dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[dotgnu-pnet-commits] pnet ChangeLog engine/cvm.c engine/cvm_config.h...


From: Klaus Treichel
Subject: [dotgnu-pnet-commits] pnet ChangeLog engine/cvm.c engine/cvm_config.h...
Date: Sat, 17 Jun 2006 09:24:38 +0000

CVSROOT:        /sources/dotgnu-pnet
Module name:    pnet
Changes by:     Klaus Treichel <ktreichel>      06/06/17 09:24:38

Modified files:
        .              : ChangeLog 
        engine         : cvm.c cvm_config.h cvm_except.c cvm_ptr.c 
                         cvmc.c dumpconfig.c engine.h jitc.c 
                         lib_delegate.c Makefile.am unroll.c 
Added files:
        engine         : system.c 

Log message:
        2006-06-17  Klaus Treichel  <address@hidden>
        
                * engine/cvm.c: Move the globalTraceMutex to system.c. Wrap the 
rest in
                an #ifdef IL_USE_CVM.
        
                * engine/cvm_config.h: Add include of il_config.h and wrap the 
rest in
                an #ifdef IL_USE_CVM.
        
                * engine/cvm_except.c: Move the functions in the global 
definitions to
                system.c.
        
                * engine/cvm_ptr.c: Move the function _ILSystemObjectSetField 
to system.c.
        
                * engine/cvmc.c: Wrap the contents in an #ifdef IL_USE_CVM.
        
                * engine/dumpconfig.c: Add support for dumping the jit 
configuration.
        
                * engine/engine.h: Add the prototype of 
_ILSetExceptionStackTrace.
        
                * engine/jitc.c: Add stub of _ILDumpMethodProfile.
        
                * engine/lib_delegate.c: Replace the delegate methods Invoke, 
BeginInvoke
                and EndInvoke with stubbs when built with the jit coder.
        
                * engine/Makefile.am: Add system.c to the libILEngine sources.
        
                * engine/system.c: Added with globals and functions that were 
in the cvm
                sources and are used globally.
        
                * engine/unroll.c: Wrap the contents in an #ifdef IL_USE_CVM.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pnet/ChangeLog?cvsroot=dotgnu-pnet&r1=1.3326&r2=1.3327
http://cvs.savannah.gnu.org/viewcvs/pnet/engine/cvm.c?cvsroot=dotgnu-pnet&r1=1.57&r2=1.58
http://cvs.savannah.gnu.org/viewcvs/pnet/engine/cvm_config.h?cvsroot=dotgnu-pnet&r1=1.16&r2=1.17
http://cvs.savannah.gnu.org/viewcvs/pnet/engine/cvm_except.c?cvsroot=dotgnu-pnet&r1=1.30&r2=1.31
http://cvs.savannah.gnu.org/viewcvs/pnet/engine/cvm_ptr.c?cvsroot=dotgnu-pnet&r1=1.47&r2=1.48
http://cvs.savannah.gnu.org/viewcvs/pnet/engine/cvmc.c?cvsroot=dotgnu-pnet&r1=1.47&r2=1.48
http://cvs.savannah.gnu.org/viewcvs/pnet/engine/dumpconfig.c?cvsroot=dotgnu-pnet&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/pnet/engine/engine.h?cvsroot=dotgnu-pnet&r1=1.111&r2=1.112
http://cvs.savannah.gnu.org/viewcvs/pnet/engine/jitc.c?cvsroot=dotgnu-pnet&r1=1.38&r2=1.39
http://cvs.savannah.gnu.org/viewcvs/pnet/engine/lib_delegate.c?cvsroot=dotgnu-pnet&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/pnet/engine/Makefile.am?cvsroot=dotgnu-pnet&r1=1.85&r2=1.86
http://cvs.savannah.gnu.org/viewcvs/pnet/engine/unroll.c?cvsroot=dotgnu-pnet&r1=1.17&r2=1.18
http://cvs.savannah.gnu.org/viewcvs/pnet/engine/system.c?cvsroot=dotgnu-pnet&rev=1.1

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/dotgnu-pnet/pnet/ChangeLog,v
retrieving revision 1.3326
retrieving revision 1.3327
diff -u -b -r1.3326 -r1.3327
--- ChangeLog   16 Jun 2006 09:51:23 -0000      1.3326
+++ ChangeLog   17 Jun 2006 09:24:38 -0000      1.3327
@@ -1,3 +1,34 @@
+2006-06-17  Klaus Treichel  <address@hidden>
+
+       * engine/cvm.c: Move the globalTraceMutex to system.c. Wrap the rest in
+       an #ifdef IL_USE_CVM.
+
+       * engine/cvm_config.h: Add include of il_config.h and wrap the rest in
+       an #ifdef IL_USE_CVM.
+
+       * engine/cvm_except.c: Move the functions in the global definitions to
+       system.c.
+
+       * engine/cvm_ptr.c: Move the function _ILSystemObjectSetField to 
system.c.
+
+       * engine/cvmc.c: Wrap the contents in an #ifdef IL_USE_CVM.
+
+       * engine/dumpconfig.c: Add support for dumping the jit configuration.
+
+       * engine/engine.h: Add the prototype of _ILSetExceptionStackTrace.
+
+       * engine/jitc.c: Add stub of _ILDumpMethodProfile.
+
+       * engine/lib_delegate.c: Replace the delegate methods Invoke, 
BeginInvoke
+       and EndInvoke with stubbs when built with the jit coder.
+
+       * engine/Makefile.am: Add system.c to the libILEngine sources.
+
+       * engine/system.c: Added with globals and functions that were in the cvm
+       sources and are used globally.
+
+       * engine/unroll.c: Wrap the contents in an #ifdef IL_USE_CVM.
+
 2006-06-16  Klaus Treichel  <address@hidden>
 
        * engine/lib_helpers.c: Fix RunClassConstructor. The type is passed by

