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/jitc.c engine/jitc.h en...


From: Klaus Treichel
Subject: [dotgnu-pnet-commits] pnet ./ChangeLog engine/jitc.c engine/jitc.h en...
Date: Sun, 05 Feb 2006 16:20:29 +0000

CVSROOT:        /cvsroot/dotgnu-pnet
Module name:    pnet
Branch:         
Changes by:     Klaus Treichel <address@hidden> 06/02/05 16:20:28

Modified files:
        .              : ChangeLog 
        engine         : jitc.c jitc.h jitc_call.c jitc_obj.c 
                         jitc_setup.c lib_helpers.c 

Log message:
        2006-02-05  Klaus Treichel  <address@hidden>
        
        * engine/jitc.h: Add jit function metadata index IL_JIT_META_METHODNAME 
for
        the complete methodname.
        
        * engine/jitc.c: Fix a bug in the ALLOC_STACK macro. Add support for
        setting and getting the methodname in/from the jit functions metadata.
        Add the function names to the native calls for debugging purposes.
        
        * engine/jitc_call.c: Add the function names to native calls for 
debugging
        purposes. Add the complete method name to the jit_insn_call.
        
        * engine/jitc_obj.c: Add function names to the native calls. Add some
        debugging output when ilrun is invoked with -Z.
        
        * engine/jitc_setup.c: Add the dumping of the jitted methods in
        JITCoder_Finish.
        
        * engine/lib_helpers.c: In the jitted code the handle is passed by value
        and not by reference in _IL_RuntimeHelpers_InitializeArray. Removed the
        check of the callers image because the stack methods are not done yet.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/dotgnu-pnet/pnet/ChangeLog.diff?tr1=1.3282&tr2=1.3283&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/dotgnu-pnet/pnet/engine/jitc.c.diff?tr1=1.15&tr2=1.16&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/dotgnu-pnet/pnet/engine/jitc.h.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/dotgnu-pnet/pnet/engine/jitc_call.c.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/dotgnu-pnet/pnet/engine/jitc_obj.c.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/dotgnu-pnet/pnet/engine/jitc_setup.c.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/dotgnu-pnet/pnet/engine/lib_helpers.c.diff?tr1=1.10&tr2=1.11&r1=text&r2=text

Patches:
Index: pnet/ChangeLog
diff -u pnet/ChangeLog:1.3282 pnet/ChangeLog:1.3283
--- pnet/ChangeLog:1.3282       Fri Feb  3 06:39:23 2006
+++ pnet/ChangeLog      Sun Feb  5 16:20:28 2006
@@ -1,3 +1,25 @@
+2006-02-05  Klaus Treichel  <address@hidden>
+
+       * engine/jitc.h: Add jit function metadata index IL_JIT_META_METHODNAME 
for
+       the complete methodname.
+
+       * engine/jitc.c: Fix a bug in the ALLOC_STACK macro. Add support for
+       setting and getting the methodname in/from the jit functions metadata.
+       Add the function names to the native calls for debugging purposes.
+
+       * engine/jitc_call.c: Add the function names to native calls for 
debugging
+       purposes. Add the complete method name to the jit_insn_call.
+
+       * engine/jitc_obj.c: Add function names to the native calls. Add some
+       debugging output when ilrun is invoked with -Z.
+
+       * engine/jitc_setup.c: Add the dumping of the jitted methods in
+       JITCoder_Finish.
+
+       * engine/lib_helpers.c: In the jitted code the handle is passed by value
+       and not by reference in _IL_RuntimeHelpers_InitializeArray. Removed the
+       check of the callers image because the stack methods are not done yet.
+
 2006-02-03  Peter Flaig  <address@hidden>
 
        * support/time.c: fixed getting offset to UTC time if timezone was 
