comparison src/share/vm/prims/methodHandles.hpp @ 1304:76c1d7d13ec5

6932091: JSR 292 x86 code cleanup Summary: Some code cleanups found during the JSR 292 SPARC port. Reviewed-by: kvn, never
author twisti
date Thu, 18 Mar 2010 09:56:51 +0100
parents 9eba43136cb5
children c640000b7cc1
comparison
equal deleted inserted replaced
1303:c047da02984c 1304:76c1d7d13ec5
1 /* 1 /*
2 * Copyright 2008-2009 Sun Microsystems, Inc. All Rights Reserved. 2 * Copyright 2008-2010 Sun Microsystems, Inc. All Rights Reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 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 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
135 assert(ek_valid(ek), "oob"); 135 assert(ek_valid(ek), "oob");
136 assert(_entries[ek] == NULL, "no double initialization"); 136 assert(_entries[ek] == NULL, "no double initialization");
137 _entries[ek] = me; 137 _entries[ek] = me;
138 } 138 }
139 139
140 // Some adapter helper functions.
141 static void get_ek_bound_mh_info(EntryKind ek, BasicType& arg_type, int& arg_mask, int& arg_slots) {
142 switch (ek) {
143 case _bound_int_mh : // fall-thru
144 case _bound_int_direct_mh : arg_type = T_INT; arg_mask = _INSERT_INT_MASK; break;
145 case _bound_long_mh : // fall-thru
146 case _bound_long_direct_mh: arg_type = T_LONG; arg_mask = _INSERT_LONG_MASK; break;
147 case _bound_ref_mh : // fall-thru
148 case _bound_ref_direct_mh : arg_type = T_OBJECT; arg_mask = _INSERT_REF_MASK; break;
149 default: ShouldNotReachHere();
150 }
151 arg_slots = type2size[arg_type];
152 }
153
154 static void get_ek_adapter_opt_swap_rot_info(EntryKind ek, int& swap_bytes, int& rotate) {
155 int swap_slots = 0;
156 switch (ek) {
157 case _adapter_opt_swap_1: swap_slots = 1; rotate = 0; break;
158 case _adapter_opt_swap_2: swap_slots = 2; rotate = 0; break;
159 case _adapter_opt_rot_1_up: swap_slots = 1; rotate = 1; break;
160 case _adapter_opt_rot_1_down: swap_slots = 1; rotate = -1; break;
161 case _adapter_opt_rot_2_up: swap_slots = 2; rotate = 1; break;
162 case _adapter_opt_rot_2_down: swap_slots = 2; rotate = -1; break;
163 default: ShouldNotReachHere();
164 }
165 // Return the size of the stack slots to move in bytes.
166 swap_bytes = swap_slots * Interpreter::stackElementSize();
167 }
168
169 static int get_ek_adapter_opt_spread_info(EntryKind ek) {
170 switch (ek) {
171 case _adapter_opt_spread_0: return 0;
172 case _adapter_opt_spread_1: return 1;
173 default : return -1;
174 }
175 }
176
140 static methodOop raise_exception_method() { 177 static methodOop raise_exception_method() {
141 oop rem = JNIHandles::resolve(_raise_exception_method); 178 oop rem = JNIHandles::resolve(_raise_exception_method);
142 assert(rem == NULL || rem->is_method(), ""); 179 assert(rem == NULL || rem->is_method(), "");
143 return (methodOop) rem; 180 return (methodOop) rem;
144 } 181 }
390 _INSERT_LONG_MASK = 3 427 _INSERT_LONG_MASK = 3
391 }; 428 };
392 static void insert_arg_slots(MacroAssembler* _masm, 429 static void insert_arg_slots(MacroAssembler* _masm,
393 RegisterOrConstant arg_slots, 430 RegisterOrConstant arg_slots,
394 int arg_mask, 431 int arg_mask,
395 Register rax_argslot, 432 Register argslot_reg,
396 Register rbx_temp, Register rdx_temp); 433 Register temp_reg, Register temp2_reg);
397 434
398 static void remove_arg_slots(MacroAssembler* _masm, 435 static void remove_arg_slots(MacroAssembler* _masm,
399 RegisterOrConstant arg_slots, 436 RegisterOrConstant arg_slots,
400 Register rax_argslot, 437 Register argslot_reg,
401 Register rbx_temp, Register rdx_temp); 438 Register temp_reg, Register temp2_reg);
402 }; 439 };
403 440
404 441
405 // Access methods for the "entry" field of a java.dyn.MethodHandle. 442 // Access methods for the "entry" field of a java.dyn.MethodHandle.
406 // The field is primarily a jump target for compiled calls. 443 // The field is primarily a jump target for compiled calls.