changeset 9751:ff9829c21f21

replaced OSRMigrationEndStub with use of ForeignCallStub
author Doug Simon <doug.simon@oracle.com>
date Thu, 16 May 2013 22:30:52 +0200
parents 23a047fba2df
children 82689c1c0dab
files graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/OSRMigrationEndStub.java
diffstat 2 files changed, 18 insertions(+), 76 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java	Thu May 16 21:46:15 2013 +0200
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java	Thu May 16 22:30:52 2013 +0200
@@ -45,7 +45,6 @@
 import static com.oracle.graal.hotspot.stubs.ExceptionHandlerStub.*;
 import static com.oracle.graal.hotspot.stubs.NewArrayStub.*;
 import static com.oracle.graal.hotspot.stubs.NewInstanceStub.*;
-import static com.oracle.graal.hotspot.stubs.OSRMigrationEndStub.*;
 import static com.oracle.graal.hotspot.stubs.StubUtil.*;
 import static com.oracle.graal.hotspot.stubs.UnwindExceptionToCallerStub.*;
 import static com.oracle.graal.hotspot.stubs.VMErrorStub.*;
@@ -206,14 +205,14 @@
     protected abstract RegisterConfig createRegisterConfig();
 
     public void registerReplacements(Replacements replacements) {
+        HotSpotVMConfig c = config;
+
         registerStubCall(VERIFY_OOP);
-        registerStubCall(OSR_MIGRATION_END);
         registerStubCall(NEW_ARRAY);
         registerStubCall(UNWIND_EXCEPTION_TO_CALLER);
         registerStubCall(NEW_INSTANCE);
         registerStubCall(VM_ERROR);
 
-        HotSpotVMConfig c = config;
         registerForeignCall(UNCOMMON_TRAP, c.uncommonTrapStub, NativeCall, PRESERVES_REGISTERS, LEAF);
         registerForeignCall(DEOPT_HANDLER, c.handleDeoptStub, NativeCall, PRESERVES_REGISTERS, LEAF);
         registerForeignCall(IC_MISS_HANDLER, c.inlineCacheMissStub, NativeCall, PRESERVES_REGISTERS, LEAF);
@@ -224,7 +223,6 @@
         registerForeignCall(ARITHMETIC_COS, c.arithmeticCosAddress, NativeCall, DESTROYS_REGISTERS, LEAF);
         registerForeignCall(ARITHMETIC_TAN, c.arithmeticTanAddress, NativeCall, DESTROYS_REGISTERS, LEAF);
 
-        registerForeignCall(OSR_MIGRATION_END_C, c.osrMigrationEndAddress, NativeCall, DESTROYS_REGISTERS, NOT_LEAF);
         registerForeignCall(EXCEPTION_HANDLER_FOR_PC, c.exceptionHandlerForPcAddress, NativeCall, DESTROYS_REGISTERS, NOT_LEAF);
         registerForeignCall(EXCEPTION_HANDLER_FOR_RETURN_ADDRESS, c.exceptionHandlerForReturnAddressAddress, NativeCall, DESTROYS_REGISTERS, NOT_LEAF);
         registerForeignCall(NEW_ARRAY_C, c.newArrayAddress, NativeCall, DESTROYS_REGISTERS, NOT_LEAF);
@@ -269,30 +267,30 @@
         link(new ExceptionHandlerStub(this, replacements, target, foreignCalls.get(EXCEPTION_HANDLER)));
         link(new UnwindExceptionToCallerStub(this, replacements, target, foreignCalls.get(UNWIND_EXCEPTION_TO_CALLER)));
         link(new VerifyOopStub(this, replacements, target, foreignCalls.get(VERIFY_OOP)));
-        link(new OSRMigrationEndStub(this, replacements, target, foreignCalls.get(OSR_MIGRATION_END)));
         link(new VMErrorStub(this, replacements, target, foreignCalls.get(VM_ERROR)));
 
-        linkForeignCall(IDENTITY_HASHCODE, config.identityHashCodeAddress, replacements);
-        linkForeignCall(REGISTER_FINALIZER, config.registerFinalizerAddress, replacements);
-        linkForeignCall(CREATE_NULL_POINTER_EXCEPTION, config.createNullPointerExceptionAddress, replacements);
-        linkForeignCall(CREATE_OUT_OF_BOUNDS_EXCEPTION, config.createOutOfBoundsExceptionAddress, replacements);
-        linkForeignCall(MONITORENTER, config.monitorenterAddress, replacements);
-        linkForeignCall(MONITOREXIT, config.monitorexitAddress, replacements);
-        linkForeignCall(WRITE_BARRIER_PRE, config.writeBarrierPreAddress, replacements);
-        linkForeignCall(WRITE_BARRIER_POST, config.writeBarrierPostAddress, replacements);
-        linkForeignCall(NEW_MULTI_ARRAY, config.newMultiArrayAddress, replacements);
-        linkForeignCall(LOG_PRINTF, config.logPrintfAddress, replacements);
-        linkForeignCall(LOG_OBJECT, config.logObjectAddress, replacements);
-        linkForeignCall(LOG_PRIMITIVE, config.logPrimitiveAddress, replacements);
-        linkForeignCall(THREAD_IS_INTERRUPTED, config.threadIsInterruptedAddress, replacements);
+        linkForeignCall(IDENTITY_HASHCODE, config.identityHashCodeAddress, replacements, true);
+        linkForeignCall(REGISTER_FINALIZER, config.registerFinalizerAddress, replacements, true);
+        linkForeignCall(CREATE_NULL_POINTER_EXCEPTION, config.createNullPointerExceptionAddress, replacements, true);
+        linkForeignCall(CREATE_OUT_OF_BOUNDS_EXCEPTION, config.createOutOfBoundsExceptionAddress, replacements, true);
+        linkForeignCall(MONITORENTER, config.monitorenterAddress, replacements, true);
+        linkForeignCall(MONITOREXIT, config.monitorexitAddress, replacements, true);
+        linkForeignCall(WRITE_BARRIER_PRE, config.writeBarrierPreAddress, replacements, true);
+        linkForeignCall(WRITE_BARRIER_POST, config.writeBarrierPostAddress, replacements, true);
+        linkForeignCall(NEW_MULTI_ARRAY, config.newMultiArrayAddress, replacements, true);
+        linkForeignCall(LOG_PRINTF, config.logPrintfAddress, replacements, true);
+        linkForeignCall(LOG_OBJECT, config.logObjectAddress, replacements, true);
+        linkForeignCall(LOG_PRIMITIVE, config.logPrimitiveAddress, replacements, true);
+        linkForeignCall(THREAD_IS_INTERRUPTED, config.threadIsInterruptedAddress, replacements, true);
+        linkForeignCall(OSR_MIGRATION_END, config.osrMigrationEndAddress, replacements, false);
     }
 
     private static void link(Stub stub) {
         stub.getLinkage().setCompiledStub(stub);
     }
 
