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