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/call.c engine/lib_reflect.c


From: Klaus Treichel
Subject: [dotgnu-pnet-commits] pnet ChangeLog engine/call.c engine/lib_reflect.c
Date: Mon, 05 Jun 2006 11:34:45 +0000

CVSROOT:        /sources/dotgnu-pnet
Module name:    pnet
Changes by:     Klaus Treichel <ktreichel>      06/06/05 11:34:45

Modified files:
        .              : ChangeLog 
        engine         : call.c lib_reflect.c 

Log message:
        2006-06-05  Klaus Treichel  <address@hidden>
        
                * engine/call.c: Fix problems with type casting.
        
                * engine/lib_reflect.c: Fix Bug in Invoke with return values.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pnet/ChangeLog?cvsroot=dotgnu-pnet&r1=1.3322&r2=1.3323
http://cvs.savannah.gnu.org/viewcvs/pnet/engine/call.c?cvsroot=dotgnu-pnet&r1=1.42&r2=1.43
http://cvs.savannah.gnu.org/viewcvs/pnet/engine/lib_reflect.c?cvsroot=dotgnu-pnet&r1=1.77&r2=1.78

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/dotgnu-pnet/pnet/ChangeLog,v
retrieving revision 1.3322
retrieving revision 1.3323
diff -u -b -r1.3322 -r1.3323
--- ChangeLog   4 Jun 2006 19:33:10 -0000       1.3322
+++ ChangeLog   5 Jun 2006 11:34:45 -0000       1.3323
@@ -1,3 +1,9 @@
+2006-06-05  Klaus Treichel  <address@hidden>
+
+       * engine/call.c: Fix problems with type casting.
+
+       * engine/lib_reflect.c: Fix Bug in Invoke with return values.
+
 2006-06-04  Klaus Treichel  <address@hidden>
 
        * engine/jitc.c: Move the code generation to handle an exception thrown

Index: engine/call.c
===================================================================
RCS file: /sources/dotgnu-pnet/pnet/engine/call.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -b -r1.42 -r1.43
--- engine/call.c       1 May 2006 17:30:50 -0000       1.42
+++ engine/call.c       5 Jun 2006 11:34:45 -0000       1.43
@@ -143,30 +143,62 @@
 
                                case IL_META_ELEMTYPE_BOOLEAN:
                                case IL_META_ELEMTYPE_I1:
+                               {
+                                       *jitArgs = argBuffer;
+                                       *((ILInt8 *)argBuffer) = 
(ILInt8)VA_ARG(va, ILVaInt);
+                                       argBuffer += sizeof(ILNativeFloat);
+                                       ++jitArgs;
+                               }
+                               break;
+
                                case IL_META_ELEMTYPE_I2:
+                               {
+                                       *jitArgs = argBuffer;
+                                       *((ILInt16 *)argBuffer) = 
(ILInt16)VA_ARG(va, ILVaInt);
+                                       argBuffer += sizeof(ILNativeFloat);
+                                       ++jitArgs;
+                               }
+                               break;
+
                                case IL_META_ELEMTYPE_I4:
                        #ifdef IL_NATIVE_INT32
                                case IL_META_ELEMTYPE_I:
                        #endif
                                {
                                        *jitArgs = argBuffer;
-                                       *((ILVaInt *)argBuffer) = VA_ARG(va, 
ILVaInt);
-                                       argBuffer += sizeof(ILVaInt);
+                                       *((ILInt32 *)argBuffer) = 
(ILInt32)VA_ARG(va, ILVaInt);
+                                       argBuffer += sizeof(ILNativeFloat);
                                        ++jitArgs;
                                }
                                break;
 
                                case IL_META_ELEMTYPE_U1:
+                               {
+                                       *jitArgs = argBuffer;
+                                       *((ILUInt8 *)argBuffer) = 
(ILUInt8)VA_ARG(va, ILVaUInt);
+                                       argBuffer += sizeof(ILNativeFloat);
+                                       ++jitArgs;
+                               }
+                               break;
+
                                case IL_META_ELEMTYPE_U2:
                                case IL_META_ELEMTYPE_CHAR:
+                               {
+                                       *jitArgs = argBuffer;
+                                       *((ILUInt16 *)argBuffer) = 
(ILUInt16)VA_ARG(va, ILVaUInt);
+                                       argBuffer += sizeof(ILNativeFloat);
+                                       ++jitArgs;
+                               }
+                               break;
+
                                case IL_META_ELEMTYPE_U4:
                        #ifdef IL_NATIVE_INT32
                                case IL_META_ELEMTYPE_U:
                        #endif
                                {
                                        *jitArgs = argBuffer;
-                                       *((ILVaUInt *)argBuffer) = VA_ARG(va, 
ILVaUInt);
-                                       argBuffer += sizeof(ILVaUInt);
+                                       *((ILUInt32 *)argBuffer) = 
(ILUInt32)VA_ARG(va, ILVaUInt);
+                                       argBuffer += sizeof(ILNativeFloat);
                                        ++jitArgs;
                                }
                                break;
