/[dgee]/dgee/pnetvm/pnetvm.c
ViewVC logotype

Diff of /dgee/pnetvm/pnetvm.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2.2.1 by csmith, Mon Jun 23 16:27:58 2003 UTC revision 1.2.2.2 by csmith, Sun Jul 20 11:59:09 2003 UTC
# Line 47  extern "C" { Line 47  extern "C" {
47    
48  /* ------------------------------------------------------------------------- */  /* ------------------------------------------------------------------------- */
49    
50    static int CallStaticConstructor(ILExecThread *thread, ILMethod * method)
51    {
52            ILClass  *classInfo = ILMethod_Owner(method);
53            ILMethod *cctor     = 0;
54    
55            while((cctor = (ILMethod *)ILClassNextMemberByKind
56                    (classInfo, (ILMember *)cctor, IL_META_MEMBERKIND_METHOD)) != 0)
57            {
58                    if(ILMethod_IsStaticConstructor(cctor))
59                    {
60                            if(ILExecThreadCall(thread, cctor, NULL))
61                            {
62                                    /* An exception was thrown while executing the program */
63                                    return 1;
64                            }
65                    }
66            }
67            return 0;
68    }
69    
70    /* ------------------------------------------------------------------------- */
71    
72  int  int
73  pnetvm_entry(int argc, char *argv[])  pnetvm_entry(int argc, char *argv[])
74  {  {
# Line 63  pnetvm_entry(int argc, char *argv[]) Line 85  pnetvm_entry(int argc, char *argv[])
85          ILObject *args;          ILObject *args;
86          ILString *argString;          ILString *argString;
87          ILObject *exception;          ILObject *exception;
88            ILExecValue execValue;
89          int sawException;          int sawException;
90            int flags = 2;
91    
92          char  dgeeWSdir[128] = {0};          char  dgeeWSdir[128] = {0};
93    
# Line 87  pnetvm_entry(int argc, char *argv[]) Line 111  pnetvm_entry(int argc, char *argv[])
111          numLibraryDirs = 0;          numLibraryDirs = 0;
112                    
113          DBG( LOG_DEBUG, "ILExecProcessCreate" );          DBG( LOG_DEBUG, "ILExecProcessCreate" );
114            /* Create a process to load the program into */          /* Create a process to load the program into */
115            process = ILExecProcessCreate(stackSize, methodCachePageSize);          process = ILExecProcessCreate(stackSize, methodCachePageSize);
116    
117            if(!process)          if(!process)
118            {          {
119                    printf( "%s: could not create process\n", progname);            printf( "%s: could not create process\n", progname);
120                    return 1;            return 1;
121            }          }
122    
123            ILExecProcessSetCoderFlags(process,flags);
124    
125          sprintf( dgeeWSdir, "%s/data", dgee_repository );          sprintf( dgeeWSdir, "%s/data", dgee_repository );
126            
# Line 146  pnetvm_entry(int argc, char *argv[]) Line 172  pnetvm_entry(int argc, char *argv[])
172          if(args != 0 && !ILExecThreadHasException(thread))          if(args != 0 && !ILExecThreadHasException(thread))
173          {          {
174                  retval = 0;                  retval = 0;
175                  DBG( LOG_DEBUG, "ILExecThreadCall" );                  DBG( LOG_DEBUG, "ILExecThreadCallV" );
176                  if(ILExecThreadCall(thread, method, &resultString, args))  
177                    retval = CallStaticConstructor(thread, method);
178                    sawException = retval;
179                    execValue.ptrValue = args;
180    
181                    if( !sawException &&
182                            ILExecThreadCallV(thread, method, (ILExecValue*)&resultString, &execValue))
183                  {                  {
184                          /* An exception was thrown while executing the program */                          /* An exception was thrown while executing the program */
185                          sawException = 1;                          sawException = 1;
# Line 212  void Line 244  void
244  pnetvm_cleanup()  pnetvm_cleanup()
245  {  {
246    if( process ) {    if( process ) {
247    /* - This was PRE Threading
248      ILGCCollect();      ILGCCollect();
249          ILGCInvokeFinalizers();          ILGCInvokeFinalizers();
250    */
251    
252      ILExecProcessDestroy(process);      ILExecProcessDestroy(process);
253            ILExecDeinit();
254    }    }
255    process = NULL;    process = NULL;
256  }  }

Legend:
Removed from v.1.2.2.1  
changed lines
  Added in v.1.2.2.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26