Index: engine/cvm.c
===================================================================
RCS file: /sources/dotgnu-pnet/pnet/engine/cvm.c,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -b -r1.57 -r1.58
--- engine/cvm.c        16 Nov 2005 05:35:50 -0000      1.57
+++ engine/cvm.c        17 Jun 2006 09:24:38 -0000      1.58
@@ -27,6 +27,8 @@
 #include "ffi.h"
 #endif
 
+#ifdef IL_USE_CVM
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -287,11 +289,6 @@
                }
 #endif
 
-#if !defined(IL_CONFIG_REDUCE_CODE) && !defined(IL_WITHOUT_TOOLS)
-/* Global lock for trace outputs */
-ILMutex *globalTraceMutex;
-#endif
-
 /*
  * Modify the program counter and stack pointer.
  */
@@ -894,3 +891,5 @@
 #ifdef __cplusplus
 };
 #endif
+
+#endif /* IL_USE_CVM */

Index: engine/cvm_config.h
===================================================================
RCS file: /sources/dotgnu-pnet/pnet/engine/cvm_config.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- engine/cvm_config.h 13 Nov 2005 09:33:53 -0000      1.16
+++ engine/cvm_config.h 17 Jun 2006 09:24:38 -0000      1.17
@@ -21,6 +21,10 @@
 #ifndef        _ENGINE_CVM_CONFIG_H
 #define        _ENGINE_CVM_CONFIG_H
 
+#include "il_config.h"
+
+#ifdef IL_USE_CVM
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -243,4 +247,6 @@
 };
 #endif
 
+#endif /* IL_USE_CVM */
+
 #endif /* _ENGINE_CVM_CONFIG_H */

Index: engine/cvm_except.c
===================================================================
RCS file: /sources/dotgnu-pnet/pnet/engine/cvm_except.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -b -r1.30 -r1.31
--- engine/cvm_except.c 17 Jun 2004 17:38:25 -0000      1.30
+++ engine/cvm_except.c 17 Jun 2006 09:24:38 -0000      1.31
@@ -20,133 +20,7 @@
 
 #if defined(IL_CVM_GLOBALS)
 
