[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnet/codegen cg_decls.tc,1.47,1.48 cg_gen.h,
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnet/codegen cg_decls.tc,1.47,1.48 cg_gen.h,1.38,1.39 cg_interface.c,1.1,1.2 cg_nodes.tc,1.76,1.77 jv_decls.tc,1.15,1.16 |
Date: |
Thu, 27 Feb 2003 01:19:26 -0500 |
Update of /cvsroot/dotgnu-pnet/pnet/codegen
In directory subversions:/tmp/cvs-serv9182/codegen
Modified Files:
cg_decls.tc cg_gen.h cg_interface.c cg_nodes.tc jv_decls.tc
Log Message:
Fix bug #2439 - pending implementation of interfaces.
Index: cg_decls.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/codegen/cg_decls.tc,v
retrieving revision 1.47
retrieving revision 1.48
diff -C2 -r1.47 -r1.48
*** cg_decls.tc 26 Feb 2003 00:07:25 -0000 1.47
--- cg_decls.tc 27 Feb 2003 06:19:22 -0000 1.48
***************
*** 250,253 ****
--- 250,322 ----
/*
+ * Generate discard code for an interface proxy replacement method.
+ */
+ ILNode_GenDiscard(ILNode_ProxyDeclaration)
+ {
+ FILE *outstream = info->asmOutput;
+ char *name;
+ ILType *signature = ILMethod_Signature(node->interfaceMethod);
+ unsigned long numParams;
+ unsigned long param;
+
+ /* Bail out if no assembly output stream */
+ if(!outstream)
+ {
+ return;
+ }
+
+ /* Create a name for the proxy method */
+ name = ILInternAppendedString
+ (ILInternAppendedString
+ (ILInternString
+ ((char
*)ILClass_Name(ILMethod_Owner(node->interfaceMethod)),
+ -1),
+ ILInternString(".", 1)),
+ ILInternString((char *)ILMethod_Name(node->interfaceMethod),
-1))
+ .string;
+
+ /* Dump the method heading */
+ fputs(".method ", outstream);
+ ILDumpFlags(outstream, IL_META_METHODDEF_PRIVATE |
+ IL_META_METHODDEF_FINAL |
+ IL_META_METHODDEF_VIRTUAL |
+ IL_META_METHODDEF_NEW_SLOT,
+ ILMethodDefinitionFlags, 0);
+ ILDumpMethodType(outstream, info->image, signature,
+ IL_DUMP_QUOTE_NAMES, 0, name,
+ node->interfaceMethod);
+ fputs(" il managed\n{\n", outstream);
+
+ /* Output the ".override" declaration */
+ fputs("\t.override\t", outstream);
+ ILDumpClassName(outstream, info->image,
+ ILMethod_Owner(node->interfaceMethod),
+ IL_DUMP_QUOTE_NAMES);
+ fputs("::", outstream);
+ ILDumpIdentifier(outstream, ILMethod_Name(node->interfaceMethod), 0,
+ IL_DUMP_QUOTE_NAMES);
+ putc('\n', outstream);
+
+ /* Push all of the arguments onto the stack, including "this" */
+ numParams = ILTypeNumParams(signature);
+ for(param = 0; param <= numParams; ++param)
+ {
+ ILGenLoadArg(info, (unsigned)param);
+ }
+
+ /* Call the proxy replacement method */
+ ILGenCallMethod(info, node->proxyReplacement);
+
+ /* Return from the proxy method */
+ ILGenSimple(info, IL_OP_RET);
+
+ /* Set the maximum stack height */
+ fprintf(outstream, "\t.maxstack %ld\n", numParams + 1);
+
+ /* Output the method footer */
+ fputs("}\n", outstream);
+ }
+
+ /*
* Generate discard code for a scope change.
*/
Index: cg_gen.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/codegen/cg_gen.h,v
retrieving revision 1.38
retrieving revision 1.39
diff -C2 -r1.38 -r1.39
*** cg_gen.h 26 Feb 2003 05:09:50 -0000 1.38
--- cg_gen.h 27 Feb 2003 06:19:22 -0000 1.39
***************
*** 277,283 ****
typedef void (*ILGenInterfaceErrorFunc)(ILNode *node, ILClass *classInfo,
ILMember *missingMember);
int ILGenImplementsAllInterfaces(ILGenInfo *info, ILNode *node,
ILClass *classInfo,
!
ILGenInterfaceErrorFunc error);
/*
--- 277,287 ----
typedef void (*ILGenInterfaceErrorFunc)(ILNode *node, ILClass *classInfo,
ILMember *missingMember);
+ typedef void (*ILGenInterfaceProxyFunc)(ILNode *node, ILClass *classInfo,
+
ILMethod *missingMember,
+
ILMethod *proxyReplacement);
int ILGenImplementsAllInterfaces(ILGenInfo *info, ILNode *node,
ILClass *classInfo,
!
ILGenInterfaceErrorFunc error,
!
ILGenInterfaceProxyFunc proxy);
/*
Index: cg_interface.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/codegen/cg_interface.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** cg_interface.c 19 Mar 2002 07:38:05 -0000 1.1
--- cg_interface.c 27 Feb 2003 06:19:22 -0000 1.2
***************
*** 30,39 ****
*/
static int ImplementsMethod(ILNode *node, ILClass *classInfo, ILMethod
*method,
! ILGenInterfaceErrorFunc
error)
{
if(!ILClassGetMethodImpl(classInfo, method))
{
! (*error)(node, classInfo, (ILMember *)method);
! return 1;
}
else
--- 30,50 ----
*/
static int ImplementsMethod(ILNode *node, ILClass *classInfo, ILMethod
*method,
! ILGenInterfaceErrorFunc
error,
! ILGenInterfaceProxyFunc
proxy)
{
if(!ILClassGetMethodImpl(classInfo, method))
{
! ILMethod *proxyMethod;
! proxyMethod = ILClassGetMethodImplForProxy(classInfo, method);
! if(!proxyMethod)
! {
! (*error)(node, classInfo, (ILMember *)method);
! return 1;
! }
! else
! {
! (*proxy)(node, classInfo, method, proxyMethod);
! return 0;
! }
}
else
***************
*** 48,55 ****
*/
static int ImplementsMethodSem(ILNode *node, ILClass *classInfo,
! ILMember *member,
ILGenInterfaceErrorFunc error)
{
ILUInt16 semType;
ILMethod *method;
/* Scan through all method semantics kinds on the member,
--- 59,68 ----
*/
static int ImplementsMethodSem(ILNode *node, ILClass *classInfo,
! ILMember *member,
ILGenInterfaceErrorFunc error,
!
ILGenInterfaceProxyFunc proxy)
{
ILUInt16 semType;
ILMethod *method;
+ ILMethod *proxyMethod;
/* Scan through all method semantics kinds on the member,
***************
*** 61,66 ****
if(method && !ILClassGetMethodImpl(classInfo, method))
{
! (*error)(node, classInfo, member);
! return 1;
}
semType >>= 1;
--- 74,87 ----
if(method && !ILClassGetMethodImpl(classInfo, method))
{
! proxyMethod = ILClassGetMethodImplForProxy(classInfo,
method);
! if(!proxyMethod)
! {
! (*error)(node, classInfo, member);
! return 1;
! }
! else
! {
! (*proxy)(node, classInfo, method, proxyMethod);
! }
}
semType >>= 1;
***************
*** 77,80 ****
--- 98,102 ----
ILClass *refClass,
ILGenInterfaceErrorFunc error,
+
ILGenInterfaceProxyFunc proxy,
ILClass
**visited, int *visitedSize);
***************
*** 86,89 ****
--- 108,112 ----
ILClass *interface,
ILGenInterfaceErrorFunc error,
+
ILGenInterfaceProxyFunc proxy,
ILClass **visited,
int *visitedSize)
{
***************
*** 110,118 ****
{
sawErrors |= ImplementsMethod(node, classInfo,
!
(ILMethod *)member, error);
}
else if(ILMember_IsProperty(member) || ILMember_IsEvent(member))
{
! sawErrors |= ImplementsMethodSem(node, classInfo,
member, error);
}
}
--- 133,142 ----
{
sawErrors |= ImplementsMethod(node, classInfo,
!
(ILMethod *)member, error, proxy);
}
else if(ILMember_IsProperty(member) || ILMember_IsEvent(member))
{
! sawErrors |= ImplementsMethodSem(node, classInfo,
member,
!
error, proxy);
}
}
***************
*** 120,124 ****
/* Process all of the parent interfaces */
return sawErrors | ImplementsAllInterfaces(node, classInfo, interface,
!
error, visited, visitedSize);
}
--- 144,149 ----
/* Process all of the parent interfaces */
return sawErrors | ImplementsAllInterfaces(node, classInfo, interface,
!
error, proxy, visited,
!
visitedSize);
}
***************
*** 130,133 ****
--- 155,159 ----
ILClass *refClass,
ILGenInterfaceErrorFunc error,
+
ILGenInterfaceProxyFunc proxy,
ILClass
**visited, int *visitedSize)
{
***************
*** 139,143 ****
(node, classInfo,
ILClassResolve(ILImplementsGetInterface(impl)),
! error, visited, visitedSize);
}
return sawErrors;
--- 165,169 ----
(node, classInfo,
ILClassResolve(ILImplementsGetInterface(impl)),
! error, proxy, visited, visitedSize);
}
return sawErrors;
***************
*** 160,164 ****
int ILGenImplementsAllInterfaces(ILGenInfo *info, ILNode *node,
ILClass *classInfo,
!
ILGenInterfaceErrorFunc error)
{
ILClass **visited;
--- 186,191 ----
int ILGenImplementsAllInterfaces(ILGenInfo *info, ILNode *node,
ILClass *classInfo,
!
ILGenInterfaceErrorFunc error,
!
ILGenInterfaceProxyFunc proxy)
{
ILClass **visited;
***************
*** 179,183 ****
/* Recursively visit all interfaces */
sawErrors = ImplementsAllInterfaces(node, classInfo, classInfo, error,
!
visited, &visitedSize);
/* Clean up and exit */
--- 206,210 ----
/* Recursively visit all interfaces */
sawErrors = ImplementsAllInterfaces(node, classInfo, classInfo, error,
!
proxy, visited, &visitedSize);
/* Clean up and exit */
Index: cg_nodes.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/codegen/cg_nodes.tc,v
retrieving revision 1.76
retrieving revision 1.77
diff -C2 -r1.76 -r1.77
*** cg_nodes.tc 27 Feb 2003 02:57:43 -0000 1.76
--- cg_nodes.tc 27 Feb 2003 06:19:22 -0000 1.77
***************
*** 852,855 ****
--- 852,860 ----
%nocreate ILNode_EventDeclaration *backLink = {0};
}
+ %node ILNode_ProxyDeclaration ILNode_Declaration =
+ {
+ ILMethod *interfaceMethod;
+ ILMethod *proxyReplacement;
+ }
/*
Index: jv_decls.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/codegen/jv_decls.tc,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -r1.15 -r1.16
*** jv_decls.tc 27 Mar 2002 01:28:46 -0000 1.15
--- jv_decls.tc 27 Feb 2003 06:19:22 -0000 1.16
***************
*** 31,34 ****
--- 31,42 ----
/*
+ * Generate discard code for an interface proxy replacement method.
+ */
+ JavaGenDiscard(ILNode_ProxyDeclaration)
+ {
+ /* TODO */
+ }
+
+ /*
* Generate discard code for a scope change.
*/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnet/codegen cg_decls.tc,1.47,1.48 cg_gen.h,1.38,1.39 cg_interface.c,1.1,1.2 cg_nodes.tc,1.76,1.77 jv_decls.tc,1.15,1.16,
Rhys Weatherley <address@hidden> <=