[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnet/engine cvm.h,1.44,1.45 cvm_conv.c,1.26,
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnet/engine cvm.h,1.44,1.45 cvm_conv.c,1.26,1.27 cvm_dasm.c,1.50,1.51 cvm_lengths.c,1.13,1.14 cvmc_setup.c,1.32,1.33 |
Date: |
Thu, 01 May 2003 06:29:10 -0400 |
Update of /cvsroot/dotgnu-pnet/pnet/engine
In directory subversions:/tmp/cvs-serv15975/engine
Modified Files:
cvm.h cvm_conv.c cvm_dasm.c cvm_lengths.c cvmc_setup.c
Log Message:
Add "String[]" to the set of types that are specially marshalled in
PInvoke operations (Bug #3387).
Index: cvm.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/cvm.h,v
retrieving revision 1.44
retrieving revision 1.45
diff -C2 -r1.44 -r1.45
*** cvm.h 18 Apr 2003 09:15:52 -0000 1.44
--- cvm.h 1 May 2003 10:29:08 -0000 1.45
***************
*** 471,515 ****
#define COP_PREFIX_TOCUSTOM 0x46
#define COP_PREFIX_FROMCUSTOM 0x47
/*
* Inline method replacements.
*/
! #define COP_PREFIX_STRING_CONCAT_2 0x48
! #define COP_PREFIX_STRING_CONCAT_3 0x49
! #define COP_PREFIX_STRING_CONCAT_4 0x4A
! #define COP_PREFIX_STRING_EQ 0x4B
! #define COP_PREFIX_STRING_NE 0x4C
! #define COP_PREFIX_STRING_GET_CHAR 0x4D
! #define COP_PREFIX_TYPE_FROM_HANDLE 0x4E
! #define COP_PREFIX_MONITOR_ENTER 0x4F
! #define COP_PREFIX_MONITOR_EXIT 0x50
! #define COP_PREFIX_APPEND_CHAR 0x51
! #define COP_PREFIX_IS_WHITE_SPACE 0x52
/*
* Binary value fixups.
*/
! #define COP_PREFIX_FIX_I4_I 0x53
! #define COP_PREFIX_FIX_I4_U 0x54
/*
* Trigger method unrolling.
*/
! #define COP_PREFIX_UNROLL_METHOD 0x55
/*
* Allocate local stack space.
*/
! #define COP_PREFIX_LOCAL_ALLOC 0x56
/*
* Method profiling.
*/
! #define COP_PREFIX_PROFILE_COUNT 0x57
/*
* Thread static handling.
*/
! #define COP_PREFIX_THREAD_STATIC 0x58
/*
--- 471,517 ----
#define COP_PREFIX_TOCUSTOM 0x46
#define COP_PREFIX_FROMCUSTOM 0x47
+ #define COP_PREFIX_ARRAY2ANSI 0x48
+ #define COP_PREFIX_ARRAY2UTF8 0x49
/*
* Inline method replacements.
*/
! #define COP_PREFIX_STRING_CONCAT_2 0x4A
! #define COP_PREFIX_STRING_CONCAT_3 0x4B
! #define COP_PREFIX_STRING_CONCAT_4 0x4C
! #define COP_PREFIX_STRING_EQ 0x4D
! #define COP_PREFIX_STRING_NE 0x4E
! #define COP_PREFIX_STRING_GET_CHAR 0x4F
! #define COP_PREFIX_TYPE_FROM_HANDLE 0x50
! #define COP_PREFIX_MONITOR_ENTER 0x51
! #define COP_PREFIX_MONITOR_EXIT 0x52
! #define COP_PREFIX_APPEND_CHAR 0x53
! #define COP_PREFIX_IS_WHITE_SPACE 0x54
/*
* Binary value fixups.
*/
! #define COP_PREFIX_FIX_I4_I 0x55
! #define COP_PREFIX_FIX_I4_U 0x56
/*
* Trigger method unrolling.
*/
! #define COP_PREFIX_UNROLL_METHOD 0x57
/*
* Allocate local stack space.
*/
! #define COP_PREFIX_LOCAL_ALLOC 0x58
/*
* Method profiling.
*/
! #define COP_PREFIX_PROFILE_COUNT 0x59
/*
* Thread static handling.
*/
! #define COP_PREFIX_THREAD_STATIC 0x5A
/*
Index: cvm_conv.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/cvm_conv.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -r1.26 -r1.27
*** cvm_conv.c 17 Feb 2003 05:20:31 -0000 1.26
--- cvm_conv.c 1 May 2003 10:29:08 -0000 1.27
***************
*** 195,199 ****
*/
static void *RefArrayToC(ILExecThread *thread, void *ref,
! char *(*conv)(ILExecThread
*thread, ILString *str))
{
void *result;
--- 195,200 ----
*/
static void *RefArrayToC(ILExecThread *thread, void *ref,
! char *(*conv)(ILExecThread
*thread, ILString *str),
! int needRefPtr)
{
void *result;
***************
*** 215,219 ****
/* Extract the string array and then create a new C array */
! array = *((System_Array **)ref);
result = ILGCAlloc(sizeof(void *) * (array->length + 2));
if(!result)
--- 216,227 ----
/* Extract the string array and then create a new C array */
! if(needRefPtr)
! {
! array = *((System_Array **)ref);
! }
! else
! {
! array = (System_Array *)ref;
! }
result = ILGCAlloc(sizeof(void *) * (array->length + 2));
if(!result)
***************
*** 241,245 ****
/* Return the new reference to the caller */
! return result;
}
--- 249,260 ----
/* Return the new reference to the caller */
! if(needRefPtr)
! {
! return result;
! }
! else
! {
! return (void *)(((void **)result) + 1);
! }
}
***************
*** 2082,2086 ****
COPY_STATE_TO_THREAD();
stacktop[-1].ptrValue = RefArrayToC(thread, stacktop[-1].ptrValue,
!
ILStringToAnsi);
RESTORE_STATE_FROM_THREAD();
MODIFY_PC_AND_STACK(CVMP_LEN_NONE, 0);
--- 2097,2101 ----
COPY_STATE_TO_THREAD();
stacktop[-1].ptrValue = RefArrayToC(thread, stacktop[-1].ptrValue,
!
ILStringToAnsi, 1);
RESTORE_STATE_FROM_THREAD();
MODIFY_PC_AND_STACK(CVMP_LEN_NONE, 0);
***************
*** 2120,2124 ****
COPY_STATE_TO_THREAD();
stacktop[-1].ptrValue = RefArrayToC(thread, stacktop[-1].ptrValue,
!
ILStringToUTF8);
RESTORE_STATE_FROM_THREAD();
MODIFY_PC_AND_STACK(CVMP_LEN_NONE, 0);
--- 2135,2139 ----
COPY_STATE_TO_THREAD();
stacktop[-1].ptrValue = RefArrayToC(thread, stacktop[-1].ptrValue,
!
ILStringToUTF8, 1);
RESTORE_STATE_FROM_THREAD();
MODIFY_PC_AND_STACK(CVMP_LEN_NONE, 0);
***************
*** 2127,2130 ****
--- 2142,2217 ----
/**
+ * <opcode name="array2ansi" group="Conversion operators">
+ * <operation>Convert an array of strings into an array of
+ * <code>ansi char *</code> values</operation>
+ *
+ * <format>prefix<fsep/>array2ansi</format>
+ * <dformat>{array2ansi}</dformat>
+ *
+ * <form name="array2ansi" code="COP_PREFIX_ARRAY2ANSI"/>
+ *
+ * <before>..., value</before>
+ * <after>..., result</after>
+ *
+ * <description>The <i>value</i> is popped from the stack as
+ * type <code>ptr</code>. The <code>String[]</code> object at
+ * the address <i>value</i> is retrieved. It is converted into
+ * a NULL-terminated C array of the same size, with all of the
+ * strings converted into the ANSI character encoding. Then
+ * a pointer to this array is pushed as <i>result</i>.
+ * </description>
+ *
+ * <notes>This instruction is used to marshal parameters of type
+ * <code>String[]</code> "PInvoke" marshalling operations.</notes>
+ * </opcode>
+ */
+ VMCASE(COP_PREFIX_ARRAY2ANSI):
+ {
+ /* Convert a reference to a string array into an ANSI array */
+ COPY_STATE_TO_THREAD();
+ stacktop[-1].ptrValue = RefArrayToC(thread, stacktop[-1].ptrValue,
+
ILStringToAnsi, 0);
+ RESTORE_STATE_FROM_THREAD();
+ MODIFY_PC_AND_STACK(CVMP_LEN_NONE, 0);
+ }
+ VMBREAK(COP_PREFIX_ARRAY2ANSI);
+
+ /**
+ * <opcode name="array2utf8" group="Conversion operators">
+ * <operation>Convert an array of strings into an array of
+ * <code>utf8 char *</code> values</operation>
+ *
+ * <format>prefix<fsep/>array2utf8</format>
+ * <dformat>{array2utf8}</dformat>
+ *
+ * <form name="array2utf8" code="COP_PREFIX_ARRAY2UTF8"/>
+ *
+ * <before>..., value</before>
+ * <after>..., result</after>
+ *
+ * <description>The <i>value</i> is popped from the stack as
+ * type <code>ptr</code>. The <code>String[]</code> object at
+ * the address <i>value</i> is retrieved. It is converted into
+ * a NULL-terminated C array of the same size, with all of the
+ * strings converted into the UTF8 character encoding. Then
+ * a pointer to this array is pushed as <i>result</i>.
+ * </description>
+ *
+ * <notes>This instruction is used to marshal parameters of type
+ * <code>String[]</code> "PInvoke" marshalling operations.</notes>
+ * </opcode>
+ */
+ VMCASE(COP_PREFIX_ARRAY2UTF8):
+ {
+ /* Convert a reference to a string array into an ANSI array */
+ COPY_STATE_TO_THREAD();
+ stacktop[-1].ptrValue = RefArrayToC(thread, stacktop[-1].ptrValue,
+
ILStringToUTF8, 0);
+ RESTORE_STATE_FROM_THREAD();
+ MODIFY_PC_AND_STACK(CVMP_LEN_NONE, 0);
+ }
+ VMBREAK(COP_PREFIX_ARRAY2UTF8);
+
+ /**
* <opcode name="tocustom" group="Conversion operators">
* <operation>Convert an object reference into a custom native
***************
*** 2212,2215 ****
--- 2299,2304 ----
VMCASE(COP_PREFIX_REFARRAY2ANSI):
VMCASE(COP_PREFIX_REFARRAY2UTF8):
+ VMCASE(COP_PREFIX_ARRAY2ANSI):
+ VMCASE(COP_PREFIX_ARRAY2UTF8):
{
/* Stub out PInvoke-related CVM opcodes */
Index: cvm_dasm.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/cvm_dasm.c,v
retrieving revision 1.50
retrieving revision 1.51
diff -C2 -r1.50 -r1.51
*** cvm_dasm.c 18 Apr 2003 09:15:52 -0000 1.50
--- cvm_dasm.c 1 May 2003 10:29:08 -0000 1.51
***************
*** 527,530 ****
--- 527,532 ----
{"tocustom", CVM_OPER_CUSTOM},
{"fromcustom", CVM_OPER_CUSTOM},
+ {"array2ansi", CVM_OPER_NONE},
+ {"array2utf8", CVM_OPER_NONE},
/*
***************
*** 572,577 ****
* Reserved opcodes.
*/
- {"preserved_59", CVM_OPER_NONE},
- {"preserved_5A", CVM_OPER_NONE},
{"preserved_5B", CVM_OPER_NONE},
{"preserved_5C", CVM_OPER_NONE},
--- 574,577 ----
Index: cvm_lengths.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/cvm_lengths.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -r1.13 -r1.14
*** cvm_lengths.c 18 Apr 2003 09:15:52 -0000 1.13
--- cvm_lengths.c 1 May 2003 10:29:08 -0000 1.14
***************
*** 484,487 ****
--- 484,489 ----
/* tocustom */ CVMP_LEN_WORD2_PTR2,
/* fromcustom */ CVMP_LEN_WORD2_PTR2,
+ /* array2ansi */ CVMP_LEN_NONE,
+ /* array2utf8 */ CVMP_LEN_NONE,
/*
***************
*** 529,534 ****
* Reserved opcodes.
*/
- /* preserved_59 */ CVMP_LEN_NONE,
- /* preserved_5a */ CVMP_LEN_NONE,
/* preserved_5b */ CVMP_LEN_NONE,
/* preserved_5c */ CVMP_LEN_NONE,
--- 531,534 ----
Index: cvmc_setup.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/cvmc_setup.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -C2 -r1.32 -r1.33
*** cvmc_setup.c 22 Feb 2003 12:02:57 -0000 1.32
--- cvmc_setup.c 1 May 2003 10:29:08 -0000 1.33
***************
*** 651,654 ****
--- 651,666 ----
}
break;
+
+ case IL_META_MARSHAL_ANSI_ARRAY:
+ {
+ CVMP_OUT_NONE(COP_PREFIX_ARRAY2ANSI);
+ }
+ break;
+
+ case IL_META_MARSHAL_UTF8_ARRAY:
+ {
+ CVMP_OUT_NONE(COP_PREFIX_ARRAY2UTF8);
+ }
+ break;
}
if(offset < 4)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnet/engine cvm.h,1.44,1.45 cvm_conv.c,1.26,1.27 cvm_dasm.c,1.50,1.51 cvm_lengths.c,1.13,1.14 cvmc_setup.c,1.32,1.33,
Rhys Weatherley <address@hidden> <=