changeset 9594:743326387173

replaced vm_error assembler stub with compiled stub (GRAAL-81)
author Doug Simon <doug.simon@oracle.com>
date Tue, 07 May 2013 01:38:07 +0200
parents a3b4bcc22313
children db2125285960
files graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotRuntime.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/VMErrorStub.java src/cpu/x86/vm/graalRuntime_x86.cpp src/share/vm/graal/graalCompilerToVM.cpp src/share/vm/graal/graalRuntime.hpp
diffstat 7 files changed, 79 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotRuntime.java	Tue May 07 00:20:25 2013 +0200
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotRuntime.java	Tue May 07 01:38:07 2013 +0200
@@ -24,7 +24,6 @@
 
 import static com.oracle.graal.amd64.AMD64.*;
 import static com.oracle.graal.hotspot.HotSpotBackend.*;
-import static com.oracle.graal.hotspot.nodes.VMErrorNode.*;
 import static com.oracle.graal.hotspot.nodes.WriteBarrierPostStubCall.*;
 import static com.oracle.graal.hotspot.nodes.WriteBarrierPreStubCall.*;
 import static com.oracle.graal.hotspot.replacements.AESCryptSubstitutions.DecryptBlockStubCall.*;
@@ -72,13 +71,6 @@
                 /*          ret */ ret(Kind.Void),
                 /* arg0: object */ javaCallingConvention(Kind.Object, word));
 
-        addRuntimeCall(VM_ERROR, config.vmErrorStub,
-                /*        temps */ null,
-                /*          ret */ ret(Kind.Void),
-                /* arg0:  where */ javaCallingConvention(Kind.Object,
-                /* arg1: format */                       Kind.Object,
-                /* arg2:  value */                       Kind.Long));
-
         addRuntimeCall(ENCRYPT_BLOCK, config.aescryptEncryptBlockStub,
                 /*        temps */ null,
                 /*          ret */ ret(Kind.Void),
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java	Tue May 07 00:20:25 2013 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java	Tue May 07 01:38:07 2013 +0200
@@ -372,7 +372,6 @@
     public long wbPreCallStub;
     public long wbPostCallStub;
 
-    public long vmErrorStub;
     public long uncommonTrapStub;
     public long unwindExceptionStub;
     public long javaTimeMillisStub;
@@ -403,6 +402,7 @@
     public long logPrimitiveAddress;
     public long logObjectAddress;
     public long logPrintfAddress;
+    public long vmErrorAddress;
 
     public int deoptReasonNullCheck;
     public int deoptReasonRangeCheck;
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java	Tue May 07 00:20:25 2013 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java	Tue May 07 01:38:07 2013 +0200
@@ -37,6 +37,7 @@
 import static com.oracle.graal.hotspot.nodes.NewInstanceStubCall.*;
 import static com.oracle.graal.hotspot.nodes.NewMultiArrayStubCall.*;
 import static com.oracle.graal.hotspot.nodes.ThreadIsInterruptedStubCall.*;
+import static com.oracle.graal.hotspot.nodes.VMErrorNode.*;
 import static com.oracle.graal.hotspot.nodes.VerifyOopStubCall.*;
 import static com.oracle.graal.hotspot.replacements.SystemSubstitutions.*;
 import static com.oracle.graal.hotspot.stubs.CreateNullPointerExceptionStub.*;
@@ -51,9 +52,11 @@
 import static com.oracle.graal.hotspot.stubs.NewArrayStub.*;
 import static com.oracle.graal.hotspot.stubs.NewInstanceStub.*;
 import static com.oracle.graal.hotspot.stubs.NewMultiArrayStub.*;
+import static com.oracle.graal.hotspot.stubs.OSRMigrationEndStub.*;
 import static com.oracle.graal.hotspot.stubs.RegisterFinalizerStub.*;
 import static com.oracle.graal.hotspot.stubs.ThreadIsInterruptedStub.*;
 import static com.oracle.graal.hotspot.stubs.UnwindExceptionToCallerStub.*;
+import static com.oracle.graal.hotspot.stubs.VMErrorStub.*;
 import static com.oracle.graal.java.GraphBuilderPhase.RuntimeCalls.*;
 import static com.oracle.graal.nodes.java.RegisterFinalizerNode.*;
 import static com.oracle.graal.replacements.Log.*;
@@ -235,7 +238,7 @@
                         /*             ret */ ret(Kind.Void),
                         /* arg0:    buffer */ javaCallingConvention(word));
 