changed
Index: pnet/engine/jitc.c
diff -u pnet/engine/jitc.c:1.15 pnet/engine/jitc.c:1.16
--- pnet/engine/jitc.c:1.15     Sat Jan 28 15:07:09 2006
+++ pnet/engine/jitc.c  Sun Feb  5 16:20:28 2006
@@ -37,6 +37,40 @@
 #endif
 
 /*
+ * For enabling extended debugging output uncomment the following define.
+ */
+/* #define _IL_JIT_ENABLE_DEBUG 1 */
+
+/*
+ * For dumping the jitted function before it is compiled uncomment the
+ * following define.
+ */
+/* #define _IL_JIT_DUMP_FUNCTION 1 */
+
+/*
+ * For dumping the disassembled jitted function before after  it is compiled
+ *  uncomment the following define.
+ */
+/* #define _IL_JIT_DISASSEMBLE_FUNCTION 1 */
+
+
+#ifdef _IL_JIT_DUMP_FUNCTION
+#ifndef _IL_JIT_ENABLE_DEBUG
+#define _IL_JIT_ENABLE_DEBUG 1
+#endif
+#endif
+
+#ifdef _IL_JIT_DISASSEMBLE_FUNCTION
+#ifndef _IL_JIT_ENABLE_DEBUG
+#define _IL_JIT_ENABLE_DEBUG 1
+#endif
+#endif
+
+#ifdef _IL_JIT_ENABLE_DEBUG
+#include "jit/jit-dump.h"
+#endif
+
+/*
  * Mapping of the native clr types to the corresponing jit types.
  */
 static struct _tagILJitTypes _ILJitType_VOID;
@@ -123,6 +157,7 @@
        int                     labelType;      /* type of the label. */
 };
 
+
 /*
  * Define the structure of a JIT coder's instance block.
  */
@@ -184,17 +219,17 @@
  */
 #define        ALLOC_STACK(coder, n)   \
                        do { \
-                               if(n > (coder)->stackSize) \
+                               if((n) > (coder)->stackSize) \
                                { \
                                        ILJitValue *newStack = \
                                                (ILJitValue 
*)ILRealloc((coder)->jitStack, \
-                                                                               
          n * sizeof(ILJitValue)); \
+                                                                               
          (n) * sizeof(ILJitValue)); \
                                        if(!newStack) \
                                        { \
                                                return 0; \
                                        } \
                                        (coder)->jitStack = newStack; \
-                                       (coder)->stackSize = n; \
+                                       (coder)->stackSize = (n); \
                                } \
                        } while (0)
 
@@ -224,6 +259,102 @@
 }
 
 /*
+ * Function to free the metadata attached to a jit_function_t.
+ */
+static void _ILJitMetaFreeFunc(void *data)
+{
+       if(data)
+       {
+               ILFree(data);
+       }
+}
+
+#if !defined(IL_CONFIG_REDUCE_CODE) && !defined(IL_WITHOUT_TOOLS) && 
defined(_IL_JIT_ENABLE_DEBUG)
+/*
+ * Get a complete methodname.
+ * The string returned must be freed by the caller.
+ */
+static char *_ILJitGetMethodName(ILMethod *method)
+{
+       const char *methodName = ILMethod_Name(method);
+       const char *className = ILClass_Name(ILMethod_Owner(method));
+       const char *namespaceName = ILClass_Namespace(ILMethod_Owner(method));
+       int namespaceLen = 0;
+       int classLen = 0;
+       int methodLen = 0;
+       int len = 0;
+       char *fullName = 0;
+
+       if(namespaceName)
+       {
+               namespaceLen = strlen(namespaceName);
+               len += namespaceLen + 1;
+       }
+       if(className)
+       {
+               classLen = strlen(className);
+               len += classLen + 1;
+       }
+       if(methodName)
+       {
+               methodLen = strlen(methodName);
+               len += methodLen;
+       }
+       if(len)
+       {
+               int pos = 0;
+
+               if(!(fullName = ILMalloc(len + 1)))
+               {
+                       return 0;
+               }
+               if(namespaceName)
+               {
+                       strcpy(fullName, namespaceName);
+                       pos = namespaceLen;
+                       fullName[pos] = '.';
+                       pos++;
+               }
+               if(className)
+               {
+                       strcpy(fullName + pos, className);
+                       pos += classLen;
+                       fullName[pos] = '.';
+                       pos++;
+               }
+               if(methodName)
+               {
+                       strcpy(fullName + pos, methodName);
+                       pos += methodLen;
+               }
+       }
+       return fullName;
+}
+
+/*
+ * Set the full methodname in the functions metadata.
+ */
+static void _ILJitFunctionSetMethodName(ILJitFunction func, ILMethod *method)
+{
+       char *methodName = _ILJitGetMethodName(method);
+
+       if(methodName)
+       {
+               jit_function_set_meta(func, IL_JIT_META_METHODNAME, methodName,
+                                                         _ILJitMetaFreeFunc, 
0);
+       }
+}
+
+/*
+ * Get the full methodname from the jit functions metadata.
+ */
+static char *_ILJitFunctionGetMethodName(ILJitFunction func)
+{
+       return (char *)jit_function_get_meta(func, IL_JIT_META_METHODNAME);
+}
+#endif
+
+/*
  * Destroy every ILJitType in a ILJitTypes  structure 
  */
 void ILJitTypesDestroy(ILJitTypes *jitTypes)
