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