Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/hotspot/cpu/aarch64/templateTable_aarch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -376,15 +376,15 @@ 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 = r0;
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;

Expand Down
10 changes: 5 additions & 5 deletions src/hotspot/cpu/arm/templateTable_arm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ void TemplateTable::sipush() {
}


void TemplateTable::ldc(bool wide) {
void TemplateTable::ldc(LdcType type) {
transition(vtos, vtos);
Label fastCase, Condy, Done;

Expand All @@ -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));
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions src/hotspot/cpu/ppc/templateTable_ppc_64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions src/hotspot/cpu/riscv/templateTable_riscv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,12 +300,12 @@ void TemplateTable::sipush()
}
}

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));
Expand Down Expand Up @@ -335,7 +335,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);
Expand Down Expand Up @@ -369,15 +369,15 @@ 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;

Expand Down
10 changes: 5 additions & 5 deletions src/hotspot/cpu/s390/templateTable_s390.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -377,13 +377,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));
Expand Down Expand Up @@ -411,7 +411,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);
Expand Down Expand Up @@ -447,11 +447,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
Expand Down
10 changes: 5 additions & 5 deletions src/hotspot/cpu/x86/templateTable_x86.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;

Expand Down
12 changes: 6 additions & 6 deletions src/hotspot/share/interpreter/templateTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}


Expand Down Expand Up @@ -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 , _ );
Expand Down Expand Up @@ -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 );

Expand Down
12 changes: 9 additions & 3 deletions src/hotspot/share/interpreter/templateTable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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);
Expand All @@ -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();
Expand Down Expand Up @@ -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);
Expand Down