@@ -1047,7 +1178,14 @@
        ILJitType signature = jit_function_get_signature(func);
        unsigned int numParams = jit_type_num_params(signature);
        ILJitValue returnValue;
+       char *methodName = 0;
 
+#if !defined(IL_CONFIG_REDUCE_CODE) && !defined(IL_WITHOUT_TOOLS) && 
defined(_IL_JIT_ENABLE_DEBUG)
+       methodName = _ILJitFunctionGetMethodName(func);
+       ILMutexLock(globalTraceMutex);
+       fprintf(stdout, "CompileInternalMethod: %s\n", methodName);
+       ILMutexUnlock(globalTraceMutex);
+#endif
        /* We need to set the method member in the ILExecThread == arg[0]. */
        if(numParams > 0)
        {
@@ -1062,11 +1200,11 @@
                        }
                }
                _ILJitSetMethodInThread(func, jitParams[0], method);
-               returnValue = jit_insn_call_native(func, 0, nativeFunction, 
signature, jitParams, numParams, 0);
+               returnValue = jit_insn_call_native(func, methodName, 
nativeFunction, signature, jitParams, numParams, 0);
        }
        else
        {
-               returnValue = jit_insn_call_native(func, 0, nativeFunction, 
signature, 0, 0, 0);
+               returnValue = jit_insn_call_native(func, methodName, 
nativeFunction, signature, 0, 0, 0);
        }
        jit_insn_return(func, returnValue);     
        return JIT_RESULT_OK;
@@ -1394,6 +1532,9 @@
        /* and link the new jitFunction to the method. */
        method->userData = jitFunction;
 
+#if !defined(IL_CONFIG_REDUCE_CODE) && !defined(IL_WITHOUT_TOOLS) && 
defined(_IL_JIT_ENABLE_DEBUG)
+       _ILJitFunctionSetMethodName(jitFunction, method);
+#endif
        /* are we ready now ? */
 
        return 1;
@@ -1462,6 +1603,9 @@
        /* and link the new jitFunction to the method. */
        method->userData = jitFunction;
 
+#if !defined(IL_CONFIG_REDUCE_CODE) && !defined(IL_WITHOUT_TOOLS) && 
defined(_IL_JIT_ENABLE_DEBUG)
+       _ILJitFunctionSetMethodName(jitFunction, method);
+#endif
        /* are we ready now ? */
 
        return 1;
Index: pnet/engine/jitc.h
diff -u pnet/engine/jitc.h:1.7 pnet/engine/jitc.h:1.8
--- pnet/engine/jitc.h:1.7      Mon Jan  9 20:49:47 2006
+++ pnet/engine/jitc.h  Sun Feb  5 16:20:28 2006
@@ -50,6 +50,11 @@
  */
 #define IL_JIT_META_METHOD 1
 
