Mercurial > hg > truffle
annotate src/cpu/sparc/vm/methodHandles_sparc.cpp @ 4889:869be5c8882e
7142586: Cannot build on Solaris 11 due to use of ia_nice
Summary: Delete the single use of ia_nice in os_solaris.cpp
Reviewed-by: kamg, kvn
author | phh |
---|---|
date | Fri, 03 Feb 2012 17:21:52 -0500 |
parents | 15d394228cfa |
children | 82e5a84b7436 |
rev | line source |
---|---|
710 | 1 /* |
2116
d810e9a3fc33
7010180: JSR 292 InvokeDynamicPrintArgs fails with: assert(_adapter == NULL) failed: init'd to NULL
twisti
parents:
2088
diff
changeset
|
2 * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. |
710 | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | |
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 | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1507
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1507
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1507
diff
changeset
|
21 * questions. |
710 | 22 * |
23 */ | |
24 | |
1972 | 25 #include "precompiled.hpp" |
26 #include "interpreter/interpreter.hpp" | |
27 #include "memory/allocation.inline.hpp" | |
28 #include "prims/methodHandles.hpp" | |
710 | 29 |
30 #define __ _masm-> | |
31 | |
1849
5beba6174298
6987555: JSR 292 unboxing to a boolean value fails on big-endian SPARC
twisti
parents:
1846
diff
changeset
|
32 #ifdef PRODUCT |
5beba6174298
6987555: JSR 292 unboxing to a boolean value fails on big-endian SPARC
twisti
parents:
1846
diff
changeset
|
33 #define BLOCK_COMMENT(str) /* nothing */ |
5beba6174298
6987555: JSR 292 unboxing to a boolean value fails on big-endian SPARC
twisti
parents:
1846
diff
changeset
|
34 #else |
5beba6174298
6987555: JSR 292 unboxing to a boolean value fails on big-endian SPARC
twisti
parents:
1846
diff
changeset
|
35 #define BLOCK_COMMENT(str) __ block_comment(str) |
5beba6174298
6987555: JSR 292 unboxing to a boolean value fails on big-endian SPARC
twisti
parents:
1846
diff
changeset
|
36 #endif |
5beba6174298
6987555: JSR 292 unboxing to a boolean value fails on big-endian SPARC
twisti
parents:
1846
diff
changeset
|
37 |
5beba6174298
6987555: JSR 292 unboxing to a boolean value fails on big-endian SPARC
twisti
parents:
1846
diff
changeset
|
38 #define BIND(label) bind(label); BLOCK_COMMENT(#label ":") |
5beba6174298
6987555: JSR 292 unboxing to a boolean value fails on big-endian SPARC
twisti
parents:
1846
diff
changeset
|
39 |
710 | 40 address MethodHandleEntry::start_compiled_entry(MacroAssembler* _masm, |
41 address interpreted_entry) { | |
1503 | 42 // Just before the actual machine code entry point, allocate space |
43 // for a MethodHandleEntry::Data record, so that we can manage everything | |
44 // from one base pointer. | |
710 | 45 __ align(wordSize); |
46 address target = __ pc() + sizeof(Data); | |
47 while (__ pc() < target) { | |
48 __ nop(); | |
49 __ align(wordSize); | |
50 } | |
51 | |
52 MethodHandleEntry* me = (MethodHandleEntry*) __ pc(); | |
53 me->set_end_address(__ pc()); // set a temporary end_address | |
54 me->set_from_interpreted_entry(interpreted_entry); | |
55 me->set_type_checking_entry(NULL); | |
56 | |
57 return (address) me; | |
58 } | |
59 | |
60 MethodHandleEntry* MethodHandleEntry::finish_compiled_entry(MacroAssembler* _masm, | |
61 address start_addr) { | |
62 MethodHandleEntry* me = (MethodHandleEntry*) start_addr; | |
63 assert(me->end_address() == start_addr, "valid ME"); | |
64 | |
65 // Fill in the real end_address: | |
66 __ align(wordSize); | |
67 me->set_end_address(__ pc()); | |
68 | |
69 return me; | |
70 } | |
71 | |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
72 // stack walking support |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
73 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
74 frame MethodHandles::ricochet_frame_sender(const frame& fr, RegisterMap *map) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
75 //RicochetFrame* f = RicochetFrame::from_frame(fr); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
76 // Cf. is_interpreted_frame path of frame::sender |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
77 intptr_t* younger_sp = fr.sp(); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
78 intptr_t* sp = fr.sender_sp(); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
79 map->make_integer_regs_unsaved(); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
80 map->shift_window(sp, younger_sp); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
81 bool this_frame_adjusted_stack = true; // I5_savedSP is live in this RF |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
82 return frame(sp, younger_sp, this_frame_adjusted_stack); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
83 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
84 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
85 void MethodHandles::ricochet_frame_oops_do(const frame& fr, OopClosure* blk, const RegisterMap* reg_map) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
86 ResourceMark rm; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
87 RicochetFrame* f = RicochetFrame::from_frame(fr); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
88 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
89 // pick up the argument type descriptor: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
90 Thread* thread = Thread::current(); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
91 Handle cookie(thread, f->compute_saved_args_layout(true, true)); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
92 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
93 // process fixed part |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
94 blk->do_oop((oop*)f->saved_target_addr()); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
95 blk->do_oop((oop*)f->saved_args_layout_addr()); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
96 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
97 // process variable arguments: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
98 if (cookie.is_null()) return; // no arguments to describe |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
99 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
100 // the cookie is actually the invokeExact method for my target |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
101 // his argument signature is what I'm interested in |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
102 assert(cookie->is_method(), ""); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
103 methodHandle invoker(thread, methodOop(cookie())); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
104 assert(invoker->name() == vmSymbols::invokeExact_name(), "must be this kind of method"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
105 assert(!invoker->is_static(), "must have MH argument"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
106 int slot_count = invoker->size_of_parameters(); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
107 assert(slot_count >= 1, "must include 'this'"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
108 intptr_t* base = f->saved_args_base(); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
109 intptr_t* retval = NULL; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
110 if (f->has_return_value_slot()) |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
111 retval = f->return_value_slot_addr(); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
112 int slot_num = slot_count - 1; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
113 intptr_t* loc = &base[slot_num]; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
114 //blk->do_oop((oop*) loc); // original target, which is irrelevant |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
115 int arg_num = 0; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
116 for (SignatureStream ss(invoker->signature()); !ss.is_done(); ss.next()) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
117 if (ss.at_return_type()) continue; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
118 BasicType ptype = ss.type(); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
119 if (ptype == T_ARRAY) ptype = T_OBJECT; // fold all refs to T_OBJECT |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
120 assert(ptype >= T_BOOLEAN && ptype <= T_OBJECT, "not array or void"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
121 slot_num -= type2size[ptype]; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
122 loc = &base[slot_num]; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
123 bool is_oop = (ptype == T_OBJECT && loc != retval); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
124 if (is_oop) blk->do_oop((oop*)loc); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
125 arg_num += 1; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
126 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
127 assert(slot_num == 0, "must have processed all the arguments"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
128 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
129 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
130 // Ricochet Frames |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
131 const Register MethodHandles::RicochetFrame::L1_continuation = L1; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
132 const Register MethodHandles::RicochetFrame::L2_saved_target = L2; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
133 const Register MethodHandles::RicochetFrame::L3_saved_args_layout = L3; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
134 const Register MethodHandles::RicochetFrame::L4_saved_args_base = L4; // cf. Gargs = G4 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
135 const Register MethodHandles::RicochetFrame::L5_conversion = L5; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
136 #ifdef ASSERT |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
137 const Register MethodHandles::RicochetFrame::L0_magic_number_1 = L0; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
138 #endif //ASSERT |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
139 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
140 oop MethodHandles::RicochetFrame::compute_saved_args_layout(bool read_cache, bool write_cache) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
141 if (read_cache) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
142 oop cookie = saved_args_layout(); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
143 if (cookie != NULL) return cookie; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
144 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
145 oop target = saved_target(); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
146 oop mtype = java_lang_invoke_MethodHandle::type(target); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
147 oop mtform = java_lang_invoke_MethodType::form(mtype); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
148 oop cookie = java_lang_invoke_MethodTypeForm::vmlayout(mtform); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
149 if (write_cache) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
150 (*saved_args_layout_addr()) = cookie; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
151 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
152 return cookie; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
153 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
154 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
155 void MethodHandles::RicochetFrame::generate_ricochet_blob(MacroAssembler* _masm, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
156 // output params: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
157 int* bounce_offset, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
158 int* exception_offset, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
159 int* frame_size_in_words) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
160 (*frame_size_in_words) = RicochetFrame::frame_size_in_bytes() / wordSize; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
161 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
162 address start = __ pc(); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
163 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
164 #ifdef ASSERT |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
165 __ illtrap(0); __ illtrap(0); __ illtrap(0); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
166 // here's a hint of something special: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
167 __ set(MAGIC_NUMBER_1, G0); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
168 __ set(MAGIC_NUMBER_2, G0); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
169 #endif //ASSERT |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
170 __ illtrap(0); // not reached |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
171 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
172 // Return values are in registers. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
173 // L1_continuation contains a cleanup continuation we must return |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
174 // to. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
175 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
176 (*bounce_offset) = __ pc() - start; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
177 BLOCK_COMMENT("ricochet_blob.bounce"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
178 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
179 if (VerifyMethodHandles) RicochetFrame::verify_clean(_masm); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
180 trace_method_handle(_masm, "ricochet_blob.bounce"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
181 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
182 __ JMP(L1_continuation, 0); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
183 __ delayed()->nop(); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
184 __ illtrap(0); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
185 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
186 DEBUG_ONLY(__ set(MAGIC_NUMBER_2, G0)); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
187 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
188 (*exception_offset) = __ pc() - start; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
189 BLOCK_COMMENT("ricochet_blob.exception"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
190 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
191 // compare this to Interpreter::rethrow_exception_entry, which is parallel code |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
192 // for example, see TemplateInterpreterGenerator::generate_throw_exception |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
193 // Live registers in: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
194 // Oexception (O0): exception |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
195 // Oissuing_pc (O1): return address/pc that threw exception (ignored, always equal to bounce addr) |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
196 __ verify_oop(Oexception); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
197 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
198 // Take down the frame. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
199 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
200 // Cf. InterpreterMacroAssembler::remove_activation. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
201 leave_ricochet_frame(_masm, /*recv_reg=*/ noreg, I5_savedSP, I7); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
202 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
203 // We are done with this activation frame; find out where to go next. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
204 // The continuation point will be an exception handler, which expects |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
205 // the following registers set up: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
206 // |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
207 // Oexception: exception |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
208 // Oissuing_pc: the local call that threw exception |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
209 // Other On: garbage |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
210 // In/Ln: the contents of the caller's register window |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
211 // |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
212 // We do the required restore at the last possible moment, because we |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
213 // need to preserve some state across a runtime call. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
214 // (Remember that the caller activation is unknown--it might not be |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
215 // interpreted, so things like Lscratch are useless in the caller.) |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
216 __ mov(Oexception, Oexception ->after_save()); // get exception in I0 so it will be on O0 after restore |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
217 __ add(I7, frame::pc_return_offset, Oissuing_pc->after_save()); // likewise set I1 to a value local to the caller |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
218 __ call_VM_leaf(L7_thread_cache, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
219 CAST_FROM_FN_PTR(address, SharedRuntime::exception_handler_for_return_address), |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
220 G2_thread, Oissuing_pc->after_save()); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
221 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
222 // The caller's SP was adjusted upon method entry to accomodate |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
223 // the callee's non-argument locals. Undo that adjustment. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
224 __ JMP(O0, 0); // return exception handler in caller |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
225 __ delayed()->restore(I5_savedSP, G0, SP); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
226 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
227 // (same old exception object is already in Oexception; see above) |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
228 // Note that an "issuing PC" is actually the next PC after the call |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
229 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
230 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
231 void MethodHandles::RicochetFrame::enter_ricochet_frame(MacroAssembler* _masm, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
232 Register recv_reg, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
233 Register argv_reg, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
234 address return_handler) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
235 // does not include the __ save() |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
236 assert(argv_reg == Gargs, ""); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
237 Address G3_mh_vmtarget( recv_reg, java_lang_invoke_MethodHandle::vmtarget_offset_in_bytes()); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
238 Address G3_amh_conversion(recv_reg, java_lang_invoke_AdapterMethodHandle::conversion_offset_in_bytes()); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
239 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
240 // Create the RicochetFrame. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
241 // Unlike on x86 we can store all required information in local |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
242 // registers. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
243 BLOCK_COMMENT("push RicochetFrame {"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
244 __ set(ExternalAddress(return_handler), L1_continuation); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
245 __ load_heap_oop(G3_mh_vmtarget, L2_saved_target); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
246 __ mov(G0, L3_saved_args_layout); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
247 __ mov(Gargs, L4_saved_args_base); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
248 __ lduw(G3_amh_conversion, L5_conversion); // 32-bit field |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
249 // I5, I6, I7 are already set up |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
250 DEBUG_ONLY(__ set((int32_t) MAGIC_NUMBER_1, L0_magic_number_1)); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
251 BLOCK_COMMENT("} RicochetFrame"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
252 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
253 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
254 void MethodHandles::RicochetFrame::leave_ricochet_frame(MacroAssembler* _masm, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
255 Register recv_reg, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
256 Register new_sp_reg, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
257 Register sender_pc_reg) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
258 assert(new_sp_reg == I5_savedSP, "exact_sender_sp already in place"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
259 assert(sender_pc_reg == I7, "in a fixed place"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
260 // does not include the __ ret() & __ restore() |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
261 assert_different_registers(recv_reg, new_sp_reg, sender_pc_reg); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
262 // Take down the frame. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
263 // Cf. InterpreterMacroAssembler::remove_activation. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
264 BLOCK_COMMENT("end_ricochet_frame {"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
265 if (recv_reg->is_valid()) |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
266 __ mov(L2_saved_target, recv_reg); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
267 BLOCK_COMMENT("} end_ricochet_frame"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
268 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
269 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
270 // Emit code to verify that FP is pointing at a valid ricochet frame. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
271 #ifdef ASSERT |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
272 enum { |
3757
f8c9417e3571
7052219: JSR 292: Crash in ~BufferBlob::MethodHandles adapters
never
parents:
3753
diff
changeset
|
273 ARG_LIMIT = 255, SLOP = 45, |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
274 // use this parameter for checking for garbage stack movements: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
275 UNREASONABLE_STACK_MOVE = (ARG_LIMIT + SLOP) |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
276 // the slop defends against false alarms due to fencepost errors |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
277 }; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
278 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
279 void MethodHandles::RicochetFrame::verify_clean(MacroAssembler* _masm) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
280 // The stack should look like this: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
281 // ... keep1 | dest=42 | keep2 | magic | handler | magic | recursive args | [RF] |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
282 // Check various invariants. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
283 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
284 Register O7_temp = O7, O5_temp = O5; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
285 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
286 Label L_ok_1, L_ok_2, L_ok_3, L_ok_4; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
287 BLOCK_COMMENT("verify_clean {"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
288 // Magic numbers must check out: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
289 __ set((int32_t) MAGIC_NUMBER_1, O7_temp); |
3839 | 290 __ cmp_and_br_short(O7_temp, L0_magic_number_1, Assembler::equal, Assembler::pt, L_ok_1); |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
291 __ stop("damaged ricochet frame: MAGIC_NUMBER_1 not found"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
292 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
293 __ BIND(L_ok_1); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
294 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
295 // Arguments pointer must look reasonable: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
296 #ifdef _LP64 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
297 Register FP_temp = O5_temp; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
298 __ add(FP, STACK_BIAS, FP_temp); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
299 #else |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
300 Register FP_temp = FP; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
301 #endif |
3839 | 302 __ cmp_and_brx_short(L4_saved_args_base, FP_temp, Assembler::greaterEqualUnsigned, Assembler::pt, L_ok_2); |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
303 __ stop("damaged ricochet frame: L4 < FP"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
304 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
305 __ BIND(L_ok_2); |
3781
d83ac25d0304
7055355: JSR 292: crash while throwing WrongMethodTypeException
never
parents:
3757
diff
changeset
|
306 // Disable until we decide on it's fate |
d83ac25d0304
7055355: JSR 292: crash while throwing WrongMethodTypeException
never
parents:
3757
diff
changeset
|
307 // __ sub(L4_saved_args_base, UNREASONABLE_STACK_MOVE * Interpreter::stackElementSize, O7_temp); |
d83ac25d0304
7055355: JSR 292: crash while throwing WrongMethodTypeException
never
parents:
3757
diff
changeset
|
308 // __ cmp(O7_temp, FP_temp); |
d83ac25d0304
7055355: JSR 292: crash while throwing WrongMethodTypeException
never
parents:
3757
diff
changeset
|
309 // __ br(Assembler::lessEqualUnsigned, false, Assembler::pt, L_ok_3); |
d83ac25d0304
7055355: JSR 292: crash while throwing WrongMethodTypeException
never
parents:
3757
diff
changeset
|
310 // __ delayed()->nop(); |
d83ac25d0304
7055355: JSR 292: crash while throwing WrongMethodTypeException
never
parents:
3757
diff
changeset
|
311 // __ stop("damaged ricochet frame: (L4 - UNREASONABLE_STACK_MOVE) > FP"); |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
312 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
313 __ BIND(L_ok_3); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
314 extract_conversion_dest_type(_masm, L5_conversion, O7_temp); |
3839 | 315 __ cmp_and_br_short(O7_temp, T_VOID, Assembler::equal, Assembler::pt, L_ok_4); |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
316 extract_conversion_vminfo(_masm, L5_conversion, O5_temp); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
317 __ ld_ptr(L4_saved_args_base, __ argument_offset(O5_temp, O5_temp), O7_temp); |
4114
6729bbc1fcd6
7003454: order constants in constant table by number of references in code
twisti
parents:
4059
diff
changeset
|
318 assert(Assembler::is_simm13(RETURN_VALUE_PLACEHOLDER), "must be simm13"); |
3839 | 319 __ cmp_and_brx_short(O7_temp, (int32_t) RETURN_VALUE_PLACEHOLDER, Assembler::equal, Assembler::pt, L_ok_4); |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
320 __ stop("damaged ricochet frame: RETURN_VALUE_PLACEHOLDER not found"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
321 __ BIND(L_ok_4); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
322 BLOCK_COMMENT("} verify_clean"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
323 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
324 #endif //ASSERT |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
325 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
326 void MethodHandles::load_klass_from_Class(MacroAssembler* _masm, Register klass_reg, Register temp_reg, Register temp2_reg) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
327 if (VerifyMethodHandles) |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
328 verify_klass(_masm, klass_reg, SystemDictionaryHandles::Class_klass(), temp_reg, temp2_reg, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
329 "AMH argument is a Class"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
330 __ load_heap_oop(Address(klass_reg, java_lang_Class::klass_offset_in_bytes()), klass_reg); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
331 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
332 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
333 void MethodHandles::load_conversion_vminfo(MacroAssembler* _masm, Address conversion_field_addr, Register reg) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
334 assert(CONV_VMINFO_SHIFT == 0, "preshifted"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
335 assert(CONV_VMINFO_MASK == right_n_bits(BitsPerByte), "else change type of following load"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
336 __ ldub(conversion_field_addr.plus_disp(BytesPerInt - 1), reg); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
337 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
338 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
339 void MethodHandles::extract_conversion_vminfo(MacroAssembler* _masm, Register conversion_field_reg, Register reg) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
340 assert(CONV_VMINFO_SHIFT == 0, "preshifted"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
341 __ and3(conversion_field_reg, CONV_VMINFO_MASK, reg); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
342 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
343 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
344 void MethodHandles::extract_conversion_dest_type(MacroAssembler* _masm, Register conversion_field_reg, Register reg) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
345 __ srl(conversion_field_reg, CONV_DEST_TYPE_SHIFT, reg); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
346 __ and3(reg, 0x0F, reg); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
347 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
348 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
349 void MethodHandles::load_stack_move(MacroAssembler* _masm, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
350 Address G3_amh_conversion, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
351 Register stack_move_reg) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
352 BLOCK_COMMENT("load_stack_move {"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
353 __ ldsw(G3_amh_conversion, stack_move_reg); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
354 __ sra(stack_move_reg, CONV_STACK_MOVE_SHIFT, stack_move_reg); |
4059
44ce519bc3d1
7104960: JSR 292: +VerifyMethodHandles in product JVM can overflow buffer
never
parents:
3905
diff
changeset
|
355 #ifdef ASSERT |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
356 if (VerifyMethodHandles) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
357 Label L_ok, L_bad; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
358 int32_t stack_move_limit = 0x0800; // extra-large |
3839 | 359 __ cmp_and_br_short(stack_move_reg, stack_move_limit, Assembler::greaterEqual, Assembler::pn, L_bad); |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
360 __ cmp(stack_move_reg, -stack_move_limit); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
361 __ br(Assembler::greater, false, Assembler::pt, L_ok); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
362 __ delayed()->nop(); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
363 __ BIND(L_bad); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
364 __ stop("load_stack_move of garbage value"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
365 __ BIND(L_ok); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
366 } |
4059
44ce519bc3d1
7104960: JSR 292: +VerifyMethodHandles in product JVM can overflow buffer
never
parents:
3905
diff
changeset
|
367 #endif |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
368 BLOCK_COMMENT("} load_stack_move"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
369 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
370 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
371 #ifdef ASSERT |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
372 void MethodHandles::RicochetFrame::verify() const { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
373 assert(magic_number_1() == MAGIC_NUMBER_1, ""); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
374 if (!Universe::heap()->is_gc_active()) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
375 if (saved_args_layout() != NULL) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
376 assert(saved_args_layout()->is_method(), "must be valid oop"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
377 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
378 if (saved_target() != NULL) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
379 assert(java_lang_invoke_MethodHandle::is_instance(saved_target()), "checking frame value"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
380 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
381 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
382 int conv_op = adapter_conversion_op(conversion()); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
383 assert(conv_op == java_lang_invoke_AdapterMethodHandle::OP_COLLECT_ARGS || |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
384 conv_op == java_lang_invoke_AdapterMethodHandle::OP_FOLD_ARGS || |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
385 conv_op == java_lang_invoke_AdapterMethodHandle::OP_PRIM_TO_REF, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
386 "must be a sane conversion"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
387 if (has_return_value_slot()) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
388 assert(*return_value_slot_addr() == RETURN_VALUE_PLACEHOLDER, ""); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
389 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
390 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
391 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
392 void MethodHandles::verify_argslot(MacroAssembler* _masm, Register argslot_reg, Register temp_reg, const char* error_message) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
393 // Verify that argslot lies within (Gargs, FP]. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
394 Label L_ok, L_bad; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
395 BLOCK_COMMENT("verify_argslot {"); |
3839 | 396 __ cmp_and_brx_short(Gargs, argslot_reg, Assembler::greaterUnsigned, Assembler::pn, L_bad); |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
397 __ add(FP, STACK_BIAS, temp_reg); // STACK_BIAS is zero on !_LP64 |
3839 | 398 __ cmp_and_brx_short(argslot_reg, temp_reg, Assembler::lessEqualUnsigned, Assembler::pt, L_ok); |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
399 __ BIND(L_bad); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
400 __ stop(error_message); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
401 __ BIND(L_ok); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
402 BLOCK_COMMENT("} verify_argslot"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
403 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
404 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
405 void MethodHandles::verify_argslots(MacroAssembler* _masm, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
406 RegisterOrConstant arg_slots, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
407 Register arg_slot_base_reg, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
408 Register temp_reg, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
409 Register temp2_reg, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
410 bool negate_argslots, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
411 const char* error_message) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
412 // Verify that [argslot..argslot+size) lies within (Gargs, FP). |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
413 Label L_ok, L_bad; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
414 BLOCK_COMMENT("verify_argslots {"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
415 if (negate_argslots) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
416 if (arg_slots.is_constant()) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
417 arg_slots = -1 * arg_slots.as_constant(); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
418 } else { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
419 __ neg(arg_slots.as_register(), temp_reg); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
420 arg_slots = temp_reg; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
421 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
422 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
423 __ add(arg_slot_base_reg, __ argument_offset(arg_slots, temp_reg), temp_reg); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
424 __ add(FP, STACK_BIAS, temp2_reg); // STACK_BIAS is zero on !_LP64 |
3839 | 425 __ cmp_and_brx_short(temp_reg, temp2_reg, Assembler::greaterUnsigned, Assembler::pn, L_bad); |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
426 // Gargs points to the first word so adjust by BytesPerWord |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
427 __ add(arg_slot_base_reg, BytesPerWord, temp_reg); |
3839 | 428 __ cmp_and_brx_short(Gargs, temp_reg, Assembler::lessEqualUnsigned, Assembler::pt, L_ok); |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
429 __ BIND(L_bad); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
430 __ stop(error_message); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
431 __ BIND(L_ok); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
432 BLOCK_COMMENT("} verify_argslots"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
433 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
434 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
435 // Make sure that arg_slots has the same sign as the given direction. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
436 // If (and only if) arg_slots is a assembly-time constant, also allow it to be zero. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
437 void MethodHandles::verify_stack_move(MacroAssembler* _masm, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
438 RegisterOrConstant arg_slots, int direction) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
439 enum { UNREASONABLE_STACK_MOVE = 256 * 4 }; // limit of 255 arguments |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
440 bool allow_zero = arg_slots.is_constant(); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
441 if (direction == 0) { direction = +1; allow_zero = true; } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
442 assert(stack_move_unit() == -1, "else add extra checks here"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
443 if (arg_slots.is_register()) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
444 Label L_ok, L_bad; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
445 BLOCK_COMMENT("verify_stack_move {"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
446 // __ btst(-stack_move_unit() - 1, arg_slots.as_register()); // no need |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
447 // __ br(Assembler::notZero, false, Assembler::pn, L_bad); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
448 // __ delayed()->nop(); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
449 __ cmp(arg_slots.as_register(), (int32_t) NULL_WORD); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
450 if (direction > 0) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
451 __ br(allow_zero ? Assembler::less : Assembler::lessEqual, false, Assembler::pn, L_bad); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
452 __ delayed()->nop(); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
453 __ cmp(arg_slots.as_register(), (int32_t) UNREASONABLE_STACK_MOVE); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
454 __ br(Assembler::less, false, Assembler::pn, L_ok); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
455 __ delayed()->nop(); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
456 } else { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
457 __ br(allow_zero ? Assembler::greater : Assembler::greaterEqual, false, Assembler::pn, L_bad); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
458 __ delayed()->nop(); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
459 __ cmp(arg_slots.as_register(), (int32_t) -UNREASONABLE_STACK_MOVE); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
460 __ br(Assembler::greater, false, Assembler::pn, L_ok); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
461 __ delayed()->nop(); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
462 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
463 __ BIND(L_bad); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
464 if (direction > 0) |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
465 __ stop("assert arg_slots > 0"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
466 else |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
467 __ stop("assert arg_slots < 0"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
468 __ BIND(L_ok); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
469 BLOCK_COMMENT("} verify_stack_move"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
470 } else { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
471 intptr_t size = arg_slots.as_constant(); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
472 if (direction < 0) size = -size; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
473 assert(size >= 0, "correct direction of constant move"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
474 assert(size < UNREASONABLE_STACK_MOVE, "reasonable size of constant move"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
475 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
476 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
477 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
478 void MethodHandles::verify_klass(MacroAssembler* _masm, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
479 Register obj_reg, KlassHandle klass, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
480 Register temp_reg, Register temp2_reg, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
481 const char* error_message) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
482 oop* klass_addr = klass.raw_value(); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
483 assert(klass_addr >= SystemDictionaryHandles::Object_klass().raw_value() && |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
484 klass_addr <= SystemDictionaryHandles::Long_klass().raw_value(), |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
485 "must be one of the SystemDictionaryHandles"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
486 Label L_ok, L_bad; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
487 BLOCK_COMMENT("verify_klass {"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
488 __ verify_oop(obj_reg); |
3839 | 489 __ br_null_short(obj_reg, Assembler::pn, L_bad); |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
490 __ load_klass(obj_reg, temp_reg); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
491 __ set(ExternalAddress(klass_addr), temp2_reg); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
492 __ ld_ptr(Address(temp2_reg, 0), temp2_reg); |
3839 | 493 __ cmp_and_brx_short(temp_reg, temp2_reg, Assembler::equal, Assembler::pt, L_ok); |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
494 intptr_t super_check_offset = klass->super_check_offset(); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
495 __ ld_ptr(Address(temp_reg, super_check_offset), temp_reg); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
496 __ set(ExternalAddress(klass_addr), temp2_reg); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
497 __ ld_ptr(Address(temp2_reg, 0), temp2_reg); |
3839 | 498 __ cmp_and_brx_short(temp_reg, temp2_reg, Assembler::equal, Assembler::pt, L_ok); |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
499 __ BIND(L_bad); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
500 __ stop(error_message); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
501 __ BIND(L_ok); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
502 BLOCK_COMMENT("} verify_klass"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
503 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
504 #endif // ASSERT |
710 | 505 |
3808
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
506 |
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
507 void MethodHandles::jump_from_method_handle(MacroAssembler* _masm, Register method, Register target, Register temp) { |
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
508 assert(method == G5_method, "interpreter calling convention"); |
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
509 __ verify_oop(method); |
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
510 __ ld_ptr(G5_method, in_bytes(methodOopDesc::from_interpreted_offset()), target); |
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
511 if (JvmtiExport::can_post_interpreter_events()) { |
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
512 // JVMTI events, such as single-stepping, are implemented partly by avoiding running |
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
513 // compiled code in threads for which the event is enabled. Check here for |
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
514 // interp_only_mode if these events CAN be enabled. |
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
515 __ verify_thread(); |
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
516 Label skip_compiled_code; |
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
517 |
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
518 const Address interp_only(G2_thread, JavaThread::interp_only_mode_offset()); |
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
519 __ ld(interp_only, temp); |
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
520 __ tst(temp); |
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
521 __ br(Assembler::notZero, true, Assembler::pn, skip_compiled_code); |
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
522 __ delayed()->ld_ptr(G5_method, in_bytes(methodOopDesc::interpreter_entry_offset()), target); |
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
523 __ bind(skip_compiled_code); |
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
524 } |
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
525 __ jmp(target, 0); |
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
526 __ delayed()->nop(); |
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
527 } |
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
528 |
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
529 |
710 | 530 // Code generation |
531 address MethodHandles::generate_method_handle_interpreter_entry(MacroAssembler* _masm) { | |
1916
e62345fd6a46
6997459: JSR 292 after 6994093 getting: on return to interpreted call, restored SP is corrupted
twisti
parents:
1911
diff
changeset
|
532 // I5_savedSP/O5_savedSP: sender SP (must preserve) |
1503 | 533 // G4 (Gargs): incoming argument list (must preserve) |
1916
e62345fd6a46
6997459: JSR 292 after 6994093 getting: on return to interpreted call, restored SP is corrupted
twisti
parents:
1911
diff
changeset
|
534 // G5_method: invoke methodOop |
1503 | 535 // G3_method_handle: receiver method handle (must load from sp[MethodTypeForm.vmslots]) |
1916
e62345fd6a46
6997459: JSR 292 after 6994093 getting: on return to interpreted call, restored SP is corrupted
twisti
parents:
1911
diff
changeset
|
536 // O0, O1, O2, O3, O4: garbage temps, blown away |
e62345fd6a46
6997459: JSR 292 after 6994093 getting: on return to interpreted call, restored SP is corrupted
twisti
parents:
1911
diff
changeset
|
537 Register O0_mtype = O0; |
1503 | 538 Register O1_scratch = O1; |
1911
fff777a71346
6994093: MethodHandle.invokeGeneric needs porting to SPARC
jrose
parents:
1901
diff
changeset
|
539 Register O2_scratch = O2; |
fff777a71346
6994093: MethodHandle.invokeGeneric needs porting to SPARC
jrose
parents:
1901
diff
changeset
|
540 Register O3_scratch = O3; |
1916
e62345fd6a46
6997459: JSR 292 after 6994093 getting: on return to interpreted call, restored SP is corrupted
twisti
parents:
1911
diff
changeset
|
541 Register O4_argslot = O4; |
1911
fff777a71346
6994093: MethodHandle.invokeGeneric needs porting to SPARC
jrose
parents:
1901
diff
changeset
|
542 Register O4_argbase = O4; |
1503 | 543 |
544 // emit WrongMethodType path first, to enable back-branch from main path | |
545 Label wrong_method_type; | |
546 __ bind(wrong_method_type); | |
1911
fff777a71346
6994093: MethodHandle.invokeGeneric needs porting to SPARC
jrose
parents:
1901
diff
changeset
|
547 Label invoke_generic_slow_path; |
fff777a71346
6994093: MethodHandle.invokeGeneric needs porting to SPARC
jrose
parents:
1901
diff
changeset
|
548 assert(methodOopDesc::intrinsic_id_size_in_bytes() == sizeof(u1), "");; |
fff777a71346
6994093: MethodHandle.invokeGeneric needs porting to SPARC
jrose
parents:
1901
diff
changeset
|
549 __ ldub(Address(G5_method, methodOopDesc::intrinsic_id_offset_in_bytes()), O1_scratch); |
fff777a71346
6994093: MethodHandle.invokeGeneric needs porting to SPARC
jrose
parents:
1901
diff
changeset
|
550 __ cmp(O1_scratch, (int) vmIntrinsics::_invokeExact); |
fff777a71346
6994093: MethodHandle.invokeGeneric needs porting to SPARC
jrose
parents:
1901
diff
changeset
|
551 __ brx(Assembler::notEqual, false, Assembler::pt, invoke_generic_slow_path); |
fff777a71346
6994093: MethodHandle.invokeGeneric needs porting to SPARC
jrose
parents:
1901
diff
changeset
|
552 __ delayed()->nop(); |
1916
e62345fd6a46
6997459: JSR 292 after 6994093 getting: on return to interpreted call, restored SP is corrupted
twisti
parents:
1911
diff
changeset
|
553 __ mov(O0_mtype, G5_method_type); // required by throw_WrongMethodType |
3781
d83ac25d0304
7055355: JSR 292: crash while throwing WrongMethodTypeException
never
parents:
3757
diff
changeset
|
554 __ mov(G3_method_handle, G3_method_handle); // already in this register |
d83ac25d0304
7055355: JSR 292: crash while throwing WrongMethodTypeException
never
parents:
3757
diff
changeset
|
555 // O0 will be filled in with JavaThread in stub |
d83ac25d0304
7055355: JSR 292: crash while throwing WrongMethodTypeException
never
parents:
3757
diff
changeset
|
556 __ jump_to(AddressLiteral(StubRoutines::throw_WrongMethodTypeException_entry()), O3_scratch); |
1503 | 557 __ delayed()->nop(); |
558 | |
559 // here's where control starts out: | |
560 __ align(CodeEntryAlignment); | |
561 address entry_point = __ pc(); | |
562 | |
1911
fff777a71346
6994093: MethodHandle.invokeGeneric needs porting to SPARC
jrose
parents:
1901
diff
changeset
|
563 // fetch the MethodType from the method handle |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
564 // FIXME: Interpreter should transmit pre-popped stack pointer, to locate base of arg list. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
565 // This would simplify several touchy bits of code. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
566 // See 6984712: JSR 292 method handle calls need a clean argument base pointer |
1503 | 567 { |
568 Register tem = G5_method; | |
569 for (jint* pchase = methodOopDesc::method_type_offsets_chain(); (*pchase) != -1; pchase++) { | |
1916
e62345fd6a46
6997459: JSR 292 after 6994093 getting: on return to interpreted call, restored SP is corrupted
twisti
parents:
1911
diff
changeset
|
570 __ ld_ptr(Address(tem, *pchase), O0_mtype); |
e62345fd6a46
6997459: JSR 292 after 6994093 getting: on return to interpreted call, restored SP is corrupted
twisti
parents:
1911
diff
changeset
|
571 tem = O0_mtype; // in case there is another indirection |
1503 | 572 } |
573 } | |
574 | |
575 // given the MethodType, find out where the MH argument is buried | |
2357
8033953d67ff
7012648: move JSR 292 to package java.lang.invoke and adjust names
jrose
parents:
2321
diff
changeset
|
576 __ load_heap_oop(Address(O0_mtype, __ delayed_value(java_lang_invoke_MethodType::form_offset_in_bytes, O1_scratch)), O4_argslot); |
8033953d67ff
7012648: move JSR 292 to package java.lang.invoke and adjust names
jrose
parents:
2321
diff
changeset
|
577 __ ldsw( Address(O4_argslot, __ delayed_value(java_lang_invoke_MethodTypeForm::vmslots_offset_in_bytes, O1_scratch)), O4_argslot); |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
578 __ add(__ argument_address(O4_argslot, O4_argslot, 1), O4_argbase); |
1911
fff777a71346
6994093: MethodHandle.invokeGeneric needs porting to SPARC
jrose
parents:
1901
diff
changeset
|
579 // Note: argument_address uses its input as a scratch register! |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
580 Address mh_receiver_slot_addr(O4_argbase, -Interpreter::stackElementSize); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
581 __ ld_ptr(mh_receiver_slot_addr, G3_method_handle); |
1911
fff777a71346
6994093: MethodHandle.invokeGeneric needs porting to SPARC
jrose
parents:
1901
diff
changeset
|
582 |
fff777a71346
6994093: MethodHandle.invokeGeneric needs porting to SPARC
jrose
parents:
1901
diff
changeset
|
583 trace_method_handle(_masm, "invokeExact"); |
fff777a71346
6994093: MethodHandle.invokeGeneric needs porting to SPARC
jrose
parents:
1901
diff
changeset
|
584 |
1916
e62345fd6a46
6997459: JSR 292 after 6994093 getting: on return to interpreted call, restored SP is corrupted
twisti
parents:
1911
diff
changeset
|
585 __ check_method_handle_type(O0_mtype, G3_method_handle, O1_scratch, wrong_method_type); |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
586 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
587 // Nobody uses the MH receiver slot after this. Make sure. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
588 DEBUG_ONLY(__ set((int32_t) 0x999999, O1_scratch); __ st_ptr(O1_scratch, mh_receiver_slot_addr)); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
589 |
1911
fff777a71346
6994093: MethodHandle.invokeGeneric needs porting to SPARC
jrose
parents:
1901
diff
changeset
|
590 __ jump_to_method_handle_entry(G3_method_handle, O1_scratch); |
fff777a71346
6994093: MethodHandle.invokeGeneric needs porting to SPARC
jrose
parents:
1901
diff
changeset
|
591 |
fff777a71346
6994093: MethodHandle.invokeGeneric needs porting to SPARC
jrose
parents:
1901
diff
changeset
|
592 // for invokeGeneric (only), apply argument and result conversions on the fly |
fff777a71346
6994093: MethodHandle.invokeGeneric needs porting to SPARC
jrose
parents:
1901
diff
changeset
|
593 __ bind(invoke_generic_slow_path); |
fff777a71346
6994093: MethodHandle.invokeGeneric needs porting to SPARC
jrose
parents:
1901
diff
changeset
|
594 #ifdef ASSERT |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
595 if (VerifyMethodHandles) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
596 Label L; |
1911
fff777a71346
6994093: MethodHandle.invokeGeneric needs porting to SPARC
jrose
parents:
1901
diff
changeset
|
597 __ ldub(Address(G5_method, methodOopDesc::intrinsic_id_offset_in_bytes()), O1_scratch); |
fff777a71346
6994093: MethodHandle.invokeGeneric needs porting to SPARC
jrose
parents:
1901
diff
changeset
|
598 __ cmp(O1_scratch, (int) vmIntrinsics::_invokeGeneric); |
fff777a71346
6994093: MethodHandle.invokeGeneric needs porting to SPARC
jrose
parents:
1901
diff
changeset
|
599 __ brx(Assembler::equal, false, Assembler::pt, L); |
fff777a71346
6994093: MethodHandle.invokeGeneric needs porting to SPARC
jrose
parents:
1901
diff
changeset
|
600 __ delayed()->nop(); |
fff777a71346
6994093: MethodHandle.invokeGeneric needs porting to SPARC
jrose
parents:
1901
diff
changeset
|
601 __ stop("bad methodOop::intrinsic_id"); |
fff777a71346
6994093: MethodHandle.invokeGeneric needs porting to SPARC
jrose
parents:
1901
diff
changeset
|
602 __ bind(L); |
fff777a71346
6994093: MethodHandle.invokeGeneric needs porting to SPARC
jrose
parents:
1901
diff
changeset
|
603 } |
fff777a71346
6994093: MethodHandle.invokeGeneric needs porting to SPARC
jrose
parents:
1901
diff
changeset
|
604 #endif //ASSERT |
1503 | 605 |
1911
fff777a71346
6994093: MethodHandle.invokeGeneric needs porting to SPARC
jrose
parents:
1901
diff
changeset
|
606 // make room on the stack for another pointer: |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
607 insert_arg_slots(_masm, 2 * stack_move_unit(), O4_argbase, O1_scratch, O2_scratch, O3_scratch); |
1911
fff777a71346
6994093: MethodHandle.invokeGeneric needs porting to SPARC
jrose
parents:
1901
diff
changeset
|
608 // load up an adapter from the calling type (Java weaves this) |
fff777a71346
6994093: MethodHandle.invokeGeneric needs porting to SPARC
jrose
parents:
1901
diff
changeset
|
609 Register O2_form = O2_scratch; |
fff777a71346
6994093: MethodHandle.invokeGeneric needs porting to SPARC
jrose
parents:
1901
diff
changeset
|
610 Register O3_adapter = O3_scratch; |
2357
8033953d67ff
7012648: move JSR 292 to package java.lang.invoke and adjust names
jrose
parents:
2321
diff
changeset
|
611 __ load_heap_oop(Address(O0_mtype, __ delayed_value(java_lang_invoke_MethodType::form_offset_in_bytes, O1_scratch)), O2_form); |
3371
fabcf26ee72f
6998541: JSR 292 implement missing return-type conversion for OP_RETYPE_RAW
twisti
parents:
3342
diff
changeset
|
612 __ load_heap_oop(Address(O2_form, __ delayed_value(java_lang_invoke_MethodTypeForm::genericInvoker_offset_in_bytes, O1_scratch)), O3_adapter); |
fabcf26ee72f
6998541: JSR 292 implement missing return-type conversion for OP_RETYPE_RAW
twisti
parents:
3342
diff
changeset
|
613 __ verify_oop(O3_adapter); |
1911
fff777a71346
6994093: MethodHandle.invokeGeneric needs porting to SPARC
jrose
parents:
1901
diff
changeset
|
614 __ st_ptr(O3_adapter, Address(O4_argbase, 1 * Interpreter::stackElementSize)); |
fff777a71346
6994093: MethodHandle.invokeGeneric needs porting to SPARC
jrose
parents:
1901
diff
changeset
|
615 // As a trusted first argument, pass the type being called, so the adapter knows |
fff777a71346
6994093: MethodHandle.invokeGeneric needs porting to SPARC
jrose
parents:
1901
diff
changeset
|
616 // the actual types of the arguments and return values. |
fff777a71346
6994093: MethodHandle.invokeGeneric needs porting to SPARC
jrose
parents:
1901
diff
changeset
|
617 // (Generic invokers are shared among form-families of method-type.) |
1916
e62345fd6a46
6997459: JSR 292 after 6994093 getting: on return to interpreted call, restored SP is corrupted
twisti
parents:
1911
diff
changeset
|
618 __ st_ptr(O0_mtype, Address(O4_argbase, 0 * Interpreter::stackElementSize)); |
1911
fff777a71346
6994093: MethodHandle.invokeGeneric needs porting to SPARC
jrose
parents:
1901
diff
changeset
|
619 // FIXME: assert that O3_adapter is of the right method-type. |
fff777a71346
6994093: MethodHandle.invokeGeneric needs porting to SPARC
jrose
parents:
1901
diff
changeset
|
620 __ mov(O3_adapter, G3_method_handle); |
fff777a71346
6994093: MethodHandle.invokeGeneric needs porting to SPARC
jrose
parents:
1901
diff
changeset
|
621 trace_method_handle(_masm, "invokeGeneric"); |
1503 | 622 __ jump_to_method_handle_entry(G3_method_handle, O1_scratch); |
623 | |
624 return entry_point; | |
710 | 625 } |
626 | |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
627 // Workaround for C++ overloading nastiness on '0' for RegisterOrConstant. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
628 static RegisterOrConstant constant(int value) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
629 return RegisterOrConstant(value); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
630 } |
1503 | 631 |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
632 static void load_vmargslot(MacroAssembler* _masm, Address vmargslot_addr, Register result) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
633 __ ldsw(vmargslot_addr, result); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
634 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
635 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
636 static RegisterOrConstant adjust_SP_and_Gargs_down_by_slots(MacroAssembler* _masm, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
637 RegisterOrConstant arg_slots, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
638 Register temp_reg, Register temp2_reg) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
639 // Keep the stack pointer 2*wordSize aligned. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
640 const int TwoWordAlignmentMask = right_n_bits(LogBytesPerWord + 1); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
641 if (arg_slots.is_constant()) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
642 const int offset = arg_slots.as_constant() << LogBytesPerWord; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
643 const int masked_offset = round_to(offset, 2 * BytesPerWord); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
644 const int masked_offset2 = (offset + 1*BytesPerWord) & ~TwoWordAlignmentMask; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
645 assert(masked_offset == masked_offset2, "must agree"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
646 __ sub(Gargs, offset, Gargs); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
647 __ sub(SP, masked_offset, SP ); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
648 return offset; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
649 } else { |
1503 | 650 #ifdef ASSERT |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
651 { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
652 Label L_ok; |
3839 | 653 __ cmp_and_br_short(arg_slots.as_register(), 0, Assembler::greaterEqual, Assembler::pt, L_ok); |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
654 __ stop("negative arg_slots"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
655 __ bind(L_ok); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
656 } |
1503 | 657 #endif |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
658 __ sll_ptr(arg_slots.as_register(), LogBytesPerWord, temp_reg); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
659 __ add( temp_reg, 1*BytesPerWord, temp2_reg); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
660 __ andn(temp2_reg, TwoWordAlignmentMask, temp2_reg); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
661 __ sub(Gargs, temp_reg, Gargs); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
662 __ sub(SP, temp2_reg, SP ); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
663 return temp_reg; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
664 } |
1503 | 665 } |
666 | |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
667 static RegisterOrConstant adjust_SP_and_Gargs_up_by_slots(MacroAssembler* _masm, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
668 RegisterOrConstant arg_slots, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
669 Register temp_reg, Register temp2_reg) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
670 // Keep the stack pointer 2*wordSize aligned. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
671 const int TwoWordAlignmentMask = right_n_bits(LogBytesPerWord + 1); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
672 if (arg_slots.is_constant()) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
673 const int offset = arg_slots.as_constant() << LogBytesPerWord; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
674 const int masked_offset = offset & ~TwoWordAlignmentMask; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
675 __ add(Gargs, offset, Gargs); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
676 __ add(SP, masked_offset, SP ); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
677 return offset; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
678 } else { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
679 __ sll_ptr(arg_slots.as_register(), LogBytesPerWord, temp_reg); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
680 __ andn(temp_reg, TwoWordAlignmentMask, temp2_reg); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
681 __ add(Gargs, temp_reg, Gargs); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
682 __ add(SP, temp2_reg, SP ); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
683 return temp_reg; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
684 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
685 } |
1503 | 686 |
687 // Helper to insert argument slots into the stack. | |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
688 // arg_slots must be a multiple of stack_move_unit() and < 0 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
689 // argslot_reg is decremented to point to the new (shifted) location of the argslot |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
690 // But, temp_reg ends up holding the original value of argslot_reg. |
1503 | 691 void MethodHandles::insert_arg_slots(MacroAssembler* _masm, |
692 RegisterOrConstant arg_slots, | |
693 Register argslot_reg, | |
694 Register temp_reg, Register temp2_reg, Register temp3_reg) { | |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
695 // allow constant zero |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
696 if (arg_slots.is_constant() && arg_slots.as_constant() == 0) |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
697 return; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
698 |
1503 | 699 assert_different_registers(argslot_reg, temp_reg, temp2_reg, temp3_reg, |
700 (!arg_slots.is_register() ? Gargs : arg_slots.as_register())); | |
701 | |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
702 BLOCK_COMMENT("insert_arg_slots {"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
703 if (VerifyMethodHandles) |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
704 verify_argslot(_masm, argslot_reg, temp_reg, "insertion point must fall within current frame"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
705 if (VerifyMethodHandles) |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
706 verify_stack_move(_masm, arg_slots, -1); |
1503 | 707 |
708 // Make space on the stack for the inserted argument(s). | |
709 // Then pull down everything shallower than argslot_reg. | |
710 // The stacked return address gets pulled down with everything else. | |
711 // That is, copy [sp, argslot) downward by -size words. In pseudo-code: | |
712 // sp -= size; | |
713 // for (temp = sp + size; temp < argslot; temp++) | |
714 // temp[-size] = temp[0] | |
715 // argslot -= size; | |
716 | |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
717 // offset is temp3_reg in case of arg_slots being a register. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
718 RegisterOrConstant offset = adjust_SP_and_Gargs_up_by_slots(_masm, arg_slots, temp3_reg, temp_reg); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
719 __ sub(Gargs, offset, temp_reg); // source pointer for copy |
1503 | 720 |
721 { | |
722 Label loop; | |
1849
5beba6174298
6987555: JSR 292 unboxing to a boolean value fails on big-endian SPARC
twisti
parents:
1846
diff
changeset
|
723 __ BIND(loop); |
1503 | 724 // pull one word down each time through the loop |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
725 __ ld_ptr( Address(temp_reg, 0 ), temp2_reg); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
726 __ st_ptr(temp2_reg, Address(temp_reg, offset) ); |
1503 | 727 __ add(temp_reg, wordSize, temp_reg); |
3839 | 728 __ cmp_and_brx_short(temp_reg, argslot_reg, Assembler::lessUnsigned, Assembler::pt, loop); |
1503 | 729 } |
730 | |
731 // Now move the argslot down, to point to the opened-up space. | |
732 __ add(argslot_reg, offset, argslot_reg); | |
1849
5beba6174298
6987555: JSR 292 unboxing to a boolean value fails on big-endian SPARC
twisti
parents:
1846
diff
changeset
|
733 BLOCK_COMMENT("} insert_arg_slots"); |
1503 | 734 } |
735 | |
736 | |
737 // Helper to remove argument slots from the stack. | |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
738 // arg_slots must be a multiple of stack_move_unit() and > 0 |
1503 | 739 void MethodHandles::remove_arg_slots(MacroAssembler* _masm, |
740 RegisterOrConstant arg_slots, | |
741 Register argslot_reg, | |
742 Register temp_reg, Register temp2_reg, Register temp3_reg) { | |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
743 // allow constant zero |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
744 if (arg_slots.is_constant() && arg_slots.as_constant() == 0) |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
745 return; |
1503 | 746 assert_different_registers(argslot_reg, temp_reg, temp2_reg, temp3_reg, |
747 (!arg_slots.is_register() ? Gargs : arg_slots.as_register())); | |
748 | |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
749 BLOCK_COMMENT("remove_arg_slots {"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
750 if (VerifyMethodHandles) |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
751 verify_argslots(_masm, arg_slots, argslot_reg, temp_reg, temp2_reg, false, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
752 "deleted argument(s) must fall within current frame"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
753 if (VerifyMethodHandles) |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
754 verify_stack_move(_masm, arg_slots, +1); |
1503 | 755 |
756 // Pull up everything shallower than argslot. | |
757 // Then remove the excess space on the stack. | |
758 // The stacked return address gets pulled up with everything else. | |
759 // That is, copy [sp, argslot) upward by size words. In pseudo-code: | |
760 // for (temp = argslot-1; temp >= sp; --temp) | |
761 // temp[size] = temp[0] | |
762 // argslot += size; | |
763 // sp += size; | |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
764 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
765 RegisterOrConstant offset = __ regcon_sll_ptr(arg_slots, LogBytesPerWord, temp3_reg); |
1503 | 766 __ sub(argslot_reg, wordSize, temp_reg); // source pointer for copy |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
767 |
1503 | 768 { |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
769 Label L_loop; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
770 __ BIND(L_loop); |
1503 | 771 // pull one word up each time through the loop |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
772 __ ld_ptr( Address(temp_reg, 0 ), temp2_reg); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
773 __ st_ptr(temp2_reg, Address(temp_reg, offset) ); |
1503 | 774 __ sub(temp_reg, wordSize, temp_reg); |
3839 | 775 __ cmp_and_brx_short(temp_reg, Gargs, Assembler::greaterEqualUnsigned, Assembler::pt, L_loop); |
1503 | 776 } |
777 | |
778 // And adjust the argslot address to point at the deletion point. | |
779 __ add(argslot_reg, offset, argslot_reg); | |
780 | |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
781 // We don't need the offset at this point anymore, just adjust SP and Gargs. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
782 (void) adjust_SP_and_Gargs_up_by_slots(_masm, arg_slots, temp3_reg, temp_reg); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
783 |
1849
5beba6174298
6987555: JSR 292 unboxing to a boolean value fails on big-endian SPARC
twisti
parents:
1846
diff
changeset
|
784 BLOCK_COMMENT("} remove_arg_slots"); |
1503 | 785 } |
786 | |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
787 // Helper to copy argument slots to the top of the stack. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
788 // The sequence starts with argslot_reg and is counted by slot_count |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
789 // slot_count must be a multiple of stack_move_unit() and >= 0 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
790 // This function blows the temps but does not change argslot_reg. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
791 void MethodHandles::push_arg_slots(MacroAssembler* _masm, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
792 Register argslot_reg, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
793 RegisterOrConstant slot_count, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
794 Register temp_reg, Register temp2_reg) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
795 // allow constant zero |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
796 if (slot_count.is_constant() && slot_count.as_constant() == 0) |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
797 return; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
798 assert_different_registers(argslot_reg, temp_reg, temp2_reg, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
799 (!slot_count.is_register() ? Gargs : slot_count.as_register()), |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
800 SP); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
801 assert(Interpreter::stackElementSize == wordSize, "else change this code"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
802 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
803 BLOCK_COMMENT("push_arg_slots {"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
804 if (VerifyMethodHandles) |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
805 verify_stack_move(_masm, slot_count, 0); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
806 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
807 RegisterOrConstant offset = adjust_SP_and_Gargs_down_by_slots(_masm, slot_count, temp2_reg, temp_reg); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
808 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
809 if (slot_count.is_constant()) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
810 for (int i = slot_count.as_constant() - 1; i >= 0; i--) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
811 __ ld_ptr( Address(argslot_reg, i * wordSize), temp_reg); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
812 __ st_ptr(temp_reg, Address(Gargs, i * wordSize)); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
813 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
814 } else { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
815 Label L_plural, L_loop, L_break; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
816 // Emit code to dynamically check for the common cases, zero and one slot. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
817 __ cmp(slot_count.as_register(), (int32_t) 1); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
818 __ br(Assembler::greater, false, Assembler::pn, L_plural); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
819 __ delayed()->nop(); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
820 __ br(Assembler::less, false, Assembler::pn, L_break); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
821 __ delayed()->nop(); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
822 __ ld_ptr( Address(argslot_reg, 0), temp_reg); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
823 __ st_ptr(temp_reg, Address(Gargs, 0)); |
3839 | 824 __ ba_short(L_break); |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
825 __ BIND(L_plural); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
826 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
827 // Loop for 2 or more: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
828 // top = &argslot[slot_count] |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
829 // while (top > argslot) *(--Gargs) = *(--top) |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
830 Register top_reg = temp_reg; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
831 __ add(argslot_reg, offset, top_reg); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
832 __ add(Gargs, offset, Gargs ); // move back up again so we can go down |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
833 __ BIND(L_loop); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
834 __ sub(top_reg, wordSize, top_reg); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
835 __ sub(Gargs, wordSize, Gargs ); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
836 __ ld_ptr( Address(top_reg, 0), temp2_reg); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
837 __ st_ptr(temp2_reg, Address(Gargs, 0)); |
3839 | 838 __ cmp_and_brx_short(top_reg, argslot_reg, Assembler::greaterUnsigned, Assembler::pt, L_loop); |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
839 __ BIND(L_break); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
840 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
841 BLOCK_COMMENT("} push_arg_slots"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
842 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
843 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
844 // in-place movement; no change to Gargs |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
845 // blows temp_reg, temp2_reg |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
846 void MethodHandles::move_arg_slots_up(MacroAssembler* _masm, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
847 Register bottom_reg, // invariant |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
848 Address top_addr, // can use temp_reg |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
849 RegisterOrConstant positive_distance_in_slots, // destroyed if register |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
850 Register temp_reg, Register temp2_reg) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
851 assert_different_registers(bottom_reg, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
852 temp_reg, temp2_reg, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
853 positive_distance_in_slots.register_or_noreg()); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
854 BLOCK_COMMENT("move_arg_slots_up {"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
855 Label L_loop, L_break; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
856 Register top_reg = temp_reg; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
857 if (!top_addr.is_same_address(Address(top_reg, 0))) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
858 __ add(top_addr, top_reg); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
859 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
860 // Detect empty (or broken) loop: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
861 #ifdef ASSERT |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
862 if (VerifyMethodHandles) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
863 // Verify that &bottom < &top (non-empty interval) |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
864 Label L_ok, L_bad; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
865 if (positive_distance_in_slots.is_register()) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
866 __ cmp(positive_distance_in_slots.as_register(), (int32_t) 0); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
867 __ br(Assembler::lessEqual, false, Assembler::pn, L_bad); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
868 __ delayed()->nop(); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
869 } |
3839 | 870 __ cmp_and_brx_short(bottom_reg, top_reg, Assembler::lessUnsigned, Assembler::pt, L_ok); |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
871 __ BIND(L_bad); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
872 __ stop("valid bounds (copy up)"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
873 __ BIND(L_ok); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
874 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
875 #endif |
3839 | 876 __ cmp_and_brx_short(bottom_reg, top_reg, Assembler::greaterEqualUnsigned, Assembler::pn, L_break); |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
877 // work top down to bottom, copying contiguous data upwards |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
878 // In pseudo-code: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
879 // while (--top >= bottom) *(top + distance) = *(top + 0); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
880 RegisterOrConstant offset = __ argument_offset(positive_distance_in_slots, positive_distance_in_slots.register_or_noreg()); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
881 __ BIND(L_loop); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
882 __ sub(top_reg, wordSize, top_reg); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
883 __ ld_ptr( Address(top_reg, 0 ), temp2_reg); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
884 __ st_ptr(temp2_reg, Address(top_reg, offset) ); |
3839 | 885 __ cmp_and_brx_short(top_reg, bottom_reg, Assembler::greaterUnsigned, Assembler::pt, L_loop); |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
886 assert(Interpreter::stackElementSize == wordSize, "else change loop"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
887 __ BIND(L_break); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
888 BLOCK_COMMENT("} move_arg_slots_up"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
889 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
890 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
891 // in-place movement; no change to rsp |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
892 // blows temp_reg, temp2_reg |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
893 void MethodHandles::move_arg_slots_down(MacroAssembler* _masm, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
894 Address bottom_addr, // can use temp_reg |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
895 Register top_reg, // invariant |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
896 RegisterOrConstant negative_distance_in_slots, // destroyed if register |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
897 Register temp_reg, Register temp2_reg) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
898 assert_different_registers(top_reg, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
899 negative_distance_in_slots.register_or_noreg(), |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
900 temp_reg, temp2_reg); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
901 BLOCK_COMMENT("move_arg_slots_down {"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
902 Label L_loop, L_break; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
903 Register bottom_reg = temp_reg; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
904 if (!bottom_addr.is_same_address(Address(bottom_reg, 0))) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
905 __ add(bottom_addr, bottom_reg); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
906 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
907 // Detect empty (or broken) loop: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
908 #ifdef ASSERT |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
909 assert(!negative_distance_in_slots.is_constant() || negative_distance_in_slots.as_constant() < 0, ""); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
910 if (VerifyMethodHandles) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
911 // Verify that &bottom < &top (non-empty interval) |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
912 Label L_ok, L_bad; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
913 if (negative_distance_in_slots.is_register()) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
914 __ cmp(negative_distance_in_slots.as_register(), (int32_t) 0); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
915 __ br(Assembler::greaterEqual, false, Assembler::pn, L_bad); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
916 __ delayed()->nop(); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
917 } |
3839 | 918 __ cmp_and_brx_short(bottom_reg, top_reg, Assembler::lessUnsigned, Assembler::pt, L_ok); |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
919 __ BIND(L_bad); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
920 __ stop("valid bounds (copy down)"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
921 __ BIND(L_ok); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
922 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
923 #endif |
3839 | 924 __ cmp_and_brx_short(bottom_reg, top_reg, Assembler::greaterEqualUnsigned, Assembler::pn, L_break); |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
925 // work bottom up to top, copying contiguous data downwards |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
926 // In pseudo-code: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
927 // while (bottom < top) *(bottom - distance) = *(bottom + 0), bottom++; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
928 RegisterOrConstant offset = __ argument_offset(negative_distance_in_slots, negative_distance_in_slots.register_or_noreg()); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
929 __ BIND(L_loop); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
930 __ ld_ptr( Address(bottom_reg, 0 ), temp2_reg); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
931 __ st_ptr(temp2_reg, Address(bottom_reg, offset) ); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
932 __ add(bottom_reg, wordSize, bottom_reg); |
3839 | 933 __ cmp_and_brx_short(bottom_reg, top_reg, Assembler::lessUnsigned, Assembler::pt, L_loop); |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
934 assert(Interpreter::stackElementSize == wordSize, "else change loop"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
935 __ BIND(L_break); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
936 BLOCK_COMMENT("} move_arg_slots_down"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
937 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
938 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
939 // Copy from a field or array element to a stacked argument slot. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
940 // is_element (ignored) says whether caller is loading an array element instead of an instance field. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
941 void MethodHandles::move_typed_arg(MacroAssembler* _masm, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
942 BasicType type, bool is_element, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
943 Address value_src, Address slot_dest, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
944 Register temp_reg) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
945 assert(!slot_dest.uses(temp_reg), "must be different register"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
946 BLOCK_COMMENT(!is_element ? "move_typed_arg {" : "move_typed_arg { (array element)"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
947 if (type == T_OBJECT || type == T_ARRAY) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
948 __ load_heap_oop(value_src, temp_reg); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
949 __ verify_oop(temp_reg); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
950 __ st_ptr(temp_reg, slot_dest); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
951 } else if (type != T_VOID) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
952 int arg_size = type2aelembytes(type); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
953 bool arg_is_signed = is_signed_subword_type(type); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
954 int slot_size = is_subword_type(type) ? type2aelembytes(T_INT) : arg_size; // store int sub-words as int |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
955 __ load_sized_value( value_src, temp_reg, arg_size, arg_is_signed); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
956 __ store_sized_value(temp_reg, slot_dest, slot_size ); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
957 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
958 BLOCK_COMMENT("} move_typed_arg"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
959 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
960 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
961 // Cf. TemplateInterpreterGenerator::generate_return_entry_for and |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
962 // InterpreterMacroAssembler::save_return_value |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
963 void MethodHandles::move_return_value(MacroAssembler* _masm, BasicType type, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
964 Address return_slot) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
965 BLOCK_COMMENT("move_return_value {"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
966 // Look at the type and pull the value out of the corresponding register. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
967 if (type == T_VOID) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
968 // nothing to do |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
969 } else if (type == T_OBJECT) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
970 __ verify_oop(O0); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
971 __ st_ptr(O0, return_slot); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
972 } else if (type == T_INT || is_subword_type(type)) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
973 int type_size = type2aelembytes(T_INT); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
974 __ store_sized_value(O0, return_slot, type_size); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
975 } else if (type == T_LONG) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
976 // store the value by parts |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
977 // Note: We assume longs are continguous (if misaligned) on the interpreter stack. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
978 #if !defined(_LP64) && defined(COMPILER2) |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
979 __ stx(G1, return_slot); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
980 #else |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
981 #ifdef _LP64 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
982 __ stx(O0, return_slot); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
983 #else |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
984 if (return_slot.has_disp()) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
985 // The displacement is a constant |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
986 __ st(O0, return_slot); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
987 __ st(O1, return_slot.plus_disp(Interpreter::stackElementSize)); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
988 } else { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
989 __ std(O0, return_slot); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
990 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
991 #endif |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
992 #endif |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
993 } else if (type == T_FLOAT) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
994 __ stf(FloatRegisterImpl::S, Ftos_f, return_slot); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
995 } else if (type == T_DOUBLE) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
996 __ stf(FloatRegisterImpl::D, Ftos_f, return_slot); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
997 } else { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
998 ShouldNotReachHere(); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
999 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1000 BLOCK_COMMENT("} move_return_value"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1001 } |
1503 | 1002 |
1003 #ifndef PRODUCT | |
1004 extern "C" void print_method_handle(oop mh); | |
1005 void trace_method_handle_stub(const char* adaptername, | |
3336
2e038ad0c1d0
7009361: JSR 292 Invalid value on stack on solaris-sparc with -Xcomp
never
parents:
3277
diff
changeset
|
1006 oopDesc* mh, |
2e038ad0c1d0
7009361: JSR 292 Invalid value on stack on solaris-sparc with -Xcomp
never
parents:
3277
diff
changeset
|
1007 intptr_t* saved_sp) { |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1008 bool has_mh = (strstr(adaptername, "return/") == NULL); // return adapters don't have mh |
3336
2e038ad0c1d0
7009361: JSR 292 Invalid value on stack on solaris-sparc with -Xcomp
never
parents:
3277
diff
changeset
|
1009 tty->print_cr("MH %s mh="INTPTR_FORMAT " saved_sp=" INTPTR_FORMAT, adaptername, (intptr_t) mh, saved_sp); |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1010 if (has_mh) |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1011 print_method_handle(mh); |
1503 | 1012 } |
1849
5beba6174298
6987555: JSR 292 unboxing to a boolean value fails on big-endian SPARC
twisti
parents:
1846
diff
changeset
|
1013 void MethodHandles::trace_method_handle(MacroAssembler* _masm, const char* adaptername) { |
5beba6174298
6987555: JSR 292 unboxing to a boolean value fails on big-endian SPARC
twisti
parents:
1846
diff
changeset
|
1014 if (!TraceMethodHandles) return; |
5beba6174298
6987555: JSR 292 unboxing to a boolean value fails on big-endian SPARC
twisti
parents:
1846
diff
changeset
|
1015 BLOCK_COMMENT("trace_method_handle {"); |
5beba6174298
6987555: JSR 292 unboxing to a boolean value fails on big-endian SPARC
twisti
parents:
1846
diff
changeset
|
1016 // save: Gargs, O5_savedSP |
5beba6174298
6987555: JSR 292 unboxing to a boolean value fails on big-endian SPARC
twisti
parents:
1846
diff
changeset
|
1017 __ save_frame(16); |
5beba6174298
6987555: JSR 292 unboxing to a boolean value fails on big-endian SPARC
twisti
parents:
1846
diff
changeset
|
1018 __ set((intptr_t) adaptername, O0); |
5beba6174298
6987555: JSR 292 unboxing to a boolean value fails on big-endian SPARC
twisti
parents:
1846
diff
changeset
|
1019 __ mov(G3_method_handle, O1); |
3336
2e038ad0c1d0
7009361: JSR 292 Invalid value on stack on solaris-sparc with -Xcomp
never
parents:
3277
diff
changeset
|
1020 __ mov(I5_savedSP, O2); |
1849
5beba6174298
6987555: JSR 292 unboxing to a boolean value fails on big-endian SPARC
twisti
parents:
1846
diff
changeset
|
1021 __ mov(G3_method_handle, L3); |
5beba6174298
6987555: JSR 292 unboxing to a boolean value fails on big-endian SPARC
twisti
parents:
1846
diff
changeset
|
1022 __ mov(Gargs, L4); |
5beba6174298
6987555: JSR 292 unboxing to a boolean value fails on big-endian SPARC
twisti
parents:
1846
diff
changeset
|
1023 __ mov(G5_method_type, L5); |
5beba6174298
6987555: JSR 292 unboxing to a boolean value fails on big-endian SPARC
twisti
parents:
1846
diff
changeset
|
1024 __ call_VM_leaf(L7, CAST_FROM_FN_PTR(address, trace_method_handle_stub)); |
5beba6174298
6987555: JSR 292 unboxing to a boolean value fails on big-endian SPARC
twisti
parents:
1846
diff
changeset
|
1025 |
5beba6174298
6987555: JSR 292 unboxing to a boolean value fails on big-endian SPARC
twisti
parents:
1846
diff
changeset
|
1026 __ mov(L3, G3_method_handle); |
5beba6174298
6987555: JSR 292 unboxing to a boolean value fails on big-endian SPARC
twisti
parents:
1846
diff
changeset
|
1027 __ mov(L4, Gargs); |
5beba6174298
6987555: JSR 292 unboxing to a boolean value fails on big-endian SPARC
twisti
parents:
1846
diff
changeset
|
1028 __ mov(L5, G5_method_type); |
5beba6174298
6987555: JSR 292 unboxing to a boolean value fails on big-endian SPARC
twisti
parents:
1846
diff
changeset
|
1029 __ restore(); |
5beba6174298
6987555: JSR 292 unboxing to a boolean value fails on big-endian SPARC
twisti
parents:
1846
diff
changeset
|
1030 BLOCK_COMMENT("} trace_method_handle"); |
5beba6174298
6987555: JSR 292 unboxing to a boolean value fails on big-endian SPARC
twisti
parents:
1846
diff
changeset
|
1031 } |
1503 | 1032 #endif // PRODUCT |
1033 | |
1507
cd5dbf694d45
6939134: JSR 292 adjustments to method handle invocation
jrose
parents:
1506
diff
changeset
|
1034 // which conversion op types are implemented here? |
cd5dbf694d45
6939134: JSR 292 adjustments to method handle invocation
jrose
parents:
1506
diff
changeset
|
1035 int MethodHandles::adapter_conversion_ops_supported_mask() { |
2357
8033953d67ff
7012648: move JSR 292 to package java.lang.invoke and adjust names
jrose
parents:
2321
diff
changeset
|
1036 return ((1<<java_lang_invoke_AdapterMethodHandle::OP_RETYPE_ONLY) |
8033953d67ff
7012648: move JSR 292 to package java.lang.invoke and adjust names
jrose
parents:
2321
diff
changeset
|
1037 |(1<<java_lang_invoke_AdapterMethodHandle::OP_RETYPE_RAW) |
8033953d67ff
7012648: move JSR 292 to package java.lang.invoke and adjust names
jrose
parents:
2321
diff
changeset
|
1038 |(1<<java_lang_invoke_AdapterMethodHandle::OP_CHECK_CAST) |
8033953d67ff
7012648: move JSR 292 to package java.lang.invoke and adjust names
jrose
parents:
2321
diff
changeset
|
1039 |(1<<java_lang_invoke_AdapterMethodHandle::OP_PRIM_TO_PRIM) |
8033953d67ff
7012648: move JSR 292 to package java.lang.invoke and adjust names
jrose
parents:
2321
diff
changeset
|
1040 |(1<<java_lang_invoke_AdapterMethodHandle::OP_REF_TO_PRIM) |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1041 // OP_PRIM_TO_REF is below... |
2357
8033953d67ff
7012648: move JSR 292 to package java.lang.invoke and adjust names
jrose
parents:
2321
diff
changeset
|
1042 |(1<<java_lang_invoke_AdapterMethodHandle::OP_SWAP_ARGS) |
8033953d67ff
7012648: move JSR 292 to package java.lang.invoke and adjust names
jrose
parents:
2321
diff
changeset
|
1043 |(1<<java_lang_invoke_AdapterMethodHandle::OP_ROT_ARGS) |
8033953d67ff
7012648: move JSR 292 to package java.lang.invoke and adjust names
jrose
parents:
2321
diff
changeset
|
1044 |(1<<java_lang_invoke_AdapterMethodHandle::OP_DUP_ARGS) |
8033953d67ff
7012648: move JSR 292 to package java.lang.invoke and adjust names
jrose
parents:
2321
diff
changeset
|
1045 |(1<<java_lang_invoke_AdapterMethodHandle::OP_DROP_ARGS) |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1046 // OP_COLLECT_ARGS is below... |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1047 |(1<<java_lang_invoke_AdapterMethodHandle::OP_SPREAD_ARGS) |
4807
15d394228cfa
7111138: delete the obsolete flag -XX:+UseRicochetFrames
jrose
parents:
4762
diff
changeset
|
1048 |( |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1049 java_lang_invoke_MethodTypeForm::vmlayout_offset_in_bytes() <= 0 ? 0 : |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1050 ((1<<java_lang_invoke_AdapterMethodHandle::OP_PRIM_TO_REF) |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1051 |(1<<java_lang_invoke_AdapterMethodHandle::OP_COLLECT_ARGS) |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1052 |(1<<java_lang_invoke_AdapterMethodHandle::OP_FOLD_ARGS) |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1053 ) |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1054 ) |
1507
cd5dbf694d45
6939134: JSR 292 adjustments to method handle invocation
jrose
parents:
1506
diff
changeset
|
1055 ); |
cd5dbf694d45
6939134: JSR 292 adjustments to method handle invocation
jrose
parents:
1506
diff
changeset
|
1056 } |
1503 | 1057 |
1058 //------------------------------------------------------------------------------ | |
1059 // MethodHandles::generate_method_handle_stub | |
1060 // | |
710 | 1061 // Generate an "entry" field for a method handle. |
1062 // This determines how the method handle will respond to calls. | |
2116
d810e9a3fc33
7010180: JSR 292 InvokeDynamicPrintArgs fails with: assert(_adapter == NULL) failed: init'd to NULL
twisti
parents:
2088
diff
changeset
|
1063 void MethodHandles::generate_method_handle_stub(MacroAssembler* _masm, MethodHandles::EntryKind ek) { |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1064 MethodHandles::EntryKind ek_orig = ek_original_kind(ek); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1065 |
1503 | 1066 // Here is the register state during an interpreted call, |
1067 // as set up by generate_method_handle_interpreter_entry(): | |
1068 // - G5: garbage temp (was MethodHandle.invoke methodOop, unused) | |
1069 // - G3: receiver method handle | |
1070 // - O5_savedSP: sender SP (must preserve) | |
1071 | |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1072 const Register O0_scratch = O0; |
2088
8d0b933dda2d
7007377: JSR 292 MethodHandlesTest.testCastFailure fails on SPARC with -Xcomp +DeoptimizeALot
twisti
parents:
2009
diff
changeset
|
1073 const Register O1_scratch = O1; |
8d0b933dda2d
7007377: JSR 292 MethodHandlesTest.testCastFailure fails on SPARC with -Xcomp +DeoptimizeALot
twisti
parents:
2009
diff
changeset
|
1074 const Register O2_scratch = O2; |
8d0b933dda2d
7007377: JSR 292 MethodHandlesTest.testCastFailure fails on SPARC with -Xcomp +DeoptimizeALot
twisti
parents:
2009
diff
changeset
|
1075 const Register O3_scratch = O3; |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1076 const Register O4_scratch = O4; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1077 const Register G5_scratch = G5; |
2088
8d0b933dda2d
7007377: JSR 292 MethodHandlesTest.testCastFailure fails on SPARC with -Xcomp +DeoptimizeALot
twisti
parents:
2009
diff
changeset
|
1078 |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1079 // Often used names: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1080 const Register O0_argslot = O0; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1081 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1082 // Argument registers for _raise_exception: |
2088
8d0b933dda2d
7007377: JSR 292 MethodHandlesTest.testCastFailure fails on SPARC with -Xcomp +DeoptimizeALot
twisti
parents:
2009
diff
changeset
|
1083 const Register O0_code = O0; |
8d0b933dda2d
7007377: JSR 292 MethodHandlesTest.testCastFailure fails on SPARC with -Xcomp +DeoptimizeALot
twisti
parents:
2009
diff
changeset
|
1084 const Register O1_actual = O1; |
8d0b933dda2d
7007377: JSR 292 MethodHandlesTest.testCastFailure fails on SPARC with -Xcomp +DeoptimizeALot
twisti
parents:
2009
diff
changeset
|
1085 const Register O2_required = O2; |
1503 | 1086 |
2357
8033953d67ff
7012648: move JSR 292 to package java.lang.invoke and adjust names
jrose
parents:
2321
diff
changeset
|
1087 guarantee(java_lang_invoke_MethodHandle::vmentry_offset_in_bytes() != 0, "must have offsets"); |
1503 | 1088 |
1089 // Some handy addresses: | |
2357
8033953d67ff
7012648: move JSR 292 to package java.lang.invoke and adjust names
jrose
parents:
2321
diff
changeset
|
1090 Address G3_mh_vmtarget( G3_method_handle, java_lang_invoke_MethodHandle::vmtarget_offset_in_bytes()); |
1503 | 1091 |
2357
8033953d67ff
7012648: move JSR 292 to package java.lang.invoke and adjust names
jrose
parents:
2321
diff
changeset
|
1092 Address G3_dmh_vmindex( G3_method_handle, java_lang_invoke_DirectMethodHandle::vmindex_offset_in_bytes()); |
1503 | 1093 |
2357
8033953d67ff
7012648: move JSR 292 to package java.lang.invoke and adjust names
jrose
parents:
2321
diff
changeset
|
1094 Address G3_bmh_vmargslot( G3_method_handle, java_lang_invoke_BoundMethodHandle::vmargslot_offset_in_bytes()); |
8033953d67ff
7012648: move JSR 292 to package java.lang.invoke and adjust names
jrose
parents:
2321
diff
changeset
|
1095 Address G3_bmh_argument( G3_method_handle, java_lang_invoke_BoundMethodHandle::argument_offset_in_bytes()); |
1503 | 1096 |
2357
8033953d67ff
7012648: move JSR 292 to package java.lang.invoke and adjust names
jrose
parents:
2321
diff
changeset
|
1097 Address G3_amh_vmargslot( G3_method_handle, java_lang_invoke_AdapterMethodHandle::vmargslot_offset_in_bytes()); |
8033953d67ff
7012648: move JSR 292 to package java.lang.invoke and adjust names
jrose
parents:
2321
diff
changeset
|
1098 Address G3_amh_argument ( G3_method_handle, java_lang_invoke_AdapterMethodHandle::argument_offset_in_bytes()); |
8033953d67ff
7012648: move JSR 292 to package java.lang.invoke and adjust names
jrose
parents:
2321
diff
changeset
|
1099 Address G3_amh_conversion(G3_method_handle, java_lang_invoke_AdapterMethodHandle::conversion_offset_in_bytes()); |
1503 | 1100 |
4762
069ab3f976d3
7118863: Move sizeof(klassOopDesc) into the *Klass::*_offset_in_bytes() functions
stefank
parents:
4114
diff
changeset
|
1101 const int java_mirror_offset = in_bytes(Klass::java_mirror_offset()); |
1503 | 1102 |
1103 if (have_entry(ek)) { | |
1104 __ nop(); // empty stubs make SG sick | |
1105 return; | |
1106 } | |
1107 | |
1108 address interp_entry = __ pc(); | |
1109 | |
1849
5beba6174298
6987555: JSR 292 unboxing to a boolean value fails on big-endian SPARC
twisti
parents:
1846
diff
changeset
|
1110 trace_method_handle(_masm, entry_name(ek)); |
1503 | 1111 |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1112 BLOCK_COMMENT(err_msg("Entry %s {", entry_name(ek))); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1113 |
1503 | 1114 switch ((int) ek) { |
1115 case _raise_exception: | |
1116 { | |
1117 // Not a real MH entry, but rather shared code for raising an | |
3808
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
1118 // exception. For sharing purposes the arguments are passed into registers |
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
1119 // and then placed in the intepreter calling convention here. |
2116
d810e9a3fc33
7010180: JSR 292 InvokeDynamicPrintArgs fails with: assert(_adapter == NULL) failed: init'd to NULL
twisti
parents:
2088
diff
changeset
|
1120 assert(raise_exception_method(), "must be set"); |
2321
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2258
diff
changeset
|
1121 assert(raise_exception_method()->from_compiled_entry(), "method must be linked"); |
1503 | 1122 |
1123 __ set(AddressLiteral((address) &_raise_exception_method), G5_method); | |
1124 __ ld_ptr(Address(G5_method, 0), G5_method); | |
1125 | |
2088
8d0b933dda2d
7007377: JSR 292 MethodHandlesTest.testCastFailure fails on SPARC with -Xcomp +DeoptimizeALot
twisti
parents:
2009
diff
changeset
|
1126 const int jobject_oop_offset = 0; |
1503 | 1127 __ ld_ptr(Address(G5_method, jobject_oop_offset), G5_method); |
1128 | |
3808
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
1129 adjust_SP_and_Gargs_down_by_slots(_masm, 3, noreg, noreg); |
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
1130 |
3848 | 1131 __ st (O0_code, __ argument_address(constant(2), noreg, 0)); |
3808
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
1132 __ st_ptr(O1_actual, __ argument_address(constant(1), noreg, 0)); |
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
1133 __ st_ptr(O2_required, __ argument_address(constant(0), noreg, 0)); |
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
1134 jump_from_method_handle(_masm, G5_method, O1_scratch, O2_scratch); |
1503 | 1135 } |
1136 break; | |
1137 | |
1138 case _invokestatic_mh: | |
1139 case _invokespecial_mh: | |
1140 { | |
1846 | 1141 __ load_heap_oop(G3_mh_vmtarget, G5_method); // target is a methodOop |
1503 | 1142 // Same as TemplateTable::invokestatic or invokespecial, |
1143 // minus the CP setup and profiling: | |
1144 if (ek == _invokespecial_mh) { | |
1145 // Must load & check the first argument before entering the target method. | |
1146 __ load_method_handle_vmslots(O0_argslot, G3_method_handle, O1_scratch); | |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1147 __ ld_ptr(__ argument_address(O0_argslot, O0_argslot, -1), G3_method_handle); |
1503 | 1148 __ null_check(G3_method_handle); |
1149 __ verify_oop(G3_method_handle); | |
1150 } | |
3808
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
1151 jump_from_method_handle(_masm, G5_method, O1_scratch, O2_scratch); |
1503 | 1152 } |
1153 break; | |
1154 | |
1155 case _invokevirtual_mh: | |
1156 { | |
1157 // Same as TemplateTable::invokevirtual, | |
1158 // minus the CP setup and profiling: | |
1159 | |
1160 // Pick out the vtable index and receiver offset from the MH, | |
1161 // and then we can discard it: | |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1162 Register O2_index = O2_scratch; |
1503 | 1163 __ load_method_handle_vmslots(O0_argslot, G3_method_handle, O1_scratch); |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1164 __ ldsw(G3_dmh_vmindex, O2_index); |
1503 | 1165 // Note: The verifier allows us to ignore G3_mh_vmtarget. |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1166 __ ld_ptr(__ argument_address(O0_argslot, O0_argslot, -1), G3_method_handle); |
1503 | 1167 __ null_check(G3_method_handle, oopDesc::klass_offset_in_bytes()); |
1168 | |
1169 // Get receiver klass: | |
1170 Register O0_klass = O0_argslot; | |
1171 __ load_klass(G3_method_handle, O0_klass); | |
1172 __ verify_oop(O0_klass); | |
1173 | |
1174 // Get target methodOop & entry point: | |
1175 const int base = instanceKlass::vtable_start_offset() * wordSize; | |
1176 assert(vtableEntry::size() * wordSize == wordSize, "adjust the scaling in the code below"); | |
1177 | |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1178 __ sll_ptr(O2_index, LogBytesPerWord, O2_index); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1179 __ add(O0_klass, O2_index, O0_klass); |
1503 | 1180 Address vtable_entry_addr(O0_klass, base + vtableEntry::method_offset_in_bytes()); |
1181 __ ld_ptr(vtable_entry_addr, G5_method); | |
1182 | |
3808
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
1183 jump_from_method_handle(_masm, G5_method, O1_scratch, O2_scratch); |
1503 | 1184 } |
1185 break; | |
1186 | |
1187 case _invokeinterface_mh: | |
1188 { | |
1189 // Same as TemplateTable::invokeinterface, | |
1190 // minus the CP setup and profiling: | |
1191 __ load_method_handle_vmslots(O0_argslot, G3_method_handle, O1_scratch); | |
1192 Register O1_intf = O1_scratch; | |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1193 Register G5_index = G5_scratch; |
1846 | 1194 __ load_heap_oop(G3_mh_vmtarget, O1_intf); |
1503 | 1195 __ ldsw(G3_dmh_vmindex, G5_index); |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1196 __ ld_ptr(__ argument_address(O0_argslot, O0_argslot, -1), G3_method_handle); |
1503 | 1197 __ null_check(G3_method_handle, oopDesc::klass_offset_in_bytes()); |
1198 | |
1199 // Get receiver klass: | |
1200 Register O0_klass = O0_argslot; | |
1201 __ load_klass(G3_method_handle, O0_klass); | |
1202 __ verify_oop(O0_klass); | |
1203 | |
1204 // Get interface: | |
1205 Label no_such_interface; | |
1206 __ verify_oop(O1_intf); | |
1207 __ lookup_interface_method(O0_klass, O1_intf, | |
1208 // Note: next two args must be the same: | |
1209 G5_index, G5_method, | |
1210 O2_scratch, | |
1211 O3_scratch, | |
1212 no_such_interface); | |
1213 | |
3808
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
1214 jump_from_method_handle(_masm, G5_method, O1_scratch, O2_scratch); |
1503 | 1215 |
1216 __ bind(no_such_interface); | |
1217 // Throw an exception. | |
1218 // For historical reasons, it will be IncompatibleClassChangeError. | |
1219 __ unimplemented("not tested yet"); | |
2088
8d0b933dda2d
7007377: JSR 292 MethodHandlesTest.testCastFailure fails on SPARC with -Xcomp +DeoptimizeALot
twisti
parents:
2009
diff
changeset
|
1220 __ ld_ptr(Address(O1_intf, java_mirror_offset), O2_required); // required interface |
8d0b933dda2d
7007377: JSR 292 MethodHandlesTest.testCastFailure fails on SPARC with -Xcomp +DeoptimizeALot
twisti
parents:
2009
diff
changeset
|
1221 __ mov( O0_klass, O1_actual); // bad receiver |
8d0b933dda2d
7007377: JSR 292 MethodHandlesTest.testCastFailure fails on SPARC with -Xcomp +DeoptimizeALot
twisti
parents:
2009
diff
changeset
|
1222 __ jump_to(AddressLiteral(from_interpreted_entry(_raise_exception)), O3_scratch); |
8d0b933dda2d
7007377: JSR 292 MethodHandlesTest.testCastFailure fails on SPARC with -Xcomp +DeoptimizeALot
twisti
parents:
2009
diff
changeset
|
1223 __ delayed()->mov(Bytecodes::_invokeinterface, O0_code); // who is complaining? |
1503 | 1224 } |
1225 break; | |
1226 | |
1227 case _bound_ref_mh: | |
1228 case _bound_int_mh: | |
1229 case _bound_long_mh: | |
1230 case _bound_ref_direct_mh: | |
1231 case _bound_int_direct_mh: | |
1232 case _bound_long_direct_mh: | |
1233 { | |
1234 const bool direct_to_method = (ek >= _bound_ref_direct_mh); | |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1235 BasicType arg_type = ek_bound_mh_arg_type(ek); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1236 int arg_slots = type2size[arg_type]; |
1503 | 1237 |
1238 // Make room for the new argument: | |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1239 load_vmargslot(_masm, G3_bmh_vmargslot, O0_argslot); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1240 __ add(__ argument_address(O0_argslot, O0_argslot), O0_argslot); |
1503 | 1241 |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1242 insert_arg_slots(_masm, arg_slots * stack_move_unit(), O0_argslot, O1_scratch, O2_scratch, O3_scratch); |
1503 | 1243 |
1244 // Store bound argument into the new stack slot: | |
1846 | 1245 __ load_heap_oop(G3_bmh_argument, O1_scratch); |
1503 | 1246 if (arg_type == T_OBJECT) { |
1247 __ st_ptr(O1_scratch, Address(O0_argslot, 0)); | |
1248 } else { | |
1249 Address prim_value_addr(O1_scratch, java_lang_boxing_object::value_offset_in_bytes(arg_type)); | |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1250 move_typed_arg(_masm, arg_type, false, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1251 prim_value_addr, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1252 Address(O0_argslot, 0), |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1253 O2_scratch); // must be an even register for !_LP64 long moves (uses O2/O3) |
1503 | 1254 } |
1255 | |
1256 if (direct_to_method) { | |
1846 | 1257 __ load_heap_oop(G3_mh_vmtarget, G5_method); // target is a methodOop |
3808
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
1258 jump_from_method_handle(_masm, G5_method, O1_scratch, O2_scratch); |
1503 | 1259 } else { |
1846 | 1260 __ load_heap_oop(G3_mh_vmtarget, G3_method_handle); // target is a methodOop |
1503 | 1261 __ verify_oop(G3_method_handle); |
1262 __ jump_to_method_handle_entry(G3_method_handle, O1_scratch); | |
1263 } | |
1264 } | |
1265 break; | |
1266 | |
3905
c26de9aef2ed
7071307: MethodHandle bimorphic inlining should consider the frequency
never
parents:
3848
diff
changeset
|
1267 case _adapter_opt_profiling: |
c26de9aef2ed
7071307: MethodHandle bimorphic inlining should consider the frequency
never
parents:
3848
diff
changeset
|
1268 if (java_lang_invoke_CountingMethodHandle::vmcount_offset_in_bytes() != 0) { |
c26de9aef2ed
7071307: MethodHandle bimorphic inlining should consider the frequency
never
parents:
3848
diff
changeset
|
1269 Address G3_mh_vmcount(G3_method_handle, java_lang_invoke_CountingMethodHandle::vmcount_offset_in_bytes()); |
c26de9aef2ed
7071307: MethodHandle bimorphic inlining should consider the frequency
never
parents:
3848
diff
changeset
|
1270 __ ld(G3_mh_vmcount, O1_scratch); |
c26de9aef2ed
7071307: MethodHandle bimorphic inlining should consider the frequency
never
parents:
3848
diff
changeset
|
1271 __ add(O1_scratch, 1, O1_scratch); |
c26de9aef2ed
7071307: MethodHandle bimorphic inlining should consider the frequency
never
parents:
3848
diff
changeset
|
1272 __ st(O1_scratch, G3_mh_vmcount); |
c26de9aef2ed
7071307: MethodHandle bimorphic inlining should consider the frequency
never
parents:
3848
diff
changeset
|
1273 } |
c26de9aef2ed
7071307: MethodHandle bimorphic inlining should consider the frequency
never
parents:
3848
diff
changeset
|
1274 // fall through |
c26de9aef2ed
7071307: MethodHandle bimorphic inlining should consider the frequency
never
parents:
3848
diff
changeset
|
1275 |
1503 | 1276 case _adapter_retype_only: |
1277 case _adapter_retype_raw: | |
1278 // Immediately jump to the next MH layer: | |
1846 | 1279 __ load_heap_oop(G3_mh_vmtarget, G3_method_handle); |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1280 __ verify_oop(G3_method_handle); |
1503 | 1281 __ jump_to_method_handle_entry(G3_method_handle, O1_scratch); |
1282 // This is OK when all parameter types widen. | |
1283 // It is also OK when a return type narrows. | |
1284 break; | |
1285 | |
1286 case _adapter_check_cast: | |
1287 { | |
1288 // Check a reference argument before jumping to the next layer of MH: | |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1289 load_vmargslot(_masm, G3_amh_vmargslot, O0_argslot); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1290 Address vmarg = __ argument_address(O0_argslot, O0_argslot); |
1503 | 1291 |
1292 // What class are we casting to? | |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1293 Register O1_klass = O1_scratch; // Interesting AMH data. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1294 __ load_heap_oop(G3_amh_argument, O1_klass); // This is a Class object! |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1295 load_klass_from_Class(_masm, O1_klass, O2_scratch, O3_scratch); |
1503 | 1296 |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1297 Label L_done; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1298 __ ld_ptr(vmarg, O2_scratch); |
3839 | 1299 __ br_null_short(O2_scratch, Assembler::pn, L_done); // No cast if null. |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1300 __ load_klass(O2_scratch, O2_scratch); |
1503 | 1301 |
1302 // Live at this point: | |
3342
8d944991dbf9
7041244: JSR 292: Server VM gets a SEGV running a JCK test
twisti
parents:
3336
diff
changeset
|
1303 // - O0_argslot : argslot index in vmarg; may be required in the failing path |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1304 // - O1_klass : klass required by the target method |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1305 // - O2_scratch : argument klass to test |
1503 | 1306 // - G3_method_handle: adapter method handle |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1307 __ check_klass_subtype(O2_scratch, O1_klass, O3_scratch, O4_scratch, L_done); |
1503 | 1308 |
1309 // If we get here, the type check failed! | |
2088
8d0b933dda2d
7007377: JSR 292 MethodHandlesTest.testCastFailure fails on SPARC with -Xcomp +DeoptimizeALot
twisti
parents:
2009
diff
changeset
|
1310 __ load_heap_oop(G3_amh_argument, O2_required); // required class |
8d0b933dda2d
7007377: JSR 292 MethodHandlesTest.testCastFailure fails on SPARC with -Xcomp +DeoptimizeALot
twisti
parents:
2009
diff
changeset
|
1311 __ ld_ptr( vmarg, O1_actual); // bad object |
8d0b933dda2d
7007377: JSR 292 MethodHandlesTest.testCastFailure fails on SPARC with -Xcomp +DeoptimizeALot
twisti
parents:
2009
diff
changeset
|
1312 __ jump_to(AddressLiteral(from_interpreted_entry(_raise_exception)), O3_scratch); |
8d0b933dda2d
7007377: JSR 292 MethodHandlesTest.testCastFailure fails on SPARC with -Xcomp +DeoptimizeALot
twisti
parents:
2009
diff
changeset
|
1313 __ delayed()->mov(Bytecodes::_checkcast, O0_code); // who is complaining? |
1503 | 1314 |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1315 __ BIND(L_done); |
1503 | 1316 // Get the new MH: |
1846 | 1317 __ load_heap_oop(G3_mh_vmtarget, G3_method_handle); |
1503 | 1318 __ jump_to_method_handle_entry(G3_method_handle, O1_scratch); |
1319 } | |
1320 break; | |
1321 | |
1322 case _adapter_prim_to_prim: | |
1323 case _adapter_ref_to_prim: | |
1324 // Handled completely by optimized cases. | |
1325 __ stop("init_AdapterMethodHandle should not issue this"); | |
1326 break; | |
1327 | |
1328 case _adapter_opt_i2i: // optimized subcase of adapt_prim_to_prim | |
1329 //case _adapter_opt_f2i: // optimized subcase of adapt_prim_to_prim | |
1330 case _adapter_opt_l2i: // optimized subcase of adapt_prim_to_prim | |
1331 case _adapter_opt_unboxi: // optimized subcase of adapt_ref_to_prim | |
1332 { | |
1333 // Perform an in-place conversion to int or an int subword. | |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1334 load_vmargslot(_masm, G3_amh_vmargslot, O0_argslot); |
2009
b856cd7f4e60
7003798: test/compiler/6991596 fails with true != false
twisti
parents:
1972
diff
changeset
|
1335 Address value; |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1336 Address vmarg; |
1503 | 1337 bool value_left_justified = false; |
1338 | |
1339 switch (ek) { | |
1340 case _adapter_opt_i2i: | |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1341 value = vmarg = __ argument_address(O0_argslot, O0_argslot); |
1901
7aff5786cc02
6991596: JSR 292 unimplemented adapter_opt_i2i and adapter_opt_l2i on SPARC
twisti
parents:
1849
diff
changeset
|
1342 break; |
1503 | 1343 case _adapter_opt_l2i: |
1901
7aff5786cc02
6991596: JSR 292 unimplemented adapter_opt_i2i and adapter_opt_l2i on SPARC
twisti
parents:
1849
diff
changeset
|
1344 { |
7aff5786cc02
6991596: JSR 292 unimplemented adapter_opt_i2i and adapter_opt_l2i on SPARC
twisti
parents:
1849
diff
changeset
|
1345 // just delete the extra slot |
2009
b856cd7f4e60
7003798: test/compiler/6991596 fails with true != false
twisti
parents:
1972
diff
changeset
|
1346 #ifdef _LP64 |
b856cd7f4e60
7003798: test/compiler/6991596 fails with true != false
twisti
parents:
1972
diff
changeset
|
1347 // In V9, longs are given 2 64-bit slots in the interpreter, but the |
b856cd7f4e60
7003798: test/compiler/6991596 fails with true != false
twisti
parents:
1972
diff
changeset
|
1348 // data is passed in only 1 slot. |
b856cd7f4e60
7003798: test/compiler/6991596 fails with true != false
twisti
parents:
1972
diff
changeset
|
1349 // Keep the second slot. |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1350 __ add(__ argument_address(O0_argslot, O0_argslot, -1), O0_argslot); |
2009
b856cd7f4e60
7003798: test/compiler/6991596 fails with true != false
twisti
parents:
1972
diff
changeset
|
1351 remove_arg_slots(_masm, -stack_move_unit(), O0_argslot, O1_scratch, O2_scratch, O3_scratch); |
b856cd7f4e60
7003798: test/compiler/6991596 fails with true != false
twisti
parents:
1972
diff
changeset
|
1352 value = Address(O0_argslot, 4); // Get least-significant 32-bit of 64-bit value. |
b856cd7f4e60
7003798: test/compiler/6991596 fails with true != false
twisti
parents:
1972
diff
changeset
|
1353 vmarg = Address(O0_argslot, Interpreter::stackElementSize); |
b856cd7f4e60
7003798: test/compiler/6991596 fails with true != false
twisti
parents:
1972
diff
changeset
|
1354 #else |
b856cd7f4e60
7003798: test/compiler/6991596 fails with true != false
twisti
parents:
1972
diff
changeset
|
1355 // Keep the first slot. |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1356 __ add(__ argument_address(O0_argslot, O0_argslot), O0_argslot); |
1901
7aff5786cc02
6991596: JSR 292 unimplemented adapter_opt_i2i and adapter_opt_l2i on SPARC
twisti
parents:
1849
diff
changeset
|
1357 remove_arg_slots(_masm, -stack_move_unit(), O0_argslot, O1_scratch, O2_scratch, O3_scratch); |
2009
b856cd7f4e60
7003798: test/compiler/6991596 fails with true != false
twisti
parents:
1972
diff
changeset
|
1358 value = Address(O0_argslot, 0); |
b856cd7f4e60
7003798: test/compiler/6991596 fails with true != false
twisti
parents:
1972
diff
changeset
|
1359 vmarg = value; |
b856cd7f4e60
7003798: test/compiler/6991596 fails with true != false
twisti
parents:
1972
diff
changeset
|
1360 #endif |
1901
7aff5786cc02
6991596: JSR 292 unimplemented adapter_opt_i2i and adapter_opt_l2i on SPARC
twisti
parents:
1849
diff
changeset
|
1361 } |
1503 | 1362 break; |
1363 case _adapter_opt_unboxi: | |
1364 { | |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1365 vmarg = __ argument_address(O0_argslot, O0_argslot); |
1503 | 1366 // Load the value up from the heap. |
1367 __ ld_ptr(vmarg, O1_scratch); | |
1368 int value_offset = java_lang_boxing_object::value_offset_in_bytes(T_INT); | |
1369 #ifdef ASSERT | |
1370 for (int bt = T_BOOLEAN; bt < T_INT; bt++) { | |
1371 if (is_subword_type(BasicType(bt))) | |
1372 assert(value_offset == java_lang_boxing_object::value_offset_in_bytes(BasicType(bt)), ""); | |
1373 } | |
1374 #endif | |
1375 __ null_check(O1_scratch, value_offset); | |
1376 value = Address(O1_scratch, value_offset); | |
1377 #ifdef _BIG_ENDIAN | |
1378 // Values stored in objects are packed. | |
1379 value_left_justified = true; | |
1380 #endif | |
1381 } | |
1382 break; | |
1383 default: | |
1384 ShouldNotReachHere(); | |
1385 } | |
1386 | |
1387 // This check is required on _BIG_ENDIAN | |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1388 Register G5_vminfo = G5_scratch; |
1503 | 1389 __ ldsw(G3_amh_conversion, G5_vminfo); |
1390 assert(CONV_VMINFO_SHIFT == 0, "preshifted"); | |
1391 | |
1392 // Original 32-bit vmdata word must be of this form: | |
1393 // | MBZ:6 | signBitCount:8 | srcDstTypes:8 | conversionOp:8 | | |
1394 __ lduw(value, O1_scratch); | |
1395 if (!value_left_justified) | |
1396 __ sll(O1_scratch, G5_vminfo, O1_scratch); | |
1397 Label zero_extend, done; | |
1398 __ btst(CONV_VMINFO_SIGN_FLAG, G5_vminfo); | |
1399 __ br(Assembler::zero, false, Assembler::pn, zero_extend); | |
1400 __ delayed()->nop(); | |
1401 | |
1402 // this path is taken for int->byte, int->short | |
1403 __ sra(O1_scratch, G5_vminfo, O1_scratch); | |
3839 | 1404 __ ba_short(done); |
1503 | 1405 |
1406 __ bind(zero_extend); | |
1407 // this is taken for int->char | |
1408 __ srl(O1_scratch, G5_vminfo, O1_scratch); | |
1409 | |
1410 __ bind(done); | |
1411 __ st(O1_scratch, vmarg); | |
1412 | |
1413 // Get the new MH: | |
1846 | 1414 __ load_heap_oop(G3_mh_vmtarget, G3_method_handle); |
1503 | 1415 __ jump_to_method_handle_entry(G3_method_handle, O1_scratch); |
1416 } | |
1417 break; | |
1418 | |
1419 case _adapter_opt_i2l: // optimized subcase of adapt_prim_to_prim | |
1420 case _adapter_opt_unboxl: // optimized subcase of adapt_ref_to_prim | |
1421 { | |
1422 // Perform an in-place int-to-long or ref-to-long conversion. | |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1423 load_vmargslot(_masm, G3_amh_vmargslot, O0_argslot); |
1503 | 1424 |
1425 // On big-endian machine we duplicate the slot and store the MSW | |
1426 // in the first slot. | |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1427 __ add(__ argument_address(O0_argslot, O0_argslot, 1), O0_argslot); |
1503 | 1428 |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1429 insert_arg_slots(_masm, stack_move_unit(), O0_argslot, O1_scratch, O2_scratch, O3_scratch); |
1503 | 1430 |
1431 Address arg_lsw(O0_argslot, 0); | |
1506 | 1432 Address arg_msw(O0_argslot, -Interpreter::stackElementSize); |
1503 | 1433 |
1434 switch (ek) { | |
1435 case _adapter_opt_i2l: | |
1436 { | |
2382
3ef1a1866a60
7027232: JSR 292: wrong numeric value returned by MH on solaris-sparc
twisti
parents:
2357
diff
changeset
|
1437 #ifdef _LP64 |
3ef1a1866a60
7027232: JSR 292: wrong numeric value returned by MH on solaris-sparc
twisti
parents:
2357
diff
changeset
|
1438 __ ldsw(arg_lsw, O2_scratch); // Load LSW sign-extended |
3ef1a1866a60
7027232: JSR 292: wrong numeric value returned by MH on solaris-sparc
twisti
parents:
2357
diff
changeset
|
1439 #else |
3ef1a1866a60
7027232: JSR 292: wrong numeric value returned by MH on solaris-sparc
twisti
parents:
2357
diff
changeset
|
1440 __ ldsw(arg_lsw, O3_scratch); // Load LSW sign-extended |
3ef1a1866a60
7027232: JSR 292: wrong numeric value returned by MH on solaris-sparc
twisti
parents:
2357
diff
changeset
|
1441 __ srlx(O3_scratch, BitsPerInt, O2_scratch); // Move MSW value to lower 32-bits for std |
3ef1a1866a60
7027232: JSR 292: wrong numeric value returned by MH on solaris-sparc
twisti
parents:
2357
diff
changeset
|
1442 #endif |
3ef1a1866a60
7027232: JSR 292: wrong numeric value returned by MH on solaris-sparc
twisti
parents:
2357
diff
changeset
|
1443 __ st_long(O2_scratch, arg_msw); // Uses O2/O3 on !_LP64 |
1503 | 1444 } |
1445 break; | |
1446 case _adapter_opt_unboxl: | |
1447 { | |
1448 // Load the value up from the heap. | |
1449 __ ld_ptr(arg_lsw, O1_scratch); | |
1450 int value_offset = java_lang_boxing_object::value_offset_in_bytes(T_LONG); | |
1451 assert(value_offset == java_lang_boxing_object::value_offset_in_bytes(T_DOUBLE), ""); | |
1452 __ null_check(O1_scratch, value_offset); | |
1453 __ ld_long(Address(O1_scratch, value_offset), O2_scratch); // Uses O2/O3 on !_LP64 | |
1454 __ st_long(O2_scratch, arg_msw); | |
1455 } | |
1456 break; | |
1457 default: | |
1458 ShouldNotReachHere(); | |
1459 } | |
1460 | |
1846 | 1461 __ load_heap_oop(G3_mh_vmtarget, G3_method_handle); |
1503 | 1462 __ jump_to_method_handle_entry(G3_method_handle, O1_scratch); |
1463 } | |
1464 break; | |
1465 | |
1466 case _adapter_opt_f2d: // optimized subcase of adapt_prim_to_prim | |
1467 case _adapter_opt_d2f: // optimized subcase of adapt_prim_to_prim | |
1468 { | |
1469 // perform an in-place floating primitive conversion | |
1470 __ unimplemented(entry_name(ek)); | |
1471 } | |
1472 break; | |
1473 | |
1474 case _adapter_prim_to_ref: | |
1475 __ unimplemented(entry_name(ek)); // %%% FIXME: NYI | |
1476 break; | |
1477 | |
1478 case _adapter_swap_args: | |
1479 case _adapter_rot_args: | |
1480 // handled completely by optimized cases | |
1481 __ stop("init_AdapterMethodHandle should not issue this"); | |
1482 break; | |
1483 | |
1484 case _adapter_opt_swap_1: | |
1485 case _adapter_opt_swap_2: | |
1486 case _adapter_opt_rot_1_up: | |
1487 case _adapter_opt_rot_1_down: | |
1488 case _adapter_opt_rot_2_up: | |
1489 case _adapter_opt_rot_2_down: | |
1490 { | |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1491 int swap_slots = ek_adapter_opt_swap_slots(ek); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1492 int rotate = ek_adapter_opt_swap_mode(ek); |
1503 | 1493 |
1494 // 'argslot' is the position of the first argument to swap. | |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1495 load_vmargslot(_masm, G3_amh_vmargslot, O0_argslot); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1496 __ add(__ argument_address(O0_argslot, O0_argslot), O0_argslot); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1497 if (VerifyMethodHandles) |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1498 verify_argslot(_masm, O0_argslot, O2_scratch, "swap point must fall within current frame"); |
1503 | 1499 |
1500 // 'vminfo' is the second. | |
1501 Register O1_destslot = O1_scratch; | |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1502 load_conversion_vminfo(_masm, G3_amh_conversion, O1_destslot); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1503 __ add(__ argument_address(O1_destslot, O1_destslot), O1_destslot); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1504 if (VerifyMethodHandles) |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1505 verify_argslot(_masm, O1_destslot, O2_scratch, "swap point must fall within current frame"); |
1503 | 1506 |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1507 assert(Interpreter::stackElementSize == wordSize, "else rethink use of wordSize here"); |
1503 | 1508 if (!rotate) { |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1509 // simple swap |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1510 for (int i = 0; i < swap_slots; i++) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1511 __ ld_ptr( Address(O0_argslot, i * wordSize), O2_scratch); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1512 __ ld_ptr( Address(O1_destslot, i * wordSize), O3_scratch); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1513 __ st_ptr(O3_scratch, Address(O0_argslot, i * wordSize)); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1514 __ st_ptr(O2_scratch, Address(O1_destslot, i * wordSize)); |
1503 | 1515 } |
1516 } else { | |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1517 // A rotate is actually pair of moves, with an "odd slot" (or pair) |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1518 // changing place with a series of other slots. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1519 // First, push the "odd slot", which is going to get overwritten |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1520 switch (swap_slots) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1521 case 2 : __ ld_ptr(Address(O0_argslot, 1 * wordSize), O4_scratch); // fall-thru |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1522 case 1 : __ ld_ptr(Address(O0_argslot, 0 * wordSize), O3_scratch); break; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1523 default: ShouldNotReachHere(); |
1503 | 1524 } |
1525 if (rotate > 0) { | |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1526 // Here is rotate > 0: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1527 // (low mem) (high mem) |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1528 // | dest: more_slots... | arg: odd_slot :arg+1 | |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1529 // => |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1530 // | dest: odd_slot | dest+1: more_slots... :arg+1 | |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1531 // work argslot down to destslot, copying contiguous data upwards |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1532 // pseudo-code: |
1503 | 1533 // argslot = src_addr - swap_bytes |
1534 // destslot = dest_addr | |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1535 // while (argslot >= destslot) *(argslot + swap_bytes) = *(argslot + 0), argslot--; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1536 move_arg_slots_up(_masm, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1537 O1_destslot, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1538 Address(O0_argslot, 0), |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1539 swap_slots, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1540 O0_argslot, O2_scratch); |
1503 | 1541 } else { |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1542 // Here is the other direction, rotate < 0: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1543 // (low mem) (high mem) |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1544 // | arg: odd_slot | arg+1: more_slots... :dest+1 | |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1545 // => |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1546 // | arg: more_slots... | dest: odd_slot :dest+1 | |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1547 // work argslot up to destslot, copying contiguous data downwards |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1548 // pseudo-code: |
1503 | 1549 // argslot = src_addr + swap_bytes |
1550 // destslot = dest_addr | |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1551 // while (argslot <= destslot) *(argslot - swap_bytes) = *(argslot + 0), argslot++; |
3757
f8c9417e3571
7052219: JSR 292: Crash in ~BufferBlob::MethodHandles adapters
never
parents:
3753
diff
changeset
|
1552 // dest_slot denotes an exclusive upper limit |
f8c9417e3571
7052219: JSR 292: Crash in ~BufferBlob::MethodHandles adapters
never
parents:
3753
diff
changeset
|
1553 int limit_bias = OP_ROT_ARGS_DOWN_LIMIT_BIAS; |
f8c9417e3571
7052219: JSR 292: Crash in ~BufferBlob::MethodHandles adapters
never
parents:
3753
diff
changeset
|
1554 if (limit_bias != 0) |
f8c9417e3571
7052219: JSR 292: Crash in ~BufferBlob::MethodHandles adapters
never
parents:
3753
diff
changeset
|
1555 __ add(O1_destslot, - limit_bias * wordSize, O1_destslot); |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1556 move_arg_slots_down(_masm, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1557 Address(O0_argslot, swap_slots * wordSize), |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1558 O1_destslot, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1559 -swap_slots, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1560 O0_argslot, O2_scratch); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1561 |
3757
f8c9417e3571
7052219: JSR 292: Crash in ~BufferBlob::MethodHandles adapters
never
parents:
3753
diff
changeset
|
1562 __ sub(O1_destslot, swap_slots * wordSize, O1_destslot); |
1503 | 1563 } |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1564 // pop the original first chunk into the destination slot, now free |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1565 switch (swap_slots) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1566 case 2 : __ st_ptr(O4_scratch, Address(O1_destslot, 1 * wordSize)); // fall-thru |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1567 case 1 : __ st_ptr(O3_scratch, Address(O1_destslot, 0 * wordSize)); break; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1568 default: ShouldNotReachHere(); |
1503 | 1569 } |
1570 } | |
1571 | |
1846 | 1572 __ load_heap_oop(G3_mh_vmtarget, G3_method_handle); |
1503 | 1573 __ jump_to_method_handle_entry(G3_method_handle, O1_scratch); |
1574 } | |
1575 break; | |
1576 | |
1577 case _adapter_dup_args: | |
1578 { | |
1579 // 'argslot' is the position of the first argument to duplicate. | |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1580 load_vmargslot(_masm, G3_amh_vmargslot, O0_argslot); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1581 __ add(__ argument_address(O0_argslot, O0_argslot), O0_argslot); |
1503 | 1582 |
1583 // 'stack_move' is negative number of words to duplicate. | |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1584 Register O1_stack_move = O1_scratch; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1585 load_stack_move(_masm, G3_amh_conversion, O1_stack_move); |
1503 | 1586 |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1587 if (VerifyMethodHandles) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1588 verify_argslots(_masm, O1_stack_move, O0_argslot, O2_scratch, O3_scratch, true, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1589 "copied argument(s) must fall within current frame"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1590 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1591 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1592 // insert location is always the bottom of the argument list: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1593 __ neg(O1_stack_move); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1594 push_arg_slots(_masm, O0_argslot, O1_stack_move, O2_scratch, O3_scratch); |
1503 | 1595 |
1846 | 1596 __ load_heap_oop(G3_mh_vmtarget, G3_method_handle); |
1503 | 1597 __ jump_to_method_handle_entry(G3_method_handle, O1_scratch); |
1598 } | |
1599 break; | |
1600 | |
1601 case _adapter_drop_args: | |
1602 { | |
1603 // 'argslot' is the position of the first argument to nuke. | |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1604 load_vmargslot(_masm, G3_amh_vmargslot, O0_argslot); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1605 __ add(__ argument_address(O0_argslot, O0_argslot), O0_argslot); |
1503 | 1606 |
1607 // 'stack_move' is number of words to drop. | |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1608 Register O1_stack_move = O1_scratch; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1609 load_stack_move(_masm, G3_amh_conversion, O1_stack_move); |
1503 | 1610 |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1611 remove_arg_slots(_masm, O1_stack_move, O0_argslot, O2_scratch, O3_scratch, O4_scratch); |
1503 | 1612 |
1846 | 1613 __ load_heap_oop(G3_mh_vmtarget, G3_method_handle); |
1503 | 1614 __ jump_to_method_handle_entry(G3_method_handle, O1_scratch); |
1615 } | |
1616 break; | |
1617 | |
1618 case _adapter_collect_args: | |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1619 case _adapter_fold_args: |
1503 | 1620 case _adapter_spread_args: |
1621 // Handled completely by optimized cases. | |
1622 __ stop("init_AdapterMethodHandle should not issue this"); | |
1623 break; | |
1624 | |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1625 case _adapter_opt_collect_ref: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1626 case _adapter_opt_collect_int: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1627 case _adapter_opt_collect_long: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1628 case _adapter_opt_collect_float: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1629 case _adapter_opt_collect_double: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1630 case _adapter_opt_collect_void: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1631 case _adapter_opt_collect_0_ref: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1632 case _adapter_opt_collect_1_ref: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1633 case _adapter_opt_collect_2_ref: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1634 case _adapter_opt_collect_3_ref: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1635 case _adapter_opt_collect_4_ref: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1636 case _adapter_opt_collect_5_ref: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1637 case _adapter_opt_filter_S0_ref: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1638 case _adapter_opt_filter_S1_ref: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1639 case _adapter_opt_filter_S2_ref: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1640 case _adapter_opt_filter_S3_ref: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1641 case _adapter_opt_filter_S4_ref: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1642 case _adapter_opt_filter_S5_ref: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1643 case _adapter_opt_collect_2_S0_ref: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1644 case _adapter_opt_collect_2_S1_ref: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1645 case _adapter_opt_collect_2_S2_ref: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1646 case _adapter_opt_collect_2_S3_ref: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1647 case _adapter_opt_collect_2_S4_ref: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1648 case _adapter_opt_collect_2_S5_ref: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1649 case _adapter_opt_fold_ref: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1650 case _adapter_opt_fold_int: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1651 case _adapter_opt_fold_long: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1652 case _adapter_opt_fold_float: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1653 case _adapter_opt_fold_double: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1654 case _adapter_opt_fold_void: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1655 case _adapter_opt_fold_1_ref: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1656 case _adapter_opt_fold_2_ref: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1657 case _adapter_opt_fold_3_ref: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1658 case _adapter_opt_fold_4_ref: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1659 case _adapter_opt_fold_5_ref: |
1503 | 1660 { |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1661 // Given a fresh incoming stack frame, build a new ricochet frame. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1662 // On entry, TOS points at a return PC, and FP is the callers frame ptr. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1663 // RSI/R13 has the caller's exact stack pointer, which we must also preserve. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1664 // RCX contains an AdapterMethodHandle of the indicated kind. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1665 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1666 // Relevant AMH fields: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1667 // amh.vmargslot: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1668 // points to the trailing edge of the arguments |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1669 // to filter, collect, or fold. For a boxing operation, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1670 // it points just after the single primitive value. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1671 // amh.argument: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1672 // recursively called MH, on |collect| arguments |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1673 // amh.vmtarget: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1674 // final destination MH, on return value, etc. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1675 // amh.conversion.dest: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1676 // tells what is the type of the return value |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1677 // (not needed here, since dest is also derived from ek) |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1678 // amh.conversion.vminfo: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1679 // points to the trailing edge of the return value |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1680 // when the vmtarget is to be called; this is |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1681 // equal to vmargslot + (retained ? |collect| : 0) |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1682 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1683 // Pass 0 or more argument slots to the recursive target. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1684 int collect_count_constant = ek_adapter_opt_collect_count(ek); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1685 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1686 // The collected arguments are copied from the saved argument list: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1687 int collect_slot_constant = ek_adapter_opt_collect_slot(ek); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1688 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1689 assert(ek_orig == _adapter_collect_args || |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1690 ek_orig == _adapter_fold_args, ""); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1691 bool retain_original_args = (ek_orig == _adapter_fold_args); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1692 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1693 // The return value is replaced (or inserted) at the 'vminfo' argslot. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1694 // Sometimes we can compute this statically. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1695 int dest_slot_constant = -1; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1696 if (!retain_original_args) |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1697 dest_slot_constant = collect_slot_constant; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1698 else if (collect_slot_constant >= 0 && collect_count_constant >= 0) |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1699 // We are preserving all the arguments, and the return value is prepended, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1700 // so the return slot is to the left (above) the |collect| sequence. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1701 dest_slot_constant = collect_slot_constant + collect_count_constant; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1702 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1703 // Replace all those slots by the result of the recursive call. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1704 // The result type can be one of ref, int, long, float, double, void. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1705 // In the case of void, nothing is pushed on the stack after return. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1706 BasicType dest = ek_adapter_opt_collect_type(ek); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1707 assert(dest == type2wfield[dest], "dest is a stack slot type"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1708 int dest_count = type2size[dest]; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1709 assert(dest_count == 1 || dest_count == 2 || (dest_count == 0 && dest == T_VOID), "dest has a size"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1710 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1711 // Choose a return continuation. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1712 EntryKind ek_ret = _adapter_opt_return_any; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1713 if (dest != T_CONFLICT && OptimizeMethodHandles) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1714 switch (dest) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1715 case T_INT : ek_ret = _adapter_opt_return_int; break; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1716 case T_LONG : ek_ret = _adapter_opt_return_long; break; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1717 case T_FLOAT : ek_ret = _adapter_opt_return_float; break; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1718 case T_DOUBLE : ek_ret = _adapter_opt_return_double; break; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1719 case T_OBJECT : ek_ret = _adapter_opt_return_ref; break; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1720 case T_VOID : ek_ret = _adapter_opt_return_void; break; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1721 default : ShouldNotReachHere(); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1722 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1723 if (dest == T_OBJECT && dest_slot_constant >= 0) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1724 EntryKind ek_try = EntryKind(_adapter_opt_return_S0_ref + dest_slot_constant); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1725 if (ek_try <= _adapter_opt_return_LAST && |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1726 ek_adapter_opt_return_slot(ek_try) == dest_slot_constant) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1727 ek_ret = ek_try; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1728 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1729 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1730 assert(ek_adapter_opt_return_type(ek_ret) == dest, ""); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1731 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1732 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1733 // Already pushed: ... keep1 | collect | keep2 | |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1734 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1735 // Push a few extra argument words, if we need them to store the return value. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1736 { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1737 int extra_slots = 0; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1738 if (retain_original_args) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1739 extra_slots = dest_count; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1740 } else if (collect_count_constant == -1) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1741 extra_slots = dest_count; // collect_count might be zero; be generous |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1742 } else if (dest_count > collect_count_constant) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1743 extra_slots = (dest_count - collect_count_constant); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1744 } else { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1745 // else we know we have enough dead space in |collect| to repurpose for return values |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1746 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1747 if (extra_slots != 0) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1748 __ sub(SP, round_to(extra_slots, 2) * Interpreter::stackElementSize, SP); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1749 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1750 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1751 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1752 // Set up Ricochet Frame. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1753 __ mov(SP, O5_savedSP); // record SP for the callee |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1754 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1755 // One extra (empty) slot for outgoing target MH (see Gargs computation below). |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1756 __ save_frame(2); // Note: we need to add 2 slots since frame::memory_parameter_word_sp_offset is 23. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1757 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1758 // Note: Gargs is live throughout the following, until we make our recursive call. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1759 // And the RF saves a copy in L4_saved_args_base. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1760 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1761 RicochetFrame::enter_ricochet_frame(_masm, G3_method_handle, Gargs, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1762 entry(ek_ret)->from_interpreted_entry()); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1763 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1764 // Compute argument base: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1765 // Set up Gargs for current frame, extra (empty) slot is for outgoing target MH (space reserved by save_frame above). |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1766 __ add(FP, STACK_BIAS - (1 * Interpreter::stackElementSize), Gargs); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1767 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1768 // Now pushed: ... keep1 | collect | keep2 | extra | [RF] |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1769 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1770 #ifdef ASSERT |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1771 if (VerifyMethodHandles && dest != T_CONFLICT) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1772 BLOCK_COMMENT("verify AMH.conv.dest {"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1773 extract_conversion_dest_type(_masm, RicochetFrame::L5_conversion, O1_scratch); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1774 Label L_dest_ok; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1775 __ cmp(O1_scratch, (int) dest); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1776 __ br(Assembler::equal, false, Assembler::pt, L_dest_ok); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1777 __ delayed()->nop(); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1778 if (dest == T_INT) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1779 for (int bt = T_BOOLEAN; bt < T_INT; bt++) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1780 if (is_subword_type(BasicType(bt))) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1781 __ cmp(O1_scratch, (int) bt); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1782 __ br(Assembler::equal, false, Assembler::pt, L_dest_ok); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1783 __ delayed()->nop(); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1784 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1785 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1786 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1787 __ stop("bad dest in AMH.conv"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1788 __ BIND(L_dest_ok); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1789 BLOCK_COMMENT("} verify AMH.conv.dest"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1790 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1791 #endif //ASSERT |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1792 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1793 // Find out where the original copy of the recursive argument sequence begins. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1794 Register O0_coll = O0_scratch; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1795 { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1796 RegisterOrConstant collect_slot = collect_slot_constant; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1797 if (collect_slot_constant == -1) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1798 load_vmargslot(_masm, G3_amh_vmargslot, O1_scratch); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1799 collect_slot = O1_scratch; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1800 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1801 // collect_slot might be 0, but we need the move anyway. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1802 __ add(RicochetFrame::L4_saved_args_base, __ argument_offset(collect_slot, collect_slot.register_or_noreg()), O0_coll); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1803 // O0_coll now points at the trailing edge of |collect| and leading edge of |keep2| |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1804 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1805 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1806 // Replace the old AMH with the recursive MH. (No going back now.) |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1807 // In the case of a boxing call, the recursive call is to a 'boxer' method, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1808 // such as Integer.valueOf or Long.valueOf. In the case of a filter |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1809 // or collect call, it will take one or more arguments, transform them, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1810 // and return some result, to store back into argument_base[vminfo]. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1811 __ load_heap_oop(G3_amh_argument, G3_method_handle); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1812 if (VerifyMethodHandles) verify_method_handle(_masm, G3_method_handle, O1_scratch, O2_scratch); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1813 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1814 // Calculate |collect|, the number of arguments we are collecting. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1815 Register O1_collect_count = O1_scratch; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1816 RegisterOrConstant collect_count; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1817 if (collect_count_constant < 0) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1818 __ load_method_handle_vmslots(O1_collect_count, G3_method_handle, O2_scratch); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1819 collect_count = O1_collect_count; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1820 } else { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1821 collect_count = collect_count_constant; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1822 #ifdef ASSERT |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1823 if (VerifyMethodHandles) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1824 BLOCK_COMMENT("verify collect_count_constant {"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1825 __ load_method_handle_vmslots(O3_scratch, G3_method_handle, O2_scratch); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1826 Label L_count_ok; |
3839 | 1827 __ cmp_and_br_short(O3_scratch, collect_count_constant, Assembler::equal, Assembler::pt, L_count_ok); |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1828 __ stop("bad vminfo in AMH.conv"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1829 __ BIND(L_count_ok); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1830 BLOCK_COMMENT("} verify collect_count_constant"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1831 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1832 #endif //ASSERT |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1833 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1834 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1835 // copy |collect| slots directly to TOS: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1836 push_arg_slots(_masm, O0_coll, collect_count, O2_scratch, O3_scratch); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1837 // Now pushed: ... keep1 | collect | keep2 | RF... | collect | |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1838 // O0_coll still points at the trailing edge of |collect| and leading edge of |keep2| |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1839 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1840 // If necessary, adjust the saved arguments to make room for the eventual return value. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1841 // Normal adjustment: ... keep1 | +dest+ | -collect- | keep2 | RF... | collect | |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1842 // If retaining args: ... keep1 | +dest+ | collect | keep2 | RF... | collect | |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1843 // In the non-retaining case, this might move keep2 either up or down. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1844 // We don't have to copy the whole | RF... collect | complex, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1845 // but we must adjust RF.saved_args_base. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1846 // Also, from now on, we will forget about the original copy of |collect|. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1847 // If we are retaining it, we will treat it as part of |keep2|. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1848 // For clarity we will define |keep3| = |collect|keep2| or |keep2|. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1849 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1850 BLOCK_COMMENT("adjust trailing arguments {"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1851 // Compare the sizes of |+dest+| and |-collect-|, which are opposed opening and closing movements. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1852 int open_count = dest_count; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1853 RegisterOrConstant close_count = collect_count_constant; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1854 Register O1_close_count = O1_collect_count; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1855 if (retain_original_args) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1856 close_count = constant(0); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1857 } else if (collect_count_constant == -1) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1858 close_count = O1_collect_count; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1859 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1860 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1861 // How many slots need moving? This is simply dest_slot (0 => no |keep3|). |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1862 RegisterOrConstant keep3_count; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1863 Register O2_keep3_count = O2_scratch; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1864 if (dest_slot_constant < 0) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1865 extract_conversion_vminfo(_masm, RicochetFrame::L5_conversion, O2_keep3_count); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1866 keep3_count = O2_keep3_count; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1867 } else { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1868 keep3_count = dest_slot_constant; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1869 #ifdef ASSERT |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1870 if (VerifyMethodHandles && dest_slot_constant < 0) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1871 BLOCK_COMMENT("verify dest_slot_constant {"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1872 extract_conversion_vminfo(_masm, RicochetFrame::L5_conversion, O3_scratch); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1873 Label L_vminfo_ok; |
3839 | 1874 __ cmp_and_br_short(O3_scratch, dest_slot_constant, Assembler::equal, Assembler::pt, L_vminfo_ok); |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1875 __ stop("bad vminfo in AMH.conv"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1876 __ BIND(L_vminfo_ok); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1877 BLOCK_COMMENT("} verify dest_slot_constant"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1878 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1879 #endif //ASSERT |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1880 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1881 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1882 // tasks remaining: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1883 bool move_keep3 = (!keep3_count.is_constant() || keep3_count.as_constant() != 0); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1884 bool stomp_dest = (NOT_DEBUG(dest == T_OBJECT) DEBUG_ONLY(dest_count != 0)); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1885 bool fix_arg_base = (!close_count.is_constant() || open_count != close_count.as_constant()); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1886 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1887 // Old and new argument locations (based at slot 0). |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1888 // Net shift (&new_argv - &old_argv) is (close_count - open_count). |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1889 bool zero_open_count = (open_count == 0); // remember this bit of info |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1890 if (move_keep3 && fix_arg_base) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1891 // It will be easier to have everything in one register: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1892 if (close_count.is_register()) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1893 // Deduct open_count from close_count register to get a clean +/- value. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1894 __ sub(close_count.as_register(), open_count, close_count.as_register()); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1895 } else { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1896 close_count = close_count.as_constant() - open_count; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1897 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1898 open_count = 0; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1899 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1900 Register L4_old_argv = RicochetFrame::L4_saved_args_base; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1901 Register O3_new_argv = O3_scratch; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1902 if (fix_arg_base) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1903 __ add(L4_old_argv, __ argument_offset(close_count, O4_scratch), O3_new_argv, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1904 -(open_count * Interpreter::stackElementSize)); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1905 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1906 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1907 // First decide if any actual data are to be moved. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1908 // We can skip if (a) |keep3| is empty, or (b) the argument list size didn't change. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1909 // (As it happens, all movements involve an argument list size change.) |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1910 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1911 // If there are variable parameters, use dynamic checks to skip around the whole mess. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1912 Label L_done; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1913 if (keep3_count.is_register()) { |
3839 | 1914 __ cmp_and_br_short(keep3_count.as_register(), 0, Assembler::equal, Assembler::pn, L_done); |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1915 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1916 if (close_count.is_register()) { |
3839 | 1917 __ cmp_and_br_short(close_count.as_register(), open_count, Assembler::equal, Assembler::pn, L_done); |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1918 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1919 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1920 if (move_keep3 && fix_arg_base) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1921 bool emit_move_down = false, emit_move_up = false, emit_guard = false; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1922 if (!close_count.is_constant()) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1923 emit_move_down = emit_guard = !zero_open_count; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1924 emit_move_up = true; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1925 } else if (open_count != close_count.as_constant()) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1926 emit_move_down = (open_count > close_count.as_constant()); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1927 emit_move_up = !emit_move_down; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1928 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1929 Label L_move_up; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1930 if (emit_guard) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1931 __ cmp(close_count.as_register(), open_count); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1932 __ br(Assembler::greater, false, Assembler::pn, L_move_up); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1933 __ delayed()->nop(); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1934 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1935 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1936 if (emit_move_down) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1937 // Move arguments down if |+dest+| > |-collect-| |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1938 // (This is rare, except when arguments are retained.) |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1939 // This opens space for the return value. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1940 if (keep3_count.is_constant()) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1941 for (int i = 0; i < keep3_count.as_constant(); i++) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1942 __ ld_ptr( Address(L4_old_argv, i * Interpreter::stackElementSize), O4_scratch); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1943 __ st_ptr(O4_scratch, Address(O3_new_argv, i * Interpreter::stackElementSize) ); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1944 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1945 } else { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1946 // Live: O1_close_count, O2_keep3_count, O3_new_argv |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1947 Register argv_top = O0_scratch; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1948 __ add(L4_old_argv, __ argument_offset(keep3_count, O4_scratch), argv_top); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1949 move_arg_slots_down(_masm, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1950 Address(L4_old_argv, 0), // beginning of old argv |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1951 argv_top, // end of old argv |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1952 close_count, // distance to move down (must be negative) |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1953 O4_scratch, G5_scratch); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1954 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1955 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1956 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1957 if (emit_guard) { |
3839 | 1958 __ ba_short(L_done); // assumes emit_move_up is true also |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1959 __ BIND(L_move_up); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1960 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1961 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1962 if (emit_move_up) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1963 // Move arguments up if |+dest+| < |-collect-| |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1964 // (This is usual, except when |keep3| is empty.) |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1965 // This closes up the space occupied by the now-deleted collect values. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1966 if (keep3_count.is_constant()) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1967 for (int i = keep3_count.as_constant() - 1; i >= 0; i--) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1968 __ ld_ptr( Address(L4_old_argv, i * Interpreter::stackElementSize), O4_scratch); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1969 __ st_ptr(O4_scratch, Address(O3_new_argv, i * Interpreter::stackElementSize) ); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1970 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1971 } else { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1972 Address argv_top(L4_old_argv, __ argument_offset(keep3_count, O4_scratch)); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1973 // Live: O1_close_count, O2_keep3_count, O3_new_argv |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1974 move_arg_slots_up(_masm, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1975 L4_old_argv, // beginning of old argv |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1976 argv_top, // end of old argv |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1977 close_count, // distance to move up (must be positive) |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1978 O4_scratch, G5_scratch); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1979 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1980 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1981 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1982 __ BIND(L_done); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1983 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1984 if (fix_arg_base) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1985 // adjust RF.saved_args_base |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1986 __ mov(O3_new_argv, RicochetFrame::L4_saved_args_base); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1987 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1988 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1989 if (stomp_dest) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1990 // Stomp the return slot, so it doesn't hold garbage. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1991 // This isn't strictly necessary, but it may help detect bugs. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1992 __ set(RicochetFrame::RETURN_VALUE_PLACEHOLDER, O4_scratch); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1993 __ st_ptr(O4_scratch, Address(RicochetFrame::L4_saved_args_base, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1994 __ argument_offset(keep3_count, keep3_count.register_or_noreg()))); // uses O2_keep3_count |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1995 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1996 BLOCK_COMMENT("} adjust trailing arguments"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1997 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1998 BLOCK_COMMENT("do_recursive_call"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
1999 __ mov(SP, O5_savedSP); // record SP for the callee |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2000 __ set(ExternalAddress(SharedRuntime::ricochet_blob()->bounce_addr() - frame::pc_return_offset), O7); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2001 // The globally unique bounce address has two purposes: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2002 // 1. It helps the JVM recognize this frame (frame::is_ricochet_frame). |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2003 // 2. When returned to, it cuts back the stack and redirects control flow |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2004 // to the return handler. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2005 // The return handler will further cut back the stack when it takes |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2006 // down the RF. Perhaps there is a way to streamline this further. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2007 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2008 // State during recursive call: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2009 // ... keep1 | dest | dest=42 | keep3 | RF... | collect | bounce_pc | |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2010 __ jump_to_method_handle_entry(G3_method_handle, O1_scratch); |
1503 | 2011 } |
2012 break; | |
2013 | |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2014 case _adapter_opt_return_ref: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2015 case _adapter_opt_return_int: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2016 case _adapter_opt_return_long: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2017 case _adapter_opt_return_float: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2018 case _adapter_opt_return_double: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2019 case _adapter_opt_return_void: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2020 case _adapter_opt_return_S0_ref: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2021 case _adapter_opt_return_S1_ref: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2022 case _adapter_opt_return_S2_ref: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2023 case _adapter_opt_return_S3_ref: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2024 case _adapter_opt_return_S4_ref: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2025 case _adapter_opt_return_S5_ref: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2026 { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2027 BasicType dest_type_constant = ek_adapter_opt_return_type(ek); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2028 int dest_slot_constant = ek_adapter_opt_return_slot(ek); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2029 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2030 if (VerifyMethodHandles) RicochetFrame::verify_clean(_masm); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2031 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2032 if (dest_slot_constant == -1) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2033 // The current stub is a general handler for this dest_type. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2034 // It can be called from _adapter_opt_return_any below. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2035 // Stash the address in a little table. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2036 assert((dest_type_constant & CONV_TYPE_MASK) == dest_type_constant, "oob"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2037 address return_handler = __ pc(); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2038 _adapter_return_handlers[dest_type_constant] = return_handler; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2039 if (dest_type_constant == T_INT) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2040 // do the subword types too |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2041 for (int bt = T_BOOLEAN; bt < T_INT; bt++) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2042 if (is_subword_type(BasicType(bt)) && |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2043 _adapter_return_handlers[bt] == NULL) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2044 _adapter_return_handlers[bt] = return_handler; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2045 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2046 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2047 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2048 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2049 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2050 // On entry to this continuation handler, make Gargs live again. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2051 __ mov(RicochetFrame::L4_saved_args_base, Gargs); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2052 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2053 Register O7_temp = O7; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2054 Register O5_vminfo = O5; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2055 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2056 RegisterOrConstant dest_slot = dest_slot_constant; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2057 if (dest_slot_constant == -1) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2058 extract_conversion_vminfo(_masm, RicochetFrame::L5_conversion, O5_vminfo); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2059 dest_slot = O5_vminfo; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2060 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2061 // Store the result back into the argslot. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2062 // This code uses the interpreter calling sequence, in which the return value |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2063 // is usually left in the TOS register, as defined by InterpreterMacroAssembler::pop. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2064 // There are certain irregularities with floating point values, which can be seen |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2065 // in TemplateInterpreterGenerator::generate_return_entry_for. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2066 move_return_value(_masm, dest_type_constant, __ argument_address(dest_slot, O7_temp)); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2067 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2068 RicochetFrame::leave_ricochet_frame(_masm, G3_method_handle, I5_savedSP, I7); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2069 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2070 // Load the final target and go. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2071 if (VerifyMethodHandles) verify_method_handle(_masm, G3_method_handle, O0_scratch, O1_scratch); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2072 __ restore(I5_savedSP, G0, SP); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2073 __ jump_to_method_handle_entry(G3_method_handle, O0_scratch); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2074 __ illtrap(0); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2075 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2076 break; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2077 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2078 case _adapter_opt_return_any: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2079 { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2080 Register O7_temp = O7; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2081 Register O5_dest_type = O5; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2082 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2083 if (VerifyMethodHandles) RicochetFrame::verify_clean(_masm); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2084 extract_conversion_dest_type(_masm, RicochetFrame::L5_conversion, O5_dest_type); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2085 __ set(ExternalAddress((address) &_adapter_return_handlers[0]), O7_temp); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2086 __ sll_ptr(O5_dest_type, LogBytesPerWord, O5_dest_type); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2087 __ ld_ptr(O7_temp, O5_dest_type, O7_temp); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2088 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2089 #ifdef ASSERT |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2090 { Label L_ok; |
3839 | 2091 __ br_notnull_short(O7_temp, Assembler::pt, L_ok); |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2092 __ stop("bad method handle return"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2093 __ BIND(L_ok); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2094 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2095 #endif //ASSERT |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2096 __ JMP(O7_temp, 0); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2097 __ delayed()->nop(); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2098 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2099 break; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2100 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2101 case _adapter_opt_spread_0: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2102 case _adapter_opt_spread_1_ref: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2103 case _adapter_opt_spread_2_ref: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2104 case _adapter_opt_spread_3_ref: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2105 case _adapter_opt_spread_4_ref: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2106 case _adapter_opt_spread_5_ref: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2107 case _adapter_opt_spread_ref: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2108 case _adapter_opt_spread_byte: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2109 case _adapter_opt_spread_char: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2110 case _adapter_opt_spread_short: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2111 case _adapter_opt_spread_int: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2112 case _adapter_opt_spread_long: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2113 case _adapter_opt_spread_float: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2114 case _adapter_opt_spread_double: |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2115 { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2116 // spread an array out into a group of arguments |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2117 int length_constant = ek_adapter_opt_spread_count(ek); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2118 bool length_can_be_zero = (length_constant == 0); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2119 if (length_constant < 0) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2120 // some adapters with variable length must handle the zero case |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2121 if (!OptimizeMethodHandles || |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2122 ek_adapter_opt_spread_type(ek) != T_OBJECT) |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2123 length_can_be_zero = true; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2124 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2125 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2126 // find the address of the array argument |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2127 load_vmargslot(_masm, G3_amh_vmargslot, O0_argslot); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2128 __ add(__ argument_address(O0_argslot, O0_argslot), O0_argslot); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2129 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2130 // O0_argslot points both to the array and to the first output arg |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2131 Address vmarg = Address(O0_argslot, 0); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2132 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2133 // Get the array value. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2134 Register O1_array = O1_scratch; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2135 Register O2_array_klass = O2_scratch; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2136 BasicType elem_type = ek_adapter_opt_spread_type(ek); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2137 int elem_slots = type2size[elem_type]; // 1 or 2 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2138 int array_slots = 1; // array is always a T_OBJECT |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2139 int length_offset = arrayOopDesc::length_offset_in_bytes(); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2140 int elem0_offset = arrayOopDesc::base_offset_in_bytes(elem_type); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2141 __ ld_ptr(vmarg, O1_array); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2142 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2143 Label L_array_is_empty, L_insert_arg_space, L_copy_args, L_args_done; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2144 if (length_can_be_zero) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2145 // handle the null pointer case, if zero is allowed |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2146 Label L_skip; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2147 if (length_constant < 0) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2148 load_conversion_vminfo(_masm, G3_amh_conversion, O3_scratch); |
3839 | 2149 __ cmp_zero_and_br(Assembler::notZero, O3_scratch, L_skip); |
2150 __ delayed()->nop(); // to avoid back-to-back cbcond instructions | |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2151 } |
3839 | 2152 __ br_null_short(O1_array, Assembler::pn, L_array_is_empty); |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2153 __ BIND(L_skip); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2154 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2155 __ null_check(O1_array, oopDesc::klass_offset_in_bytes()); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2156 __ load_klass(O1_array, O2_array_klass); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2157 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2158 // Check the array type. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2159 Register O3_klass = O3_scratch; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2160 __ load_heap_oop(G3_amh_argument, O3_klass); // this is a Class object! |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2161 load_klass_from_Class(_masm, O3_klass, O4_scratch, G5_scratch); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2162 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2163 Label L_ok_array_klass, L_bad_array_klass, L_bad_array_length; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2164 __ check_klass_subtype(O2_array_klass, O3_klass, O4_scratch, G5_scratch, L_ok_array_klass); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2165 // If we get here, the type check failed! |
3839 | 2166 __ ba_short(L_bad_array_klass); |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2167 __ BIND(L_ok_array_klass); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2168 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2169 // Check length. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2170 if (length_constant >= 0) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2171 __ ldsw(Address(O1_array, length_offset), O4_scratch); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2172 __ cmp(O4_scratch, length_constant); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2173 } else { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2174 Register O3_vminfo = O3_scratch; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2175 load_conversion_vminfo(_masm, G3_amh_conversion, O3_vminfo); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2176 __ ldsw(Address(O1_array, length_offset), O4_scratch); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2177 __ cmp(O3_vminfo, O4_scratch); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2178 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2179 __ br(Assembler::notEqual, false, Assembler::pn, L_bad_array_length); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2180 __ delayed()->nop(); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2181 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2182 Register O2_argslot_limit = O2_scratch; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2183 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2184 // Array length checks out. Now insert any required stack slots. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2185 if (length_constant == -1) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2186 // Form a pointer to the end of the affected region. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2187 __ add(O0_argslot, Interpreter::stackElementSize, O2_argslot_limit); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2188 // 'stack_move' is negative number of words to insert |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2189 // This number already accounts for elem_slots. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2190 Register O3_stack_move = O3_scratch; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2191 load_stack_move(_masm, G3_amh_conversion, O3_stack_move); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2192 __ cmp(O3_stack_move, 0); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2193 assert(stack_move_unit() < 0, "else change this comparison"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2194 __ br(Assembler::less, false, Assembler::pn, L_insert_arg_space); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2195 __ delayed()->nop(); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2196 __ br(Assembler::equal, false, Assembler::pn, L_copy_args); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2197 __ delayed()->nop(); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2198 // single argument case, with no array movement |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2199 __ BIND(L_array_is_empty); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2200 remove_arg_slots(_masm, -stack_move_unit() * array_slots, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2201 O0_argslot, O1_scratch, O2_scratch, O3_scratch); |
3839 | 2202 __ ba_short(L_args_done); // no spreading to do |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2203 __ BIND(L_insert_arg_space); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2204 // come here in the usual case, stack_move < 0 (2 or more spread arguments) |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2205 // Live: O1_array, O2_argslot_limit, O3_stack_move |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2206 insert_arg_slots(_masm, O3_stack_move, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2207 O0_argslot, O4_scratch, G5_scratch, O1_scratch); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2208 // reload from rdx_argslot_limit since rax_argslot is now decremented |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2209 __ ld_ptr(Address(O2_argslot_limit, -Interpreter::stackElementSize), O1_array); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2210 } else if (length_constant >= 1) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2211 int new_slots = (length_constant * elem_slots) - array_slots; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2212 insert_arg_slots(_masm, new_slots * stack_move_unit(), |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2213 O0_argslot, O2_scratch, O3_scratch, O4_scratch); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2214 } else if (length_constant == 0) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2215 __ BIND(L_array_is_empty); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2216 remove_arg_slots(_masm, -stack_move_unit() * array_slots, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2217 O0_argslot, O1_scratch, O2_scratch, O3_scratch); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2218 } else { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2219 ShouldNotReachHere(); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2220 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2221 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2222 // Copy from the array to the new slots. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2223 // Note: Stack change code preserves integrity of O0_argslot pointer. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2224 // So even after slot insertions, O0_argslot still points to first argument. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2225 // Beware: Arguments that are shallow on the stack are deep in the array, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2226 // and vice versa. So a downward-growing stack (the usual) has to be copied |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2227 // elementwise in reverse order from the source array. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2228 __ BIND(L_copy_args); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2229 if (length_constant == -1) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2230 // [O0_argslot, O2_argslot_limit) is the area we are inserting into. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2231 // Array element [0] goes at O0_argslot_limit[-wordSize]. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2232 Register O1_source = O1_array; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2233 __ add(Address(O1_array, elem0_offset), O1_source); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2234 Register O4_fill_ptr = O4_scratch; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2235 __ mov(O2_argslot_limit, O4_fill_ptr); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2236 Label L_loop; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2237 __ BIND(L_loop); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2238 __ add(O4_fill_ptr, -Interpreter::stackElementSize * elem_slots, O4_fill_ptr); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2239 move_typed_arg(_masm, elem_type, true, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2240 Address(O1_source, 0), Address(O4_fill_ptr, 0), |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2241 O2_scratch); // must be an even register for !_LP64 long moves (uses O2/O3) |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2242 __ add(O1_source, type2aelembytes(elem_type), O1_source); |
3839 | 2243 __ cmp_and_brx_short(O4_fill_ptr, O0_argslot, Assembler::greaterUnsigned, Assembler::pt, L_loop); |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2244 } else if (length_constant == 0) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2245 // nothing to copy |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2246 } else { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2247 int elem_offset = elem0_offset; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2248 int slot_offset = length_constant * Interpreter::stackElementSize; |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2249 for (int index = 0; index < length_constant; index++) { |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2250 slot_offset -= Interpreter::stackElementSize * elem_slots; // fill backward |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2251 move_typed_arg(_masm, elem_type, true, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2252 Address(O1_array, elem_offset), Address(O0_argslot, slot_offset), |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2253 O2_scratch); // must be an even register for !_LP64 long moves (uses O2/O3) |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2254 elem_offset += type2aelembytes(elem_type); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2255 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2256 } |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2257 __ BIND(L_args_done); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2258 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2259 // Arguments are spread. Move to next method handle. |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2260 __ load_heap_oop(G3_mh_vmtarget, G3_method_handle); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2261 __ jump_to_method_handle_entry(G3_method_handle, O1_scratch); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2262 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2263 __ BIND(L_bad_array_klass); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2264 assert(!vmarg.uses(O2_required), "must be different registers"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2265 __ load_heap_oop(Address(O2_array_klass, java_mirror_offset), O2_required); // required class |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2266 __ ld_ptr( vmarg, O1_actual); // bad object |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2267 __ jump_to(AddressLiteral(from_interpreted_entry(_raise_exception)), O3_scratch); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2268 __ delayed()->mov(Bytecodes::_aaload, O0_code); // who is complaining? |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2269 |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2270 __ bind(L_bad_array_length); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2271 assert(!vmarg.uses(O2_required), "must be different registers"); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2272 __ mov( G3_method_handle, O2_required); // required class |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2273 __ ld_ptr(vmarg, O1_actual); // bad object |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2274 __ jump_to(AddressLiteral(from_interpreted_entry(_raise_exception)), O3_scratch); |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2275 __ delayed()->mov(Bytecodes::_arraylength, O0_code); // who is complaining? |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2276 } |
1503 | 2277 break; |
2278 | |
2279 default: | |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2280 DEBUG_ONLY(tty->print_cr("bad ek=%d (%s)", (int)ek, entry_name(ek))); |
1503 | 2281 ShouldNotReachHere(); |
2282 } | |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3371
diff
changeset
|
2283 BLOCK_COMMENT(err_msg("} Entry %s", entry_name(ek))); |
1503 | 2284 |
2285 address me_cookie = MethodHandleEntry::start_compiled_entry(_masm, interp_entry); | |
2286 __ unimplemented(entry_name(ek)); // %%% FIXME: NYI | |
2287 | |
2288 init_entry(ek, MethodHandleEntry::finish_compiled_entry(_masm, me_cookie)); | |
710 | 2289 } |