# HG changeset patch # User Doug Simon # Date 1348757881 -7200 # Node ID c4d21bd7653b47db047bb5a3361b07a18ed0f4d4 # Parent 5a2c5d93f5c8b02674d37bdae489c5512d96950d made position calculation for VMErrorNode more robust when debug info is not available diff -r 5a2c5d93f5c8 -r c4d21bd7653b graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/LIRGenerator.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/LIRGenerator.java Thu Sep 27 16:56:50 2012 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/LIRGenerator.java Thu Sep 27 16:58:01 2012 +0200 @@ -127,6 +127,10 @@ return target; } + public ResolvedJavaMethod method() { + return method; + } + /** * Returns the operand that has been previously initialized by {@link #setResult(ValueNode, Value)} * with the result of an instruction. diff -r 5a2c5d93f5c8 -r c4d21bd7653b graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/VMErrorNode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/VMErrorNode.java Thu Sep 27 16:56:50 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/VMErrorNode.java Thu Sep 27 16:58:01 2012 +0200 @@ -51,11 +51,17 @@ @Override public void generate(LIRGenerator gen) { long vmErrorStub = HotSpotGraalRuntime.getInstance().getConfig().vmErrorStub; - LIRFrameState state = gen.state(); - BytecodePosition pos = state.topFrame; - String where = CodeUtil.append(new StringBuilder(100), pos).toString(); + String where; + try { + LIRFrameState state = gen.state(); + BytecodePosition pos = state.topFrame; + where = "near or " + CodeUtil.append(new StringBuilder(100), pos).toString().replace(CodeUtil.NEW_LINE, CodeUtil.NEW_LINE + "\t"); + } catch (Throwable t) { + // Report a less accurate location when debug info cannot be obtained + where = "in compiled code for " + MetaUtil.format("%H.%n(%p)", gen.method()); + } Kind[] signature = new Kind[] {Kind.Object, Kind.Object, Kind.Long}; - gen.emitCall(vmErrorStub, Kind.Void, signature, true, Constant.forObject(where), gen.operand(format), gen.operand(value)); + gen.emitCall(vmErrorStub, Kind.Void, signature, false, Constant.forObject(where), gen.operand(format), gen.operand(value)); } @SuppressWarnings("unused")