-        addCRuntimeCall(OSRMigrationEndStub.OSR_MIGRATION_END_C, config.osrMigrationEndAddress,
+        addCRuntimeCall(OSR_MIGRATION_END_C, config.osrMigrationEndAddress,
                         /*             ret */ ret(Kind.Void),
                         /* arg0:    buffer */ nativeCallingConvention(word));
 
@@ -433,6 +436,19 @@
                         /*          ret */ ret(Kind.Void),
                         /* arg0: thread */ nativeCallingConvention(word,
                         /* arg1:  index */                         Kind.Int));
+
+        addStubCall(VM_ERROR,
+                        /*          ret */ ret(Kind.Void),
+                        /* arg0:  where */ javaCallingConvention(Kind.Object,
+                        /* arg1: format */                       Kind.Object,
+                        /* arg2:  value */                       Kind.Long));
+
+        addCRuntimeCall(VM_ERROR_C, config.vmErrorAddress,
+                        /*          ret */ ret(Kind.Void),
+                        /* arg0: thread */ nativeCallingConvention(word,
+                        /* arg0:  where */                         Kind.Object,
+                        /* arg1: format */                         Kind.Object,
+                        /* arg2:  value */                         Kind.Long));
         // @formatter:on
     }
 
@@ -558,9 +574,10 @@
         registerStub(new MonitorExitStub(this, replacements, graalRuntime.getTarget(), runtimeCalls.get(MONITOREXIT)));
         registerStub(new CreateNullPointerExceptionStub(this, replacements, graalRuntime.getTarget(), runtimeCalls.get(CREATE_NULL_POINTER_EXCEPTION)));
         registerStub(new CreateOutOfBoundsExceptionStub(this, replacements, graalRuntime.getTarget(), runtimeCalls.get(CREATE_OUT_OF_BOUNDS_EXCEPTION)));
