[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] pnet/engine lib_delegate.c,1.6,1.7
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] pnet/engine lib_delegate.c,1.6,1.7 |
Date: |
Mon, 01 Dec 2003 01:07:53 +0000 |
Update of /cvsroot/dotgnu-pnet/pnet/engine
In directory subversions:/tmp/cvs-serv11885/engine
Modified Files:
lib_delegate.c
Log Message:
PackDelegateInvokeParams: fix a bug with the expansion of float and
double parameters (bug #6891).
Index: lib_delegate.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/lib_delegate.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** lib_delegate.c 8 Oct 2003 09:42:42 -0000 1.6
--- lib_delegate.c 1 Dec 2003 01:07:51 -0000 1.7
***************
*** 147,150 ****
--- 147,164 ----
/*
+ * Read a double value from a stack position.
+ */
+ static IL_INLINE ILDouble DelegateReadDouble(CVMWord *stack)
+ {
+ #ifdef CVM_DOUBLES_ALIGNED_WORD
+ return *((ILDouble *)stack);
+ #else
+ ILDouble temp;
+ ILMemCpy(&temp, stack, sizeof(ILDouble));
+ return temp;
+ #endif
+ }
+
+ /*
* Pack the parameters for a delegate invocation.
*/
***************
*** 155,158 ****
--- 169,179 ----
ILType *signature = ILMethod_Signature(method);
CVMWord *stacktop = thread->stackTop;
+ ILType *type;
+ unsigned long numParams;
+ unsigned long paramNum;
+ ILNativeFloat nativeFloat;
+ CVMWord *words;
+ ILUInt32 size;
+ CVMWord *ptr;
/* Push the "this" pointer if necessary */
***************
*** 176,181 ****
return 1;
}
! ILMemCpy(stacktop, params->words, params->numWords * sizeof(CVMWord));
! stacktop += params->numWords;
/* Update the stack top */
--- 197,230 ----
return 1;
}
!
! /* Expand "float" and "double" parameters, because the frame variables
! are in "fixed up" form, rather than native float form */
! numParams = ILTypeNumParams(signature);
! words = params->words;
! for(paramNum = 1; paramNum <= numParams; ++paramNum)
! {
! type = ILTypeGetParam(signature, paramNum);
! if(type == ILType_Float32)
! {
! nativeFloat = (ILNativeFloat)(*((ILFloat *)words));
! ptr = (CVMWord *)&nativeFloat;
! size = CVM_WORDS_PER_NATIVE_FLOAT;
! }
! else if(type == ILType_Float64)
! {
! nativeFloat = (ILNativeFloat)DelegateReadDouble(words);
! ptr = (CVMWord *)&nativeFloat;
! size = CVM_WORDS_PER_NATIVE_FLOAT;
! }
! else
! {
! ptr = words;
! size = ((ILSizeOfType(thread, type) + sizeof(CVMWord) -
1)
! / sizeof(CVMWord));
! }
! ILMemCpy(stacktop, ptr, size * sizeof(CVMWord));
! words += size;
! stacktop += size;
! }
/* Update the stack top */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] pnet/engine lib_delegate.c,1.6,1.7,
Rhys Weatherley <address@hidden> <=