[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnet/engine cvmc.c, 1.42, 1.43 cvmc_conv.c, 1
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnet/engine cvmc.c, 1.42, 1.43 cvmc_conv.c, 1.3, 1.4 gen_marshal.tc, 1.1, 1.2 null_coder.c, 1.23, 1.24 |
Date: |
Mon, 28 Jul 2003 02:39:48 -0400 |
Update of /cvsroot/dotgnu-pnet/pnet/engine
In directory subversions:/tmp/cvs-serv7218/engine
Modified Files:
cvmc.c cvmc_conv.c gen_marshal.tc null_coder.c
Log Message:
Parameter marshalling.
Index: cvmc.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/cvmc.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -C2 -r1.42 -r1.43
*** cvmc.c 28 Jul 2003 03:56:24 -0000 1.42
--- cvmc.c 28 Jul 2003 06:39:46 -0000 1.43
***************
*** 453,456 ****
--- 453,458 ----
CVMCoder_CallFfi,
CVMCoder_CheckNull,
+ CVMCoder_Convert,
+ CVMCoder_ConvertCustom,
"sentinel"
};
Index: cvmc_conv.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/cvmc_conv.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** cvmc_conv.c 16 May 2002 04:48:10 -0000 1.3
--- cvmc_conv.c 28 Jul 2003 06:39:46 -0000 1.4
***************
*** 672,674 ****
--- 672,697 ----
}
+ /*
+ * Output an instruction to convert the top of stack according
+ * to a PInvoke marshalling rule.
+ */
+ static void CVMCoder_Convert(ILCoder *coder, int opcode)
+ {
+ CVMP_OUT_NONE(opcode);
+ }
+
+ /*
+ * Output an instruction to convert the top of stack according
+ * to a custom marshalling rule.
+ */
+ static void CVMCoder_ConvertCustom(ILCoder *coder, int opcode,
+ ILUInt32
customNameLen,
+ ILUInt32
customCookieLen,
+ void *customName,
void *customCookie)
+ {
+ CVMP_OUT_WORD2_PTR2(COP_PREFIX_TOCUSTOM,
+ customNameLen, customCookieLen,
+ customName, customCookie);
+ }
+
#endif /* IL_CVMC_CODE */
Index: gen_marshal.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/gen_marshal.tc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** gen_marshal.tc 28 Jul 2003 03:56:24 -0000 1.1
--- gen_marshal.tc 28 Jul 2003 06:39:46 -0000 1.2
***************
*** 113,116 ****
--- 113,133 ----
}
%node ILM_ReturnCtor ILM_Unary
+ %node ILM_Convert ILM_Unary =
+ {
+ int opcode;
+ }
+ %node ILM_ConvertCustom ILM_Unary =
+ {
+ int opcode;
+ ILUInt32 customNameLen;
+ ILUInt32 customCookieLen;
+ void *customName;
+ void *customCookie;
+ }
+ %node ILM_AddressOf ILM_Unary =
+ {
+ ILType *type;
+ %nocreate ILUInt32 localNum = {IL_MAX_UINT32};
+ }
/*
***************
*** 234,237 ****
--- 251,262 ----
ILM_AllocLocals(node->expr2, context);
}
+ ILM_AllocLocals(ILM_AddressOf)
+ {
+ ILM_AllocLocals(node->expr, context);
+ if(!ILM_isa(node->expr, ILM_LValue))
+ {
+ node->localNum = ILCoderAllocExtraLocal(context->coder,
node->type);
+ }
+ }
ILM_AllocLocals(ILM_FfiArgument)
{
***************
*** 313,316 ****
--- 338,346 ----
ILM_ClearLocals(node->expr2, context);
}
+ ILM_ClearLocals(ILM_AddressOf)
+ {
+ ILM_ClearLocals(node->expr, context);
+ node->localNum = IL_MAX_UINT32;
+ }
ILM_ClearLocals(ILM_FfiArgument)
{
***************
*** 668,671 ****
--- 698,740 ----
/*
+ * Generate value code for a CVM conversion opcode.
+ */
+ ILM_GenValue(ILM_Convert)
+ {
+ ILM_GenValue(node->expr, context);
+ ILCoderConvert(context->coder, node->opcode);
+ }
+
+ /*
+ * Generate value code for a custom marshalling conversion.
+ */
+ ILM_GenValue(ILM_ConvertCustom)
+ {
+ ILM_GenValue(node->expr, context);
+ ILCoderConvertCustom(context->coder, node->opcode,
+ node->customNameLen,
node->customCookieLen,
+ node->customName,
node->customCookie);
+ }
+
+ /*
+ * Generate value code for an "address of" operator.
+ */
+ ILM_GenValue(ILM_AddressOf)
+ {
+ if(ILM_isa(node->expr, ILM_LValue))
+ {
+ ILM_GenRef((ILM_LValue *)(node->expr), context);
+ }
+ else
+ {
+ /* Store the value in a local variable before taking its
address */
+ ILM_GenValue(node->expr, context);
+ ILCoderStoreLocal(context->coder, node->localNum,
+
_ILTypeToEngineType(node->type), node->type);
+ ILCoderAddrOfLocal(context->coder, node->localNum);
+ }
+ }
+
+ /*
* Generate code for a "try ... finally ..." block.
*/
***************
*** 843,849 ****
unsigned long paramNum,
ILType *argType, ILM_Node *node,
!
ILM_Node *cleanup)
{
! /* TODO */
return node;
}
--- 912,1021 ----
unsigned long paramNum,
ILType *argType, ILM_Node *node,
!
ILM_Node *cleanup, ILPInvoke *pinv)
{
! #ifdef IL_CONFIG_PINVOKE
! ILUInt32 marshalType;
! char *customName;
! int customNameLen;
! char *customCookie;
! int customCookieLen;
! #endif
!
! /* Resolve enumerated type references first */
! argType = ILTypeGetEnumType(argType);
!
! /* Value types are passed by reference to internalcalls */
! if(context->isInternal && ILType_IsValueType(argType))
! {
! node = ILM_AddressOf_create(state, node, argType);
! }
!
! #ifdef IL_CONFIG_PINVOKE
!
! /* Process the PInvoke marshalling information */
! if(!(context->isInternal) &&
! (marshalType = ILPInvokeGetMarshalType(pinv, context->method,
paramNum,
!
&customName, &customNameLen,
!
&customCookie,
!
&customCookieLen))
! != IL_META_MARSHAL_DIRECT)
! {
! switch(marshalType)
! {
! case IL_META_MARSHAL_ANSI_STRING:
! {
! node = ILM_Convert_create(state, node,
COP_PREFIX_STR2ANSI);
! }
! break;
!
! case IL_META_MARSHAL_UTF8_STRING:
! {
! node = ILM_Convert_create(state, node,
COP_PREFIX_STR2UTF8);
! }
! break;
!
! case IL_META_MARSHAL_UTF16_STRING:
! {
! node = ILM_Convert_create(state, node,
COP_PREFIX_STR2UTF16);
! }
! break;
!
! case IL_META_MARSHAL_FNPTR:
! {
! node = ILM_Convert_create
! (state, node,
COP_PREFIX_DELEGATE2FNPTR);
! }
! break;
!
! case IL_META_MARSHAL_ARRAY:
! {
! node = ILM_Convert_create(state, node,
COP_PREFIX_ARRAY2PTR);
! }
! break;
!
! case IL_META_MARSHAL_REF_ANSI_ARRAY:
! {
! node = ILM_Convert_create
! (state, node, COP_PREFIX_REFARRAY2ANSI);
! }
! break;
!
! case IL_META_MARSHAL_REF_UTF8_ARRAY:
! {
! node = ILM_Convert_create
! (state, node, COP_PREFIX_REFARRAY2UTF8);
! }
! break;
!
! case IL_META_MARSHAL_CUSTOM:
! {
! node = ILM_ConvertCustom_create
! (state, node, COP_PREFIX_TOCUSTOM,
! (ILUInt32)(ILInt32)customNameLen,
! (ILUInt32)(ILInt32)customCookieLen,
! (void *)customName,
! (void *)customCookie);
! }
! break;
!
! case IL_META_MARSHAL_ANSI_ARRAY:
! {
! node = ILM_Convert_create
! (state, node, COP_PREFIX_ARRAY2ANSI);
! }
! break;
!
! case IL_META_MARSHAL_UTF8_ARRAY:
! {
! node = ILM_Convert_create
! (state, node, COP_PREFIX_ARRAY2UTF8);
! }
! break;
! }
! }
!
! #endif /* IL_CONFIG_PINVOKE */
!
! /* Return the adjusted node to the caller */
return node;
}
***************
*** 878,881 ****
--- 1050,1054 ----
ILType *argType;
ILM_Node *argNode;
+ ILPInvoke *pinv;
/* Create the main compound statement for the method */
***************
*** 891,894 ****
--- 1064,1077 ----
ILM_Compound_Add(state, compound, ILM_FfiThis_create(state));
+ /* Get the PInvoke information for the method */
+ if(context->isInternal)
+ {
+ pinv = 0;
+ }
+ else
+ {
+ pinv = ILPInvokeFind(context->method);
+ }
+
/* Create a local variable to hold the return value */
/* TODO: the type may be different if it is structure-marshalled */
***************
*** 928,932 ****
}
argNode = MarshalNativeParameter
! (context, state, paramNum, argType, argNode, cleanup);
ILM_Compound_Add(state, compound, argNode);
++argNum;
--- 1111,1115 ----
}
argNode = MarshalNativeParameter
! (context, state, paramNum, argType, argNode, cleanup,
pinv);
ILM_Compound_Add(state, compound, argNode);
++argNum;
Index: null_coder.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/null_coder.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -r1.23 -r1.24
*** null_coder.c 28 Jul 2003 03:56:24 -0000 1.23
--- null_coder.c 28 Jul 2003 06:39:46 -0000 1.24
***************
*** 399,402 ****
--- 399,411 ----
{
}
+ static void Coder_Convert(ILCoder *coder, int opcode)
+ {
+ }
+ static void Coder_ConvertCustom(ILCoder *coder, int opcode,
+ ILUInt32 customNameLen,
+ ILUInt32
customCookieLen,
+ void *customName, void
*customCookie)
+ {
+ }
/*
***************
*** 504,507 ****
--- 513,518 ----
Coder_CallFfi,
Coder_CheckNull,
+ Coder_Convert,
+ Coder_ConvertCustom,
"sentinel"
};
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnet/engine cvmc.c, 1.42, 1.43 cvmc_conv.c, 1.3, 1.4 gen_marshal.tc, 1.1, 1.2 null_coder.c, 1.23, 1.24,
Rhys Weatherley <address@hidden> <=