-        registerStub(new LogPrimitiveStub(this, replacements, graalRuntime.getTarget(), runtimeCalls.get(Log.LOG_PRIMITIVE)));
-        registerStub(new LogObjectStub(this, replacements, graalRuntime.getTarget(), runtimeCalls.get(Log.LOG_OBJECT)));
-        registerStub(new LogPrintfStub(this, replacements, graalRuntime.getTarget(), runtimeCalls.get(Log.LOG_PRINTF)));
+        registerStub(new LogPrimitiveStub(this, replacements, graalRuntime.getTarget(), runtimeCalls.get(LOG_PRIMITIVE)));
+        registerStub(new LogObjectStub(this, replacements, graalRuntime.getTarget(), runtimeCalls.get(LOG_OBJECT)));
+        registerStub(new LogPrintfStub(this, replacements, graalRuntime.getTarget(), runtimeCalls.get(LOG_PRINTF)));
+        registerStub(new VMErrorStub(this, replacements, graalRuntime.getTarget(), runtimeCalls.get(VM_ERROR)));
     }
 
     private void registerStub(Stub stub) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/VMErrorStub.java	Tue May 07 01:38:07 2013 +0200
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.graal.hotspot.stubs;
+
+import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*;
+
+import com.oracle.graal.api.code.RuntimeCallTarget.Descriptor;
+import com.oracle.graal.api.code.*;
+import com.oracle.graal.graph.Node.ConstantNodeParameter;
+import com.oracle.graal.graph.Node.NodeIntrinsic;
+import com.oracle.graal.hotspot.*;
+import com.oracle.graal.hotspot.meta.*;
+import com.oracle.graal.hotspot.nodes.*;
+import com.oracle.graal.nodes.spi.*;
+import com.oracle.graal.replacements.*;
+import com.oracle.graal.word.*;
+
+/**
+ * Stub called from {@link VMErrorNode}.
+ */
+public class VMErrorStub extends CRuntimeStub {
+
+    public VMErrorStub(final HotSpotRuntime runtime, Replacements replacements, TargetDescription target, HotSpotRuntimeCallTarget linkage) {
+        super(runtime, replacements, target, linkage);
+    }
+
+    @Snippet
+    private static void vmError(String where, String format, long value) {
+        vmErrorC(VM_ERROR_C, thread(), where, format, value);
+    }
+
+    public static final Descriptor VM_ERROR_C = descriptorFor(VMErrorStub.class, "vmErrorC", false);
+
+    @NodeIntrinsic(CRuntimeCall.class)
+    public static native void vmErrorC(@ConstantNodeParameter Descriptor vmErrorC, Word thread, String where, String format, long value);
+}
--- a/src/cpu/x86/vm/graalRuntime_x86.cpp	Tue May 07 00:20:25 2013 +0200
+++ b/src/cpu/x86/vm/graalRuntime_x86.cpp	Tue May 07 01:38:07 2013 +0200
@@ -588,18 +588,6 @@
   OopMapSet* oop_maps = NULL;
   switch (id) {
 
-    case vm_error_id: {
-      __ enter();
-      oop_maps = new OopMapSet();
-      OopMap* oop_map = save_live_registers(sasm, 3);
-      int call_offset = __ call_RT(noreg, noreg, (address)vm_error, j_rarg0, j_rarg1, j_rarg2);
-      oop_maps->add_gc_map(call_offset, oop_map);
-      restore_live_registers(sasm);
-      __ leave();
-      __ ret(0);
-      break;
-    }
-
    case wb_pre_call_id: {
       Register obj = j_rarg0;
       {
--- a/src/share/vm/graal/graalCompilerToVM.cpp	Tue May 07 00:20:25 2013 +0200
+++ b/src/share/vm/graal/graalCompilerToVM.cpp	Tue May 07 01:38:07 2013 +0200
@@ -762,7 +762,6 @@
 
   set_address("inlineCacheMissStub", SharedRuntime::get_ic_miss_stub());
   set_address("handleDeoptStub", SharedRuntime::deopt_blob()->unpack());
-  set_address("vmErrorStub", GraalRuntime::entry_for(GraalRuntime::vm_error_id));
   set_address("javaTimeMillisStub", CAST_FROM_FN_PTR(address, os::javaTimeMillis));
   set_address("javaTimeNanosStub", CAST_FROM_FN_PTR(address, os::javaTimeNanos));
   set_address("arithmeticSinStub", CAST_FROM_FN_PTR(address, SharedRuntime::dsin));
@@ -791,6 +790,7 @@
   set_address("logPrimitiveAddress", GraalRuntime::log_primitive);
   set_address("logObjectAddress", GraalRuntime::log_object);
   set_address("logPrintfAddress", GraalRuntime::log_printf);
+  set_address("vmErrorAddress", GraalRuntime::vm_error);
 
   set_int("deoptReasonNone", Deoptimization::Reason_none);
   set_int("deoptReasonNullCheck", Deoptimization::Reason_null_check);
--- a/src/share/vm/graal/graalRuntime.hpp	Tue May 07 00:20:25 2013 +0200
+++ b/src/share/vm/graal/graalRuntime.hpp	Tue May 07 01:38:07 2013 +0200
@@ -78,7 +78,6 @@
 // runtime routines needed by code code generated
 // by Graal.
 #define GRAAL_STUBS(stub, last_entry) \
-  stub(vm_error)                \
   stub(wb_pre_call)             \
   stub(wb_post_call)             \
  last_entry(number_of_ids)