dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[dotgnu-pnet-commits] pnet ChangeLog codegen/cg_coerce.c codegen/cg_g...


From: Klaus Treichel
Subject: [dotgnu-pnet-commits] pnet ChangeLog codegen/cg_coerce.c codegen/cg_g...
Date: Sun, 14 Dec 2008 15:20:01 +0000

CVSROOT:        /cvsroot/dotgnu-pnet
Module name:    pnet
Changes by:     Klaus Treichel <ktreichel>      08/12/14 15:20:00

Modified files:
        .              : ChangeLog 
        codegen        : cg_coerce.c cg_gen.c cg_gen.h 
        cscc/csharp    : cs_stmt.tc 

Log message:
        Fix some issues in the fixed statement and allow the new conversions 
there now.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pnet/ChangeLog?cvsroot=dotgnu-pnet&r1=1.3591&r2=1.3592
http://cvs.savannah.gnu.org/viewcvs/pnet/codegen/cg_coerce.c?cvsroot=dotgnu-pnet&r1=1.30&r2=1.31
http://cvs.savannah.gnu.org/viewcvs/pnet/codegen/cg_gen.c?cvsroot=dotgnu-pnet&r1=1.53&r2=1.54
http://cvs.savannah.gnu.org/viewcvs/pnet/codegen/cg_gen.h?cvsroot=dotgnu-pnet&r1=1.51&r2=1.52
http://cvs.savannah.gnu.org/viewcvs/pnet/cscc/csharp/cs_stmt.tc?cvsroot=dotgnu-pnet&r1=1.42&r2=1.43

Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/ChangeLog,v
retrieving revision 1.3591
retrieving revision 1.3592
diff -u -b -r1.3591 -r1.3592
--- ChangeLog   14 Dec 2008 13:03:33 -0000      1.3591
+++ ChangeLog   14 Dec 2008 15:19:59 -0000      1.3592
@@ -2,8 +2,15 @@
 
        * codegen/cg_coerce.c (GetUnsafeConvertRules): Handle cast from an array
        to a pointer to the array's element type.
+       Allow casting a string or array to a pointer only if the new flag 
inFixed
+       in the gen struct is set.
        (ApplyRules): Handle the array to element type pointer conversion.
 
+       * codegen/cg_gen.c (ILGenInfoInit): Initialize  the new flag inFixed in
+       the generator struct.
+
+       * codegen/cg_gen.h: Add the new flag inFixed to the ILGenInfo struct.
+
        * codegen/cg_misc.tc: Add the codegen functions for the new node type
        ILNode_CastArrayToElementPtr.
 
@@ -15,6 +22,11 @@
        * cscc/c/c_name.tc, cscc/c/c_oper.tc, cscc/csharp/cs_oper.tc: Add the
        functions to handle the new node type ILNode_CastArrayToElementPtr.
 
+       * cscc/csharp/cs_stmp,tc (ILNode_SemAnalysis(ILNode_Fixed)): Add check
+       if the type in the fixed statement is a pointer type.
+       Set the new inFixed flag before semanalyzing the FixedPointerDeclarators
+       and reset it afterwards.
+
 2008-12-12  Klaus Treichel  <address@hidden>
 
        * codegen/cg_misc.tc (ILNode_GenValue(ILNode_CastStringToCharPtr)): Add

Index: codegen/cg_coerce.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/codegen/cg_coerce.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -b -r1.30 -r1.31
--- codegen/cg_coerce.c 14 Dec 2008 13:03:34 -0000      1.30
+++ codegen/cg_coerce.c 14 Dec 2008 15:20:00 -0000      1.31
@@ -400,7 +400,9 @@
                                return 1;
                        }
                }
-
+       }
+       else if(info->inFixed)
+       {
                /* String to char * or void * conversion */
                if((ILTypeToMachineType(fromType) == ILMachineType_String) &&
                   ILType_IsPointer(toType))

Index: codegen/cg_gen.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/codegen/cg_gen.c,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -b -r1.53 -r1.54
--- codegen/cg_gen.c    26 Nov 2008 20:15:18 -0000      1.53
+++ codegen/cg_gen.c    14 Dec 2008 15:20:00 -0000      1.54
@@ -112,6 +112,7 @@
        info->needSwitchPop = 0;
        info->hasGotoScopes = -1;
        info->resolvingAlias = 0;
+       info->inFixed = 0;
        info->decimalRoundMode = IL_DECIMAL_ROUND_HALF_EVEN;
        info->stackHeight = 0;
        info->maxStackHeight = 0;

Index: codegen/cg_gen.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/codegen/cg_gen.h,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -b -r1.51 -r1.52
--- codegen/cg_gen.h    26 Nov 2008 20:15:18 -0000      1.51
+++ codegen/cg_gen.h    14 Dec 2008 15:20:00 -0000      1.52
@@ -121,6 +121,7 @@
        int                             needSwitchPop : 1;      /* Non-zero to 
pop a switch value */
        int                             hasGotoScopes : 1;      /* Non-zero if 
goto scopes used */
        int                             resolvingAlias : 1;     /* Non-zero if 
resolving an alias */
+       int                             inFixed : 1;            /* Non-Zero if 
in a fixed statement */
        int             decimalRoundMode;       /* Rounding mode for ILDecimal 
*/
        long                    stackHeight;            /* Current stack height 
*/
        long                    maxStackHeight;         /* Maximum stack height 
*/

Index: cscc/csharp/cs_stmt.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/csharp/cs_stmt.tc,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -b -r1.42 -r1.43
--- cscc/csharp/cs_stmt.tc      29 Nov 2007 20:16:50 -0000      1.42
+++ cscc/csharp/cs_stmt.tc      14 Dec 2008 15:20:00 -0000      1.43
@@ -1672,6 +1672,12 @@
        /* Perform semantic analysis on the local variable type */
        type = CSSemType(node->type, info, &(node->type));
 
+       if(!ILType_IsPointer(type))
+       {
+               CCErrorOnLine(yygetfilename(errorNode), yygetlinenum(errorNode),
+                                       "only pointer types can be declared in 
fixed statements");
+       }
+
        /* Scan through the variable names and declare them in the current 
scope */
        ILNode_ListIter_Init(&iter, node->decls);
        while((varNode = ILNode_ListIter_Next(&iter)) != 0)
@@ -1717,7 +1723,9 @@
                        ILScopeDeclareLocal(info->currentScope, name,
                                                                
ILTypeNumLocals(method->localVarSig) - 1,
                                                                
((ILNode_FixedVariable*)varNode)->name);
+                       info->inFixed = -1;
                        ILNode_SemAnalysis(varNode,info,iter.last);
+                       info->inFixed = 0;
                }
        }
        ILNode_SemAnalysis(node->stmt,info,&(node->stmt));




reply via email to

[Prev in Thread] Current Thread [Next in Thread]