Mercurial > hg > truffle
annotate src/cpu/x86/vm/methodHandles_x86.cpp @ 6639:892ec0920ccd
Merge
author | vladidan |
---|---|
date | Wed, 08 Aug 2012 16:09:11 -0400 |
parents | 45a1bf98f1bb |
children | 1d7922586cf6 |
rev | line source |
---|---|
710 | 1 /* |
4818
82e5a84b7436
7120450: complete information dumped by frame_describe
bdelsart
parents:
4807
diff
changeset
|
2 * Copyright (c) 1997, 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" | |
3755
5cf771a79037
7047697: MethodHandle.invokeExact call for wrong method causes VM failure if run with -Xcomp
jrose
parents:
3753
diff
changeset
|
27 #include "interpreter/interpreterRuntime.hpp" |
1972 | 28 #include "memory/allocation.inline.hpp" |
29 #include "prims/methodHandles.hpp" | |
710 | 30 |
31 #define __ _masm-> | |
32 | |
1793
d257356e35f0
6939224: MethodHandle.invokeGeneric needs to perform the correct set of conversions
jrose
parents:
1552
diff
changeset
|
33 #ifdef PRODUCT |
d257356e35f0
6939224: MethodHandle.invokeGeneric needs to perform the correct set of conversions
jrose
parents:
1552
diff
changeset
|
34 #define BLOCK_COMMENT(str) /* nothing */ |
d257356e35f0
6939224: MethodHandle.invokeGeneric needs to perform the correct set of conversions
jrose
parents:
1552
diff
changeset
|
35 #else |
d257356e35f0
6939224: MethodHandle.invokeGeneric needs to perform the correct set of conversions
jrose
parents:
1552
diff
changeset
|
36 #define BLOCK_COMMENT(str) __ block_comment(str) |
d257356e35f0
6939224: MethodHandle.invokeGeneric needs to perform the correct set of conversions
jrose
parents:
1552
diff
changeset
|
37 #endif |
d257356e35f0
6939224: MethodHandle.invokeGeneric needs to perform the correct set of conversions
jrose
parents:
1552
diff
changeset
|
38 |
d257356e35f0
6939224: MethodHandle.invokeGeneric needs to perform the correct set of conversions
jrose
parents:
1552
diff
changeset
|
39 #define BIND(label) bind(label); BLOCK_COMMENT(#label ":") |
d257356e35f0
6939224: MethodHandle.invokeGeneric needs to perform the correct set of conversions
jrose
parents:
1552
diff
changeset
|
40 |
3755
5cf771a79037
7047697: MethodHandle.invokeExact call for wrong method causes VM failure if run with -Xcomp
jrose
parents:
3753
diff
changeset
|
41 // Workaround for C++ overloading nastiness on '0' for RegisterOrConstant. |
5cf771a79037
7047697: MethodHandle.invokeExact call for wrong method causes VM failure if run with -Xcomp
jrose
parents:
3753
diff
changeset
|
42 static RegisterOrConstant constant(int value) { |
5cf771a79037
7047697: MethodHandle.invokeExact call for wrong method causes VM failure if run with -Xcomp
jrose
parents:
3753
diff
changeset
|
43 return RegisterOrConstant(value); |
5cf771a79037
7047697: MethodHandle.invokeExact call for wrong method causes VM failure if run with -Xcomp
jrose
parents:
3753
diff
changeset
|
44 } |
5cf771a79037
7047697: MethodHandle.invokeExact call for wrong method causes VM failure if run with -Xcomp
jrose
parents:
3753
diff
changeset
|
45 |
710 | 46 address MethodHandleEntry::start_compiled_entry(MacroAssembler* _masm, |
47 address interpreted_entry) { | |
48 // Just before the actual machine code entry point, allocate space | |
49 // for a MethodHandleEntry::Data record, so that we can manage everything | |
50 // from one base pointer. | |
51 __ align(wordSize); | |
52 address target = __ pc() + sizeof(Data); | |
53 while (__ pc() < target) { | |
54 __ nop(); | |
55 __ align(wordSize); | |
56 } | |
57 | |
58 MethodHandleEntry* me = (MethodHandleEntry*) __ pc(); | |
59 me->set_end_address(__ pc()); // set a temporary end_address | |
60 me->set_from_interpreted_entry(interpreted_entry); | |
61 me->set_type_checking_entry(NULL); | |
62 | |
63 return (address) me; | |
64 } | |
65 | |
66 MethodHandleEntry* MethodHandleEntry::finish_compiled_entry(MacroAssembler* _masm, | |
67 address start_addr) { | |
68 MethodHandleEntry* me = (MethodHandleEntry*) start_addr; | |
69 assert(me->end_address() == start_addr, "valid ME"); | |
70 | |
71 // Fill in the real end_address: | |
72 __ align(wordSize); | |
73 me->set_end_address(__ pc()); | |
74 | |
75 return me; | |
76 } | |
77 | |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
78 // stack walking support |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
79 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
80 frame MethodHandles::ricochet_frame_sender(const frame& fr, RegisterMap *map) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
81 RicochetFrame* f = RicochetFrame::from_frame(fr); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
82 if (map->update_map()) |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
83 frame::update_map_with_saved_link(map, &f->_sender_link); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
84 return frame(f->extended_sender_sp(), f->exact_sender_sp(), f->sender_link(), f->sender_pc()); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
85 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
86 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
87 void MethodHandles::ricochet_frame_oops_do(const frame& fr, OopClosure* blk, const RegisterMap* reg_map) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
88 RicochetFrame* f = RicochetFrame::from_frame(fr); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
89 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
90 // pick up the argument type descriptor: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
91 Thread* thread = Thread::current(); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
92 Handle cookie(thread, f->compute_saved_args_layout(true, true)); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
93 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
94 // process fixed part |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
95 blk->do_oop((oop*)f->saved_target_addr()); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
96 blk->do_oop((oop*)f->saved_args_layout_addr()); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
97 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
98 // process variable arguments: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
99 if (cookie.is_null()) return; // no arguments to describe |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
100 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
101 // the cookie is actually the invokeExact method for my target |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
102 // his argument signature is what I'm interested in |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
103 assert(cookie->is_method(), ""); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
104 methodHandle invoker(thread, methodOop(cookie())); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
105 assert(invoker->name() == vmSymbols::invokeExact_name(), "must be this kind of method"); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
106 assert(!invoker->is_static(), "must have MH argument"); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
107 int slot_count = invoker->size_of_parameters(); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
108 assert(slot_count >= 1, "must include 'this'"); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
109 intptr_t* base = f->saved_args_base(); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
110 intptr_t* retval = NULL; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
111 if (f->has_return_value_slot()) |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
112 retval = f->return_value_slot_addr(); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
113 int slot_num = slot_count; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
114 intptr_t* loc = &base[slot_num -= 1]; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
115 //blk->do_oop((oop*) loc); // original target, which is irrelevant |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
116 int arg_num = 0; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
117 for (SignatureStream ss(invoker->signature()); !ss.is_done(); ss.next()) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
118 if (ss.at_return_type()) continue; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
119 BasicType ptype = ss.type(); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
120 if (ptype == T_ARRAY) ptype = T_OBJECT; // fold all refs to T_OBJECT |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
121 assert(ptype >= T_BOOLEAN && ptype <= T_OBJECT, "not array or void"); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
122 loc = &base[slot_num -= type2size[ptype]]; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
123 bool is_oop = (ptype == T_OBJECT && loc != retval); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
124 if (is_oop) blk->do_oop((oop*)loc); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
125 arg_num += 1; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
126 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
127 assert(slot_num == 0, "must have processed all the arguments"); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
128 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
129 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
130 oop MethodHandles::RicochetFrame::compute_saved_args_layout(bool read_cache, bool write_cache) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
131 oop cookie = NULL; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
132 if (read_cache) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
133 cookie = saved_args_layout(); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
134 if (cookie != NULL) return cookie; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
135 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
136 oop target = saved_target(); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
137 oop mtype = java_lang_invoke_MethodHandle::type(target); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
138 oop mtform = java_lang_invoke_MethodType::form(mtype); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
139 cookie = java_lang_invoke_MethodTypeForm::vmlayout(mtform); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
140 if (write_cache) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
141 (*saved_args_layout_addr()) = cookie; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
142 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
143 return cookie; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
144 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
145 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
146 void MethodHandles::RicochetFrame::generate_ricochet_blob(MacroAssembler* _masm, |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
147 // output params: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
148 int* bounce_offset, |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3388
diff
changeset
|
149 int* exception_offset, |
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3388
diff
changeset
|
150 int* frame_size_in_words) { |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
151 (*frame_size_in_words) = RicochetFrame::frame_size_in_bytes() / wordSize; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
152 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
153 address start = __ pc(); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
154 |
710 | 155 #ifdef ASSERT |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
156 __ hlt(); __ hlt(); __ hlt(); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
157 // here's a hint of something special: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
158 __ push(MAGIC_NUMBER_1); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
159 __ push(MAGIC_NUMBER_2); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
160 #endif //ASSERT |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
161 __ hlt(); // not reached |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
162 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
163 // A return PC has just been popped from the stack. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
164 // Return values are in registers. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
165 // The ebp points into the RicochetFrame, which contains |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
166 // a cleanup continuation we must return to. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
167 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
168 (*bounce_offset) = __ pc() - start; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
169 BLOCK_COMMENT("ricochet_blob.bounce"); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
170 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
171 if (VerifyMethodHandles) RicochetFrame::verify_clean(_masm); |
3371
fabcf26ee72f
6998541: JSR 292 implement missing return-type conversion for OP_RETYPE_RAW
twisti
parents:
3363
diff
changeset
|
172 trace_method_handle(_masm, "return/ricochet_blob.bounce"); |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
173 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
174 __ jmp(frame_address(continuation_offset_in_bytes())); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
175 __ hlt(); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
176 DEBUG_ONLY(__ push(MAGIC_NUMBER_2)); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
177 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
178 (*exception_offset) = __ pc() - start; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
179 BLOCK_COMMENT("ricochet_blob.exception"); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
180 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
181 // compare this to Interpreter::rethrow_exception_entry, which is parallel code |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
182 // for example, see TemplateInterpreterGenerator::generate_throw_exception |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
183 // Live registers in: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
184 // rax: exception |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
185 // rdx: return address/pc that threw exception (ignored, always equal to bounce addr) |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
186 __ verify_oop(rax); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
187 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
188 // no need to empty_FPU_stack or reinit_heapbase, since caller frame will do the same if needed |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
189 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
190 // Take down the frame. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
191 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
192 // Cf. InterpreterMacroAssembler::remove_activation. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
193 leave_ricochet_frame(_masm, /*rcx_recv=*/ noreg, |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
194 saved_last_sp_register(), |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
195 /*sender_pc_reg=*/ rdx); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
196 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
197 // In between activations - previous activation type unknown yet |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
198 // compute continuation point - the continuation point expects the |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
199 // following registers set up: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
200 // |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
201 // rax: exception |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
202 // rdx: return address/pc that threw exception |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
203 // rsp: expression stack of caller |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
204 // rbp: ebp of caller |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
205 __ push(rax); // save exception |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
206 __ push(rdx); // save return address |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
207 Register thread_reg = LP64_ONLY(r15_thread) NOT_LP64(rdi); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
208 NOT_LP64(__ get_thread(thread_reg)); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
209 __ call_VM_leaf(CAST_FROM_FN_PTR(address, |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
210 SharedRuntime::exception_handler_for_return_address), |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
211 thread_reg, rdx); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
212 __ mov(rbx, rax); // save exception handler |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
213 __ pop(rdx); // restore return address |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
214 __ pop(rax); // restore exception |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
215 __ jmp(rbx); // jump to exception |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
216 // handler of caller |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
217 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
218 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
219 void MethodHandles::RicochetFrame::enter_ricochet_frame(MacroAssembler* _masm, |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
220 Register rcx_recv, |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
221 Register rax_argv, |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
222 address return_handler, |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
223 Register rbx_temp) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
224 const Register saved_last_sp = saved_last_sp_register(); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
225 Address rcx_mh_vmtarget( rcx_recv, java_lang_invoke_MethodHandle::vmtarget_offset_in_bytes() ); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
226 Address rcx_amh_conversion( rcx_recv, java_lang_invoke_AdapterMethodHandle::conversion_offset_in_bytes() ); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
227 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
228 // Push the RicochetFrame a word at a time. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
229 // This creates something similar to an interpreter frame. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
230 // Cf. TemplateInterpreterGenerator::generate_fixed_frame. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
231 BLOCK_COMMENT("push RicochetFrame {"); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
232 DEBUG_ONLY(int rfo = (int) sizeof(RicochetFrame)); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
233 assert((rfo -= wordSize) == RicochetFrame::sender_pc_offset_in_bytes(), ""); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
234 #define RF_FIELD(push_value, name) \ |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
235 { push_value; \ |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
236 assert((rfo -= wordSize) == RicochetFrame::name##_offset_in_bytes(), ""); } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
237 RF_FIELD(__ push(rbp), sender_link); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
238 RF_FIELD(__ push(saved_last_sp), exact_sender_sp); // rsi/r13 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
239 RF_FIELD(__ pushptr(rcx_amh_conversion), conversion); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
240 RF_FIELD(__ push(rax_argv), saved_args_base); // can be updated if args are shifted |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
241 RF_FIELD(__ push((int32_t) NULL_WORD), saved_args_layout); // cache for GC layout cookie |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
242 if (UseCompressedOops) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
243 __ load_heap_oop(rbx_temp, rcx_mh_vmtarget); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
244 RF_FIELD(__ push(rbx_temp), saved_target); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
245 } else { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
246 RF_FIELD(__ pushptr(rcx_mh_vmtarget), saved_target); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
247 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
248 __ lea(rbx_temp, ExternalAddress(return_handler)); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
249 RF_FIELD(__ push(rbx_temp), continuation); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
250 #undef RF_FIELD |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
251 assert(rfo == 0, "fully initialized the RicochetFrame"); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
252 // compute new frame pointer: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
253 __ lea(rbp, Address(rsp, RicochetFrame::sender_link_offset_in_bytes())); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
254 // Push guard word #1 in debug mode. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
255 DEBUG_ONLY(__ push((int32_t) RicochetFrame::MAGIC_NUMBER_1)); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
256 // For debugging, leave behind an indication of which stub built this frame. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
257 DEBUG_ONLY({ Label L; __ call(L, relocInfo::none); __ bind(L); }); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
258 BLOCK_COMMENT("} RicochetFrame"); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
259 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
260 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
261 void MethodHandles::RicochetFrame::leave_ricochet_frame(MacroAssembler* _masm, |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
262 Register rcx_recv, |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
263 Register new_sp_reg, |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
264 Register sender_pc_reg) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
265 assert_different_registers(rcx_recv, new_sp_reg, sender_pc_reg); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
266 const Register saved_last_sp = saved_last_sp_register(); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
267 // Take down the frame. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
268 // Cf. InterpreterMacroAssembler::remove_activation. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
269 BLOCK_COMMENT("end_ricochet_frame {"); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
270 // TO DO: If (exact_sender_sp - extended_sender_sp) > THRESH, compact the frame down. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
271 // This will keep stack in bounds even with unlimited tailcalls, each with an adapter. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
272 if (rcx_recv->is_valid()) |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
273 __ movptr(rcx_recv, RicochetFrame::frame_address(RicochetFrame::saved_target_offset_in_bytes())); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
274 __ movptr(sender_pc_reg, RicochetFrame::frame_address(RicochetFrame::sender_pc_offset_in_bytes())); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
275 __ movptr(saved_last_sp, RicochetFrame::frame_address(RicochetFrame::exact_sender_sp_offset_in_bytes())); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
276 __ movptr(rbp, RicochetFrame::frame_address(RicochetFrame::sender_link_offset_in_bytes())); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
277 __ mov(rsp, new_sp_reg); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
278 BLOCK_COMMENT("} end_ricochet_frame"); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
279 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
280 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
281 // Emit code to verify that RBP 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
|
282 #ifndef PRODUCT |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
283 enum { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
284 ARG_LIMIT = 255, SLOP = 4, |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
285 // use this parameter for checking for garbage stack movements: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
286 UNREASONABLE_STACK_MOVE = (ARG_LIMIT + SLOP) |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
287 // the slop defends against false alarms due to fencepost errors |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
288 }; |
4824
5dbed2f542ff
7120468: SPARC/x86: use frame::describe to enhance trace_method_handle
bdelsart
parents:
4818
diff
changeset
|
289 #endif |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
290 |
4824
5dbed2f542ff
7120468: SPARC/x86: use frame::describe to enhance trace_method_handle
bdelsart
parents:
4818
diff
changeset
|
291 #ifdef ASSERT |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
292 void MethodHandles::RicochetFrame::verify_clean(MacroAssembler* _masm) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
293 // The stack should look like this: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
294 // ... keep1 | dest=42 | keep2 | RF | magic | handler | magic | recursive args | |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
295 // Check various invariants. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
296 verify_offsets(); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
297 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
298 Register rdi_temp = rdi; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
299 Register rcx_temp = rcx; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
300 { __ push(rdi_temp); __ push(rcx_temp); } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
301 #define UNPUSH_TEMPS \ |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
302 { __ pop(rcx_temp); __ pop(rdi_temp); } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
303 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
304 Address magic_number_1_addr = RicochetFrame::frame_address(RicochetFrame::magic_number_1_offset_in_bytes()); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
305 Address magic_number_2_addr = RicochetFrame::frame_address(RicochetFrame::magic_number_2_offset_in_bytes()); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
306 Address continuation_addr = RicochetFrame::frame_address(RicochetFrame::continuation_offset_in_bytes()); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
307 Address conversion_addr = RicochetFrame::frame_address(RicochetFrame::conversion_offset_in_bytes()); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
308 Address saved_args_base_addr = RicochetFrame::frame_address(RicochetFrame::saved_args_base_offset_in_bytes()); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
309 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
310 Label L_bad, L_ok; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
311 BLOCK_COMMENT("verify_clean {"); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
312 // Magic numbers must check out: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
313 __ cmpptr(magic_number_1_addr, (int32_t) MAGIC_NUMBER_1); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
314 __ jcc(Assembler::notEqual, L_bad); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
315 __ cmpptr(magic_number_2_addr, (int32_t) MAGIC_NUMBER_2); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
316 __ jcc(Assembler::notEqual, L_bad); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
317 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
318 // Arguments pointer must look reasonable: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
319 __ movptr(rcx_temp, saved_args_base_addr); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
320 __ cmpptr(rcx_temp, rbp); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
321 __ jcc(Assembler::below, L_bad); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
322 __ subptr(rcx_temp, UNREASONABLE_STACK_MOVE * Interpreter::stackElementSize); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
323 __ cmpptr(rcx_temp, rbp); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
324 __ jcc(Assembler::above, L_bad); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
325 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
326 load_conversion_dest_type(_masm, rdi_temp, conversion_addr); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
327 __ cmpl(rdi_temp, T_VOID); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
328 __ jcc(Assembler::equal, L_ok); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
329 __ movptr(rcx_temp, saved_args_base_addr); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
330 load_conversion_vminfo(_masm, rdi_temp, conversion_addr); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
331 __ cmpptr(Address(rcx_temp, rdi_temp, Interpreter::stackElementScale()), |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
332 (int32_t) RETURN_VALUE_PLACEHOLDER); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
333 __ jcc(Assembler::equal, L_ok); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
334 __ BIND(L_bad); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
335 UNPUSH_TEMPS; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
336 __ stop("damaged ricochet frame"); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
337 __ BIND(L_ok); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
338 UNPUSH_TEMPS; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
339 BLOCK_COMMENT("} verify_clean"); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
340 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
341 #undef UNPUSH_TEMPS |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
342 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
343 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
344 #endif //ASSERT |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
345 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
346 void MethodHandles::load_klass_from_Class(MacroAssembler* _masm, Register klass_reg) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
347 if (VerifyMethodHandles) |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
348 verify_klass(_masm, klass_reg, SystemDictionaryHandles::Class_klass(), |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
349 "AMH argument is a Class"); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
350 __ load_heap_oop(klass_reg, Address(klass_reg, java_lang_Class::klass_offset_in_bytes())); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
351 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
352 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
353 void MethodHandles::load_conversion_vminfo(MacroAssembler* _masm, Register reg, Address conversion_field_addr) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
354 int bits = BitsPerByte; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
355 int offset = (CONV_VMINFO_SHIFT / bits); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
356 int shift = (CONV_VMINFO_SHIFT % bits); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
357 __ load_unsigned_byte(reg, conversion_field_addr.plus_disp(offset)); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
358 assert(CONV_VMINFO_MASK == right_n_bits(bits - shift), "else change type of previous load"); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
359 assert(shift == 0, "no shift needed"); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
360 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
361 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
362 void MethodHandles::load_conversion_dest_type(MacroAssembler* _masm, Register reg, Address conversion_field_addr) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
363 int bits = BitsPerByte; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
364 int offset = (CONV_DEST_TYPE_SHIFT / bits); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
365 int shift = (CONV_DEST_TYPE_SHIFT % bits); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
366 __ load_unsigned_byte(reg, conversion_field_addr.plus_disp(offset)); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
367 assert(CONV_TYPE_MASK == right_n_bits(bits - shift), "else change type of previous load"); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
368 __ shrl(reg, shift); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
369 DEBUG_ONLY(int conv_type_bits = (int) exact_log2(CONV_TYPE_MASK+1)); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
370 assert((shift + conv_type_bits) == bits, "left justified in byte"); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
371 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
372 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
373 void MethodHandles::load_stack_move(MacroAssembler* _masm, |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
374 Register rdi_stack_move, |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
375 Register rcx_amh, |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
376 bool might_be_negative) { |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3388
diff
changeset
|
377 BLOCK_COMMENT("load_stack_move {"); |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
378 Address rcx_amh_conversion(rcx_amh, java_lang_invoke_AdapterMethodHandle::conversion_offset_in_bytes()); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
379 __ movl(rdi_stack_move, rcx_amh_conversion); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
380 __ sarl(rdi_stack_move, CONV_STACK_MOVE_SHIFT); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
381 #ifdef _LP64 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
382 if (might_be_negative) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
383 // clean high bits of stack motion register (was loaded as an int) |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
384 __ movslq(rdi_stack_move, rdi_stack_move); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
385 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
386 #endif //_LP64 |
4059
44ce519bc3d1
7104960: JSR 292: +VerifyMethodHandles in product JVM can overflow buffer
never
parents:
4000
diff
changeset
|
387 #ifdef ASSERT |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
388 if (VerifyMethodHandles) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
389 Label L_ok, L_bad; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
390 int32_t stack_move_limit = 0x4000; // extra-large |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
391 __ cmpptr(rdi_stack_move, stack_move_limit); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
392 __ jcc(Assembler::greaterEqual, L_bad); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
393 __ cmpptr(rdi_stack_move, -stack_move_limit); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
394 __ jcc(Assembler::greater, L_ok); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
395 __ bind(L_bad); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
396 __ stop("load_stack_move of garbage value"); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
397 __ BIND(L_ok); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
398 } |
4059
44ce519bc3d1
7104960: JSR 292: +VerifyMethodHandles in product JVM can overflow buffer
never
parents:
4000
diff
changeset
|
399 #endif |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3388
diff
changeset
|
400 BLOCK_COMMENT("} load_stack_move"); |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
401 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
402 |
3388
a80577f854f9
7045513: JSR 292 inlining causes crashes in methodHandleWalk.cpp
never
parents:
3371
diff
changeset
|
403 #ifdef ASSERT |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
404 void MethodHandles::RicochetFrame::verify_offsets() { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
405 // Check compatibility of this struct with the more generally used offsets of class frame: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
406 int ebp_off = sender_link_offset_in_bytes(); // offset from struct base to local rbp value |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
407 assert(ebp_off + wordSize*frame::interpreter_frame_method_offset == saved_args_base_offset_in_bytes(), ""); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
408 assert(ebp_off + wordSize*frame::interpreter_frame_last_sp_offset == conversion_offset_in_bytes(), ""); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
409 assert(ebp_off + wordSize*frame::interpreter_frame_sender_sp_offset == exact_sender_sp_offset_in_bytes(), ""); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
410 // These last two have to be exact: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
411 assert(ebp_off + wordSize*frame::link_offset == sender_link_offset_in_bytes(), ""); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
412 assert(ebp_off + wordSize*frame::return_addr_offset == sender_pc_offset_in_bytes(), ""); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
413 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
414 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
415 void MethodHandles::RicochetFrame::verify() const { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
416 verify_offsets(); |
4000
0abefdb54d21
7081938: JSR292: assert(magic_number_2() == MAGIC_NUMBER_2) failed
twisti
parents:
3937
diff
changeset
|
417 assert(magic_number_1() == MAGIC_NUMBER_1, err_msg(PTR_FORMAT " == " PTR_FORMAT, magic_number_1(), MAGIC_NUMBER_1)); |
0abefdb54d21
7081938: JSR292: assert(magic_number_2() == MAGIC_NUMBER_2) failed
twisti
parents:
3937
diff
changeset
|
418 assert(magic_number_2() == MAGIC_NUMBER_2, err_msg(PTR_FORMAT " == " PTR_FORMAT, magic_number_2(), MAGIC_NUMBER_2)); |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
419 if (!Universe::heap()->is_gc_active()) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
420 if (saved_args_layout() != NULL) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
421 assert(saved_args_layout()->is_method(), "must be valid oop"); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
422 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
423 if (saved_target() != NULL) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
424 assert(java_lang_invoke_MethodHandle::is_instance(saved_target()), "checking frame value"); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
425 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
426 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
427 int conv_op = adapter_conversion_op(conversion()); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
428 assert(conv_op == java_lang_invoke_AdapterMethodHandle::OP_COLLECT_ARGS || |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
429 conv_op == java_lang_invoke_AdapterMethodHandle::OP_FOLD_ARGS || |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
430 conv_op == java_lang_invoke_AdapterMethodHandle::OP_PRIM_TO_REF, |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
431 "must be a sane conversion"); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
432 if (has_return_value_slot()) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
433 assert(*return_value_slot_addr() == RETURN_VALUE_PLACEHOLDER, ""); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
434 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
435 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
436 #endif //PRODUCT |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
437 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
438 #ifdef ASSERT |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
439 void MethodHandles::verify_argslot(MacroAssembler* _masm, |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
440 Register argslot_reg, |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
441 const char* error_message) { |
710 | 442 // Verify that argslot lies within (rsp, rbp]. |
443 Label L_ok, L_bad; | |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
444 BLOCK_COMMENT("verify_argslot {"); |
1304 | 445 __ cmpptr(argslot_reg, rbp); |
1135
e66fd840cb6b
6893081: method handle & invokedynamic code needs additional cleanup (post 6815692, 6858164)
twisti
parents:
1133
diff
changeset
|
446 __ jccb(Assembler::above, L_bad); |
1304 | 447 __ cmpptr(rsp, argslot_reg); |
1135
e66fd840cb6b
6893081: method handle & invokedynamic code needs additional cleanup (post 6815692, 6858164)
twisti
parents:
1133
diff
changeset
|
448 __ jccb(Assembler::below, L_ok); |
710 | 449 __ bind(L_bad); |
450 __ stop(error_message); | |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
451 __ BIND(L_ok); |
1793
d257356e35f0
6939224: MethodHandle.invokeGeneric needs to perform the correct set of conversions
jrose
parents:
1552
diff
changeset
|
452 BLOCK_COMMENT("} verify_argslot"); |
710 | 453 } |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
454 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
455 void MethodHandles::verify_argslots(MacroAssembler* _masm, |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
456 RegisterOrConstant arg_slots, |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
457 Register arg_slot_base_reg, |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
458 bool negate_argslots, |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
459 const char* error_message) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
460 // Verify that [argslot..argslot+size) lies within (rsp, rbp). |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
461 Label L_ok, L_bad; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
462 Register rdi_temp = rdi; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
463 BLOCK_COMMENT("verify_argslots {"); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
464 __ push(rdi_temp); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
465 if (negate_argslots) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
466 if (arg_slots.is_constant()) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
467 arg_slots = -1 * arg_slots.as_constant(); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
468 } else { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
469 __ movptr(rdi_temp, arg_slots); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
470 __ negptr(rdi_temp); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
471 arg_slots = rdi_temp; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
472 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
473 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
474 __ lea(rdi_temp, Address(arg_slot_base_reg, arg_slots, Interpreter::stackElementScale())); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
475 __ cmpptr(rdi_temp, rbp); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
476 __ pop(rdi_temp); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
477 __ jcc(Assembler::above, L_bad); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
478 __ cmpptr(rsp, arg_slot_base_reg); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
479 __ jcc(Assembler::below, L_ok); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
480 __ bind(L_bad); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
481 __ stop(error_message); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
482 __ BIND(L_ok); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
483 BLOCK_COMMENT("} verify_argslots"); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
484 } |
710 | 485 |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
486 // Make sure that arg_slots has the same sign as the given direction. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
487 // If (and only if) arg_slots is a assembly-time constant, also allow it to be zero. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
488 void MethodHandles::verify_stack_move(MacroAssembler* _masm, |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
489 RegisterOrConstant arg_slots, int direction) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
490 bool allow_zero = arg_slots.is_constant(); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
491 if (direction == 0) { direction = +1; allow_zero = true; } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
492 assert(stack_move_unit() == -1, "else add extra checks here"); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
493 if (arg_slots.is_register()) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
494 Label L_ok, L_bad; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
495 BLOCK_COMMENT("verify_stack_move {"); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
496 // testl(arg_slots.as_register(), -stack_move_unit() - 1); // no need |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
497 // jcc(Assembler::notZero, L_bad); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
498 __ cmpptr(arg_slots.as_register(), (int32_t) NULL_WORD); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
499 if (direction > 0) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
500 __ jcc(allow_zero ? Assembler::less : Assembler::lessEqual, L_bad); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
501 __ cmpptr(arg_slots.as_register(), (int32_t) UNREASONABLE_STACK_MOVE); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
502 __ jcc(Assembler::less, L_ok); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
503 } else { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
504 __ jcc(allow_zero ? Assembler::greater : Assembler::greaterEqual, L_bad); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
505 __ cmpptr(arg_slots.as_register(), (int32_t) -UNREASONABLE_STACK_MOVE); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
506 __ jcc(Assembler::greater, L_ok); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
507 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
508 __ bind(L_bad); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
509 if (direction > 0) |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
510 __ stop("assert arg_slots > 0"); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
511 else |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
512 __ stop("assert arg_slots < 0"); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
513 __ BIND(L_ok); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
514 BLOCK_COMMENT("} verify_stack_move"); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
515 } else { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
516 intptr_t size = arg_slots.as_constant(); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
517 if (direction < 0) size = -size; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
518 assert(size >= 0, "correct direction of constant move"); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
519 assert(size < UNREASONABLE_STACK_MOVE, "reasonable size of constant move"); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
520 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
521 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
522 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
523 void MethodHandles::verify_klass(MacroAssembler* _masm, |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
524 Register obj, KlassHandle klass, |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
525 const char* error_message) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
526 oop* klass_addr = klass.raw_value(); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
527 assert(klass_addr >= SystemDictionaryHandles::Object_klass().raw_value() && |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
528 klass_addr <= SystemDictionaryHandles::Long_klass().raw_value(), |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
529 "must be one of the SystemDictionaryHandles"); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
530 Register temp = rdi; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
531 Label L_ok, L_bad; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
532 BLOCK_COMMENT("verify_klass {"); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
533 __ verify_oop(obj); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
534 __ testptr(obj, obj); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
535 __ jcc(Assembler::zero, L_bad); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
536 __ push(temp); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
537 __ load_klass(temp, obj); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
538 __ cmpptr(temp, ExternalAddress((address) klass_addr)); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
539 __ jcc(Assembler::equal, L_ok); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
540 intptr_t super_check_offset = klass->super_check_offset(); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
541 __ movptr(temp, Address(temp, super_check_offset)); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
542 __ cmpptr(temp, ExternalAddress((address) klass_addr)); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
543 __ jcc(Assembler::equal, L_ok); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
544 __ pop(temp); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
545 __ bind(L_bad); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
546 __ stop(error_message); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
547 __ BIND(L_ok); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
548 __ pop(temp); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
549 BLOCK_COMMENT("} verify_klass"); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
550 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
551 #endif //ASSERT |
710 | 552 |
3808
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
553 void MethodHandles::jump_from_method_handle(MacroAssembler* _masm, Register method, Register temp) { |
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
554 if (JvmtiExport::can_post_interpreter_events()) { |
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
555 Label run_compiled_code; |
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
556 // JVMTI events, such as single-stepping, are implemented partly by avoiding running |
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
557 // compiled code in threads for which the event is enabled. Check here for |
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
558 // interp_only_mode if these events CAN be enabled. |
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
559 #ifdef _LP64 |
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
560 Register rthread = r15_thread; |
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
561 #else |
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
562 Register rthread = temp; |
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
563 __ get_thread(rthread); |
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
564 #endif |
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
565 // interp_only is an int, on little endian it is sufficient to test the byte only |
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
566 // Is a cmpl faster? |
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
567 __ cmpb(Address(rthread, JavaThread::interp_only_mode_offset()), 0); |
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
568 __ jccb(Assembler::zero, run_compiled_code); |
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
569 __ jmp(Address(method, methodOopDesc::interpreter_entry_offset())); |
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
570 __ bind(run_compiled_code); |
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
571 } |
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
572 __ jmp(Address(method, methodOopDesc::from_interpreted_offset())); |
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
573 } |
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
574 |
710 | 575 // Code generation |
576 address MethodHandles::generate_method_handle_interpreter_entry(MacroAssembler* _masm) { | |
577 // rbx: methodOop | |
578 // rcx: receiver method handle (must load from sp[MethodTypeForm.vmslots]) | |
579 // rsi/r13: sender SP (must preserve; see prepare_to_jump_from_interpreted) | |
1793
d257356e35f0
6939224: MethodHandle.invokeGeneric needs to perform the correct set of conversions
jrose
parents:
1552
diff
changeset
|
580 // rdx, rdi: garbage temp, blown away |
710 | 581 |
582 Register rbx_method = rbx; | |
583 Register rcx_recv = rcx; | |
584 Register rax_mtype = rax; | |
585 Register rdx_temp = rdx; | |
1793
d257356e35f0
6939224: MethodHandle.invokeGeneric needs to perform the correct set of conversions
jrose
parents:
1552
diff
changeset
|
586 Register rdi_temp = rdi; |
710 | 587 |
588 // emit WrongMethodType path first, to enable jccb back-branch from main path | |
589 Label wrong_method_type; | |
590 __ bind(wrong_method_type); | |
3755
5cf771a79037
7047697: MethodHandle.invokeExact call for wrong method causes VM failure if run with -Xcomp
jrose
parents:
3753
diff
changeset
|
591 Label invoke_generic_slow_path, invoke_exact_error_path; |
1793
d257356e35f0
6939224: MethodHandle.invokeGeneric needs to perform the correct set of conversions
jrose
parents:
1552
diff
changeset
|
592 assert(methodOopDesc::intrinsic_id_size_in_bytes() == sizeof(u1), "");; |
d257356e35f0
6939224: MethodHandle.invokeGeneric needs to perform the correct set of conversions
jrose
parents:
1552
diff
changeset
|
593 __ cmpb(Address(rbx_method, methodOopDesc::intrinsic_id_offset_in_bytes()), (int) vmIntrinsics::_invokeExact); |
d257356e35f0
6939224: MethodHandle.invokeGeneric needs to perform the correct set of conversions
jrose
parents:
1552
diff
changeset
|
594 __ jcc(Assembler::notEqual, invoke_generic_slow_path); |
3755
5cf771a79037
7047697: MethodHandle.invokeExact call for wrong method causes VM failure if run with -Xcomp
jrose
parents:
3753
diff
changeset
|
595 __ jmp(invoke_exact_error_path); |
710 | 596 |
597 // here's where control starts out: | |
598 __ align(CodeEntryAlignment); | |
599 address entry_point = __ pc(); | |
600 | |
601 // fetch the MethodType from the method handle into rax (the 'check' register) | |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
602 // FIXME: Interpreter should transmit pre-popped stack pointer, to locate base of arg list. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
603 // This would simplify several touchy bits of code. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
604 // See 6984712: JSR 292 method handle calls need a clean argument base pointer |
710 | 605 { |
606 Register tem = rbx_method; | |
607 for (jint* pchase = methodOopDesc::method_type_offsets_chain(); (*pchase) != -1; pchase++) { | |
608 __ movptr(rax_mtype, Address(tem, *pchase)); | |
609 tem = rax_mtype; // in case there is another indirection | |
610 } | |
611 } | |
612 | |
613 // 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
|
614 __ load_heap_oop(rdx_temp, Address(rax_mtype, __ delayed_value(java_lang_invoke_MethodType::form_offset_in_bytes, rdi_temp))); |
1793
d257356e35f0
6939224: MethodHandle.invokeGeneric needs to perform the correct set of conversions
jrose
parents:
1552
diff
changeset
|
615 Register rdx_vmslots = rdx_temp; |
2357
8033953d67ff
7012648: move JSR 292 to package java.lang.invoke and adjust names
jrose
parents:
2321
diff
changeset
|
616 __ movl(rdx_vmslots, Address(rdx_temp, __ delayed_value(java_lang_invoke_MethodTypeForm::vmslots_offset_in_bytes, rdi_temp))); |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
617 Address mh_receiver_slot_addr = __ argument_address(rdx_vmslots); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
618 __ movptr(rcx_recv, mh_receiver_slot_addr); |
1793
d257356e35f0
6939224: MethodHandle.invokeGeneric needs to perform the correct set of conversions
jrose
parents:
1552
diff
changeset
|
619 |
d257356e35f0
6939224: MethodHandle.invokeGeneric needs to perform the correct set of conversions
jrose
parents:
1552
diff
changeset
|
620 trace_method_handle(_masm, "invokeExact"); |
d257356e35f0
6939224: MethodHandle.invokeGeneric needs to perform the correct set of conversions
jrose
parents:
1552
diff
changeset
|
621 |
d257356e35f0
6939224: MethodHandle.invokeGeneric needs to perform the correct set of conversions
jrose
parents:
1552
diff
changeset
|
622 __ check_method_handle_type(rax_mtype, rcx_recv, rdi_temp, wrong_method_type); |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
623 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
624 // Nobody uses the MH receiver slot after this. Make sure. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
625 DEBUG_ONLY(__ movptr(mh_receiver_slot_addr, (int32_t)0x999999)); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
626 |
1793
d257356e35f0
6939224: MethodHandle.invokeGeneric needs to perform the correct set of conversions
jrose
parents:
1552
diff
changeset
|
627 __ jump_to_method_handle_entry(rcx_recv, rdi_temp); |
d257356e35f0
6939224: MethodHandle.invokeGeneric needs to perform the correct set of conversions
jrose
parents:
1552
diff
changeset
|
628 |
3755
5cf771a79037
7047697: MethodHandle.invokeExact call for wrong method causes VM failure if run with -Xcomp
jrose
parents:
3753
diff
changeset
|
629 // error path for invokeExact (only) |
5cf771a79037
7047697: MethodHandle.invokeExact call for wrong method causes VM failure if run with -Xcomp
jrose
parents:
3753
diff
changeset
|
630 __ bind(invoke_exact_error_path); |
3937 | 631 // ensure that the top of stack is properly aligned. |
632 __ mov(rdi, rsp); | |
633 __ andptr(rsp, -StackAlignmentInBytes); // Align the stack for the ABI | |
634 __ pushptr(Address(rdi, 0)); // Pick up the return address | |
635 | |
3781
d83ac25d0304
7055355: JSR 292: crash while throwing WrongMethodTypeException
never
parents:
3757
diff
changeset
|
636 // Stub wants expected type in rax and the actual type in rcx |
d83ac25d0304
7055355: JSR 292: crash while throwing WrongMethodTypeException
never
parents:
3757
diff
changeset
|
637 __ jump(ExternalAddress(StubRoutines::throw_WrongMethodTypeException_entry())); |
3755
5cf771a79037
7047697: MethodHandle.invokeExact call for wrong method causes VM failure if run with -Xcomp
jrose
parents:
3753
diff
changeset
|
638 |
1793
d257356e35f0
6939224: MethodHandle.invokeGeneric needs to perform the correct set of conversions
jrose
parents:
1552
diff
changeset
|
639 // for invokeGeneric (only), apply argument and result conversions on the fly |
d257356e35f0
6939224: MethodHandle.invokeGeneric needs to perform the correct set of conversions
jrose
parents:
1552
diff
changeset
|
640 __ bind(invoke_generic_slow_path); |
d257356e35f0
6939224: MethodHandle.invokeGeneric needs to perform the correct set of conversions
jrose
parents:
1552
diff
changeset
|
641 #ifdef ASSERT |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
642 if (VerifyMethodHandles) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
643 Label L; |
1793
d257356e35f0
6939224: MethodHandle.invokeGeneric needs to perform the correct set of conversions
jrose
parents:
1552
diff
changeset
|
644 __ cmpb(Address(rbx_method, methodOopDesc::intrinsic_id_offset_in_bytes()), (int) vmIntrinsics::_invokeGeneric); |
d257356e35f0
6939224: MethodHandle.invokeGeneric needs to perform the correct set of conversions
jrose
parents:
1552
diff
changeset
|
645 __ jcc(Assembler::equal, L); |
d257356e35f0
6939224: MethodHandle.invokeGeneric needs to perform the correct set of conversions
jrose
parents:
1552
diff
changeset
|
646 __ stop("bad methodOop::intrinsic_id"); |
d257356e35f0
6939224: MethodHandle.invokeGeneric needs to perform the correct set of conversions
jrose
parents:
1552
diff
changeset
|
647 __ bind(L); |
d257356e35f0
6939224: MethodHandle.invokeGeneric needs to perform the correct set of conversions
jrose
parents:
1552
diff
changeset
|
648 } |
d257356e35f0
6939224: MethodHandle.invokeGeneric needs to perform the correct set of conversions
jrose
parents:
1552
diff
changeset
|
649 #endif //ASSERT |
d257356e35f0
6939224: MethodHandle.invokeGeneric needs to perform the correct set of conversions
jrose
parents:
1552
diff
changeset
|
650 Register rbx_temp = rbx_method; // don't need it now |
d257356e35f0
6939224: MethodHandle.invokeGeneric needs to perform the correct set of conversions
jrose
parents:
1552
diff
changeset
|
651 |
d257356e35f0
6939224: MethodHandle.invokeGeneric needs to perform the correct set of conversions
jrose
parents:
1552
diff
changeset
|
652 // make room on the stack for another pointer: |
d257356e35f0
6939224: MethodHandle.invokeGeneric needs to perform the correct set of conversions
jrose
parents:
1552
diff
changeset
|
653 Register rcx_argslot = rcx_recv; |
d257356e35f0
6939224: MethodHandle.invokeGeneric needs to perform the correct set of conversions
jrose
parents:
1552
diff
changeset
|
654 __ lea(rcx_argslot, __ argument_address(rdx_vmslots, 1)); |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
655 insert_arg_slots(_masm, 2 * stack_move_unit(), |
1793
d257356e35f0
6939224: MethodHandle.invokeGeneric needs to perform the correct set of conversions
jrose
parents:
1552
diff
changeset
|
656 rcx_argslot, rbx_temp, rdx_temp); |
710 | 657 |
1793
d257356e35f0
6939224: MethodHandle.invokeGeneric needs to perform the correct set of conversions
jrose
parents:
1552
diff
changeset
|
658 // load up an adapter from the calling type (Java weaves this) |
d257356e35f0
6939224: MethodHandle.invokeGeneric needs to perform the correct set of conversions
jrose
parents:
1552
diff
changeset
|
659 Register rdx_adapter = rdx_temp; |
3371
fabcf26ee72f
6998541: JSR 292 implement missing return-type conversion for OP_RETYPE_RAW
twisti
parents:
3363
diff
changeset
|
660 __ load_heap_oop(rdx_temp, Address(rax_mtype, __ delayed_value(java_lang_invoke_MethodType::form_offset_in_bytes, rdi_temp))); |
fabcf26ee72f
6998541: JSR 292 implement missing return-type conversion for OP_RETYPE_RAW
twisti
parents:
3363
diff
changeset
|
661 __ load_heap_oop(rdx_adapter, Address(rdx_temp, __ delayed_value(java_lang_invoke_MethodTypeForm::genericInvoker_offset_in_bytes, rdi_temp))); |
fabcf26ee72f
6998541: JSR 292 implement missing return-type conversion for OP_RETYPE_RAW
twisti
parents:
3363
diff
changeset
|
662 __ verify_oop(rdx_adapter); |
1793
d257356e35f0
6939224: MethodHandle.invokeGeneric needs to perform the correct set of conversions
jrose
parents:
1552
diff
changeset
|
663 __ movptr(Address(rcx_argslot, 1 * Interpreter::stackElementSize), rdx_adapter); |
d257356e35f0
6939224: MethodHandle.invokeGeneric needs to perform the correct set of conversions
jrose
parents:
1552
diff
changeset
|
664 // As a trusted first argument, pass the type being called, so the adapter knows |
d257356e35f0
6939224: MethodHandle.invokeGeneric needs to perform the correct set of conversions
jrose
parents:
1552
diff
changeset
|
665 // the actual types of the arguments and return values. |
d257356e35f0
6939224: MethodHandle.invokeGeneric needs to perform the correct set of conversions
jrose
parents:
1552
diff
changeset
|
666 // (Generic invokers are shared among form-families of method-type.) |
d257356e35f0
6939224: MethodHandle.invokeGeneric needs to perform the correct set of conversions
jrose
parents:
1552
diff
changeset
|
667 __ movptr(Address(rcx_argslot, 0 * Interpreter::stackElementSize), rax_mtype); |
d257356e35f0
6939224: MethodHandle.invokeGeneric needs to perform the correct set of conversions
jrose
parents:
1552
diff
changeset
|
668 // FIXME: assert that rdx_adapter is of the right method-type. |
d257356e35f0
6939224: MethodHandle.invokeGeneric needs to perform the correct set of conversions
jrose
parents:
1552
diff
changeset
|
669 __ mov(rcx, rdx_adapter); |
d257356e35f0
6939224: MethodHandle.invokeGeneric needs to perform the correct set of conversions
jrose
parents:
1552
diff
changeset
|
670 trace_method_handle(_masm, "invokeGeneric"); |
d257356e35f0
6939224: MethodHandle.invokeGeneric needs to perform the correct set of conversions
jrose
parents:
1552
diff
changeset
|
671 __ jump_to_method_handle_entry(rcx, rdi_temp); |
d257356e35f0
6939224: MethodHandle.invokeGeneric needs to perform the correct set of conversions
jrose
parents:
1552
diff
changeset
|
672 |
710 | 673 return entry_point; |
674 } | |
675 | |
676 // Helper to insert argument slots into the stack. | |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
677 // arg_slots must be a multiple of stack_move_unit() and < 0 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
678 // rax_argslot is decremented to point to the new (shifted) location of the argslot |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
679 // But, rdx_temp ends up holding the original value of rax_argslot. |
710 | 680 void MethodHandles::insert_arg_slots(MacroAssembler* _masm, |
681 RegisterOrConstant arg_slots, | |
682 Register rax_argslot, | |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
683 Register rbx_temp, Register rdx_temp) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
684 // allow constant zero |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
685 if (arg_slots.is_constant() && arg_slots.as_constant() == 0) |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
686 return; |
710 | 687 assert_different_registers(rax_argslot, rbx_temp, rdx_temp, |
688 (!arg_slots.is_register() ? rsp : arg_slots.as_register())); | |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
689 if (VerifyMethodHandles) |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
690 verify_argslot(_masm, rax_argslot, "insertion point must fall within current frame"); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
691 if (VerifyMethodHandles) |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
692 verify_stack_move(_masm, arg_slots, -1); |
710 | 693 |
694 // Make space on the stack for the inserted argument(s). | |
695 // Then pull down everything shallower than rax_argslot. | |
696 // The stacked return address gets pulled down with everything else. | |
697 // That is, copy [rsp, argslot) downward by -size words. In pseudo-code: | |
698 // rsp -= size; | |
699 // for (rdx = rsp + size; rdx < argslot; rdx++) | |
700 // rdx[-size] = rdx[0] | |
701 // argslot -= size; | |
1793
d257356e35f0
6939224: MethodHandle.invokeGeneric needs to perform the correct set of conversions
jrose
parents:
1552
diff
changeset
|
702 BLOCK_COMMENT("insert_arg_slots {"); |
710 | 703 __ mov(rdx_temp, rsp); // source pointer for copy |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
704 __ lea(rsp, Address(rsp, arg_slots, Interpreter::stackElementScale())); |
710 | 705 { |
706 Label loop; | |
1793
d257356e35f0
6939224: MethodHandle.invokeGeneric needs to perform the correct set of conversions
jrose
parents:
1552
diff
changeset
|
707 __ BIND(loop); |
710 | 708 // pull one word down each time through the loop |
709 __ movptr(rbx_temp, Address(rdx_temp, 0)); | |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
710 __ movptr(Address(rdx_temp, arg_slots, Interpreter::stackElementScale()), rbx_temp); |
710 | 711 __ addptr(rdx_temp, wordSize); |
712 __ cmpptr(rdx_temp, rax_argslot); | |
3371
fabcf26ee72f
6998541: JSR 292 implement missing return-type conversion for OP_RETYPE_RAW
twisti
parents:
3363
diff
changeset
|
713 __ jcc(Assembler::below, loop); |
710 | 714 } |
715 | |
716 // Now move the argslot down, to point to the opened-up space. | |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
717 __ lea(rax_argslot, Address(rax_argslot, arg_slots, Interpreter::stackElementScale())); |
1793
d257356e35f0
6939224: MethodHandle.invokeGeneric needs to perform the correct set of conversions
jrose
parents:
1552
diff
changeset
|
718 BLOCK_COMMENT("} insert_arg_slots"); |
710 | 719 } |
720 | |
721 // Helper to remove argument slots from the stack. | |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
722 // arg_slots must be a multiple of stack_move_unit() and > 0 |
710 | 723 void MethodHandles::remove_arg_slots(MacroAssembler* _masm, |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
724 RegisterOrConstant arg_slots, |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
725 Register rax_argslot, |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
726 Register rbx_temp, Register rdx_temp) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
727 // allow constant zero |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
728 if (arg_slots.is_constant() && arg_slots.as_constant() == 0) |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
729 return; |
710 | 730 assert_different_registers(rax_argslot, rbx_temp, rdx_temp, |
731 (!arg_slots.is_register() ? rsp : arg_slots.as_register())); | |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
732 if (VerifyMethodHandles) |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
733 verify_argslots(_masm, arg_slots, rax_argslot, false, |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
734 "deleted argument(s) must fall within current frame"); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
735 if (VerifyMethodHandles) |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
736 verify_stack_move(_masm, arg_slots, +1); |
710 | 737 |
1793
d257356e35f0
6939224: MethodHandle.invokeGeneric needs to perform the correct set of conversions
jrose
parents:
1552
diff
changeset
|
738 BLOCK_COMMENT("remove_arg_slots {"); |
710 | 739 // Pull up everything shallower than rax_argslot. |
740 // Then remove the excess space on the stack. | |
741 // The stacked return address gets pulled up with everything else. | |
742 // That is, copy [rsp, argslot) upward by size words. In pseudo-code: | |
743 // for (rdx = argslot-1; rdx >= rsp; --rdx) | |
744 // rdx[size] = rdx[0] | |
745 // argslot += size; | |
746 // rsp += size; | |
747 __ lea(rdx_temp, Address(rax_argslot, -wordSize)); // source pointer for copy | |
748 { | |
749 Label loop; | |
1793
d257356e35f0
6939224: MethodHandle.invokeGeneric needs to perform the correct set of conversions
jrose
parents:
1552
diff
changeset
|
750 __ BIND(loop); |
710 | 751 // pull one word up each time through the loop |
752 __ movptr(rbx_temp, Address(rdx_temp, 0)); | |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
753 __ movptr(Address(rdx_temp, arg_slots, Interpreter::stackElementScale()), rbx_temp); |
710 | 754 __ addptr(rdx_temp, -wordSize); |
755 __ cmpptr(rdx_temp, rsp); | |
3371
fabcf26ee72f
6998541: JSR 292 implement missing return-type conversion for OP_RETYPE_RAW
twisti
parents:
3363
diff
changeset
|
756 __ jcc(Assembler::aboveEqual, loop); |
710 | 757 } |
758 | |
759 // Now move the argslot up, to point to the just-copied block. | |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
760 __ lea(rsp, Address(rsp, arg_slots, Interpreter::stackElementScale())); |
710 | 761 // And adjust the argslot address to point at the deletion point. |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
762 __ lea(rax_argslot, Address(rax_argslot, arg_slots, Interpreter::stackElementScale())); |
1793
d257356e35f0
6939224: MethodHandle.invokeGeneric needs to perform the correct set of conversions
jrose
parents:
1552
diff
changeset
|
763 BLOCK_COMMENT("} remove_arg_slots"); |
710 | 764 } |
765 | |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
766 // Helper to copy argument slots to the top of the stack. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
767 // The sequence starts with rax_argslot and is counted by slot_count |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
768 // slot_count must be a multiple of stack_move_unit() and >= 0 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
769 // This function blows the temps but does not change rax_argslot. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
770 void MethodHandles::push_arg_slots(MacroAssembler* _masm, |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
771 Register rax_argslot, |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
772 RegisterOrConstant slot_count, |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
773 int skip_words_count, |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
774 Register rbx_temp, Register rdx_temp) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
775 assert_different_registers(rax_argslot, rbx_temp, rdx_temp, |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
776 (!slot_count.is_register() ? rbp : slot_count.as_register()), |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
777 rsp); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
778 assert(Interpreter::stackElementSize == wordSize, "else change this code"); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
779 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
780 if (VerifyMethodHandles) |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
781 verify_stack_move(_masm, slot_count, 0); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
782 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
783 // allow constant zero |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
784 if (slot_count.is_constant() && slot_count.as_constant() == 0) |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
785 return; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
786 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
787 BLOCK_COMMENT("push_arg_slots {"); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
788 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
789 Register rbx_top = rbx_temp; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
790 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
791 // There is at most 1 word to carry down with the TOS. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
792 switch (skip_words_count) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
793 case 1: __ pop(rdx_temp); break; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
794 case 0: break; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
795 default: ShouldNotReachHere(); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
796 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
797 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
798 if (slot_count.is_constant()) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
799 for (int i = slot_count.as_constant() - 1; i >= 0; i--) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
800 __ pushptr(Address(rax_argslot, i * wordSize)); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
801 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
802 } else { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
803 Label L_plural, L_loop, L_break; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
804 // Emit code to dynamically check for the common cases, zero and one slot. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
805 __ cmpl(slot_count.as_register(), (int32_t) 1); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
806 __ jccb(Assembler::greater, L_plural); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
807 __ jccb(Assembler::less, L_break); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
808 __ pushptr(Address(rax_argslot, 0)); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
809 __ jmpb(L_break); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
810 __ BIND(L_plural); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
811 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
812 // Loop for 2 or more: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
813 // rbx = &rax[slot_count] |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
814 // while (rbx > rax) *(--rsp) = *(--rbx) |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
815 __ lea(rbx_top, Address(rax_argslot, slot_count, Address::times_ptr)); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
816 __ BIND(L_loop); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
817 __ subptr(rbx_top, wordSize); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
818 __ pushptr(Address(rbx_top, 0)); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
819 __ cmpptr(rbx_top, rax_argslot); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
820 __ jcc(Assembler::above, L_loop); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
821 __ bind(L_break); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
822 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
823 switch (skip_words_count) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
824 case 1: __ push(rdx_temp); break; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
825 case 0: break; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
826 default: ShouldNotReachHere(); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
827 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
828 BLOCK_COMMENT("} push_arg_slots"); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
829 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
830 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
831 // in-place movement; no change to rsp |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
832 // blows rax_temp, rdx_temp |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
833 void MethodHandles::move_arg_slots_up(MacroAssembler* _masm, |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
834 Register rbx_bottom, // invariant |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
835 Address top_addr, // can use rax_temp |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
836 RegisterOrConstant positive_distance_in_slots, |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
837 Register rax_temp, Register rdx_temp) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
838 BLOCK_COMMENT("move_arg_slots_up {"); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
839 assert_different_registers(rbx_bottom, |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
840 rax_temp, rdx_temp, |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
841 positive_distance_in_slots.register_or_noreg()); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
842 Label L_loop, L_break; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
843 Register rax_top = rax_temp; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
844 if (!top_addr.is_same_address(Address(rax_top, 0))) |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
845 __ lea(rax_top, top_addr); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
846 // Detect empty (or broken) loop: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
847 #ifdef ASSERT |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
848 if (VerifyMethodHandles) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
849 // Verify that &bottom < &top (non-empty interval) |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
850 Label L_ok, L_bad; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
851 if (positive_distance_in_slots.is_register()) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
852 __ cmpptr(positive_distance_in_slots.as_register(), (int32_t) 0); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
853 __ jcc(Assembler::lessEqual, L_bad); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
854 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
855 __ cmpptr(rbx_bottom, rax_top); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
856 __ jcc(Assembler::below, L_ok); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
857 __ bind(L_bad); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
858 __ stop("valid bounds (copy up)"); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
859 __ BIND(L_ok); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
860 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
861 #endif |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
862 __ cmpptr(rbx_bottom, rax_top); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
863 __ jccb(Assembler::aboveEqual, L_break); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
864 // work rax down to rbx, copying contiguous data upwards |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
865 // In pseudo-code: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
866 // [rbx, rax) = &[bottom, top) |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
867 // while (--rax >= rbx) *(rax + distance) = *(rax + 0), rax--; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
868 __ BIND(L_loop); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
869 __ subptr(rax_top, wordSize); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
870 __ movptr(rdx_temp, Address(rax_top, 0)); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
871 __ movptr( Address(rax_top, positive_distance_in_slots, Address::times_ptr), rdx_temp); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
872 __ cmpptr(rax_top, rbx_bottom); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
873 __ jcc(Assembler::above, L_loop); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
874 assert(Interpreter::stackElementSize == wordSize, "else change loop"); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
875 __ bind(L_break); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
876 BLOCK_COMMENT("} move_arg_slots_up"); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
877 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
878 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
879 // in-place movement; no change to rsp |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
880 // blows rax_temp, rdx_temp |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
881 void MethodHandles::move_arg_slots_down(MacroAssembler* _masm, |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
882 Address bottom_addr, // can use rax_temp |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
883 Register rbx_top, // invariant |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
884 RegisterOrConstant negative_distance_in_slots, |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
885 Register rax_temp, Register rdx_temp) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
886 BLOCK_COMMENT("move_arg_slots_down {"); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
887 assert_different_registers(rbx_top, |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
888 negative_distance_in_slots.register_or_noreg(), |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
889 rax_temp, rdx_temp); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
890 Label L_loop, L_break; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
891 Register rax_bottom = rax_temp; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
892 if (!bottom_addr.is_same_address(Address(rax_bottom, 0))) |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
893 __ lea(rax_bottom, bottom_addr); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
894 // Detect empty (or broken) loop: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
895 #ifdef ASSERT |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
896 assert(!negative_distance_in_slots.is_constant() || negative_distance_in_slots.as_constant() < 0, ""); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
897 if (VerifyMethodHandles) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
898 // Verify that &bottom < &top (non-empty interval) |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
899 Label L_ok, L_bad; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
900 if (negative_distance_in_slots.is_register()) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
901 __ cmpptr(negative_distance_in_slots.as_register(), (int32_t) 0); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
902 __ jcc(Assembler::greaterEqual, L_bad); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
903 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
904 __ cmpptr(rax_bottom, rbx_top); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
905 __ jcc(Assembler::below, L_ok); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
906 __ bind(L_bad); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
907 __ stop("valid bounds (copy down)"); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
908 __ BIND(L_ok); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
909 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
910 #endif |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
911 __ cmpptr(rax_bottom, rbx_top); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
912 __ jccb(Assembler::aboveEqual, L_break); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
913 // work rax up to rbx, copying contiguous data downwards |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
914 // In pseudo-code: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
915 // [rax, rbx) = &[bottom, top) |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
916 // while (rax < rbx) *(rax - distance) = *(rax + 0), rax++; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
917 __ BIND(L_loop); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
918 __ movptr(rdx_temp, Address(rax_bottom, 0)); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
919 __ movptr( Address(rax_bottom, negative_distance_in_slots, Address::times_ptr), rdx_temp); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
920 __ addptr(rax_bottom, wordSize); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
921 __ cmpptr(rax_bottom, rbx_top); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
922 __ jcc(Assembler::below, L_loop); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
923 assert(Interpreter::stackElementSize == wordSize, "else change loop"); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
924 __ bind(L_break); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
925 BLOCK_COMMENT("} move_arg_slots_down"); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
926 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
927 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
928 // Copy from a field or array element to a stacked argument slot. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
929 // is_element (ignored) says whether caller is loading an array element instead of an instance field. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
930 void MethodHandles::move_typed_arg(MacroAssembler* _masm, |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
931 BasicType type, bool is_element, |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
932 Address slot_dest, Address value_src, |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
933 Register rbx_temp, Register rdx_temp) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
934 BLOCK_COMMENT(!is_element ? "move_typed_arg {" : "move_typed_arg { (array element)"); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
935 if (type == T_OBJECT || type == T_ARRAY) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
936 __ load_heap_oop(rbx_temp, value_src); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
937 __ movptr(slot_dest, rbx_temp); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
938 } else if (type != T_VOID) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
939 int arg_size = type2aelembytes(type); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
940 bool arg_is_signed = is_signed_subword_type(type); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
941 int slot_size = (arg_size > wordSize) ? arg_size : wordSize; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
942 __ load_sized_value( rdx_temp, value_src, arg_size, arg_is_signed, rbx_temp); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
943 __ store_sized_value( slot_dest, rdx_temp, slot_size, rbx_temp); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
944 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
945 BLOCK_COMMENT("} move_typed_arg"); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
946 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
947 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
948 void MethodHandles::move_return_value(MacroAssembler* _masm, BasicType type, |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
949 Address return_slot) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
950 BLOCK_COMMENT("move_return_value {"); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
951 // Old versions of the JVM must clean the FPU stack after every return. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
952 #ifndef _LP64 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
953 #ifdef COMPILER2 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
954 // The FPU stack is clean if UseSSE >= 2 but must be cleaned in other cases |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
955 if ((type == T_FLOAT && UseSSE < 1) || (type == T_DOUBLE && UseSSE < 2)) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
956 for (int i = 1; i < 8; i++) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
957 __ ffree(i); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
958 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
959 } else if (UseSSE < 2) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
960 __ empty_FPU_stack(); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
961 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
962 #endif //COMPILER2 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
963 #endif //!_LP64 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
964 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
965 // Look at the type and pull the value out of the corresponding register. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
966 if (type == T_VOID) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
967 // nothing to do |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
968 } else if (type == T_OBJECT) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
969 __ movptr(return_slot, rax); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
970 } else if (type == T_INT || is_subword_type(type)) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
971 // write the whole word, even if only 32 bits is significant |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
972 __ movptr(return_slot, rax); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
973 } else if (type == T_LONG) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
974 // store the value by parts |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
975 // Note: We assume longs are continguous (if misaligned) on the interpreter stack. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
976 __ store_sized_value(return_slot, rax, BytesPerLong, rdx); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
977 } else if (NOT_LP64((type == T_FLOAT && UseSSE < 1) || |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
978 (type == T_DOUBLE && UseSSE < 2) ||) |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
979 false) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
980 // Use old x86 FPU registers: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
981 if (type == T_FLOAT) |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
982 __ fstp_s(return_slot); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
983 else |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
984 __ fstp_d(return_slot); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
985 } else if (type == T_FLOAT) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
986 __ movflt(return_slot, xmm0); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
987 } else if (type == T_DOUBLE) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
988 __ movdbl(return_slot, xmm0); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
989 } else { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
990 ShouldNotReachHere(); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
991 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
992 BLOCK_COMMENT("} move_return_value"); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
993 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
994 |
4824
5dbed2f542ff
7120468: SPARC/x86: use frame::describe to enhance trace_method_handle
bdelsart
parents:
4818
diff
changeset
|
995 #ifndef PRODUCT |
4818
82e5a84b7436
7120450: complete information dumped by frame_describe
bdelsart
parents:
4807
diff
changeset
|
996 #define DESCRIBE_RICOCHET_OFFSET(rf, name) \ |
82e5a84b7436
7120450: complete information dumped by frame_describe
bdelsart
parents:
4807
diff
changeset
|
997 values.describe(frame_no, (intptr_t *) (((uintptr_t)rf) + MethodHandles::RicochetFrame::name##_offset_in_bytes()), #name) |
82e5a84b7436
7120450: complete information dumped by frame_describe
bdelsart
parents:
4807
diff
changeset
|
998 |
82e5a84b7436
7120450: complete information dumped by frame_describe
bdelsart
parents:
4807
diff
changeset
|
999 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
|
1000 address bp = (address) fr->fp(); |
82e5a84b7436
7120450: complete information dumped by frame_describe
bdelsart
parents:
4807
diff
changeset
|
1001 RicochetFrame* rf = (RicochetFrame*)(bp - sender_link_offset_in_bytes()); |
82e5a84b7436
7120450: complete information dumped by frame_describe
bdelsart
parents:
4807
diff
changeset
|
1002 |
82e5a84b7436
7120450: complete information dumped by frame_describe
bdelsart
parents:
4807
diff
changeset
|
1003 // ricochet slots |
82e5a84b7436
7120450: complete information dumped by frame_describe
bdelsart
parents:
4807
diff
changeset
|
1004 DESCRIBE_RICOCHET_OFFSET(rf, exact_sender_sp); |
82e5a84b7436
7120450: complete information dumped by frame_describe
bdelsart
parents:
4807
diff
changeset
|
1005 DESCRIBE_RICOCHET_OFFSET(rf, conversion); |
82e5a84b7436
7120450: complete information dumped by frame_describe
bdelsart
parents:
4807
diff
changeset
|
1006 DESCRIBE_RICOCHET_OFFSET(rf, saved_args_base); |
82e5a84b7436
7120450: complete information dumped by frame_describe
bdelsart
parents:
4807
diff
changeset
|
1007 DESCRIBE_RICOCHET_OFFSET(rf, saved_args_layout); |
82e5a84b7436
7120450: complete information dumped by frame_describe
bdelsart
parents:
4807
diff
changeset
|
1008 DESCRIBE_RICOCHET_OFFSET(rf, saved_target); |
82e5a84b7436
7120450: complete information dumped by frame_describe
bdelsart
parents:
4807
diff
changeset
|
1009 DESCRIBE_RICOCHET_OFFSET(rf, continuation); |
82e5a84b7436
7120450: complete information dumped by frame_describe
bdelsart
parents:
4807
diff
changeset
|
1010 |
82e5a84b7436
7120450: complete information dumped by frame_describe
bdelsart
parents:
4807
diff
changeset
|
1011 // relevant ricochet targets (in caller frame) |
82e5a84b7436
7120450: complete information dumped by frame_describe
bdelsart
parents:
4807
diff
changeset
|
1012 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
|
1013 } |
82e5a84b7436
7120450: complete information dumped by frame_describe
bdelsart
parents:
4807
diff
changeset
|
1014 #endif // ASSERT |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1015 |
710 | 1016 #ifndef PRODUCT |
1133
aa62b9388fce
6894206: JVM needs a way to traverse method handle structures
twisti
parents:
1108
diff
changeset
|
1017 extern "C" void print_method_handle(oop mh); |
710 | 1018 void trace_method_handle_stub(const char* adaptername, |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1019 oop mh, |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1020 intptr_t* saved_regs, |
4939
45a1bf98f1bb
7141329: Strange values of stack_size in -XX:+TraceMethodHandles output
twisti
parents:
4874
diff
changeset
|
1021 intptr_t* entry_sp) { |
710 | 1022 // called as a leaf from native code: do not block the JVM! |
3371
fabcf26ee72f
6998541: JSR 292 implement missing return-type conversion for OP_RETYPE_RAW
twisti
parents:
3363
diff
changeset
|
1023 bool has_mh = (strstr(adaptername, "return/") == NULL); // return adapters don't have rcx_mh |
4939
45a1bf98f1bb
7141329: Strange values of stack_size in -XX:+TraceMethodHandles output
twisti
parents:
4874
diff
changeset
|
1024 const char* mh_reg_name = has_mh ? "rcx_mh" : "rcx"; |
45a1bf98f1bb
7141329: Strange values of stack_size in -XX:+TraceMethodHandles output
twisti
parents:
4874
diff
changeset
|
1025 tty->print_cr("MH %s %s="PTR_FORMAT" sp="PTR_FORMAT, adaptername, mh_reg_name, mh, entry_sp); |
4824
5dbed2f542ff
7120468: SPARC/x86: use frame::describe to enhance trace_method_handle
bdelsart
parents:
4818
diff
changeset
|
1026 |
1793
d257356e35f0
6939224: MethodHandle.invokeGeneric needs to perform the correct set of conversions
jrose
parents:
1552
diff
changeset
|
1027 if (Verbose) { |
4939
45a1bf98f1bb
7141329: Strange values of stack_size in -XX:+TraceMethodHandles output
twisti
parents:
4874
diff
changeset
|
1028 tty->print_cr("Registers:"); |
45a1bf98f1bb
7141329: Strange values of stack_size in -XX:+TraceMethodHandles output
twisti
parents:
4874
diff
changeset
|
1029 const int saved_regs_count = RegisterImpl::number_of_registers; |
45a1bf98f1bb
7141329: Strange values of stack_size in -XX:+TraceMethodHandles output
twisti
parents:
4874
diff
changeset
|
1030 for (int i = 0; i < saved_regs_count; i++) { |
45a1bf98f1bb
7141329: Strange values of stack_size in -XX:+TraceMethodHandles output
twisti
parents:
4874
diff
changeset
|
1031 Register r = as_Register(i); |
45a1bf98f1bb
7141329: Strange values of stack_size in -XX:+TraceMethodHandles output
twisti
parents:
4874
diff
changeset
|
1032 // The registers are stored in reverse order on the stack (by pusha). |
45a1bf98f1bb
7141329: Strange values of stack_size in -XX:+TraceMethodHandles output
twisti
parents:
4874
diff
changeset
|
1033 tty->print("%3s=" PTR_FORMAT, r->name(), saved_regs[((saved_regs_count - 1) - i)]); |
45a1bf98f1bb
7141329: Strange values of stack_size in -XX:+TraceMethodHandles output
twisti
parents:
4874
diff
changeset
|
1034 if ((i + 1) % 4 == 0) { |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1035 tty->cr(); |
4939
45a1bf98f1bb
7141329: Strange values of stack_size in -XX:+TraceMethodHandles output
twisti
parents:
4874
diff
changeset
|
1036 } else { |
45a1bf98f1bb
7141329: Strange values of stack_size in -XX:+TraceMethodHandles output
twisti
parents:
4874
diff
changeset
|
1037 tty->print(", "); |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1038 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1039 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1040 tty->cr(); |
4824
5dbed2f542ff
7120468: SPARC/x86: use frame::describe to enhance trace_method_handle
bdelsart
parents:
4818
diff
changeset
|
1041 |
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 // dumping last frame with frame::describe |
5dbed2f542ff
7120468: SPARC/x86: use frame::describe to enhance trace_method_handle
bdelsart
parents:
4818
diff
changeset
|
1044 |
5dbed2f542ff
7120468: SPARC/x86: use frame::describe to enhance trace_method_handle
bdelsart
parents:
4818
diff
changeset
|
1045 JavaThread* p = JavaThread::active(); |
5dbed2f542ff
7120468: SPARC/x86: use frame::describe to enhance trace_method_handle
bdelsart
parents:
4818
diff
changeset
|
1046 |
5dbed2f542ff
7120468: SPARC/x86: use frame::describe to enhance trace_method_handle
bdelsart
parents:
4818
diff
changeset
|
1047 ResourceMark rm; |
5dbed2f542ff
7120468: SPARC/x86: use frame::describe to enhance trace_method_handle
bdelsart
parents:
4818
diff
changeset
|
1048 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
|
1049 FrameValues values; |
5dbed2f542ff
7120468: SPARC/x86: use frame::describe to enhance trace_method_handle
bdelsart
parents:
4818
diff
changeset
|
1050 |
5dbed2f542ff
7120468: SPARC/x86: use frame::describe to enhance trace_method_handle
bdelsart
parents:
4818
diff
changeset
|
1051 // 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
|
1052 // 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
|
1053 // without a PC on the stack top (e.g. not just after a call). |
5dbed2f542ff
7120468: SPARC/x86: use frame::describe to enhance trace_method_handle
bdelsart
parents:
4818
diff
changeset
|
1054 // 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
|
1055 // => 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
|
1056 |
5dbed2f542ff
7120468: SPARC/x86: use frame::describe to enhance trace_method_handle
bdelsart
parents:
4818
diff
changeset
|
1057 // Current C frame |
5dbed2f542ff
7120468: SPARC/x86: use frame::describe to enhance trace_method_handle
bdelsart
parents:
4818
diff
changeset
|
1058 frame cur_frame = os::current_frame(); |
5dbed2f542ff
7120468: SPARC/x86: use frame::describe to enhance trace_method_handle
bdelsart
parents:
4818
diff
changeset
|
1059 |
5dbed2f542ff
7120468: SPARC/x86: use frame::describe to enhance trace_method_handle
bdelsart
parents:
4818
diff
changeset
|
1060 // Robust search of trace_calling_frame (independant of inlining). |
5dbed2f542ff
7120468: SPARC/x86: use frame::describe to enhance trace_method_handle
bdelsart
parents:
4818
diff
changeset
|
1061 // Assumes saved_regs comes from a pusha in the trace_calling_frame. |
5dbed2f542ff
7120468: SPARC/x86: use frame::describe to enhance trace_method_handle
bdelsart
parents:
4818
diff
changeset
|
1062 assert(cur_frame.sp() < saved_regs, "registers not saved on stack ?"); |
5dbed2f542ff
7120468: SPARC/x86: use frame::describe to enhance trace_method_handle
bdelsart
parents:
4818
diff
changeset
|
1063 frame trace_calling_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
|
1064 while (trace_calling_frame.fp() < saved_regs) { |
5dbed2f542ff
7120468: SPARC/x86: use frame::describe to enhance trace_method_handle
bdelsart
parents:
4818
diff
changeset
|
1065 trace_calling_frame = os::get_sender_for_C_frame(&trace_calling_frame); |
5dbed2f542ff
7120468: SPARC/x86: use frame::describe to enhance trace_method_handle
bdelsart
parents:
4818
diff
changeset
|
1066 } |
5dbed2f542ff
7120468: SPARC/x86: use frame::describe to enhance trace_method_handle
bdelsart
parents:
4818
diff
changeset
|
1067 |
5dbed2f542ff
7120468: SPARC/x86: use frame::describe to enhance trace_method_handle
bdelsart
parents:
4818
diff
changeset
|
1068 // 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
|
1069 intptr_t *dump_sp = trace_calling_frame.sender_sp(); |
5dbed2f542ff
7120468: SPARC/x86: use frame::describe to enhance trace_method_handle
bdelsart
parents:
4818
diff
changeset
|
1070 intptr_t *dump_fp = trace_calling_frame.link(); |
5dbed2f542ff
7120468: SPARC/x86: use frame::describe to enhance trace_method_handle
bdelsart
parents:
4818
diff
changeset
|
1071 |
5dbed2f542ff
7120468: SPARC/x86: use frame::describe to enhance trace_method_handle
bdelsart
parents:
4818
diff
changeset
|
1072 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
|
1073 |
5dbed2f542ff
7120468: SPARC/x86: use frame::describe to enhance trace_method_handle
bdelsart
parents:
4818
diff
changeset
|
1074 if (walkable) { |
5dbed2f542ff
7120468: SPARC/x86: use frame::describe to enhance trace_method_handle
bdelsart
parents:
4818
diff
changeset
|
1075 // 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
|
1076 // 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
|
1077 // failing. Alternatively, frame constructors could be |
5dbed2f542ff
7120468: SPARC/x86: use frame::describe to enhance trace_method_handle
bdelsart
parents:
4818
diff
changeset
|
1078 // 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
|
1079 // 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
|
1080 // 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
|
1081 frame dump_frame = frame(dump_sp, dump_fp); |
5dbed2f542ff
7120468: SPARC/x86: use frame::describe to enhance trace_method_handle
bdelsart
parents:
4818
diff
changeset
|
1082 dump_frame.describe(values, 1); |
5dbed2f542ff
7120468: SPARC/x86: use frame::describe to enhance trace_method_handle
bdelsart
parents:
4818
diff
changeset
|
1083 } else { |
5dbed2f542ff
7120468: SPARC/x86: use frame::describe to enhance trace_method_handle
bdelsart
parents:
4818
diff
changeset
|
1084 // Stack may not be walkable (invalid PC above FP): |
5dbed2f542ff
7120468: SPARC/x86: use frame::describe to enhance trace_method_handle
bdelsart
parents:
4818
diff
changeset
|
1085 // 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
|
1086 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
|
1087 values.describe(-1, dump_sp, "sp for #1"); |
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 |
4939
45a1bf98f1bb
7141329: Strange values of stack_size in -XX:+TraceMethodHandles output
twisti
parents:
4874
diff
changeset
|
1090 tty->print_cr("Stack layout:"); |
4824
5dbed2f542ff
7120468: SPARC/x86: use frame::describe to enhance trace_method_handle
bdelsart
parents:
4818
diff
changeset
|
1091 values.print(p); |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1092 } |
3371
fabcf26ee72f
6998541: JSR 292 implement missing return-type conversion for OP_RETYPE_RAW
twisti
parents:
3363
diff
changeset
|
1093 if (has_mh) |
fabcf26ee72f
6998541: JSR 292 implement missing return-type conversion for OP_RETYPE_RAW
twisti
parents:
3363
diff
changeset
|
1094 print_method_handle(mh); |
1793
d257356e35f0
6939224: MethodHandle.invokeGeneric needs to perform the correct set of conversions
jrose
parents:
1552
diff
changeset
|
1095 } |
d257356e35f0
6939224: MethodHandle.invokeGeneric needs to perform the correct set of conversions
jrose
parents:
1552
diff
changeset
|
1096 } |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1097 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1098 // The stub wraps the arguments in a struct on the stack to avoid |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1099 // dealing with the different calling conventions for passing 6 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1100 // arguments. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1101 struct MethodHandleStubArguments { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1102 const char* adaptername; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1103 oopDesc* mh; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1104 intptr_t* saved_regs; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1105 intptr_t* entry_sp; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1106 }; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1107 void trace_method_handle_stub_wrapper(MethodHandleStubArguments* args) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1108 trace_method_handle_stub(args->adaptername, |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1109 args->mh, |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1110 args->saved_regs, |
4939
45a1bf98f1bb
7141329: Strange values of stack_size in -XX:+TraceMethodHandles output
twisti
parents:
4874
diff
changeset
|
1111 args->entry_sp); |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1112 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1113 |
1793
d257356e35f0
6939224: MethodHandle.invokeGeneric needs to perform the correct set of conversions
jrose
parents:
1552
diff
changeset
|
1114 void MethodHandles::trace_method_handle(MacroAssembler* _masm, const char* adaptername) { |
d257356e35f0
6939224: MethodHandle.invokeGeneric needs to perform the correct set of conversions
jrose
parents:
1552
diff
changeset
|
1115 if (!TraceMethodHandles) return; |
d257356e35f0
6939224: MethodHandle.invokeGeneric needs to perform the correct set of conversions
jrose
parents:
1552
diff
changeset
|
1116 BLOCK_COMMENT("trace_method_handle {"); |
4824
5dbed2f542ff
7120468: SPARC/x86: use frame::describe to enhance trace_method_handle
bdelsart
parents:
4818
diff
changeset
|
1117 __ enter(); |
5dbed2f542ff
7120468: SPARC/x86: use frame::describe to enhance trace_method_handle
bdelsart
parents:
4818
diff
changeset
|
1118 __ andptr(rsp, -16); // align stack if needed for FPU state |
1793
d257356e35f0
6939224: MethodHandle.invokeGeneric needs to perform the correct set of conversions
jrose
parents:
1552
diff
changeset
|
1119 __ pusha(); |
4824
5dbed2f542ff
7120468: SPARC/x86: use frame::describe to enhance trace_method_handle
bdelsart
parents:
4818
diff
changeset
|
1120 __ mov(rbx, rsp); // for retreiving saved_regs |
5dbed2f542ff
7120468: SPARC/x86: use frame::describe to enhance trace_method_handle
bdelsart
parents:
4818
diff
changeset
|
1121 // Note: saved_regs must be in the entered frame for the |
5dbed2f542ff
7120468: SPARC/x86: use frame::describe to enhance trace_method_handle
bdelsart
parents:
4818
diff
changeset
|
1122 // robust stack walking implemented in trace_method_handle_stub. |
5dbed2f542ff
7120468: SPARC/x86: use frame::describe to enhance trace_method_handle
bdelsart
parents:
4818
diff
changeset
|
1123 |
5dbed2f542ff
7120468: SPARC/x86: use frame::describe to enhance trace_method_handle
bdelsart
parents:
4818
diff
changeset
|
1124 // 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
|
1125 __ increment(rsp, -2 * wordSize); |
5dbed2f542ff
7120468: SPARC/x86: use frame::describe to enhance trace_method_handle
bdelsart
parents:
4818
diff
changeset
|
1126 if (UseSSE >= 2) { |
5dbed2f542ff
7120468: SPARC/x86: use frame::describe to enhance trace_method_handle
bdelsart
parents:
4818
diff
changeset
|
1127 __ movdbl(Address(rsp, 0), xmm0); |
5dbed2f542ff
7120468: SPARC/x86: use frame::describe to enhance trace_method_handle
bdelsart
parents:
4818
diff
changeset
|
1128 } else if (UseSSE == 1) { |
5dbed2f542ff
7120468: SPARC/x86: use frame::describe to enhance trace_method_handle
bdelsart
parents:
4818
diff
changeset
|
1129 __ movflt(Address(rsp, 0), xmm0); |
5dbed2f542ff
7120468: SPARC/x86: use frame::describe to enhance trace_method_handle
bdelsart
parents:
4818
diff
changeset
|
1130 } else { |
5dbed2f542ff
7120468: SPARC/x86: use frame::describe to enhance trace_method_handle
bdelsart
parents:
4818
diff
changeset
|
1131 __ fst_d(Address(rsp, 0)); |
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 |
4939
45a1bf98f1bb
7141329: Strange values of stack_size in -XX:+TraceMethodHandles output
twisti
parents:
4874
diff
changeset
|
1134 // Incoming state: |
3336
2e038ad0c1d0
7009361: JSR 292 Invalid value on stack on solaris-sparc with -Xcomp
never
parents:
2357
diff
changeset
|
1135 // rcx: method handle |
4939
45a1bf98f1bb
7141329: Strange values of stack_size in -XX:+TraceMethodHandles output
twisti
parents:
4874
diff
changeset
|
1136 // |
45a1bf98f1bb
7141329: Strange values of stack_size in -XX:+TraceMethodHandles output
twisti
parents:
4874
diff
changeset
|
1137 // To avoid calling convention issues, build a record on the stack |
45a1bf98f1bb
7141329: Strange values of stack_size in -XX:+TraceMethodHandles output
twisti
parents:
4874
diff
changeset
|
1138 // and pass the pointer to that instead. |
4824
5dbed2f542ff
7120468: SPARC/x86: use frame::describe to enhance trace_method_handle
bdelsart
parents:
4818
diff
changeset
|
1139 __ push(rbp); // entry_sp (with extra align space) |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1140 __ push(rbx); // pusha saved_regs |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1141 __ push(rcx); // mh |
4824
5dbed2f542ff
7120468: SPARC/x86: use frame::describe to enhance trace_method_handle
bdelsart
parents:
4818
diff
changeset
|
1142 __ push(rcx); // slot for adaptername |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1143 __ movptr(Address(rsp, 0), (intptr_t) adaptername); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1144 __ super_call_VM_leaf(CAST_FROM_FN_PTR(address, trace_method_handle_stub_wrapper), rsp); |
4939
45a1bf98f1bb
7141329: Strange values of stack_size in -XX:+TraceMethodHandles output
twisti
parents:
4874
diff
changeset
|
1145 __ increment(rsp, sizeof(MethodHandleStubArguments)); |
4824
5dbed2f542ff
7120468: SPARC/x86: use frame::describe to enhance trace_method_handle
bdelsart
parents:
4818
diff
changeset
|
1146 |
5dbed2f542ff
7120468: SPARC/x86: use frame::describe to enhance trace_method_handle
bdelsart
parents:
4818
diff
changeset
|
1147 if (UseSSE >= 2) { |
5dbed2f542ff
7120468: SPARC/x86: use frame::describe to enhance trace_method_handle
bdelsart
parents:
4818
diff
changeset
|
1148 __ movdbl(xmm0, Address(rsp, 0)); |
5dbed2f542ff
7120468: SPARC/x86: use frame::describe to enhance trace_method_handle
bdelsart
parents:
4818
diff
changeset
|
1149 } else if (UseSSE == 1) { |
5dbed2f542ff
7120468: SPARC/x86: use frame::describe to enhance trace_method_handle
bdelsart
parents:
4818
diff
changeset
|
1150 __ movflt(xmm0, Address(rsp, 0)); |
5dbed2f542ff
7120468: SPARC/x86: use frame::describe to enhance trace_method_handle
bdelsart
parents:
4818
diff
changeset
|
1151 } else { |
5dbed2f542ff
7120468: SPARC/x86: use frame::describe to enhance trace_method_handle
bdelsart
parents:
4818
diff
changeset
|
1152 __ fld_d(Address(rsp, 0)); |
5dbed2f542ff
7120468: SPARC/x86: use frame::describe to enhance trace_method_handle
bdelsart
parents:
4818
diff
changeset
|
1153 } |
5dbed2f542ff
7120468: SPARC/x86: use frame::describe to enhance trace_method_handle
bdelsart
parents:
4818
diff
changeset
|
1154 __ increment(rsp, 2 * wordSize); |
5dbed2f542ff
7120468: SPARC/x86: use frame::describe to enhance trace_method_handle
bdelsart
parents:
4818
diff
changeset
|
1155 |
1793
d257356e35f0
6939224: MethodHandle.invokeGeneric needs to perform the correct set of conversions
jrose
parents:
1552
diff
changeset
|
1156 __ popa(); |
4824
5dbed2f542ff
7120468: SPARC/x86: use frame::describe to enhance trace_method_handle
bdelsart
parents:
4818
diff
changeset
|
1157 __ leave(); |
1793
d257356e35f0
6939224: MethodHandle.invokeGeneric needs to perform the correct set of conversions
jrose
parents:
1552
diff
changeset
|
1158 BLOCK_COMMENT("} trace_method_handle"); |
710 | 1159 } |
1160 #endif //PRODUCT | |
1161 | |
1507
cd5dbf694d45
6939134: JSR 292 adjustments to method handle invocation
jrose
parents:
1506
diff
changeset
|
1162 // which conversion op types are implemented here? |
cd5dbf694d45
6939134: JSR 292 adjustments to method handle invocation
jrose
parents:
1506
diff
changeset
|
1163 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
|
1164 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
|
1165 |(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
|
1166 |(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
|
1167 |(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
|
1168 |(1<<java_lang_invoke_AdapterMethodHandle::OP_REF_TO_PRIM) |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1169 //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
|
1170 |(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
|
1171 |(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
|
1172 |(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
|
1173 |(1<<java_lang_invoke_AdapterMethodHandle::OP_DROP_ARGS) |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1174 //OP_COLLECT_ARGS is below... |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1175 |(1<<java_lang_invoke_AdapterMethodHandle::OP_SPREAD_ARGS) |
4807
15d394228cfa
7111138: delete the obsolete flag -XX:+UseRicochetFrames
jrose
parents:
4762
diff
changeset
|
1176 |( |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1177 java_lang_invoke_MethodTypeForm::vmlayout_offset_in_bytes() <= 0 ? 0 : |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1178 ((1<<java_lang_invoke_AdapterMethodHandle::OP_PRIM_TO_REF) |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1179 |(1<<java_lang_invoke_AdapterMethodHandle::OP_COLLECT_ARGS) |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1180 |(1<<java_lang_invoke_AdapterMethodHandle::OP_FOLD_ARGS) |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1181 )) |
1507
cd5dbf694d45
6939134: JSR 292 adjustments to method handle invocation
jrose
parents:
1506
diff
changeset
|
1182 ); |
cd5dbf694d45
6939134: JSR 292 adjustments to method handle invocation
jrose
parents:
1506
diff
changeset
|
1183 } |
cd5dbf694d45
6939134: JSR 292 adjustments to method handle invocation
jrose
parents:
1506
diff
changeset
|
1184 |
2088
8d0b933dda2d
7007377: JSR 292 MethodHandlesTest.testCastFailure fails on SPARC with -Xcomp +DeoptimizeALot
twisti
parents:
1972
diff
changeset
|
1185 //------------------------------------------------------------------------------ |
8d0b933dda2d
7007377: JSR 292 MethodHandlesTest.testCastFailure fails on SPARC with -Xcomp +DeoptimizeALot
twisti
parents:
1972
diff
changeset
|
1186 // MethodHandles::generate_method_handle_stub |
8d0b933dda2d
7007377: JSR 292 MethodHandlesTest.testCastFailure fails on SPARC with -Xcomp +DeoptimizeALot
twisti
parents:
1972
diff
changeset
|
1187 // |
710 | 1188 // Generate an "entry" field for a method handle. |
1189 // 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
|
1190 void MethodHandles::generate_method_handle_stub(MacroAssembler* _masm, MethodHandles::EntryKind ek) { |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1191 MethodHandles::EntryKind ek_orig = ek_original_kind(ek); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1192 |
710 | 1193 // Here is the register state during an interpreted call, |
1194 // as set up by generate_method_handle_interpreter_entry(): | |
1195 // - rbx: garbage temp (was MethodHandle.invoke methodOop, unused) | |
1196 // - rcx: receiver method handle | |
1197 // - rax: method handle type (only used by the check_mtype entry point) | |
1198 // - rsi/r13: sender SP (must preserve; see prepare_to_jump_from_interpreted) | |
1199 // - rdx: garbage temp, can blow away | |
1200 | |
2088
8d0b933dda2d
7007377: JSR 292 MethodHandlesTest.testCastFailure fails on SPARC with -Xcomp +DeoptimizeALot
twisti
parents:
1972
diff
changeset
|
1201 const Register rcx_recv = rcx; |
8d0b933dda2d
7007377: JSR 292 MethodHandlesTest.testCastFailure fails on SPARC with -Xcomp +DeoptimizeALot
twisti
parents:
1972
diff
changeset
|
1202 const Register rax_argslot = rax; |
8d0b933dda2d
7007377: JSR 292 MethodHandlesTest.testCastFailure fails on SPARC with -Xcomp +DeoptimizeALot
twisti
parents:
1972
diff
changeset
|
1203 const Register rbx_temp = rbx; |
8d0b933dda2d
7007377: JSR 292 MethodHandlesTest.testCastFailure fails on SPARC with -Xcomp +DeoptimizeALot
twisti
parents:
1972
diff
changeset
|
1204 const Register rdx_temp = rdx; |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1205 const Register rdi_temp = rdi; |
710 | 1206 |
1039
987e948ebbc8
6815692: method handle code needs some cleanup (post-6655638)
jrose
parents:
845
diff
changeset
|
1207 // This guy is set up by prepare_to_jump_from_interpreted (from interpreted calls) |
987e948ebbc8
6815692: method handle code needs some cleanup (post-6655638)
jrose
parents:
845
diff
changeset
|
1208 // and gen_c2i_adapter (from compiled calls): |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1209 const Register saved_last_sp = saved_last_sp_register(); |
2088
8d0b933dda2d
7007377: JSR 292 MethodHandlesTest.testCastFailure fails on SPARC with -Xcomp +DeoptimizeALot
twisti
parents:
1972
diff
changeset
|
1210 |
8d0b933dda2d
7007377: JSR 292 MethodHandlesTest.testCastFailure fails on SPARC with -Xcomp +DeoptimizeALot
twisti
parents:
1972
diff
changeset
|
1211 // Argument registers for _raise_exception. |
8d0b933dda2d
7007377: JSR 292 MethodHandlesTest.testCastFailure fails on SPARC with -Xcomp +DeoptimizeALot
twisti
parents:
1972
diff
changeset
|
1212 // 32-bit: Pass first two oop/int args in registers ECX and EDX. |
8d0b933dda2d
7007377: JSR 292 MethodHandlesTest.testCastFailure fails on SPARC with -Xcomp +DeoptimizeALot
twisti
parents:
1972
diff
changeset
|
1213 const Register rarg0_code = LP64_ONLY(j_rarg0) NOT_LP64(rcx); |
8d0b933dda2d
7007377: JSR 292 MethodHandlesTest.testCastFailure fails on SPARC with -Xcomp +DeoptimizeALot
twisti
parents:
1972
diff
changeset
|
1214 const Register rarg1_actual = LP64_ONLY(j_rarg1) NOT_LP64(rdx); |
8d0b933dda2d
7007377: JSR 292 MethodHandlesTest.testCastFailure fails on SPARC with -Xcomp +DeoptimizeALot
twisti
parents:
1972
diff
changeset
|
1215 const Register rarg2_required = LP64_ONLY(j_rarg2) NOT_LP64(rdi); |
8d0b933dda2d
7007377: JSR 292 MethodHandlesTest.testCastFailure fails on SPARC with -Xcomp +DeoptimizeALot
twisti
parents:
1972
diff
changeset
|
1216 assert_different_registers(rarg0_code, rarg1_actual, rarg2_required, saved_last_sp); |
1039
987e948ebbc8
6815692: method handle code needs some cleanup (post-6655638)
jrose
parents:
845
diff
changeset
|
1217 |
2357
8033953d67ff
7012648: move JSR 292 to package java.lang.invoke and adjust names
jrose
parents:
2321
diff
changeset
|
1218 guarantee(java_lang_invoke_MethodHandle::vmentry_offset_in_bytes() != 0, "must have offsets"); |
710 | 1219 |
1220 // some handy addresses | |
2357
8033953d67ff
7012648: move JSR 292 to package java.lang.invoke and adjust names
jrose
parents:
2321
diff
changeset
|
1221 Address rcx_mh_vmtarget( rcx_recv, java_lang_invoke_MethodHandle::vmtarget_offset_in_bytes() ); |
8033953d67ff
7012648: move JSR 292 to package java.lang.invoke and adjust names
jrose
parents:
2321
diff
changeset
|
1222 Address rcx_dmh_vmindex( rcx_recv, java_lang_invoke_DirectMethodHandle::vmindex_offset_in_bytes() ); |
710 | 1223 |
2357
8033953d67ff
7012648: move JSR 292 to package java.lang.invoke and adjust names
jrose
parents:
2321
diff
changeset
|
1224 Address rcx_bmh_vmargslot( rcx_recv, 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
|
1225 Address rcx_bmh_argument( rcx_recv, java_lang_invoke_BoundMethodHandle::argument_offset_in_bytes() ); |
710 | 1226 |
2357
8033953d67ff
7012648: move JSR 292 to package java.lang.invoke and adjust names
jrose
parents:
2321
diff
changeset
|
1227 Address rcx_amh_vmargslot( rcx_recv, 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
|
1228 Address rcx_amh_argument( rcx_recv, 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
|
1229 Address rcx_amh_conversion( rcx_recv, java_lang_invoke_AdapterMethodHandle::conversion_offset_in_bytes() ); |
710 | 1230 Address vmarg; // __ argument_address(vmargslot) |
1231 | |
4762
069ab3f976d3
7118863: Move sizeof(klassOopDesc) into the *Klass::*_offset_in_bytes() functions
stefank
parents:
4059
diff
changeset
|
1232 const int java_mirror_offset = in_bytes(Klass::java_mirror_offset()); |
1039
987e948ebbc8
6815692: method handle code needs some cleanup (post-6655638)
jrose
parents:
845
diff
changeset
|
1233 |
710 | 1234 if (have_entry(ek)) { |
1235 __ nop(); // empty stubs make SG sick | |
1236 return; | |
1237 } | |
1238 | |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1239 #ifdef ASSERT |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1240 __ push((int32_t) 0xEEEEEEEE); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1241 __ push((int32_t) (intptr_t) entry_name(ek)); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1242 LP64_ONLY(__ push((int32_t) high((intptr_t) entry_name(ek)))); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1243 __ push((int32_t) 0x33333333); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1244 #endif //ASSERT |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1245 |
710 | 1246 address interp_entry = __ pc(); |
1247 | |
1793
d257356e35f0
6939224: MethodHandle.invokeGeneric needs to perform the correct set of conversions
jrose
parents:
1552
diff
changeset
|
1248 trace_method_handle(_masm, entry_name(ek)); |
d257356e35f0
6939224: MethodHandle.invokeGeneric needs to perform the correct set of conversions
jrose
parents:
1552
diff
changeset
|
1249 |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3388
diff
changeset
|
1250 BLOCK_COMMENT(err_msg("Entry %s {", entry_name(ek))); |
710 | 1251 |
1252 switch ((int) ek) { | |
1039
987e948ebbc8
6815692: method handle code needs some cleanup (post-6655638)
jrose
parents:
845
diff
changeset
|
1253 case _raise_exception: |
710 | 1254 { |
2088
8d0b933dda2d
7007377: JSR 292 MethodHandlesTest.testCastFailure fails on SPARC with -Xcomp +DeoptimizeALot
twisti
parents:
1972
diff
changeset
|
1255 // Not a real MH entry, but rather shared code for raising an |
2321
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2258
diff
changeset
|
1256 // exception. Since we use the compiled entry, arguments are |
1b4e6a5d98e0
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
2258
diff
changeset
|
1257 // expected in compiler argument registers. |
2116
d810e9a3fc33
7010180: JSR 292 InvokeDynamicPrintArgs fails with: assert(_adapter == NULL) failed: init'd to NULL
twisti
parents:
2088
diff
changeset
|
1258 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
|
1259 assert(raise_exception_method()->from_compiled_entry(), "method must be linked"); |
710 | 1260 |
3808
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
1261 const Register rax_pc = rax; |
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
1262 __ pop(rax_pc); // caller PC |
2088
8d0b933dda2d
7007377: JSR 292 MethodHandlesTest.testCastFailure fails on SPARC with -Xcomp +DeoptimizeALot
twisti
parents:
1972
diff
changeset
|
1263 __ mov(rsp, saved_last_sp); // cut the stack back to where the caller started |
710 | 1264 |
1039
987e948ebbc8
6815692: method handle code needs some cleanup (post-6655638)
jrose
parents:
845
diff
changeset
|
1265 Register rbx_method = rbx_temp; |
987e948ebbc8
6815692: method handle code needs some cleanup (post-6655638)
jrose
parents:
845
diff
changeset
|
1266 __ movptr(rbx_method, ExternalAddress((address) &_raise_exception_method)); |
2088
8d0b933dda2d
7007377: JSR 292 MethodHandlesTest.testCastFailure fails on SPARC with -Xcomp +DeoptimizeALot
twisti
parents:
1972
diff
changeset
|
1267 |
8d0b933dda2d
7007377: JSR 292 MethodHandlesTest.testCastFailure fails on SPARC with -Xcomp +DeoptimizeALot
twisti
parents:
1972
diff
changeset
|
1268 const int jobject_oop_offset = 0; |
1039
987e948ebbc8
6815692: method handle code needs some cleanup (post-6655638)
jrose
parents:
845
diff
changeset
|
1269 __ movptr(rbx_method, Address(rbx_method, jobject_oop_offset)); // dereference the jobject |
3808
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
1270 |
3848 | 1271 __ movptr(saved_last_sp, rsp); |
3808
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
1272 __ subptr(rsp, 3 * wordSize); |
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
1273 __ push(rax_pc); // restore caller PC |
2088
8d0b933dda2d
7007377: JSR 292 MethodHandlesTest.testCastFailure fails on SPARC with -Xcomp +DeoptimizeALot
twisti
parents:
1972
diff
changeset
|
1274 |
3848 | 1275 __ movl (__ argument_address(constant(2)), rarg0_code); |
3808
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
1276 __ movptr(__ argument_address(constant(1)), rarg1_actual); |
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
1277 __ movptr(__ argument_address(constant(0)), rarg2_required); |
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
1278 jump_from_method_handle(_masm, rbx_method, rax); |
710 | 1279 } |
1280 break; | |
1281 | |
1282 case _invokestatic_mh: | |
1283 case _invokespecial_mh: | |
1284 { | |
1285 Register rbx_method = rbx_temp; | |
1846 | 1286 __ load_heap_oop(rbx_method, rcx_mh_vmtarget); // target is a methodOop |
710 | 1287 __ verify_oop(rbx_method); |
1288 // same as TemplateTable::invokestatic or invokespecial, | |
1289 // minus the CP setup and profiling: | |
1290 if (ek == _invokespecial_mh) { | |
1291 // Must load & check the first argument before entering the target method. | |
1292 __ load_method_handle_vmslots(rax_argslot, rcx_recv, rdx_temp); | |
1293 __ movptr(rcx_recv, __ argument_address(rax_argslot, -1)); | |
1294 __ null_check(rcx_recv); | |
1295 __ verify_oop(rcx_recv); | |
1296 } | |
3808
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
1297 jump_from_method_handle(_masm, rbx_method, rax); |
710 | 1298 } |
1299 break; | |
1300 | |
1301 case _invokevirtual_mh: | |
1302 { | |
1303 // same as TemplateTable::invokevirtual, | |
1304 // minus the CP setup and profiling: | |
1305 | |
1306 // pick out the vtable index and receiver offset from the MH, | |
1307 // and then we can discard it: | |
1308 __ load_method_handle_vmslots(rax_argslot, rcx_recv, rdx_temp); | |
1309 Register rbx_index = rbx_temp; | |
1310 __ movl(rbx_index, rcx_dmh_vmindex); | |
1311 // Note: The verifier allows us to ignore rcx_mh_vmtarget. | |
1312 __ movptr(rcx_recv, __ argument_address(rax_argslot, -1)); | |
1313 __ null_check(rcx_recv, oopDesc::klass_offset_in_bytes()); | |
1314 | |
1315 // get receiver klass | |
1316 Register rax_klass = rax_argslot; | |
1317 __ load_klass(rax_klass, rcx_recv); | |
1318 __ verify_oop(rax_klass); | |
1319 | |
1320 // get target methodOop & entry point | |
1321 const int base = instanceKlass::vtable_start_offset() * wordSize; | |
1322 assert(vtableEntry::size() * wordSize == wordSize, "adjust the scaling in the code below"); | |
1323 Address vtable_entry_addr(rax_klass, | |
1324 rbx_index, Address::times_ptr, | |
1325 base + vtableEntry::method_offset_in_bytes()); | |
1326 Register rbx_method = rbx_temp; | |
1108 | 1327 __ movptr(rbx_method, vtable_entry_addr); |
710 | 1328 |
1329 __ verify_oop(rbx_method); | |
3808
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
1330 jump_from_method_handle(_masm, rbx_method, rax); |
710 | 1331 } |
1332 break; | |
1333 | |
1334 case _invokeinterface_mh: | |
1335 { | |
1336 // same as TemplateTable::invokeinterface, | |
1337 // minus the CP setup and profiling: | |
1338 | |
1339 // pick out the interface and itable index from the MH. | |
1340 __ load_method_handle_vmslots(rax_argslot, rcx_recv, rdx_temp); | |
1341 Register rdx_intf = rdx_temp; | |
1342 Register rbx_index = rbx_temp; | |
1846 | 1343 __ load_heap_oop(rdx_intf, rcx_mh_vmtarget); |
1344 __ movl(rbx_index, rcx_dmh_vmindex); | |
710 | 1345 __ movptr(rcx_recv, __ argument_address(rax_argslot, -1)); |
1346 __ null_check(rcx_recv, oopDesc::klass_offset_in_bytes()); | |
1347 | |
1348 // get receiver klass | |
1349 Register rax_klass = rax_argslot; | |
1350 __ load_klass(rax_klass, rcx_recv); | |
1351 __ verify_oop(rax_klass); | |
1352 | |
1353 Register rbx_method = rbx_index; | |
1354 | |
1355 // get interface klass | |
1356 Label no_such_interface; | |
1357 __ verify_oop(rdx_intf); | |
1358 __ lookup_interface_method(rax_klass, rdx_intf, | |
1359 // note: next two args must be the same: | |
1360 rbx_index, rbx_method, | |
1039
987e948ebbc8
6815692: method handle code needs some cleanup (post-6655638)
jrose
parents:
845
diff
changeset
|
1361 rdi_temp, |
710 | 1362 no_such_interface); |
1363 | |
1364 __ verify_oop(rbx_method); | |
3808
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
1365 jump_from_method_handle(_masm, rbx_method, rax); |
710 | 1366 __ hlt(); |
1367 | |
1368 __ bind(no_such_interface); | |
1369 // Throw an exception. | |
1370 // For historical reasons, it will be IncompatibleClassChangeError. | |
2088
8d0b933dda2d
7007377: JSR 292 MethodHandlesTest.testCastFailure fails on SPARC with -Xcomp +DeoptimizeALot
twisti
parents:
1972
diff
changeset
|
1371 __ mov(rbx_temp, rcx_recv); // rarg2_required might be RCX |
8d0b933dda2d
7007377: JSR 292 MethodHandlesTest.testCastFailure fails on SPARC with -Xcomp +DeoptimizeALot
twisti
parents:
1972
diff
changeset
|
1372 assert_different_registers(rarg2_required, rbx_temp); |
8d0b933dda2d
7007377: JSR 292 MethodHandlesTest.testCastFailure fails on SPARC with -Xcomp +DeoptimizeALot
twisti
parents:
1972
diff
changeset
|
1373 __ movptr(rarg2_required, Address(rdx_intf, java_mirror_offset)); // required interface |
8d0b933dda2d
7007377: JSR 292 MethodHandlesTest.testCastFailure fails on SPARC with -Xcomp +DeoptimizeALot
twisti
parents:
1972
diff
changeset
|
1374 __ mov( rarg1_actual, rbx_temp); // bad receiver |
8d0b933dda2d
7007377: JSR 292 MethodHandlesTest.testCastFailure fails on SPARC with -Xcomp +DeoptimizeALot
twisti
parents:
1972
diff
changeset
|
1375 __ movl( rarg0_code, (int) Bytecodes::_invokeinterface); // who is complaining? |
1039
987e948ebbc8
6815692: method handle code needs some cleanup (post-6655638)
jrose
parents:
845
diff
changeset
|
1376 __ jump(ExternalAddress(from_interpreted_entry(_raise_exception))); |
710 | 1377 } |
1378 break; | |
1379 | |
1380 case _bound_ref_mh: | |
1381 case _bound_int_mh: | |
1382 case _bound_long_mh: | |
1383 case _bound_ref_direct_mh: | |
1384 case _bound_int_direct_mh: | |
1385 case _bound_long_direct_mh: | |
1386 { | |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3388
diff
changeset
|
1387 const bool direct_to_method = (ek >= _bound_ref_direct_mh); |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1388 BasicType arg_type = ek_bound_mh_arg_type(ek); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1389 int arg_slots = type2size[arg_type]; |
710 | 1390 |
1391 // make room for the new argument: | |
1392 __ movl(rax_argslot, rcx_bmh_vmargslot); | |
1393 __ lea(rax_argslot, __ argument_address(rax_argslot)); | |
2258
28bf941f445e
7018378: JSR 292: _bound_int_mh produces wrong result on 64-bit SPARC
twisti
parents:
2116
diff
changeset
|
1394 |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1395 insert_arg_slots(_masm, arg_slots * stack_move_unit(), rax_argslot, rbx_temp, rdx_temp); |
710 | 1396 |
1397 // store bound argument into the new stack slot: | |
1846 | 1398 __ load_heap_oop(rbx_temp, rcx_bmh_argument); |
710 | 1399 if (arg_type == T_OBJECT) { |
1400 __ movptr(Address(rax_argslot, 0), rbx_temp); | |
1401 } else { | |
2258
28bf941f445e
7018378: JSR 292: _bound_int_mh produces wrong result on 64-bit SPARC
twisti
parents:
2116
diff
changeset
|
1402 Address prim_value_addr(rbx_temp, java_lang_boxing_object::value_offset_in_bytes(arg_type)); |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1403 move_typed_arg(_masm, arg_type, false, |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1404 Address(rax_argslot, 0), |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1405 prim_value_addr, |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1406 rbx_temp, rdx_temp); |
710 | 1407 } |
1408 | |
1409 if (direct_to_method) { | |
1410 Register rbx_method = rbx_temp; | |
1846 | 1411 __ load_heap_oop(rbx_method, rcx_mh_vmtarget); |
710 | 1412 __ verify_oop(rbx_method); |
3808
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3781
diff
changeset
|
1413 jump_from_method_handle(_masm, rbx_method, rax); |
710 | 1414 } else { |
1846 | 1415 __ load_heap_oop(rcx_recv, rcx_mh_vmtarget); |
710 | 1416 __ verify_oop(rcx_recv); |
1417 __ jump_to_method_handle_entry(rcx_recv, rdx_temp); | |
1418 } | |
1419 } | |
1420 break; | |
1421 | |
3905
c26de9aef2ed
7071307: MethodHandle bimorphic inlining should consider the frequency
never
parents:
3848
diff
changeset
|
1422 case _adapter_opt_profiling: |
c26de9aef2ed
7071307: MethodHandle bimorphic inlining should consider the frequency
never
parents:
3848
diff
changeset
|
1423 if (java_lang_invoke_CountingMethodHandle::vmcount_offset_in_bytes() != 0) { |
c26de9aef2ed
7071307: MethodHandle bimorphic inlining should consider the frequency
never
parents:
3848
diff
changeset
|
1424 Address rcx_mh_vmcount(rcx_recv, java_lang_invoke_CountingMethodHandle::vmcount_offset_in_bytes()); |
c26de9aef2ed
7071307: MethodHandle bimorphic inlining should consider the frequency
never
parents:
3848
diff
changeset
|
1425 __ incrementl(rcx_mh_vmcount); |
c26de9aef2ed
7071307: MethodHandle bimorphic inlining should consider the frequency
never
parents:
3848
diff
changeset
|
1426 } |
c26de9aef2ed
7071307: MethodHandle bimorphic inlining should consider the frequency
never
parents:
3848
diff
changeset
|
1427 // fall through |
c26de9aef2ed
7071307: MethodHandle bimorphic inlining should consider the frequency
never
parents:
3848
diff
changeset
|
1428 |
710 | 1429 case _adapter_retype_only: |
1039
987e948ebbc8
6815692: method handle code needs some cleanup (post-6655638)
jrose
parents:
845
diff
changeset
|
1430 case _adapter_retype_raw: |
710 | 1431 // immediately jump to the next MH layer: |
1846 | 1432 __ load_heap_oop(rcx_recv, rcx_mh_vmtarget); |
710 | 1433 __ verify_oop(rcx_recv); |
1434 __ jump_to_method_handle_entry(rcx_recv, rdx_temp); | |
1435 // This is OK when all parameter types widen. | |
1436 // It is also OK when a return type narrows. | |
1437 break; | |
1438 | |
1439 case _adapter_check_cast: | |
1440 { | |
1441 // temps: | |
1442 Register rbx_klass = rbx_temp; // interesting AMH data | |
1443 | |
1444 // check a reference argument before jumping to the next layer of MH: | |
1445 __ movl(rax_argslot, rcx_amh_vmargslot); | |
1446 vmarg = __ argument_address(rax_argslot); | |
1447 | |
1448 // What class are we casting to? | |
1846 | 1449 __ load_heap_oop(rbx_klass, rcx_amh_argument); // this is a Class object! |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1450 load_klass_from_Class(_masm, rbx_klass); |
710 | 1451 |
1452 Label done; | |
1453 __ movptr(rdx_temp, vmarg); | |
1277 | 1454 __ testptr(rdx_temp, rdx_temp); |
1846 | 1455 __ jcc(Assembler::zero, done); // no cast if null |
710 | 1456 __ load_klass(rdx_temp, rdx_temp); |
1457 | |
1458 // live at this point: | |
1459 // - rbx_klass: klass required by the target method | |
1460 // - rdx_temp: argument klass to test | |
1039
987e948ebbc8
6815692: method handle code needs some cleanup (post-6655638)
jrose
parents:
845
diff
changeset
|
1461 // - rcx_recv: adapter method handle |
710 | 1462 __ check_klass_subtype(rdx_temp, rbx_klass, rax_argslot, done); |
1463 | |
1464 // If we get here, the type check failed! | |
1465 // Call the wrong_method_type stub, passing the failing argument type in rax. | |
1466 Register rax_mtype = rax_argslot; | |
1039
987e948ebbc8
6815692: method handle code needs some cleanup (post-6655638)
jrose
parents:
845
diff
changeset
|
1467 __ movl(rax_argslot, rcx_amh_vmargslot); // reload argslot field |
987e948ebbc8
6815692: method handle code needs some cleanup (post-6655638)
jrose
parents:
845
diff
changeset
|
1468 __ movptr(rdx_temp, vmarg); |
987e948ebbc8
6815692: method handle code needs some cleanup (post-6655638)
jrose
parents:
845
diff
changeset
|
1469 |
2088
8d0b933dda2d
7007377: JSR 292 MethodHandlesTest.testCastFailure fails on SPARC with -Xcomp +DeoptimizeALot
twisti
parents:
1972
diff
changeset
|
1470 assert_different_registers(rarg2_required, rdx_temp); |
8d0b933dda2d
7007377: JSR 292 MethodHandlesTest.testCastFailure fails on SPARC with -Xcomp +DeoptimizeALot
twisti
parents:
1972
diff
changeset
|
1471 __ load_heap_oop(rarg2_required, rcx_amh_argument); // required class |
8d0b933dda2d
7007377: JSR 292 MethodHandlesTest.testCastFailure fails on SPARC with -Xcomp +DeoptimizeALot
twisti
parents:
1972
diff
changeset
|
1472 __ mov( rarg1_actual, rdx_temp); // bad object |
8d0b933dda2d
7007377: JSR 292 MethodHandlesTest.testCastFailure fails on SPARC with -Xcomp +DeoptimizeALot
twisti
parents:
1972
diff
changeset
|
1473 __ movl( rarg0_code, (int) Bytecodes::_checkcast); // who is complaining? |
1039
987e948ebbc8
6815692: method handle code needs some cleanup (post-6655638)
jrose
parents:
845
diff
changeset
|
1474 __ jump(ExternalAddress(from_interpreted_entry(_raise_exception))); |
710 | 1475 |
1476 __ bind(done); | |
1039
987e948ebbc8
6815692: method handle code needs some cleanup (post-6655638)
jrose
parents:
845
diff
changeset
|
1477 // get the new MH: |
1846 | 1478 __ load_heap_oop(rcx_recv, rcx_mh_vmtarget); |
710 | 1479 __ jump_to_method_handle_entry(rcx_recv, rdx_temp); |
1480 } | |
1481 break; | |
1482 | |
1483 case _adapter_prim_to_prim: | |
1484 case _adapter_ref_to_prim: | |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1485 case _adapter_prim_to_ref: |
710 | 1486 // handled completely by optimized cases |
1487 __ stop("init_AdapterMethodHandle should not issue this"); | |
1488 break; | |
1489 | |
1490 case _adapter_opt_i2i: // optimized subcase of adapt_prim_to_prim | |
1491 //case _adapter_opt_f2i: // optimized subcase of adapt_prim_to_prim | |
1492 case _adapter_opt_l2i: // optimized subcase of adapt_prim_to_prim | |
1493 case _adapter_opt_unboxi: // optimized subcase of adapt_ref_to_prim | |
1494 { | |
1495 // perform an in-place conversion to int or an int subword | |
1496 __ movl(rax_argslot, rcx_amh_vmargslot); | |
1497 vmarg = __ argument_address(rax_argslot); | |
1498 | |
1499 switch (ek) { | |
1500 case _adapter_opt_i2i: | |
1501 __ movl(rdx_temp, vmarg); | |
1502 break; | |
1503 case _adapter_opt_l2i: | |
1504 { | |
1505 // just delete the extra slot; on a little-endian machine we keep the first | |
1506 __ lea(rax_argslot, __ argument_address(rax_argslot, 1)); | |
1507 remove_arg_slots(_masm, -stack_move_unit(), | |
1508 rax_argslot, rbx_temp, rdx_temp); | |
1506 | 1509 vmarg = Address(rax_argslot, -Interpreter::stackElementSize); |
710 | 1510 __ movl(rdx_temp, vmarg); |
1511 } | |
1512 break; | |
1513 case _adapter_opt_unboxi: | |
1514 { | |
1515 // Load the value up from the heap. | |
1516 __ movptr(rdx_temp, vmarg); | |
1517 int value_offset = java_lang_boxing_object::value_offset_in_bytes(T_INT); | |
1518 #ifdef ASSERT | |
1519 for (int bt = T_BOOLEAN; bt < T_INT; bt++) { | |
1520 if (is_subword_type(BasicType(bt))) | |
1521 assert(value_offset == java_lang_boxing_object::value_offset_in_bytes(BasicType(bt)), ""); | |
1522 } | |
1523 #endif | |
1524 __ null_check(rdx_temp, value_offset); | |
1525 __ movl(rdx_temp, Address(rdx_temp, value_offset)); | |
1526 // We load this as a word. Because we are little-endian, | |
1527 // the low bits will be correct, but the high bits may need cleaning. | |
1528 // The vminfo will guide us to clean those bits. | |
1529 } | |
1530 break; | |
1531 default: | |
1304 | 1532 ShouldNotReachHere(); |
710 | 1533 } |
1534 | |
1304 | 1535 // Do the requested conversion and store the value. |
710 | 1536 Register rbx_vminfo = rbx_temp; |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1537 load_conversion_vminfo(_masm, rbx_vminfo, rcx_amh_conversion); |
710 | 1538 |
1539 // get the new MH: | |
1846 | 1540 __ load_heap_oop(rcx_recv, rcx_mh_vmtarget); |
710 | 1541 // (now we are done with the old MH) |
1542 | |
1543 // original 32-bit vmdata word must be of this form: | |
1135
e66fd840cb6b
6893081: method handle & invokedynamic code needs additional cleanup (post 6815692, 6858164)
twisti
parents:
1133
diff
changeset
|
1544 // | MBZ:6 | signBitCount:8 | srcDstTypes:8 | conversionOp:8 | |
e66fd840cb6b
6893081: method handle & invokedynamic code needs additional cleanup (post 6815692, 6858164)
twisti
parents:
1133
diff
changeset
|
1545 __ xchgptr(rcx, rbx_vminfo); // free rcx for shifts |
710 | 1546 __ shll(rdx_temp /*, rcx*/); |
1547 Label zero_extend, done; | |
1548 __ testl(rcx, CONV_VMINFO_SIGN_FLAG); | |
1135
e66fd840cb6b
6893081: method handle & invokedynamic code needs additional cleanup (post 6815692, 6858164)
twisti
parents:
1133
diff
changeset
|
1549 __ jccb(Assembler::zero, zero_extend); |
710 | 1550 |
1551 // this path is taken for int->byte, int->short | |
1552 __ sarl(rdx_temp /*, rcx*/); | |
1135
e66fd840cb6b
6893081: method handle & invokedynamic code needs additional cleanup (post 6815692, 6858164)
twisti
parents:
1133
diff
changeset
|
1553 __ jmpb(done); |
710 | 1554 |
1555 __ bind(zero_extend); | |
1556 // this is taken for int->char | |
1557 __ shrl(rdx_temp /*, rcx*/); | |
1558 | |
1559 __ bind(done); | |
1304 | 1560 __ movl(vmarg, rdx_temp); // Store the value. |
1135
e66fd840cb6b
6893081: method handle & invokedynamic code needs additional cleanup (post 6815692, 6858164)
twisti
parents:
1133
diff
changeset
|
1561 __ xchgptr(rcx, rbx_vminfo); // restore rcx_recv |
710 | 1562 |
1563 __ jump_to_method_handle_entry(rcx_recv, rdx_temp); | |
1564 } | |
1565 break; | |
1566 | |
1567 case _adapter_opt_i2l: // optimized subcase of adapt_prim_to_prim | |
1568 case _adapter_opt_unboxl: // optimized subcase of adapt_ref_to_prim | |
1569 { | |
1570 // perform an in-place int-to-long or ref-to-long conversion | |
1571 __ movl(rax_argslot, rcx_amh_vmargslot); | |
1572 | |
1573 // on a little-endian machine we keep the first slot and add another after | |
1574 __ lea(rax_argslot, __ argument_address(rax_argslot, 1)); | |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1575 insert_arg_slots(_masm, stack_move_unit(), |
710 | 1576 rax_argslot, rbx_temp, rdx_temp); |
1506 | 1577 Address vmarg1(rax_argslot, -Interpreter::stackElementSize); |
1578 Address vmarg2 = vmarg1.plus_disp(Interpreter::stackElementSize); | |
710 | 1579 |
1580 switch (ek) { | |
1581 case _adapter_opt_i2l: | |
1582 { | |
1293
51db1e4b379d
6932536: JSR 292 modified JDK MethodHandlesTest fails on x86_64
twisti
parents:
1277
diff
changeset
|
1583 #ifdef _LP64 |
51db1e4b379d
6932536: JSR 292 modified JDK MethodHandlesTest fails on x86_64
twisti
parents:
1277
diff
changeset
|
1584 __ movslq(rdx_temp, vmarg1); // Load sign-extended |
51db1e4b379d
6932536: JSR 292 modified JDK MethodHandlesTest fails on x86_64
twisti
parents:
1277
diff
changeset
|
1585 __ movq(vmarg1, rdx_temp); // Store into first slot |
51db1e4b379d
6932536: JSR 292 modified JDK MethodHandlesTest fails on x86_64
twisti
parents:
1277
diff
changeset
|
1586 #else |
710 | 1587 __ movl(rdx_temp, vmarg1); |
1293
51db1e4b379d
6932536: JSR 292 modified JDK MethodHandlesTest fails on x86_64
twisti
parents:
1277
diff
changeset
|
1588 __ sarl(rdx_temp, BitsPerInt - 1); // __ extend_sign() |
710 | 1589 __ movl(vmarg2, rdx_temp); // store second word |
1293
51db1e4b379d
6932536: JSR 292 modified JDK MethodHandlesTest fails on x86_64
twisti
parents:
1277
diff
changeset
|
1590 #endif |
710 | 1591 } |
1592 break; | |
1593 case _adapter_opt_unboxl: | |
1594 { | |
1595 // Load the value up from the heap. | |
1596 __ movptr(rdx_temp, vmarg1); | |
1597 int value_offset = java_lang_boxing_object::value_offset_in_bytes(T_LONG); | |
1598 assert(value_offset == java_lang_boxing_object::value_offset_in_bytes(T_DOUBLE), ""); | |
1599 __ null_check(rdx_temp, value_offset); | |
1293
51db1e4b379d
6932536: JSR 292 modified JDK MethodHandlesTest fails on x86_64
twisti
parents:
1277
diff
changeset
|
1600 #ifdef _LP64 |
51db1e4b379d
6932536: JSR 292 modified JDK MethodHandlesTest fails on x86_64
twisti
parents:
1277
diff
changeset
|
1601 __ movq(rbx_temp, Address(rdx_temp, value_offset)); |
51db1e4b379d
6932536: JSR 292 modified JDK MethodHandlesTest fails on x86_64
twisti
parents:
1277
diff
changeset
|
1602 __ movq(vmarg1, rbx_temp); |
51db1e4b379d
6932536: JSR 292 modified JDK MethodHandlesTest fails on x86_64
twisti
parents:
1277
diff
changeset
|
1603 #else |
710 | 1604 __ movl(rbx_temp, Address(rdx_temp, value_offset + 0*BytesPerInt)); |
1605 __ movl(rdx_temp, Address(rdx_temp, value_offset + 1*BytesPerInt)); | |
1606 __ movl(vmarg1, rbx_temp); | |
1607 __ movl(vmarg2, rdx_temp); | |
1293
51db1e4b379d
6932536: JSR 292 modified JDK MethodHandlesTest fails on x86_64
twisti
parents:
1277
diff
changeset
|
1608 #endif |
710 | 1609 } |
1610 break; | |
1611 default: | |
1304 | 1612 ShouldNotReachHere(); |
710 | 1613 } |
1614 | |
1846 | 1615 __ load_heap_oop(rcx_recv, rcx_mh_vmtarget); |
710 | 1616 __ jump_to_method_handle_entry(rcx_recv, rdx_temp); |
1617 } | |
1618 break; | |
1619 | |
1620 case _adapter_opt_f2d: // optimized subcase of adapt_prim_to_prim | |
1621 case _adapter_opt_d2f: // optimized subcase of adapt_prim_to_prim | |
1622 { | |
1623 // perform an in-place floating primitive conversion | |
1624 __ movl(rax_argslot, rcx_amh_vmargslot); | |
1625 __ lea(rax_argslot, __ argument_address(rax_argslot, 1)); | |
1626 if (ek == _adapter_opt_f2d) { | |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1627 insert_arg_slots(_masm, stack_move_unit(), |
710 | 1628 rax_argslot, rbx_temp, rdx_temp); |
1629 } | |
1506 | 1630 Address vmarg(rax_argslot, -Interpreter::stackElementSize); |
710 | 1631 |
1632 #ifdef _LP64 | |
1633 if (ek == _adapter_opt_f2d) { | |
1634 __ movflt(xmm0, vmarg); | |
1635 __ cvtss2sd(xmm0, xmm0); | |
1636 __ movdbl(vmarg, xmm0); | |
1637 } else { | |
1638 __ movdbl(xmm0, vmarg); | |
1639 __ cvtsd2ss(xmm0, xmm0); | |
1640 __ movflt(vmarg, xmm0); | |
1641 } | |
1642 #else //_LP64 | |
1643 if (ek == _adapter_opt_f2d) { | |
1644 __ fld_s(vmarg); // load float to ST0 | |
3371
fabcf26ee72f
6998541: JSR 292 implement missing return-type conversion for OP_RETYPE_RAW
twisti
parents:
3363
diff
changeset
|
1645 __ fstp_d(vmarg); // store double |
1304 | 1646 } else { |
710 | 1647 __ fld_d(vmarg); // load double to ST0 |
1648 __ fstp_s(vmarg); // store single | |
1649 } | |
1650 #endif //_LP64 | |
1651 | |
1652 if (ek == _adapter_opt_d2f) { | |
1653 remove_arg_slots(_masm, -stack_move_unit(), | |
1654 rax_argslot, rbx_temp, rdx_temp); | |
1655 } | |
1656 | |
1846 | 1657 __ load_heap_oop(rcx_recv, rcx_mh_vmtarget); |
710 | 1658 __ jump_to_method_handle_entry(rcx_recv, rdx_temp); |
1659 } | |
1660 break; | |
1661 | |
1662 case _adapter_swap_args: | |
1663 case _adapter_rot_args: | |
1664 // handled completely by optimized cases | |
1665 __ stop("init_AdapterMethodHandle should not issue this"); | |
1666 break; | |
1667 | |
1668 case _adapter_opt_swap_1: | |
1669 case _adapter_opt_swap_2: | |
1670 case _adapter_opt_rot_1_up: | |
1671 case _adapter_opt_rot_1_down: | |
1672 case _adapter_opt_rot_2_up: | |
1673 case _adapter_opt_rot_2_down: | |
1674 { | |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1675 int swap_slots = ek_adapter_opt_swap_slots(ek); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1676 int rotate = ek_adapter_opt_swap_mode(ek); |
710 | 1677 |
1678 // 'argslot' is the position of the first argument to swap | |
1679 __ movl(rax_argslot, rcx_amh_vmargslot); | |
1680 __ lea(rax_argslot, __ argument_address(rax_argslot)); | |
1681 | |
1682 // 'vminfo' is the second | |
1683 Register rbx_destslot = rbx_temp; | |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1684 load_conversion_vminfo(_masm, rbx_destslot, rcx_amh_conversion); |
710 | 1685 __ lea(rbx_destslot, __ argument_address(rbx_destslot)); |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1686 if (VerifyMethodHandles) |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1687 verify_argslot(_masm, rbx_destslot, "swap point must fall within current frame"); |
710 | 1688 |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1689 assert(Interpreter::stackElementSize == wordSize, "else rethink use of wordSize here"); |
710 | 1690 if (!rotate) { |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1691 // simple swap |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1692 for (int i = 0; i < swap_slots; i++) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1693 __ movptr(rdi_temp, Address(rax_argslot, i * wordSize)); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1694 __ movptr(rdx_temp, Address(rbx_destslot, i * wordSize)); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1695 __ movptr(Address(rax_argslot, i * wordSize), rdx_temp); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1696 __ movptr(Address(rbx_destslot, i * wordSize), rdi_temp); |
710 | 1697 } |
1698 } else { | |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1699 // A rotate is actually pair of moves, with an "odd slot" (or pair) |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1700 // changing place with a series of other slots. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1701 // First, push the "odd slot", which is going to get overwritten |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1702 for (int i = swap_slots - 1; i >= 0; i--) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1703 // handle one with rdi_temp instead of a push: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1704 if (i == 0) __ movptr(rdi_temp, Address(rax_argslot, i * wordSize)); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1705 else __ pushptr( Address(rax_argslot, i * wordSize)); |
710 | 1706 } |
1707 if (rotate > 0) { | |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1708 // Here is rotate > 0: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1709 // (low mem) (high mem) |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1710 // | dest: more_slots... | arg: odd_slot :arg+1 | |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1711 // => |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1712 // | dest: odd_slot | dest+1: more_slots... :arg+1 | |
710 | 1713 // work argslot down to destslot, copying contiguous data upwards |
1714 // pseudo-code: | |
1715 // rax = src_addr - swap_bytes | |
1716 // rbx = dest_addr | |
1717 // while (rax >= rbx) *(rax + swap_bytes) = *(rax + 0), rax--; | |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1718 move_arg_slots_up(_masm, |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1719 rbx_destslot, |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1720 Address(rax_argslot, 0), |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1721 swap_slots, |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1722 rax_argslot, rdx_temp); |
710 | 1723 } else { |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1724 // Here is the other direction, rotate < 0: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1725 // (low mem) (high mem) |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1726 // | arg: odd_slot | arg+1: more_slots... :dest+1 | |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1727 // => |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1728 // | arg: more_slots... | dest: odd_slot :dest+1 | |
710 | 1729 // work argslot up to destslot, copying contiguous data downwards |
1730 // pseudo-code: | |
1731 // rax = src_addr + swap_bytes | |
1732 // rbx = dest_addr | |
1733 // while (rax <= rbx) *(rax - swap_bytes) = *(rax + 0), rax++; | |
3757
f8c9417e3571
7052219: JSR 292: Crash in ~BufferBlob::MethodHandles adapters
never
parents:
3755
diff
changeset
|
1734 // dest_slot denotes an exclusive upper limit |
f8c9417e3571
7052219: JSR 292: Crash in ~BufferBlob::MethodHandles adapters
never
parents:
3755
diff
changeset
|
1735 int limit_bias = OP_ROT_ARGS_DOWN_LIMIT_BIAS; |
f8c9417e3571
7052219: JSR 292: Crash in ~BufferBlob::MethodHandles adapters
never
parents:
3755
diff
changeset
|
1736 if (limit_bias != 0) |
f8c9417e3571
7052219: JSR 292: Crash in ~BufferBlob::MethodHandles adapters
never
parents:
3755
diff
changeset
|
1737 __ addptr(rbx_destslot, - limit_bias * wordSize); |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1738 move_arg_slots_down(_masm, |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1739 Address(rax_argslot, swap_slots * wordSize), |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1740 rbx_destslot, |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1741 -swap_slots, |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1742 rax_argslot, rdx_temp); |
3757
f8c9417e3571
7052219: JSR 292: Crash in ~BufferBlob::MethodHandles adapters
never
parents:
3755
diff
changeset
|
1743 __ subptr(rbx_destslot, swap_slots * wordSize); |
710 | 1744 } |
1745 // pop the original first chunk into the destination slot, now free | |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1746 for (int i = 0; i < swap_slots; i++) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1747 if (i == 0) __ movptr(Address(rbx_destslot, i * wordSize), rdi_temp); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1748 else __ popptr(Address(rbx_destslot, i * wordSize)); |
710 | 1749 } |
1750 } | |
1751 | |
1846 | 1752 __ load_heap_oop(rcx_recv, rcx_mh_vmtarget); |
710 | 1753 __ jump_to_method_handle_entry(rcx_recv, rdx_temp); |
1754 } | |
1755 break; | |
1756 | |
1757 case _adapter_dup_args: | |
1758 { | |
1759 // 'argslot' is the position of the first argument to duplicate | |
1760 __ movl(rax_argslot, rcx_amh_vmargslot); | |
1761 __ lea(rax_argslot, __ argument_address(rax_argslot)); | |
1762 | |
1763 // 'stack_move' is negative number of words to duplicate | |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1764 Register rdi_stack_move = rdi_temp; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1765 load_stack_move(_masm, rdi_stack_move, rcx_recv, true); |
710 | 1766 |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1767 if (VerifyMethodHandles) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1768 verify_argslots(_masm, rdi_stack_move, rax_argslot, true, |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1769 "copied argument(s) must fall within current frame"); |
710 | 1770 } |
1771 | |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1772 // insert location is always the bottom of the argument list: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1773 Address insert_location = __ argument_address(constant(0)); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1774 int pre_arg_words = insert_location.disp() / wordSize; // return PC is pushed |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1775 assert(insert_location.base() == rsp, ""); |
710 | 1776 |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1777 __ negl(rdi_stack_move); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1778 push_arg_slots(_masm, rax_argslot, rdi_stack_move, |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1779 pre_arg_words, rbx_temp, rdx_temp); |
710 | 1780 |
1846 | 1781 __ load_heap_oop(rcx_recv, rcx_mh_vmtarget); |
710 | 1782 __ jump_to_method_handle_entry(rcx_recv, rdx_temp); |
1783 } | |
1784 break; | |
1785 | |
1786 case _adapter_drop_args: | |
1787 { | |
1788 // 'argslot' is the position of the first argument to nuke | |
1789 __ movl(rax_argslot, rcx_amh_vmargslot); | |
1790 __ lea(rax_argslot, __ argument_address(rax_argslot)); | |
1791 | |
1792 // (must do previous push after argslot address is taken) | |
1793 | |
1794 // 'stack_move' is number of words to drop | |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1795 Register rdi_stack_move = rdi_temp; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1796 load_stack_move(_masm, rdi_stack_move, rcx_recv, false); |
710 | 1797 remove_arg_slots(_masm, rdi_stack_move, |
1798 rax_argslot, rbx_temp, rdx_temp); | |
1799 | |
1846 | 1800 __ load_heap_oop(rcx_recv, rcx_mh_vmtarget); |
710 | 1801 __ jump_to_method_handle_entry(rcx_recv, rdx_temp); |
1802 } | |
1803 break; | |
1804 | |
1805 case _adapter_collect_args: | |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1806 case _adapter_fold_args: |
710 | 1807 case _adapter_spread_args: |
1808 // handled completely by optimized cases | |
1809 __ stop("init_AdapterMethodHandle should not issue this"); | |
1810 break; | |
1811 | |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1812 case _adapter_opt_collect_ref: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1813 case _adapter_opt_collect_int: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1814 case _adapter_opt_collect_long: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1815 case _adapter_opt_collect_float: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1816 case _adapter_opt_collect_double: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1817 case _adapter_opt_collect_void: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1818 case _adapter_opt_collect_0_ref: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1819 case _adapter_opt_collect_1_ref: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1820 case _adapter_opt_collect_2_ref: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1821 case _adapter_opt_collect_3_ref: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1822 case _adapter_opt_collect_4_ref: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1823 case _adapter_opt_collect_5_ref: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1824 case _adapter_opt_filter_S0_ref: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1825 case _adapter_opt_filter_S1_ref: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1826 case _adapter_opt_filter_S2_ref: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1827 case _adapter_opt_filter_S3_ref: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1828 case _adapter_opt_filter_S4_ref: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1829 case _adapter_opt_filter_S5_ref: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1830 case _adapter_opt_collect_2_S0_ref: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1831 case _adapter_opt_collect_2_S1_ref: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1832 case _adapter_opt_collect_2_S2_ref: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1833 case _adapter_opt_collect_2_S3_ref: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1834 case _adapter_opt_collect_2_S4_ref: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1835 case _adapter_opt_collect_2_S5_ref: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1836 case _adapter_opt_fold_ref: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1837 case _adapter_opt_fold_int: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1838 case _adapter_opt_fold_long: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1839 case _adapter_opt_fold_float: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1840 case _adapter_opt_fold_double: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1841 case _adapter_opt_fold_void: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1842 case _adapter_opt_fold_1_ref: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1843 case _adapter_opt_fold_2_ref: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1844 case _adapter_opt_fold_3_ref: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1845 case _adapter_opt_fold_4_ref: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1846 case _adapter_opt_fold_5_ref: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1847 { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1848 // Given a fresh incoming stack frame, build a new ricochet frame. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1849 // On entry, TOS points at a return PC, and RBP is the callers frame ptr. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1850 // RSI/R13 has the caller's exact stack pointer, which we must also preserve. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1851 // RCX contains an AdapterMethodHandle of the indicated kind. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1852 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1853 // Relevant AMH fields: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1854 // amh.vmargslot: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1855 // points to the trailing edge of the arguments |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1856 // to filter, collect, or fold. For a boxing operation, |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1857 // it points just after the single primitive value. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1858 // amh.argument: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1859 // recursively called MH, on |collect| arguments |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1860 // amh.vmtarget: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1861 // final destination MH, on return value, etc. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1862 // amh.conversion.dest: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1863 // tells what is the type of the return value |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1864 // (not needed here, since dest is also derived from ek) |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1865 // amh.conversion.vminfo: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1866 // points to the trailing edge of the return value |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1867 // when the vmtarget is to be called; this is |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1868 // equal to vmargslot + (retained ? |collect| : 0) |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1869 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1870 // Pass 0 or more argument slots to the recursive target. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1871 int collect_count_constant = ek_adapter_opt_collect_count(ek); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1872 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1873 // The collected arguments are copied from the saved argument list: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1874 int collect_slot_constant = ek_adapter_opt_collect_slot(ek); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1875 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1876 assert(ek_orig == _adapter_collect_args || |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1877 ek_orig == _adapter_fold_args, ""); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1878 bool retain_original_args = (ek_orig == _adapter_fold_args); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1879 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1880 // The return value is replaced (or inserted) at the 'vminfo' argslot. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1881 // Sometimes we can compute this statically. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1882 int dest_slot_constant = -1; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1883 if (!retain_original_args) |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1884 dest_slot_constant = collect_slot_constant; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1885 else if (collect_slot_constant >= 0 && collect_count_constant >= 0) |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1886 // We are preserving all the arguments, and the return value is prepended, |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1887 // so the return slot is to the left (above) the |collect| sequence. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1888 dest_slot_constant = collect_slot_constant + collect_count_constant; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1889 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1890 // Replace all those slots by the result of the recursive call. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1891 // The result type can be one of ref, int, long, float, double, void. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1892 // In the case of void, nothing is pushed on the stack after return. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1893 BasicType dest = ek_adapter_opt_collect_type(ek); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1894 assert(dest == type2wfield[dest], "dest is a stack slot type"); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1895 int dest_count = type2size[dest]; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1896 assert(dest_count == 1 || dest_count == 2 || (dest_count == 0 && dest == T_VOID), "dest has a size"); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1897 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1898 // Choose a return continuation. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1899 EntryKind ek_ret = _adapter_opt_return_any; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1900 if (dest != T_CONFLICT && OptimizeMethodHandles) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1901 switch (dest) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1902 case T_INT : ek_ret = _adapter_opt_return_int; break; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1903 case T_LONG : ek_ret = _adapter_opt_return_long; break; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1904 case T_FLOAT : ek_ret = _adapter_opt_return_float; break; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1905 case T_DOUBLE : ek_ret = _adapter_opt_return_double; break; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1906 case T_OBJECT : ek_ret = _adapter_opt_return_ref; break; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1907 case T_VOID : ek_ret = _adapter_opt_return_void; break; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1908 default : ShouldNotReachHere(); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1909 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1910 if (dest == T_OBJECT && dest_slot_constant >= 0) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1911 EntryKind ek_try = EntryKind(_adapter_opt_return_S0_ref + dest_slot_constant); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1912 if (ek_try <= _adapter_opt_return_LAST && |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1913 ek_adapter_opt_return_slot(ek_try) == dest_slot_constant) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1914 ek_ret = ek_try; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1915 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1916 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1917 assert(ek_adapter_opt_return_type(ek_ret) == dest, ""); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1918 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1919 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1920 // Already pushed: ... keep1 | collect | keep2 | sender_pc | |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1921 // push(sender_pc); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1922 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1923 // Compute argument base: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1924 Register rax_argv = rax_argslot; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1925 __ lea(rax_argv, __ argument_address(constant(0))); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1926 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1927 // Push a few extra argument words, if we need them to store the return value. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1928 { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1929 int extra_slots = 0; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1930 if (retain_original_args) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1931 extra_slots = dest_count; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1932 } else if (collect_count_constant == -1) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1933 extra_slots = dest_count; // collect_count might be zero; be generous |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1934 } else if (dest_count > collect_count_constant) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1935 extra_slots = (dest_count - collect_count_constant); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1936 } else { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1937 // else we know we have enough dead space in |collect| to repurpose for return values |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1938 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1939 DEBUG_ONLY(extra_slots += 1); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1940 if (extra_slots > 0) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1941 __ pop(rbx_temp); // return value |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1942 __ subptr(rsp, (extra_slots * Interpreter::stackElementSize)); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1943 // Push guard word #2 in debug mode. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1944 DEBUG_ONLY(__ movptr(Address(rsp, 0), (int32_t) RicochetFrame::MAGIC_NUMBER_2)); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1945 __ push(rbx_temp); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1946 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1947 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1948 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1949 RicochetFrame::enter_ricochet_frame(_masm, rcx_recv, rax_argv, |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1950 entry(ek_ret)->from_interpreted_entry(), rbx_temp); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1951 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1952 // Now pushed: ... keep1 | collect | keep2 | RF | |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1953 // some handy frame slots: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1954 Address exact_sender_sp_addr = RicochetFrame::frame_address(RicochetFrame::exact_sender_sp_offset_in_bytes()); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1955 Address conversion_addr = RicochetFrame::frame_address(RicochetFrame::conversion_offset_in_bytes()); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1956 Address saved_args_base_addr = RicochetFrame::frame_address(RicochetFrame::saved_args_base_offset_in_bytes()); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1957 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1958 #ifdef ASSERT |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1959 if (VerifyMethodHandles && dest != T_CONFLICT) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1960 BLOCK_COMMENT("verify AMH.conv.dest"); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1961 load_conversion_dest_type(_masm, rbx_temp, conversion_addr); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1962 Label L_dest_ok; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1963 __ cmpl(rbx_temp, (int) dest); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1964 __ jcc(Assembler::equal, L_dest_ok); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1965 if (dest == T_INT) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1966 for (int bt = T_BOOLEAN; bt < T_INT; bt++) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1967 if (is_subword_type(BasicType(bt))) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1968 __ cmpl(rbx_temp, (int) bt); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1969 __ jcc(Assembler::equal, L_dest_ok); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1970 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1971 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1972 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1973 __ stop("bad dest in AMH.conv"); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1974 __ BIND(L_dest_ok); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1975 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1976 #endif //ASSERT |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1977 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1978 // Find out where the original copy of the recursive argument sequence begins. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1979 Register rax_coll = rax_argv; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1980 { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1981 RegisterOrConstant collect_slot = collect_slot_constant; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1982 if (collect_slot_constant == -1) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1983 __ movl(rdi_temp, rcx_amh_vmargslot); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1984 collect_slot = rdi_temp; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1985 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1986 if (collect_slot_constant != 0) |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1987 __ lea(rax_coll, Address(rax_argv, collect_slot, Interpreter::stackElementScale())); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1988 // rax_coll now points at the trailing edge of |collect| and leading edge of |keep2| |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1989 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1990 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1991 // Replace the old AMH with the recursive MH. (No going back now.) |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1992 // In the case of a boxing call, the recursive call is to a 'boxer' method, |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1993 // such as Integer.valueOf or Long.valueOf. In the case of a filter |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1994 // or collect call, it will take one or more arguments, transform them, |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1995 // and return some result, to store back into argument_base[vminfo]. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1996 __ load_heap_oop(rcx_recv, rcx_amh_argument); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1997 if (VerifyMethodHandles) verify_method_handle(_masm, rcx_recv); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1998 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
1999 // Push a space for the recursively called MH first: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2000 __ push((int32_t)NULL_WORD); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2001 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2002 // Calculate |collect|, the number of arguments we are collecting. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2003 Register rdi_collect_count = rdi_temp; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2004 RegisterOrConstant collect_count; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2005 if (collect_count_constant >= 0) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2006 collect_count = collect_count_constant; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2007 } else { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2008 __ load_method_handle_vmslots(rdi_collect_count, rcx_recv, rdx_temp); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2009 collect_count = rdi_collect_count; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2010 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2011 #ifdef ASSERT |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2012 if (VerifyMethodHandles && collect_count_constant >= 0) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2013 __ load_method_handle_vmslots(rbx_temp, rcx_recv, rdx_temp); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2014 Label L_count_ok; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2015 __ cmpl(rbx_temp, collect_count_constant); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2016 __ jcc(Assembler::equal, L_count_ok); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2017 __ stop("bad vminfo in AMH.conv"); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2018 __ BIND(L_count_ok); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2019 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2020 #endif //ASSERT |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2021 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2022 // copy |collect| slots directly to TOS: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2023 push_arg_slots(_masm, rax_coll, collect_count, 0, rbx_temp, rdx_temp); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2024 // Now pushed: ... keep1 | collect | keep2 | RF... | collect | |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2025 // rax_coll still points at the trailing edge of |collect| and leading edge of |keep2| |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2026 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2027 // If necessary, adjust the saved arguments to make room for the eventual return value. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2028 // Normal adjustment: ... keep1 | +dest+ | -collect- | keep2 | RF... | collect | |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2029 // If retaining args: ... keep1 | +dest+ | collect | keep2 | RF... | collect | |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2030 // In the non-retaining case, this might move keep2 either up or down. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2031 // We don't have to copy the whole | RF... collect | complex, |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2032 // but we must adjust RF.saved_args_base. |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3388
diff
changeset
|
2033 // Also, from now on, we will forget about the original copy of |collect|. |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2034 // If we are retaining it, we will treat it as part of |keep2|. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2035 // For clarity we will define |keep3| = |collect|keep2| or |keep2|. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2036 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2037 BLOCK_COMMENT("adjust trailing arguments {"); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2038 // Compare the sizes of |+dest+| and |-collect-|, which are opposed opening and closing movements. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2039 int open_count = dest_count; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2040 RegisterOrConstant close_count = collect_count_constant; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2041 Register rdi_close_count = rdi_collect_count; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2042 if (retain_original_args) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2043 close_count = constant(0); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2044 } else if (collect_count_constant == -1) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2045 close_count = rdi_collect_count; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2046 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2047 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2048 // How many slots need moving? This is simply dest_slot (0 => no |keep3|). |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2049 RegisterOrConstant keep3_count; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2050 Register rsi_keep3_count = rsi; // can repair from RF.exact_sender_sp |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2051 if (dest_slot_constant >= 0) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2052 keep3_count = dest_slot_constant; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2053 } else { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2054 load_conversion_vminfo(_masm, rsi_keep3_count, conversion_addr); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2055 keep3_count = rsi_keep3_count; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2056 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2057 #ifdef ASSERT |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2058 if (VerifyMethodHandles && dest_slot_constant >= 0) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2059 load_conversion_vminfo(_masm, rbx_temp, conversion_addr); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2060 Label L_vminfo_ok; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2061 __ cmpl(rbx_temp, dest_slot_constant); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2062 __ jcc(Assembler::equal, L_vminfo_ok); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2063 __ stop("bad vminfo in AMH.conv"); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2064 __ BIND(L_vminfo_ok); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2065 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2066 #endif //ASSERT |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2067 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2068 // tasks remaining: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2069 bool move_keep3 = (!keep3_count.is_constant() || keep3_count.as_constant() != 0); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2070 bool stomp_dest = (NOT_DEBUG(dest == T_OBJECT) DEBUG_ONLY(dest_count != 0)); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2071 bool fix_arg_base = (!close_count.is_constant() || open_count != close_count.as_constant()); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2072 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2073 if (stomp_dest | fix_arg_base) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2074 // we will probably need an updated rax_argv value |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2075 if (collect_slot_constant >= 0) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2076 // rax_coll already holds the leading edge of |keep2|, so tweak it |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2077 assert(rax_coll == rax_argv, "elided a move"); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2078 if (collect_slot_constant != 0) |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2079 __ subptr(rax_argv, collect_slot_constant * Interpreter::stackElementSize); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2080 } else { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2081 // Just reload from RF.saved_args_base. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2082 __ movptr(rax_argv, saved_args_base_addr); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2083 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2084 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2085 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2086 // Old and new argument locations (based at slot 0). |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2087 // Net shift (&new_argv - &old_argv) is (close_count - open_count). |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2088 bool zero_open_count = (open_count == 0); // remember this bit of info |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2089 if (move_keep3 && fix_arg_base) { |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3388
diff
changeset
|
2090 // It will be easier to have everything in one register: |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2091 if (close_count.is_register()) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2092 // Deduct open_count from close_count register to get a clean +/- value. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2093 __ subptr(close_count.as_register(), open_count); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2094 } else { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2095 close_count = close_count.as_constant() - open_count; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2096 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2097 open_count = 0; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2098 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2099 Address old_argv(rax_argv, 0); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2100 Address new_argv(rax_argv, close_count, Interpreter::stackElementScale(), |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2101 - open_count * Interpreter::stackElementSize); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2102 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2103 // First decide if any actual data are to be moved. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2104 // We can skip if (a) |keep3| is empty, or (b) the argument list size didn't change. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2105 // (As it happens, all movements involve an argument list size change.) |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2106 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2107 // If there are variable parameters, use dynamic checks to skip around the whole mess. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2108 Label L_done; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2109 if (!keep3_count.is_constant()) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2110 __ testl(keep3_count.as_register(), keep3_count.as_register()); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2111 __ jcc(Assembler::zero, L_done); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2112 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2113 if (!close_count.is_constant()) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2114 __ cmpl(close_count.as_register(), open_count); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2115 __ jcc(Assembler::equal, L_done); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2116 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2117 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2118 if (move_keep3 && fix_arg_base) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2119 bool emit_move_down = false, emit_move_up = false, emit_guard = false; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2120 if (!close_count.is_constant()) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2121 emit_move_down = emit_guard = !zero_open_count; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2122 emit_move_up = true; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2123 } else if (open_count != close_count.as_constant()) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2124 emit_move_down = (open_count > close_count.as_constant()); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2125 emit_move_up = !emit_move_down; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2126 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2127 Label L_move_up; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2128 if (emit_guard) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2129 __ cmpl(close_count.as_register(), open_count); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2130 __ jcc(Assembler::greater, L_move_up); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2131 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2132 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2133 if (emit_move_down) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2134 // Move arguments down if |+dest+| > |-collect-| |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2135 // (This is rare, except when arguments are retained.) |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2136 // This opens space for the return value. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2137 if (keep3_count.is_constant()) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2138 for (int i = 0; i < keep3_count.as_constant(); i++) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2139 __ movptr(rdx_temp, old_argv.plus_disp(i * Interpreter::stackElementSize)); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2140 __ movptr( new_argv.plus_disp(i * Interpreter::stackElementSize), rdx_temp); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2141 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2142 } else { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2143 Register rbx_argv_top = rbx_temp; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2144 __ lea(rbx_argv_top, old_argv.plus_disp(keep3_count, Interpreter::stackElementScale())); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2145 move_arg_slots_down(_masm, |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2146 old_argv, // beginning of old argv |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2147 rbx_argv_top, // end of old argv |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2148 close_count, // distance to move down (must be negative) |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2149 rax_argv, rdx_temp); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2150 // Used argv as an iteration variable; reload from RF.saved_args_base. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2151 __ movptr(rax_argv, saved_args_base_addr); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2152 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2153 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2154 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2155 if (emit_guard) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2156 __ jmp(L_done); // assumes emit_move_up is true also |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2157 __ BIND(L_move_up); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2158 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2159 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2160 if (emit_move_up) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2161 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2162 // Move arguments up if |+dest+| < |-collect-| |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2163 // (This is usual, except when |keep3| is empty.) |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2164 // This closes up the space occupied by the now-deleted collect values. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2165 if (keep3_count.is_constant()) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2166 for (int i = keep3_count.as_constant() - 1; i >= 0; i--) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2167 __ movptr(rdx_temp, old_argv.plus_disp(i * Interpreter::stackElementSize)); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2168 __ movptr( new_argv.plus_disp(i * Interpreter::stackElementSize), rdx_temp); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2169 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2170 } else { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2171 Address argv_top = old_argv.plus_disp(keep3_count, Interpreter::stackElementScale()); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2172 move_arg_slots_up(_masm, |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2173 rax_argv, // beginning of old argv |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2174 argv_top, // end of old argv |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2175 close_count, // distance to move up (must be positive) |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2176 rbx_temp, rdx_temp); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2177 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2178 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2179 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2180 __ BIND(L_done); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2181 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2182 if (fix_arg_base) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2183 // adjust RF.saved_args_base by adding (close_count - open_count) |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2184 if (!new_argv.is_same_address(Address(rax_argv, 0))) |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2185 __ lea(rax_argv, new_argv); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2186 __ movptr(saved_args_base_addr, rax_argv); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2187 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2188 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2189 if (stomp_dest) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2190 // Stomp the return slot, so it doesn't hold garbage. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2191 // This isn't strictly necessary, but it may help detect bugs. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2192 int forty_two = RicochetFrame::RETURN_VALUE_PLACEHOLDER; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2193 __ movptr(Address(rax_argv, keep3_count, Address::times_ptr), |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2194 (int32_t) forty_two); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2195 // uses rsi_keep3_count |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2196 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2197 BLOCK_COMMENT("} adjust trailing arguments"); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2198 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2199 BLOCK_COMMENT("do_recursive_call"); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2200 __ mov(saved_last_sp, rsp); // set rsi/r13 for callee |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2201 __ pushptr(ExternalAddress(SharedRuntime::ricochet_blob()->bounce_addr()).addr()); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2202 // The globally unique bounce address has two purposes: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2203 // 1. It helps the JVM recognize this frame (frame::is_ricochet_frame). |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2204 // 2. When returned to, it cuts back the stack and redirects control flow |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2205 // to the return handler. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2206 // The return handler will further cut back the stack when it takes |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2207 // down the RF. Perhaps there is a way to streamline this further. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2208 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2209 // State during recursive call: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2210 // ... keep1 | dest | dest=42 | keep3 | RF... | collect | bounce_pc | |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2211 __ jump_to_method_handle_entry(rcx_recv, rdx_temp); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2212 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2213 break; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2214 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2215 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2216 case _adapter_opt_return_ref: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2217 case _adapter_opt_return_int: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2218 case _adapter_opt_return_long: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2219 case _adapter_opt_return_float: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2220 case _adapter_opt_return_double: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2221 case _adapter_opt_return_void: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2222 case _adapter_opt_return_S0_ref: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2223 case _adapter_opt_return_S1_ref: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2224 case _adapter_opt_return_S2_ref: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2225 case _adapter_opt_return_S3_ref: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2226 case _adapter_opt_return_S4_ref: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2227 case _adapter_opt_return_S5_ref: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2228 { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2229 BasicType dest_type_constant = ek_adapter_opt_return_type(ek); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2230 int dest_slot_constant = ek_adapter_opt_return_slot(ek); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2231 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2232 if (VerifyMethodHandles) RicochetFrame::verify_clean(_masm); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2233 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2234 if (dest_slot_constant == -1) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2235 // The current stub is a general handler for this dest_type. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2236 // It can be called from _adapter_opt_return_any below. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2237 // Stash the address in a little table. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2238 assert((dest_type_constant & CONV_TYPE_MASK) == dest_type_constant, "oob"); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2239 address return_handler = __ pc(); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2240 _adapter_return_handlers[dest_type_constant] = return_handler; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2241 if (dest_type_constant == T_INT) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2242 // do the subword types too |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2243 for (int bt = T_BOOLEAN; bt < T_INT; bt++) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2244 if (is_subword_type(BasicType(bt)) && |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2245 _adapter_return_handlers[bt] == NULL) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2246 _adapter_return_handlers[bt] = return_handler; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2247 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2248 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2249 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2250 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2251 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2252 Register rbx_arg_base = rbx_temp; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2253 assert_different_registers(rax, rdx, // possibly live return value registers |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2254 rdi_temp, rbx_arg_base); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2255 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2256 Address conversion_addr = RicochetFrame::frame_address(RicochetFrame::conversion_offset_in_bytes()); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2257 Address saved_args_base_addr = RicochetFrame::frame_address(RicochetFrame::saved_args_base_offset_in_bytes()); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2258 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2259 __ movptr(rbx_arg_base, saved_args_base_addr); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2260 RegisterOrConstant dest_slot = dest_slot_constant; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2261 if (dest_slot_constant == -1) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2262 load_conversion_vminfo(_masm, rdi_temp, conversion_addr); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2263 dest_slot = rdi_temp; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2264 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2265 // Store the result back into the argslot. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2266 // This code uses the interpreter calling sequence, in which the return value |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2267 // is usually left in the TOS register, as defined by InterpreterMacroAssembler::pop. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2268 // There are certain irregularities with floating point values, which can be seen |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2269 // in TemplateInterpreterGenerator::generate_return_entry_for. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2270 move_return_value(_masm, dest_type_constant, Address(rbx_arg_base, dest_slot, Interpreter::stackElementScale())); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2271 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2272 RicochetFrame::leave_ricochet_frame(_masm, rcx_recv, rbx_arg_base, rdx_temp); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2273 __ push(rdx_temp); // repush the return PC |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2274 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2275 // Load the final target and go. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2276 if (VerifyMethodHandles) verify_method_handle(_masm, rcx_recv); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2277 __ jump_to_method_handle_entry(rcx_recv, rdx_temp); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2278 __ hlt(); // -------------------- |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2279 break; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2280 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2281 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2282 case _adapter_opt_return_any: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2283 { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2284 if (VerifyMethodHandles) RicochetFrame::verify_clean(_masm); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2285 Register rdi_conv = rdi_temp; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2286 assert_different_registers(rax, rdx, // possibly live return value registers |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2287 rdi_conv, rbx_temp); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2288 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2289 Address conversion_addr = RicochetFrame::frame_address(RicochetFrame::conversion_offset_in_bytes()); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2290 load_conversion_dest_type(_masm, rdi_conv, conversion_addr); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2291 __ lea(rbx_temp, ExternalAddress((address) &_adapter_return_handlers[0])); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2292 __ movptr(rbx_temp, Address(rbx_temp, rdi_conv, Address::times_ptr)); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2293 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2294 #ifdef ASSERT |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2295 { Label L_badconv; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2296 __ testptr(rbx_temp, rbx_temp); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2297 __ jccb(Assembler::zero, L_badconv); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2298 __ jmp(rbx_temp); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2299 __ bind(L_badconv); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2300 __ stop("bad method handle return"); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2301 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2302 #else //ASSERT |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2303 __ jmp(rbx_temp); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2304 #endif //ASSERT |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2305 break; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2306 } |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2307 |
710 | 2308 case _adapter_opt_spread_0: |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2309 case _adapter_opt_spread_1_ref: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2310 case _adapter_opt_spread_2_ref: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2311 case _adapter_opt_spread_3_ref: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2312 case _adapter_opt_spread_4_ref: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2313 case _adapter_opt_spread_5_ref: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2314 case _adapter_opt_spread_ref: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2315 case _adapter_opt_spread_byte: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2316 case _adapter_opt_spread_char: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2317 case _adapter_opt_spread_short: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2318 case _adapter_opt_spread_int: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2319 case _adapter_opt_spread_long: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2320 case _adapter_opt_spread_float: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2321 case _adapter_opt_spread_double: |
710 | 2322 { |
2323 // spread an array out into a group of arguments | |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2324 int length_constant = ek_adapter_opt_spread_count(ek); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2325 bool length_can_be_zero = (length_constant == 0); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2326 if (length_constant < 0) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2327 // some adapters with variable length must handle the zero case |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2328 if (!OptimizeMethodHandles || |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2329 ek_adapter_opt_spread_type(ek) != T_OBJECT) |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2330 length_can_be_zero = true; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2331 } |
710 | 2332 |
2333 // find the address of the array argument | |
2334 __ movl(rax_argslot, rcx_amh_vmargslot); | |
2335 __ lea(rax_argslot, __ argument_address(rax_argslot)); | |
2336 | |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2337 // grab another temp |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2338 Register rsi_temp = rsi; |
710 | 2339 |
2340 // arx_argslot points both to the array and to the first output arg | |
2341 vmarg = Address(rax_argslot, 0); | |
2342 | |
2343 // Get the array value. | |
4874
392a3f07d567
7141637: JSR 292: MH spread invoker crashes with NULL argument on x86_32
twisti
parents:
4824
diff
changeset
|
2344 Register rdi_array = rdi_temp; |
710 | 2345 Register rdx_array_klass = rdx_temp; |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2346 BasicType elem_type = ek_adapter_opt_spread_type(ek); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2347 int elem_slots = type2size[elem_type]; // 1 or 2 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2348 int array_slots = 1; // array is always a T_OBJECT |
710 | 2349 int length_offset = arrayOopDesc::length_offset_in_bytes(); |
2350 int elem0_offset = arrayOopDesc::base_offset_in_bytes(elem_type); | |
4874
392a3f07d567
7141637: JSR 292: MH spread invoker crashes with NULL argument on x86_32
twisti
parents:
4824
diff
changeset
|
2351 __ movptr(rdi_array, vmarg); |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2352 |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2353 Label L_array_is_empty, L_insert_arg_space, L_copy_args, L_args_done; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2354 if (length_can_be_zero) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2355 // handle the null pointer case, if zero is allowed |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2356 Label L_skip; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2357 if (length_constant < 0) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2358 load_conversion_vminfo(_masm, rbx_temp, rcx_amh_conversion); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2359 __ testl(rbx_temp, rbx_temp); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2360 __ jcc(Assembler::notZero, L_skip); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2361 } |
4874
392a3f07d567
7141637: JSR 292: MH spread invoker crashes with NULL argument on x86_32
twisti
parents:
4824
diff
changeset
|
2362 __ testptr(rdi_array, rdi_array); |
392a3f07d567
7141637: JSR 292: MH spread invoker crashes with NULL argument on x86_32
twisti
parents:
4824
diff
changeset
|
2363 __ jcc(Assembler::notZero, L_skip); |
392a3f07d567
7141637: JSR 292: MH spread invoker crashes with NULL argument on x86_32
twisti
parents:
4824
diff
changeset
|
2364 |
392a3f07d567
7141637: JSR 292: MH spread invoker crashes with NULL argument on x86_32
twisti
parents:
4824
diff
changeset
|
2365 // If 'rsi' contains the 'saved_last_sp' (this is only the |
392a3f07d567
7141637: JSR 292: MH spread invoker crashes with NULL argument on x86_32
twisti
parents:
4824
diff
changeset
|
2366 // case in a 32-bit version of the VM) we have to save 'rsi' |
392a3f07d567
7141637: JSR 292: MH spread invoker crashes with NULL argument on x86_32
twisti
parents:
4824
diff
changeset
|
2367 // on the stack because later on (at 'L_array_is_empty') 'rsi' |
392a3f07d567
7141637: JSR 292: MH spread invoker crashes with NULL argument on x86_32
twisti
parents:
4824
diff
changeset
|
2368 // will be overwritten. |
392a3f07d567
7141637: JSR 292: MH spread invoker crashes with NULL argument on x86_32
twisti
parents:
4824
diff
changeset
|
2369 { if (rsi_temp == saved_last_sp) __ push(saved_last_sp); } |
392a3f07d567
7141637: JSR 292: MH spread invoker crashes with NULL argument on x86_32
twisti
parents:
4824
diff
changeset
|
2370 // Also prepare a handy macro which restores 'rsi' if required. |
392a3f07d567
7141637: JSR 292: MH spread invoker crashes with NULL argument on x86_32
twisti
parents:
4824
diff
changeset
|
2371 #define UNPUSH_RSI \ |
392a3f07d567
7141637: JSR 292: MH spread invoker crashes with NULL argument on x86_32
twisti
parents:
4824
diff
changeset
|
2372 { if (rsi_temp == saved_last_sp) __ pop(saved_last_sp); } |
392a3f07d567
7141637: JSR 292: MH spread invoker crashes with NULL argument on x86_32
twisti
parents:
4824
diff
changeset
|
2373 |
392a3f07d567
7141637: JSR 292: MH spread invoker crashes with NULL argument on x86_32
twisti
parents:
4824
diff
changeset
|
2374 __ jmp(L_array_is_empty); |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2375 __ bind(L_skip); |
710 | 2376 } |
4874
392a3f07d567
7141637: JSR 292: MH spread invoker crashes with NULL argument on x86_32
twisti
parents:
4824
diff
changeset
|
2377 __ null_check(rdi_array, oopDesc::klass_offset_in_bytes()); |
392a3f07d567
7141637: JSR 292: MH spread invoker crashes with NULL argument on x86_32
twisti
parents:
4824
diff
changeset
|
2378 __ load_klass(rdx_array_klass, rdi_array); |
392a3f07d567
7141637: JSR 292: MH spread invoker crashes with NULL argument on x86_32
twisti
parents:
4824
diff
changeset
|
2379 |
392a3f07d567
7141637: JSR 292: MH spread invoker crashes with NULL argument on x86_32
twisti
parents:
4824
diff
changeset
|
2380 // Save 'rsi' if required (see comment above). Do this only |
392a3f07d567
7141637: JSR 292: MH spread invoker crashes with NULL argument on x86_32
twisti
parents:
4824
diff
changeset
|
2381 // after the null check such that the exception handler which is |
392a3f07d567
7141637: JSR 292: MH spread invoker crashes with NULL argument on x86_32
twisti
parents:
4824
diff
changeset
|
2382 // called in the case of a null pointer exception will not be |
392a3f07d567
7141637: JSR 292: MH spread invoker crashes with NULL argument on x86_32
twisti
parents:
4824
diff
changeset
|
2383 // confused by the extra value on the stack (it expects the |
392a3f07d567
7141637: JSR 292: MH spread invoker crashes with NULL argument on x86_32
twisti
parents:
4824
diff
changeset
|
2384 // return pointer on top of the stack) |
392a3f07d567
7141637: JSR 292: MH spread invoker crashes with NULL argument on x86_32
twisti
parents:
4824
diff
changeset
|
2385 { if (rsi_temp == saved_last_sp) __ push(saved_last_sp); } |
710 | 2386 |
2387 // Check the array type. | |
2388 Register rbx_klass = rbx_temp; | |
1846 | 2389 __ load_heap_oop(rbx_klass, rcx_amh_argument); // this is a Class object! |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2390 load_klass_from_Class(_masm, rbx_klass); |
710 | 2391 |
2392 Label ok_array_klass, bad_array_klass, bad_array_length; | |
4874
392a3f07d567
7141637: JSR 292: MH spread invoker crashes with NULL argument on x86_32
twisti
parents:
4824
diff
changeset
|
2393 __ check_klass_subtype(rdx_array_klass, rbx_klass, rsi_temp, ok_array_klass); |
710 | 2394 // If we get here, the type check failed! |
2395 __ jmp(bad_array_klass); | |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2396 __ BIND(ok_array_klass); |
710 | 2397 |
2398 // Check length. | |
2399 if (length_constant >= 0) { | |
4874
392a3f07d567
7141637: JSR 292: MH spread invoker crashes with NULL argument on x86_32
twisti
parents:
4824
diff
changeset
|
2400 __ cmpl(Address(rdi_array, length_offset), length_constant); |
710 | 2401 } else { |
2402 Register rbx_vminfo = rbx_temp; | |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2403 load_conversion_vminfo(_masm, rbx_vminfo, rcx_amh_conversion); |
4874
392a3f07d567
7141637: JSR 292: MH spread invoker crashes with NULL argument on x86_32
twisti
parents:
4824
diff
changeset
|
2404 __ cmpl(rbx_vminfo, Address(rdi_array, length_offset)); |
710 | 2405 } |
2406 __ jcc(Assembler::notEqual, bad_array_length); | |
2407 | |
2408 Register rdx_argslot_limit = rdx_temp; | |
2409 | |
2410 // Array length checks out. Now insert any required stack slots. | |
2411 if (length_constant == -1) { | |
2412 // Form a pointer to the end of the affected region. | |
1506 | 2413 __ lea(rdx_argslot_limit, Address(rax_argslot, Interpreter::stackElementSize)); |
710 | 2414 // 'stack_move' is negative number of words to insert |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2415 // This number already accounts for elem_slots. |
4874
392a3f07d567
7141637: JSR 292: MH spread invoker crashes with NULL argument on x86_32
twisti
parents:
4824
diff
changeset
|
2416 Register rsi_stack_move = rsi_temp; |
392a3f07d567
7141637: JSR 292: MH spread invoker crashes with NULL argument on x86_32
twisti
parents:
4824
diff
changeset
|
2417 load_stack_move(_masm, rsi_stack_move, rcx_recv, true); |
392a3f07d567
7141637: JSR 292: MH spread invoker crashes with NULL argument on x86_32
twisti
parents:
4824
diff
changeset
|
2418 __ cmpptr(rsi_stack_move, 0); |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2419 assert(stack_move_unit() < 0, "else change this comparison"); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2420 __ jcc(Assembler::less, L_insert_arg_space); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2421 __ jcc(Assembler::equal, L_copy_args); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2422 // single argument case, with no array movement |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2423 __ BIND(L_array_is_empty); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2424 remove_arg_slots(_masm, -stack_move_unit() * array_slots, |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2425 rax_argslot, rbx_temp, rdx_temp); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2426 __ jmp(L_args_done); // no spreading to do |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2427 __ BIND(L_insert_arg_space); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2428 // come here in the usual case, stack_move < 0 (2 or more spread arguments) |
4874
392a3f07d567
7141637: JSR 292: MH spread invoker crashes with NULL argument on x86_32
twisti
parents:
4824
diff
changeset
|
2429 Register rdi_temp = rdi_array; // spill this |
392a3f07d567
7141637: JSR 292: MH spread invoker crashes with NULL argument on x86_32
twisti
parents:
4824
diff
changeset
|
2430 insert_arg_slots(_masm, rsi_stack_move, |
392a3f07d567
7141637: JSR 292: MH spread invoker crashes with NULL argument on x86_32
twisti
parents:
4824
diff
changeset
|
2431 rax_argslot, rbx_temp, rdi_temp); |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2432 // reload the array since rsi was killed |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2433 // reload from rdx_argslot_limit since rax_argslot is now decremented |
4874
392a3f07d567
7141637: JSR 292: MH spread invoker crashes with NULL argument on x86_32
twisti
parents:
4824
diff
changeset
|
2434 __ movptr(rdi_array, Address(rdx_argslot_limit, -Interpreter::stackElementSize)); |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2435 } else if (length_constant >= 1) { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2436 int new_slots = (length_constant * elem_slots) - array_slots; |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2437 insert_arg_slots(_masm, new_slots * stack_move_unit(), |
710 | 2438 rax_argslot, rbx_temp, rdx_temp); |
2439 } else if (length_constant == 0) { | |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2440 __ BIND(L_array_is_empty); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2441 remove_arg_slots(_masm, -stack_move_unit() * array_slots, |
710 | 2442 rax_argslot, rbx_temp, rdx_temp); |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2443 } else { |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2444 ShouldNotReachHere(); |
710 | 2445 } |
2446 | |
2447 // Copy from the array to the new slots. | |
2448 // Note: Stack change code preserves integrity of rax_argslot pointer. | |
2449 // So even after slot insertions, rax_argslot still points to first argument. | |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2450 // Beware: Arguments that are shallow on the stack are deep in the array, |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2451 // and vice versa. So a downward-growing stack (the usual) has to be copied |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2452 // elementwise in reverse order from the source array. |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2453 __ BIND(L_copy_args); |
710 | 2454 if (length_constant == -1) { |
2455 // [rax_argslot, rdx_argslot_limit) is the area we are inserting into. | |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2456 // Array element [0] goes at rdx_argslot_limit[-wordSize]. |
4874
392a3f07d567
7141637: JSR 292: MH spread invoker crashes with NULL argument on x86_32
twisti
parents:
4824
diff
changeset
|
2457 Register rdi_source = rdi_array; |
392a3f07d567
7141637: JSR 292: MH spread invoker crashes with NULL argument on x86_32
twisti
parents:
4824
diff
changeset
|
2458 __ lea(rdi_source, Address(rdi_array, elem0_offset)); |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2459 Register rdx_fill_ptr = rdx_argslot_limit; |
710 | 2460 Label loop; |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2461 __ BIND(loop); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2462 __ addptr(rdx_fill_ptr, -Interpreter::stackElementSize * elem_slots); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2463 move_typed_arg(_masm, elem_type, true, |
4874
392a3f07d567
7141637: JSR 292: MH spread invoker crashes with NULL argument on x86_32
twisti
parents:
4824
diff
changeset
|
2464 Address(rdx_fill_ptr, 0), Address(rdi_source, 0), |
392a3f07d567
7141637: JSR 292: MH spread invoker crashes with NULL argument on x86_32
twisti
parents:
4824
diff
changeset
|
2465 rbx_temp, rsi_temp); |
392a3f07d567
7141637: JSR 292: MH spread invoker crashes with NULL argument on x86_32
twisti
parents:
4824
diff
changeset
|
2466 __ addptr(rdi_source, type2aelembytes(elem_type)); |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2467 __ cmpptr(rdx_fill_ptr, rax_argslot); |
3371
fabcf26ee72f
6998541: JSR 292 implement missing return-type conversion for OP_RETYPE_RAW
twisti
parents:
3363
diff
changeset
|
2468 __ jcc(Assembler::above, loop); |
710 | 2469 } else if (length_constant == 0) { |
2470 // nothing to copy | |
2471 } else { | |
2472 int elem_offset = elem0_offset; | |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2473 int slot_offset = length_constant * Interpreter::stackElementSize; |
710 | 2474 for (int index = 0; index < length_constant; index++) { |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2475 slot_offset -= Interpreter::stackElementSize * elem_slots; // fill backward |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2476 move_typed_arg(_masm, elem_type, true, |
4874
392a3f07d567
7141637: JSR 292: MH spread invoker crashes with NULL argument on x86_32
twisti
parents:
4824
diff
changeset
|
2477 Address(rax_argslot, slot_offset), Address(rdi_array, elem_offset), |
392a3f07d567
7141637: JSR 292: MH spread invoker crashes with NULL argument on x86_32
twisti
parents:
4824
diff
changeset
|
2478 rbx_temp, rsi_temp); |
710 | 2479 elem_offset += type2aelembytes(elem_type); |
2480 } | |
2481 } | |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2482 __ BIND(L_args_done); |
710 | 2483 |
2484 // Arguments are spread. Move to next method handle. | |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2485 UNPUSH_RSI; |
1846 | 2486 __ load_heap_oop(rcx_recv, rcx_mh_vmtarget); |
710 | 2487 __ jump_to_method_handle_entry(rcx_recv, rdx_temp); |
2488 | |
2489 __ bind(bad_array_klass); | |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2490 UNPUSH_RSI; |
2088
8d0b933dda2d
7007377: JSR 292 MethodHandlesTest.testCastFailure fails on SPARC with -Xcomp +DeoptimizeALot
twisti
parents:
1972
diff
changeset
|
2491 assert(!vmarg.uses(rarg2_required), "must be different registers"); |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2492 __ load_heap_oop( rarg2_required, Address(rdx_array_klass, java_mirror_offset)); // required type |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2493 __ movptr( rarg1_actual, vmarg); // bad array |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2494 __ movl( rarg0_code, (int) Bytecodes::_aaload); // who is complaining? |
1039
987e948ebbc8
6815692: method handle code needs some cleanup (post-6655638)
jrose
parents:
845
diff
changeset
|
2495 __ jump(ExternalAddress(from_interpreted_entry(_raise_exception))); |
710 | 2496 |
2497 __ bind(bad_array_length); | |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2498 UNPUSH_RSI; |
2088
8d0b933dda2d
7007377: JSR 292 MethodHandlesTest.testCastFailure fails on SPARC with -Xcomp +DeoptimizeALot
twisti
parents:
1972
diff
changeset
|
2499 assert(!vmarg.uses(rarg2_required), "must be different registers"); |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2500 __ mov( rarg2_required, rcx_recv); // AMH requiring a certain length |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2501 __ movptr( rarg1_actual, vmarg); // bad array |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2502 __ movl( rarg0_code, (int) Bytecodes::_arraylength); // who is complaining? |
1039
987e948ebbc8
6815692: method handle code needs some cleanup (post-6655638)
jrose
parents:
845
diff
changeset
|
2503 __ jump(ExternalAddress(from_interpreted_entry(_raise_exception))); |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2504 #undef UNPUSH_RSI |
710 | 2505 |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2506 break; |
710 | 2507 } |
2508 | |
3363
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2509 default: |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2510 // do not require all platforms to recognize all adapter types |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2511 __ nop(); |
167b70ff3abc
6939861: JVM should handle more conversion operations
never
parents:
3336
diff
changeset
|
2512 return; |
710 | 2513 } |
3753
cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
never
parents:
3388
diff
changeset
|
2514 BLOCK_COMMENT(err_msg("} Entry %s", entry_name(ek))); |
710 | 2515 __ hlt(); |
2516 | |
2517 address me_cookie = MethodHandleEntry::start_compiled_entry(_masm, interp_entry); | |
2518 __ unimplemented(entry_name(ek)); // %%% FIXME: NYI | |
2519 | |
2520 init_entry(ek, MethodHandleEntry::finish_compiled_entry(_masm, me_cookie)); | |
2521 } |