-#if defined(IL_CONFIG_REFLECTION) && defined(IL_CONFIG_DEBUG_LINES)
-
-/*
- * Find the "stackTrace" field within "System.Exception" and then set.
- */
-static int FindAndSetStackTrace(ILExecThread *thread, ILObject *object)
-{
-       ILObject *trace;
-       ILCallFrame *callFrame;
-       ILField *field;
-
-       /* Find the "stackTrace" field within the "Exception" class */
-       field = ILExecThreadLookupField
-                       (thread, "System.Exception", "stackTrace",
-                        "[vSystem.Diagnostics.PackedStackFrame;");
-       if(field)
-       {
-               /* Push the current frame data onto the stack temporarily
-                  so that "GetExceptionStackTrace" can find it */
-               if(thread->numFrames < thread->maxFrames)
-               {
-                       callFrame = 
&(thread->frameStack[(thread->numFrames)++]);
-               }
-               else if((callFrame = _ILAllocCallFrame(thread)) == 0)
-               {
-                       /* We ran out of memory trying to push the frame */
-                       return 0;
-               }
-               callFrame->method = thread->method;
-               callFrame->pc = thread->pc;
-               callFrame->frame = thread->frame;
-               callFrame->exceptHeight = thread->exceptHeight;
-               callFrame->permissions = 0;
-
-               /* Get the stack trace and pop the frame */
-               trace = (ILObject 
*)_IL_StackFrame_GetExceptionStackTrace(thread);
-               --(thread->numFrames);
-               if(!trace)
-               {
-                       /* We ran out of memory obtaining the stack trace */
-                       return 0;
-               }
-
-               /* Write the stack trace into the object */
-               *((ILObject **)(((unsigned char *)object) + field->offset)) = 
trace;
-       }
-       return 1;
-}
-
-/*
- * Set the stack trace for an exception to the current call context.
- */
-void _ILSetExceptionStackTrace(ILExecThread *thread, ILObject *object)
-{
-       ILClass *classInfo;
-       if(!object)
-       {
-               return;
-       }
-       classInfo = ILExecThreadLookupClass(thread, "System.Exception");
-       if(!classInfo)
-       {
-               return;
-       }
-       if(!ILClassInheritsFrom(GetObjectClass(object), classInfo))
-       {
-               return;
-       }
-       if(!FindAndSetStackTrace(thread, object))
-       {
-               /* We ran out of memory while allocating the stack trace,
-                  but it isn't serious: we can just throw without the trace */
-               thread->thrownException = 0;
-       }
-}
-
-#else  /* !(IL_CONFIG_REFLECTION && IL_CONFIG_DEBUG_LINES) */
-
-/*
- * Set the stack trace for an exception to the current call context.
- */
-void _ILSetExceptionStackTrace(ILExecThread *thread, ILObject *object)
-{
-       /* Nothing to do here */
-}
-
-#endif /* !(IL_CONFIG_REFLECTION && IL_CONFIG_DEBUG_LINES) */
-
-void *_ILSystemExceptionWithClass(ILExecThread *thread, ILClass *classInfo)
-{
-       ILObject *object;
-       
-       object = _ILEngineAllocObject(thread, classInfo);
-       if(object)
-       {
-#if defined(IL_CONFIG_REFLECTION) && defined(IL_CONFIG_DEBUG_LINES)
-               if(!FindAndSetStackTrace(thread, object))
-               {
-                       /* We ran out of memory: pick up the 
"OutOfMemoryException" */
-                       object = thread->thrownException;
-                       thread->thrownException = 0;
-               }
-#endif /* IL_CONFIG_REFLECTION && IL_CONFIG_DEBUG_LINES */
-       }
-       else
-       {
-               /* The system ran out of memory, so copy the 
"OutOfMemoryException" */
-               object = thread->thrownException;
-               thread->thrownException = 0;
-       }
-       return object;
-}
-
-void *_ILSystemException(ILExecThread *thread, const char *className)
-{
-       ILClass *classInfo = ILExecThreadLookupClass(thread, className);
-       if(!classInfo)
-       {
-       #ifndef REDUCED_STDIO
-               /* Huh?  The required class doesn't exist.  This shouldn't 
happen */
-               fprintf(stderr, "Fatal error: %s is missing from the system 
library\n",
-                               className);
-               exit(1);
-       #endif
-       }
-       return _ILSystemExceptionWithClass(thread, classInfo);
-}
+/* Moved to system.c */
 
 #elif defined(IL_CVM_LOCALS)
 

Index: engine/cvm_ptr.c
===================================================================
RCS file: /sources/dotgnu-pnet/pnet/engine/cvm_ptr.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -b -r1.47 -r1.48
--- engine/cvm_ptr.c    18 Oct 2005 19:00:57 -0000      1.47
+++ engine/cvm_ptr.c    17 Jun 2006 09:24:38 -0000      1.48
@@ -44,27 +44,6 @@
        }
 }
 