-    private void linkForeignCall(ForeignCallDescriptor descriptor, long address, Replacements replacements) {
-        ForeignCallStub stub = new ForeignCallStub(address, descriptor, true, this, replacements);
+    private void linkForeignCall(ForeignCallDescriptor descriptor, long address, Replacements replacements, boolean prependThread) {
+        ForeignCallStub stub = new ForeignCallStub(address, descriptor, prependThread, this, replacements);
         HotSpotForeignCallLinkage linkage = stub.getLinkage();
         HotSpotForeignCallLinkage targetLinkage = stub.getTargetLinkage();
         linkage.setCompiledStub(stub);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/OSRMigrationEndStub.java	Thu May 16 21:46:15 2013 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/*
- * 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.stubs.StubUtil.*;
-
-import com.oracle.graal.api.code.*;
-import com.oracle.graal.api.meta.*;
-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.nodes.extended.*;
-import com.oracle.graal.nodes.spi.*;
-import com.oracle.graal.replacements.*;
-import com.oracle.graal.word.*;
-
-/**
- * Stub called from {@link OSRStartNode}.
- */
-public class OSRMigrationEndStub extends CRuntimeStub {
-
-    public OSRMigrationEndStub(final HotSpotRuntime runtime, Replacements replacements, TargetDescription target, HotSpotForeignCallLinkage linkage) {
-        super(runtime, replacements, target, linkage);
-    }
-
-    @Snippet
-    private static void osrMigrationEnd(Word buffer) {
-        osrMigrationEndC(OSR_MIGRATION_END_C, buffer);
-    }
-
-    public static final ForeignCallDescriptor OSR_MIGRATION_END_C = descriptorFor(OSRMigrationEndStub.class, "osrMigrationEndC");
-
-    @NodeIntrinsic(ForeignCallNode.class)
-    public static native void osrMigrationEndC(@ConstantNodeParameter ForeignCallDescriptor osrMigrationEndC, Word buffer);
-}