Skip to content

Commit 383fe6e

Browse files
author
Matias Saavedra Silva
committed
8330388: Remove invokedynamic cache index encoding
Reviewed-by: cjplummer, dlong, coleenp
1 parent 2ea8926 commit 383fe6e

37 files changed

+88
-210
lines changed

src/hotspot/cpu/aarch64/interp_masm_aarch64.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -190,11 +190,6 @@ void InterpreterMacroAssembler::get_cache_index_at_bcp(Register index,
190190
} else if (index_size == sizeof(u4)) {
191191
// assert(EnableInvokeDynamic, "giant index used only for JSR 292");
192192
ldrw(index, Address(rbcp, bcp_offset));
193-
// Check if the secondary index definition is still ~x, otherwise
194-
// we have to change the following assembler code to calculate the
195-
// plain index.
196-
assert(ConstantPool::decode_invokedynamic_index(~123) == 123, "else change next line");
197-
eonw(index, index, zr); // convert to plain index
198193
} else if (index_size == sizeof(u1)) {
199194
load_unsigned_byte(index, Address(rbcp, bcp_offset));
200195
} else {

src/hotspot/cpu/arm/interp_masm_arm.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -211,11 +211,6 @@ void InterpreterMacroAssembler::get_index_at_bcp(Register index, int bcp_offset,
211211
orr(index, tmp_reg, AsmOperand(index, lsl, BitsPerByte));
212212
ldrb(tmp_reg, Address(Rbcp, bcp_offset));
213213
orr(index, tmp_reg, AsmOperand(index, lsl, BitsPerByte));
214-
// Check if the secondary index definition is still ~x, otherwise
215-
// we have to change the following assembler code to calculate the
216-
// plain index.
217-
assert(ConstantPool::decode_invokedynamic_index(~123) == 123, "else change next line");
218-
mvn_32(index, index); // convert to plain index
219214
} else if (index_size == sizeof(u1)) {
220215
ldrb(index, Address(Rbcp, bcp_offset));
221216
} else {

src/hotspot/cpu/ppc/interp_masm_ppc_64.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -444,8 +444,6 @@ void InterpreterMacroAssembler::get_cache_index_at_bcp(Register Rdst, int bcp_of
444444
} else {
445445
lwa(Rdst, bcp_offset, R14_bcp);
446446
}
447-
assert(ConstantPool::decode_invokedynamic_index(~123) == 123, "else change next line");
448-
nand(Rdst, Rdst, Rdst); // convert to plain index
449447
} else if (index_size == sizeof(u1)) {
450448
lbz(Rdst, bcp_offset, R14_bcp);
451449
} else {

src/hotspot/cpu/riscv/interp_masm_riscv.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -216,13 +216,6 @@ void InterpreterMacroAssembler::get_cache_index_at_bcp(Register index,
216216
}
217217
} else if (index_size == sizeof(u4)) {
218218
load_int_misaligned(index, Address(xbcp, bcp_offset), tmp, false);
219-
220-
// Check if the secondary index definition is still ~x, otherwise
221-
// we have to change the following assembler code to calculate the
222-
// plain index.
223-
assert(ConstantPool::decode_invokedynamic_index(~123) == 123, "else change next line");
224-
xori(index, index, -1);
225-
sign_extend(index, index, 32);
226219
} else if (index_size == sizeof(u1)) {
227220
load_unsigned_byte(index, Address(xbcp, bcp_offset));
228221
} else {

src/hotspot/cpu/s390/interp_masm_s390.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -324,12 +324,6 @@ void InterpreterMacroAssembler::get_cache_index_at_bcp(Register index, int bcp_o
324324
} else if (index_size == sizeof(u4)) {
325325

326326
load_sized_value(index, param, 4, false);
327-
328-
// Check if the secondary index definition is still ~x, otherwise
329-
// we have to change the following assembler code to calculate the
330-
// plain index.
331-
assert(ConstantPool::decode_invokedynamic_index(~123) == 123, "else change next line");
332-
not_(index); // Convert to plain index.
333327
} else if (index_size == sizeof(u1)) {
334328
z_llgc(index, param);
335329
} else {

src/hotspot/cpu/x86/interp_masm_x86.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -463,11 +463,6 @@ void InterpreterMacroAssembler::get_cache_index_at_bcp(Register index,
463463
load_unsigned_short(index, Address(_bcp_register, bcp_offset));
464464
} else if (index_size == sizeof(u4)) {
465465
movl(index, Address(_bcp_register, bcp_offset));
466-
// Check if the secondary index definition is still ~x, otherwise
467-
// we have to change the following assembler code to calculate the
468-
// plain index.
469-
assert(ConstantPool::decode_invokedynamic_index(~123) == 123, "else change next line");
470-
notl(index); // convert to plain index
471466
} else if (index_size == sizeof(u1)) {
472467
load_unsigned_byte(index, Address(_bcp_register, bcp_offset));
473468
} else {

src/hotspot/share/c1/c1_Runtime1.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,8 +1059,7 @@ JRT_ENTRY(void, Runtime1::patch_code(JavaThread* current, Runtime1::StubID stub_
10591059
break;
10601060
}
10611061
case Bytecodes::_invokedynamic: {
1062-
int indy_index = pool->decode_invokedynamic_index(index);
1063-
appendix = Handle(current, pool->cache()->set_dynamic_call(info, indy_index));
1062+
appendix = Handle(current, pool->cache()->set_dynamic_call(info, index));
10641063
break;
10651064
}
10661065
default: fatal("unexpected bytecode for load_appendix_patching_id");

src/hotspot/share/cds/classListParser.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ void ClassListParser::resolve_indy_impl(Symbol* class_name_symbol, TRAPS) {
591591
LinkResolver::resolve_invoke(info,
592592
recv,
593593
pool,
594-
ConstantPool::encode_invokedynamic_index(indy_index),
594+
indy_index,
595595
Bytecodes::_invokedynamic, CHECK);
596596
break;
597597
}

src/hotspot/share/ci/ciEnv.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -869,10 +869,8 @@ ciMethod* ciEnv::get_method_by_index_impl(const constantPoolHandle& cpool,
869869
// Jump through a patchable call site, which is initially a deopt routine.
870870
// Patch the call site to the nmethod entry point of the static compiled lambda form.
871871
// As with other two-component call sites, both values must be independently verified.
872-
int indy_index = cpool->decode_invokedynamic_index(index);
873-
assert (indy_index >= 0, "should be");
874-
assert(indy_index < cpool->cache()->resolved_indy_entries_length(), "impossible");
875-
Method* adapter = cpool->resolved_indy_entry_at(indy_index)->method();
872+
assert(index < cpool->cache()->resolved_indy_entries_length(), "impossible");
873+
Method* adapter = cpool->resolved_indy_entry_at(index)->method();
876874
// Resolved if the adapter is non null.
877875
if (adapter != nullptr) {
878876
return get_method(adapter);
@@ -1499,21 +1497,20 @@ void ciEnv::record_call_site_method(Thread* thread, Method* adapter) {
14991497

15001498
// Process an invokedynamic call site and record any dynamic locations.
15011499
void ciEnv::process_invokedynamic(const constantPoolHandle &cp, int indy_index, JavaThread* thread) {
1502-
int index = cp->decode_invokedynamic_index(indy_index);
1503-
ResolvedIndyEntry* indy_info = cp->resolved_indy_entry_at(index);
1500+
ResolvedIndyEntry* indy_info = cp->resolved_indy_entry_at(indy_index);
15041501
if (indy_info->method() != nullptr) {
15051502
// process the adapter
15061503
Method* adapter = indy_info->method();
15071504
record_call_site_method(thread, adapter);
15081505
// process the appendix
1509-
oop appendix = cp->resolved_reference_from_indy(index);
1506+
oop appendix = cp->resolved_reference_from_indy(indy_index);
15101507
{
15111508
RecordLocation fp(this, "<appendix>");
15121509
record_call_site_obj(thread, appendix);
15131510
}
15141511
// process the BSM
15151512
int pool_index = indy_info->constant_pool_index();
1516-
BootstrapInfo bootstrap_specifier(cp, pool_index, index);
1513+
BootstrapInfo bootstrap_specifier(cp, pool_index, indy_index);
15171514
oop bsm = cp->resolve_possibly_cached_constant_at(bootstrap_specifier.bsm_index(), thread);
15181515
{
15191516
RecordLocation fp(this, "<bsm>");

src/hotspot/share/ci/ciReplay.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,6 @@ class CompileReplay : public StackObj {
416416
int pool_index = 0;
417417

418418
if (bytecode.is_invokedynamic()) {
419-
index = cp->decode_invokedynamic_index(index);
420419
cp->cache()->set_dynamic_call(callInfo, index);
421420

422421
appendix = cp->resolved_reference_from_indy(index);

0 commit comments

Comments
 (0)