346 compiler.clearBytecode();
347
348 for (final CompileUnit oldUnit : compiler.getCompileUnits()) {
349 assert map.get(oldUnit) == null;
350 final CompileUnit newUnit = createNewCompileUnit(compiler, phases);
351 log.fine("Creating new compile unit ", oldUnit, " => ", newUnit);
352 map.put(oldUnit, newUnit);
353 assert newUnit != null;
354 newUnits.add(newUnit);
355 }
356
357 log.fine("Replacing compile units in Compiler...");
358 compiler.replaceCompileUnits(newUnits);
359 log.fine("Done");
360
361 //replace old compile units in function nodes, if any are assigned,
362 //for example by running the splitter on this function node in a previous
363 //partial code generation
364 final FunctionNode newFunctionNode = transformFunction(fn, new ReplaceCompileUnits() {
365 @Override
366 CompileUnit getReplacement(CompileUnit original) {
367 return map.get(original);
368 }
369
370 @Override
371 public Node leaveDefault(final Node node) {
372 return node.ensureUniqueLabels(lc);
373 }
374 });
375
376 return newFunctionNode;
377 }
378
379 @Override
380 public String toString() {
381 return "'Reuse Compile Units'";
382 }
383 },
384
385 REINITIALIZE_SERIALIZED(
386 EnumSet.of(
|
346 compiler.clearBytecode();
347
348 for (final CompileUnit oldUnit : compiler.getCompileUnits()) {
349 assert map.get(oldUnit) == null;
350 final CompileUnit newUnit = createNewCompileUnit(compiler, phases);
351 log.fine("Creating new compile unit ", oldUnit, " => ", newUnit);
352 map.put(oldUnit, newUnit);
353 assert newUnit != null;
354 newUnits.add(newUnit);
355 }
356
357 log.fine("Replacing compile units in Compiler...");
358 compiler.replaceCompileUnits(newUnits);
359 log.fine("Done");
360
361 //replace old compile units in function nodes, if any are assigned,
362 //for example by running the splitter on this function node in a previous
363 //partial code generation
364 final FunctionNode newFunctionNode = transformFunction(fn, new ReplaceCompileUnits() {
365 @Override
366 CompileUnit getReplacement(final CompileUnit original) {
367 return map.get(original);
368 }
369
370 @Override
371 public Node leaveDefault(final Node node) {
372 return node.ensureUniqueLabels(lc);
373 }
374 });
375
376 return newFunctionNode;
377 }
378
379 @Override
380 public String toString() {
381 return "'Reuse Compile Units'";
382 }
383 },
384
385 REINITIALIZE_SERIALIZED(
386 EnumSet.of(
|