@@ -154,6 +154,7 @@ public static void processMembrane(Membrane mem) {
154154 InterpretedRuleset ruleset = new InterpretedRuleset ();
155155 // guard or 用に and のみを含むように分割したルールを合成する
156156 // -O3 前提
157+ int maxlocals = 0 ;
157158 for (int itr = 0 ; itr < mem .or_pairs .size (); itr ++) {
158159 LinkedList <Integer > pair = (LinkedList ) mem .or_pairs .get (itr );
159160 if (pair .size () > 1 ) { // guard or を含む場合
@@ -162,6 +163,9 @@ public static void processMembrane(Membrane mem) {
162163 notAdd .add (pair .get (i ));
163164 InstructionList orlist = new InstructionList ();
164165 orlist .insts = InstructionList .cloneInstructions (rules .get (pair .get (i )).memMatch );
166+ if (orlist .insts .get (0 ).getIntArg2 () > maxlocals ){
167+ maxlocals = orlist .insts .get (0 ).getIntArg2 ();
168+ }
165169 for (Instruction instr : rules .get (pair .get (i )).memMatch ) {
166170 if (instr .getKind () == Instruction .ORDUMMY ) { // ordummy 以降の命令をすべて branch で囲む
167171 orlist .insts .remove (0 );
@@ -174,6 +178,11 @@ public static void processMembrane(Membrane mem) {
174178 }
175179 // ordummy を guard or を表す branch 命令の列に置き換える
176180 List <Instruction > replace = rules .get (pair .get (0 )).memMatch ;
181+ Instruction spec = replace .get (0 );
182+ if (spec .getIntArg2 () > maxlocals ){
183+ maxlocals = spec .getIntArg2 ();
184+ }
185+ spec .updateSpec (spec .getIntArg1 (), maxlocals );
177186 for (int i = 0 ; i < replace .size (); i ++) {
178187 if (replace .get (i ).getKind () == Instruction .ORDUMMY ) {
179188 replace .addAll (i + 1 , orlists .insts );
0 commit comments