Bladeren bron

2006-04-03 Zoltan Varga <[email protected]>

	* output.c skeleton skeleton.cs: Initialize the jay debug tables
	lazily. Fixes #77946.

svn path=/trunk/mcs/; revision=58937
Zoltan Varga 20 jaren geleden
bovenliggende
commit
d47a6bf4ae
4 gewijzigde bestanden met toevoegingen van 14 en 2 verwijderingen
  1. 5 0
      mcs/jay/ChangeLog
  2. 7 0
      mcs/jay/output.c
  3. 1 1
      mcs/jay/skeleton
  4. 1 1
      mcs/jay/skeleton.cs

+ 5 - 0
mcs/jay/ChangeLog

@@ -1,3 +1,8 @@
+2006-04-03  Zoltan Varga  <[email protected]>
+
+	* output.c skeleton skeleton.cs: Initialize the jay debug tables
+	lazily. Fixes #77946.
+
 2006-03-10  Zoltan Varga  <[email protected]>
 
 	* reader.c (copy_action): Applied patch from Axel T Schreiner ([email protected]).

+ 7 - 0
mcs/jay/output.c

@@ -854,6 +854,9 @@ output_debug()
     printf("  protected static %s int yyFinal = %d;\n", csharp ? "" : "final", final_state);
 
       ++outline;
+	  printf ("%s // Put this array into a separate class so it is only initialized if debugging is actually used\n", prefix);
+	  printf ("%s // Use MarshalByRefObject to disable inlining\n", prefix);
+	  printf("%s class YYRules %s {\n", prefix, csharp ? ": MarshalByRefObject" : "");
       printf("%s  public static %s string [] yyRule = {\n", prefix, csharp ? "" : "final");
       for (i = 2; i < nrules; ++i)
       {
@@ -905,6 +908,10 @@ output_debug()
       }
       ++ outline;
       printf("%s  };\n", prefix);
+	  printf ("%s public static string getRule (int index) {\n", prefix);
+	  printf ("%s    return yyRule [index];\n", prefix);
+	  printf ("%s }\n", prefix);
+	  printf ("%s}\n", prefix);
 
     max = 0;
     for (i = 2; i < ntokens; ++i)

+ 1 - 1
mcs/jay/skeleton

@@ -228,7 +228,7 @@ t  							yyLex.value());
 .        }
 .        int yyV = yyTop + 1-yyLen[yyN];
 t        if (yydebug != null)
-t          yydebug.reduce(yyState, yyStates[yyV-1], yyN, yyRule[yyN], yyLen[yyN]);
+t          yydebug.reduce(yyState, yyStates[yyV-1], yyN, YYRules.getRule[yyN], yyLen[yyN]);
 .        yyVal = yyDefault(yyV > yyTop ? null : yyVals[yyV]);
 .        switch (yyN) {
 

+ 1 - 1
mcs/jay/skeleton.cs

@@ -210,7 +210,7 @@ t  							yyLex.value());
 .        }
 .        int yyV = yyTop + 1-yyLen[yyN];
 t        if (debug != null)
-t          debug.reduce(yyState, yyStates[yyV-1], yyN, yyRule[yyN], yyLen[yyN]);
+t          debug.reduce(yyState, yyStates[yyV-1], yyN, YYRules.getRule (yyN), yyLen[yyN]);
 .        yyVal = yyDefault(yyV > yyTop ? null : yyVals[yyV]);
 .        switch (yyN) {