6932091: JSR 292 x86 code cleanup

Some code cleanups found during the JSR 292 SPARC port.

Reviewed-by: kvn, never
This commit is contained in:
Christian Thalinger 2010-03-18 09:56:51 +01:00
parent dac78c30b9
commit 1270c6c005
6 changed files with 72 additions and 118 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright 2008-2009 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2008-2010 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -137,6 +137,43 @@ class MethodHandles: AllStatic {
_entries[ek] = me;
}
// Some adapter helper functions.
static void get_ek_bound_mh_info(EntryKind ek, BasicType& arg_type, int& arg_mask, int& arg_slots) {
switch (ek) {
case _bound_int_mh : // fall-thru
case _bound_int_direct_mh : arg_type = T_INT; arg_mask = _INSERT_INT_MASK; break;
case _bound_long_mh : // fall-thru
case _bound_long_direct_mh: arg_type = T_LONG; arg_mask = _INSERT_LONG_MASK; break;
case _bound_ref_mh : // fall-thru
case _bound_ref_direct_mh : arg_type = T_OBJECT; arg_mask = _INSERT_REF_MASK; break;
default: ShouldNotReachHere();
}
arg_slots = type2size[arg_type];
}
static void get_ek_adapter_opt_swap_rot_info(EntryKind ek, int& swap_bytes, int& rotate) {
int swap_slots = 0;
switch (ek) {
case _adapter_opt_swap_1: swap_slots = 1; rotate = 0; break;
case _adapter_opt_swap_2: swap_slots = 2; rotate = 0; break;
case _adapter_opt_rot_1_up: swap_slots = 1; rotate = 1; break;
case _adapter_opt_rot_1_down: swap_slots = 1; rotate = -1; break;
case _adapter_opt_rot_2_up: swap_slots = 2; rotate = 1; break;
case _adapter_opt_rot_2_down: swap_slots = 2; rotate = -1; break;
default: ShouldNotReachHere();
}
// Return the size of the stack slots to move in bytes.
swap_bytes = swap_slots * Interpreter::stackElementSize();
}
static int get_ek_adapter_opt_spread_info(EntryKind ek) {
switch (ek) {
case _adapter_opt_spread_0: return 0;
case _adapter_opt_spread_1: return 1;
default : return -1;
}
}
static methodOop raise_exception_method() {
oop rem = JNIHandles::resolve(_raise_exception_method);
assert(rem == NULL || rem->is_method(), "");
@ -392,13 +429,13 @@ class MethodHandles: AllStatic {
static void insert_arg_slots(MacroAssembler* _masm,
RegisterOrConstant arg_slots,
int arg_mask,
Register rax_argslot,
Register rbx_temp, Register rdx_temp);
Register argslot_reg,
Register temp_reg, Register temp2_reg);
static void remove_arg_slots(MacroAssembler* _masm,
RegisterOrConstant arg_slots,
Register rax_argslot,
Register rbx_temp, Register rdx_temp);
Register argslot_reg,
Register temp_reg, Register temp2_reg);
};