33 private:
34 static zpointer store_good(oop obj);
35
36 public:
37 ZBarrierSet();
38
39 static ZBarrierSetAssembler* assembler();
40 static bool barrier_needed(DecoratorSet decorators, BasicType type);
41
42 static void clone_obj_array(objArrayOop src, objArrayOop dst);
43
44 virtual void on_thread_create(Thread* thread);
45 virtual void on_thread_destroy(Thread* thread);
46 virtual void on_thread_attach(Thread* thread);
47 virtual void on_thread_detach(Thread* thread);
48
49 virtual void on_slowpath_allocation_exit(JavaThread* thread, oop new_obj);
50
51 virtual void print_on(outputStream* st) const;
52
53 template <DecoratorSet decorators, typename BarrierSetT = ZBarrierSet>
54 class AccessBarrier : public BarrierSet::AccessBarrier<decorators, BarrierSetT> {
55 private:
56 typedef BarrierSet::AccessBarrier<decorators, BarrierSetT> Raw;
57
58 template <DecoratorSet expected>
59 static void verify_decorators_present();
60
61 template <DecoratorSet expected>
62 static void verify_decorators_absent();
63
64 static zpointer* field_addr(oop base, ptrdiff_t offset);
65
66 static zaddress load_barrier(zpointer* p, zpointer o);
67 static zaddress load_barrier_on_unknown_oop_ref(oop base, ptrdiff_t offset, zpointer* p, zpointer o);
68
69 static void store_barrier_heap_with_healing(zpointer* p);
70 static void store_barrier_heap_without_healing(zpointer* p);
71 static void no_keep_alive_store_barrier_heap(zpointer* p);
72
73 static void store_barrier_native_with_healing(zpointer* p);
74 static void store_barrier_native_without_healing(zpointer* p);
75
76 static void unsupported();
77 static zaddress load_barrier(narrowOop* p, zpointer o) { unsupported(); return zaddress::null; }
78 static zaddress load_barrier_on_unknown_oop_ref(oop base, ptrdiff_t offset, narrowOop* p, zpointer o) { unsupported(); return zaddress::null; }
79 static void store_barrier_heap_with_healing(narrowOop* p) { unsupported(); }
80 static void store_barrier_heap_without_healing(narrowOop* p) { unsupported(); }
81 static void no_keep_alive_store_barrier_heap(narrowOop* p) { unsupported(); }
82 static void store_barrier_native_with_healing(narrowOop* p) { unsupported(); }
83 static void store_barrier_native_without_healing(narrowOop* p) { unsupported(); }
84
85 static zaddress oop_copy_one_barriers(zpointer* dst, zpointer* src);
86 static bool oop_copy_one_check_cast(zpointer* dst, zpointer* src, Klass* dst_klass);
87 static void oop_copy_one(zpointer* dst, zpointer* src);
88
89 static bool oop_arraycopy_in_heap_check_cast(zpointer* dst, zpointer* src, size_t length, Klass* dst_klass);
90 static bool oop_arraycopy_in_heap_no_check_cast(zpointer* dst, zpointer* src, size_t length);
91
92 public:
93 //
94 // In heap
95 //
96 static oop oop_load_in_heap(zpointer* p);
97 static oop oop_load_in_heap(oop* p) { return oop_load_in_heap((zpointer*)p); };
98 static oop oop_load_in_heap(narrowOop* p) { unsupported(); return nullptr; }
99
100 static oop oop_load_in_heap_at(oop base, ptrdiff_t offset);
101
102 static void oop_store_in_heap(zpointer* p, oop value);
103 static void oop_store_in_heap(oop* p, oop value) { oop_store_in_heap((zpointer*)p, value); }
104 static void oop_store_in_heap(narrowOop* p, oop value) { unsupported(); }
105 static void oop_store_in_heap_at(oop base, ptrdiff_t offset, oop value);
106
107 static void oop_store_not_in_heap(zpointer* p, oop value);
108 static void oop_store_not_in_heap(oop* p, oop value) { oop_store_not_in_heap((zpointer*)p, value); }
109 static void oop_store_not_in_heap(narrowOop* p, oop value) { unsupported(); }
110 static void oop_store_not_in_heap_at(oop base, ptrdiff_t offset, oop value);
111
112 static oop oop_atomic_cmpxchg_in_heap(zpointer* p, oop compare_value, oop new_value);
113 static oop oop_atomic_cmpxchg_in_heap(oop* p, oop compare_value, oop new_value) { return oop_atomic_cmpxchg_in_heap((zpointer*)p, compare_value, new_value); }
114 static oop oop_atomic_cmpxchg_in_heap(narrowOop* p, oop compare_value, oop new_value) { unsupported(); return nullptr; }
115 static oop oop_atomic_cmpxchg_in_heap_at(oop base, ptrdiff_t offset, oop compare_value, oop new_value);
116
117 static oop oop_atomic_xchg_in_heap(zpointer* p, oop new_value);
118 static oop oop_atomic_xchg_in_heap(oop* p, oop new_value) { return oop_atomic_xchg_in_heap((zpointer*)p, new_value); }
119 static oop oop_atomic_xchg_in_heap(narrowOop* p, oop new_value) { unsupported(); return nullptr; }
120 static oop oop_atomic_xchg_in_heap_at(oop base, ptrdiff_t offset, oop new_value);
121
122 static bool oop_arraycopy_in_heap(arrayOop src_obj, size_t src_offset_in_bytes, zpointer* src_raw,
123 arrayOop dst_obj, size_t dst_offset_in_bytes, zpointer* dst_raw,
124 size_t length);
125 static bool oop_arraycopy_in_heap(arrayOop src_obj, size_t src_offset_in_bytes, oop* src_raw,
126 arrayOop dst_obj, size_t dst_offset_in_bytes, oop* dst_raw,
127 size_t length) {
128 return oop_arraycopy_in_heap(src_obj, src_offset_in_bytes, (zpointer*)src_raw,
129 dst_obj, dst_offset_in_bytes, (zpointer*)dst_raw,
130 length);
131 }
132 static bool oop_arraycopy_in_heap(arrayOop src_obj, size_t src_offset_in_bytes, narrowOop* src_raw,
133 arrayOop dst_obj, size_t dst_offset_in_bytes, narrowOop* dst_raw,
134 size_t length) { unsupported(); return false; }
135
136 static void clone_in_heap(oop src, oop dst, size_t size);
137
138 //
139 // Not in heap
140 //
141 static oop oop_load_not_in_heap(zpointer* p);
142 static oop oop_load_not_in_heap(oop* p);
143 static oop oop_load_not_in_heap(narrowOop* p) { unsupported(); return nullptr; }
144
145 static oop oop_atomic_cmpxchg_not_in_heap(zpointer* p, oop compare_value, oop new_value);
146 static oop oop_atomic_cmpxchg_not_in_heap(oop* p, oop compare_value, oop new_value) {
147 return oop_atomic_cmpxchg_not_in_heap((zpointer*)p, compare_value, new_value);
148 }
149 static oop oop_atomic_cmpxchg_not_in_heap(narrowOop* addr, oop compare_value, oop new_value) { unsupported(); return nullptr; }
150
151 static oop oop_atomic_xchg_not_in_heap(zpointer* p, oop new_value);
152 static oop oop_atomic_xchg_not_in_heap(oop* p, oop new_value) { return oop_atomic_xchg_not_in_heap((zpointer*)p, new_value); }
153 static oop oop_atomic_xchg_not_in_heap(narrowOop* p, oop new_value) { unsupported(); return nullptr; }
154 };
155 };
156
157 template<> struct BarrierSet::GetName<ZBarrierSet> {
|
33 private:
34 static zpointer store_good(oop obj);
35
36 public:
37 ZBarrierSet();
38
39 static ZBarrierSetAssembler* assembler();
40 static bool barrier_needed(DecoratorSet decorators, BasicType type);
41
42 static void clone_obj_array(objArrayOop src, objArrayOop dst);
43
44 virtual void on_thread_create(Thread* thread);
45 virtual void on_thread_destroy(Thread* thread);
46 virtual void on_thread_attach(Thread* thread);
47 virtual void on_thread_detach(Thread* thread);
48
49 virtual void on_slowpath_allocation_exit(JavaThread* thread, oop new_obj);
50
51 virtual void print_on(outputStream* st) const;
52
53 enum OopCopyCheckStatus {
54 oop_copy_check_ok = 0, // oop array copy sucessful
55 oop_copy_check_class_cast = 1, // oop array copy failed subtype check (ARRAYCOPY_CHECKCAST)
56 oop_copy_check_null = 2 // oop array copy failed null check (ARRAYCOPY_NOTNULL)
57 };
58
59 template <DecoratorSet decorators, typename BarrierSetT = ZBarrierSet>
60 class AccessBarrier : public BarrierSet::AccessBarrier<decorators, BarrierSetT> {
61 private:
62 typedef BarrierSet::AccessBarrier<decorators, BarrierSetT> Raw;
63
64 template <DecoratorSet expected>
65 static void verify_decorators_present();
66
67 template <DecoratorSet expected>
68 static void verify_decorators_absent();
69
70 static zpointer* field_addr(oop base, ptrdiff_t offset);
71
72 static zaddress load_barrier(zpointer* p, zpointer o);
73 static zaddress load_barrier_on_unknown_oop_ref(oop base, ptrdiff_t offset, zpointer* p, zpointer o);
74
75 static void store_barrier_heap_with_healing(zpointer* p);
76 static void store_barrier_heap_without_healing(zpointer* p);
77 static void no_keep_alive_store_barrier_heap(zpointer* p);
78
79 static void store_barrier_native_with_healing(zpointer* p);
80 static void store_barrier_native_without_healing(zpointer* p);
81
82 static void unsupported();
83 static zaddress load_barrier(narrowOop* p, zpointer o) { unsupported(); return zaddress::null; }
84 static zaddress load_barrier_on_unknown_oop_ref(oop base, ptrdiff_t offset, narrowOop* p, zpointer o) { unsupported(); return zaddress::null; }
85 static void store_barrier_heap_with_healing(narrowOop* p) { unsupported(); }
86 static void store_barrier_heap_without_healing(narrowOop* p) { unsupported(); }
87 static void no_keep_alive_store_barrier_heap(narrowOop* p) { unsupported(); }
88 static void store_barrier_native_with_healing(narrowOop* p) { unsupported(); }
89 static void store_barrier_native_without_healing(narrowOop* p) { unsupported(); }
90
91 static zaddress oop_copy_one_barriers(zpointer* dst, zpointer* src);
92 static OopCopyCheckStatus oop_copy_one_check_cast(zpointer* dst, zpointer* src, Klass* dst_klass);
93 static OopCopyCheckStatus oop_copy_one(zpointer* dst, zpointer* src);
94
95 static OopCopyCheckStatus oop_arraycopy_in_heap_check_cast(zpointer* dst, zpointer* src, size_t length, Klass* dst_klass);
96 static OopCopyCheckStatus oop_arraycopy_in_heap_no_check_cast(zpointer* dst, zpointer* src, size_t length);
97
98 public:
99 //
100 // In heap
101 //
102 static oop oop_load_in_heap(zpointer* p);
103 static oop oop_load_in_heap(oop* p) { return oop_load_in_heap((zpointer*)p); };
104 static oop oop_load_in_heap(narrowOop* p) { unsupported(); return nullptr; }
105
106 static oop oop_load_in_heap_at(oop base, ptrdiff_t offset);
107
108 static void oop_store_in_heap(zpointer* p, oop value);
109 static void oop_store_in_heap(oop* p, oop value) { oop_store_in_heap((zpointer*)p, value); }
110 static void oop_store_in_heap(narrowOop* p, oop value) { unsupported(); }
111 static void oop_store_in_heap_at(oop base, ptrdiff_t offset, oop value);
112
113 static void oop_store_not_in_heap(zpointer* p, oop value);
114 static void oop_store_not_in_heap(oop* p, oop value) { oop_store_not_in_heap((zpointer*)p, value); }
115 static void oop_store_not_in_heap(narrowOop* p, oop value) { unsupported(); }
116 static void oop_store_not_in_heap_at(oop base, ptrdiff_t offset, oop value);
117
118 static oop oop_atomic_cmpxchg_in_heap(zpointer* p, oop compare_value, oop new_value);
119 static oop oop_atomic_cmpxchg_in_heap(oop* p, oop compare_value, oop new_value) { return oop_atomic_cmpxchg_in_heap((zpointer*)p, compare_value, new_value); }
120 static oop oop_atomic_cmpxchg_in_heap(narrowOop* p, oop compare_value, oop new_value) { unsupported(); return nullptr; }
121 static oop oop_atomic_cmpxchg_in_heap_at(oop base, ptrdiff_t offset, oop compare_value, oop new_value);
122
123 static oop oop_atomic_xchg_in_heap(zpointer* p, oop new_value);
124 static oop oop_atomic_xchg_in_heap(oop* p, oop new_value) { return oop_atomic_xchg_in_heap((zpointer*)p, new_value); }
125 static oop oop_atomic_xchg_in_heap(narrowOop* p, oop new_value) { unsupported(); return nullptr; }
126 static oop oop_atomic_xchg_in_heap_at(oop base, ptrdiff_t offset, oop new_value);
127
128 static void oop_arraycopy_in_heap(arrayOop src_obj, size_t src_offset_in_bytes, zpointer* src_raw,
129 arrayOop dst_obj, size_t dst_offset_in_bytes, zpointer* dst_raw,
130 size_t length);
131 static void oop_arraycopy_in_heap(arrayOop src_obj, size_t src_offset_in_bytes, oop* src_raw,
132 arrayOop dst_obj, size_t dst_offset_in_bytes, oop* dst_raw,
133 size_t length) {
134 oop_arraycopy_in_heap(src_obj, src_offset_in_bytes, (zpointer*)src_raw,
135 dst_obj, dst_offset_in_bytes, (zpointer*)dst_raw,
136 length);
137 }
138 static void oop_arraycopy_in_heap(arrayOop src_obj, size_t src_offset_in_bytes, narrowOop* src_raw,
139 arrayOop dst_obj, size_t dst_offset_in_bytes, narrowOop* dst_raw,
140 size_t length) { unsupported(); }
141
142 static void clone_in_heap(oop src, oop dst, size_t size);
143
144 static void value_copy_in_heap(void* src, void* dst, InlineKlass* md, LayoutKind lk);
145
146 //
147 // Not in heap
148 //
149 static oop oop_load_not_in_heap(zpointer* p);
150 static oop oop_load_not_in_heap(oop* p);
151 static oop oop_load_not_in_heap(narrowOop* p) { unsupported(); return nullptr; }
152
153 static oop oop_atomic_cmpxchg_not_in_heap(zpointer* p, oop compare_value, oop new_value);
154 static oop oop_atomic_cmpxchg_not_in_heap(oop* p, oop compare_value, oop new_value) {
155 return oop_atomic_cmpxchg_not_in_heap((zpointer*)p, compare_value, new_value);
156 }
157 static oop oop_atomic_cmpxchg_not_in_heap(narrowOop* addr, oop compare_value, oop new_value) { unsupported(); return nullptr; }
158
159 static oop oop_atomic_xchg_not_in_heap(zpointer* p, oop new_value);
160 static oop oop_atomic_xchg_not_in_heap(oop* p, oop new_value) { return oop_atomic_xchg_not_in_heap((zpointer*)p, new_value); }
161 static oop oop_atomic_xchg_not_in_heap(narrowOop* p, oop new_value) { unsupported(); return nullptr; }
162 };
163 };
164
165 template<> struct BarrierSet::GetName<ZBarrierSet> {
|