Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/jruby-9.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
headius committed Jun 25, 2024
2 parents fb2b70b + e6b6a4d commit 5456d09
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public void generateInstructionsForInterpretation() {
Instr[] linearizedInstrArray = newInstrs.toArray(new Instr[newInstrs.size()]);

BasicBlock[] basicBlocks = getLinearizedBBList();
rescueIPCs = new int[2 * basicBlocks.length];
int[] rescueIPCs = new int[2 * basicBlocks.length];

// Pass 2: Use ipc info from previous to mark all linearized instrs rpc
ipc = 0;
Expand All @@ -154,7 +154,8 @@ public void generateInstructionsForInterpretation() {
}
}

instructions = linearizedInstrArray;
this.rescueIPCs = rescueIPCs;
this.instructions = linearizedInstrArray;

// System.out.println("SCOPE: " + getScope().getId());
// System.out.println("INSTRS: " + cfg.toStringInstrs());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ public class InterpreterContext {

// startup interp will mark this at construction and not change but full interpreter will write it
// much later after running compiler passes. JIT will not use this field at all.
protected Instr[] instructions;
protected volatile Instr[] instructions;

// Contains pairs of values. The first value is number of instrs in this range + number of instrs before
// this range. The second number is the rescuePC. getRescuePC(ipc) will walk this list and first odd value
// less than this value will be the rpc.
protected int[] rescueIPCs = null;
protected volatile int[] rescueIPCs = null;

// Cached computed fields
protected boolean hasExplicitCallProtocol; // Only can be true in Full+
Expand Down Expand Up @@ -97,7 +97,7 @@ public Instr[] getInstructions() {
return instructions == null ? NO_INSTRUCTIONS : instructions;
}

private void setInstructions(final List<Instr> instructions) {
private synchronized void setInstructions(final List<Instr> instructions) {
this.instructions = instructions != null ? prepareBuildInstructions(instructions) : null;
}

Expand All @@ -112,7 +112,7 @@ private Instr[] prepareBuildInstructions(List<Instr> instructions) {
}

Deque<Integer> markers = new ArrayDeque<>(8);
rescueIPCs = new int[length];
int[] rescueIPCs = new int[length];
int rpc = -1;

for (int ipc = 0; ipc < length; ipc++) {
Expand All @@ -129,6 +129,8 @@ private Instr[] prepareBuildInstructions(List<Instr> instructions) {
rescueIPCs[ipc] = rpc;
}

this.rescueIPCs = rescueIPCs;

return linearizedInstrArray;
}

Expand Down

0 comments on commit 5456d09

Please sign in to comment.