Skip to content

Commit c91a300

Browse files
author
Matias Saavedra Silva
committedJul 31, 2023
8307312: Replace "int which" with "int cp_index" in constantPool
Reviewed-by: coleenp, dholmes, iklam
1 parent 6af0af5 commit c91a300

File tree

8 files changed

+329
-329
lines changed

8 files changed

+329
-329
lines changed
 

‎src/hotspot/share/c1/c1_GraphBuilder.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -998,8 +998,8 @@ void GraphBuilder::load_constant() {
998998
// Unbox the value at runtime, if needed.
999999
// ConstantDynamic entry can be of a primitive type, but it is cached in boxed form.
10001000
if (patch_state != nullptr) {
1001-
int index = stream()->get_constant_pool_index();
1002-
BasicType type = stream()->get_basic_type_for_constant_at(index);
1001+
int cp_index = stream()->get_constant_pool_index();
1002+
BasicType type = stream()->get_basic_type_for_constant_at(cp_index);
10031003
if (is_java_primitive(type)) {
10041004
ciInstanceKlass* box_klass = ciEnv::current()->get_box_klass_for_primitive_type(type);
10051005
assert(box_klass->is_loaded(), "sanity");

‎src/hotspot/share/ci/ciStreams.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -267,9 +267,9 @@ ciConstant ciBytecodeStream::get_constant() {
267267
//
268268
// If this bytecode is one of the ldc variants, get the referenced
269269
// constant.
270-
constantTag ciBytecodeStream::get_constant_pool_tag(int index) const {
270+
constantTag ciBytecodeStream::get_constant_pool_tag(int cp_index) const {
271271
VM_ENTRY_MARK;
272-
return _method->get_Method()->constants()->constant_tag_at(index);
272+
return _method->get_Method()->constants()->constant_tag_at(cp_index);
273273
}
274274

275275
// ------------------------------------------------------------------
@@ -283,9 +283,9 @@ constantTag ciBytecodeStream::get_raw_pool_tag_at(int index) const {
283283
// ------------------------------------------------------------------
284284
// ciBytecodeStream::get_basic_type_for_constant_at
285285
//
286-
BasicType ciBytecodeStream::get_basic_type_for_constant_at(int index) const {
286+
BasicType ciBytecodeStream::get_basic_type_for_constant_at(int cp_index) const {
287287
VM_ENTRY_MARK;
288-
return _method->get_Method()->constants()->basic_type_for_constant_at(index);
288+
return _method->get_Method()->constants()->basic_type_for_constant_at(cp_index);
289289
}
290290

291291
// ------------------------------------------------------------------

‎src/hotspot/share/ci/ciStreams.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ class ciBytecodeStream : StackObj {
229229
// object (ciConstant.as_object()->is_loaded() == false).
230230
ciConstant get_constant();
231231
constantTag get_constant_pool_tag(int index) const;
232-
BasicType get_basic_type_for_constant_at(int index) const;
232+
BasicType get_basic_type_for_constant_at(int cp_index) const;
233233

234234
constantTag get_raw_pool_tag_at(int index) const;
235235

‎src/hotspot/share/ci/ciTypeFlow.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -727,8 +727,8 @@ void ciTypeFlow::StateVector::do_ldc(ciBytecodeStream* str) {
727727
}
728728
ciConstant con = str->get_constant();
729729
if (con.is_valid()) {
730-
int index = str->get_constant_pool_index();
731-
BasicType basic_type = str->get_basic_type_for_constant_at(index);
730+
int cp_index = str->get_constant_pool_index();
731+
BasicType basic_type = str->get_basic_type_for_constant_at(cp_index);
732732
if (is_reference_type(basic_type)) {
733733
ciObject* obj = con.as_object();
734734
if (obj->is_null_object()) {

‎src/hotspot/share/interpreter/bytecode.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,8 @@ int Bytecode_loadconstant::pool_index() const {
217217
}
218218

219219
BasicType Bytecode_loadconstant::result_type() const {
220-
int index = pool_index();
221-
return _method->constants()->basic_type_for_constant_at(index);
220+
int cp_index = pool_index();
221+
return _method->constants()->basic_type_for_constant_at(cp_index);
222222
}
223223

224224
oop Bytecode_loadconstant::resolve_constant(TRAPS) const {

‎src/hotspot/share/interpreter/interpreterRuntime.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,11 @@ JRT_ENTRY(void, InterpreterRuntime::ldc(JavaThread* current, bool wide))
151151
// access constant pool
152152
LastFrameAccessor last_frame(current);
153153
ConstantPool* pool = last_frame.method()->constants();
154-
int index = wide ? last_frame.get_index_u2(Bytecodes::_ldc_w) : last_frame.get_index_u1(Bytecodes::_ldc);
155-
constantTag tag = pool->tag_at(index);
154+
int cp_index = wide ? last_frame.get_index_u2(Bytecodes::_ldc_w) : last_frame.get_index_u1(Bytecodes::_ldc);
155+
constantTag tag = pool->tag_at(cp_index);
156156

157157
assert (tag.is_unresolved_klass() || tag.is_klass(), "wrong ldc call");
158-
Klass* klass = pool->klass_at(index, CHECK);
158+
Klass* klass = pool->klass_at(cp_index, CHECK);
159159
oop java_class = klass->java_mirror();
160160
current->set_vm_result(java_class);
161161
JRT_END

‎src/hotspot/share/oops/constantPool.cpp

+127-127
Large diffs are not rendered by default.

‎src/hotspot/share/oops/constantPool.hpp

+188-188
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)
Please sign in to comment.