# HG changeset patch # User Doug Simon # Date 1367846579 -7200 # Node ID ffd3d85e055f0ceb832fbae658a7215dedb47569 # Parent e799f8478b6d72be5a62883965d94703d160747b replaced OSR_migration_end assembler stub with a compiled stub (GRAAL-81) diff -r e799f8478b6d -r ffd3d85e055f graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java Mon May 06 14:53:28 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java Mon May 06 15:22:59 2013 +0200 @@ -377,7 +377,6 @@ public long vmErrorStub; public long uncommonTrapStub; public long unwindExceptionStub; - public long osrMigrationEndStub; public long createNullPointerExceptionStub; public long createOutOfBoundsExceptionStub; public long javaTimeMillisStub; @@ -405,6 +404,7 @@ public long identityHashCodeAddress; public long exceptionHandlerForPcAddress; public long exceptionHandlerForReturnAddressAddress; + public long osrMigrationEndAddress; public int deoptReasonNullCheck; public int deoptReasonRangeCheck; diff -r e799f8478b6d -r ffd3d85e055f graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java Mon May 06 14:53:28 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java Mon May 06 15:22:59 2013 +0200 @@ -222,10 +222,13 @@ /* ret */ ret(Kind.Object), /* arg0: object */ javaCallingConvention(Kind.Object)); - addRuntimeCall(OSR_MIGRATION_END, config.osrMigrationEndStub, - /* temps */ null, + addStubCall(OSR_MIGRATION_END, /* ret */ ret(Kind.Void), - /* arg0: long */ javaCallingConvention(Kind.Long)); + /* arg0: buffer */ javaCallingConvention(word)); + + addCRuntimeCall(OSRMigrationEndStub.OSR_MIGRATION_END_C, config.osrMigrationEndAddress, + /* ret */ ret(Kind.Void), + /* arg0: buffer */ nativeCallingConvention(word)); addRuntimeCall(UNCOMMON_TRAP, config.uncommonTrapStub, /* temps */ null, @@ -493,6 +496,7 @@ registerStub(new ExceptionHandlerStub(this, replacements, graalRuntime.getTarget(), runtimeCalls.get(EXCEPTION_HANDLER))); registerStub(new UnwindExceptionToCallerStub(this, replacements, graalRuntime.getTarget(), runtimeCalls.get(UNWIND_EXCEPTION_TO_CALLER))); registerStub(new VerifyOopStub(this, replacements, graalRuntime.getTarget(), runtimeCalls.get(VERIFY_OOP))); + registerStub(new OSRMigrationEndStub(this, replacements, graalRuntime.getTarget(), runtimeCalls.get(OSR_MIGRATION_END))); } private void registerStub(Stub stub) { diff -r e799f8478b6d -r ffd3d85e055f graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/OSRMigrationEndStub.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/stubs/OSRMigrationEndStub.java Mon May 06 15:22:59 2013 +0200 @@ -0,0 +1,57 @@ +/* + * 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 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.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, HotSpotRuntimeCallTarget linkage) { + super(runtime, replacements, target, linkage); + } + + @Snippet + private static void osrMigrationEnd(Word buffer) { + printf("freeing OSR migration buffer %p\n", buffer.rawValue()); + osrMigrationEndC(OSR_MIGRATION_END_C, buffer); + printf("freed OSR migration buffer %p\n", buffer.rawValue()); + } + + public static final Descriptor OSR_MIGRATION_END_C = descriptorFor(OSRMigrationEndStub.class, "osrMigrationEndC", false); + + @NodeIntrinsic(CRuntimeCall.class) + public static native void osrMigrationEndC(@ConstantNodeParameter Descriptor osrMigrationEndC, Word buffer); +} diff -r e799f8478b6d -r ffd3d85e055f src/cpu/x86/vm/graalRuntime_x86.cpp --- a/src/cpu/x86/vm/graalRuntime_x86.cpp Mon May 06 14:53:28 2013 +0200 +++ b/src/cpu/x86/vm/graalRuntime_x86.cpp Mon May 06 15:22:59 2013 +0200 @@ -625,17 +625,6 @@ OopMapSet* oop_maps = NULL; switch (id) { - case OSR_migration_end_id: { - __ enter(); - save_live_registers(sasm, 0); - __ movptr(c_rarg0, j_rarg0); - __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::OSR_migration_end))); - restore_live_registers(sasm); - __ leave(); - __ ret(0); - break; - } - case create_null_pointer_exception_id: { __ enter(); oop_maps = new OopMapSet(); diff -r e799f8478b6d -r ffd3d85e055f src/share/vm/graal/graalCompilerToVM.cpp --- a/src/share/vm/graal/graalCompilerToVM.cpp Mon May 06 14:53:28 2013 +0200 +++ b/src/share/vm/graal/graalCompilerToVM.cpp Mon May 06 15:22:59 2013 +0200 @@ -765,7 +765,6 @@ set_address("monitorEnterStub", GraalRuntime::entry_for(GraalRuntime::monitorenter_id)); set_address("monitorExitStub", GraalRuntime::entry_for(GraalRuntime::monitorexit_id)); set_address("vmErrorStub", GraalRuntime::entry_for(GraalRuntime::vm_error_id)); - set_address("osrMigrationEndStub", GraalRuntime::entry_for(GraalRuntime::OSR_migration_end_id)); set_address("createNullPointerExceptionStub", GraalRuntime::entry_for(GraalRuntime::create_null_pointer_exception_id)); set_address("createOutOfBoundsExceptionStub", GraalRuntime::entry_for(GraalRuntime::create_out_of_bounds_exception_id)); set_address("javaTimeMillisStub", CAST_FROM_FN_PTR(address, os::javaTimeMillis)); @@ -793,6 +792,7 @@ set_address("identityHashCodeAddress", GraalRuntime::identity_hash_code); set_address("exceptionHandlerForPcAddress", GraalRuntime::exception_handler_for_pc); set_address("exceptionHandlerForReturnAddressAddress", SharedRuntime::exception_handler_for_return_address); + set_address("osrMigrationEndAddress", SharedRuntime::OSR_migration_end); set_int("deoptReasonNone", Deoptimization::Reason_none); set_int("deoptReasonNullCheck", Deoptimization::Reason_null_check); diff -r e799f8478b6d -r ffd3d85e055f src/share/vm/graal/graalRuntime.cpp --- a/src/share/vm/graal/graalRuntime.cpp Mon May 06 14:53:28 2013 +0200 +++ b/src/share/vm/graal/graalRuntime.cpp Mon May 06 15:22:59 2013 +0200 @@ -127,7 +127,6 @@ // Make sure that stubs that need oopmaps have them switch (id) { // These stubs don't need to have an oopmap - case OSR_migration_end_id: case arithmetic_frem_id: case arithmetic_drem_id: break; diff -r e799f8478b6d -r ffd3d85e055f src/share/vm/graal/graalRuntime.hpp --- a/src/share/vm/graal/graalRuntime.hpp Mon May 06 14:53:28 2013 +0200 +++ b/src/share/vm/graal/graalRuntime.hpp Mon May 06 15:22:59 2013 +0200 @@ -78,7 +78,6 @@ // runtime routines needed by code code generated // by Graal. #define GRAAL_STUBS(stub, last_entry) \ - stub(OSR_migration_end) \ stub(arithmetic_frem) \ stub(arithmetic_drem) \ stub(monitorenter) \