+/*
+ * Definitions of method metadata only set when the coder is built with
+ * extended debugging.
+ */
+#define IL_JIT_META_METHODNAME 1001
 
 /*
  * Defaut calling convention for libjit.
Index: pnet/engine/jitc_call.c
diff -u pnet/engine/jitc_call.c:1.7 pnet/engine/jitc_call.c:1.8
--- pnet/engine/jitc_call.c:1.7 Sat Jan 28 15:07:10 2006
+++ pnet/engine/jitc_call.c     Sun Feb  5 16:20:28 2006
@@ -52,9 +52,10 @@
                                                                                
                jit_type_void_ptr, (jit_nint)info);
        args[2] = jit_value_create_nint_constant(coder->jitFunction,
                                                                                
                jit_type_int, objSize);
-       newObj = jit_insn_call_native(coder->jitFunction, 0, _ILEngineAlloc,
-                                                                       
_ILJitSignature_ILEngineAlloc, args, 3,
-                                                                       
JIT_CALL_NOTHROW);
+       newObj = jit_insn_call_native(coder->jitFunction, "_ILEngineAlloc",
+                                                                 
_ILEngineAlloc,
+                                                                 
_ILJitSignature_ILEngineAlloc, args, 3,
+                                                                 
JIT_CALL_NOTHROW);
        jit_insn_branch_if(coder->jitFunction, newObj, &label1);
        _ILJitThrowCurrentException(coder);
        jit_insn_label(coder->jitFunction, &label1);
@@ -148,6 +149,7 @@
        int argCount = info->numBaseArgs + info->numVarArgs;
        ILJitValue jitParams[argCount + 1];
        ILJitValue returnValue;
+       char *methodName = 0;
 
 #if !defined(IL_CONFIG_REDUCE_CODE) && !defined(IL_WITHOUT_TOOLS)
        if (jitCoder->flags & IL_CODER_FLAG_STATS)
@@ -171,7 +173,7 @@
                jitFunction = ILJitFunctionFromILMethod(methodInfo);
        }
 
-#if !defined(IL_CONFIG_REDUCE_CODE) && !defined(IL_WITHOUT_TOOLS)
+#if !defined(IL_CONFIG_REDUCE_CODE) && !defined(IL_WITHOUT_TOOLS) && 
defined(_IL_JIT_ENABLE_DEBUG)
        if (jitCoder->flags & IL_CODER_FLAG_STATS)
        {
                ILJitType  signature  = jit_function_get_signature(jitFunction);
@@ -182,7 +184,7 @@
                        jitCoder->stackTop,
                        argCount,
                        jit_type_num_params(signature));
-                       ILMutexUnlock(globalTraceMutex);
+               ILMutexUnlock(globalTraceMutex);
        }
 #endif
        /* Output a call to the static constructor */
@@ -194,9 +196,13 @@
        _ILJitFillArguments(jitCoder, &(jitParams[1]), info);
        /* TODO: create call signature for vararg calls. */     
                
