changeset 16406:ed91068c8af5

cleanup in AssertionNode
author Lukas Stadler <lukas.stadler@oracle.com>
date Fri, 04 Jul 2014 16:06:44 +0200
parents 9bfc4247262f
children 9575add7149c
files graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotHostForeignCallsProvider.java graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/AssertionNode.java
diffstat 2 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotHostForeignCallsProvider.java	Fri Jul 04 16:06:44 2014 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotHostForeignCallsProvider.java	Fri Jul 04 16:06:44 2014 +0200
@@ -136,6 +136,10 @@
          */
         registerForeignCall(UNPACK_FRAMES, c.deoptimizationUnpackFrames, NativeCall, DESTROYS_REGISTERS, LEAF, NOT_REEXECUTABLE, ANY_LOCATION);
 
+        /*
+         * This message call is registered twice, where the second one must only be used for calls
+         * that do not return, i.e., that exit the VM.
+         */
         registerForeignCall(VM_MESSAGE_C, c.vmMessageAddress, NativeCall, DESTROYS_REGISTERS, NOT_LEAF, REEXECUTABLE, NO_LOCATIONS);
         registerForeignCall(ASSERTION_VM_MESSAGE_C, c.vmMessageAddress, NativeCall, PRESERVES_REGISTERS, LEAF, REEXECUTABLE, NO_LOCATIONS);
 
--- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/AssertionNode.java	Fri Jul 04 16:06:44 2014 +0200
+++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/AssertionNode.java	Fri Jul 04 16:06:44 2014 +0200
@@ -61,6 +61,10 @@
         if (value.isConstant() && value.asConstant().asInt() != 0) {
             return null;
         }
+        /*
+         * Assertions with a constant "false" value do not immediately cause an error, since they
+         * may be unreachable and could thus be removed by later optimizations.
+         */
         return this;
     }
 
@@ -73,9 +77,9 @@
     public void generate(NodeLIRBuilderTool generator) {
         assert compileTimeAssertion;
         if (value.isConstant() && value.asConstant().asInt() == 0) {
-            throw new GraalInternalError("failed compile-time assertion: %s", message);
+            throw new GraalInternalError("%s: failed compile-time assertion: %s", this, message);
         } else {
-            throw new GraalInternalError("failed compile-time assertion (value %s): %s", value, message);
+            throw new GraalInternalError("%s: failed compile-time assertion (value %s): %s", this, value, message);
         }
     }