Skip to content

Commit 64a6743

Browse files
committed
Use explicit constants for source table patch indicators.
1 parent c7df2b1 commit 64a6743

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

truffle/src/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/bytecode/generator/BytecodeRootNodeElement.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2596,6 +2596,10 @@ void lazyInit() {
25962596

25972597
this.add(createDoEmitFinallyHandler());
25982598
this.add(createDoCreateExceptionHandler());
2599+
2600+
this.add(new CodeVariableElement(Set.of(PRIVATE, STATIC, FINAL), type(int.class), "PATCH_CURRENT_SOURCE")).createInitBuilder().string("-2");
2601+
this.add(new CodeVariableElement(Set.of(PRIVATE, STATIC, FINAL), type(int.class), "PATCH_NODE_SOURCE")).createInitBuilder().string("-3");
2602+
25992603
this.add(createDoPatchSourceInfo());
26002604
this.add(createDoEmitSourceInfo());
26012605
this.add(createFinish());
@@ -6979,7 +6983,7 @@ private CodeExecutableElement createDoPatchSourceInfo() {
69796983

69806984
b.declaration(type(int.class), "oldStart", "info[index + SOURCE_INFO_OFFSET_START]");
69816985
b.declaration(type(int.class), "oldEnd", "info[index + SOURCE_INFO_OFFSET_LENGTH]");
6982-
b.statement("assert nodeId >= 0 ? oldEnd == -3 : oldEnd == -2");
6986+
b.statement("assert nodeId >= 0 ? oldEnd == PATCH_NODE_SOURCE : oldEnd == PATCH_CURRENT_SOURCE");
69836987
b.statement("info[index + SOURCE_INFO_OFFSET_START] = start");
69846988
b.statement("info[index + SOURCE_INFO_OFFSET_LENGTH] = length");
69856989
b.statement("index = oldStart");
@@ -7299,7 +7303,7 @@ private CodeExecutableElement createDoEmitRootSourceSection() {
72997303
b.string("0");
73007304
b.string("bci");
73017305
b.string("operationData.start");
7302-
b.string("-3");
7306+
b.string("PATCH_NODE_SOURCE");
73037307
b.end(2);
73047308
b.statement("return");
73057309
b.end();
@@ -7538,7 +7542,7 @@ private void emitUnwindBeforeEarlyExit(CodeTreeBuilder b, OperationKind operatio
75387542
b.string("operationData.startBci");
75397543
b.string("bci");
75407544
b.string("operationData.start");
7541-
b.string("-2");
7545+
b.string("PATCH_CURRENT_SOURCE");
75427546
b.end(2);
75437547
b.statement("needsRewind = true");
75447548
b.statement("break");

0 commit comments

Comments
 (0)