-
-int _ILSystemObjectSetField(ILExecThread *thread, ILObject* obj,
-                                                       const char *fieldName, 
const char *signature,
-                                                       ILObject *value)
-{
-       ILField *field;
-       ILClass *classInfo = GetObjectClass(obj);
-
-       field = ILExecThreadLookupFieldInClass(thread, classInfo, fieldName, 
signature);
-
-       if (field == 0)
-       {
-               return -1;
-       }
-
-       *(((ILObject **)(((char *)obj) + field->offset))) = value;
-
-       return 0;
-}
-
-
 #ifdef IL_CONFIG_FP_SUPPORTED
 
 /*

Index: engine/cvmc.c
===================================================================
RCS file: /sources/dotgnu-pnet/pnet/engine/cvmc.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -b -r1.47 -r1.48
--- engine/cvmc.c       23 Aug 2005 10:45:52 -0000      1.47
+++ engine/cvmc.c       17 Jun 2006 09:24:38 -0000      1.48
@@ -33,6 +33,8 @@
 #include "ffi.h"
 #endif
 
+#ifdef IL_USE_CVM
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -479,3 +481,6 @@
 #ifdef __cplusplus
 };
 #endif
+
+#endif /* IL_USE_CVM */
+

Index: engine/dumpconfig.c
===================================================================
RCS file: /sources/dotgnu-pnet/pnet/engine/dumpconfig.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- engine/dumpconfig.c 5 Dec 2005 10:13:16 -0000       1.5
+++ engine/dumpconfig.c 17 Jun 2006 09:24:38 -0000      1.6
@@ -62,7 +62,12 @@
        struct utsname buf;
 #endif
        PrintFormatted(stream,"Engine Version",VERSION);
+#ifdef IL_USE_CVM
        PrintFormatted(stream,"Engine Flavour",IL_CVM_FLAVOUR);
+#endif
+#ifdef IL_USE_JIT
+       PrintFormatted(stream,"Engine Flavour", "just in time compiler");
+#endif
 
 #ifdef HAVE_UNAME
        if(uname(&buf)==0)
@@ -81,6 +86,7 @@
        #endif
 #endif
 
+#ifdef IL_USE_CVM
 #ifdef HAVE_COMPUTED_GOTO
        #ifdef HAVE_PIC_COMPUTED_GOTO
                PrintFormatted(stream,"Computed Goto","Yes (PIC)");
@@ -140,6 +146,7 @@
                PrintFormatted(stream,"Manual Register Allocation","No");
        #endif
        }
+#endif
 
 #ifdef HAVE_LIBGC
        PrintFormatted(stream,"Garbage Collector","Boehm");

Index: engine/engine.h
===================================================================
RCS file: /sources/dotgnu-pnet/pnet/engine/engine.h,v
retrieving revision 1.111
retrieving revision 1.112
diff -u -b -r1.111 -r1.112
--- engine/engine.h     22 Feb 2006 19:50:50 -0000      1.111
+++ engine/engine.h     17 Jun 2006 09:24:38 -0000      1.112
@@ -852,6 +852,11 @@
                                                           ILObject *value);
 
 /*
+ * Set the stack trace for an exception to the current call context.
+ */
+void _ILSetExceptionStackTrace(ILExecThread *thread, ILObject *object);
+
+/*
  * Create a system exception object of a particular class.
  * We do this very carefully, to avoid re-entering the engine.
  * We cannot call the exception's constructor, so we do the

Index: engine/jitc.c
===================================================================
RCS file: /sources/dotgnu-pnet/pnet/engine/jitc.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -b -r1.38 -r1.39
--- engine/jitc.c       11 Jun 2006 15:17:15 -0000      1.38
+++ engine/jitc.c       17 Jun 2006 09:24:38 -0000      1.39
@@ -3434,6 +3434,19 @@
        return 0;
 }
 
+#if !defined(IL_CONFIG_REDUCE_CODE) && !defined(IL_WITHOUT_TOOLS)
+
+/*
+ * Dump method profile information.
+ */
+int _ILDumpMethodProfile(FILE *stream, ILExecProcess *process)
+{
+       /* TODO */
+       return 0;
+}
+
+#endif /* !IL_CONFIG_REDUCE_CODE */
+
 #include "jitc_diag.c"
 #include "jitc_locals.c"
 #include "jitc_labels.c"

