[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[dotgnu-pnet-commits] pnet ./ChangeLog engine/call.c engine/jitc.c
From: |
Klaus Treichel |
Subject: |
[dotgnu-pnet-commits] pnet ./ChangeLog engine/call.c engine/jitc.c |
Date: |
Wed, 28 Dec 2005 18:55:08 +0000 |
CVSROOT: /cvsroot/dotgnu-pnet
Module name: pnet
Branch:
Changes by: Klaus Treichel <address@hidden> 05/12/28 18:55:07
Modified files:
. : ChangeLog
engine : call.c jitc.c
Log message:
Fix some bugs in the jit coder.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/dotgnu-pnet/pnet/ChangeLog.diff?tr1=1.3258&tr2=1.3259&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/dotgnu-pnet/pnet/engine/call.c.diff?tr1=1.33&tr2=1.34&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/dotgnu-pnet/pnet/engine/jitc.c.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
Patches:
Index: pnet/ChangeLog
diff -u pnet/ChangeLog:1.3258 pnet/ChangeLog:1.3259
--- pnet/ChangeLog:1.3258 Tue Dec 27 20:07:24 2005
+++ pnet/ChangeLog Wed Dec 28 18:55:07 2005
@@ -1,3 +1,11 @@
+2005-12-28 Klaus Treichel <address@hidden>
+
+ * engine/call.c: Fix that the constructors of array and string classes
+ don't get the this parameter.
+
+ * engine/jitc.c: Fix the same problem as in call.c and fix the return
type
+ of constructors.
+
2005-12-27 Klaus Treichel <address@hidden>
* engine/call.c: implement _ILCallPackVaParams, _ILCallPackVParams and
Index: pnet/engine/call.c
diff -u pnet/engine/call.c:1.33 pnet/engine/call.c:1.34
--- pnet/engine/call.c:1.33 Tue Dec 27 20:07:24 2005
+++ pnet/engine/call.c Wed Dec 28 18:55:07 2005
@@ -936,12 +936,36 @@
ILUInt32 totalParams = numParams + 1;
/* current arg in the parameter Array. */
ILUInt32 current = 1;
+ /* Some infos that we'll need later. */
+ ILClass *info = ILMethod_Owner(method);
+ /* Flag if this is an array or string constructor. */
+ int isArrayOrString = 0;
/* We need to calculate the number of needed arguments first for the
args array. */
if(ILType_HasThis(signature))
{
- /* We need an additional parameter for the this pointer. */
- totalParams++;
+ /* the this arg is not passed to constructors of arrays or
strings. */
+ if(!isCtor)
+ {
+ /* We need an additional parameter for the this
pointer. */
+ totalParams++;
+ }
+ else
+ {
+ ILType *type = ILType_FromClass(info);
+ ILType *synType = type = ILClassGetSynType(info);
+
+ if(!(synType && ILType_IsArray(synType)) &&
!ILTypeIsStringClass(type))
+ {
+ /* We need an additional parameter for the this
pointer */
+ /* for all casese except arrays or strings. */
+ totalParams++;
+ }
+ else
+ {
+ isArrayOrString = 1;
+ }
+ }
}
/* Now create the array for the args. */
@@ -957,17 +981,22 @@
{
if(isCtor)
{
- /* We need to allocate the Object. */
- if(!(jitArgs[1] = _ILEngineAlloc(thread,
ILMethod_Owner(method), 0)))
+ if(!isArrayOrString)
{
- return 1;
+ /* We need to allocate the Object. */
+ if(!(_this = _ILEngineAlloc(thread,
ILMethod_Owner(method), 0)))
+ {
+ return 1;
+ }
+ jitArgs[1] = &_this;
+ current++;
}
}
else
{
jitArgs[1] = &_this;
+ current++;
}
- current++;
}
if((*pack)(thread, signature, &(jitArgsBuffer[0]), &(jitArgs[current]),
userData))
Index: pnet/engine/jitc.c
diff -u pnet/engine/jitc.c:1.4 pnet/engine/jitc.c:1.5
--- pnet/engine/jitc.c:1.4 Tue Dec 27 20:07:24 2005
+++ pnet/engine/jitc.c Wed Dec 28 18:55:07 2005
@@ -627,13 +627,15 @@
/*
* Generate the stub for calling an internal function.
*/
-static int _ILJitCompileInternal(jit_function_t func, void *nativeFunction)
+static int _ILJitCompileInternal(jit_function_t func, ILMethod *method, void
*nativeFunction)
{
ILJitType signature = jit_function_get_signature(func);
ILJitType returnType = jit_type_get_return(signature);
unsigned int numParams = jit_type_num_params(signature);
ILJitValue returnValue;
+ ILJitValue methodPtr = jit_value_create_nint_constant(func,
jit_type_void_ptr, (jit_nint)method);
+ /* We need to set the method member in the ILExecThread == arg[0]. */
if(numParams > 0)
{
ILJitValue jitParams[numParams];
@@ -646,20 +648,14 @@
return JIT_RESULT_OUT_OF_MEMORY;
}
}
+ jit_insn_store_relative(func, jitParams[0],
offsetof(ILExecThread, method), methodPtr);
returnValue = jit_insn_call_native(func, 0, nativeFunction,
signature, jitParams, numParams, 0);
}
else
{
returnValue = jit_insn_call_native(func, 0, nativeFunction,
signature, 0, 0, 0);
}
- if(returnType != jit_type_void_ptr)
- {
- jit_insn_return(func, returnValue);
- }
- else
- {
- jit_insn_return(func, 0);
- }
+ jit_insn_return(func, returnValue);
return JIT_RESULT_OK;
}
@@ -811,7 +807,7 @@
case IL_META_METHODIMPL_RUNTIME:
case IL_META_METHODIMPL_IL |
IL_META_METHODIMPL_INTERNAL_CALL:
{
- return _ILJitCompileInternal(func, fnInfo.func);
+ return _ILJitCompileInternal(func, method,
fnInfo.func);
}
}
return JIT_RESULT_COMPILE_ERROR;
@@ -846,6 +842,12 @@
ILJitType jitSignature;
/* The new created function. */
ILJitFunction jitFunction;
+ /* Some infos that we'll need later. */
+ ILClass *info = ILMethod_Owner(method);
+ /* Flag if this is an array or string constructor. */
+ int isArrayOrString = 0;
+ /* Flag if the method is a ctor. */
+ int isCtor = ILMethodIsConstructor(method);
/* Don't create the jit function twice. */
if(method->userData)
@@ -854,14 +856,39 @@
}
if(ILType_HasThis(signature))
{
- /* we need an other arg for this */
- total++;
+ if(!isCtor)
+ {
+ /* we need an other arg for this */
+ total++;
+ }
+ else
+ {
+ ILType *ownerType = ILType_FromClass(info);
+ ILType *synType = type = ILClassGetSynType(info);
+
+ if(!(synType && ILType_IsArray(synType)) &&
!ILTypeIsStringClass(ownerType))
+ {
+ /* we need an other arg for this */
+ total++;
+ }
+ else
+ {
+ isArrayOrString = 1;
+ }
+ }
}
ILJitType jitArgs[total];
/* Get the return type for this function */
- type = ILTypeGetEnumType(ILTypeGetParam(signature, 0));
+ if(isCtor)
+ {
+ type = ILType_FromClass(info);
+ }
+ else
+ {
+ type = ILTypeGetEnumType(ILTypeGetParam(signature, 0));
+ }
if(!(jitReturnType = _ILJitGetReturnType(type, coder->process)))
{
return 0;
@@ -872,18 +899,21 @@
if(ILType_HasThis(signature))
{
- /* We need to setup the this arg */
- /* determine the type of this arg */
- if(!(type = (ILType *)ILMethod_Owner(method)))
- {
- return 0;
- }
- /* at this time the type must be layouted or at least partially
layouted */
- if(!(jitArgs[1] = _ILJitGetThisType(type, coder->process)))
+ if(!isCtor || !isArrayOrString)
{
- return 0;
+ /* We need to setup the this arg */
+ /* determine the type of this arg */
+ if(!(type = ILType_FromClass(info)))
+ {
+ return 0;
+ }
+ /* at this time the type must be layouted or at least
partially layouted */
+ if(!(jitArgs[1] = _ILJitGetThisType(type,
coder->process)))
+ {
+ return 0;
+ }
+ jitArgc++;
}
- jitArgc++;
}
/* Get the jit types for the regular arguments */
@@ -972,7 +1002,7 @@
* Call the jit function for a ILMethod.
* Returns 1 if an exception occured.
*/
-int ILJitCallMethod(ILMethod *method, void**jitArgs, void *result)
+int ILJitCallMethod(ILMethod *method, void **jitArgs, void *result)
{
ILJitFunction jitFunction = method->userData;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [dotgnu-pnet-commits] pnet ./ChangeLog engine/call.c engine/jitc.c,
Klaus Treichel <=