[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[dotgnu-pnet-commits] pnet ChangeLog csdoc/il2doc.c dumpasm/dump_clas...
From: |
Klaus Treichel |
Subject: |
[dotgnu-pnet-commits] pnet ChangeLog csdoc/il2doc.c dumpasm/dump_clas... |
Date: |
Sun, 01 Jul 2007 14:15:17 +0000 |
CVSROOT: /cvsroot/dotgnu-pnet
Module name: pnet
Changes by: Klaus Treichel <ktreichel> 07/07/01 14:15:17
Modified files:
. : ChangeLog
csdoc : il2doc.c
dumpasm : dump_class.c dump_type.c dump_utils.c
ilasm : ilasm_build.c ilasm_grammar.y
ilalink : link_class.c link_method.c
image : generic.c meta_build.c meta_writer.c program.h
sig_parse.c
include : il_dumpasm.h il_meta.h il_program.h
Log message:
Add generics support for ildasm. (patch #6051, ideras)
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pnet/ChangeLog?cvsroot=dotgnu-pnet&r1=1.3472&r2=1.3473
http://cvs.savannah.gnu.org/viewcvs/pnet/csdoc/il2doc.c?cvsroot=dotgnu-pnet&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/pnet/dumpasm/dump_class.c?cvsroot=dotgnu-pnet&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/pnet/dumpasm/dump_type.c?cvsroot=dotgnu-pnet&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/pnet/dumpasm/dump_utils.c?cvsroot=dotgnu-pnet&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/pnet/ilasm/ilasm_build.c?cvsroot=dotgnu-pnet&r1=1.26&r2=1.27
http://cvs.savannah.gnu.org/viewcvs/pnet/ilasm/ilasm_grammar.y?cvsroot=dotgnu-pnet&r1=1.44&r2=1.45
http://cvs.savannah.gnu.org/viewcvs/pnet/ilalink/link_class.c?cvsroot=dotgnu-pnet&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/pnet/ilalink/link_method.c?cvsroot=dotgnu-pnet&r1=1.29&r2=1.30
http://cvs.savannah.gnu.org/viewcvs/pnet/image/generic.c?cvsroot=dotgnu-pnet&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/pnet/image/meta_build.c?cvsroot=dotgnu-pnet&r1=1.46&r2=1.47
http://cvs.savannah.gnu.org/viewcvs/pnet/image/meta_writer.c?cvsroot=dotgnu-pnet&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/pnet/image/program.h?cvsroot=dotgnu-pnet&r1=1.23&r2=1.24
http://cvs.savannah.gnu.org/viewcvs/pnet/image/sig_parse.c?cvsroot=dotgnu-pnet&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/pnet/include/il_dumpasm.h?cvsroot=dotgnu-pnet&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/pnet/include/il_meta.h?cvsroot=dotgnu-pnet&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/pnet/include/il_program.h?cvsroot=dotgnu-pnet&r1=1.54&r2=1.55
Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/ChangeLog,v
retrieving revision 1.3472
retrieving revision 1.3473
diff -u -b -r1.3472 -r1.3473
--- ChangeLog 15 Jun 2007 09:03:47 -0000 1.3472
+++ ChangeLog 1 Jul 2007 14:15:15 -0000 1.3473
@@ -1,3 +1,48 @@
+2007-07-01 Ivan de Jesus Daras Tabora <address@hidden>
+
+ * csdoc/il2doc.c: Replace the code for printing the generic parameters
+ with a call to ILAsmDumpGenericParams.
+
+ * dumpasm/dump_class.c: Replace the code for printing the generic
+ parameters with a call to ILAsmDumpGenericParams. Do some adjustments in
+ the output.
+
+ * dumpasm/dump_type.c: Replace the code for printing the generic
+ parameters with a call to ILAsmDumpGenericParams.
+
+ * dumpasm/dump_utils.c: Add the method ILAsmDumpGenericParams for
dumping
+ generic parameters.
+
+ * ilasm/ilasm_build.c, ilasm/ilasm_grammar.y: Replace the calls to
+ ILGenericParSetConstraint with ILGenericParAddConstraint.
+
+ * ilalink/link_class.c, ilalink/link_method.c: Fix the processing of
+ generic constraints to allow processing of more than one constraint per
+ generic parameter.
+
+ * image/generic.c: Redo the generic type constraints to allow more than
+ one type constraint per generic parameter.
+
+ * image/meta_build.c: Make LoadForwardTypeDef public. Remove the 'Gyro'
+ code. Replace the calls to ILGenericParSetConstraint with
+ ILGenericParAddConstraint.
+
+ * image/meta_writer.c: Fix formatting of the GenericParameter.
+
+ * image/program.h: Add the member firstConstraint to ILGenericParameter
+ and nextConstraint to ILGenericConstraint for handling more than one
+ constraint per parameter.
+
+ * image/sig_parse.c: Use LoadForwardTypeDef to reslove types in the
image
+ that are used before they are loaded.
+
+ * include/il_dumpasm.h: Add the prototype for ILAsmDumpGenericParams.
+
+ * include/il_meta.h: Add the definitions for generic parameter
attributes.
+
+ * include/il_program.h: Fix the declarations for generic constraint
+ handling.
+
2007-06-15 Radek Polak <address@hidden>
* engine/debugger.c: Fix warning on x86_64.
Index: csdoc/il2doc.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/csdoc/il2doc.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- csdoc/il2doc.c 4 Sep 2003 23:40:35 -0000 1.4
+++ csdoc/il2doc.c 1 Jul 2007 14:15:15 -0000 1.5
@@ -696,11 +696,6 @@
ILUInt32 callingConventions;
ILType *synType;
int dumpGenerics;
- ILUInt32 genericNum;
- ILGenericPar *genPar;
- const char *name;
- ILProgramItem *constraint;
- ILTypeSpec *spec;
unsigned long numWithParams;
unsigned long withParam;
@@ -748,51 +743,8 @@
/* Dump the generic method parameters if necessary */
if(dumpGenerics && methodInfo)
{
- genericNum = 0;
- genPar = ILGenericParGetFromOwner
- (ILToProgramItem(methodInfo), genericNum);
- if(genPar)
- {
- putc('<', stream);
- do
- {
- if(genericNum > 0)
- {
- fputs(", ", stream);
- }
- constraint = ILGenericPar_Constraint(genPar);
- if(constraint)
- {
- putc('(', stream);
- spec =
ILProgramItemToTypeSpec(constraint);
- if(spec)
- {
- _ILDumpType(stream, image,
-
ILTypeSpec_Type(spec), flags);
- }
- else
- {
- _ILDumpType(stream, image,
-
ILClassToType((ILClass *)constraint), flags);
- }
- putc(')', stream);
- }
- name = ILGenericPar_Name(genPar);
- if(name)
- {
- ILDumpIdentifier(stream, name, 0,
flags);
- }
- else
- {
- fprintf(stream, "G_%d",
(int)(genericNum + 1));
- }
- ++genericNum;
- genPar = ILGenericParGetFromOwner
- (ILToProgramItem(methodInfo),
genericNum);
- }
- while(genPar != 0);
- putc('>', stream);
- }
+ ILAsmDumpGenericParams(image, stream,
+
ILToProgramItem(methodInfo), flags);
}
else if(withTypes)
{
Index: dumpasm/dump_class.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/dumpasm/dump_class.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- dumpasm/dump_class.c 11 Feb 2007 16:12:27 -0000 1.2
+++ dumpasm/dump_class.c 1 Jul 2007 14:15:15 -0000 1.3
@@ -352,11 +352,6 @@
ILClass *info, int flags, int
withNamespace)
{
ILType *type;
- ILUInt32 genericNum;
- ILGenericPar *genPar;
- const char *name;
- ILProgramItem *constraint;
- ILTypeSpec *spec;
/* Use a different approach if the class is a type specification */
type = ILClassGetSynType(info);
@@ -377,49 +372,8 @@
}
/* Dump the generic parameters, if any are present */
- genericNum = 0;
- genPar = ILGenericParGetFromOwner(ILToProgramItem(info), genericNum);
- if(genPar)
- {
- putc('<', outstream);
- do
- {
- if(genericNum > 0)
- {
- fputs(", ", outstream);
- }
- constraint = ILGenericPar_Constraint(genPar);
- if(constraint)
- {
- putc('(', outstream);
- spec = ILProgramItemToTypeSpec(constraint);
- if(spec)
- {
- ILDumpType(outstream, image,
ILTypeSpec_Type(spec), flags);
- }
- else
- {
- ILDumpType(outstream, image,
-
ILClassToType((ILClass *)constraint), flags);
- }
- putc(')', outstream);
- }
- name = ILGenericPar_Name(genPar);
- if(name)
- {
- ILDumpIdentifier(outstream, name, 0, flags);
- }
- else
- {
- fprintf(outstream, "G_%d", (int)(genericNum +
1));
- }
- ++genericNum;
- genPar = ILGenericParGetFromOwner
- (ILToProgramItem(info), genericNum);
- }
- while(genPar != 0);
- putc('>', outstream);
- }
+ ILAsmDumpGenericParams(image, outstream,
+ ILToProgramItem(info),
flags);
}
/*
@@ -457,7 +411,7 @@
DumpClassName(outstream, image, info, flags, 0);
if(ILClass_Parent(info))
{
- fputs(" extends ", outstream);
+ fputs("\n extends ", outstream);
DumpClassName(outstream, image, ILClass_Parent(info),
flags, 1);
}
first = 1;
@@ -467,13 +421,15 @@
interface = ILImplementsGetInterface(impl);
if(first)
{
- fputs(" implements ", outstream);
+ fputs("\n implements ", outstream);
first = 0;
}
else
{
- fputs(", ", outstream);
+ fputs(",\n", outstream);
+ fputs(" ", outstream);
}
+ interface = ILClassResolve(interface);
DumpClassName(outstream, image, interface, flags, 1);
}
fputs("\n{\n", outstream);
Index: dumpasm/dump_type.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/dumpasm/dump_type.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- dumpasm/dump_type.c 6 Mar 2004 09:47:38 -0000 1.15
+++ dumpasm/dump_type.c 1 Jul 2007 14:15:16 -0000 1.16
@@ -673,11 +673,6 @@
ILUInt32 callingConventions;
ILType *synType;
int dumpGenerics;
- ILUInt32 genericNum;
- ILGenericPar *genPar;
- const char *name;
- ILProgramItem *constraint;
- ILTypeSpec *spec;
unsigned long numWithParams;
unsigned long withParam;
@@ -733,51 +728,8 @@
/* Dump the generic method parameters if necessary */
if(dumpGenerics && methodInfo)
{
- genericNum = 0;
- genPar = ILGenericParGetFromOwner
- (ILToProgramItem(methodInfo), genericNum);
- if(genPar)
- {
- putc('<', stream);
- do
- {
- if(genericNum > 0)
- {
- fputs(", ", stream);
- }
- constraint = ILGenericPar_Constraint(genPar);
- if(constraint)
- {
- putc('(', stream);
- spec =
ILProgramItemToTypeSpec(constraint);
- if(spec)
- {
- ILDumpType(stream, image,
-
ILTypeSpec_Type(spec), flags);
- }
- else
- {
- ILDumpType(stream, image,
-
ILClassToType((ILClass *)constraint), flags);
- }
- putc(')', stream);
- }
- name = ILGenericPar_Name(genPar);
- if(name)
- {
- ILDumpIdentifier(stream, name, 0,
flags);
- }
- else
- {
- fprintf(stream, "G_%d",
(int)(genericNum + 1));
- }
- ++genericNum;
- genPar = ILGenericParGetFromOwner
- (ILToProgramItem(methodInfo),
genericNum);
- }
- while(genPar != 0);
- putc('>', stream);
- }
+ ILAsmDumpGenericParams(image, stream,
+
ILToProgramItem(methodInfo), flags);
}
else if(withTypes)
{
Index: dumpasm/dump_utils.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/dumpasm/dump_utils.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- dumpasm/dump_utils.c 9 Feb 2007 21:54:16 -0000 1.1
+++ dumpasm/dump_utils.c 1 Jul 2007 14:15:16 -0000 1.2
@@ -186,6 +186,96 @@
}
}
+void ILAsmDumpGenericParams(ILImage *image, FILE *outstream,
+ ILProgramItem *item,
int flags)
+{
+ ILUInt32 genericNum, genParFlags;
+ ILGenericPar *genPar;
+ ILGenericConstraint *genConstr;
+ ILProgramItem *constraint;
+ ILTypeSpec *spec;
+ const char *name;
+
+ genericNum = 0;
+ genPar = ILGenericParGetFromOwner(item, genericNum);
+ if(genPar)
+ {
+ putc('<', outstream);
+ do
+ {
+ if(genericNum > 0)
+ {
+ fputs(", ", outstream);
+ }
+ genParFlags = ILGenericParGetFlags(genPar);
+ if ((genParFlags & IL_META_GENPARAM_VARIANCE_MASK) != 0)
+ {
+ /* This generic parameter is a variance */
+ if (genParFlags & IL_META_GENPARAM_COVARIANT)
+ {
+ fputs("+ ", outstream);
+ }
+ else if (genParFlags &
IL_META_GENPARAM_CONTRAVARIANT)
+ {
+ fputs("- ", outstream);
+ }
+ }
+ if ((genParFlags & IL_META_GENPARAM_SPECIAL_CONST_MASK)
!= 0)
+ {
+ /* This generic parameter has special
constraints */
+ if (genParFlags & IL_META_GENPARAM_CTOR_CONST)
+ {
+ fputs(".ctor ", outstream);
+ }
+ if (genParFlags & IL_META_GENPARAM_CLASS_CONST)
+ {
+ fputs("class ", outstream);
+ }
+ if (genParFlags &
IL_META_GENPARAM_VALUETYPE_CONST)
+ {
+ fputs("valuetype ", outstream);
+ }
+ }
+ genConstr = ILGenericParNextConstraint(genPar, 0);
+ if(genConstr)
+ {
+ putc('(', outstream);
+ while(genConstr)
+ {
+ constraint =
ILConstraint_Type(genConstr);
+ spec =
ILProgramItemToTypeSpec(constraint);
+ if(spec)
+ {
+ ILDumpType(outstream, image,
ILTypeSpec_Type(spec), flags);
+ }
+ else
+ {
+ ILDumpType(outstream, image,
+
ILClassToType((ILClass *)constraint), flags);
+ }
+ genConstr =
ILGenericParNextConstraint(genPar, genConstr);
+ if(genConstr)
+ fputs(", ", outstream);
+ }
+ putc(')', outstream);
+ }
+ name = ILGenericPar_Name(genPar);
+ if(name)
+ {
+ ILDumpIdentifier(outstream, name, 0, flags);
+ }
+ else
+ {
+ fprintf(outstream, "G_%d", (int)(genericNum +
1));
+ }
+ ++genericNum;
+ genPar = ILGenericParGetFromOwner(item, genericNum);
+ }
+ while(genPar != 0);
+ putc('>', outstream);
+ }
+}
+
#ifdef __cplusplus
};
#endif
Index: ilasm/ilasm_build.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/ilasm/ilasm_build.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- ilasm/ilasm_build.c 5 May 2007 18:15:17 -0000 1.26
+++ ilasm/ilasm_build.c 1 Jul 2007 14:15:16 -0000 1.27
@@ -371,7 +371,7 @@
}
constraint = ILToProgramItem(spec);
}
- ILGenericParSetConstraint(genPar, constraint);
+ ILGenericParAddConstraint(genPar, constraint);
}
ILFree(genericParams);
genericParams = nextGeneric;
Index: ilasm/ilasm_grammar.y
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/ilasm/ilasm_grammar.y,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -b -r1.44 -r1.45
--- ilasm/ilasm_grammar.y 5 May 2007 15:56:42 -0000 1.44
+++ ilasm/ilasm_grammar.y 1 Jul 2007 14:15:16 -0000 1.45
@@ -2098,7 +2098,7 @@
}
constraint =
ILToProgramItem(spec);
}
-
ILGenericParSetConstraint(genPar, constraint);
+
ILGenericParAddConstraint(genPar, constraint);
}
ILFree(genericParams);
genericParams = nextGeneric;
Index: ilalink/link_class.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/ilalink/link_class.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- ilalink/link_class.c 6 Mar 2004 11:04:45 -0000 1.14
+++ ilalink/link_class.c 1 Jul 2007 14:15:16 -0000 1.15
@@ -46,6 +46,7 @@
ILUInt32 genericNum;
ILGenericPar *genPar;
ILGenericPar *newGenPar;
+ ILGenericConstraint *genConstr;
ILProgramItem *constraint;
ILTypeSpec *spec;
@@ -248,9 +249,12 @@
_ILLinkerOutOfMemory(linker);
return 0;
}
- constraint = ILGenericPar_Constraint(genPar);
- if(constraint)
+ genConstr = ILGenericParNextConstraint(genPar, 0);
+ if(genConstr)
{
+ while (genConstr)
+ {
+ constraint = ILConstraint_Type(genConstr);
spec = ILProgramItemToTypeSpec(constraint);
if(spec)
{
@@ -266,7 +270,12 @@
{
return 0;
}
- ILGenericParSetConstraint(newGenPar, constraint);
+ if (!ILGenericParAddConstraint(newGenPar,
constraint))
+ {
+ return 0;
+ }
+ genConstr = ILGenericParNextConstraint(genPar,
genConstr);
+ }
}
++genericNum;
}
Index: ilalink/link_method.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/ilalink/link_method.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -b -r1.29 -r1.30
--- ilalink/link_method.c 5 May 2007 15:56:42 -0000 1.29
+++ ilalink/link_method.c 1 Jul 2007 14:15:16 -0000 1.30
@@ -603,6 +603,7 @@
ILUInt32 genericNum;
ILGenericPar *genPar;
ILGenericPar *newGenPar;
+ ILGenericConstraint *genConstr;
ILProgramItem *constraint;
ILTypeSpec *spec;
@@ -845,9 +846,12 @@
_ILLinkerOutOfMemory(linker);
return 0;
}
- constraint = ILGenericPar_Constraint(genPar);
- if(constraint)
+ genConstr = ILGenericParNextConstraint(genPar, 0);
+ if(genConstr)
{
+ while (genConstr)
+ {
+ constraint = ILConstraint_Type(genConstr);
spec = ILProgramItemToTypeSpec(constraint);
if(spec)
{
@@ -863,7 +867,12 @@
{
return 0;
}
- ILGenericParSetConstraint(newGenPar, constraint);
+ if (!ILGenericParAddConstraint(newGenPar,
constraint))
+ {
+ return 0;
+ }
+ genConstr = ILGenericParNextConstraint(genPar,
genConstr);
+ }
}
++genericNum;
}
Index: image/generic.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/image/generic.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- image/generic.c 26 Feb 2003 00:07:26 -0000 1.4
+++ image/generic.c 1 Jul 2007 14:15:16 -0000 1.5
@@ -43,8 +43,7 @@
genPar->number = (ILUInt16)number;
genPar->flags = 0;
genPar->name = 0;
- genPar->kind = 0;
- genPar->constraint = 0;
+ genPar->firstConstraint = 0;
/* Assign a token code to the GenericPar information block */
if(!_ILImageSetToken(image, &(genPar->ownedItem.programItem), token,
@@ -96,24 +95,53 @@
return (genPar->name != 0);
}
-ILProgramItem *ILGenericParGetKind(ILGenericPar *genPar)
+ILGenericConstraint *ILGenericParNextConstraint(ILGenericPar *genPar,
ILGenericConstraint *last)
{
- return genPar->kind;
+ if(last)
+ {
+ return last->nextConstraint;
+ }
+ else if(genPar)
+ {
+ return genPar->firstConstraint;
+ }
+ else
+ {
+ return 0;
+ }
}
-void ILGenericParSetKind(ILGenericPar *genPar, ILProgramItem *type)
+ILGenericConstraint *ILGenericParAddConstraint(ILGenericPar *genPar,
ILProgramItem *constraint)
{
- genPar->kind = type;
+ ILGenericConstraint **last = &(genPar->firstConstraint);
+
+ while (*last != 0)
+ {
+ last = &((*last)->nextConstraint);
+ }
+ (*last) = ILMemStackAlloc(&(constraint->image->memStack),
ILGenericConstraint);
+ if(!(*last))
+ {
+ return 0;
+ }
+
+ (*last)->ownedItem.programItem.image =
genPar->ownedItem.programItem.image;
+ (*last)->ownedItem.owner = ILToProgramItem(genPar);
+ (*last)->parameter = ILToProgramItem(genPar);
+ (*last)->constraint = constraint;
+ (*last)->nextConstraint = 0;
+
+ return (*last);
}
-ILProgramItem *ILGenericParGetConstraint(ILGenericPar *genPar)
+ILGenericPar *ILConstraintGetParam(ILGenericConstraint *constraint)
{
- return genPar->constraint;
+ return (ILGenericPar *)constraint->parameter;
}
-void ILGenericParSetConstraint(ILGenericPar *genPar, ILProgramItem *type)
+ILProgramItem *ILConstraintGetType(ILGenericConstraint *constraint)
{
- genPar->constraint = type;
+ return constraint->constraint;
}
/*
Index: image/meta_build.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/image/meta_build.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -b -r1.46 -r1.47
--- image/meta_build.c 9 Jun 2005 07:59:59 -0000 1.46
+++ image/meta_build.c 1 Jul 2007 14:15:16 -0000 1.47
@@ -1013,7 +1013,7 @@
* Load a reference to a type definition token that is
* further along in the file from where we currently are.
*/
-static int LoadForwardTypeDef(ILImage *image, ILToken token)
+int LoadForwardTypeDef(ILImage *image, ILToken token)
{
ILUInt32 values[IL_IMAGE_TOKEN_COLUMNS];
ILUInt32 valuesNext[IL_IMAGE_TOKEN_COLUMNS];
@@ -3243,18 +3243,6 @@
{
return IL_LOADERR_MEMORY;
}
- if(values[IL_OFFSET_GENERICPAR_KIND])
- {
- ILGenericParSetKind(genPar, ILProgramItem_FromToken
- (image, values[IL_OFFSET_GENERICPAR_KIND]));
- }
-
- /* Note: in Gyro, the constraint is stored in the GenericPar
- table, but in the .NET Framework SDK 2.0 beta it is stored
- in a separate GenericConstraint table. This code handles
- the Gyro case. See "Load_GenericConstraint" for the other */
- ILGenericParSetConstraint(genPar, ILProgramItem_FromToken
- (image, values[IL_OFFSET_GENERICPAR_CONSTRAINT]));
/* Done */
return 0;
@@ -3277,9 +3265,12 @@
return IL_LOADERR_BAD_META;
}
- /* Set the record's properties */
- ILGenericParSetConstraint(genPar, ILProgramItem_FromToken
- (image, values[IL_OFFSET_GENERICCON_CONSTRAINT]));
+ /* Add the generic constraint to the parameter */
+ if (!ILGenericParAddConstraint(genPar, ILProgramItem_FromToken (image,
+
values[IL_OFFSET_GENERICCON_CONSTRAINT])))
+ {
+ return IL_LOADERR_MEMORY;
+ }
/* Done */
return 0;
Index: image/meta_writer.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/image/meta_writer.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- image/meta_writer.c 1 Jun 2007 07:35:35 -0000 1.15
+++ image/meta_writer.c 1 Jul 2007 14:15:16 -0000 1.16
@@ -701,10 +701,6 @@
values[IL_OFFSET_GENERICPAR_FLAGS] = genPar->flags;
values[IL_OFFSET_GENERICPAR_OWNER] = genPar->ownedItem.owner->token;
values[IL_OFFSET_GENERICPAR_NAME] = GetPersistString(image,
genPar->name);
- values[IL_OFFSET_GENERICPAR_KIND] =
- (genPar->kind ? genPar->kind->token : 0);
- values[IL_OFFSET_GENERICPAR_CONSTRAINT] =
- (genPar->constraint ? genPar->constraint->token : 0);
}
/*
Index: image/program.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/image/program.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- image/program.h 16 Jan 2007 06:46:08 -0000 1.23
+++ image/program.h 1 Jul 2007 14:15:17 -0000 1.24
@@ -677,20 +677,19 @@
ILUInt16 number; /* Parameter
number */
ILUInt16 flags; /* Parameter
flags */
const char *name; /* Parameter name */
- ILProgramItem *kind; /* Parameter kind */
- ILProgramItem *constraint; /* Parameter constraint
*/
+ ILGenericConstraint *firstConstraint; /* Parameter constraints */
};
/*
* Information about a generic constraint.
*/
-typedef struct _tagILGenericConstraint ILGenericConstraint;
struct _tagILGenericConstraint
{
ILOwnedItem ownedItem; /* Parent class
fields */
ILProgramItem *parameter; /* Generic parameter to
modify */
ILProgramItem *constraint; /* Constraint to apply
*/
+ ILGenericConstraint *nextConstraint; /* Next constraint for this
parameter */
};
Index: image/sig_parse.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/image/sig_parse.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- image/sig_parse.c 1 Mar 2004 04:21:12 -0000 1.9
+++ image/sig_parse.c 1 Jul 2007 14:15:17 -0000 1.10
@@ -122,6 +122,7 @@
ILMetaDataRead
*reader, int *kind,
int depth);
+int LoadForwardTypeDef(ILImage *image, ILToken token);
/*
* Parse an element type. "depth" is used to control the
* recursion depth so that malicious parties cannot cause
@@ -266,6 +267,20 @@
if(value != 0)
{
info = (ILClass *)ILImageTokenInfo(image,
value);
+ if(info == 0)
+ {
+ int error;
+ /*
+ * When this class is referenced as a
actual generic parameter for a base class,
+ * and it is not already loaded we can
get to this point.
+ */
+ error = LoadForwardTypeDef(image,
value);
+ if(error != 0)
+ {
+ return 0;
+ }
+ info = (ILClass
*)ILImageTokenInfo(image, value);
+ }
if(info != 0)
{
type = ILType_FromClass(info);
Index: include/il_dumpasm.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/include/il_dumpasm.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- include/il_dumpasm.h 11 Feb 2007 14:48:54 -0000 1.11
+++ include/il_dumpasm.h 1 Jul 2007 14:15:17 -0000 1.12
@@ -214,6 +214,12 @@
ILProgramItem *item, int flags);
/*
+ * Dump the generic parameters of a generic class or method.
+ */
+void ILAsmDumpGenericParams(ILImage *image, FILE *outstream,
+ ILProgramItem *item,
int flags);
+
+/*
* Dump the ".data" and ".tls" sections.
*/
void ILDAsmDumpDataSections(FILE *outstream, ILImage *image);
Index: include/il_meta.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/include/il_meta.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- include/il_meta.h 20 Oct 2006 19:30:54 -0000 1.12
+++ include/il_meta.h 1 Jul 2007 14:15:17 -0000 1.13
@@ -301,6 +301,18 @@
#define IL_META_FILE_WRITEABLE 0x0002
/*
+ * Generic parameters flags.
+ */
+#define IL_META_GENPARAM_VARIANCE_MASK 0x0003
+#define IL_META_GENPARAM_NONE 0x0000
+#define IL_META_GENPARAM_COVARIANT 0x0001
+#define IL_META_GENPARAM_CONTRAVARIANT 0x0002
+#define IL_META_GENPARAM_SPECIAL_CONST_MASK 0x001C
+#define IL_META_GENPARAM_CLASS_CONST 0x0004
+#define IL_META_GENPARAM_VALUETYPE_CONST 0x0008
+#define IL_META_GENPARAM_CTOR_CONST 0x0010
+
+/*
* Element types.
*/
#define IL_META_ELEMTYPE_END 0x00
Index: include/il_program.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/include/il_program.h,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -b -r1.54 -r1.55
--- include/il_program.h 20 Oct 2006 19:30:54 -0000 1.54
+++ include/il_program.h 1 Jul 2007 14:15:17 -0000 1.55
@@ -62,6 +62,7 @@
typedef struct _tagILManifestRes ILManifestRes;
typedef struct _tagILExportedType ILExportedType;
typedef struct _tagILGenericPar ILGenericPar;
+typedef struct _tagILGenericConstraint ILGenericConstraint;
typedef struct _tagILMethodSpec ILMethodSpec;
/*
@@ -2321,24 +2322,14 @@
int ILGenericParSetName(ILGenericPar *genPar, const char *name);
/*
- * Get the kind associated with a generic parameter.
+ * Get the next constraint associated with generic parameter.
*/
-ILProgramItem *ILGenericParGetKind(ILGenericPar *genPar);
+ILGenericConstraint *ILGenericParNextConstraint(ILGenericPar *genPar,
ILGenericConstraint *last);
/*
- * Set the kind associated with a generic parameter.
+ * Add a constraint to a generic parameter.
*/
-void ILGenericParSetKind(ILGenericPar *genPar, ILProgramItem *type);
-
-/*
- * Get the constraint associated with a generic parameter.
- */
-ILProgramItem *ILGenericParGetConstraint(ILGenericPar *genPar);
-
-/*
- * Set the constraint associated with a generic parameter.
- */
-void ILGenericParSetConstraint(ILGenericPar *genPar, ILProgramItem *type);
+ILGenericConstraint *ILGenericParAddConstraint(ILGenericPar *genPar,
ILProgramItem *constraint);
/*
* Get a generic parameter record for a particular owner and number.
@@ -2361,8 +2352,22 @@
#define ILGenericPar_Flags(genPar)
(ILGenericParGetFlags((genPar)))
#define ILGenericPar_Owner(genPar)
(ILGenericParGetOwner((genPar)))
#define ILGenericPar_Name(genPar)
(ILGenericParGetName((genPar)))
-#define ILGenericPar_Kind(genPar)
(ILGenericParGetKind((genPar)))
-#define ILGenericPar_Constraint(genPar)
(ILGenericParGetConstraint((genPar)))
+
+/*
+ * Return the associated Parameter to the generic constraint
+ */
+ILGenericPar *ILConstraintGetParam(ILGenericConstraint *constraint);
+
+/*
+ * Return the type associated specified by the generic constraint
+ */
+ILProgramItem *ILConstraintGetType(ILGenericConstraint *constraint);
+
+/*
+ * Helper macros for querying information about generic constraints.
+ */
+#define ILConstraint_Param(constraint) (ILConstraintGetParam(constraint))
+#define ILConstraint_Type(constraint) (ILConstraintGetType(constraint))
/*
* Create a method specification record.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [dotgnu-pnet-commits] pnet ChangeLog csdoc/il2doc.c dumpasm/dump_clas...,
Klaus Treichel <=