# HG changeset patch # User Tom Rodriguez # Date 1392751008 28800 # Node ID bbf84e85b775ebe94f9a03bd8af76f2efcb7e3bf # Parent fe034af88233b9cafd75f4ebeb2843352ae2004e Move BytecodeFrame validation into the HotSpot backend diff -r fe034af88233 -r bbf84e85b775 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 18 10:47:13 2014 -0800 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/BytecodeFrame.java Tue Feb 18 11:16:48 2014 -0800 @@ -116,16 +116,14 @@ 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 + * because of Word type rewriting and alternative backends that can't be done. */ - private boolean validateFormat() { + public boolean validateFormat() { for (int i = 0; i < numLocals + numStack; i++) { if (values[i] != null) { Kind kind = values[i].getKind(); diff -r fe034af88233 -r bbf84e85b775 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotCompiledCode.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotCompiledCode.java Tue Feb 18 10:47:13 2014 -0800 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotCompiledCode.java Tue Feb 18 11:16:48 2014 -0800 @@ -31,6 +31,7 @@ import com.oracle.graal.api.code.CompilationResult.Data; import com.oracle.graal.api.code.CompilationResult.DataPatch; import com.oracle.graal.api.code.CompilationResult.ExceptionHandler; +import com.oracle.graal.api.code.CompilationResult.Infopoint; import com.oracle.graal.api.code.CompilationResult.JumpTable; import com.oracle.graal.api.code.CompilationResult.Mark; import com.oracle.graal.api.code.CompilationResult.Site; @@ -195,6 +196,24 @@ comments[i] = new Comment(annotation.position, text); } } + assert validateFrames(); + } + + /** + * Ensure that all the frames passed into HotSpot are properly formatted with an empty or + * illegal slot following double word slots. + */ + private boolean validateFrames() { + for (Site site : sites) { + if (site instanceof Infopoint) { + Infopoint info = (Infopoint) site; + if (info.debugInfo != null) { + BytecodeFrame frame = info.debugInfo.frame(); + assert frame == null || frame.validateFormat(); + } + } + } + return true; } static class SiteComparator implements Comparator {