[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[dotgnu-pnet-commits] pnet ChangeLog ilalink/linker.h ilalink/link_at...
From: |
Klaus Treichel |
Subject: |
[dotgnu-pnet-commits] pnet ChangeLog ilalink/linker.h ilalink/link_at... |
Date: |
Sat, 04 Oct 2008 20:13:24 +0000 |
CVSROOT: /cvsroot/dotgnu-pnet
Module name: pnet
Changes by: Klaus Treichel <ktreichel> 08/10/04 20:13:24
Modified files:
. : ChangeLog
ilalink : linker.h link_attrs.c link_class.c
link_method.c Makefile.am
Added files:
ilalink : link_generics.c
Log message:
Fix some compiler warnings.
Add file with generics support.
Copy primary, secondary and ctor constraints and attributes for the
generic
parameters.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pnet/ChangeLog?cvsroot=dotgnu-pnet&r1=1.3572&r2=1.3573
http://cvs.savannah.gnu.org/viewcvs/pnet/ilalink/linker.h?cvsroot=dotgnu-pnet&r1=1.34&r2=1.35
http://cvs.savannah.gnu.org/viewcvs/pnet/ilalink/link_attrs.c?cvsroot=dotgnu-pnet&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/pnet/ilalink/link_class.c?cvsroot=dotgnu-pnet&r1=1.16&r2=1.17
http://cvs.savannah.gnu.org/viewcvs/pnet/ilalink/link_method.c?cvsroot=dotgnu-pnet&r1=1.31&r2=1.32
http://cvs.savannah.gnu.org/viewcvs/pnet/ilalink/Makefile.am?cvsroot=dotgnu-pnet&r1=1.20&r2=1.21
http://cvs.savannah.gnu.org/viewcvs/pnet/ilalink/link_generics.c?cvsroot=dotgnu-pnet&rev=1.1
Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/ChangeLog,v
retrieving revision 1.3572
retrieving revision 1.3573
diff -u -b -r1.3572 -r1.3573
--- ChangeLog 2 Oct 2008 14:23:36 -0000 1.3572
+++ ChangeLog 4 Oct 2008 20:13:22 -0000 1.3573
@@ -1,3 +1,20 @@
+2008-10-04 Klaus Treichel <address@hidden>
+
+ * ilalink/link_generics.c (_ILLinkerConvertGenerics): Add new file
+ with the consolidated generics stuff. Add copying primary, secondary
+ and ctor constraints and the attributes for the generic parameters.
+
+ * ilalink/linker.h (_ILLinkerConvertGenerics): Add prototype.
+
+ * ilalink/link_class.c (ConvertClass),
+ ilalink/link_method.c (_ILLinkerConvertMethod): Use the new common
+ function instead of having the code duplicated.
+
+ * ilalink/Makefile.am: Add link_generics.c to the sources.
+
+ * ilalink/link_attrs.c (_ILLinkerConvertDebug): Fix some compiler
+ warnings.
+
2008-10-02 Klaus Treichel <address@hidden>
* cscc/csharp/cs_grammar.y: Fix some shift/reduce conflicts and the
Index: ilalink/linker.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/ilalink/linker.h,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -b -r1.34 -r1.35
--- ilalink/linker.h 5 May 2007 15:56:42 -0000 1.34
+++ ilalink/linker.h 4 Oct 2008 20:13:23 -0000 1.35
@@ -379,6 +379,14 @@
ILType *arg1Type,
ILType *arg2Type,
void *data, int len);
+#if IL_VERSION_MAJOR > 1
+/*
+ * Copy the generic parameters for one program item to an other one.
+ */
+int _ILLinkerConvertGenerics(ILLinker *linker, ILProgramItem *oldItem,
+ ILProgramItem *newItem);
+#endif /* IL_VERSION_MAJOR > 1 */
+
#ifdef __cplusplus
};
#endif
Index: ilalink/link_attrs.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/ilalink/link_attrs.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- ilalink/link_attrs.c 2 Apr 2002 06:11:51 -0000 1.5
+++ ilalink/link_attrs.c 4 Oct 2008 20:13:23 -0000 1.6
@@ -126,7 +126,7 @@
ILDebugContext *dbg;
ILDebugIter iter;
ILMetaDataRead reader;
- char buf[1024];
+ unsigned char buf[1024];
unsigned long len;
const char *name;
unsigned long nameIndex;
Index: ilalink/link_class.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/ilalink/link_class.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- ilalink/link_class.c 17 Jul 2007 17:30:29 -0000 1.16
+++ ilalink/link_class.c 4 Oct 2008 20:13:23 -0000 1.17
@@ -43,12 +43,6 @@
ILNestedInfo *nested;
ILMember *member;
ILLibraryFind find;
- ILUInt32 genericNum;
- ILGenericPar *genPar;
- ILGenericPar *newGenPar;
- ILGenericConstraint *genConstr;
- ILProgramItem *constraint;
- ILTypeSpec *spec;
/* Convert the parent class reference */
parent = ILClass_ParentRef(classInfo);
@@ -232,53 +226,14 @@
}
}
+#if IL_VERSION_MAJOR > 1
/* Convert the generic parameters, if any */
- genericNum = 0;
- while((genPar = ILGenericParGetFromOwner
- (ILToProgramItem(classInfo), genericNum)) != 0)
- {
- newGenPar = ILGenericParCreate
- (linker->image, 0, ILToProgramItem(newClass),
genericNum);
- if(!newGenPar)
- {
- _ILLinkerOutOfMemory(linker);
- return 0;
- }
- if(!ILGenericParSetName(newGenPar, ILGenericPar_Name(genPar)))
- {
- _ILLinkerOutOfMemory(linker);
- return 0;
- }
- genConstr = ILGenericParNextConstraint(genPar, 0);
- if(genConstr)
- {
- while (genConstr)
- {
- constraint = ILConstraint_Type(genConstr);
- spec = ILProgramItemToTypeSpec(constraint);
- if(spec)
- {
- constraint = ILToProgramItem
-
(_ILLinkerConvertTypeSpec(linker, ILTypeSpec_Type(spec)));
- }
- else
- {
- constraint = ILToProgramItem
-
(_ILLinkerConvertClassRef(linker, (ILClass *)constraint));
- }
- if(!constraint)
- {
- return 0;
- }
- if (!ILGenericParAddConstraint(newGenPar, 0,
constraint))
+ if(!_ILLinkerConvertGenerics(linker, (ILProgramItem *)classInfo,
+ (ILProgramItem
*)newClass))
{
return 0;
}
- genConstr = ILGenericParNextConstraint(genPar,
genConstr);
- }
- }
- ++genericNum;
- }
+#endif
/* Convert the class members */
member = 0;
Index: ilalink/link_method.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/ilalink/link_method.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -b -r1.31 -r1.32
--- ilalink/link_method.c 17 Jul 2007 17:30:29 -0000 1.31
+++ ilalink/link_method.c 4 Oct 2008 20:13:23 -0000 1.32
@@ -600,12 +600,6 @@
ILException *exceptions;
ILUInt32 numParams;
char *newName = 0;
- ILUInt32 genericNum;
- ILGenericPar *genPar;
- ILGenericPar *newGenPar;
- ILGenericConstraint *genConstr;
- ILProgramItem *constraint;
- ILTypeSpec *spec;
/* Rename the method if it is within the "<Module>" class and private */
if(ILMethod_IsPrivate(method) && ILMethod_IsStatic(method) &&
@@ -829,53 +823,14 @@
}
}
+#if IL_VERSION_MAJOR > 1
/* Convert the generic parameters, if any */
- genericNum = 0;
- while((genPar = ILGenericParGetFromOwner
- (ILToProgramItem(method), genericNum)) != 0)
- {
- newGenPar = ILGenericParCreate(linker->image, 0,
-
ILToProgramItem(newMethod), genericNum);
- if(!newGenPar)
- {
- _ILLinkerOutOfMemory(linker);
- return 0;
- }
- if(!ILGenericParSetName(newGenPar, ILGenericPar_Name(genPar)))
+ if(!_ILLinkerConvertGenerics(linker, ILToProgramItem(method),
+
ILToProgramItem(newMethod)))
{
- _ILLinkerOutOfMemory(linker);
return 0;
}
- genConstr = ILGenericParNextConstraint(genPar, 0);
- if(genConstr)
- {
- while (genConstr)
- {
- constraint = ILConstraint_Type(genConstr);
- spec = ILProgramItemToTypeSpec(constraint);
- if(spec)
- {
- constraint = ILToProgramItem
-
(_ILLinkerConvertTypeSpec(linker, ILTypeSpec_Type(spec)));
- }
- else
- {
- constraint = ILToProgramItem
-
(_ILLinkerConvertClassRef(linker, (ILClass *)constraint));
- }
- if(!constraint)
- {
- return 0;
- }
- if (!ILGenericParAddConstraint(newGenPar, 0,
constraint))
- {
- return 0;
- }
- genConstr = ILGenericParNextConstraint(genPar,
genConstr);
- }
- }
- ++genericNum;
- }
+#endif
/* Get the method's code. If there is no code, then we are done */
if(!ILMethodGetCode(method, &code))
Index: ilalink/Makefile.am
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/ilalink/Makefile.am,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- ilalink/Makefile.am 21 Aug 2005 15:33:24 -0000 1.20
+++ ilalink/Makefile.am 4 Oct 2008 20:13:23 -0000 1.21
@@ -11,6 +11,7 @@
link_class.c \
link_create.c \
link_field.c \
+ link_generics.c \
link_image.c \
link_init.c \
link_library.c \
Index: ilalink/link_generics.c
===================================================================
RCS file: ilalink/link_generics.c
diff -N ilalink/link_generics.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ilalink/link_generics.c 4 Oct 2008 20:13:23 -0000 1.1
@@ -0,0 +1,105 @@
+/*
+ * link_generics.c - Copy generic parameters to the final image.
+ *
+ * Copyright (C) 2008 Southern Storm Software, Pty Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "linker.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if IL_VERSION_MAJOR > 1
+/*
+ * Copy the generic parameters for one program item to an other one.
+ */
+int _ILLinkerConvertGenerics(ILLinker *linker, ILProgramItem *oldItem,
+ ILProgramItem *newItem)
+{
+ ILUInt32 genericNum;
+ ILGenericPar *genPar;
+
+ genericNum = 0;
+ while((genPar = ILGenericParGetFromOwner(oldItem, genericNum)) != 0)
+ {
+ ILGenericPar *newGenPar;
+ ILGenericConstraint *genConstr;
+ ILProgramItem *constraint;
+ ILTypeSpec *spec;
+
+ newGenPar = ILGenericParCreate(linker->image, 0, newItem,
genericNum);
+ if(!newGenPar)
+ {
+ _ILLinkerOutOfMemory(linker);
+ return 0;
+ }
+ if(!ILGenericParSetName(newGenPar, ILGenericPar_Name(genPar)))
+ {
+ _ILLinkerOutOfMemory(linker);
+ return 0;
+ }
+ /*
+ * Copy the primary, secondary and ctor constraints.
+ */
+ ILGenericParSetFlags(newGenPar, 0,
ILGenericParGetFlags(genPar));
+
+ /*
+ * Now copy the type constraints associated with the generic
parameter.
+ */
+ genConstr = 0;
+ while((genConstr = ILGenericParNextConstraint(genPar,
genConstr)) != 0)
+ {
+ constraint = ILConstraint_Type(genConstr);
+ spec = ILProgramItemToTypeSpec(constraint);
+ if(spec)
+ {
+ constraint = ILToProgramItem
+ (_ILLinkerConvertTypeSpec(linker,
ILTypeSpec_Type(spec)));
+ }
+ else
+ {
+ constraint = ILToProgramItem
+ (_ILLinkerConvertClassRef(linker,
(ILClass *)constraint));
+ }
+ if(!constraint)
+ {
+ return 0;
+ }
+ if (!ILGenericParAddConstraint(newGenPar, 0,
constraint))
+ {
+ return 0;
+ }
+ }
+
+ /*
+ * Now copy the attributes associated with the generic
parameter.
+ */
+ if(!_ILLinkerConvertAttrs(linker, ILToProgramItem(genPar),
+
ILToProgramItem(newGenPar)))
+ {
+ return 0;
+ }
+ ++genericNum;
+ }
+ return 1;
+}
+#endif /* IL_VERSION_MAJOR > 1 */
+
+#ifdef __cplusplus
+};
+#endif
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [dotgnu-pnet-commits] pnet ChangeLog ilalink/linker.h ilalink/link_at...,
Klaus Treichel <=