14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
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.hpp"
28 #include "gc/shared/barrierSet.hpp"
29 #include "gc/shared/barrierSetAssembler.hpp"
30 #include "memory/resourceArea.hpp"
31 #include "prims/jniFastGetField.hpp"
32 #include "prims/jvm_misc.hpp"
33 #include "prims/jvmtiExport.hpp"
34 #include "runtime/javaThread.inline.hpp"
35 #include "runtime/safepoint.hpp"
36 #include "runtime/threadWXSetters.inline.hpp"
37
38 #define __ masm->
39
40 #define BUFFER_SIZE 30*wordSize
41
42 // Instead of issuing a LoadLoad barrier we create an address
43 // dependency between loads; this might be more efficient.
44
45 // Common register usage:
46 // r0/v0: result
47 // c_rarg0: jni env
48 // c_rarg1: obj
49 // c_rarg2: jfield id
50
51 static const Register robj = r3;
52 static const Register rcounter = r4;
53 static const Register roffset = r5;
136 uint64_t offset2;
137 __ adrp(result,
138 ExternalAddress((address) JvmtiExport::get_field_access_count_addr()),
139 offset2);
140 __ ldrw(result, Address(result, offset2));
141 __ cbnzw(result, slow);
142
143 __ mov(robj, c_rarg1);
144 } else {
145 // Using address dependency to order wrt. load of result.
146 __ eor(robj, c_rarg1, rcounter);
147 __ eor(robj, robj, rcounter); // obj, since
148 // robj ^ rcounter ^ rcounter == robj
149 // robj is address dependent on rcounter.
150 }
151
152 // Both robj and rscratch1 are clobbered by try_resolve_jobject_in_native.
153 BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler();
154 bs->try_resolve_jobject_in_native(masm, c_rarg0, robj, rscratch1, slow);
155
156 __ lsr(roffset, c_rarg2, 2); // offset
157 __ add(result, robj, roffset);
158
159 assert(count < LIST_CAPACITY, "LIST_CAPACITY too small");
160 speculative_load_pclist[count] = __ pc(); // Used by the segfault handler
161 // Using acquire: Order JVMTI check and load of result wrt. succeeding check
162 // (LoadStore for volatile field).
163 switch (type) {
164 case T_BOOLEAN: __ ldarb(result, result); break;
165 case T_BYTE: __ ldarb(result, result); __ sxtb(result, result); break;
166 case T_CHAR: __ ldarh(result, result); break;
167 case T_SHORT: __ ldarh(result, result); __ sxth(result, result); break;
168 case T_FLOAT: __ ldarw(result, result); break;
169 case T_INT: __ ldarw(result, result); __ sxtw(result, result); break;
170 case T_DOUBLE:
171 case T_LONG: __ ldar (result, result); break;
172 default: ShouldNotReachHere();
173 }
174
175 __ ldrw(rscratch1, safepoint_counter_addr);
176 __ cmpw(rcounter, rscratch1);
|
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
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.hpp"
28 #include "gc/shared/barrierSet.hpp"
29 #include "gc/shared/barrierSetAssembler.hpp"
30 #include "memory/resourceArea.hpp"
31 #include "prims/jniFastGetField.hpp"
32 #include "prims/jvm_misc.hpp"
33 #include "prims/jvmtiExport.hpp"
34 #include "runtime/jfieldIDWorkaround.hpp"
35 #include "runtime/javaThread.inline.hpp"
36 #include "runtime/safepoint.hpp"
37 #include "runtime/threadWXSetters.inline.hpp"
38
39 #define __ masm->
40
41 #define BUFFER_SIZE 30*wordSize
42
43 // Instead of issuing a LoadLoad barrier we create an address
44 // dependency between loads; this might be more efficient.
45
46 // Common register usage:
47 // r0/v0: result
48 // c_rarg0: jni env
49 // c_rarg1: obj
50 // c_rarg2: jfield id
51
52 static const Register robj = r3;
53 static const Register rcounter = r4;
54 static const Register roffset = r5;
137 uint64_t offset2;
138 __ adrp(result,
139 ExternalAddress((address) JvmtiExport::get_field_access_count_addr()),
140 offset2);
141 __ ldrw(result, Address(result, offset2));
142 __ cbnzw(result, slow);
143
144 __ mov(robj, c_rarg1);
145 } else {
146 // Using address dependency to order wrt. load of result.
147 __ eor(robj, c_rarg1, rcounter);
148 __ eor(robj, robj, rcounter); // obj, since
149 // robj ^ rcounter ^ rcounter == robj
150 // robj is address dependent on rcounter.
151 }
152
153 // Both robj and rscratch1 are clobbered by try_resolve_jobject_in_native.
154 BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler();
155 bs->try_resolve_jobject_in_native(masm, c_rarg0, robj, rscratch1, slow);
156
157 __ lsr(roffset, c_rarg2, jfieldIDWorkaround::offset_shift); // offset
158 __ add(result, robj, roffset);
159
160 assert(count < LIST_CAPACITY, "LIST_CAPACITY too small");
161 speculative_load_pclist[count] = __ pc(); // Used by the segfault handler
162 // Using acquire: Order JVMTI check and load of result wrt. succeeding check
163 // (LoadStore for volatile field).
164 switch (type) {
165 case T_BOOLEAN: __ ldarb(result, result); break;
166 case T_BYTE: __ ldarb(result, result); __ sxtb(result, result); break;
167 case T_CHAR: __ ldarh(result, result); break;
168 case T_SHORT: __ ldarh(result, result); __ sxth(result, result); break;
169 case T_FLOAT: __ ldarw(result, result); break;
170 case T_INT: __ ldarw(result, result); __ sxtw(result, result); break;
171 case T_DOUBLE:
172 case T_LONG: __ ldar (result, result); break;
173 default: ShouldNotReachHere();
174 }
175
176 __ ldrw(rscratch1, safepoint_counter_addr);
177 __ cmpw(rcounter, rscratch1);
|