@@ -178,7 +210,7 @@
                                {
                                        *jitArgs = argBuffer;
                                        *((ILInt64 *)argBuffer) = VA_ARG(va, 
ILInt64);
-                                       argBuffer += sizeof(ILInt64);
+                                       argBuffer += sizeof(ILNativeFloat);
                                        ++jitArgs;
                                }
                                break;
@@ -196,12 +228,28 @@
                                break;
 
                                case IL_META_ELEMTYPE_R4:
+                               {
+                                       *jitArgs = argBuffer;
+                                       *((ILFloat *)argBuffer) = 
(ILFloat)VA_ARG(va, ILVaDouble);
+                                       argBuffer += sizeof(ILNativeFloat);
+                                       ++jitArgs;
+                               }
+                               break;
+
                                case IL_META_ELEMTYPE_R8:
+                               {
+                                       *jitArgs = argBuffer;
+                                       *((ILDouble *)argBuffer) = 
(ILDouble)VA_ARG(va, ILVaDouble);
+                                       argBuffer += sizeof(ILNativeFloat);
+                                       ++jitArgs;
+                               }
+                               break;
+
                                case IL_META_ELEMTYPE_R:
                                {
                                        *jitArgs = argBuffer;
-                                       *((ILVaDouble *)argBuffer) = VA_ARG(va, 
ILVaDouble);
-                                       argBuffer += sizeof(ILUInt64);
+                                       *((ILNativeFloat *)argBuffer) = 
(ILNativeFloat)VA_ARG(va, ILVaDouble);
+                                       argBuffer += sizeof(ILNativeFloat);
                                        ++jitArgs;
                                }
                                break;
@@ -212,7 +260,7 @@
                                           as a pointer to a temporary typedref 
structure */
                                        *jitArgs = argBuffer;
                                        *((void **)argBuffer) = VA_ARG(va, void 
*);
-                                       argBuffer += sizeof(void *);
+                                       argBuffer += sizeof(ILNativeFloat);
                                        ++jitArgs;
                                }
                                break;
@@ -223,7 +271,7 @@
                        /* Process an object reference */
                        *jitArgs = argBuffer;
                        *((ILObject **)argBuffer) = VA_ARG(va, ILObject *);
-                       argBuffer += sizeof(ILObject *);
+                       argBuffer += sizeof(ILNativeFloat);
                        ++jitArgs;
                }
                else if(ILType_IsValueType(paramType))
@@ -240,7 +288,7 @@
                        /* Process a value that is being passed by reference */
                        *jitArgs = argBuffer;
                        *((void **)argBuffer) = VA_ARG(va, void *);
-                       argBuffer += sizeof(void *);
+                       argBuffer += sizeof(ILNativeFloat);
                        ++jitArgs;
                }
                else
@@ -248,7 +296,7 @@
                        /* Assume that everything else is an object reference */
                        *jitArgs = argBuffer;
                        *((ILObject **)argBuffer) = VA_ARG(va, ILObject *);
-                       argBuffer += sizeof(ILObject *);
+                       argBuffer += sizeof(ILNativeFloat);
                        ++jitArgs;
                }
        }
@@ -429,7 +477,7 @@
                        /* Use the supplied "this" parameter */
                        *jitArgs = argBuffer;
                        *((void **)argBuffer) = _this;
-                       argBuffer += sizeof(void *);
+                       argBuffer += sizeof(ILNativeFloat);
                }
                else
                {
@@ -452,8 +500,26 @@
 
                                case IL_META_ELEMTYPE_BOOLEAN:
                                case IL_META_ELEMTYPE_I1:
+                               {
+                                       *jitArgs = argBuffer;
+                                       *((ILInt8 *)argBuffer) = 
(ILInt8)(args->int32Value);
+                                       argBuffer += sizeof(ILNativeFloat);
+                                       ++args;
+                                       ++jitArgs;
+                               }
+                               break;
+
                                case IL_META_ELEMTYPE_I2:
                                case IL_META_ELEMTYPE_CHAR:
+                               {
+                                       *jitArgs = argBuffer;
+                                       *((ILInt16 *)argBuffer) = 
(ILInt16)(args->int32Value);
+                                       argBuffer += sizeof(ILNativeFloat);
+                                       ++args;
+                                       ++jitArgs;
+                               }
+                               break;
+
                                case IL_META_ELEMTYPE_I4:
                        #ifdef IL_NATIVE_INT32
                                case IL_META_ELEMTYPE_I:
@@ -466,7 +532,25 @@
                                break;
 
                                case IL_META_ELEMTYPE_U1:
+                               {
+                                       *jitArgs = argBuffer;
+                                       *((ILUInt8 *)argBuffer) = 
(ILUInt8)(args->uint32Value);
+                                       argBuffer += sizeof(ILNativeFloat);
+                                       ++args;
+                                       ++jitArgs;
+                               }
+                               break;
+
                                case IL_META_ELEMTYPE_U2:
+                               {
+                                       *jitArgs = argBuffer;
+                                       *((ILUInt16 *)argBuffer) = 
(ILUInt16)(args->uint32Value);
+                                       argBuffer += sizeof(ILNativeFloat);
+                                       ++args;
+                                       ++jitArgs;
+                               }
+                               break;
+
                                case IL_META_ELEMTYPE_U4:
                        #ifdef IL_NATIVE_INT32
                                case IL_META_ELEMTYPE_U:
@@ -501,7 +585,25 @@
                                break;
 
                                case IL_META_ELEMTYPE_R4:
+                               {
+                                       *jitArgs = argBuffer;
+                                       *((ILFloat *)argBuffer) = 
(ILFloat)(args->floatValue);
+                                       argBuffer += sizeof(ILNativeFloat);
+                                       ++args;
+                                       ++jitArgs;
+                               }
+                               break;
+
                                case IL_META_ELEMTYPE_R8:
+                               {
+                                       *jitArgs = argBuffer;
+                                       *((ILDouble *)argBuffer) = 
(ILDouble)(args->floatValue);
+                                       argBuffer += sizeof(ILNativeFloat);
+                                       ++args;
+                                       ++jitArgs;
+                               }
+                               break;
+
                                case IL_META_ELEMTYPE_R:
                                {
                                        *jitArgs = &(args->floatValue);
@@ -713,6 +815,14 @@
 }
 #endif
 
+#ifdef IL_USE_JIT
+void _ILCallUnpackDirectResult(ILExecThread *thread, ILMethod *method,
+                                                  int isCtor, void *result, 
void *userData)
+{
+       /* This is a NOOP for now. */
+}
+
+#else
 void _ILCallUnpackDirectResult(ILExecThread *thread, ILMethod *method,
                                                   int isCtor, void *result, 
void *userData)
 {
@@ -844,7 +954,15 @@
                }
        }
 }
