1 /* |
1 /* |
2 * Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
39 // rax/xmm0: result |
39 // rax/xmm0: result |
40 // c_rarg0: jni env |
40 // c_rarg0: jni env |
41 // c_rarg1: obj |
41 // c_rarg1: obj |
42 // c_rarg2: jfield id |
42 // c_rarg2: jfield id |
43 |
43 |
44 static const Register rtmp = r8; |
44 static const Register rtmp = rax; // r8 == c_rarg2 on Windows |
45 static const Register robj = r9; |
45 static const Register robj = r9; |
46 static const Register rcounter = r10; |
46 static const Register roffset = r10; |
47 static const Register roffset = r11; |
47 static const Register rcounter = r11; |
48 static const Register rcounter_addr = r11; |
|
49 |
48 |
50 // Warning: do not use rip relative addressing after the first counter load |
49 // Warning: do not use rip relative addressing after the first counter load |
51 // since that may scratch r10! |
50 // since that may scratch r10! |
52 |
51 |
53 address JNI_FastGetField::generate_fast_get_int_field0(BasicType type) { |
52 address JNI_FastGetField::generate_fast_get_int_field0(BasicType type) { |
72 ExternalAddress counter(SafepointSynchronize::safepoint_counter_addr()); |
71 ExternalAddress counter(SafepointSynchronize::safepoint_counter_addr()); |
73 __ mov32 (rcounter, counter); |
72 __ mov32 (rcounter, counter); |
74 __ mov (robj, c_rarg1); |
73 __ mov (robj, c_rarg1); |
75 __ testb (rcounter, 1); |
74 __ testb (rcounter, 1); |
76 __ jcc (Assembler::notZero, slow); |
75 __ jcc (Assembler::notZero, slow); |
|
76 |
|
77 if (JvmtiExport::can_post_field_access()) { |
|
78 // Check to see if a field access watch has been set before we |
|
79 // take the fast path. |
|
80 assert_different_registers(rscratch1, robj, rcounter); // cmp32 clobbers rscratch1! |
|
81 __ cmp32(ExternalAddress((address) JvmtiExport::get_field_access_count_addr()), 0); |
|
82 __ jcc(Assembler::notZero, slow); |
|
83 } |
|
84 |
77 __ mov (roffset, c_rarg2); |
85 __ mov (roffset, c_rarg2); |
78 __ shrptr(roffset, 2); // offset |
86 __ shrptr(roffset, 2); // offset |
79 |
87 |
80 // Both robj and rtmp are clobbered by try_resolve_jobject_in_native. |
88 // Both robj and rtmp are clobbered by try_resolve_jobject_in_native. |
81 BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler(); |
89 BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler(); |
162 __ mov32 (rcounter, counter); |
170 __ mov32 (rcounter, counter); |
163 __ mov (robj, c_rarg1); |
171 __ mov (robj, c_rarg1); |
164 __ testb (rcounter, 1); |
172 __ testb (rcounter, 1); |
165 __ jcc (Assembler::notZero, slow); |
173 __ jcc (Assembler::notZero, slow); |
166 |
174 |
|
175 if (JvmtiExport::can_post_field_access()) { |
|
176 // Check to see if a field access watch has been set before we |
|
177 // take the fast path. |
|
178 __ cmp32(ExternalAddress((address) JvmtiExport::get_field_access_count_addr()), 0); |
|
179 __ jcc(Assembler::notZero, slow); |
|
180 } |
|
181 |
167 // Both robj and rtmp are clobbered by try_resolve_jobject_in_native. |
182 // Both robj and rtmp are clobbered by try_resolve_jobject_in_native. |
168 BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler(); |
183 BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler(); |
169 bs->try_resolve_jobject_in_native(masm, /* jni_env */ c_rarg0, robj, rtmp, slow); |
184 bs->try_resolve_jobject_in_native(masm, /* jni_env */ c_rarg0, robj, rtmp, slow); |
170 DEBUG_ONLY(__ movl(rtmp, 0xDEADC0DE);) |
185 DEBUG_ONLY(__ movl(rtmp, 0xDEADC0DE);) |
171 |
186 |