Mercurial > hg > graal-compiler
annotate src/cpu/sparc/vm/methodHandles_sparc.hpp @ 3842:c7b60b601eb4
7069452: Cleanup NodeFlags
Summary: Remove flags which duplicate information in Node::NodeClasses.
Reviewed-by: never
author | kvn |
---|---|
date | Wed, 27 Jul 2011 17:28:36 -0700 |
parents | 341a57af9b0a |
children | 44ce519bc3d1 |
rev | line source |
---|---|
3753 | 1 /* |
2 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. | |
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 * | |
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | |
20 * or visit www.oracle.com if you need additional information or have any | |
21 * questions. | |
22 * | |
23 */ | |
24 | |
25 // Platform-specific definitions for method handles. | |
26 // These definitions are inlined into class MethodHandles. | |
27 | |
28 // Adapters | |
29 enum /* platform_dependent_constants */ { | |
30 adapter_code_size = NOT_LP64(22000 DEBUG_ONLY(+ 40000)) LP64_ONLY(32000 DEBUG_ONLY(+ 80000)) | |
31 }; | |
32 | |
33 public: | |
34 | |
35 class RicochetFrame : public ResourceObj { | |
36 friend class MethodHandles; | |
37 | |
38 private: | |
39 /* | |
40 RF field x86 SPARC | |
41 sender_pc *(rsp+0) I7-0x8 | |
42 sender_link rbp I6+BIAS | |
43 exact_sender_sp rsi/r13 I5_savedSP | |
44 conversion *(rcx+&amh_conv) L5_conv | |
45 saved_args_base rax L4_sab (cf. Gargs = G4) | |
46 saved_args_layout #NULL L3_sal | |
47 saved_target *(rcx+&mh_vmtgt) L2_stgt | |
48 continuation #STUB_CON L1_cont | |
49 */ | |
50 static const Register L1_continuation ; // what to do when control gets back here | |
51 static const Register L2_saved_target ; // target method handle to invoke on saved_args | |
52 static const Register L3_saved_args_layout; // caching point for MethodTypeForm.vmlayout cookie | |
53 static const Register L4_saved_args_base ; // base of pushed arguments (slot 0, arg N) (-3) | |
54 static const Register L5_conversion ; // misc. information from original AdapterMethodHandle (-2) | |
55 | |
56 frame _fr; | |
57 | |
58 RicochetFrame(const frame& fr) : _fr(fr) { } | |
59 | |
60 intptr_t* register_addr(Register reg) const { | |
61 assert((_fr.sp() + reg->sp_offset_in_saved_window()) == _fr.register_addr(reg), "must agree"); | |
62 return _fr.register_addr(reg); | |
63 } | |
64 intptr_t register_value(Register reg) const { return *register_addr(reg); } | |
65 | |
66 public: | |
67 intptr_t* continuation() const { return (intptr_t*) register_value(L1_continuation); } | |
68 oop saved_target() const { return (oop) register_value(L2_saved_target); } | |
69 oop saved_args_layout() const { return (oop) register_value(L3_saved_args_layout); } | |
70 intptr_t* saved_args_base() const { return (intptr_t*) register_value(L4_saved_args_base); } | |
71 intptr_t conversion() const { return register_value(L5_conversion); } | |
72 intptr_t* exact_sender_sp() const { return (intptr_t*) register_value(I5_savedSP); } | |
73 intptr_t* sender_link() const { return _fr.sender_sp(); } // XXX | |
74 address sender_pc() const { return _fr.sender_pc(); } | |
75 | |
76 // This value is not used for much, but it apparently must be nonzero. | |
77 static int frame_size_in_bytes() { return wordSize * 4; } | |
78 | |
79 intptr_t* extended_sender_sp() const { return saved_args_base(); } | |
80 | |
81 intptr_t return_value_slot_number() const { | |
82 return adapter_conversion_vminfo(conversion()); | |
83 } | |
84 BasicType return_value_type() const { | |
85 return adapter_conversion_dest_type(conversion()); | |
86 } | |
87 bool has_return_value_slot() const { | |
88 return return_value_type() != T_VOID; | |
89 } | |
90 intptr_t* return_value_slot_addr() const { | |
91 assert(has_return_value_slot(), ""); | |
92 return saved_arg_slot_addr(return_value_slot_number()); | |
93 } | |
94 intptr_t* saved_target_slot_addr() const { | |
95 return saved_arg_slot_addr(saved_args_length()); | |
96 } | |
97 intptr_t* saved_arg_slot_addr(int slot) const { | |
98 assert(slot >= 0, ""); | |
99 return (intptr_t*)( (address)saved_args_base() + (slot * Interpreter::stackElementSize) ); | |
100 } | |
101 | |
102 jint saved_args_length() const; | |
103 jint saved_arg_offset(int arg) const; | |
104 | |
105 // GC interface | |
106 oop* saved_target_addr() { return (oop*)register_addr(L2_saved_target); } | |
107 oop* saved_args_layout_addr() { return (oop*)register_addr(L3_saved_args_layout); } | |
108 | |
109 oop compute_saved_args_layout(bool read_cache, bool write_cache); | |
110 | |
111 #ifdef ASSERT | |
112 // The magic number is supposed to help find ricochet frames within the bytes of stack dumps. | |
113 enum { MAGIC_NUMBER_1 = 0xFEED03E, MAGIC_NUMBER_2 = 0xBEEF03E }; | |
114 static const Register L0_magic_number_1 ; // cookie for debugging, at start of RSA | |
115 static Address magic_number_2_addr() { return Address(L4_saved_args_base, -wordSize); } | |
116 intptr_t magic_number_1() const { return register_value(L0_magic_number_1); } | |
117 intptr_t magic_number_2() const { return saved_args_base()[-1]; } | |
118 #endif //ASSERT | |
119 | |
120 public: | |
121 enum { RETURN_VALUE_PLACEHOLDER = (NOT_DEBUG(0) DEBUG_ONLY(42)) }; | |
122 | |
123 void verify() const NOT_DEBUG_RETURN; // check for MAGIC_NUMBER, etc. | |
124 | |
125 static void generate_ricochet_blob(MacroAssembler* _masm, | |
126 // output params: | |
127 int* bounce_offset, | |
128 int* exception_offset, | |
129 int* frame_size_in_words); | |
130 | |
131 static void enter_ricochet_frame(MacroAssembler* _masm, | |
132 Register recv_reg, | |
133 Register argv_reg, | |
134 address return_handler); | |
135 | |
136 static void leave_ricochet_frame(MacroAssembler* _masm, | |
137 Register recv_reg, | |
138 Register new_sp_reg, | |
139 Register sender_pc_reg); | |
140 | |
141 static RicochetFrame* from_frame(const frame& fr) { | |
142 RicochetFrame* rf = new RicochetFrame(fr); | |
143 rf->verify(); | |
144 return rf; | |
145 } | |
146 | |
147 static void verify_clean(MacroAssembler* _masm) NOT_DEBUG_RETURN; | |
148 }; | |
149 | |
150 // Additional helper methods for MethodHandles code generation: | |
151 public: | |
152 static void load_klass_from_Class(MacroAssembler* _masm, Register klass_reg, Register temp_reg, Register temp2_reg); | |
153 static void load_conversion_vminfo(MacroAssembler* _masm, Address conversion_field_addr, Register reg); | |
154 static void extract_conversion_vminfo(MacroAssembler* _masm, Register conversion_field_reg, Register reg); | |
155 static void extract_conversion_dest_type(MacroAssembler* _masm, Register conversion_field_reg, Register reg); | |
156 | |
157 static void load_stack_move(MacroAssembler* _masm, | |
158 Address G3_amh_conversion, | |
159 Register G5_stack_move); | |
160 | |
161 static void insert_arg_slots(MacroAssembler* _masm, | |
162 RegisterOrConstant arg_slots, | |
163 Register argslot_reg, | |
164 Register temp_reg, Register temp2_reg, Register temp3_reg); | |
165 | |
166 static void remove_arg_slots(MacroAssembler* _masm, | |
167 RegisterOrConstant arg_slots, | |
168 Register argslot_reg, | |
169 Register temp_reg, Register temp2_reg, Register temp3_reg); | |
170 | |
171 static void push_arg_slots(MacroAssembler* _masm, | |
172 Register argslot_reg, | |
173 RegisterOrConstant slot_count, | |
174 Register temp_reg, Register temp2_reg); | |
175 | |
176 static void move_arg_slots_up(MacroAssembler* _masm, | |
177 Register bottom_reg, // invariant | |
178 Address top_addr, // can use temp_reg | |
179 RegisterOrConstant positive_distance_in_slots, | |
180 Register temp_reg, Register temp2_reg); | |
181 | |
182 static void move_arg_slots_down(MacroAssembler* _masm, | |
183 Address bottom_addr, // can use temp_reg | |
184 Register top_reg, // invariant | |
185 RegisterOrConstant negative_distance_in_slots, | |
186 Register temp_reg, Register temp2_reg); | |
187 | |
188 static void move_typed_arg(MacroAssembler* _masm, | |
189 BasicType type, bool is_element, | |
190 Address value_src, Address slot_dest, | |
191 Register temp_reg); | |
192 | |
193 static void move_return_value(MacroAssembler* _masm, BasicType type, | |
194 Address return_slot); | |
195 | |
196 static void verify_argslot(MacroAssembler* _masm, Register argslot_reg, | |
197 Register temp_reg, | |
198 const char* error_message) NOT_DEBUG_RETURN; | |
199 | |
200 static void verify_argslots(MacroAssembler* _masm, | |
201 RegisterOrConstant argslot_count, | |
202 Register argslot_reg, | |
203 Register temp_reg, | |
204 Register temp2_reg, | |
205 bool negate_argslot, | |
206 const char* error_message) NOT_DEBUG_RETURN; | |
207 | |
208 static void verify_stack_move(MacroAssembler* _masm, | |
209 RegisterOrConstant arg_slots, | |
210 int direction) NOT_DEBUG_RETURN; | |
211 | |
212 static void verify_klass(MacroAssembler* _masm, | |
213 Register obj_reg, KlassHandle klass, | |
214 Register temp_reg, Register temp2_reg, | |
215 const char* error_message = "wrong klass") NOT_DEBUG_RETURN; | |
216 | |
217 static void verify_method_handle(MacroAssembler* _masm, Register mh_reg, | |
218 Register temp_reg, Register temp2_reg) { | |
219 verify_klass(_masm, mh_reg, SystemDictionaryHandles::MethodHandle_klass(), | |
220 temp_reg, temp2_reg, | |
221 "reference is a MH"); | |
222 } | |
223 | |
3808
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3753
diff
changeset
|
224 // Similar to InterpreterMacroAssembler::jump_from_interpreted. |
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3753
diff
changeset
|
225 // Takes care of special dispatch from single stepping too. |
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3753
diff
changeset
|
226 static void jump_from_method_handle(MacroAssembler* _masm, Register method, Register temp, Register temp2); |
341a57af9b0a
6990212: JSR 292 JVMTI MethodEnter hook is not called for JSR 292 bootstrap and target methods
never
parents:
3753
diff
changeset
|
227 |
3753 | 228 static void trace_method_handle(MacroAssembler* _masm, const char* adaptername) PRODUCT_RETURN; |