+#if !defined(IL_CONFIG_REDUCE_CODE) && !defined(IL_WITHOUT_TOOLS) && 
defined(_IL_JIT_ENABLE_DEBUG)
+       methodName = _ILJitFunctionGetMethodName(jitFunction);
+#endif
        if(info->tailCall == 1)
        {
-               returnValue = jit_insn_call(jitCoder->jitFunction, 0, 
jitFunction, 0,
+               returnValue = jit_insn_call(jitCoder->jitFunction, methodName,
+                                                                       
jitFunction, 0,
                                                                        
jitParams, argCount + 1, JIT_CALL_TAIL);
                if(returnItem->engineType != ILEngineType_Invalid)
                {
@@ -208,7 +214,8 @@
        }
        else
        {               
-               returnValue = jit_insn_call(jitCoder->jitFunction, 0, 
jitFunction, 0,
+               returnValue = jit_insn_call(jitCoder->jitFunction, methodName,
+                                                                       
jitFunction, 0,
                                                                        
jitParams, argCount + 1, 0);
                if(returnItem && returnItem->engineType != ILEngineType_Invalid)
                {
@@ -237,6 +244,7 @@
        int argCount = info->numBaseArgs + info->numVarArgs;
        ILJitValue jitParams[argCount + 2];
        ILJitValue returnValue;
+       char *methodName = 0;
        
 #if !defined(IL_CONFIG_REDUCE_CODE) && !defined(IL_WITHOUT_TOOLS)
        if (jitCoder->flags & IL_CODER_FLAG_STATS)
@@ -246,7 +254,7 @@
                        "CallCtor: %s.%s\n", 
                        ILClass_Name(ILMethod_Owner(methodInfo)),
                        ILMethod_Name(methodInfo));
-                       ILMutexUnlock(globalTraceMutex);
+               ILMutexUnlock(globalTraceMutex);
        }
 #endif
 
@@ -261,6 +269,7 @@
        }
 
 #if !defined(IL_CONFIG_REDUCE_CODE) && !defined(IL_WITHOUT_TOOLS)
+#if defined(_IL_JIT_ENABLE_DEBUG)
        if (jitCoder->flags & IL_CODER_FLAG_STATS)
        {
                ILJitType  signature  = jit_function_get_signature(jitFunction);
@@ -271,8 +280,10 @@
                        jitCoder->stackTop,
                        argCount,
                        jit_type_num_params(signature));
-                       ILMutexUnlock(globalTraceMutex);
+               ILMutexUnlock(globalTraceMutex);
        }
+       methodName = _ILJitFunctionGetMethodName(jitFunction);
+#endif
 #endif
        /* Output a call to the static constructor */
        _ILJitCallStaticConstructor(jitCoder, ILMethod_Owner(methodInfo), 1);
@@ -294,7 +305,8 @@
                _ILJitFillArguments(jitCoder, &(jitParams[2]), info);
 
                // call the constructor with jitParams as input
-               returnValue = jit_insn_call(jitCoder->jitFunction, 0, 
jitFunction, 0,
+               returnValue = jit_insn_call(jitCoder->jitFunction, methodName,
+                                                                       
jitFunction, 0,
                                                                        
jitParams, argCount + 2, 0);
                jitCoder->jitStack[jitCoder->stackTop] = jitParams[1];
        }       
@@ -331,7 +343,7 @@
                        ILClass_Name(ILMethod_Owner(methodInfo)),
                        ILMethod_Name(methodInfo),
                        methodInfo->index);
-                       ILMutexUnlock(globalTraceMutex);
+               ILMutexUnlock(globalTraceMutex);
        }
 #endif
 
@@ -353,7 +365,7 @@
        {
                signature = jit_function_get_signature(func);
        }
-#if !defined(IL_CONFIG_REDUCE_CODE) && !defined(IL_WITHOUT_TOOLS)
+#if !defined(IL_CONFIG_REDUCE_CODE) && !defined(IL_WITHOUT_TOOLS) && 
defined(_IL_JIT_ENABLE_DEBUG)
        if (jitCoder->flags & IL_CODER_FLAG_STATS)
        {
                ILMutexLock(globalTraceMutex);
@@ -362,7 +374,7 @@
                        jitCoder->stackTop,
                        argCount,
                        jit_type_num_params(signature));
-                       ILMutexUnlock(globalTraceMutex);
+               ILMutexUnlock(globalTraceMutex);
        }
 #endif
        jitParams[0] = jit_value_get_param(jitCoder->jitFunction, 0);
@@ -422,6 +434,14 @@
        ILJitValue args[3];
        jit_label_t label = jit_label_undefined;
 
+       if(!func)
+       {
+               signature = _ILJitCreateMethodSignature(jitCoder, methodInfo);
+       }
+       else
+       {
+               signature = jit_function_get_signature(func);
+       }
 #if !defined(IL_CONFIG_REDUCE_CODE) && !defined(IL_WITHOUT_TOOLS)
        if (jitCoder->flags & IL_CODER_FLAG_STATS)
        {
@@ -431,18 +451,21 @@
                        ILClass_Name(ILMethod_Owner(methodInfo)),
                        ILMethod_Name(methodInfo),
                        methodInfo->index);
-                       ILMutexUnlock(globalTraceMutex);
-       }
-#endif
-
-       if(!func)
-       {
-               signature = _ILJitCreateMethodSignature(jitCoder, methodInfo);
+               ILMutexUnlock(globalTraceMutex);
        }
