[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[dotgnu-pnet-commits] pnet ./ChangeLog engine/jitc.c engine/jitc_call...
From: |
Klaus Treichel |
Subject: |
[dotgnu-pnet-commits] pnet ./ChangeLog engine/jitc.c engine/jitc_call... |
Date: |
Thu, 25 May 2006 09:29:01 +0000 |
CVSROOT: /sources/dotgnu-pnet
Module name: pnet
Branch:
Changes by: Klaus Treichel <address@hidden> 06/05/25 09:29:00
Modified files:
. : ChangeLog
engine : jitc.c jitc_call.c jitc_delegate.c
Log message:
2006-05-25 Klaus Treichel <address@hidden>
* engine/jitc.c: Add signatures for inlined internalcalls. Add output of
debugging infos in the on demand compiler for pinvokes. Clean up the
source.
* engine/jitc_call.c: Add the inlined calls needed for the synchronized
classes.
* engine/jitc_delegate.c: Add the output of debugging infos in the on
demand compilers.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/dotgnu-pnet/pnet/ChangeLog.diff?tr1=1.3316&tr2=1.3317&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/dotgnu-pnet/pnet/engine/jitc.c.diff?tr1=1.32&tr2=1.33&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/dotgnu-pnet/pnet/engine/jitc_call.c.diff?tr1=1.15&tr2=1.16&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/dotgnu-pnet/pnet/engine/jitc_delegate.c.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
Patches:
Index: pnet/ChangeLog
diff -u pnet/ChangeLog:1.3316 pnet/ChangeLog:1.3317
--- pnet/ChangeLog:1.3316 Thu May 18 19:34:31 2006
+++ pnet/ChangeLog Thu May 25 09:28:59 2006
@@ -1,3 +1,15 @@
+2006-05-25 Klaus Treichel <address@hidden>
+
+ * engine/jitc.c: Add signatures for inlined internalcalls. Add output of
+ debugging infos in the on demand compiler for pinvokes. Clean up the
+ source.
+
+ * engine/jitc_call.c: Add the inlined calls needed for the synchronized
+ classes.
+
+ * engine/jitc_delegate.c: Add the output of debugging infos in the on
+ demand compilers.
+
2006-05-18 Klaus Treichel <address@hidden>
* engine/Makefile.am: Add jitc_delegate.c to the jit coder sources.
Index: pnet/engine/jitc.c
diff -u pnet/engine/jitc.c:1.32 pnet/engine/jitc.c:1.33
--- pnet/engine/jitc.c:1.32 Thu May 18 19:34:31 2006
+++ pnet/engine/jitc.c Thu May 25 09:29:00 2006
@@ -202,6 +202,25 @@
#endif
/*
+ * Definition of the signatures for inlined calls of native runtime functions.
+ */
+
+/*
+ * void _IL_Monitor_Enter(ILExecThread *thread, ILObject *obj)
+ */
+static ILJitType _ILJitSignature_ILMonitorEnter = 0;
+
+/*
+ * void _IL_Monitor_Exit(ILExecThread *thread, ILObject *obj)
+ */
+static ILJitType _ILJitSignature_ILMonitorExit = 0;
+
+/*
+ * void _ILGetClrType(ILExecThread *thread, ILClass *info)
+ */
+static ILJitType _ILJitSignature_ILGetClrType = 0;
+
+/*
* Define offsetof macro if not present.
*/
#ifndef offsetof
@@ -280,6 +299,12 @@
ILInternalInfo fnInfo; /* Information for internal
calls or pinvokes. */
};
+#define _IL_JIT_IMPL_DEFAULT 0x0
+#define _IL_JIT_IMPL_INTERNAL 0x1
+#define _IL_JIT_IMPL_INTERNALALLOC 0x2
+#define _IL_JIT_IMPL_INTERNALMASK 0x3
+#define _IL_JIT_IMPL_PINVOKE 0x4
+
/*
* Define the structure of a JIT coder's instance block.
*/
@@ -1966,6 +1991,34 @@
}
#endif
+ /* Create the signatures for the inlined native function calls. */
+ args[0] = _IL_JIT_TYPE_VPTR;
+ args[1] = _IL_JIT_TYPE_VPTR;
+ returnType = _IL_JIT_TYPE_VOID;
+ if(!(_ILJitSignature_ILMonitorEnter =
+ jit_type_create_signature(IL_JIT_CALLCONV_CDECL, returnType,
args, 2, 1)))
+ {
+ return 0;
+ }
+
+ args[0] = _IL_JIT_TYPE_VPTR;
+ args[1] = _IL_JIT_TYPE_VPTR;
+ returnType = _IL_JIT_TYPE_VOID;
+ if(!(_ILJitSignature_ILMonitorExit =
+ jit_type_create_signature(IL_JIT_CALLCONV_CDECL, returnType,
args, 2, 1)))
+ {
+ return 0;
+ }
+
+ args[0] = _IL_JIT_TYPE_VPTR;
+ args[1] = _IL_JIT_TYPE_VPTR;
+ returnType = _IL_JIT_TYPE_VPTR;
+ if(!(_ILJitSignature_ILGetClrType =
+ jit_type_create_signature(IL_JIT_CALLCONV_CDECL, returnType,
args, 2, 1)))
+ {
+ return 0;
+ }
+
return 1;
}
/*
@@ -2246,11 +2299,11 @@
if(jitMethodInfo)
{
- if(jitMethodInfo->implementationType)
+ if((jitMethodInfo->implementationType) &
_IL_JIT_IMPL_INTERNALMASK)
{
fnInfo->func = jitMethodInfo->fnInfo.func;
+ return (jitMethodInfo->implementationType) &
_IL_JIT_IMPL_INTERNALMASK;
}
- return jitMethodInfo->implementationType;
}
return 0;
}
@@ -2515,9 +2568,47 @@
static int _ILJitCompilePinvoke(jit_function_t func)
{
ILMethod *method = (ILMethod *)jit_function_get_meta(func,
IL_JIT_META_METHOD);
+#if !defined(IL_CONFIG_REDUCE_CODE) && !defined(IL_WITHOUT_TOOLS) &&
defined(_IL_JIT_ENABLE_DEBUG)
+ ILClass *info = ILMethod_Owner(method);
+ ILClassPrivate *classPrivate = (ILClassPrivate *)info->userData;
+ ILJITCoder *jitCoder = (ILJITCoder *)(classPrivate->process->coder);
+ char *methodName = _ILJitFunctionGetMethodName(func);
+#endif
+
+#if !defined(IL_CONFIG_REDUCE_CODE) && !defined(IL_WITHOUT_TOOLS) &&
defined(_IL_JIT_ENABLE_DEBUG)
+ if(jitCoder->flags & IL_CODER_FLAG_STATS)
+ {
+ ILMutexLock(globalTraceMutex);
+ fprintf(stdout, "CompilePinvoke: %s\n", methodName);
+ ILMutexUnlock(globalTraceMutex);
+ }
+#endif
/* TODO */
- return JIT_RESULT_COMPILE_ERROR;
+
+#if !defined(IL_CONFIG_REDUCE_CODE) && !defined(IL_WITHOUT_TOOLS) &&
defined(_IL_JIT_ENABLE_DEBUG)
+#ifdef _IL_JIT_DUMP_FUNCTION
+ if(jitCoder->flags & IL_CODER_FLAG_STATS)
+ {
+ ILMutexLock(globalTraceMutex);
+ jit_dump_function(stdout, func, methodName);
+ ILMutexUnlock(globalTraceMutex);
+ }
+#endif
+#ifdef _IL_JIT_DISASSEMBLE_FUNCTION
+ if(jitCoder->flags & IL_CODER_FLAG_STATS)
+ {
+ if(!jit_function_compile(func))
+ {
+ return JIT_RESULT_COMPILE_ERROR;
+ }
+ ILMutexLock(globalTraceMutex);
+ jit_dump_function(stdout, func, methodName);
+ ILMutexUnlock(globalTraceMutex);
+ }
+#endif
+#endif
+ return JIT_RESULT_OK;
}
/*
@@ -2605,7 +2696,7 @@
}
else
{
- if(implementationType != 2)
+ if(implementationType != _IL_JIT_IMPL_INTERNALALLOC)
{
/* we need an other arg for this */
total++;
@@ -2721,7 +2812,7 @@
if(method == ILTypeGetDelegateMethod(type))
{
/* Flag method implemented in IL.. */
- implementationType = 0;
+ implementationType = _IL_JIT_IMPL_DEFAULT;
/* now set the on demand compiler function */
onDemandCompiler = _ILJitCompileMultiCastDelegateInvoke;
@@ -2742,7 +2833,7 @@
if(code.code)
{
/* Flag method implemented in IL.. */
- implementationType = 0;
+ implementationType = _IL_JIT_IMPL_DEFAULT;
/* set the function recompilable. */
setRecompilable = 1;
@@ -2813,7 +2904,7 @@
}
/* Flag the method pinvoke. */
- implementationType = 3;
+ implementationType =
_IL_JIT_IMPL_PINVOKE;
/* now set the on demand compiler
function */
onDemandCompiler = _ILJitCompilePinvoke;
@@ -2844,7 +2935,7 @@
if(fnInfo.func)
{
/* Flag the
method internal. */
-
implementationType = 1;
+
implementationType = _IL_JIT_IMPL_INTERNAL;
}
}
else
@@ -2855,12 +2946,12 @@
if(!_ILFindInternalCall(_ILExecThreadProcess(thread),
method, 1, &fnInfo))
{
-
implementationType = 0;
+
implementationType = _IL_JIT_IMPL_DEFAULT;
}
if(fnInfo.func)
{
/* Flag
the method an allocating constructor. */
-
implementationType = 2;
+
implementationType = _IL_JIT_IMPL_INTERNALALLOC;
}
}
else
@@ -2868,19 +2959,19 @@
if(fnInfo.func)
{
/* Flag
the method internal. */
-
implementationType = 1;
+
implementationType = _IL_JIT_IMPL_INTERNAL;
}
else
{
if(!_ILFindInternalCall(_ILExecThreadProcess(thread),
method, 1, &fnInfo))
{
-
implementationType = 0;
+
implementationType = _IL_JIT_IMPL_DEFAULT;
}
if(fnInfo.func)
{
/* Flag the method an allocating constructor. */
-
implementationType = 2;
+
implementationType = _IL_JIT_IMPL_INTERNALALLOC;
}
}
}
@@ -2891,14 +2982,14 @@
if(!_ILFindInternalCall(_ILExecThreadProcess(thread),
method, 0, &fnInfo))
{
- implementationType = 0;
+ implementationType =
_IL_JIT_IMPL_DEFAULT;
}
else
{
if(fnInfo.func)
{
/* Flag the
method internal. */
-
implementationType = 1;
+
implementationType = _IL_JIT_IMPL_INTERNAL;
}
}
}
Index: pnet/engine/jitc_call.c
diff -u pnet/engine/jitc_call.c:1.15 pnet/engine/jitc_call.c:1.16
--- pnet/engine/jitc_call.c:1.15 Thu May 18 19:34:31 2006
+++ pnet/engine/jitc_call.c Thu May 25 09:29:00 2006
@@ -737,7 +737,7 @@
ILJitValue jitParams[argCount + 2];
ILJitValue returnValue;
ILInternalInfo fnInfo;
- int internalType = 0;
+ int internalType = _IL_JIT_IMPL_DEFAULT;
char *methodName = 0;
#if !defined(IL_CONFIG_REDUCE_CODE) && !defined(IL_WITHOUT_TOOLS)
@@ -792,7 +792,7 @@
ILJitValue thread = _ILJitCoderGetThread(jitCoder);
/* Call the engine function directly with the supplied args. */
- if(internalType == 2)
+ if(internalType == _IL_JIT_IMPL_INTERNALALLOC)
{
/* This is an allocating constructor. */
if(info->hasParamArray)
@@ -1089,6 +1089,82 @@
static int JITCoder_CallInlineable(ILCoder *coder, int inlineType,
ILMethod
*methodInfo)
{
+ ILJITCoder *jitCoder = _ILCoderToILJITCoder(coder);
+
+ /* Determine what to do for the inlineable method type */
+ switch(inlineType)
+ {
+ case IL_INLINEMETHOD_MONITOR_ENTER:
+ {
+ /* Enter the monitor on the top-most object */
+ ILJitValue args[2];
+
+ args[0] = _ILJitCoderGetThread(jitCoder);
+ args[1] = jitCoder->jitStack[jitCoder->stackTop - 1];
+
+ /* Pop the object from the stack. */
+ JITC_ADJUST(jitCoder, -1);
+
+ jit_insn_call_native(jitCoder->jitFunction,
+
"_IL_Monitor_Enter",
+
_IL_Monitor_Enter,
+
_ILJitSignature_ILMonitorEnter,
+ args, 2, 0);
+ return 1;
+ }
+ /* Not reached */
+
+ case IL_INLINEMETHOD_MONITOR_EXIT:
+ {
+ /* Exit the monitor on the top-most object */
+ ILJitValue args[2];
+
+ args[0] = _ILJitCoderGetThread(jitCoder);
+ args[1] = jitCoder->jitStack[jitCoder->stackTop - 1];
+
+ /* Pop the object from the stack. */
+ JITC_ADJUST(jitCoder, -1);
+
+ jit_insn_call_native(jitCoder->jitFunction,
+
"_IL_Monitor_Exit",
+
_IL_Monitor_Exit,
+
_ILJitSignature_ILMonitorExit,
+ args, 2, 0);
+ return 1;
+ }
+ /* Not reached */
+ case IL_INLINEMETHOD_TYPE_FROM_HANDLE:
+ {
+ /* Convert a RuntimeTypeHandle into a Type object */
+ ILJitValue returnValue =
jit_value_create(jitCoder->jitFunction,
+
_IL_JIT_TYPE_VPTR);
+ ILJitValue temp;
+ ILJitValue args[2];
+ jit_label_t label = jit_label_undefined;
+;
+ jit_insn_store(jitCoder->jitFunction,
+ returnValue,
+
jitCoder->jitStack[jitCoder->stackTop - 1]);
+
+ jit_insn_branch_if_not(jitCoder->jitFunction,
returnValue, &label);
+
+ args[0] = _ILJitCoderGetThread(jitCoder);
+ args[1] = returnValue;
+ temp = jit_insn_call_native(jitCoder->jitFunction,
+
"_ILGetClrType",
+
_ILGetClrType,
+
_ILJitSignature_ILGetClrType,
+
args, 2, 0);
+ jit_insn_store(jitCoder->jitFunction,
+ returnValue,
+ temp);
+ jit_insn_label(jitCoder->jitFunction, &label);
+ jitCoder->jitStack[jitCoder->stackTop - 1] =
returnValue;
+ return 1;
+ }
+ /* Not reached */
+
+ }
/* If we get here, then we don't know how to inline the method */
return 0;
}
Index: pnet/engine/jitc_delegate.c
diff -u pnet/engine/jitc_delegate.c:1.1 pnet/engine/jitc_delegate.c:1.2
--- pnet/engine/jitc_delegate.c:1.1 Thu May 18 19:34:31 2006
+++ pnet/engine/jitc_delegate.c Thu May 25 09:29:00 2006
@@ -147,6 +147,13 @@
*/
static int _ILJitCompileMultiCastDelegateInvoke(ILJitFunction func)
{
+#if !defined(IL_CONFIG_REDUCE_CODE) && !defined(IL_WITHOUT_TOOLS) &&
defined(_IL_JIT_ENABLE_DEBUG)
+ ILMethod *method = (ILMethod *)jit_function_get_meta(func,
IL_JIT_META_METHOD);
+ ILClass *info = ILMethod_Owner(method);
+ ILClassPrivate *classPrivate = (ILClassPrivate *)info->userData;
+ ILJITCoder *jitCoder = (ILJITCoder *)(classPrivate->process->coder);
+ char *methodName = _ILJitFunctionGetMethodName(func);
+#endif
#ifdef IL_JIT_THREAD_IN_SIGNATURE
ILJitValue thread = _ILJitFunctionGetThread(func);
#endif
@@ -161,6 +168,14 @@
ILJitValue args[numArgs]; /* The array for the invokation args. */
ILUInt32 current;
+#if !defined(IL_CONFIG_REDUCE_CODE) && !defined(IL_WITHOUT_TOOLS) &&
defined(_IL_JIT_ENABLE_DEBUG)
+ if(jitCoder->flags & IL_CODER_FLAG_STATS)
+ {
+ ILMutexLock(globalTraceMutex);
+ fprintf(stdout, "CompileMulticastDelegateInvoke: %s\n",
methodName);
+ ILMutexUnlock(globalTraceMutex);
+ }
+#endif
if(numArgs < 2)
{
/* There is something wrong with this delegate. */
@@ -191,5 +206,27 @@
#endif
jit_insn_return(func, returnValue);
+#if !defined(IL_CONFIG_REDUCE_CODE) && !defined(IL_WITHOUT_TOOLS) &&
defined(_IL_JIT_ENABLE_DEBUG)
+#ifdef _IL_JIT_DUMP_FUNCTION
+ if(jitCoder->flags & IL_CODER_FLAG_STATS)
+ {
+ ILMutexLock(globalTraceMutex);
+ jit_dump_function(stdout, func, methodName);
+ ILMutexUnlock(globalTraceMutex);
+ }
+#endif
+#ifdef _IL_JIT_DISASSEMBLE_FUNCTION
+ if(jitCoder->flags & IL_CODER_FLAG_STATS)
+ {
+ if(!jit_function_compile(func))
+ {
+ return JIT_RESULT_COMPILE_ERROR;
+ }
+ ILMutexLock(globalTraceMutex);
+ jit_dump_function(stdout, func, methodName);
+ ILMutexUnlock(globalTraceMutex);
+ }
+#endif
+#endif
return JIT_RESULT_OK;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [dotgnu-pnet-commits] pnet ./ChangeLog engine/jitc.c engine/jitc_call...,
Klaus Treichel <=