See:
https://github.com/openjdk/jdk/blob/8a70664e5248cd6b9d63951729e93bf73eff004c/src/hotspot/share/oops/constantPool.hpp
Many of the APIs take an "int which" parameter to represent an index that is NOT an index to the constant pool. (These are "derived indices". See JDK-8307309)
However, we have a large number of function that do take constant pool indices. E.g.
void tag_at_put(int which, jbyte t) { tags()->at_put(which, t); }
void release_tag_at_put(int which, jbyte t) { tags()->release_at_put(which, t); }
u1* tag_addr_at(int which) const { return tags()->adr_at(which); }
intptr_t* obj_at_addr(int which) const {
assert(is_within_bounds(which), "index out of bounds");
return (intptr_t*) &base()[which];
}
jint* int_at_addr(int which) const {
assert(is_within_bounds(which), "index out of bounds");
return (jint*) &base()[which];
}
These should be renamed from "which" to "cp_index" to distinguish them from the derived indices.
Also, in constantPool.cpp and various of other files, callers of these function use different local variables like i, index, etc. These should also be renamed to cp_index to improve readability.
https://github.com/openjdk/jdk/blob/8a70664e5248cd6b9d63951729e93bf73eff004c/src/hotspot/share/oops/constantPool.hpp
Many of the APIs take an "int which" parameter to represent an index that is NOT an index to the constant pool. (These are "derived indices". See JDK-8307309)
However, we have a large number of function that do take constant pool indices. E.g.
void tag_at_put(int which, jbyte t) { tags()->at_put(which, t); }
void release_tag_at_put(int which, jbyte t) { tags()->release_at_put(which, t); }
u1* tag_addr_at(int which) const { return tags()->adr_at(which); }
intptr_t* obj_at_addr(int which) const {
assert(is_within_bounds(which), "index out of bounds");
return (intptr_t*) &base()[which];
}
jint* int_at_addr(int which) const {
assert(is_within_bounds(which), "index out of bounds");
return (jint*) &base()[which];
}
These should be renamed from "which" to "cp_index" to distinguish them from the derived indices.
Also, in constantPool.cpp and various of other files, callers of these function use different local variables like i, index, etc. These should also be renamed to cp_index to improve readability.
- relates to
-
JDK-8307309 Use distinct types for derived constant pool indices
-
- Open
-