1 /*
2 * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
3 * Copyright (c) 2016 SAP SE. 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.
23 *
58 if (stub == NULL) {
59 return NULL; // CodeBuffer::expand failed.
60 }
61 __ relocate(static_stub_Relocation::spec(mark));
62
63 AddressLiteral meta = __ allocate_metadata_address(NULL);
64 bool success = __ load_const_from_toc(as_Register(Matcher::inline_cache_reg_encode()), meta);
65
66 __ set_inst_mark();
67 AddressLiteral a((address)-1);
68 success = success && __ load_const_from_toc(Z_R1, a);
69 if (!success) {
70 return NULL; // CodeCache is full.
71 }
72
73 __ z_br(Z_R1);
74 __ end_a_stub(); // Update current stubs pointer and restore insts_end.
75 return stub;
76 #else
77 ShouldNotReachHere();
78 #endif
79 }
80
81 #undef __
82
83 int CompiledStaticCall::to_interp_stub_size() {
84 return 2 * MacroAssembler::load_const_from_toc_size() +
85 2; // branch
86 }
87
88 // Relocation entries for call stub, compiled java to interpreter.
89 int CompiledStaticCall::reloc_to_interp_stub() {
90 return 5; // 4 in emit_java_to_interp + 1 in Java_Static_Call
91 }
92
93 void CompiledDirectStaticCall::set_to_interpreted(const methodHandle& callee, address entry) {
94 address stub = find_stub(/*is_aot*/ false);
95 guarantee(stub != NULL, "stub not found");
96
97 if (TraceICs) {
|
1 /*
2 * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
3 * Copyright (c) 2016, 2019, SAP SE. 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.
23 *
58 if (stub == NULL) {
59 return NULL; // CodeBuffer::expand failed.
60 }
61 __ relocate(static_stub_Relocation::spec(mark));
62
63 AddressLiteral meta = __ allocate_metadata_address(NULL);
64 bool success = __ load_const_from_toc(as_Register(Matcher::inline_cache_reg_encode()), meta);
65
66 __ set_inst_mark();
67 AddressLiteral a((address)-1);
68 success = success && __ load_const_from_toc(Z_R1, a);
69 if (!success) {
70 return NULL; // CodeCache is full.
71 }
72
73 __ z_br(Z_R1);
74 __ end_a_stub(); // Update current stubs pointer and restore insts_end.
75 return stub;
76 #else
77 ShouldNotReachHere();
78 return NULL;
79 #endif
80 }
81
82 #undef __
83
84 int CompiledStaticCall::to_interp_stub_size() {
85 return 2 * MacroAssembler::load_const_from_toc_size() +
86 2; // branch
87 }
88
89 // Relocation entries for call stub, compiled java to interpreter.
90 int CompiledStaticCall::reloc_to_interp_stub() {
91 return 5; // 4 in emit_java_to_interp + 1 in Java_Static_Call
92 }
93
94 void CompiledDirectStaticCall::set_to_interpreted(const methodHandle& callee, address entry) {
95 address stub = find_stub(/*is_aot*/ false);
96 guarantee(stub != NULL, "stub not found");
97
98 if (TraceICs) {
|