Index: engine/lib_delegate.c
===================================================================
RCS file: /sources/dotgnu-pnet/pnet/engine/lib_delegate.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- engine/lib_delegate.c       1 Oct 2005 18:36:54 -0000       1.14
+++ engine/lib_delegate.c       17 Jun 2006 09:24:38 -0000      1.15
@@ -175,6 +175,7 @@
        return _this;
 }
 
+#ifdef IL_USE_CVM
 /*
  * Parameter information for delegate invocation.
  */
@@ -554,6 +555,38 @@
        thread->stackTop = stackTop;
 }
 
+#endif /* IL_USE_CVM */
+
+#ifdef IL_USE_JIT
+
+/*
+ * public Type Invoke(...);
+ */
+static void Delegate_Invoke(ILExecThread *thread,
+                                                       void *result,
+                                                       ILObject *_this)
+{
+       /* This is a dummy because the real function is generated by the */
+       /* jit coder. */
+}
+
+static ILObject *Delegate_BeginInvoke(ILExecThread *thread, ILObject *_this)
+{      
+       /* This is a dummy because the real function is generated by the */
+       /* jit coder. */
+       return 0;
+}
+
+static void Delegate_EndInvoke(ILExecThread *thread,
+                                                       void *result,
+                                                       ILObject *_this)
+{
+       /* This is a dummy because the real function is generated by the */
+       /* jit coder. */
+}
+
+#endif /* IL_USE_JIT */
+
 #if !defined(HAVE_LIBFFI)
 
 /*

Index: engine/Makefile.am
===================================================================
RCS file: /sources/dotgnu-pnet/pnet/engine/Makefile.am,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -b -r1.85 -r1.86
--- engine/Makefile.am  18 May 2006 19:34:31 -0000      1.85
+++ engine/Makefile.am  17 Jun 2006 09:24:38 -0000      1.86
@@ -144,6 +144,7 @@
                                                pinvoke.c \
                                                process.c \
                                                register.c \
+                                               system.c \
                                                thread.c \
                                                throw.c \
                                                unroll.c \

Index: engine/unroll.c
===================================================================
RCS file: /sources/dotgnu-pnet/pnet/engine/unroll.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- engine/unroll.c     15 Dec 2005 09:25:40 -0000      1.17
+++ engine/unroll.c     17 Jun 2006 09:24:38 -0000      1.18
@@ -26,6 +26,8 @@
 #include "il_dumpasm.h"
 #include "lib_defs.h"
 
+#ifdef IL_USE_CVM
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -1679,3 +1681,5 @@
 #ifdef __cplusplus
 };
 #endif
+
+#endif /* IL_USE_CVM */

