[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[dotgnu-pnet-commits] pnet ChangeLog codegen/cg_decls.tc codegen/cg_g...
From: |
Klaus Treichel |
Subject: |
[dotgnu-pnet-commits] pnet ChangeLog codegen/cg_decls.tc codegen/cg_g... |
Date: |
Wed, 26 Nov 2008 20:15:29 +0000 |
CVSROOT: /cvsroot/dotgnu-pnet
Module name: pnet
Changes by: Klaus Treichel <ktreichel> 08/11/26 20:15:28
Modified files:
. : ChangeLog
codegen : cg_decls.tc cg_gen.c cg_gen.h cg_interface.c
cg_resolve.c
cscc : csdoc.c
cscc/c : c_invoke.tc c_lvalue.tc
cscc/csharp : cs_gather.c cs_lookup.c cs_semantics.tc
cscc/java : java_gather.c java_lookup.c
csdoc : doc_valil.c il2doc.c
dumpasm : dump_class.c dump_ident.c
engine : layout.c lib_emit.c lib_type.c
ilalink : link_class.c
ilasm : ilasm_grammar.y
image : class.c generic_class.c item.c java_loader.c
java_writer.c meta_build.c meta_writer.c
program.h
include : il_dumpasm.h il_program.h
Log message:
Change member interface in ILImplements from ILClass * to ILProgramItem
* to be
able to hold TypeSpecs directly instead of synthetic classes.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pnet/ChangeLog?cvsroot=dotgnu-pnet&r1=1.3586&r2=1.3587
http://cvs.savannah.gnu.org/viewcvs/pnet/codegen/cg_decls.tc?cvsroot=dotgnu-pnet&r1=1.59&r2=1.60
http://cvs.savannah.gnu.org/viewcvs/pnet/codegen/cg_gen.c?cvsroot=dotgnu-pnet&r1=1.52&r2=1.53
http://cvs.savannah.gnu.org/viewcvs/pnet/codegen/cg_gen.h?cvsroot=dotgnu-pnet&r1=1.50&r2=1.51
http://cvs.savannah.gnu.org/viewcvs/pnet/codegen/cg_interface.c?cvsroot=dotgnu-pnet&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/pnet/codegen/cg_resolve.c?cvsroot=dotgnu-pnet&r1=1.16&r2=1.17
http://cvs.savannah.gnu.org/viewcvs/pnet/cscc/csdoc.c?cvsroot=dotgnu-pnet&r1=1.27&r2=1.28
http://cvs.savannah.gnu.org/viewcvs/pnet/cscc/c/c_invoke.tc?cvsroot=dotgnu-pnet&r1=1.16&r2=1.17
http://cvs.savannah.gnu.org/viewcvs/pnet/cscc/c/c_lvalue.tc?cvsroot=dotgnu-pnet&r1=1.27&r2=1.28
http://cvs.savannah.gnu.org/viewcvs/pnet/cscc/csharp/cs_gather.c?cvsroot=dotgnu-pnet&r1=1.61&r2=1.62
http://cvs.savannah.gnu.org/viewcvs/pnet/cscc/csharp/cs_lookup.c?cvsroot=dotgnu-pnet&r1=1.40&r2=1.41
http://cvs.savannah.gnu.org/viewcvs/pnet/cscc/csharp/cs_semantics.tc?cvsroot=dotgnu-pnet&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/pnet/cscc/java/java_gather.c?cvsroot=dotgnu-pnet&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/pnet/cscc/java/java_lookup.c?cvsroot=dotgnu-pnet&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/pnet/csdoc/doc_valil.c?cvsroot=dotgnu-pnet&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/pnet/csdoc/il2doc.c?cvsroot=dotgnu-pnet&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/pnet/dumpasm/dump_class.c?cvsroot=dotgnu-pnet&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/pnet/dumpasm/dump_ident.c?cvsroot=dotgnu-pnet&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/pnet/engine/layout.c?cvsroot=dotgnu-pnet&r1=1.49&r2=1.50
http://cvs.savannah.gnu.org/viewcvs/pnet/engine/lib_emit.c?cvsroot=dotgnu-pnet&r1=1.31&r2=1.32
http://cvs.savannah.gnu.org/viewcvs/pnet/engine/lib_type.c?cvsroot=dotgnu-pnet&r1=1.55&r2=1.56
http://cvs.savannah.gnu.org/viewcvs/pnet/ilalink/link_class.c?cvsroot=dotgnu-pnet&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/pnet/ilasm/ilasm_grammar.y?cvsroot=dotgnu-pnet&r1=1.51&r2=1.52
http://cvs.savannah.gnu.org/viewcvs/pnet/image/class.c?cvsroot=dotgnu-pnet&r1=1.44&r2=1.45
http://cvs.savannah.gnu.org/viewcvs/pnet/image/generic_class.c?cvsroot=dotgnu-pnet&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/pnet/image/item.c?cvsroot=dotgnu-pnet&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/pnet/image/java_loader.c?cvsroot=dotgnu-pnet&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/pnet/image/java_writer.c?cvsroot=dotgnu-pnet&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/pnet/image/meta_build.c?cvsroot=dotgnu-pnet&r1=1.52&r2=1.53
http://cvs.savannah.gnu.org/viewcvs/pnet/image/meta_writer.c?cvsroot=dotgnu-pnet&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/pnet/image/program.h?cvsroot=dotgnu-pnet&r1=1.30&r2=1.31
http://cvs.savannah.gnu.org/viewcvs/pnet/include/il_dumpasm.h?cvsroot=dotgnu-pnet&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/pnet/include/il_program.h?cvsroot=dotgnu-pnet&r1=1.64&r2=1.65
Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/ChangeLog,v
retrieving revision 1.3586
retrieving revision 1.3587
diff -u -b -r1.3586 -r1.3587
--- ChangeLog 25 Nov 2008 09:15:08 -0000 1.3586
+++ ChangeLog 26 Nov 2008 20:15:16 -0000 1.3587
@@ -1,3 +1,74 @@
+2008-11-26 Klaus Treichel <address@hidden>
+
+ * codegen/cg_decls.tc: Use the new function ILDumpProgramItem for output
+ of class' parents or implemented interfaces.
+
+ * codegen/cg_gen.c (ILTypeToClass): Create a TypeSpec for complex types
+ and not only for generic types while converting them to an ILClass.
+ (ILTypeToProgramItem): Added.
+
+ * codegen/cg_gen.h (ILTypeToProgramItem): Add prototype.
+
+ * codegen/cg_interface.c, codegen/cg_resolve.c, cscc/csdoc.c,
+ cscc/c/c_invoke.tc, cscc/c/c_lvalue.tc, cscc/csharp/cs_lookup.c,
+ cscc/java/java_gather.c, cscc/java/java_lookup.c, csdoc/doc_valil.c,
+ csdoc/il2doc.c, engine/layout.c, engine/lib_emit.c, engine/lib_type.c,
+ image/generic_class.c, image/java_loader.c, image/java_writer.c:
+ Replace calls to ILImplementsGetInterface with macro invokations of
+ ILImplements_InterfaceClass or ILImplements_UnderlyingInterfaceClass
+ where appropriate.
+
+ * cscc/csharp/cs_gather.c (AddBaseClasses, CreateType): Use program
+ items instead of classes for base types or implemented interfaces
+ to avoid creation of synthetic classes at this point.
+ (FindMemberByName, FindMemberBySignature, FindInterfaceMatchInParents):
+ Replace calls to ILImplementsGetInterface with macro invokations of
+ ILImplements_InterfaceClass.
+
+ * cscc/csharp/cs_semantics.tc (CSSemBaseType): Change baseClass argument
+ from ILClass ** to ILProgramItem **.
+
+ * dumpasm/dump_class.c (Dump_TypeAndNested): Use the new function
+ ILDumpProgramItem for output of class' parents and implemented
interfaces.
+
+ * dumpasm/dump_ident.c (ILDumpProgramItem): Add new function for dumping
+ program items used as class parents and implemented interfaces.
+
+ * ilalink/link_class.c (ConvertClassParents): Use
+ _ILLinkerConvertProgramItemRef instead of _ILLinkerConvertClassRef for
+ converting implemented interfaces.
+
+ * ilasm/ilasm_grammar.y: Pass an ILProgramItem * to ILClassAddImplements
+ instead of a synthetic class.
+
+ * image/class.c (ILClassAddImplements): Change type of argument
interface
+ from ILClass * to ILProgramItem *.
+ (ILImplementsGetInterface): Change type of return value from ILClass *
+ to ILProgramItem *.
+ (ILImplementsGetInterfaceClass,
ILImplementsGetUnderlyingInterfaceClass):
+ Add new support functions.
+
+ * image/item.c (ILProgramItemFromType, ILProgramItemToType): Add new
+ support functions.
+
+ * image/meta_build.c (Load_InterfaceImpl): Store a program item instead
+ of an ILClass as the implemented interface.
+
+ * image/meta_writer.c (Format_InterfaceImpl): Use ProgramItemToToken for
+ storing the implemented interface.
+
+ * image/program.h: Change type of member interface from ILClass * to
+ ILProgramItem in ILImplements struct.
+
+ * include/il_dumpasm.h (ILDumpProgramItem): Add prototype.
+
+ * include/il_program.h (ILImplementsGetInterfaceClass,
+ ILImplementsGetUnderlyingInterfaceClass, ILProgramItemToType,
+ ILProgramItemFromType): Add prototypes.
+ (ILClassAddImplements, ILImplementsGetInterface): Adjust prototypes
+ according to changes in class.c.
+ Add some new helper macros.
+
2008-11-25 Radek Polak <address@hidden>
* engine/int_proto.h, engine/int_table.c: Regenerate for new blocking
Index: codegen/cg_decls.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/codegen/cg_decls.tc,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -b -r1.59 -r1.60
--- codegen/cg_decls.tc 7 Nov 2007 16:39:41 -0000 1.59
+++ codegen/cg_decls.tc 26 Nov 2008 20:15:17 -0000 1.60
@@ -132,7 +132,6 @@
{
ILClass *classInfo;
ILImplements *impl;
- ILClass *interface;
int first;
ILNode *prevClass;
int isModule = (!strcmp(node->name, "<Module>"));
@@ -153,6 +152,8 @@
/* Output the class heading */
if(info->asmOutput && !isModule)
{
+ ILProgramItem *parent;
+
/* Output the namespace information */
if(ILClass_Namespace(classInfo) &&
ILClass_NestedParent(classInfo) == 0)
{
@@ -177,12 +178,11 @@
#endif /* IL_VERSION_MAJOR > 1 */
/* Output the name of the parent class */
- if(ILClass_ParentRef(classInfo) != 0)
+ if((parent = ILClass_Parent(classInfo)) != 0)
{
fputs(" extends ", info->asmOutput);
- ILDumpClassName(info->asmOutput, info->image,
-
ILClass_ParentRef(classInfo),
- IL_DUMP_QUOTE_NAMES);
+ ILDumpProgramItem(info->asmOutput, info->image,
+ parent,
IL_DUMP_QUOTE_NAMES);
}
/* Output the names of the implemented interfaces */
@@ -190,6 +190,8 @@
first = 1;
while((impl = ILClassNextImplements(classInfo, impl)) != 0)
{
+ ILProgramItem *interface;
+
interface = ILImplementsGetInterface(impl);
if(first)
{
@@ -200,7 +202,7 @@
{
fputs(", ", info->asmOutput);
}
- ILDumpClassName(info->asmOutput, info->image, interface,
+ ILDumpProgramItem(info->asmOutput, info->image,
interface,
IL_DUMP_QUOTE_NAMES);
}
Index: codegen/cg_gen.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/codegen/cg_gen.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -b -r1.52 -r1.53
--- codegen/cg_gen.c 30 Oct 2007 17:35:23 -0000 1.52
+++ codegen/cg_gen.c 26 Nov 2008 20:15:18 -0000 1.53
@@ -296,28 +296,35 @@
ILClass *ILTypeToClass(ILGenInfo *info, ILType *type)
{
-#if IL_VERSION_MAJOR > 1
- if(ILType_IsWith(type))
+ if(ILType_IsComplex(type))
{
- ILClass *classInfo;
- ILTypeSpec *typeSpec;
+ ILProgramItem *item;
- typeSpec = ILTypeSpecCreate(info->image, 0, type);
- if(!typeSpec)
+ item = ILProgramItemFromType(info->image, type);
+ if(item)
{
- ILGenOutOfMemory(info);
+ return ILProgramItemToClass(item);
+ }
+ return 0;
}
- classInfo = ILTypeSpecGetClassWrapper(typeSpec);
- if(!classInfo)
+ else
{
- ILGenOutOfMemory(info);
+ return ILClassFromType(info->image, info, type, TypeResolver);
}
- return classInfo;
+}
+
+ILProgramItem *ILTypeToProgramItem(ILGenInfo *info, ILType *type)
+{
+ if(ILType_IsComplex(type))
+ {
+ return ILProgramItemFromType(info->image, type);
}
else
-#endif /* IL_VERSION_MAJOR > 1 */
{
- return ILClassFromType(info->image, info, type, TypeResolver);
+ ILClass *classInfo;
+
+ classInfo = ILClassFromType(info->image, info, type,
TypeResolver);
+ return ILToProgramItem(classInfo);
}
}
Index: codegen/cg_gen.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/codegen/cg_gen.h,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -b -r1.50 -r1.51
--- codegen/cg_gen.h 30 Oct 2007 17:35:23 -0000 1.50
+++ codegen/cg_gen.h 26 Nov 2008 20:15:18 -0000 1.51
@@ -224,6 +224,13 @@
ILClass *ILTypeToClass(ILGenInfo *info, ILType *type);
/*
+ * Convert a type into its program item form.
+ * Returns either a class or typespec or NULL if
+ * there is no class or typespec form for the type.
+ */
+ILProgramItem *ILTypeToProgramItem(ILGenInfo *info, ILType *type);
+
+/*
* Convert a type into a machine type.
*/
ILMachineType ILTypeToMachineType(ILType *type);
Index: codegen/cg_interface.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/codegen/cg_interface.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- codegen/cg_interface.c 27 Feb 2003 06:19:22 -0000 1.2
+++ codegen/cg_interface.c 26 Nov 2008 20:15:18 -0000 1.3
@@ -163,7 +163,7 @@
{
sawErrors |= ImplementsInterface
(node, classInfo,
- ILClassResolve(ILImplementsGetInterface(impl)),
+ ILImplements_InterfaceClass(impl),
error, proxy, visited, visitedSize);
}
return sawErrors;
@@ -178,7 +178,7 @@
ILImplements *impl = 0;
while((impl = ILClassNextImplements(interface, impl)) != 0)
{
- size +=
GetSpanningSize(ILClassResolve(ILImplementsGetInterface(impl)));
+ size +=
GetSpanningSize(ILImplements_UnderlyingInterfaceClass(impl));
}
return size;
}
Index: codegen/cg_resolve.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/codegen/cg_resolve.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- codegen/cg_resolve.c 18 Nov 2008 20:06:03 -0000 1.16
+++ codegen/cg_resolve.c 26 Nov 2008 20:15:18 -0000 1.17
@@ -150,7 +150,7 @@
ILImplements *impl = 0;
while((impl = ILClassNextImplements(classInfo, impl))
!= 0)
{
- method = ResolveMethod(info,
ILImplementsGetInterface(impl),
+ method = ResolveMethod(info,
ILImplements_InterfaceClass(impl),
callScope, name, args, nodes, numArgs,
returnType, attrs, normalOrVirtual,
dontInherit,indirect);
@@ -307,7 +307,7 @@
ILImplements *impl = 0;
while((impl = ILClassNextImplements(classInfo, impl))
!= 0)
{
- property = ResolveProperty(info,
ILImplementsGetInterface(impl),
+ property = ResolveProperty(info,
ILImplements_InterfaceClass(impl),
callScope, name, type, attrs,
dontInherit);
if(property)
Index: cscc/csdoc.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/csdoc.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- cscc/csdoc.c 18 Nov 2008 20:06:04 -0000 1.27
+++ cscc/csdoc.c 26 Nov 2008 20:15:19 -0000 1.28
@@ -1323,11 +1323,11 @@
if(impl)
{
fputs(" implements ", stream);
- DumpClassName(stream, ILImplementsGetInterface(impl));
+ DumpClassName(stream,
ILImplements_UnderlyingInterfaceClass(impl));
while((impl = ILClassNextImplements(classInfo, impl)) != 0)
{
fputs(", ", stream);
- DumpClassName(stream, ILImplementsGetInterface(impl));
+ DumpClassName(stream,
ILImplements_UnderlyingInterfaceClass(impl));
}
}
fputs("\"/>\n", stream);
@@ -1394,11 +1394,14 @@
}
if(!isEnum && impl)
{
- DumpClassNameOther(stream, ILImplementsGetInterface(impl),
classInfo);
+ DumpClassNameOther(stream,
+
ILImplements_UnderlyingInterfaceClass(impl),
+ classInfo);
while((impl = ILClassNextImplements(classInfo, impl)) != 0)
{
fputs(", ", stream);
- DumpClassNameOther(stream,
ILImplementsGetInterface(impl),
+ DumpClassNameOther(stream,
+
ILImplements_UnderlyingInterfaceClass(impl),
classInfo);
}
}
@@ -1449,7 +1452,7 @@
fputs("<Interface>\n", stream);
Indent(stream, indent + 4);
fputs("<InterfaceName>", stream);
- DumpClassName(stream, ILImplementsGetInterface(impl));
+ DumpClassName(stream,
ILImplements_UnderlyingInterfaceClass(impl));
fputs("</InterfaceName>\n", stream);
Indent(stream, indent + 4);
fputs("<Excluded>0</Excluded>\n", stream);
Index: cscc/c/c_invoke.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/c/c_invoke.tc,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- cscc/c/c_invoke.tc 18 Nov 2008 20:06:04 -0000 1.16
+++ cscc/c/c_invoke.tc 26 Nov 2008 20:15:19 -0000 1.17
@@ -631,7 +631,7 @@
ILImplements *impl = 0;
while((impl = ILClassNextImplements(classInfo, impl))
!= 0)
{
- method = ResolveCSMethod(info,
ILImplementsGetInterface(impl),
+ method = ResolveCSMethod(info,
ILImplements_InterfaceClass(impl),
callScope, name, args, numArgs,
isStatic);
if(method)
Index: cscc/c/c_lvalue.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/c/c_lvalue.tc,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- cscc/c/c_lvalue.tc 18 Nov 2008 20:06:04 -0000 1.27
+++ cscc/c/c_lvalue.tc 26 Nov 2008 20:15:19 -0000 1.28
@@ -688,7 +688,7 @@
while((impl = ILClassNextImplements(tempClass, impl))
!= 0)
{
value = ResolveMember
- (info,
ILClassToType(ILImplementsGetInterface(impl)),
+ (info,
ILProgramItemToType(ILImplements_Interface(impl)),
name, isStatic);
if(!CSemIsError(value))
{
Index: cscc/csharp/cs_gather.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/csharp/cs_gather.c,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -b -r1.61 -r1.62
--- cscc/csharp/cs_gather.c 18 Nov 2008 20:06:04 -0000 1.61
+++ cscc/csharp/cs_gather.c 26 Nov 2008 20:15:19 -0000 1.62
@@ -79,6 +79,8 @@
return 0;
}
+#define NodeToProgramItem(node) ILToProgramItem(NodeToClass(node))
+
/*
* Get the full and basic names from a method/property/event name.
*/
@@ -379,7 +381,7 @@
if(classInfo && (classInfo != (ILClass *)1) &&
(classInfo != (ILClass *)2))
{
- ILClass *parent = 0;
+ ILProgramItem *parent = 0;
int numBases = CountBaseClasses(classNode->baseClass);
if(numBases > 0)
@@ -388,7 +390,7 @@
ILNode *baseNode;
ILNode *baseNodeList;
int errorReported = 0;
- ILClass *baseList[numBases];
+ ILProgramItem *baseList[numBases];
ILMemZero(baseList, numBases * sizeof(ILClass *));
@@ -416,7 +418,7 @@
this point. */
if(baseList[base] == 0)
{
- baseList[base] =
NodeToClass(baseTypeNode);
+ baseList[base] =
NodeToProgramItem(baseTypeNode);
if(baseList[base] == 0)
{
@@ -428,17 +430,18 @@
if(baseList[base])
{
- #if IL_VERSION_MAJOR > 1
- ILClass *underlying =
ILClassGetUnderlying(baseList[base]);
+ ILClass *underlying;
+ underlying =
ILProgramItemToUnderlyingClass(baseList[base]);
+ if(underlying)
+ {
+ underlying =
ILClassResolve(underlying);
+ }
if(!underlying)
{
CCOutOfMemory();
}
if(!ILClass_IsInterface(underlying))
- #else /* IL_VERSION_MAJOR == 1 */
-
if(!ILClass_IsInterface(baseList[base]))
- #endif /* IL_VERSION_MAJOR == 1 */
{
if(parent)
{
@@ -479,8 +482,10 @@
else if(!parent)
{
/* Use the builtin library's "System.Object" */
- parent = ILType_ToClass(ILFindSystemType(info,
"Object"));
- if(!parent)
+ ILClass *objectClass;
+
+ objectClass =
ILType_ToClass(ILFindSystemType(info, "Object"));
+ if(!objectClass)
{
ILNode *baseTypeNode;
@@ -490,9 +495,13 @@
{
if(!parent)
{
- parent =
NodeToClass(baseTypeNode);
+ parent =
NodeToProgramItem(baseTypeNode);
+ }
}
}
+ else
+ {
+ parent = ILToProgramItem(objectClass);
}
if(!parent)
{
@@ -501,17 +510,25 @@
}
else
{
- if(ILClassResolve(parent) ==
ILClassResolve(classInfo))
+ if(!ILProgramItemToTypeSpec(parent) &&
+ ((objectClass =
ILProgramItemToClass(parent)) != 0))
+ {
+ if(ILClassResolve(objectClass)
== ILClassResolve(classInfo))
{
/* Compiling System.Object so
don't set the parent. */
parent = 0;
}
}
}
+ }
else
{
/* Output an error if attempting to inherit
from a sealed class */
- ILClass *underlying =
ILClassGetUnderlying(parent);
+ ILClass *underlying =
ILProgramItemToUnderlyingClass(parent);
+ if(underlying)
+ {
+ underlying = ILClassResolve(underlying);
+ }
if(!underlying)
{
CCOutOfMemory();
@@ -528,7 +545,7 @@
{
if(parent && !ILClass_IsInterface(classInfo))
{
- ILClassSetParent(classInfo,
ILToProgramItem(parent));
+ ILClassSetParent(classInfo, parent);
}
}
@@ -546,14 +563,14 @@
}
else if(!ILClass_IsInterface(classInfo))
{
- ILClass *parent;
+ ILClass *objectClass;
/* Use the builtin library's "System.Object" as parent
class */
- parent = ILType_ToClass(ILFindSystemType(info,
"Object"));
+ objectClass = ILType_ToClass(ILFindSystemType(info,
"Object"));
- if(ILClassResolve(classInfo) != ILClassResolve(parent))
+ if(ILClassResolve(classInfo) !=
ILClassResolve(objectClass))
{
- ILClassSetParent(classInfo,
ILToProgramItem(parent));
+ ILClassSetParent(classInfo,
ILToProgramItem(objectClass));
}
}
}
@@ -599,7 +616,7 @@
ILNode *baseNodeList;
ILNode *baseNode;
ILNode *baseTypeNode;
- ILClass *parent;
+ ILProgramItem *parent;
ILClass *classInfo;
ILNode_ClassDefn *defn;
ILNode *savedNamespace;
@@ -669,7 +686,7 @@
baseNodeList = defn->baseClass;
while(baseNodeList)
{
- ILClass *baseClass = 0;
+ ILProgramItem *baseItem = 0;
/* Get the name of the class to be inherited or implemented */
if(yykind(baseNodeList) == yykindof(ILNode_ArgList))
@@ -685,33 +702,34 @@
/* Look in the scope for the base class */
if(CSSemBaseType(baseNode, info, &baseNode,
- &baseTypeNode, &baseClass))
+ &baseTypeNode, &baseItem))
{
- if(baseClass == 0)
+ if(baseItem == 0)
{
- baseClass = NodeToClass(baseTypeNode);
- if(baseClass == 0)
+ baseItem = NodeToProgramItem(baseTypeNode);
+ if(baseItem == 0)
{
CreateType(info, globalScope, list,
systemObjectName,
baseTypeNode);
- baseClass = NodeToClass(baseTypeNode);
+ baseItem =
NodeToProgramItem(baseTypeNode);
}
}
- if(baseClass)
+ if(baseItem)
{
- #if IL_VERSION_MAJOR > 1
- ILClass *underlying =
ILClassGetUnderlying(baseClass);
+ ILClass *underlying;
+ underlying =
ILProgramItemToUnderlyingClass(baseItem);
+ if(underlying)
+ {
+ underlying = ILClassResolve(underlying);
+ }
if(!underlying)
{
CCOutOfMemory();
}
if(!ILClass_IsInterface(underlying))
- #else /* IL_VERSION_MAJOR == 1 */
- if(!ILClass_IsInterface(baseClass))
- #endif /* IL_VERSION_MAJOR == 1 */
{
- parent = baseClass;
+ parent = baseItem;
}
}
}
@@ -733,9 +751,11 @@
{
/* Compiling something else that inherits "System.Object" */
/* Use the builtin library's "System.Object" as parent class */
- parent = ILType_ToClass(ILFindSystemType(info, "Object"));
+ ILClass *objectClass;
- if(!parent)
+ objectClass = ILType_ToClass(ILFindSystemType(info, "Object"));
+
+ if(!objectClass)
{
/* Change to the global namespace to resolve
"System.Object" */
while(((ILNode_Namespace
*)(info->currentNamespace))->enclosing != 0)
@@ -752,12 +772,12 @@
what means we are currently processing
System.Object itself. */
if(!parent && (baseTypeNode != type))
{
- parent = NodeToClass(baseTypeNode);
+ parent =
NodeToProgramItem(baseTypeNode);
if(!parent)
{
CreateType(info, globalScope,
list,
systemObjectName, baseTypeNode);
- parent =
NodeToClass(baseTypeNode);
+ parent =
NodeToProgramItem(baseTypeNode);
}
}
}
@@ -839,11 +859,12 @@
static ILMember *FindMemberByName(ILClass *classInfo, const char *name,
ILClass
*scope, ILMember *notThis)
{
- ILMember *member;
- ILImplements *impl;
while(classInfo != 0)
{
/* Scan the members of this class */
+ ILMember *member;
+ ILImplements *impl;
+
member = 0;
while((member = ILClassNextMemberMatch
(classInfo, member, 0, name, 0)) != 0)
@@ -861,7 +882,7 @@
while((impl = ILClassNextImplements(classInfo, impl))
!= 0)
{
member = FindMemberByName
-
(ILClassResolve(ILImplementsGetInterface(impl)),
+
(ILClassResolve(ILImplements_InterfaceClass(impl)),
name, scope, notThis);
if(member)
{
@@ -883,13 +904,13 @@
ILType *signature, ILMember *notThis,
ILClass *scope, int interfaceOverride)
{
- ILMember *member;
- ILImplements *impl;
int kind = ILMemberGetKind(notThis);
while(classInfo != 0)
{
/* Scan the members of this class */
+ ILMember *member;
+
member = 0;
while((member = ILClassNextMemberMatch
(classInfo, member, 0, name, 0)) != 0)
@@ -929,11 +950,13 @@
/* Scan parent interfaces if this class is itself an interface
*/
if(ILClass_IsInterface(classInfo))
{
+ ILImplements *impl;
+
impl = 0;
while((impl = ILClassNextImplements(classInfo, impl))
!= 0)
{
member = FindMemberBySignature
-
(ILClassResolve(ILImplementsGetInterface(impl)),
+ (ILImplements_InterfaceClass(impl),
name, signature, notThis, scope,
interfaceOverride);
if(member)
{
@@ -1101,12 +1124,13 @@
int kind)
{
ILImplements *impl = 0;
- ILMember *member;
- ILClass *interface;
while((impl = ILClassNextImplements(classInfo, impl)) != 0)
{
- interface = ILClassResolve(ILImplementsGetInterface(impl));
+ ILMember *member;
+ ILClass *interface;
+
+ interface = ILImplements_InterfaceClass(impl);
member = FindInterfaceMatch(interface, name, signature, kind);
if(member)
{
Index: cscc/csharp/cs_lookup.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/csharp/cs_lookup.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -b -r1.40 -r1.41
--- cscc/csharp/cs_lookup.c 15 Aug 2008 20:52:36 -0000 1.40
+++ cscc/csharp/cs_lookup.c 26 Nov 2008 20:15:20 -0000 1.41
@@ -250,7 +250,7 @@
impl = 0;
while((impl = ILClassNextImplements(info, impl)) != 0)
{
- FindMembers(genInfo,
ILImplementsGetInterface(impl),
+ FindMembers(genInfo,
ILImplements_InterfaceClass(impl),
name, accessedFrom, results,
lookInParents,
baseAccess, literalType, inAttrArg);
}
@@ -635,7 +635,7 @@
impl = 0;
while((impl = ILClassNextImplements(info, impl)) != 0)
{
- FindIndexers(ILImplementsGetInterface(impl),
+ FindIndexers(ILImplements_InterfaceClass(impl),
accessedFrom, results, baseAccess);
}
Index: cscc/csharp/cs_semantics.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/csharp/cs_semantics.tc,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- cscc/csharp/cs_semantics.tc 30 Oct 2007 17:35:23 -0000 1.15
+++ cscc/csharp/cs_semantics.tc 26 Nov 2008 20:15:20 -0000 1.16
@@ -94,7 +94,7 @@
* zero if not a legal base type.
*/
int CSSemBaseType(ILNode *type, ILGenInfo *info, ILNode **parent,
- ILNode **baseNode, ILClass **baseClass);
+ ILNode **baseNode, ILProgramItem **baseItem);
/*
* Perform semantic analysis on a node and expect a value.
@@ -221,7 +221,7 @@
}
int CSSemBaseType(ILNode *type, ILGenInfo *info, ILNode **parent,
- ILNode **baseNode, ILClass **baseClass)
+ ILNode **baseNode, ILProgramItem **baseItem)
{
CSSemValue value;
int save = info->inSemType;
@@ -234,13 +234,13 @@
if(CSSemIsType(value))
{
*baseNode = 0;
- *baseClass = ILTypeToClass(info, CSSemGetType(value));
- return (*baseClass != 0);
+ *baseItem = ILTypeToProgramItem(info, CSSemGetType(value));
+ return (*baseItem != 0);
}
else if(CSSemIsTypeNode(value))
{
*baseNode = CSSemGetTypeNode(value);
- *baseClass = 0;
+ *baseItem = 0;
return 1;
}
else
Index: cscc/java/java_gather.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/java/java_gather.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- cscc/java/java_gather.c 18 Nov 2008 20:06:05 -0000 1.5
+++ cscc/java/java_gather.c 26 Nov 2008 20:15:20 -0000 1.6
@@ -211,7 +211,7 @@
while((impl = ILClassNextImplements(classInfo, impl)) != 0)
{
- interface = ILClassResolve(ILImplementsGetInterface(impl));
+ interface = ILImplements_InterfaceClass(impl);
member = FindInterfaceMatch(interface, name, signature, kind);
if(member)
{
@@ -591,7 +591,8 @@
{
if(baseList[base] && ILClass_IsInterface(baseList[base]))
{
- if(!ILClassAddImplements(classInfo, baseList[base], 0))
+ if(!ILClassAddImplements(classInfo,
+
ILToProgramItem(baseList[base]), 0))
{
CCOutOfMemory();
}
@@ -671,8 +672,7 @@
impl = 0;
while((impl = ILClassNextImplements(classInfo, impl))
!= 0)
{
- member = FindMemberByName
-
(ILClassResolve(ILImplementsGetInterface(impl)),
+ member =
FindMemberByName(ILImplements_InterfaceClass(impl),
name, scope);
if(member)
{
@@ -728,7 +728,7 @@
while((impl = ILClassNextImplements(classInfo, impl))
!= 0)
{
member = FindMemberBySignature
-
(ILClassResolve(ILImplementsGetInterface(impl)),
+ (ILImplements_InterfaceClass(impl),
name, signature, notThis, scope,
interfaceOverride);
if(member)
{
Index: cscc/java/java_lookup.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/java/java_lookup.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- cscc/java/java_lookup.c 24 May 2007 13:51:16 -0000 1.3
+++ cscc/java/java_lookup.c 26 Nov 2008 20:15:21 -0000 1.4
@@ -553,14 +553,14 @@
/* also scan the 'Object' class , as all interface
instances
* have Objects behind them !!
*/
- FindMembers(genInfo,ILTypeToClass(genInfo,objectType),
+ FindMembers(genInfo, ILTypeToClass(genInfo,objectType),
name, accessedFrom, results,
0, baseAccess, literalType);
impl = 0;
while((impl = ILClassNextImplements(info, impl)) != 0)
{
- FindMembers(genInfo,
ILImplementsGetInterface(impl),
+ FindMembers(genInfo,
ILImplements_InterfaceClass(impl),
name, accessedFrom, results,
lookInParents,
baseAccess, literalType);
}
Index: csdoc/doc_valil.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/csdoc/doc_valil.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- csdoc/doc_valil.c 18 Nov 2008 20:06:05 -0000 1.15
+++ csdoc/doc_valil.c 26 Nov 2008 20:15:21 -0000 1.16
@@ -3237,7 +3237,7 @@
impl = 0;
while((impl = ILClassNextImplements(tempClass, impl))
!= 0)
{
- parent = ILImplementsGetInterface(impl);
+ parent = ILImplements_InterfaceClass(impl);
fullName = GetFullClassName(parent);
if(!strcmp(fullName, interface->name))
{
@@ -3274,7 +3274,7 @@
fullName = 0;
while((impl = ILClassNextImplements(classInfo, impl)) != 0)
{
- parent = ILImplementsGetInterface(impl);
+ parent = ILImplements_InterfaceClass(impl);
if(ILClass_IsPrivate(parent))
{
/* It is OK to implement a private interface */
Index: csdoc/il2doc.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/csdoc/il2doc.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- csdoc/il2doc.c 18 Nov 2008 20:06:05 -0000 1.9
+++ csdoc/il2doc.c 26 Nov 2008 20:15:21 -0000 1.10
@@ -1846,7 +1846,8 @@
{
fputs(extendsNoBase, stdout);
}
- while(impl && !ILClass_IsPublic(ILImplementsGetInterface(impl)))
+ while(impl &&
+
!ILClass_IsPublic(ILImplements_UnderlyingInterfaceClass(impl)))
{
impl = ILClassNextImplements(classInfo, impl);
}
@@ -1854,16 +1855,16 @@
{
return;
}
- PrintClassNameWithFlags(ILImplementsGetInterface(impl),
+ PrintProgramItemWithFlags(ILImplements_Interface(impl),
ILToProgramItem(classInfo), flags);
while((impl = ILClassNextImplements(classInfo, impl)) != 0)
{
- if(!ILClass_IsPublic(ILImplementsGetInterface(impl)))
+
if(!ILClass_IsPublic(ILImplements_UnderlyingInterfaceClass(impl)))
{
continue;
}
fputs(implementsSeparator, stdout);
- PrintClassNameWithFlags(ILImplementsGetInterface(impl),
+ PrintProgramItemWithFlags(ILImplements_Interface(impl),
ILToProgramItem(classInfo), flags);
}
}
@@ -2902,12 +2903,12 @@
fputs("<Interfaces>\n", stdout);
do
{
- if(!ILClass_IsPublic(ILImplementsGetInterface(impl)))
+
if(!ILClass_IsPublic(ILImplements_UnderlyingInterfaceClass(impl)))
{
continue;
}
fputs("<Interface><InterfaceName>", stdout);
- PrintClassNameWithFlags(ILImplementsGetInterface(impl),
+ PrintProgramItemWithFlags(ILImplements_Interface(impl),
ILToProgramItem(classInfo),
DUMP_STYLE_CSHARP);
fputs("</InterfaceName></Interface>\n", stdout);
Index: dumpasm/dump_class.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/dumpasm/dump_class.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- dumpasm/dump_class.c 18 Nov 2008 20:06:05 -0000 1.6
+++ dumpasm/dump_class.c 26 Nov 2008 20:15:22 -0000 1.7
@@ -419,7 +419,6 @@
{
ILMember *member;
ILImplements *impl;
- ILClass *interface;
ILNestedInfo *nested;
int first;
int isModule = 0;
@@ -441,18 +440,22 @@
if(strcmp(ILClass_Name(info), "<Module>") != 0 ||
ILClass_Namespace(info) != 0)
{
+ ILProgramItem *parent;
+
fputs(".class ", outstream);
ILDumpFlags(outstream, ILClass_Attrs(info),
ILTypeDefinitionFlags, 0);
DumpClassName(outstream, image, info, flags, 0);
- if(ILClass_Parent(info))
+ if((parent = ILClass_Parent(info)) != 0)
{
fputs("\n extends ", outstream);
- DumpClassName(outstream, image,
ILClass_ParentClass(info), flags, 1);
+ ILDumpProgramItem(outstream, image, parent, flags);
}
first = 1;
impl = 0;
while((impl = ILClassNextImplements(info, impl)) != 0)
{
+ ILProgramItem *interface;
+
interface = ILImplementsGetInterface(impl);
if(first)
{
@@ -464,8 +467,7 @@
fputs(",\n", outstream);
fputs(" ", outstream);
}
- interface = ILClassResolve(interface);
- DumpClassName(outstream, image, interface, flags, 1);
+ ILDumpProgramItem(outstream, image, interface, flags);
}
fputs("\n{\n", outstream);
Index: dumpasm/dump_ident.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/dumpasm/dump_ident.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- dumpasm/dump_ident.c 1 Mar 2003 01:06:40 -0000 1.7
+++ dumpasm/dump_ident.c 26 Nov 2008 20:15:22 -0000 1.8
@@ -186,6 +186,31 @@
}
}
+void ILDumpProgramItem(FILE *stream, ILImage *image,
+ ILProgramItem *item, int flags)
+{
+ ILClass *info;
+ ILTypeSpec *spec;
+
+ if((spec = ILProgramItemToTypeSpec(item)) != 0)
+ {
+ ILType *type = ILTypeSpec_Type(spec);
+
+ ILDumpType(stream, image, type, flags);
+ }
+ else if((info = ILProgramItemToClass(item)) != 0)
+ {
+ info = ILClassResolve(info);
+ ILDumpClassName(stream, image, info, flags);
+ }
+ else if(ILProgramItem_Token(item) == 0)
+ {
+ /* Might be an unresolved class reference */
+ info = (ILClass *)item;
+ ILDumpClassName(stream, image, info, flags);
+ }
+}
+
#ifdef __cplusplus
};
#endif
Index: engine/layout.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/layout.c,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -b -r1.49 -r1.50
--- engine/layout.c 18 Nov 2008 20:06:05 -0000 1.49
+++ engine/layout.c 26 Nov 2008 20:15:22 -0000 1.50
@@ -904,14 +904,14 @@
}
/* Recursively compute all interfaces that the interface inherits from
*/
- implBlock = interface->implements;
+ implBlock = _ILClass_Implements(interface);
while(implBlock != 0)
{
- if(!ComputeInterfaceTable(info,
ILClassResolve(implBlock->interface)))
+ if(!ComputeInterfaceTable(info,
ILImplements_InterfaceClass(implBlock)))
{
return 0;
}
- implBlock = implBlock->nextInterface;
+ implBlock = _ILImplements_NextImplements(implBlock);
}
/* Done */
@@ -1195,10 +1195,10 @@
#endif
/* Lay out the interfaces that this class implements */
- implements = info->implements;
+ implements = _ILClass_Implements(info);
while(implements != 0)
{
- ILClass *interface = implements->interface;
+ ILClass *interface = ILImplements_InterfaceClass(implements);
if(ILClassNeedsExpansion(interface))
{
@@ -1210,18 +1210,15 @@
info->userData = 0;
return 0;
}
- implements->interface = interface;
- }
- else
- {
- interface = ILClassResolve(interface);
+ /* TODO: We don't really need this */
+ implements->interface = ILToProgramItem(interface);
}
if(!LayoutClass(process, interface, &typeLayout))
{
info->userData = 0;
return 0;
}
- implements = implements->nextInterface;
+ implements = _ILImplements_NextImplements(implements);
}
/* Should we use the explicit layout algorithm? */
@@ -1613,10 +1610,10 @@
if((info->attributes & IL_META_TYPEDEF_CLASS_SEMANTICS_MASK) !=
IL_META_TYPEDEF_INTERFACE)
{
- implements = info->implements;
+ implements = _ILClass_Implements(info);
while(implements != 0)
{
- parent = ILClassResolve(implements->interface);
+ parent = ILImplements_InterfaceClass(implements);
if(parent->userData)
{
if(!ComputeInterfaceTable(info, parent))
@@ -1625,7 +1622,7 @@
return 0;
}
}
- implements = implements->nextInterface;
+ implements = _ILImplements_NextImplements(implements);
}
}
Index: engine/lib_emit.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/lib_emit.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -b -r1.31 -r1.32
--- engine/lib_emit.c 18 Nov 2008 20:06:06 -0000 1.31
+++ engine/lib_emit.c 26 Nov 2008 20:15:23 -0000 1.32
@@ -1215,7 +1215,7 @@
ILExecThreadThrowOutOfMemory(_thread);
return;
}
- if (!(ILClassAddImplements(class, interface, token)))
+ if (!(ILClassAddImplements(class, ILToProgramItem(interface), token)))
{
IL_METADATA_UNLOCK(_ILExecThreadProcess(_thread));
ILExecThreadThrowOutOfMemory(_thread);
Index: engine/lib_type.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/lib_type.c,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -b -r1.55 -r1.56
--- engine/lib_type.c 18 Nov 2008 20:06:06 -0000 1.55
+++ engine/lib_type.c 26 Nov 2008 20:15:23 -0000 1.56
@@ -763,10 +763,10 @@
ILClass *interface;
while((impl = ILClassNextImplements(classInfo, impl)) != 0)
{
- interface = ILImplementsGetInterface(impl);
+ interface = ILImplements_UnderlyingInterfaceClass(impl);
if(InterfaceNameMatch(thread, interface, name, ignoreCase))
{
- return interface;
+ return ILImplements_InterfaceClass(impl);
}
interface = GetInterface(thread, interface, name, ignoreCase);
if(interface)
@@ -834,11 +834,11 @@
while((impl = ILClassNextImplements(classInfo, impl)) != 0)
{
- count += 1 + GetMaxInterfaces(ILImplementsGetInterface(impl));
+ count += 1 +
GetMaxInterfaces(ILImplements_UnderlyingInterfaceClass(impl));
}
// Traverse up into the parent class as well
- count += GetMaxInterfaces(ILClass_ParentClass(classInfo));
+ count += GetMaxInterfaces(ILClass_UnderlyingParentClass(classInfo));
return count;
}
@@ -861,7 +861,7 @@
while((impl = ILClassNextImplements(classInfo, impl)) != 0)
{
- interface = ILImplementsGetInterface(impl);
+ interface = ILImplements_InterfaceClass(impl);
clrType = _ILGetClrType(thread, interface);
for(index = 0; index < posn; ++index)
{
Index: ilalink/link_class.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/ilalink/link_class.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- ilalink/link_class.c 18 Nov 2008 20:06:06 -0000 1.18
+++ ilalink/link_class.c 26 Nov 2008 20:15:23 -0000 1.19
@@ -232,9 +232,9 @@
implements = 0;
while((implements = ILClassNextImplements(classInfo, implements)) != 0)
{
- ILClass *interface;
+ ILProgramItem *interface;
- interface = _ILLinkerConvertClassRef
+ interface = _ILLinkerConvertProgramItemRef
(linker,
ILImplementsGetInterface(implements));
if(!interface)
{
Index: ilasm/ilasm_grammar.y
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/ilasm/ilasm_grammar.y,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -b -r1.51 -r1.52
--- ilasm/ilasm_grammar.y 18 Nov 2008 20:06:07 -0000 1.51
+++ ilasm/ilasm_grammar.y 26 Nov 2008 20:15:24 -0000 1.52
@@ -1589,13 +1589,13 @@
ClassNameList
: ClassNameTypeSpec {
- if(!ILClassAddImplements(ILAsmClass,
ILProgramItemToClass($1), 0))
+ if(!ILClassAddImplements(ILAsmClass, $1, 0))
{
ILAsmOutOfMemory();
}
}
| ClassNameList ',' ClassNameTypeSpec {
- if(!ILClassAddImplements(ILAsmClass,
ILProgramItemToClass($3), 0))
+ if(!ILClassAddImplements(ILAsmClass, $3, 0))
{
ILAsmOutOfMemory();
}
Index: image/class.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/image/class.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -b -r1.44 -r1.45
--- image/class.c 18 Nov 2008 20:06:07 -0000 1.44
+++ image/class.c 26 Nov 2008 20:15:24 -0000 1.45
@@ -309,6 +309,39 @@
return info;
}
+static ILProgramItem *ImportItem(ILImage *image, ILProgramItem *item)
+{
+ ILClass *info;
+ ILTypeSpec *spec;
+
+ if((info = _ILProgramItem_ToClass(item)) != 0)
+ {
+ info = ILClassImport(image, info);
+ if(info)
+ {
+ return ILToProgramItem(info);
+ }
+ }
+ else if((spec = _ILProgramItem_ToTypeSpec(item)) != 0)
+ {
+ spec = ILTypeSpecImport(image, spec);
+ if(spec)
+ {
+ return ILToProgramItem(spec);
+ }
+ }
+ else if(item->token == 0)
+ {
+ /* We have an unresolved ClassRef here or a synthetic class */
+ info = ILClassImport(image, (ILClass *)item);
+ if(info)
+ {
+ return ILToProgramItem(info);
+ }
+ }
+ return 0;
+}
+
ILClass *ILClassCreateWrapper(ILProgramItem *scope, ILToken token,
ILType *type)
{
@@ -361,42 +394,7 @@
/* Import the parent class into this image */
if(parent)
{
- ILClass *parentClass;
- ILTypeSpec *parentSpec;
-
- if((parentClass = _ILProgramItem_ToClass(parent)) != 0)
- {
- parentClass = ILClassImport(image, parentClass);
- if(!parentClass)
- {
- return 0;
- }
- parent = ILToProgramItem(parentClass);
- }
- else if((parentSpec = _ILProgramItem_ToTypeSpec(parent)) != 0)
- {
- parentSpec = ILTypeSpecImport(image, parentSpec);
- if(!parentSpec)
- {
- return 0;
- }
- parent = ILToProgramItem(parentSpec);
- }
- else if(parent->token == 0)
- {
- /* We have an unresolved ClassRef here or a synthetic
class */
- parentClass = ILClassImport(image, (ILClass *)parent);
- if(!parentClass)
- {
- return 0;
- }
- parent = ILToProgramItem(parentClass);
- }
- else
- {
- /* Invalid parent program item type */
- return 0;
- }
+ parent = ImportItem(image, parent);
if(!parent)
{
return 0;
@@ -636,28 +634,49 @@
*/
static ILProgramItem *GetParent(ILClass *info)
{
- if(info->parent)
+ if(info)
{
- return _ILProgramItemResolve(info->parent);
+ return info->parent;
}
return 0;
}
/*
- * Get the parent class of a class.
- * If the parent is a TypeSpec then the main class of the TypeSpec is returned.
+ * Get the underlying class of a ProgramItem.
+ * If the ProgramItem is a TypeSpec then the main class of the TypeSpec
+ * is returned.
*/
-static ILClass *GetUnderlyingParentClass(ILClass *info)
+static ILClass *GetUnderlyingClassResolved(ILProgramItem *item)
{
- if(!info || !info->parent)
+ if(item)
{
- return 0;
+ ILClass *info;
+
+ info = ILProgramItemToUnderlyingClass(item);
+ if(info)
+ {
+ return ILClassResolve(info);
}
- info = ILProgramItemToUnderlyingClass(info->parent);
+ }
+ return 0;
+}
+
+/*
+ * Get the class for a program item.
+ * If the program item is a TypeSpec the synthetic class is returned.
+ */
+static ILClass *GetClassResolved(ILProgramItem *item)
+{
+ if(item)
+ {
+ ILClass *info;
+
+ info = ILProgramItemToClass(item);
if(info)
{
return ILClassResolve(info);
}
+ }
return 0;
}
@@ -667,12 +686,9 @@
*/
static ILClass *GetParentClass(ILClass *info)
{
- if(info && info->parent)
- {
- if((info = ILProgramItemToClass(info->parent)) != 0)
+ if(info)
{
- return ILClassResolve(info);
- }
+ return GetClassResolved(info->parent);
}
return 0;
}
@@ -684,7 +700,11 @@
ILClass *ILClassGetUnderlyingParentClass(ILClass *info)
{
- return GetUnderlyingParentClass(info);
+ if(info)
+ {
+ return GetUnderlyingClassResolved(info->parent);
+ }
+ return 0;
}
ILClass *ILClassGetParentClass(ILClass *info)
@@ -806,29 +826,25 @@
int ILClassIsValid(ILClass *info)
{
- ILImplements *implements;
- ILProgramItem *item;
info = (ILClass *)(_ILProgramItemResolve(&(info->programItem)));
while(info != 0)
{
+ ILImplements *implements;
+
if((info->attributes & IL_META_TYPEDEF_REFERENCE) != 0)
{
return 0;
}
- implements = info->implements;
+ implements = _ILClass_Implements(info);
while(implements != 0)
{
- if(!ILClassIsValid(implements->interface))
+
if(!ILClassIsValid(GetUnderlyingClassResolved(implements->interface)))
{
return 0;
}
- implements = implements->nextInterface;
- }
- item = info->parent;
- if(item != 0)
- {
- item = _ILProgramItemResolve(item);
+ implements = _ILImplements_NextImplements(implements);
}
+ info = GetUnderlyingClassResolved(info->parent);
}
return 1;
}
@@ -1098,7 +1114,7 @@
(ILHashMatchFunc)UnicodeMatch));
}
-ILImplements *ILClassAddImplements(ILClass *info, ILClass *interface,
+ILImplements *ILClassAddImplements(ILClass *info, ILProgramItem *interface,
ILToken
token)
{
ILImplements *impl;
@@ -1110,15 +1126,17 @@
return 0;
}
- /* Import the interface into the class's image */
- interface = ILClassImport(info->programItem.image, interface);
+ if(token == 0)
+ {
+ interface = ImportItem(info->programItem.image, interface);
if(!interface)
{
return 0;
}
+ }
/* Ignore the request if the interface is already on the list */
- current = info->implements;
+ current = _ILClass_Implements(info);
last = 0;
while(current != 0)
{
@@ -1127,7 +1145,7 @@
return current;
}
last = current;
- current = current->nextInterface;
+ current = _ILImplements_NextImplements(current);
}
/* Allocate space for the implements clause and fill it in */
@@ -1190,11 +1208,10 @@
ILClass *tempInterface;
while(info != 0)
{
- temp = info->implements;
+ temp = _ILClass_Implements(info);
while(temp != 0)
{
- tempInterface = (ILClass *)(_ILProgramItemResolve
-
(&(temp->interface->programItem)));
+ tempInterface = GetClassResolved(temp->interface);
if(tempInterface == interface)
{
return 1;
@@ -1203,7 +1220,7 @@
{
return 1;
}
- temp = temp->nextInterface;
+ temp = _ILImplements_NextImplements(temp);
}
info = GetParentClass(info);
}
@@ -1225,11 +1242,11 @@
{
if(last)
{
- return last->nextInterface;
+ return _ILImplements_NextImplements(last);
}
else
{
- return info->implements;
+ return _ILClass_Implements(info);
}
}
@@ -1238,11 +1255,40 @@
return impl->implement;
}
-ILClass *ILImplementsGetInterface(ILImplements *impl)
+ILProgramItem *ILImplementsGetInterface(ILImplements *impl)
{
return impl->interface;
}
+ILClass *ILImplementsGetInterfaceClass(ILImplements *impl)
+{
+ if(impl && impl->interface)
+ {
+ ILClass *info;
+
+ if((info = ILProgramItemToClass(impl->interface)) != 0)
+ {
+ return ILClassResolve(info);
+ }
+ }
+ return 0;
+}
+
+ILClass *ILImplementsGetUnderlyingInterfaceClass(ILImplements *impl)
+{
+ if(impl && impl->interface)
+ {
+ ILClass *info;
+
+ info = ILProgramItemToUnderlyingClass(impl->interface);
+ if(info)
+ {
+ return ILClassResolve(info);
+ }
+ }
+ return 0;
+}
+
int ILClassIsNested(ILClass *parent, ILClass *child)
{
ILClass *temp = (child ? ILClassGetNestedParent(child) : 0);
@@ -1662,7 +1708,7 @@
return 1;
}
}
- info = GetUnderlyingParentClass(info);
+ info = GetUnderlyingClassResolved(info->parent);
}
return 0;
}
Index: image/generic_class.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/image/generic_class.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- image/generic_class.c 18 Nov 2008 20:06:07 -0000 1.3
+++ image/generic_class.c 26 Nov 2008 20:15:24 -0000 1.4
@@ -121,19 +121,20 @@
}
classInfo->parent = ILToProgramItem(parentClass);
}
- impl = 0;
- while((impl = ILClassNextImplements(origClass, impl)) != 0)
+ impl = _ILClass_Implements(origClass);
+ while(impl)
{
- tempInfo = ILImplementsGetInterface(impl);
+ tempInfo = ILImplements_InterfaceClass(impl);
tempInfo = ILClassExpand(image, tempInfo, classParams, 0);
if(!tempInfo)
{
return 0;
}
- if(!ILClassAddImplements(classInfo, tempInfo, 0))
+ if(!ILClassAddImplements(classInfo, ILToProgramItem(tempInfo),
0))
{
return 0;
}
+ impl = _ILImplements_NextImplements(impl);
}
/* Expand the methods and fields */
Index: image/item.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/image/item.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- image/item.c 18 Nov 2008 20:06:07 -0000 1.10
+++ image/item.c 26 Nov 2008 20:15:25 -0000 1.11
@@ -477,7 +477,7 @@
{
ILType *type;
- type = ILTypeSpec_Type((ILTypeSpec *)item);
+ type = _ILTypeSpec_Type((ILTypeSpec *)item);
if(type)
{
type = ILTypeGetWithMain(type);
@@ -492,6 +492,77 @@
return 0;
}
+ILProgramItem *ILProgramItemFromType(ILImage *image, ILType *type)
+{
+ if(!type)
+ {
+ return 0;
+ }
+ if(ILType_IsComplex(type))
+ {
+ switch(ILType_Kind(type))
+ {
+ case IL_TYPE_COMPLEX_WITH:
+ case IL_TYPE_COMPLEX_ARRAY:
+ case IL_TYPE_COMPLEX_ARRAY_CONTINUE:
+ case IL_TYPE_COMPLEX_PTR:
+ case IL_TYPE_COMPLEX_METHOD:
+ case (IL_TYPE_COMPLEX_METHOD |
IL_TYPE_COMPLEX_METHOD_SENTINEL):
+ {
+ ILTypeSpec *spec;
+
+ spec = ILTypeSpecCreate(image, 0, type);
+ return ILToProgramItem(spec);
+ }
+ }
+ }
+ else
+ {
+ ILClass *info;
+
+ info = ILClassFromType(image, 0, type, 0);
+ if(info)
+ {
+ info = ILClassImport(image, info);
+ }
+ return ILToProgramItem(info);
+ }
+ return 0;
+}
+
+ILType *ILProgramItemToType(ILProgramItem *item)
+{
+ if(!item)
+ {
+ return 0;
+ }
+ switch(item->token & IL_META_TOKEN_MASK)
+ {
+ case IL_META_TOKEN_TYPE_DEF:
+ case IL_META_TOKEN_TYPE_REF:
+ case IL_META_TOKEN_EXPORTED_TYPE:
+ {
+ ILType *type;
+ ILClass *info = (ILClass *)item;
+
+ if((type = _ILClass_Synthetic(info)) != 0)
+ {
+ return type;
+ }
+ return ILClassToType(info);
+ }
+ break;
+
+ case IL_META_TOKEN_TYPE_SPEC:
+ {
+ return _ILTypeSpec_Type((ILTypeSpec *)item);
+ }
+ break;
+ }
+
+ return 0;
+}
+
ILMember *ILProgramItemToMember(ILProgramItem *item)
{
ILToken tokenType = (item ? (item->token & IL_META_TOKEN_MASK) : 0);
Index: image/java_loader.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/image/java_loader.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- image/java_loader.c 18 Nov 2008 20:06:07 -0000 1.12
+++ image/java_loader.c 26 Nov 2008 20:15:25 -0000 1.13
@@ -1178,7 +1178,7 @@
{
goto cleanup;
}
- if(!ILClassAddImplements(classInfo, otherClass, 0))
+ if(!ILClassAddImplements(classInfo,
ILToProgramItem(otherClass), 0))
{
error = IL_LOADERR_MEMORY;
goto cleanup;
Index: image/java_writer.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/image/java_writer.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- image/java_writer.c 18 Nov 2008 20:06:07 -0000 1.6
+++ image/java_writer.c 26 Nov 2008 20:15:25 -0000 1.7
@@ -992,17 +992,20 @@
OUT_UINT16(parentIndex);
/* implemented interfaces */
- impl = 0;
+ impl = _ILClass_Implements(class);
count = 0;
- while((impl = ILClassNextImplements(class, impl)) != 0)
+ while(impl)
+ {
count++;
+ impl = _ILImplements_NextImplements(impl);
+ }
OUT_UINT16(count);
- impl = 0;
- while((impl = ILClassNextImplements(class, impl)) != 0)
+ impl = _ILClass_Implements(class);
+ while(impl)
{
int index;
- interface = ILImplementsGetInterface(impl);
+ interface = ILImplements_InterfaceClass(impl);
index = ILJavaSetClass(writer, class, interface);
if(!index)
{
@@ -1010,6 +1013,7 @@
goto cleanup;
}
OUT_UINT16(index);
+ impl = _ILImplements_NextImplements(impl);
}
/* Dump the class members */
Index: image/meta_build.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/image/meta_build.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -b -r1.52 -r1.53
--- image/meta_build.c 18 Nov 2008 20:06:07 -0000 1.52
+++ image/meta_build.c 26 Nov 2008 20:15:26 -0000 1.53
@@ -2026,7 +2026,8 @@
{
ILClass *info;
ILProgramItem *item;
- ILClass *interface;
+ ILProgramItem *interface;
+ ILClass *interfaceClass;
#if IL_VERSION_MAJOR > 1
ILTypeSpec *spec;
#endif
@@ -2049,12 +2050,18 @@
#if IL_VERSION_MAJOR > 1
if((spec = _ILProgramItem_ToTypeSpec(item)))
{
- interface = ILTypeSpecGetClassWrapper(spec);
+ interface = ILToProgramItem(spec);
}
else
#endif
+ if((interfaceClass = _ILProgramItem_ToClass(item)))
{
- interface = ILProgramItemToClass(item);
+ interface = ILToProgramItem(interfaceClass);
+ }
+ else
+ {
+ /* Invalid interface token type */
+ interface = 0;
}
if(!interface)
{
Index: image/meta_writer.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/image/meta_writer.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- image/meta_writer.c 18 Nov 2008 20:06:07 -0000 1.18
+++ image/meta_writer.c 26 Nov 2008 20:15:26 -0000 1.19
@@ -346,7 +346,7 @@
{
values[IL_OFFSET_INTERFACE_TYPE] = impl->implement->programItem.token;
values[IL_OFFSET_INTERFACE_INTERFACE] =
- ClassToToken(image, impl->interface);
+ ProgramItemToToken(image, impl->interface);
}
/*
Index: image/program.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/image/program.h,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -b -r1.30 -r1.31
--- image/program.h 18 Nov 2008 20:06:08 -0000 1.30
+++ image/program.h 26 Nov 2008 20:15:27 -0000 1.31
@@ -305,7 +305,7 @@
{
ILProgramItem programItem; /* Parent class fields */
ILClass *implement; /* Implementing class */
- ILClass *interface; /* Implemented
interface */
+ ILProgramItem *interface; /* Implemented
interface */
ILImplements *nextInterface; /* Next implemented interface */
};
@@ -852,6 +852,14 @@
(((item)->token & IL_META_TOKEN_MASK) ==
IL_META_TOKEN_MODULE_REF)) ? \
(item) : 0)
+/*
+ * Internal macros for accessing members in external opaque types
+ */
+#define _ILClass_Synthetic(info) ((info)->synthetic)
+#define _ILClass_Implements(info) ((info)->implements)
+#define _ILImplements_NextImplements(impl) ((impl)->nextInterface)
+#define _ILTypeSpec_Type(spec) ((spec)->type)
+
#ifdef __cplusplus
};
#endif
Index: include/il_dumpasm.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/include/il_dumpasm.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- include/il_dumpasm.h 12 Nov 2007 19:06:47 -0000 1.14
+++ include/il_dumpasm.h 26 Nov 2008 20:15:27 -0000 1.15
@@ -110,6 +110,13 @@
void ILDumpClassName(FILE *stream, ILImage *image, ILClass *info, int flags);
/*
+ * Dump a program item which can be a typespec or class like it's used
+ * with generics for class' parents or implemented interfaces.
+ */
+void ILDumpProgramItem(FILE *stream, ILImage *image,
+ ILProgramItem *item, int flags);
+
+/*
* Dump a simple NUL-terminated string to an output stream.
*/
void ILDumpString(FILE *stream, const char *str);
Index: include/il_program.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/include/il_program.h,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -b -r1.64 -r1.65
--- include/il_program.h 18 Nov 2008 20:06:08 -0000 1.64
+++ include/il_program.h 26 Nov 2008 20:15:28 -0000 1.65
@@ -163,6 +163,23 @@
ILClass *ILProgramItemToUnderlyingClass(ILProgramItem *item);
/*
+ * Get the type for a program item.
+ * Only TypeSpecs and Classes are handled here and the type of the TypeSpec
+ * or the returnvalue from ILClassToType is returned.
+ * If item is NULL or neither a TypeSpec nor a Class 0 is returned.
+ */
+ILType *ILProgramItemToType(ILProgramItem *item);
+
+/*
+ * Get the program item for a type.
+ * Only primitive, class/value types, arrays and generic types are handled
+ * by now.
+ * Returns a TypeSpec for array and with types, a class for primitive,
+ * reference and value types and NULL otherwise.
+ */
+ILProgramItem *ILProgramItemFromType(ILImage *image, ILType *type);
+
+/*
* Helper macros for querying information about a program item.
*/
#define ILProgramItem_FromToken(image,token) \
@@ -661,7 +678,7 @@
/*
* Add an implements clause to a class. Returns NULL if out of memory.
*/
-ILImplements *ILClassAddImplements(ILClass *info, ILClass *interface,
+ILImplements *ILClassAddImplements(ILClass *info, ILProgramItem *interface,
ILToken
token);
/*
@@ -688,7 +705,21 @@
/*
* Get the interface information from an implements clause.
*/
-ILClass *ILImplementsGetInterface(ILImplements *impl);
+ILProgramItem *ILImplementsGetInterface(ILImplements *impl);
+
+/*
+ * Get the interface class information from an implements clause.
+ * This will create and return a synthetic class if it's a generic
+ * interface and cross image boundaries to take linking into account.
+ */
+ILClass *ILImplementsGetInterfaceClass(ILImplements *impl);
+
+/*
+ * Get the class underlying ine interface class. If the interface is not
+ * generic the interface class will be returned.
+ * This will cross image boundaries to take linking into account.
+ */
+ILClass *ILImplementsGetUnderlyingInterfaceClass(ILImplements *impl);
/*
* Determine if "child" is directly or indirectly nested within "parent".
@@ -1046,6 +1077,16 @@
((ILClassGetAttrs((info)) &
IL_META_TYPEDEF_RT_SPECIAL_NAME) != 0)
#define ILClass_IsGenericInstance(info) \
ILClassIsExpanded(info)
+
+#define ILImplements_Class(impl) \
+ ILImplementsGetClass(impl)
+#define ILImplements_Interface(impl) \
+ ILImplementsGetInterface(impl)
+#define ILImplements_InterfaceClass(impl) \
+ ILImplementsGetInterfaceClass(impl)
+#define ILImplements_UnderlyingInterfaceClass(impl) \
+ ILImplementsGetUnderlyingInterfaceClass(impl)
+
/*
* Member kinds.
*/
@@ -2016,6 +2057,7 @@
#define ILTypeSpec_Token(spec) (ILProgramItem_Token((spec)))
#define ILTypeSpec_Type(spec) (ILTypeSpecGetType((spec)))
#define ILTypeSpec_Class(spec) (ILTypeSpecGetClass((spec)))
+#define ILTypeSpec_ClassWrapper(spec)
(ILTypeSpecGetClassWrapper((spec)))
/*
* Create a stand alone signature token within an image.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [dotgnu-pnet-commits] pnet ChangeLog codegen/cg_decls.tc codegen/cg_g...,
Klaus Treichel <=