1 /*
2 * Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
3 * Copyright (c) 2014, Red Hat Inc. All rights reserved.
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 *
6 * This code is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 only, as
8 * published by the Free Software Foundation.
9 *
10 * This code is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
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.
65 }
66 ResourceMark rm;
67 BufferBlob* blob = BufferBlob::create(name, BUFFER_SIZE);
68 CodeBuffer cbuf(blob);
69 MacroAssembler* masm = new MacroAssembler(&cbuf);
70 address fast_entry = __ pc();
71
72 Label slow;
73
74 unsigned long offset;
75 __ adrp(rcounter_addr,
76 SafepointSynchronize::safepoint_counter_addr(), offset);
77 Address safepoint_counter_addr(rcounter_addr, offset);
78 __ ldrw(rcounter, safepoint_counter_addr);
79 __ andw(rscratch1, rcounter, 1);
80 __ cbnzw(rscratch1, slow);
81 __ eor(robj, c_rarg1, rcounter);
82 __ eor(robj, robj, rcounter); // obj, since
83 // robj ^ rcounter ^ rcounter == robj
84 // robj is address dependent on rcounter.
85
86 // If mask changes we need to ensure that the inverse is still encodable as an immediate
87 STATIC_ASSERT(JNIHandles::weak_tag_mask == 1);
88 __ andr(robj, robj, ~JNIHandles::weak_tag_mask);
89
90 __ ldr(robj, Address(robj, 0)); // *obj
91 __ lsr(roffset, c_rarg2, 2); // offset
92
93 assert(count < LIST_CAPACITY, "LIST_CAPACITY too small");
94 speculative_load_pclist[count] = __ pc(); // Used by the segfault handler
95 switch (type) {
96 case T_BOOLEAN: __ ldrb (result, Address(robj, roffset)); break;
97 case T_BYTE: __ ldrsb (result, Address(robj, roffset)); break;
98 case T_CHAR: __ ldrh (result, Address(robj, roffset)); break;
99 case T_SHORT: __ ldrsh (result, Address(robj, roffset)); break;
100 case T_FLOAT: __ ldrw (result, Address(robj, roffset)); break;
101 case T_INT: __ ldrsw (result, Address(robj, roffset)); break;
102 case T_DOUBLE:
103 case T_LONG: __ ldr (result, Address(robj, roffset)); break;
104 default: ShouldNotReachHere();
105 }
106
107 // counter_addr is address dependent on result.
108 __ eor(rcounter_addr, rcounter_addr, result);
109 __ eor(rcounter_addr, rcounter_addr, result);
|
1 /*
2 * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
3 * Copyright (c) 2014, Red Hat Inc. All rights reserved.
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 *
6 * This code is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 only, as
8 * published by the Free Software Foundation.
9 *
10 * This code is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
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.
65 }
66 ResourceMark rm;
67 BufferBlob* blob = BufferBlob::create(name, BUFFER_SIZE);
68 CodeBuffer cbuf(blob);
69 MacroAssembler* masm = new MacroAssembler(&cbuf);
70 address fast_entry = __ pc();
71
72 Label slow;
73
74 unsigned long offset;
75 __ adrp(rcounter_addr,
76 SafepointSynchronize::safepoint_counter_addr(), offset);
77 Address safepoint_counter_addr(rcounter_addr, offset);
78 __ ldrw(rcounter, safepoint_counter_addr);
79 __ andw(rscratch1, rcounter, 1);
80 __ cbnzw(rscratch1, slow);
81 __ eor(robj, c_rarg1, rcounter);
82 __ eor(robj, robj, rcounter); // obj, since
83 // robj ^ rcounter ^ rcounter == robj
84 // robj is address dependent on rcounter.
85 __ ldr(robj, Address(robj, 0)); // *obj
86 __ lsr(roffset, c_rarg2, 2); // offset
87
88 assert(count < LIST_CAPACITY, "LIST_CAPACITY too small");
89 speculative_load_pclist[count] = __ pc(); // Used by the segfault handler
90 switch (type) {
91 case T_BOOLEAN: __ ldrb (result, Address(robj, roffset)); break;
92 case T_BYTE: __ ldrsb (result, Address(robj, roffset)); break;
93 case T_CHAR: __ ldrh (result, Address(robj, roffset)); break;
94 case T_SHORT: __ ldrsh (result, Address(robj, roffset)); break;
95 case T_FLOAT: __ ldrw (result, Address(robj, roffset)); break;
96 case T_INT: __ ldrsw (result, Address(robj, roffset)); break;
97 case T_DOUBLE:
98 case T_LONG: __ ldr (result, Address(robj, roffset)); break;
99 default: ShouldNotReachHere();
100 }
101
102 // counter_addr is address dependent on result.
103 __ eor(rcounter_addr, rcounter_addr, result);
104 __ eor(rcounter_addr, rcounter_addr, result);
|