# HG changeset patch # User Tom Rodriguez # Date 1392143817 28800 # Node ID f191cac0460597fc76e8a35f945db9e7edf918c6 # Parent 6be4edba54ba8861fb38b0adcd101e9a6d0e48a5 add assert to check format of debug info diff -r 6be4edba54ba -r f191cac04605 graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/BytecodeFrame.java --- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/BytecodeFrame.java Tue Feb 11 08:47:18 2014 -0800 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/BytecodeFrame.java Tue Feb 11 10:36:57 2014 -0800 @@ -116,6 +116,26 @@ this.numStack = numStack; this.numLocks = numLocks; assert !rethrowException || numStack == 1 : "must have exception on top of the stack"; + assert validateFormat(); + } + + /** + * Ensure that the frame state is formatted as expected by the JVM, with null or Illegal in the + * slot following a double word item. This should really be checked in FrameState itself but + * because of Word type rewriting that can't be done. If a frame makes it into this code, then + * could be materialized by the JVM so it must follow the rules. it + */ + private boolean validateFormat() { + for (int i = 0; i < numLocals + numStack; i++) { + if (values[i] != null) { + Kind kind = values[i].getKind(); + if (kind == Kind.Long || kind == Kind.Double) { + assert values.length > i + 1 : String.format("missing second word %s", this); + assert values[i + 1] == null || values[i + 1].getKind() == Kind.Illegal; + } + } + } + return true; } /**