[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[dotgnu-pnet-commits] pnet ChangeLog codegen/cg_nodes.tc cscc/csharp/...
From: |
Klaus Treichel |
Subject: |
[dotgnu-pnet-commits] pnet ChangeLog codegen/cg_nodes.tc cscc/csharp/... |
Date: |
Sun, 23 Sep 2007 14:40:20 +0000 |
CVSROOT: /cvsroot/dotgnu-pnet
Module name: pnet
Changes by: Klaus Treichel <ktreichel> 07/09/23 14:40:20
Modified files:
. : ChangeLog
codegen : cg_nodes.tc
cscc/csharp : cs_defs.tc cs_gather.c cs_grammar.y
cs_lvalue.tc
Log message:
Optimize semanalysis of generic parameters and make sure that they are
semanalyzed only once so that errors appear only once.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pnet/ChangeLog?cvsroot=dotgnu-pnet&r1=1.3499&r2=1.3500
http://cvs.savannah.gnu.org/viewcvs/pnet/codegen/cg_nodes.tc?cvsroot=dotgnu-pnet&r1=1.89&r2=1.90
http://cvs.savannah.gnu.org/viewcvs/pnet/cscc/csharp/cs_defs.tc?cvsroot=dotgnu-pnet&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/pnet/cscc/csharp/cs_gather.c?cvsroot=dotgnu-pnet&r1=1.55&r2=1.56
http://cvs.savannah.gnu.org/viewcvs/pnet/cscc/csharp/cs_grammar.y?cvsroot=dotgnu-pnet&r1=1.80&r2=1.81
http://cvs.savannah.gnu.org/viewcvs/pnet/cscc/csharp/cs_lvalue.tc?cvsroot=dotgnu-pnet&r1=1.63&r2=1.64
Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/ChangeLog,v
retrieving revision 1.3499
retrieving revision 1.3500
diff -u -b -r1.3499 -r1.3500
--- ChangeLog 23 Sep 2007 08:49:54 -0000 1.3499
+++ ChangeLog 23 Sep 2007 14:40:19 -0000 1.3500
@@ -1,7 +1,20 @@
2007-09-23 Klaus Treichel <address@hidden>
+ * codegen/cg_nodes.tc: Add the member visited to the definitions of
+ ILNode_GenericTypeParameter and ILNode_GenericTypeParameters.
+
+ * cscc/csharp/cs_defs.tc: Add the node type
ILNode_GenericTypeConstraint.
+
* cscc/csharp/cs_gather.c: Fix resolving the class of generic type
constraints so that primitive types are handled too.
+ Move the semantic check of generic type parameters to the
+ ILNode_Semanalysis operation of the nodes.
+
+ * cscc/csharp/cs_grammar.y: Wrap the types for the type constraints in
+ ILNode_GenericTypeConstraint nodes.
+
+ * cscc/csharp/cs_lvalue.tc: Perform the semanalysis for generics in the
+ correponding ILNode_Semanalysis operations.
2007-09-20 Klaus Treichel <address@hidden>
Index: codegen/cg_nodes.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/codegen/cg_nodes.tc,v
retrieving revision 1.89
retrieving revision 1.90
diff -u -b -r1.89 -r1.90
--- codegen/cg_nodes.tc 20 Sep 2007 20:04:15 -0000 1.89
+++ codegen/cg_nodes.tc 23 Sep 2007 14:40:19 -0000 1.90
@@ -606,11 +606,13 @@
const char *name;
ILUInt32 constraint;
ILNode_List *typeConstraints;
+ %nocreate ILVisitMode visited = {ILVisitMode_NotVisited};
}
%node ILNode_GenericTypeParameters ILNode_Dummy =
{
ILUInt32 numTypeParams;
ILNode_List *typeParams;
+ %nocreate ILVisitMode visited = {ILVisitMode_NotVisited};
}
%output "cg_ainit.c"
Index: cscc/csharp/cs_defs.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/csharp/cs_defs.tc,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- cscc/csharp/cs_defs.tc 20 Sep 2007 20:04:16 -0000 1.18
+++ cscc/csharp/cs_defs.tc 23 Sep 2007 14:40:20 -0000 1.19
@@ -104,6 +104,12 @@
ILUInt32 constraint;
ILNode_List *typeConstraints;
}
+%node ILNode_GenericTypeConstraint ILNode_Dummy =
+{
+ ILNode *identifier;
+ %nocreate ILType *type = {0};
+ %nocreate ILVisitMode visited = {ILVisitMode_NotVisited};
+}
/*
* Misc nodes.
Index: cscc/csharp/cs_gather.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/csharp/cs_gather.c,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -b -r1.55 -r1.56
--- cscc/csharp/cs_gather.c 23 Sep 2007 08:49:55 -0000 1.55
+++ cscc/csharp/cs_gather.c 23 Sep 2007 14:40:20 -0000 1.56
@@ -128,7 +128,6 @@
{
if(constraints)
{
- ILUInt32 first = 1;
ILNode_ListIter iter;
ILNode *constraint;
@@ -142,30 +141,8 @@
{
ILClass *constraintClass =
ILClassFromType(info->image, 0, constraintType, 0);
- if(first)
+ if(constraintClass)
{
-
if(!ILClass_IsInterface(constraintClass))
- {
- if(ILGenericParGetFlags(genPar)
& (IL_META_GENPARAM_CLASS_CONST |
-
IL_META_GENPARAM_VALUETYPE_CONST))
- {
-
CCErrorOnLine(yygetfilename(constraint), yygetlinenum(constraint),
-
"either class or valuetype or a non interface class can be supplied");
- }
- }
- first = 0;
- }
- else
- {
-
if(!ILClass_IsInterface(constraintClass))
- {
-
CCErrorOnLine(yygetfilename(constraint), yygetlinenum(constraint),
- "only
one non interface class can be supplied");
- }
- }
-
- constraintClass = ILClassImport(info->image,
constraintClass);
-
if(!ILGenericParAddConstraint(genPar, 0,
ILToProgramItem(constraintClass)))
{
@@ -174,6 +151,7 @@
}
}
}
+ }
}
/*
@@ -189,6 +167,9 @@
ILNode_GenericTypeParameter *genParam;
ILNode_GenericTypeParameters *genParams;
+ /* Perform the semantic analysis on the typeFormals */
+ ILNode_SemAnalysis(typeFormals, info, &typeFormals);
+
genParams = (ILNode_GenericTypeParameters *)typeFormals;
ILNode_ListIter_Init(&iter, genParams->typeParams);
while((genParam =
@@ -271,6 +252,9 @@
ILNode_GenericTypeParameter *genParam;
ILNode_GenericTypeParameters *genParams;
+ /* Perform the semantic analysis on the typeFormals */
+ ILNode_SemAnalysis(defn->typeFormals, info,
&(defn->typeFormals));
+
genParams = (ILNode_GenericTypeParameters *)(defn->typeFormals);
ILNode_ListIter_Init(&iter, genParams->typeParams);
while((genParam =
Index: cscc/csharp/cs_grammar.y
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/csharp/cs_grammar.y,v
retrieving revision 1.80
retrieving revision 1.81
diff -u -b -r1.80 -r1.81
--- cscc/csharp/cs_grammar.y 20 Sep 2007 20:04:16 -0000 1.80
+++ cscc/csharp/cs_grammar.y 23 Sep 2007 14:40:20 -0000 1.81
@@ -3050,8 +3050,14 @@
;
SecondaryConstraints
- : Type { $$ =
(ILNode_List *)MakeList(0, $1); }
- | SecondaryConstraints ',' Type { $$ = (ILNode_List *)MakeList((ILNode
*)$1, $3); }
+ : Type {
+ $$ = (ILNode_List *)MakeList(0,
+
ILNode_GenericTypeConstraint_create($1));
+ }
+ | SecondaryConstraints ',' Type {
+ $$ = (ILNode_List
*)MakeList((ILNode *)$1,
+
ILNode_GenericTypeConstraint_create($3));
+ }
;
PrimaryConstraint
Index: cscc/csharp/cs_lvalue.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/csharp/cs_lvalue.tc,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -b -r1.63 -r1.64
--- cscc/csharp/cs_lvalue.tc 20 Sep 2007 20:04:17 -0000 1.63
+++ cscc/csharp/cs_lvalue.tc 23 Sep 2007 14:40:20 -0000 1.64
@@ -1177,15 +1177,114 @@
/*
* Perform semantic analysis for generic parameters.
*/
-ILNode_SemAnalysis(ILNode_GenericTypeParameter),
-ILNode_SemAnalysis(ILNode_GenericTypeParameters),
+ILNode_SemAnalysis(ILNode_GenericTypeParameter)
+{
+ if(node->visited == ILVisitMode_NotVisited)
+ {
+ ILUInt32 first = 1;
+ ILNode_ListIter iter;
+ ILNode *constraint;
+
+ node->visited = ILVisitMode_Processing;
+ ILNode_ListIter_Init(&iter, (ILNode *)node->typeConstraints);
+ while((constraint = ILNode_ListIter_Next(&iter)) != 0)
+ {
+ ILType *constraintType;
+
+ constraintType = CSSemType(constraint, info,
&constraint);
+ if(constraintType)
+ {
+ ILClass *constraintClass =
ILClassFromType(info->image, 0, constraintType, 0);
+
+ if(first)
+ {
+
if(!ILClass_IsInterface(constraintClass))
+ {
+ if(node->constraint &
(IL_META_GENPARAM_CLASS_CONST |
+
IL_META_GENPARAM_VALUETYPE_CONST))
+ {
+
CCErrorOnLine(yygetfilename(constraint), yygetlinenum(constraint),
+
"either class or valuetype or a non interface class can be supplied");
+ }
+ }
+ first = 0;
+ }
+ else
+ {
+
if(!ILClass_IsInterface(constraintClass))
+ {
+
CCErrorOnLine(yygetfilename(constraint), yygetlinenum(constraint),
+ "only
one non interface class can be supplied");
+ }
+ }
+
+ /* Import the constraint class into the build
image. */
+ constraintClass = ILClassImport(info->image,
constraintClass);
+ }
+ }
+ node->visited = ILVisitMode_Done;
+ }
+ return CSSemValueDefault;
+}
+
+ILNode_SemAnalysis(ILNode_GenericTypeParameters)
+{
+ if(node->visited == ILVisitMode_NotVisited)
+ {
+ ILNode_ListIter iter;
+ ILNode *genPar;
+
+ node->visited = ILVisitMode_Processing;
+ ILNode_ListIter_Init(&iter, (ILNode *)node->typeParams);
+ while((genPar = ILNode_ListIter_Next(&iter)) != 0)
+ {
+ ILNode_SemAnalysis(genPar, info, &(genPar));
+ }
+ node->visited = ILVisitMode_Done;
+ }
+ return CSSemValueDefault;
+}
+
ILNode_SemAnalysis(ILNode_GenericConstraint)
{
- /* This should never be called because they are handled
- during type gathering */
+ /* This should never be called because they are merged into the
+ GenericTypeParameter during parsing. */
return CSSemValueDefault;
}
+ILNode_SemAnalysis(ILNode_GenericTypeConstraint)
+{
+ CSSemValue value;
+
+ if(node->visited == ILVisitMode_NotVisited)
+ {
+ node->visited = ILVisitMode_Processing;
+
+ node->type = CSSemType(node->identifier, info,
&(node->identifier));
+
+ node->visited = ILVisitMode_Done;
+ }
+ CSSemSetType(value, node->type);
+ return value;
+}
+
+ILNode_SemAnalysisType(ILNode_GenericTypeConstraint)
+{
+ CSSemValue value;
+
+ if(node->visited == ILVisitMode_NotVisited)
+ {
+ node->visited = ILVisitMode_Processing;
+
+ node->type = CSSemType(node->identifier, info,
&(node->identifier));
+
+ node->visited = ILVisitMode_Done;
+ }
+ CSSemSetType(value, node->type);
+ return value;
+}
+
+
/*
* Perform semantic analysis for local and argument variables.
*/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [dotgnu-pnet-commits] pnet ChangeLog codegen/cg_nodes.tc cscc/csharp/...,
Klaus Treichel <=