8294591: Fix cast-function-type warning in TemplateTable
Reviewed-by: ihse, coleenp
This commit is contained in:
parent
544e317225
commit
fc616588c1
@ -159,7 +159,6 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBJVM, \
|
||||
DISABLED_WARNINGS_gcc_cgroupV2Subsystem_linux.cpp := address, \
|
||||
DISABLED_WARNINGS_gcc_interp_masm_x86.cpp := uninitialized, \
|
||||
DISABLED_WARNINGS_gcc_postaloc.cpp := address, \
|
||||
DISABLED_WARNINGS_gcc_templateTable.cpp := cast-function-type, \
|
||||
DISABLED_WARNINGS_clang := $(DISABLED_WARNINGS_clang), \
|
||||
DISABLED_WARNINGS_clang_arguments.cpp := missing-field-initializers, \
|
||||
DISABLED_WARNINGS_clang_codeBuffer.cpp := tautological-undefined-compare, \
|
||||
|
@ -309,12 +309,12 @@ void TemplateTable::sipush()
|
||||
__ asrw(r0, r0, 16);
|
||||
}
|
||||
|
||||
void TemplateTable::ldc(bool wide)
|
||||
void TemplateTable::ldc(LdcType type)
|
||||
{
|
||||
transition(vtos, vtos);
|
||||
Label call_ldc, notFloat, notClass, notInt, Done;
|
||||
|
||||
if (wide) {
|
||||
if (is_ldc_wide(type)) {
|
||||
__ get_unsigned_2_byte_index_at_bcp(r1, 1);
|
||||
} else {
|
||||
__ load_unsigned_byte(r1, at_bcp(1));
|
||||
@ -343,7 +343,7 @@ void TemplateTable::ldc(bool wide)
|
||||
__ br(Assembler::NE, notClass);
|
||||
|
||||
__ bind(call_ldc);
|
||||
__ mov(c_rarg1, wide);
|
||||
__ mov(c_rarg1, is_ldc_wide(type) ? 1 : 0);
|
||||
call_VM(r0, CAST_FROM_FN_PTR(address, InterpreterRuntime::ldc), c_rarg1);
|
||||
__ push_ptr(r0);
|
||||
__ verify_oop(r0);
|
||||
@ -376,7 +376,7 @@ void TemplateTable::ldc(bool wide)
|
||||
}
|
||||
|
||||
// Fast path for caching oop constants.
|
||||
void TemplateTable::fast_aldc(bool wide)
|
||||
void TemplateTable::fast_aldc(LdcType type)
|
||||
{
|
||||
transition(vtos, atos);
|
||||
|
||||
@ -384,7 +384,7 @@ void TemplateTable::fast_aldc(bool wide)
|
||||
Register tmp = r1;
|
||||
Register rarg = r2;
|
||||
|
||||
int index_size = wide ? sizeof(u2) : sizeof(u1);
|
||||
int index_size = is_ldc_wide(type) ? sizeof(u2) : sizeof(u1);
|
||||
|
||||
Label resolved;
|
||||
|
||||
|
@ -364,7 +364,7 @@ void TemplateTable::sipush() {
|
||||
}
|
||||
|
||||
|
||||
void TemplateTable::ldc(bool wide) {
|
||||
void TemplateTable::ldc(LdcType type) {
|
||||
transition(vtos, vtos);
|
||||
Label fastCase, Condy, Done;
|
||||
|
||||
@ -373,7 +373,7 @@ void TemplateTable::ldc(bool wide) {
|
||||
const Register Rtags = R3_tmp;
|
||||
const Register RtagType = R3_tmp;
|
||||
|
||||
if (wide) {
|
||||
if (is_ldc_wide(type)) {
|
||||
__ get_unsigned_2_byte_index_at_bcp(Rindex, 1);
|
||||
} else {
|
||||
__ ldrb(Rindex, at_bcp(1));
|
||||
@ -401,7 +401,7 @@ void TemplateTable::ldc(bool wide) {
|
||||
__ b(fastCase, ne);
|
||||
|
||||
// slow case - call runtime
|
||||
__ mov(R1, wide);
|
||||
__ mov(R1, is_ldc_wide(type) ? 1 : 0);
|
||||
call_VM(R0_tos, CAST_FROM_FN_PTR(address, InterpreterRuntime::ldc), R1);
|
||||
__ push(atos);
|
||||
__ b(Done);
|
||||
@ -429,9 +429,9 @@ void TemplateTable::ldc(bool wide) {
|
||||
}
|
||||
|
||||
// Fast path for caching oop constants.
|
||||
void TemplateTable::fast_aldc(bool wide) {
|
||||
void TemplateTable::fast_aldc(LdcType type) {
|
||||
transition(vtos, atos);
|
||||
int index_size = wide ? sizeof(u2) : sizeof(u1);
|
||||
int index_size = is_ldc_wide(type) ? sizeof(u2) : sizeof(u1);
|
||||
Label resolved;
|
||||
|
||||
// We are resolved if the resolved reference cache entry contains a
|
||||
|
@ -237,7 +237,7 @@ void TemplateTable::sipush() {
|
||||
__ get_2_byte_integer_at_bcp(1, R17_tos, InterpreterMacroAssembler::Signed);
|
||||
}
|
||||
|
||||
void TemplateTable::ldc(bool wide) {
|
||||
void TemplateTable::ldc(LdcType type) {
|
||||
Register Rscratch1 = R11_scratch1,
|
||||
Rscratch2 = R12_scratch2,
|
||||
Rcpool = R3_ARG1;
|
||||
@ -246,7 +246,7 @@ void TemplateTable::ldc(bool wide) {
|
||||
Label notInt, notFloat, notClass, exit;
|
||||
|
||||
__ get_cpool_and_tags(Rcpool, Rscratch2); // Set Rscratch2 = &tags.
|
||||
if (wide) { // Read index.
|
||||
if (is_ldc_wide(type)) { // Read index.
|
||||
__ get_2_byte_integer_at_bcp(1, Rscratch1, InterpreterMacroAssembler::Unsigned);
|
||||
} else {
|
||||
__ lbz(Rscratch1, 1, R14_bcp);
|
||||
@ -268,7 +268,7 @@ void TemplateTable::ldc(bool wide) {
|
||||
__ crnor(CCR0, Assembler::equal, CCR1, Assembler::equal); // Neither resolved class nor unresolved case from above?
|
||||
__ beq(CCR0, notClass);
|
||||
|
||||
__ li(R4, wide ? 1 : 0);
|
||||
__ li(R4, is_ldc_wide(type) ? 1 : 0);
|
||||
call_VM(R17_tos, CAST_FROM_FN_PTR(address, InterpreterRuntime::ldc), R4);
|
||||
__ push(atos);
|
||||
__ b(exit);
|
||||
@ -301,10 +301,10 @@ void TemplateTable::ldc(bool wide) {
|
||||
}
|
||||
|
||||
// Fast path for caching oop constants.
|
||||
void TemplateTable::fast_aldc(bool wide) {
|
||||
void TemplateTable::fast_aldc(LdcType type) {
|
||||
transition(vtos, atos);
|
||||
|
||||
int index_size = wide ? sizeof(u2) : sizeof(u1);
|
||||
int index_size = is_ldc_wide(type) ? sizeof(u2) : sizeof(u1);
|
||||
Label is_null;
|
||||
|
||||
// We are resolved if the resolved reference cache entry contains a
|
||||
|
@ -285,11 +285,11 @@ void TemplateTable::sipush() {
|
||||
__ sraiw(x10, x10, 16);
|
||||
}
|
||||
|
||||
void TemplateTable::ldc(bool wide) {
|
||||
void TemplateTable::ldc(LdcType type) {
|
||||
transition(vtos, vtos);
|
||||
Label call_ldc, notFloat, notClass, notInt, Done;
|
||||
|
||||
if (wide) {
|
||||
if (is_ldc_wide(type)) {
|
||||
__ get_unsigned_2_byte_index_at_bcp(x11, 1);
|
||||
} else {
|
||||
__ load_unsigned_byte(x11, at_bcp(1));
|
||||
@ -320,7 +320,7 @@ void TemplateTable::ldc(bool wide) {
|
||||
__ bne(x13, t1, notClass);
|
||||
|
||||
__ bind(call_ldc);
|
||||
__ mv(c_rarg1, wide);
|
||||
__ mv(c_rarg1, is_ldc_wide(type) ? 1 : 0);
|
||||
call_VM(x10, CAST_FROM_FN_PTR(address, InterpreterRuntime::ldc), c_rarg1);
|
||||
__ push_ptr(x10);
|
||||
__ verify_oop(x10);
|
||||
@ -354,14 +354,14 @@ void TemplateTable::ldc(bool wide) {
|
||||
}
|
||||
|
||||
// Fast path for caching oop constants.
|
||||
void TemplateTable::fast_aldc(bool wide) {
|
||||
void TemplateTable::fast_aldc(LdcType type) {
|
||||
transition(vtos, atos);
|
||||
|
||||
const Register result = x10;
|
||||
const Register tmp = x11;
|
||||
const Register rarg = x12;
|
||||
|
||||
const int index_size = wide ? sizeof(u2) : sizeof(u1);
|
||||
const int index_size = is_ldc_wide(type) ? sizeof(u2) : sizeof(u1);
|
||||
|
||||
Label resolved;
|
||||
|
||||
|
@ -378,13 +378,13 @@ void TemplateTable::sipush() {
|
||||
}
|
||||
|
||||
|
||||
void TemplateTable::ldc(bool wide) {
|
||||
void TemplateTable::ldc(LdcType type) {
|
||||
transition(vtos, vtos);
|
||||
Label call_ldc, notFloat, notClass, notInt, Done;
|
||||
const Register RcpIndex = Z_tmp_1;
|
||||
const Register Rtags = Z_ARG2;
|
||||
|
||||
if (wide) {
|
||||
if (is_ldc_wide(type)) {
|
||||
__ get_2_byte_integer_at_bcp(RcpIndex, 1, InterpreterMacroAssembler::Unsigned);
|
||||
} else {
|
||||
__ z_llgc(RcpIndex, at_bcp(1));
|
||||
@ -412,7 +412,7 @@ void TemplateTable::ldc(bool wide) {
|
||||
|
||||
// We deal with a class. Call vm to do the appropriate.
|
||||
__ bind(call_ldc);
|
||||
__ load_const_optimized(Z_ARG2, wide);
|
||||
__ load_const_optimized(Z_ARG2, is_ldc_wide(type) ? 1 : 0);
|
||||
call_VM(Z_RET, CAST_FROM_FN_PTR(address, InterpreterRuntime::ldc), Z_ARG2);
|
||||
__ push_ptr(Z_RET);
|
||||
__ z_bru(Done);
|
||||
@ -448,11 +448,11 @@ void TemplateTable::ldc(bool wide) {
|
||||
// Fast path for caching oop constants.
|
||||
// %%% We should use this to handle Class and String constants also.
|
||||
// %%% It will simplify the ldc/primitive path considerably.
|
||||
void TemplateTable::fast_aldc(bool wide) {
|
||||
void TemplateTable::fast_aldc(LdcType type) {
|
||||
transition(vtos, atos);
|
||||
|
||||
const Register index = Z_tmp_2;
|
||||
int index_size = wide ? sizeof(u2) : sizeof(u1);
|
||||
int index_size = is_ldc_wide(type) ? sizeof(u2) : sizeof(u1);
|
||||
Label L_do_resolve, L_resolved;
|
||||
|
||||
// We are resolved if the resolved reference cache entry contains a
|
||||
|
@ -350,12 +350,12 @@ void TemplateTable::sipush() {
|
||||
__ sarl(rax, 16);
|
||||
}
|
||||
|
||||
void TemplateTable::ldc(bool wide) {
|
||||
void TemplateTable::ldc(LdcType type) {
|
||||
transition(vtos, vtos);
|
||||
Register rarg = NOT_LP64(rcx) LP64_ONLY(c_rarg1);
|
||||
Label call_ldc, notFloat, notClass, notInt, Done;
|
||||
|
||||
if (wide) {
|
||||
if (is_ldc_wide(type)) {
|
||||
__ get_unsigned_2_byte_index_at_bcp(rbx, 1);
|
||||
} else {
|
||||
__ load_unsigned_byte(rbx, at_bcp(1));
|
||||
@ -383,7 +383,7 @@ void TemplateTable::ldc(bool wide) {
|
||||
|
||||
__ bind(call_ldc);
|
||||
|
||||
__ movl(rarg, wide);
|
||||
__ movl(rarg, is_ldc_wide(type) ? 1 : 0);
|
||||
call_VM(rax, CAST_FROM_FN_PTR(address, InterpreterRuntime::ldc), rarg);
|
||||
|
||||
__ push(atos);
|
||||
@ -415,13 +415,13 @@ void TemplateTable::ldc(bool wide) {
|
||||
}
|
||||
|
||||
// Fast path for caching oop constants.
|
||||
void TemplateTable::fast_aldc(bool wide) {
|
||||
void TemplateTable::fast_aldc(LdcType type) {
|
||||
transition(vtos, atos);
|
||||
|
||||
Register result = rax;
|
||||
Register tmp = rdx;
|
||||
Register rarg = NOT_LP64(rcx) LP64_ONLY(c_rarg1);
|
||||
int index_size = wide ? sizeof(u2) : sizeof(u1);
|
||||
int index_size = is_ldc_wide(type) ? sizeof(u2) : sizeof(u1);
|
||||
|
||||
Label resolved;
|
||||
|
||||
|
@ -202,8 +202,8 @@ void TemplateTable::def(Bytecodes::Code code, int flags, TosState in, TosState o
|
||||
}
|
||||
|
||||
|
||||
void TemplateTable::def(Bytecodes::Code code, int flags, TosState in, TosState out, void (*gen)(bool arg ), bool arg) {
|
||||
def(code, flags, in, out, (Template::generator)gen, (int)arg);
|
||||
void TemplateTable::def(Bytecodes::Code code, int flags, TosState in, TosState out, void (*gen)(LdcType ldct), LdcType ldct) {
|
||||
def(code, flags, in, out, (Template::generator)gen, (int)ldct);
|
||||
}
|
||||
|
||||
|
||||
@ -250,8 +250,8 @@ void TemplateTable::initialize() {
|
||||
def(Bytecodes::_dconst_1 , ____|____|____|____, vtos, dtos, dconst , 1 );
|
||||
def(Bytecodes::_bipush , ubcp|____|____|____, vtos, itos, bipush , _ );
|
||||
def(Bytecodes::_sipush , ubcp|____|____|____, vtos, itos, sipush , _ );
|
||||
def(Bytecodes::_ldc , ubcp|____|clvm|____, vtos, vtos, ldc , false );
|
||||
def(Bytecodes::_ldc_w , ubcp|____|clvm|____, vtos, vtos, ldc , true );
|
||||
def(Bytecodes::_ldc , ubcp|____|clvm|____, vtos, vtos, ldc , ldc_normal );
|
||||
def(Bytecodes::_ldc_w , ubcp|____|clvm|____, vtos, vtos, ldc , ldc_wide );
|
||||
def(Bytecodes::_ldc2_w , ubcp|____|clvm|____, vtos, vtos, ldc2_w , _ );
|
||||
def(Bytecodes::_iload , ubcp|____|clvm|____, vtos, itos, iload , _ );
|
||||
def(Bytecodes::_lload , ubcp|____|____|____, vtos, ltos, lload , _ );
|
||||
@ -484,8 +484,8 @@ void TemplateTable::initialize() {
|
||||
def(Bytecodes::_fast_linearswitch , ubcp|disp|____|____, itos, vtos, fast_linearswitch , _ );
|
||||
def(Bytecodes::_fast_binaryswitch , ubcp|disp|____|____, itos, vtos, fast_binaryswitch , _ );
|
||||
|
||||
def(Bytecodes::_fast_aldc , ubcp|____|clvm|____, vtos, atos, fast_aldc , false );
|
||||
def(Bytecodes::_fast_aldc_w , ubcp|____|clvm|____, vtos, atos, fast_aldc , true );
|
||||
def(Bytecodes::_fast_aldc , ubcp|____|clvm|____, vtos, atos, fast_aldc , ldc_normal );
|
||||
def(Bytecodes::_fast_aldc_w , ubcp|____|clvm|____, vtos, atos, fast_aldc , ldc_wide );
|
||||
|
||||
def(Bytecodes::_return_register_finalizer , ____|disp|clvm|____, vtos, vtos, _return , vtos );
|
||||
|
||||
|
@ -83,6 +83,7 @@ class TemplateTable: AllStatic {
|
||||
enum Operation { add, sub, mul, div, rem, _and, _or, _xor, shl, shr, ushr };
|
||||
enum Condition { equal, not_equal, less, less_equal, greater, greater_equal };
|
||||
enum CacheByte { f1_byte = 1, f2_byte = 2 }; // byte_no codes
|
||||
enum LdcType { ldc_normal = 0, ldc_wide = 1 }; // LDC type
|
||||
enum RewriteControl { may_rewrite, may_not_rewrite }; // control for fast code under CDS
|
||||
|
||||
private:
|
||||
@ -105,6 +106,11 @@ class TemplateTable: AllStatic {
|
||||
static void patch_bytecode(Bytecodes::Code bc, Register bc_reg,
|
||||
Register temp_reg, bool load_bc_into_bc_reg = true, int byte_no = -1);
|
||||
|
||||
static bool is_ldc_wide(LdcType type) {
|
||||
assert(type == ldc_wide || type == ldc_normal, "sanity");
|
||||
return (type == ldc_wide);
|
||||
}
|
||||
|
||||
// C calls
|
||||
static void call_VM(Register oop_result, address entry_point);
|
||||
static void call_VM(Register oop_result, address entry_point, Register arg_1);
|
||||
@ -128,9 +134,9 @@ class TemplateTable: AllStatic {
|
||||
|
||||
static void bipush();
|
||||
static void sipush();
|
||||
static void ldc(bool wide);
|
||||
static void ldc(LdcType type);
|
||||
static void ldc2_w();
|
||||
static void fast_aldc(bool wide);
|
||||
static void fast_aldc(LdcType type);
|
||||
|
||||
static void locals_index(Register reg, int offset = 1);
|
||||
static void iload();
|
||||
@ -327,7 +333,7 @@ class TemplateTable: AllStatic {
|
||||
// initialization helpers
|
||||
static void def(Bytecodes::Code code, int flags, TosState in, TosState out, void (*gen)( ), char filler );
|
||||
static void def(Bytecodes::Code code, int flags, TosState in, TosState out, void (*gen)(int arg ), int arg );
|
||||
static void def(Bytecodes::Code code, int flags, TosState in, TosState out, void (*gen)(bool arg ), bool arg );
|
||||
static void def(Bytecodes::Code code, int flags, TosState in, TosState out, void (*gen)(LdcType ldct), LdcType ldct);
|
||||
static void def(Bytecodes::Code code, int flags, TosState in, TosState out, void (*gen)(TosState tos), TosState tos);
|
||||
static void def(Bytecodes::Code code, int flags, TosState in, TosState out, void (*gen)(Operation op), Operation op);
|
||||
static void def(Bytecodes::Code code, int flags, TosState in, TosState out, void (*gen)(Condition cc), Condition cc);
|
||||
|
Loading…
Reference in New Issue
Block a user