< prev index next >
src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/gen/NodeLIRBuilder.java
Print this page
rev 52509 : [mq]: graal
*** 25,34 ****
--- 25,36 ----
package org.graalvm.compiler.core.gen;
import static jdk.vm.ci.code.ValueUtil.asRegister;
import static jdk.vm.ci.code.ValueUtil.isLegal;
import static jdk.vm.ci.code.ValueUtil.isRegister;
+ import static org.graalvm.compiler.core.common.SpeculativeExecutionAttacksMitigations.AllTargets;
+ import static org.graalvm.compiler.core.common.SpeculativeExecutionAttacksMitigations.Options.MitigateSpeculativeExecutionAttacks;
import static org.graalvm.compiler.core.common.GraalOptions.MatchExpressions;
import static org.graalvm.compiler.debug.DebugOptions.LogVerbose;
import static org.graalvm.compiler.lir.LIR.verifyBlock;
import java.util.ArrayList;
*** 310,319 ****
--- 312,334 ----
return values.toArray(new Value[values.size()]);
}
public void doBlockPrologue(@SuppressWarnings("unused") Block block, @SuppressWarnings("unused") OptionValues options) {
+ if (MitigateSpeculativeExecutionAttacks.getValue(options) == AllTargets) {
+ boolean hasControlSplitPredecessor = false;
+ for (Block b : block.getPredecessors()) {
+ if (b.getSuccessorCount() > 1) {
+ hasControlSplitPredecessor = true;
+ break;
+ }
+ }
+ boolean isStartBlock = block.getPredecessorCount() == 0;
+ if (hasControlSplitPredecessor || isStartBlock) {
+ getLIRGeneratorTool().emitSpeculationFence();
+ }
+ }
}
@Override
@SuppressWarnings("try")
public void doBlock(Block block, StructuredGraph graph, BlockMap<List<Node>> blockMap) {
*** 370,379 ****
--- 385,396 ----
} else if (ComplexMatchValue.INTERIOR_MATCH.equals(operand)) {
// Doesn't need to be evaluated
debug.log("interior match for %s", valueNode);
} else if (operand instanceof ComplexMatchValue) {
debug.log("complex match for %s", valueNode);
+ // Set current position to the position of the root matched node.
+ setSourcePosition(node.getNodeSourcePosition());
ComplexMatchValue match = (ComplexMatchValue) operand;
operand = match.evaluate(this);
if (operand != null) {
setResult(valueNode, operand);
}
< prev index next >