20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 *
24 */
25
26 #include "precompiled.hpp"
27 #include "asm/macroAssembler.inline.hpp"
28 #include "compiler/disassembler.hpp"
29 #include "gc/shared/cardTableModRefBS.hpp"
30 #include "gc/shared/collectedHeap.inline.hpp"
31 #include "interpreter/interpreter.hpp"
32 #include "memory/resourceArea.hpp"
33 #include "nativeInst_ppc.hpp"
34 #include "prims/methodHandles.hpp"
35 #include "runtime/biasedLocking.hpp"
36 #include "runtime/icache.hpp"
37 #include "runtime/interfaceSupport.hpp"
38 #include "runtime/objectMonitor.hpp"
39 #include "runtime/os.hpp"
40 #include "runtime/sharedRuntime.hpp"
41 #include "runtime/stubRoutines.hpp"
42 #include "utilities/macros.hpp"
43 #if INCLUDE_ALL_GCS
44 #include "gc/g1/g1CollectedHeap.inline.hpp"
45 #include "gc/g1/g1SATBCardTableModRefBS.hpp"
46 #include "gc/g1/heapRegion.hpp"
47 #endif // INCLUDE_ALL_GCS
48 #ifdef COMPILER2
49 #include "opto/intrinsicnode.hpp"
50 #endif
51
52 #ifdef PRODUCT
53 #define BLOCK_COMMENT(str) // nothing
54 #else
55 #define BLOCK_COMMENT(str) block_comment(str)
56 #endif
57 #define BIND(label) bind(label); BLOCK_COMMENT(#label ":")
58
59 #ifdef ASSERT
3000
3001 // Write serialization page so VM thread can do a pseudo remote membar.
3002 // We use the current thread pointer to calculate a thread specific
3003 // offset to write to within the page. This minimizes bus traffic
3004 // due to cache line collision.
3005 void MacroAssembler::serialize_memory(Register thread, Register tmp1, Register tmp2) {
3006 srdi(tmp2, thread, os::get_serialize_page_shift_count());
3007
3008 int mask = os::vm_page_size() - sizeof(int);
3009 if (Assembler::is_simm(mask, 16)) {
3010 andi(tmp2, tmp2, mask);
3011 } else {
3012 lis(tmp1, (int)((signed short) (mask >> 16)));
3013 ori(tmp1, tmp1, mask & 0x0000ffff);
3014 andr(tmp2, tmp2, tmp1);
3015 }
3016
3017 load_const(tmp1, (long) os::get_memory_serialize_page());
3018 release();
3019 stwx(R0, tmp1, tmp2);
3020 }
3021
3022
3023 // GC barrier helper macros
3024
3025 // Write the card table byte if needed.
3026 void MacroAssembler::card_write_barrier_post(Register Rstore_addr, Register Rnew_val, Register Rtmp) {
3027 CardTableModRefBS* bs =
3028 barrier_set_cast<CardTableModRefBS>(Universe::heap()->barrier_set());
3029 assert(bs->kind() == BarrierSet::CardTableForRS ||
3030 bs->kind() == BarrierSet::CardTableExtension, "wrong barrier");
3031 #ifdef ASSERT
3032 cmpdi(CCR0, Rnew_val, 0);
3033 asm_assert_ne("null oop not allowed", 0x321);
3034 #endif
3035 card_table_write(bs->byte_map_base, Rtmp, Rstore_addr);
3036 }
3037
3038 // Write the card table byte.
3039 void MacroAssembler::card_table_write(jbyte* byte_map_base, Register Rtmp, Register Robj) {
|
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 *
24 */
25
26 #include "precompiled.hpp"
27 #include "asm/macroAssembler.inline.hpp"
28 #include "compiler/disassembler.hpp"
29 #include "gc/shared/cardTableModRefBS.hpp"
30 #include "gc/shared/collectedHeap.inline.hpp"
31 #include "interpreter/interpreter.hpp"
32 #include "memory/resourceArea.hpp"
33 #include "nativeInst_ppc.hpp"
34 #include "prims/methodHandles.hpp"
35 #include "runtime/biasedLocking.hpp"
36 #include "runtime/icache.hpp"
37 #include "runtime/interfaceSupport.hpp"
38 #include "runtime/objectMonitor.hpp"
39 #include "runtime/os.hpp"
40 #include "runtime/safepoint.hpp"
41 #include "runtime/safepointMechanism.hpp"
42 #include "runtime/sharedRuntime.hpp"
43 #include "runtime/stubRoutines.hpp"
44 #include "utilities/macros.hpp"
45 #if INCLUDE_ALL_GCS
46 #include "gc/g1/g1CollectedHeap.inline.hpp"
47 #include "gc/g1/g1SATBCardTableModRefBS.hpp"
48 #include "gc/g1/heapRegion.hpp"
49 #endif // INCLUDE_ALL_GCS
50 #ifdef COMPILER2
51 #include "opto/intrinsicnode.hpp"
52 #endif
53
54 #ifdef PRODUCT
55 #define BLOCK_COMMENT(str) // nothing
56 #else
57 #define BLOCK_COMMENT(str) block_comment(str)
58 #endif
59 #define BIND(label) bind(label); BLOCK_COMMENT(#label ":")
60
61 #ifdef ASSERT
3002
3003 // Write serialization page so VM thread can do a pseudo remote membar.
3004 // We use the current thread pointer to calculate a thread specific
3005 // offset to write to within the page. This minimizes bus traffic
3006 // due to cache line collision.
3007 void MacroAssembler::serialize_memory(Register thread, Register tmp1, Register tmp2) {
3008 srdi(tmp2, thread, os::get_serialize_page_shift_count());
3009
3010 int mask = os::vm_page_size() - sizeof(int);
3011 if (Assembler::is_simm(mask, 16)) {
3012 andi(tmp2, tmp2, mask);
3013 } else {
3014 lis(tmp1, (int)((signed short) (mask >> 16)));
3015 ori(tmp1, tmp1, mask & 0x0000ffff);
3016 andr(tmp2, tmp2, tmp1);
3017 }
3018
3019 load_const(tmp1, (long) os::get_memory_serialize_page());
3020 release();
3021 stwx(R0, tmp1, tmp2);
3022 }
3023
3024 void MacroAssembler::safepoint_poll(Label& slow_path, Register temp_reg) {
3025 if (SafepointMechanism::uses_thread_local_poll()) {
3026 ld(temp_reg, in_bytes(Thread::polling_page_offset()), R16_thread);
3027 // Armed page has poll_bit set.
3028 andi_(temp_reg, temp_reg, SafepointMechanism::poll_bit());
3029 } else {
3030 lwz(temp_reg, (RegisterOrConstant)(intptr_t)SafepointSynchronize::address_of_state());
3031 cmpwi(CCR0, temp_reg, SafepointSynchronize::_not_synchronized);
3032 }
3033 bne(CCR0, slow_path);
3034 }
3035
3036
3037 // GC barrier helper macros
3038
3039 // Write the card table byte if needed.
3040 void MacroAssembler::card_write_barrier_post(Register Rstore_addr, Register Rnew_val, Register Rtmp) {
3041 CardTableModRefBS* bs =
3042 barrier_set_cast<CardTableModRefBS>(Universe::heap()->barrier_set());
3043 assert(bs->kind() == BarrierSet::CardTableForRS ||
3044 bs->kind() == BarrierSet::CardTableExtension, "wrong barrier");
3045 #ifdef ASSERT
3046 cmpdi(CCR0, Rnew_val, 0);
3047 asm_assert_ne("null oop not allowed", 0x321);
3048 #endif
3049 card_table_write(bs->byte_map_base, Rtmp, Rstore_addr);
3050 }
3051
3052 // Write the card table byte.
3053 void MacroAssembler::card_table_write(jbyte* byte_map_base, Register Rtmp, Register Robj) {
|