Index: engine/system.c
===================================================================
RCS file: engine/system.c
diff -N engine/system.c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ engine/system.c     17 Jun 2006 09:24:38 -0000      1.1
@@ -0,0 +1,193 @@
+/*
+ * system.c - functions and objects used by the runtime.
+ *
+ * Copyright (C) 2001  Southern Storm Software, Pty Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include "engine_private.h"
+#include "lib_defs.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if !defined(IL_CONFIG_REDUCE_CODE) && !defined(IL_WITHOUT_TOOLS)
+/* Global lock for trace outputs */
+ILMutex *globalTraceMutex;
+#endif
+
+#if defined(IL_CONFIG_REFLECTION) && defined(IL_CONFIG_DEBUG_LINES)
+
+/*
+ * Find the "stackTrace" field within "System.Exception" and then set.
+ */
+static int FindAndSetStackTrace(ILExecThread *thread, ILObject *object)
+{
+       ILField *field;
+
+       /* Find the "stackTrace" field within the "Exception" class */
+       field = ILExecThreadLookupField
+                       (thread, "System.Exception", "stackTrace",
+                        "[vSystem.Diagnostics.PackedStackFrame;");
+       if(field)
+       {
+#ifdef IL_USE_CVM
+               ILObject *trace;
+               ILCallFrame *callFrame;
+
+               /* Push the current frame data onto the stack temporarily
+                  so that "GetExceptionStackTrace" can find it */
+               if(thread->numFrames < thread->maxFrames)
+               {
+                       callFrame = 
&(thread->frameStack[(thread->numFrames)++]);
+               }
+               else if((callFrame = _ILAllocCallFrame(thread)) == 0)
+               {
+                       /* We ran out of memory trying to push the frame */
+                       return 0;
+               }
+               callFrame->method = thread->method;
+               callFrame->pc = thread->pc;
+               callFrame->frame = thread->frame;
+               callFrame->exceptHeight = thread->exceptHeight;
+               callFrame->permissions = 0;
+
+               /* Get the stack trace and pop the frame */
+               trace = (ILObject 
*)_IL_StackFrame_GetExceptionStackTrace(thread);
+               --(thread->numFrames);
+               if(!trace)
+               {
+                       /* We ran out of memory obtaining the stack trace */
+                       return 0;
+               }
+
+               /* Write the stack trace into the object */
+               *((ILObject **)(((unsigned char *)object) + field->offset)) = 
trace;
+#endif
+#ifdef IL_USE_JIT
+               System_Array *trace;
+
+               trace = _ILJitGetExceptionStackTrace(thread);
+
+               /* Write the stack trace into the object */
+               *((System_Array **)(((unsigned char *)object) + field->offset)) 
= trace;
+#endif
+       }
+       return 1;
+}
+
+/*
+ * Set the stack trace for an exception to the current call context.
+ */
+void _ILSetExceptionStackTrace(ILExecThread *thread, ILObject *object)
+{
+       ILClass *classInfo;
+       if(!object)
+       {
+               return;
+       }
+       classInfo = ILExecThreadLookupClass(thread, "System.Exception");
+       if(!classInfo)
+       {
+               return;
+       }
+       if(!ILClassInheritsFrom(GetObjectClass(object), classInfo))
+       {
+               return;
+       }
+       if(!FindAndSetStackTrace(thread, object))
+       {
+               /* We ran out of memory while allocating the stack trace,
+                  but it isn't serious: we can just throw without the trace */
+               thread->thrownException = 0;
+       }
+}
+
+#else  /* !(IL_CONFIG_REFLECTION && IL_CONFIG_DEBUG_LINES) */
+
+/*
+ * Set the stack trace for an exception to the current call context.
+ */
+void _ILSetExceptionStackTrace(ILExecThread *thread, ILObject *object)
+{
+       /* Nothing to do here */
+}
+
+#endif /* !(IL_CONFIG_REFLECTION && IL_CONFIG_DEBUG_LINES) */
+
+void *_ILSystemExceptionWithClass(ILExecThread *thread, ILClass *classInfo)
+{
+       ILObject *object;
+       
+       object = _ILEngineAllocObject(thread, classInfo);
+       if(object)
+       {
+#if defined(IL_CONFIG_REFLECTION) && defined(IL_CONFIG_DEBUG_LINES)
+               if(!FindAndSetStackTrace(thread, object))
+               {
+                       /* We ran out of memory: pick up the 
"OutOfMemoryException" */
+                       object = thread->thrownException;
+                       thread->thrownException = 0;
+               }
+#endif /* IL_CONFIG_REFLECTION && IL_CONFIG_DEBUG_LINES */
+       }
+       else
+       {
+               /* The system ran out of memory, so copy the 
"OutOfMemoryException" */
+               object = thread->thrownException;
+               thread->thrownException = 0;
+       }
+       return object;
+}
+
+void *_ILSystemException(ILExecThread *thread, const char *className)
+{
+       ILClass *classInfo = ILExecThreadLookupClass(thread, className);
+       if(!classInfo)
+       {
+       #ifndef REDUCED_STDIO
+               /* Huh?  The required class doesn't exist.  This shouldn't 
happen */
+               fprintf(stderr, "Fatal error: %s is missing from the system 
library\n",
+                               className);
+               exit(1);
+       #endif
+       }
+       return _ILSystemExceptionWithClass(thread, classInfo);
+}
+
+int _ILSystemObjectSetField(ILExecThread *thread, ILObject* obj,
+                                                       const char *fieldName, 
const char *signature,
+                                                       ILObject *value)
+{
+       ILField *field;
+       ILClass *classInfo = GetObjectClass(obj);
+
+       field = ILExecThreadLookupFieldInClass(thread, classInfo, fieldName, 
signature);
+
+       if(field == 0)
+       {
+               return -1;
+       }
+
+       *(((ILObject **)(((char *)obj) + field->offset))) = value;
+
+       return 0;
+}
+
+#ifdef __cplusplus
+};
+#endif




reply via email to

[Prev in Thread] Current Thread [Next in Thread]