Skip to content

Commit 2fd7156

Browse files
marc-chevalierVladimir Kozlov
authored andcommitted
8347426: Invalid value used for enum Cell in iTypeFlow::StateVector::meet_exception
Reviewed-by: dlong, kvn
1 parent 939815f commit 2fd7156

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/hotspot/share/ci/ciTypeFlow.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -500,8 +500,8 @@ bool ciTypeFlow::StateVector::meet_exception(ciInstanceKlass* exc,
500500
bool different = false;
501501

502502
// Meet locals from incoming array.
503-
Cell limit = local(_outer->max_locals()-1);
504-
for (Cell c = start_cell(); c <= limit; c = next_cell(c)) {
503+
Cell limit = local_limit_cell();
504+
for (Cell c = start_cell(); c < limit; c = next_cell(c)) {
505505
ciType* t1 = type_at(c);
506506
ciType* t2 = incoming->type_at(c);
507507
if (!t1->equals(t2)) {

src/hotspot/share/ci/ciTypeFlow.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,9 +213,12 @@ class ciTypeFlow : public ArenaObj {
213213
return (Cell)(outer()->max_locals() + stack_size());
214214
}
215215

216+
Cell local_limit_cell() const { return (Cell) outer()->max_locals(); }
217+
216218
// Cell creation
217219
Cell local(int lnum) const {
218220
assert(lnum < outer()->max_locals(), "index check");
221+
assert(Cell_0 <= lnum && lnum <= Cell_max, "out of Cell's range");
219222
return (Cell)(lnum);
220223
}
221224

0 commit comments

Comments
 (0)