-       else
+#if defined(_IL_JIT_ENABLE_DEBUG)
+       if (jitCoder->flags & IL_CODER_FLAG_STATS)
        {
-               signature = jit_function_get_signature(func);
+               ILMutexLock(globalTraceMutex);
+               fprintf(stdout,
+                       "CallInfos: StackTop: %i, ArgCount: %i, Signature 
argCount: %i\n",
+                       jitCoder->stackTop,
+                       argCount,
+                       jit_type_num_params(signature));
+               ILMutexUnlock(globalTraceMutex);
        }
+#endif
+#endif
        jitParams[0] = jit_value_get_param(jitCoder->jitFunction, 0);
        _ILJitFillArguments(jitCoder, &(jitParams[1]), info);
        /* TODO: handle varargs here and create a call signature. */
@@ -458,10 +481,11 @@
        args[0] = classPrivate;
        args[1] = interfaceClass;
        args[2] = methodIndex;
-       jitFunction = jit_insn_call_native(jitCoder->jitFunction, 0,
+       jitFunction = jit_insn_call_native(jitCoder->jitFunction,
+                                                                          
"_ILRuntimeLookupInterfaceMethod",
                                                                           
_ILRuntimeLookupInterfaceMethod,
                                                                           
_ILJitSignature_ILRuntimeLookupInterfaceMethod,
-                                                                          
args, 3, 0);
+                                                                          
args, 3, JIT_CALL_NOTHROW);
        jit_insn_branch_if(jitCoder->jitFunction, jitFunction, &label);
        /* TODO: raise a MissingMethodException here. */
 
Index: pnet/engine/jitc_obj.c
diff -u pnet/engine/jitc_obj.c:1.9 pnet/engine/jitc_obj.c:1.10
--- pnet/engine/jitc_obj.c:1.9  Sat Jan 28 15:07:10 2006
+++ pnet/engine/jitc_obj.c      Sun Feb  5 16:20:28 2006
@@ -471,10 +471,35 @@
 
        if(valueType == ILEngineType_TypedRef)
        {
+#if !defined(IL_CONFIG_REDUCE_CODE) && !defined(IL_WITHOUT_TOOLS)
+               if (jitCoder->flags & IL_CODER_FLAG_STATS)
+               {
+                       ILMutexLock(globalTraceMutex);
+                       fprintf(stdout,
+                               "BoxTypedRef: %s Size: %i\n", 
+                               ILClass_Name(boxClass),
+                               size);
+                       ILMutexUnlock(globalTraceMutex);
+               }
+#endif
                /* We have to unpack the value first. */        
                ILJitValue ptr = _ILJitGetValFromRef(jitCoder, value, boxClass);
                value = jit_insn_load_relative(jitCoder->jitFunction, ptr, 0, 
jitType);
        }
+#if !defined(IL_CONFIG_REDUCE_CODE) && !defined(IL_WITHOUT_TOOLS)
+       else
+       {
+               if (jitCoder->flags & IL_CODER_FLAG_STATS)
+               {
+                       ILMutexLock(globalTraceMutex);
+                       fprintf(stdout,
+                               "Box: %s Size: %i\n", 
+                               ILClass_Name(boxClass),
+                               size);
+                       ILMutexUnlock(globalTraceMutex);
+               }
+       }
+#endif
 
        /* Allocate the object. */
        args[0] = jit_value_get_param(jitCoder->jitFunction, 0);
@@ -482,10 +507,11 @@
                                                        _IL_JIT_TYPE_VPTR, 
(jit_nint)boxClass);
 
        args[2] = jit_value_create_nint_constant(jitCoder->jitFunction,
-                                                       jit_type_int, size);
+                                                       _IL_JIT_TYPE_UINT32, 
size);
 
-       newObj = jit_insn_call_native(jitCoder->jitFunction, 0, _ILEngineAlloc,
-                                       _ILJitSignature_ILEngineAlloc, args, 3, 
0);
+       newObj = jit_insn_call_native(jitCoder->jitFunction, "_ILEngineAlloc",
+                                                                 
_ILEngineAlloc, _ILJitSignature_ILEngineAlloc,
+                                                                 args, 3, 
JIT_CALL_NOTHROW);
 
        jit_insn_branch_if(jitCoder->jitFunction, newObj, &label1);
        _ILJitThrowCurrentException(jitCoder);
