# HG changeset patch # User Bernhard Urban # Date 1371484209 -7200 # Node ID e8fbc5fd3440f89f72b61600298124744468a3b9 # Parent 1397c3e1f642a1c789bf3f50dfa90a7009bb337e aot: add/fix some javadoc diff -r 1397c3e1f642 -r e8fbc5fd3440 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaField.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaField.java Mon Jun 17 17:07:49 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaField.java Mon Jun 17 17:50:09 2013 +0200 @@ -81,7 +81,7 @@ } /** - * if the compiler is configured for AOT mode, {@link #readConstantValue(Constant)} should be + * If the compiler is configured for AOT mode, {@link #readConstantValue(Constant)} should be * only called for snippets or replacements. */ private static boolean isCalledForSnippets() { diff -r 1397c3e1f642 -r e8fbc5fd3440 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/AheadOfTimeVerifcationPhase.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/AheadOfTimeVerifcationPhase.java Mon Jun 17 17:07:49 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/AheadOfTimeVerifcationPhase.java Mon Jun 17 17:50:09 2013 +0200 @@ -26,12 +26,18 @@ import com.oracle.graal.nodes.*; import com.oracle.graal.phases.*; +/** + * Checking for embedded oops in the graph. (Interned) Strings are an exception as they live in CDS + * space. + * + * @see LoadJavaMirrorWithKlassPhase + */ public class AheadOfTimeVerifcationPhase extends VerifyPhase { @Override protected boolean verify(StructuredGraph graph) { for (ConstantNode node : graph.getNodes().filter(ConstantNode.class)) { - assert !isOop(node) || isNullReference(node) || isString(node) : "embedded oop: " + node + ". toString: " + node.asConstant().asObject(); + assert !isOop(node) || isNullReference(node) || isString(node) : "embedded oop: " + node; } return true; } diff -r 1397c3e1f642 -r e8fbc5fd3440 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/LoadJavaMirrorWithKlassPhase.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/LoadJavaMirrorWithKlassPhase.java Mon Jun 17 17:07:49 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/LoadJavaMirrorWithKlassPhase.java Mon Jun 17 17:50:09 2013 +0200 @@ -32,6 +32,15 @@ import com.oracle.graal.phases.*; import com.oracle.graal.phases.tiers.*; +/** + * For AOT compilation we aren't allowed to use a class reference (javaMirror) directly. Instead the + * class reference should be obtained from the klass object. The reason for this is, that in CDS a + * klass object is mapped to a fixed address in memory, but the javaMirror is not (which lives in + * the java heap). + * + * Lowering can introduce new ConstantNodes containing a class reference, thus this phase must be + * applied after lowering. + */ public class LoadJavaMirrorWithKlassPhase extends BasePhase { @Override diff -r 1397c3e1f642 -r e8fbc5fd3440 graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/BoxingSnippets.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/BoxingSnippets.java Mon Jun 17 17:07:49 2013 +0200 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/BoxingSnippets.java Mon Jun 17 17:50:09 2013 +0200 @@ -215,6 +215,7 @@ public void lower(BoxNode box) { FloatingNode canonical = canonicalizeBoxing(box, runtime); + // if in AOT mode, we don't want to embed boxed constants. if (!AOTCompilation.getValue() && canonical != null) { box.graph().replaceFixedWithFloating(box, canonical); } else {