Mercurial > hg > graal-compiler
changeset 8489:92d21814cf7b
-Implement WB primitive stub call for G1's slow path later
author | Christos Kotselidis <christos.kotselidis@oracle.com> |
---|---|
date | Tue, 19 Feb 2013 17:57:14 +0100 |
parents | 225c984588ee |
children | 1567c6cc6561 |
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/nodes/WriteBarrierStubCall.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/WriteBarrierSnippets.java src/cpu/x86/vm/graalRuntime_x86.cpp src/share/vm/graal/graalCompilerToVM.cpp src/share/vm/graal/graalRuntime.cpp src/share/vm/graal/graalRuntime.hpp |
diffstat | 8 files changed, 85 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotRuntime.java Tue Feb 19 16:53:10 2013 +0100 +++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotRuntime.java Tue Feb 19 17:57:14 2013 +0100 @@ -36,6 +36,7 @@ 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.nodes.WriteBarrierStubCall.*; import static com.oracle.graal.hotspot.snippets.AESCryptSubstitutions.DecryptBlockStubCall.*; import static com.oracle.graal.hotspot.snippets.AESCryptSubstitutions.EncryptBlockStubCall.*; import static com.oracle.graal.hotspot.snippets.CipherBlockChainingSubstitutions.DecryptAESCryptStubCall.*; @@ -87,6 +88,11 @@ /* arg0: object */ javaCallingConvention(Kind.Object, /* arg1: lock */ word)); + addRuntimeCall(G1_WB_SLOW, config.g1WBSlowStub, + /* temps */ null, + /* ret */ ret(Kind.Void), + /* arg0: object */ javaCallingConvention(Kind.Object)); + addRuntimeCall(MONITOREXIT, config.monitorExitStub, /* temps */ null, /* ret */ ret(Kind.Void),
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java Tue Feb 19 16:53:10 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java Tue Feb 19 17:57:14 2013 +0100 @@ -316,6 +316,7 @@ public long handleDeoptStub; public long monitorEnterStub; public long monitorExitStub; + public long g1WBSlowStub; public long verifyOopStub; public long vmErrorStub; public long deoptimizeStub;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/WriteBarrierStubCall.java Tue Feb 19 17:57:14 2013 +0100 @@ -0,0 +1,53 @@ +/* + * 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.nodes; + +import com.oracle.graal.api.code.*; +import com.oracle.graal.api.code.RuntimeCallTarget.Descriptor; +import com.oracle.graal.compiler.gen.*; +import com.oracle.graal.compiler.target.*; +import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.type.*; + +/** + * Node implementing a call to HotSpot's {@code graal_monitorenter} stub. + */ +public class WriteBarrierStubCall extends FixedWithNextNode implements LIRGenLowerable { + + @Input private final ValueNode object; + public static final Descriptor G1_WB_SLOW = new Descriptor("g1_wb_slow", true, void.class, Object.class); + + public WriteBarrierStubCall(ValueNode object) { + super(StampFactory.forVoid()); + this.object = object; + } + + @Override + public void generate(LIRGenerator gen) { + RuntimeCallTarget stub = gen.getRuntime().lookupRuntimeCall(WriteBarrierStubCall.G1_WB_SLOW); + gen.emitCall(stub, stub.getCallingConvention(), true, gen.operand(object)); + } + + @NodeIntrinsic + public static native void call(Object hub); +}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/WriteBarrierSnippets.java Tue Feb 19 16:53:10 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/WriteBarrierSnippets.java Tue Feb 19 17:57:14 2013 +0100 @@ -68,6 +68,7 @@ base = base.add(Word.unsigned(cardTableStart())); } base.writeWord(displacement, Word.zero()); + WriteBarrierStubCall.call(object); } @Snippet
--- a/src/cpu/x86/vm/graalRuntime_x86.cpp Tue Feb 19 16:53:10 2013 +0100 +++ b/src/cpu/x86/vm/graalRuntime_x86.cpp Tue Feb 19 17:57:14 2013 +0100 @@ -1192,8 +1192,25 @@ __ ret(0); break; } + case graal_g1_wb_slow_id: { + Register obj = j_rarg0; + { + GraalStubFrame f(sasm, "graal_g1_wb_slow", dont_gc_arguments); + OopMap* map = save_live_registers(sasm, 2, save_fpu_registers); - case graal_identity_hash_code_id: { + // note: really a leaf routine but must setup last java sp + // => use call_RT for now (speed can be improved by + // doing last java sp setup manually) + int call_offset = __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, graal_g1_wb_slow), obj); + + oop_maps = new OopMapSet(); + oop_maps->add_gc_map(call_offset, map); + restore_live_registers(sasm, save_fpu_registers); + } + __ ret(0); + break; + } + case graal_identity_hash_code_id: { Register obj = j_rarg0; // Incoming __ set_info("identity_hash_code", dont_gc_arguments); __ enter();
--- a/src/share/vm/graal/graalCompilerToVM.cpp Tue Feb 19 16:53:10 2013 +0100 +++ b/src/share/vm/graal/graalCompilerToVM.cpp Tue Feb 19 17:57:14 2013 +0100 @@ -720,6 +720,7 @@ set_long("handleDeoptStub", VmIds::addStub(SharedRuntime::deopt_blob()->unpack())); set_long("monitorEnterStub", VmIds::addStub(GraalRuntime::entry_for(GraalRuntime::graal_monitorenter_id))); set_long("monitorExitStub", VmIds::addStub(GraalRuntime::entry_for(GraalRuntime::graal_monitorexit_id))); + set_long("g1WBSlowStub", VmIds::addStub(GraalRuntime::entry_for(GraalRuntime::graal_g1_wb_slow_id))); set_long("verifyOopStub", VmIds::addStub(GraalRuntime::entry_for(GraalRuntime::graal_verify_oop_id))); set_long("vmErrorStub", VmIds::addStub(GraalRuntime::entry_for(GraalRuntime::graal_vm_error_id))); set_long("deoptimizeStub", VmIds::addStub(SharedRuntime::deopt_blob()->uncommon_trap()));
--- a/src/share/vm/graal/graalRuntime.cpp Tue Feb 19 16:53:10 2013 +0100 +++ b/src/share/vm/graal/graalRuntime.cpp Tue Feb 19 17:57:14 2013 +0100 @@ -483,6 +483,9 @@ } JRT_END +JRT_LEAF(void, GraalRuntime::graal_g1_wb_slow(JavaThread* thread, oopDesc* obj)) + tty->print_cr("HELLO WRITE BARRIER"); +JRT_END JRT_LEAF(void, GraalRuntime::graal_monitorexit(JavaThread* thread, oopDesc* obj, BasicLock* lock)) assert(thread == JavaThread::current(), "threads must correspond");
--- a/src/share/vm/graal/graalRuntime.hpp Tue Feb 19 16:53:10 2013 +0100 +++ b/src/share/vm/graal/graalRuntime.hpp Tue Feb 19 17:57:14 2013 +0100 @@ -103,6 +103,7 @@ stub(graal_log_primitive) \ stub(graal_identity_hash_code) \ stub(graal_thread_is_interrupted) \ + stub(graal_g1_wb_slow) \ last_entry(number_of_ids) #define DECLARE_STUB_ID(x) x ## _id , @@ -140,6 +141,7 @@ static address exception_handler_for_pc(JavaThread* thread); + static void graal_g1_wb_slow(JavaThread* thread, oopDesc* obj); static void graal_create_null_exception(JavaThread* thread); static void graal_create_out_of_bounds_exception(JavaThread* thread, jint index); static void graal_monitorenter(JavaThread* thread, oopDesc* obj, BasicLock* lock);