@@ -521,8 +547,9 @@
                                                                                
         _IL_JIT_TYPE_UINT32,
                                                                                
         jit_type_get_size(jitType));
                                                        
-       newObj = jit_insn_call_native(jitCoder->jitFunction, 0, _ILEngineAlloc,
-                                                                 
_ILJitSignature_ILEngineAlloc, args, 3, 0);
+       newObj = jit_insn_call_native(jitCoder->jitFunction, "_ILEngineAlloc",
+                                                                 
_ILEngineAlloc, _ILJitSignature_ILEngineAlloc,
+                                                                 args, 3, 0);
                                        
        jit_insn_branch_if(jitCoder->jitFunction, newObj, &label1);
        _ILJitThrowCurrentException(jitCoder);
Index: pnet/engine/jitc_setup.c
diff -u pnet/engine/jitc_setup.c:1.8 pnet/engine/jitc_setup.c:1.9
--- pnet/engine/jitc_setup.c:1.8        Sat Jan 28 15:07:10 2006
+++ pnet/engine/jitc_setup.c    Sun Feb  5 16:20:28 2006
@@ -199,6 +199,9 @@
 static int JITCoder_Finish(ILCoder *_coder)
 {
        ILJITCoder *jitCoder = ((ILJITCoder *)_coder);
+#if !defined(IL_CONFIG_REDUCE_CODE) && !defined(IL_WITHOUT_TOOLS) && 
defined(_IL_JIT_ENABLE_DEBUG)
+       char *methodName = _ILJitFunctionGetMethodName(jitCoder->jitFunction);
+#endif
 
        /* Clear the label pool */
        ILMemPoolClear(&(jitCoder->labelPool));
@@ -212,6 +215,22 @@
        }
        jitCoder->labelOutOfMemory = 0;
 
+#if !defined(IL_CONFIG_REDUCE_CODE) && !defined(IL_WITHOUT_TOOLS) && 
defined(_IL_JIT_ENABLE_DEBUG)
+#ifdef _IL_JIT_DUMP_FUNCTION
+       ILMutexLock(globalTraceMutex);
+       jit_dump_function(stdout, jitCoder->jitFunction, methodName);
+       ILMutexUnlock(globalTraceMutex);
+#endif
+#ifdef _IL_JIT_DISASSEMBLE_FUNCTION
+       if(!jit_function_compile(jitCoder->jitFunction))
+       {
+               return IL_CODER_END_TOO_BIG;
+       }
+       ILMutexLock(globalTraceMutex);
+       jit_dump_function(stdout, jitCoder->jitFunction, methodName);
+       ILMutexUnlock(globalTraceMutex);
+#endif
+#endif
        return IL_CODER_END_OK;
 }
 
Index: pnet/engine/lib_helpers.c
diff -u pnet/engine/lib_helpers.c:1.10 pnet/engine/lib_helpers.c:1.11
--- pnet/engine/lib_helpers.c:1.10      Tue Aug 23 10:45:52 2005
+++ pnet/engine/lib_helpers.c   Sun Feb  5 16:20:28 2006
@@ -35,7 +35,9 @@
        ILField *field;
        ILFieldRVA *fieldRVA;
        ILUInt32 rva;
+#ifndef IL_USE_JIT
        ILMethod *caller;
+#endif
        ILImage *image;
        void *addr;
        unsigned long maxLen;
@@ -49,7 +51,11 @@
        {
                return;
        }
+#ifdef IL_USE_JIT
+       field = (ILField *)handle;
+#else
        field = *((ILField **)handle);
+#endif
        if(!field)
        {
                return;
@@ -71,11 +77,13 @@
                return;
        }
        image = ILProgramItem_Image(field);
+#ifndef IL_USE_JIT
        caller = ILExecThreadStackMethod(thread, 1);
        if(!caller || ILProgramItem_Image(caller) != image)
        {
                return;
        }
+#endif
 
        /* Map the RVA to find the array data */
        addr = ILImageMapRVA(image, rva, &maxLen);




reply via email to

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