+#endif
 
+#ifdef IL_USE_JIT
+void _ILCallUnpackVResult(ILExecThread *thread, ILMethod *method,
+                                         int isCtor, void *_result, void 
*userData)
+{
+       /* This is a NOOP for now. */
+}
+#else
 void _ILCallUnpackVResult(ILExecThread *thread, ILMethod *method,
                                          int isCtor, void *_result, void 
*userData)
 {
@@ -945,6 +1063,7 @@
                }
        }
 }
+#endif
 
 #ifdef IL_USE_JIT
 int _ILCallMethod(ILExecThread *thread, ILMethod *method,

Index: engine/lib_reflect.c
===================================================================
RCS file: /sources/dotgnu-pnet/pnet/engine/lib_reflect.c,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -b -r1.77 -r1.78
--- engine/lib_reflect.c        26 Feb 2006 20:33:25 -0000      1.77
+++ engine/lib_reflect.c        5 Jun 2006 11:34:45 -0000       1.78
@@ -3047,6 +3047,71 @@
                ++argNum;
        }
 
+#ifdef IL_USE_JIT
+       /* Invoke the method */
+       if(isCtor)
+       {
+               return ILExecThreadCallCtorV(thread, method, args);
+       }
+       else 
+       {
+               /* Handle the return object creation. */
+               ILMemZero(&result, sizeof(result));
+               paramType = ILTypeGetEnumType(ILTypeGetReturn(signature));
+               if(ILType_IsPrimitive(paramType))
+               {
+                       /* Box a primitive value */
+                       if(paramType == ILType_Void)
+                       {
+                               paramObject = 0;
+                               result.ptrValue = (void *)&paramObject;
+                       }
+                       else
+                       {
+                               ILClass *classInfo = ILClassFromType
+                                       
(ILContextNextImage(thread->process->context, 0),
+                                       0, paramType, 0);
+                               if(!classInfo)
+                               {
+                                       ILExecThreadThrowOutOfMemory(thread);
+                                       return 0;
+                               }
+                               classInfo = ILClassResolve(classInfo);
+                               paramObject = (ILObject *)_ILEngineAllocObject
+                                                                               
(thread, classInfo);
+                               if(!paramObject)
+                               {
+                                       return 0;
+                               }
+                               result.ptrValue = paramObject;
+                       }
+               }
+               else if(ILType_IsValueType(paramType))
+               {
+                       paramObject = (ILObject *)_ILEngineAllocObject
+                               (thread, ILType_ToValueType(paramType));
+                       if(!paramObject)
+                       {
+                               return 0;
+                       }
+                       result.ptrValue = paramObject;
+               }
+               else
+               {
+                       paramObject = 0;
+                       result.ptrValue = (void *)&paramObject;
+               }
+
+               /* and call the method now. */
+               if(ILExecThreadCallV(thread, method, result.ptrValue, args))
+               {
+                       /* An exception was thrown by the method */
+                       return 0;
+               }
+       }
+
+       return paramObject;
+#else
        /* Allocate a boxing object for the result if it is a value type */
        ILMemZero(&result, sizeof(result));
        paramType = ILTypeGetEnumType(ILTypeGetReturn(signature));
@@ -3109,6 +3174,7 @@
                /* Don't know how to box this type of value */
                return 0;
        }
+#endif
 }
 
 /*




reply via email to

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