Skip to content

Commit 5902b64

Browse files
author
Michael Haas
committed
Remove trust_bytecode (explicitly_bind) variable.
1 parent 21759a9 commit 5902b64

File tree

15 files changed

+47
-83
lines changed

15 files changed

+47
-83
lines changed

src/hotspot/cpu/aarch64/jvmciCodeInstaller_aarch64.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ void CodeInstaller::pd_relocate_ForeignCall(NativeInstruction* inst, jlong forei
124124
JVMCI_event_3("relocating (foreign call) at " PTR_FORMAT, p2i(inst));
125125
}
126126

127-
void CodeInstaller::pd_relocate_JavaMethod(CodeBuffer &cbuf, methodHandle& method, jint pc_offset, int method_index, bool trust_bytecode, JVMCI_TRAPS) {
127+
void CodeInstaller::pd_relocate_JavaMethod(CodeBuffer &cbuf, methodHandle& method, jint pc_offset, int method_index, JVMCI_TRAPS) {
128128
NativeCall* call = nullptr;
129129
switch (_next_call_type) {
130130
case INLINE_INVOKE:
@@ -133,21 +133,21 @@ void CodeInstaller::pd_relocate_JavaMethod(CodeBuffer &cbuf, methodHandle& metho
133133
case INVOKEINTERFACE: {
134134
assert(!method->is_static(), "cannot call static method with invokeinterface");
135135
call = nativeCall_at(_instructions->start() + pc_offset);
136-
_instructions->relocate(call->instruction_address(), virtual_call_Relocation::spec(_invoke_mark_pc, method_index, trust_bytecode));
136+
_instructions->relocate(call->instruction_address(), virtual_call_Relocation::spec(_invoke_mark_pc, method_index));
137137
call->trampoline_jump(cbuf, SharedRuntime::get_resolve_virtual_call_stub(), JVMCI_CHECK);
138138
break;
139139
}
140140
case INVOKESTATIC: {
141141
assert(method->is_static(), "cannot call non-static method with invokestatic");
142142
call = nativeCall_at(_instructions->start() + pc_offset);
143-
_instructions->relocate(call->instruction_address(), relocInfo::static_call_type, method_index, trust_bytecode);
143+
_instructions->relocate(call->instruction_address(), relocInfo::static_call_type, method_index);
144144
call->trampoline_jump(cbuf, SharedRuntime::get_resolve_static_call_stub(), JVMCI_CHECK);
145145
break;
146146
}
147147
case INVOKESPECIAL: {
148148
assert(!method->is_static(), "cannot call static method with invokespecial");
149149
call = nativeCall_at(_instructions->start() + pc_offset);
150-
_instructions->relocate(call->instruction_address(), relocInfo::opt_virtual_call_type, method_index, trust_bytecode);
150+
_instructions->relocate(call->instruction_address(), relocInfo::opt_virtual_call_type, method_index);
151151
call->trampoline_jump(cbuf, SharedRuntime::get_resolve_opt_virtual_call_stub(), JVMCI_CHECK);
152152
break;
153153
}

src/hotspot/cpu/x86/jvmciCodeInstaller_x86.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ void CodeInstaller::pd_relocate_ForeignCall(NativeInstruction* inst, jlong forei
153153
JVMCI_event_3("relocating (foreign call) at " PTR_FORMAT, p2i(inst));
154154
}
155155

156-
void CodeInstaller::pd_relocate_JavaMethod(CodeBuffer &, methodHandle& method, jint pc_offset, int method_index, bool trust_bytecode, JVMCI_TRAPS) {
156+
void CodeInstaller::pd_relocate_JavaMethod(CodeBuffer &, methodHandle& method, jint pc_offset, int method_index, JVMCI_TRAPS) {
157157
NativeCall* call = nullptr;
158158
switch (_next_call_type) {
159159
case INLINE_INVOKE:
@@ -165,7 +165,7 @@ void CodeInstaller::pd_relocate_JavaMethod(CodeBuffer &, methodHandle& method, j
165165
call = nativeCall_at(_instructions->start() + pc_offset);
166166
call->set_destination(SharedRuntime::get_resolve_virtual_call_stub());
167167
_instructions->relocate(call->instruction_address(),
168-
virtual_call_Relocation::spec(_invoke_mark_pc, method_index, trust_bytecode),
168+
virtual_call_Relocation::spec(_invoke_mark_pc, method_index),
169169
Assembler::call32_operand);
170170
break;
171171
}
@@ -175,15 +175,15 @@ void CodeInstaller::pd_relocate_JavaMethod(CodeBuffer &, methodHandle& method, j
175175
call = nativeCall_at(_instructions->start() + pc_offset);
176176
call->set_destination(SharedRuntime::get_resolve_static_call_stub());
177177
_instructions->relocate(call->instruction_address(),
178-
relocInfo::static_call_type, Assembler::call32_operand, method_index, trust_bytecode);
178+
relocInfo::static_call_type, Assembler::call32_operand, method_index);
179179
break;
180180
}
181181
case INVOKESPECIAL: {
182182
assert(!method->is_static(), "cannot call static method with invokespecial");
183183
call = nativeCall_at(_instructions->start() + pc_offset);
184184
call->set_destination(SharedRuntime::get_resolve_opt_virtual_call_stub());
185185
_instructions->relocate(call->instruction_address(),
186-
relocInfo::opt_virtual_call_type, Assembler::call32_operand, method_index, trust_bytecode);
186+
relocInfo::opt_virtual_call_type, Assembler::call32_operand, method_index);
187187
break;
188188
}
189189
default:

src/hotspot/share/asm/codeBuffer.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -279,16 +279,16 @@ address CodeSection::target(Label& L, address branch_pc) {
279279
}
280280
}
281281

282-
void CodeSection::relocate(address at, relocInfo::relocType rtype, int format, jint method_index, bool trust_bytecode) {
282+
void CodeSection::relocate(address at, relocInfo::relocType rtype, int format, jint method_index) {
283283
RelocationHolder rh;
284284
switch (rtype) {
285285
case relocInfo::none: return;
286286
case relocInfo::opt_virtual_call_type: {
287-
rh = opt_virtual_call_Relocation::spec(method_index, trust_bytecode);
287+
rh = opt_virtual_call_Relocation::spec(method_index);
288288
break;
289289
}
290290
case relocInfo::static_call_type: {
291-
rh = static_call_Relocation::spec(method_index, trust_bytecode);
291+
rh = static_call_Relocation::spec(method_index);
292292
break;
293293
}
294294
case relocInfo::virtual_call_type: {

src/hotspot/share/asm/codeBuffer.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ class CodeSection {
268268

269269
// Emit a relocation.
270270
void relocate(address at, RelocationHolder const& rspec, int format = 0);
271-
void relocate(address at, relocInfo::relocType rtype, int format = 0, jint method_index = 0, bool trust_bytecode = true);
271+
void relocate(address at, relocInfo::relocType rtype, int format = 0, jint method_index = 0);
272272

273273
int alignment() const;
274274

src/hotspot/share/code/nmethod.cpp

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -737,45 +737,26 @@ void nmethod::preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map
737737
}
738738
}
739739

740-
Method* nmethod::attached_method(address call_instr, bool* trust_bytecode) {
740+
Method* nmethod::attached_method(address call_instr) {
741741
assert(code_contains(call_instr), "not part of the nmethod");
742742
RelocIterator iter(this, call_instr, call_instr + 1);
743743
while (iter.next()) {
744744
if (iter.addr() == call_instr) {
745745
switch(iter.type()) {
746-
case relocInfo::static_call_type: {
747-
static_call_Relocation* reloc = iter.static_call_reloc();
748-
if (trust_bytecode != nullptr){
749-
*trust_bytecode = reloc->trust_bytecode();
750-
}
751-
return iter.static_call_reloc()->method_value();
752-
}
753-
case relocInfo::opt_virtual_call_type: {
754-
opt_virtual_call_Relocation* reloc = iter.opt_virtual_call_reloc();
755-
if (trust_bytecode != nullptr){
756-
*trust_bytecode = reloc->trust_bytecode();
757-
}
758-
return iter.opt_virtual_call_reloc()->method_value();
759-
}
760-
case relocInfo::virtual_call_type: {
761-
virtual_call_Relocation* reloc = iter.virtual_call_reloc();
762-
if (trust_bytecode != nullptr){
763-
*trust_bytecode = reloc->trust_bytecode();
764-
}
765-
return iter.virtual_call_reloc()->method_value();
766-
}
767-
default:
768-
break;
746+
case relocInfo::static_call_type: return iter.static_call_reloc()->method_value();
747+
case relocInfo::opt_virtual_call_type: return iter.opt_virtual_call_reloc()->method_value();
748+
case relocInfo::virtual_call_type: return iter.virtual_call_reloc()->method_value();
749+
default: break;
769750
}
770751
}
771752
}
772753
return nullptr; // not found
773754
}
774755

775-
Method* nmethod::attached_method_before_pc(address pc, bool* trust_bytecode) {
756+
Method* nmethod::attached_method_before_pc(address pc) {
776757
if (NativeCall::is_call_before(pc)) {
777758
NativeCall* ncall = nativeCall_before(pc);
778-
return attached_method(ncall->instruction_address(), trust_bytecode);
759+
return attached_method(ncall->instruction_address());
779760
}
780761
return nullptr; // not a call
781762
}

src/hotspot/share/code/nmethod.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -862,8 +862,8 @@ class nmethod : public CodeBlob {
862862

863863
bool has_evol_metadata();
864864

865-
Method* attached_method(address call_pc, bool* trust_bytecode = nullptr);
866-
Method* attached_method_before_pc(address pc, bool* trust_bytecode = nullptr);
865+
Method* attached_method(address call_pc);
866+
Method* attached_method_before_pc(address pc);
867867

868868
// GC unloading support
869869
// Cleans unloaded klasses and unloaded nmethods in inline caches

src/hotspot/share/code/relocInfo.hpp

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1080,22 +1080,20 @@ class virtual_call_Relocation : public CallRelocation {
10801080
// "cached_value" points to the first associated set-oop.
10811081
// The oop_limit helps find the last associated set-oop.
10821082
// (See comments at the top of this file.)
1083-
static RelocationHolder spec(address cached_value, jint method_index = 0, bool trust_bytecode = true) {
1084-
return RelocationHolder::construct<virtual_call_Relocation>(cached_value, method_index, trust_bytecode);
1083+
static RelocationHolder spec(address cached_value, jint method_index = 0) {
1084+
return RelocationHolder::construct<virtual_call_Relocation>(cached_value, method_index);
10851085
}
10861086

10871087
void copy_into(RelocationHolder& holder) const override;
10881088

10891089
private:
10901090
address _cached_value; // location of set-value instruction
10911091
jint _method_index; // resolved method for a Java call
1092-
bool _trust_bytecode; // trust the bytecode of an underlying Java call
10931092

1094-
virtual_call_Relocation(address cached_value, int method_index, bool trust_bytecode)
1093+
virtual_call_Relocation(address cached_value, int method_index)
10951094
: CallRelocation(relocInfo::virtual_call_type),
10961095
_cached_value(cached_value),
1097-
_method_index(method_index),
1098-
_trust_bytecode(trust_bytecode) {
1096+
_method_index(method_index) {
10991097
assert(cached_value != nullptr, "first oop address must be specified");
11001098
}
11011099

@@ -1107,7 +1105,6 @@ class virtual_call_Relocation : public CallRelocation {
11071105

11081106
int method_index() { return _method_index; }
11091107
Method* method_value();
1110-
bool trust_bytecode() { return _trust_bytecode; }
11111108

11121109
// data is packed as scaled offsets in "2_ints" format: [f l] or [Ff Ll]
11131110
// oop_limit is set to 0 if the limit falls somewhere within the call.
@@ -1122,28 +1119,25 @@ class virtual_call_Relocation : public CallRelocation {
11221119

11231120
class opt_virtual_call_Relocation : public CallRelocation {
11241121
public:
1125-
static RelocationHolder spec(int method_index = 0, bool trust_bytecode = true) {
1126-
return RelocationHolder::construct<opt_virtual_call_Relocation>(method_index, trust_bytecode);
1122+
static RelocationHolder spec(int method_index = 0) {
1123+
return RelocationHolder::construct<opt_virtual_call_Relocation>(method_index);
11271124
}
11281125

11291126
void copy_into(RelocationHolder& holder) const override;
11301127

11311128
private:
11321129
jint _method_index; // resolved method for a Java call
1133-
bool _trust_bytecode; // trust the bytecode of an underlying Java call
11341130

1135-
opt_virtual_call_Relocation(int method_index, bool trust_bytecode)
1131+
opt_virtual_call_Relocation(int method_index)
11361132
: CallRelocation(relocInfo::opt_virtual_call_type),
1137-
_method_index(method_index),
1138-
_trust_bytecode(trust_bytecode) { }
1133+
_method_index(method_index) { }
11391134

11401135
friend class RelocationHolder;
11411136
opt_virtual_call_Relocation() : CallRelocation(relocInfo::opt_virtual_call_type) {}
11421137

11431138
public:
11441139
int method_index() { return _method_index; }
11451140
Method* method_value();
1146-
bool trust_bytecode() { return _trust_bytecode; }
11471141

11481142
void pack_data_to(CodeSection* dest) override;
11491143
void unpack_data() override;
@@ -1157,28 +1151,25 @@ class opt_virtual_call_Relocation : public CallRelocation {
11571151

11581152
class static_call_Relocation : public CallRelocation {
11591153
public:
1160-
static RelocationHolder spec(int method_index = 0, bool trust_bytecode = true) {
1161-
return RelocationHolder::construct<static_call_Relocation>(method_index, trust_bytecode);
1154+
static RelocationHolder spec(int method_index = 0) {
1155+
return RelocationHolder::construct<static_call_Relocation>(method_index);
11621156
}
11631157

11641158
void copy_into(RelocationHolder& holder) const override;
11651159

11661160
private:
11671161
jint _method_index; // resolved method for a Java call
1168-
bool _trust_bytecode; // trust the bytecode of an underlying Java call
11691162

1170-
static_call_Relocation(int method_index, bool trust_bytecode)
1163+
static_call_Relocation(int method_index)
11711164
: CallRelocation(relocInfo::static_call_type),
1172-
_method_index(method_index),
1173-
_trust_bytecode(trust_bytecode) { }
1165+
_method_index(method_index) { }
11741166

11751167
friend class RelocationHolder;
11761168
static_call_Relocation() : CallRelocation(relocInfo::static_call_type) {}
11771169

11781170
public:
11791171
int method_index() { return _method_index; }
11801172
Method* method_value();
1181-
bool trust_bytecode() { return _trust_bytecode; }
11821173

11831174
void pack_data_to(CodeSection* dest) override;
11841175
void unpack_data() override;

src/hotspot/share/jvmci/jvmciCodeInstaller.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1225,14 +1225,12 @@ void CodeInstaller::site_Call(CodeBuffer& buffer, u1 tag, jint pc_offset, HotSpo
12251225
methodHandle method;
12261226
bool direct_call = false;
12271227
bool bind = false;
1228-
bool trust_bytecode = true;
12291228
if (tag == SITE_CALL) {
12301229
method = methodHandle(thread, (Method*) target);
12311230
assert(Method::is_valid_method(method()), "invalid method");
12321231
direct_call = stream->read_bool("direct");
12331232
if (direct_call){
12341233
bind = stream->read_bool("bind");
1235-
trust_bytecode = stream->read_bool("trustBytecode");
12361234
}
12371235
if (method.is_null()) {
12381236
JVMCI_THROW(NullPointerException);
@@ -1266,7 +1264,7 @@ void CodeInstaller::site_Call(CodeBuffer& buffer, u1 tag, jint pc_offset, HotSpo
12661264
CodeInstaller::pd_relocate_ForeignCall(inst, foreign_call_destination, JVMCI_CHECK);
12671265
} else {
12681266
int method_index = bind ? _oop_recorder->find_index(method()) : 0;
1269-
CodeInstaller::pd_relocate_JavaMethod(buffer, method, pc_offset, method_index, trust_bytecode, JVMCI_CHECK);
1267+
CodeInstaller::pd_relocate_JavaMethod(buffer, method, pc_offset, method_index, JVMCI_CHECK);
12701268
if (_next_call_type == INVOKESTATIC || _next_call_type == INVOKESPECIAL) {
12711269
// Need a static call stub for transitions from compiled to interpreted.
12721270
MacroAssembler masm(&buffer);

src/hotspot/share/jvmci/jvmciCodeInstaller.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ class CodeInstaller : public StackObj {
332332
void pd_patch_MetaspaceConstant(int pc_offset, HotSpotCompiledCodeStream* stream, u1 tag, JVMCI_TRAPS);
333333
void pd_patch_DataSectionReference(int pc_offset, int data_offset, JVMCI_TRAPS);
334334
void pd_relocate_ForeignCall(NativeInstruction* inst, jlong foreign_call_destination, JVMCI_TRAPS);
335-
void pd_relocate_JavaMethod(CodeBuffer &cbuf, methodHandle& method, jint pc_offset, int method_index, bool trust_bytecode, JVMCI_TRAPS);
335+
void pd_relocate_JavaMethod(CodeBuffer &cbuf, methodHandle& method, jint pc_offset, int method_index, JVMCI_TRAPS);
336336
bool pd_relocate(address pc, jint mark);
337337

338338
public:

src/hotspot/share/runtime/sharedRuntime.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,13 +1163,13 @@ Handle SharedRuntime::find_callee_info(Bytecodes::Code& bc, CallInfo& callinfo,
11631163
return find_callee_info_helper(vfst, bc, callinfo, THREAD);
11641164
}
11651165

1166-
Method* SharedRuntime::extract_attached_method(vframeStream& vfst, bool* trust_bytecode) {
1166+
Method* SharedRuntime::extract_attached_method(vframeStream& vfst) {
11671167
nmethod* caller = vfst.nm();
11681168

11691169
address pc = vfst.frame_pc();
11701170
{ // Get call instruction under lock because another thread may be busy patching it.
11711171
CompiledICLocker ic_locker(caller);
1172-
return caller->attached_method_before_pc(pc, trust_bytecode);
1172+
return caller->attached_method_before_pc(pc);
11731173
}
11741174
return nullptr;
11751175
}
@@ -1197,11 +1197,10 @@ Handle SharedRuntime::find_callee_info_helper(vframeStream& vfst, Bytecodes::Cod
11971197

11981198

11991199
#if INCLUDE_JVMCI
1200-
bool trust_bytecode = true;
1201-
methodHandle attached_method(THREAD, extract_attached_method(vfst, &trust_bytecode));
1200+
methodHandle attached_method(THREAD, extract_attached_method(vfst));
12021201
bool caller_is_jvmci = vfst.nm()->is_compiled_by_jvmci();
12031202

1204-
if (!trust_bytecode && attached_method.not_null() && caller_is_jvmci) {
1203+
if (attached_method.not_null() && caller_is_jvmci) {
12051204
RegisterMap reg_map2(current,
12061205
RegisterMap::UpdateMap::include,
12071206
RegisterMap::ProcessFrames::include,

0 commit comments

Comments
 (0)