[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] pnet/codegen cg_gen.h, 1.41, 1.42 cg_stmt.tc, 1.40
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] pnet/codegen cg_gen.h, 1.41, 1.42 cg_stmt.tc, 1.40, 1.41 jv_stmt.tc, 1.19, 1.20 |
Date: |
Tue, 14 Oct 2003 05:24:19 +0000 |
Update of /cvsroot/dotgnu-pnet/pnet/codegen
In directory subversions:/tmp/cvs-serv32053/codegen
Modified Files:
cg_gen.h cg_stmt.tc jv_stmt.tc
Log Message:
Fixed a bug in "foreach" which caused it to use the wrong
kind of jump when a "break" appeared in the loop body.
Index: cg_gen.h
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/codegen/cg_gen.h,v
retrieving revision 1.41
retrieving revision 1.42
diff -C2 -d -r1.41 -r1.42
*** cg_gen.h 5 Jul 2003 05:03:58 -0000 1.41
--- cg_gen.h 14 Oct 2003 05:24:17 -0000 1.42
***************
*** 37,40 ****
--- 37,41 ----
ILLabel *breakLabel;
ILLabel *finallyLabel;
+ int isForeachCollection;
} ILLoopStack;
Index: cg_stmt.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/codegen/cg_stmt.tc,v
retrieving revision 1.40
retrieving revision 1.41
diff -C2 -d -r1.40 -r1.41
*** cg_stmt.tc 18 Aug 2003 07:34:13 -0000 1.40
--- cg_stmt.tc 14 Oct 2003 05:24:17 -0000 1.41
***************
*** 34,38 ****
*/
static void PushLoop(ILGenInfo *info, ILLabel *continueLabel,
! ILLabel *breakLabel, char *name)
{
if(info->loopStackSize >= info->loopStackMax)
--- 34,39 ----
*/
static void PushLoop(ILGenInfo *info, ILLabel *continueLabel,
! ILLabel *breakLabel, char *name,
! int isForeachCollection)
{
if(info->loopStackSize >= info->loopStackMax)
***************
*** 54,57 ****
--- 55,60 ----
info->loopStack[info->loopStackSize].breakLabel = breakLabel;
info->loopStack[info->loopStackSize].finallyLabel = 0;
+ info->loopStack[info->loopStackSize].isForeachCollection =
+ isForeachCollection;
++(info->loopStackSize);
}
***************
*** 80,83 ****
--- 83,87 ----
info->loopStack[info->loopStackSize].breakLabel = 0;
info->loopStack[info->loopStackSize].finallyLabel = finallyLabel;
+ info->loopStack[info->loopStackSize].isForeachCollection = 0;
++(info->loopStackSize);
}
***************
*** 567,571 ****
{
/* Generate code for an infinite loop */
! PushLoop(info, &label1, &label2, node->name);
ILGenLabel(info, &label1);
if(node->stmt)
--- 571,575 ----
{
/* Generate code for an infinite loop */
! PushLoop(info, &label1, &label2, node->name, 0);
ILGenLabel(info, &label1);
if(node->stmt)
***************
*** 587,591 ****
{
/* Generate the full case of the "while" loop */
! PushLoop(info, &label2, &label3, node->name);
ILGenJump(info, IL_OP_BR, &label2);
ILGenLabel(info, &label1);
--- 591,595 ----
{
/* Generate the full case of the "while" loop */
! PushLoop(info, &label2, &label3, node->name, 0);
ILGenJump(info, IL_OP_BR, &label2);
ILGenLabel(info, &label1);
***************
*** 655,659 ****
{
/* Generate code for an infinite loop */
! PushLoop(info, &label1, &label2, node->name);
ILGenLabel(info, &label1);
if(node->stmt)
--- 659,663 ----
{
/* Generate code for an infinite loop */
! PushLoop(info, &label1, &label2, node->name, 0);
ILGenLabel(info, &label1);
if(node->stmt)
***************
*** 668,672 ****
{
/* Generate code for a single execution of the loop
body */
! PushLoop(info, &label1, &label1, node->name);
ILNode_GenDiscard(node->stmt, info);
ILGenLabel(info, &label1);
--- 672,676 ----
{
/* Generate code for a single execution of the loop
body */
! PushLoop(info, &label1, &label1, node->name, 0);
ILNode_GenDiscard(node->stmt, info);
ILGenLabel(info, &label1);
***************
*** 683,687 ****
{
/* Generate the full case of the "do" loop */
! PushLoop(info, &label2, &label3, node->name);
ILGenLabel(info, &label1);
ILNode_GenDiscard(node->stmt, info);
--- 687,691 ----
{
/* Generate the full case of the "do" loop */
! PushLoop(info, &label2, &label3, node->name, 0);
ILGenLabel(info, &label1);
ILNode_GenDiscard(node->stmt, info);
***************
*** 731,735 ****
{
/* Generate code for an infinite loop */
! PushLoop(info, &label2, &label3, node->name);
ILGenLabel(info, &label1);
if(node->stmt)
--- 735,739 ----
{
/* Generate code for an infinite loop */
! PushLoop(info, &label2, &label3, node->name, 0);
ILGenLabel(info, &label1);
if(node->stmt)
***************
*** 757,761 ****
{
/* Generate the full case of the "for" loop */
! PushLoop(info, &label2, &label4, node->name);
ILGenJump(info, IL_OP_BR, &label3);
ILGenLabel(info, &label1);
--- 761,765 ----
{
/* Generate the full case of the "for" loop */
! PushLoop(info, &label2, &label4, node->name, 0);
ILGenJump(info, IL_OP_BR, &label3);
ILGenLabel(info, &label1);
***************
*** 810,814 ****
/* Push the loop label information */
! PushLoop(info, &label2, &label4, node->name);
/* Fetch the next array element and put it into the variable */
--- 814,818 ----
/* Push the loop label information */
! PushLoop(info, &label2, &label4, node->name, 0);
/* Fetch the next array element and put it into the variable */
***************
*** 905,909 ****
/* Push the loop label information */
! PushLoop(info, &label2, &label4, node->name);
/* Fetch the next string element and put it into the variable */
--- 909,913 ----
/* Push the loop label information */
! PushLoop(info, &label2, &label4, node->name, 0);
/* Fetch the next string element and put it into the variable */
***************
*** 1005,1009 ****
/* Push the loop label information */
! PushLoop(info, &label2, &label5, node->name);
ILGenLabel(info, &label1);
--- 1009,1013 ----
/* Push the loop label information */
! PushLoop(info, &label2, &label5, node->name, 1);
ILGenLabel(info, &label1);
***************
*** 1121,1124 ****
--- 1125,1133 ----
/* Look for the next outer loop or switch to break to */
sawTryBlock = 0;
+ if(size > 0 && stack[size - 1].isForeachCollection)
+ {
+ /* This is a "foreach" block with a surrounding "try" */
+ sawTryBlock = 1;
+ }
while(size > 0 && stack[size - 1].breakLabel == 0)
{
***************
*** 1156,1159 ****
--- 1165,1173 ----
/* Look for the next outer loop or switch to break to */
sawTryBlock = 0;
+ if(size > 0 && stack[size - 1].isForeachCollection)
+ {
+ /* This is a "foreach" block with a surrounding "try" */
+ sawTryBlock = 1;
+ }
while(size > 0 && stack[size - 1].name != node->name)
{
***************
*** 1834,1838 ****
/* Push the switch context information for "break" statements */
! PushLoop(info, (ILLabel *)0, &breakLabel, node->name);
/* Get the value table */
--- 1848,1852 ----
/* Push the switch context information for "break" statements */
! PushLoop(info, (ILLabel *)0, &breakLabel, node->name, 0);
/* Get the value table */
Index: jv_stmt.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/codegen/jv_stmt.tc,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** jv_stmt.tc 28 Dec 2002 17:17:02 -0000 1.19
--- jv_stmt.tc 14 Oct 2003 05:24:17 -0000 1.20
***************
*** 118,122 ****
{
/* Generate code for an infinite loop */
! PushLoop(info, &label1, &label2, node->name);
JavaGenLabel(info, &label1);
if(node->stmt)
--- 118,122 ----
{
/* Generate code for an infinite loop */
! PushLoop(info, &label1, &label2, node->name, 0);
JavaGenLabel(info, &label1);
if(node->stmt)
***************
*** 138,142 ****
{
/* Generate the full case of the "while" loop */
! PushLoop(info, &label2, &label3, node->name);
JavaGenJump(info, JAVA_OP_GOTO, &label2);
JavaGenLabel(info, &label1);
--- 138,142 ----
{
/* Generate the full case of the "while" loop */
! PushLoop(info, &label2, &label3, node->name, 0);
JavaGenJump(info, JAVA_OP_GOTO, &label2);
JavaGenLabel(info, &label1);
***************
*** 166,170 ****
{
/* Generate code for an infinite loop */
! PushLoop(info, &label1, &label2, node->name);
JavaGenLabel(info, &label1);
if(node->stmt)
--- 166,170 ----
{
/* Generate code for an infinite loop */
! PushLoop(info, &label1, &label2, node->name, 0);
JavaGenLabel(info, &label1);
if(node->stmt)
***************
*** 179,183 ****
{
/* Generate code for a single execution of the loop
body */
! PushLoop(info, &label1, &label1, node->name);
JavaGenDiscard(node->stmt, info);
JavaGenLabel(info, &label1);
--- 179,183 ----
{
/* Generate code for a single execution of the loop
body */
! PushLoop(info, &label1, &label1, node->name, 0);
JavaGenDiscard(node->stmt, info);
JavaGenLabel(info, &label1);
***************
*** 194,198 ****
{
/* Generate the full case of the "do" loop */
! PushLoop(info, &label2, &label3, node->name);
JavaGenLabel(info, &label1);
JavaGenDiscard(node->stmt, info);
--- 194,198 ----
{
/* Generate the full case of the "do" loop */
! PushLoop(info, &label2, &label3, node->name, 0);
JavaGenLabel(info, &label1);
JavaGenDiscard(node->stmt, info);
***************
*** 242,246 ****
{
/* Generate code for an infinite loop */
! PushLoop(info, &label2, &label3, node->name);
JavaGenLabel(info, &label1);
if(node->stmt)
--- 242,246 ----
{
/* Generate code for an infinite loop */
! PushLoop(info, &label2, &label3, node->name, 0);
JavaGenLabel(info, &label1);
if(node->stmt)
***************
*** 268,272 ****
{
/* Generate the full case of the "for" loop */
! PushLoop(info, &label2, &label4, node->name);
JavaGenJump(info, JAVA_OP_GOTO, &label3);
JavaGenLabel(info, &label1);
--- 268,272 ----
{
/* Generate the full case of the "for" loop */
! PushLoop(info, &label2, &label4, node->name, 0);
JavaGenJump(info, JAVA_OP_GOTO, &label3);
JavaGenLabel(info, &label1);
***************
*** 321,325 ****
/* Push the loop label information */
! PushLoop(info, &label2, &label4, node->name);
/* Fetch the next array element and put it into the variable */
--- 321,325 ----
/* Push the loop label information */
! PushLoop(info, &label2, &label4, node->name, 0);
/* Fetch the next array element and put it into the variable */
***************
*** 414,418 ****
/* Push the loop label information */
! PushLoop(info, &label2, &label4, node->name);
/* Fetch the next array element and put it into the variable */
--- 414,418 ----
/* Push the loop label information */
! PushLoop(info, &label2, &label4, node->name, 0);
/* Fetch the next array element and put it into the variable */
***************
*** 518,522 ****
/* Push the loop label information */
! PushLoop(info, &label2, &label3, node->name);
/* Fetch the next collection element and put it into the variable */
--- 518,522 ----
/* Push the loop label information */
! PushLoop(info, &label2, &label3, node->name, 1);
/* Fetch the next collection element and put it into the variable */
***************
*** 1239,1243 ****
/* Push the switch context information for "break" statements */
! PushLoop(info, (ILLabel *)0, &breakLabel, node->name);
/* Get the value table */
--- 1239,1243 ----
/* Push the switch context information for "break" statements */
! PushLoop(info, (ILLabel *)0, &breakLabel, node->name, 0);
/* Get the value table */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] pnet/codegen cg_gen.h, 1.41, 1.42 cg_stmt.tc, 1.40, 1.41 jv_stmt.tc, 1.19, 1.20,
Rhys Weatherley <address@hidden> <=