Skip to content

Commit

Permalink
Remove variable push replacements optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
bengt-GS committed Nov 20, 2024
1 parent 7b6712e commit 844f3d7
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ public class EvaluationSimplifier
implements AttributeVisitor,
InstructionVisitor
{
private static final int POS_ZERO_FLOAT_BITS = Float.floatToIntBits(0.0f);
private static final long POS_ZERO_DOUBLE_BITS = Double.doubleToLongBits(0.0);
private static final boolean ENABLE_LOWER_SLOT_REPLACEMENT = System.getProperty("optimization.enable.slot.replacement") != null;
private static final int POS_ZERO_FLOAT_BITS = Float.floatToIntBits(0.0f);
private static final long POS_ZERO_DOUBLE_BITS = Double.doubleToLongBits(0.0);

private static final Logger logger = LogManager.getLogger(EvaluationSimplifier.class);

Expand All @@ -58,7 +59,7 @@ public class EvaluationSimplifier

private final PartialEvaluator partialEvaluator;
private final SideEffectInstructionChecker sideEffectInstructionChecker;
private final CodeAttributeEditor codeAttributeEditor = new CodeAttributeEditor(true, true);
private final CodeAttributeEditor codeAttributeEditor = new CodeAttributeEditor(true, true);


/**
Expand Down Expand Up @@ -692,7 +693,7 @@ private void replaceIntegerPushInstruction(Clazz clazz,
replaceInstruction(clazz, offset, instruction, replacementInstruction);
}
}
else if (pushedValue.isSpecific())
else if (ENABLE_LOWER_SLOT_REPLACEMENT && pushedValue.isSpecific())
{
// Load an equivalent lower-numbered variable instead, if any.
TracedVariables variables = partialEvaluator.getVariablesBefore(offset);
Expand Down Expand Up @@ -762,7 +763,7 @@ private void replaceLongPushInstruction(Clazz clazz,
replaceInstruction(clazz, offset, instruction, replacementInstruction);
}
}
else if (pushedValue.isSpecific())
else if (ENABLE_LOWER_SLOT_REPLACEMENT && pushedValue.isSpecific())
{
// Load an equivalent lower-numbered variable instead, if any.
TracedVariables variables = partialEvaluator.getVariablesBefore(offset);
Expand Down Expand Up @@ -836,7 +837,7 @@ private void replaceFloatPushInstruction(Clazz clazz,
replaceInstruction(clazz, offset, instruction, replacementInstruction);
}
}
else if (pushedValue.isSpecific())
else if (ENABLE_LOWER_SLOT_REPLACEMENT && pushedValue.isSpecific())
{
// Load an equivalent lower-numbered variable instead, if any.
TracedVariables variables = partialEvaluator.getVariablesBefore(offset);
Expand Down Expand Up @@ -906,7 +907,7 @@ private void replaceDoublePushInstruction(Clazz clazz,
replaceInstruction(clazz, offset, instruction, replacementInstruction);
}
}
else if (pushedValue.isSpecific())
else if (ENABLE_LOWER_SLOT_REPLACEMENT && pushedValue.isSpecific())
{
// Load an equivalent lower-numbered variable instead, if any.
TracedVariables variables = partialEvaluator.getVariablesBefore(offset);
Expand Down

0 comments on commit 844f3d7

Please sign in to comment.