Skip to content

Commit 457bfa5

Browse files
committed
Const variant of adr_at
1 parent 65a4f50 commit 457bfa5

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/hotspot/share/oops/array.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ class Array: public MetaspaceObj {
126126
T at(int i) const { assert(i >= 0 && i< _length, "oob: 0 <= %d < %d", i, _length); return data()[i]; }
127127
void at_put(const int i, const T& x) { assert(i >= 0 && i< _length, "oob: 0 <= %d < %d", i, _length); data()[i] = x; }
128128
T* adr_at(const int i) { assert(i >= 0 && i< _length, "oob: 0 <= %d < %d", i, _length); return &data()[i]; }
129+
const T* adr_at(const int i) const { assert(i >= 0 && i< _length, "oob: 0 <= %d < %d", i, _length); return &data()[i]; }
129130
int find(const T& x) { return index_of(x); }
130131

131132
T at_acquire(const int i) { return Atomic::load_acquire(adr_at(i)); }

src/hotspot/share/oops/constantPool.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1734,8 +1734,8 @@ void ConstantPool::copy_bsm_data(const constantPoolHandle& from_cp,
17341734
// Append my offsets and data to the target's offset and data arrays.
17351735
const Array<u4>* from_offs = from_cp->bsm_attribute_offsets();
17361736
const Array<u2>* from_data = from_cp->bsm_attribute_entries();
1737-
Array<u4>* to_offs = to_cp->bsm_attribute_offsets();
1738-
Array<u2>* to_data = to_cp->bsm_attribute_entries();
1737+
const Array<u4>* to_offs = to_cp->bsm_attribute_offsets();
1738+
const Array<u2>* to_data = to_cp->bsm_attribute_entries();
17391739
if (from_offs == nullptr || from_offs->length() == 0) {
17401740
return; // nothing to copy
17411741
}

0 commit comments

Comments
 (0)