# HG changeset patch # User Christos Kotselidis # Date 1371737414 -7200 # Node ID 8b22524df53bee5a80f62ba97751ac24179f19e9 # Parent d7f4cc510a88d59227b2d596cffaea8b48dce882 Add G1 Barriers' foreign calls diff -r d7f4cc510a88 -r 8b22524df53b 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 Thu Jun 20 15:36:49 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotRuntime.java Thu Jun 20 16:10:14 2013 +0200 @@ -51,6 +51,8 @@ import static com.oracle.graal.phases.GraalOptions.*; import static com.oracle.graal.replacements.Log.*; import static com.oracle.graal.replacements.MathSubstitutionsX86.*; +import static com.oracle.graal.hotspot.nodes.G1PostWriteBarrierStubCall.*; +import static com.oracle.graal.hotspot.nodes.G1PreWriteBarrierStubCall.*; import java.lang.reflect.*; import java.util.*; @@ -294,7 +296,8 @@ linkForeignCall(r, THREAD_IS_INTERRUPTED, c.threadIsInterruptedAddress, PREPEND_THREAD, NOT_REEXECUTABLE, ANY_LOCATION); linkForeignCall(r, VM_ERROR, c.vmErrorAddress, PREPEND_THREAD, REEXECUTABLE, NO_LOCATIONS); linkForeignCall(r, OSR_MIGRATION_END, c.osrMigrationEndAddress, DONT_PREPEND_THREAD, NOT_REEXECUTABLE, NO_LOCATIONS); - + linkForeignCall(r, G1WBPRECALL, c.writeBarrierPreAddress, PREPEND_THREAD, REEXECUTABLE, NO_LOCATIONS); + linkForeignCall(r, G1WBPOSTCALL, c.writeBarrierPostAddress, PREPEND_THREAD, REEXECUTABLE, NO_LOCATIONS); if (IntrinsifyObjectMethods.getValue()) { r.registerSubstitutions(ObjectSubstitutions.class); } diff -r d7f4cc510a88 -r 8b22524df53b src/share/vm/graal/graalCompilerToVM.cpp --- a/src/share/vm/graal/graalCompilerToVM.cpp Thu Jun 20 15:36:49 2013 +0200 +++ b/src/share/vm/graal/graalCompilerToVM.cpp Thu Jun 20 16:10:14 2013 +0200 @@ -871,6 +871,8 @@ set_int("g1SATBQueueMarkingOffset", in_bytes(JavaThread::satb_mark_queue_offset() + PtrQueue::byte_offset_of_active())); set_int("g1SATBQueueIndexOffset", in_bytes(JavaThread::satb_mark_queue_offset() + PtrQueue::byte_offset_of_index())); set_int("g1SATBQueueBufferOffset", in_bytes(JavaThread::satb_mark_queue_offset() + PtrQueue::byte_offset_of_buf())); + set_address("writeBarrierPreAddress", GraalRuntime::write_barrier_pre); + set_address("writeBarrierPostAddress", GraalRuntime::write_barrier_post); BarrierSet* bs = Universe::heap()->barrier_set(); switch (bs->kind()) { diff -r d7f4cc510a88 -r 8b22524df53b src/share/vm/graal/graalRuntime.cpp --- a/src/share/vm/graal/graalRuntime.cpp Thu Jun 20 15:36:49 2013 +0200 +++ b/src/share/vm/graal/graalRuntime.cpp Thu Jun 20 16:10:14 2013 +0200 @@ -358,6 +358,14 @@ } JRT_END +JRT_LEAF(void, GraalRuntime::write_barrier_pre(JavaThread* thread, oopDesc* obj)) + thread->satb_mark_queue().enqueue(obj); +JRT_END + +JRT_LEAF(void, GraalRuntime::write_barrier_post(JavaThread* thread, void* card_addr)) + thread->dirty_card_queue().enqueue(card_addr); +JRT_END + JRT_ENTRY(void, GraalRuntime::vm_error(JavaThread* thread, oop where, oop format, jlong value)) ResourceMark rm; assert(where == NULL || java_lang_String::is_instance(where), "must be"); diff -r d7f4cc510a88 -r 8b22524df53b src/share/vm/graal/graalRuntime.hpp --- a/src/share/vm/graal/graalRuntime.hpp Thu Jun 20 15:36:49 2013 +0200 +++ b/src/share/vm/graal/graalRuntime.hpp Thu Jun 20 16:10:14 2013 +0200 @@ -52,6 +52,8 @@ LOG_OBJECT_ADDRESS = 0x04 }; static void log_object(JavaThread* thread, oop msg, jint flags); + static void write_barrier_pre(JavaThread* thread, oopDesc* obj); + static void write_barrier_post(JavaThread* thread, void* card); }; #endif // SHARE_VM_GRAAL_GRAAL_RUNTIME_HPP