Skip to content

Commit

Permalink
8319945: [lworld+vector] Fix vector api jtreg crash with "-XX:-Enable…
Browse files Browse the repository at this point in the history
…VectorSupport"

Reviewed-by: jbhateja
  • Loading branch information
Xiaohong Gong committed Nov 28, 2023
1 parent 7df90df commit 6d74481
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 27 deletions.
4 changes: 3 additions & 1 deletion src/hotspot/share/ci/ciInlineKlass.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -53,6 +53,8 @@ int ciInlineKlass::field_index_by_offset(int offset) {
int best_offset = 0;
int best_index = -1;
// Search the field with the given offset
// TODO: Add special handling for the secondary_fields of multifields. This is
// needed once this method is used by other compilers besides C2.
for (int i = 0; i < nof_declared_nonstatic_fields(); ++i) {
int field_offset = _declared_nonstatic_fields->at(i)->offset_in_bytes();
if (field_offset == offset) {
Expand Down
11 changes: 11 additions & 0 deletions src/hotspot/share/ci/ciInstanceKlass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,17 @@ ciField* ciInstanceKlass::get_field_by_offset(int field_offset, bool is_static)
if (field_off > field_offset)
break;
// could do binary search or check bins, but probably not worth it

if (field->secondary_fields_count() > 1) {
for (int j = 0; j < field->secondary_fields_count() - 1; j++) {
ciField* sec_field = static_cast<ciMultiField*>(field)->secondary_fields()->at(j);
int sec_field_offset = sec_field->offset_in_bytes();
if (sec_field_offset == field_offset)
return sec_field;
if (sec_field_offset > field_offset)
return nullptr;
}
}
}
return nullptr;
}
Expand Down
41 changes: 15 additions & 26 deletions src/hotspot/share/opto/callnode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -516,36 +516,25 @@ void JVMState::format(PhaseRegAlloc *regalloc, const Node *n, outputStream* st)
format_helper(regalloc, st, larval_node, ":", -1, NULL);
}

Node* fld_node = mcall->in(first_ind);
ciField* cifield;
uint sec_fields_count = 0;
for (uint j = 0; j < nf; j++) {
Node* fld_node = mcall->in(first_ind + j);
if (iklass != NULL) {
st->print(" [");
cifield = iklass->nonstatic_field_at(j - sec_fields_count);
if (iklass != nullptr) {
st->print(" [");
cifield = iklass->nonstatic_field_at(0);
cifield->print_name_on(st);
format_helper(regalloc, st, fld_node, ":", 0, &scobjs);
} else {
format_helper(regalloc, st, fld_node, "[", 0, &scobjs);
}
for (uint j = 1; j < nf; j++) {
fld_node = mcall->in(first_ind+j);
if (iklass != nullptr) {
st->print(", [");
cifield = iklass->nonstatic_field_at(j);
cifield->print_name_on(st);
format_helper(regalloc, st, fld_node, ":", j, &scobjs);
sec_fields_count = 0;
if (cifield->is_multifield_base() && !fld_node->bottom_type()->isa_vect()) {
sec_fields_count = cifield->secondary_fields_count() - 1;
for (uint f = 0; f < sec_fields_count; f++) {
st->print(" [");
fld_node = mcall->in(first_ind + j + f + 1);
ciField* sec_field = static_cast<ciMultiField*>(cifield)->secondary_field_at(f);
sec_field->print_name_on(st);
format_helper(regalloc, st, fld_node, ":", j + f + 1, &scobjs);
if (f < sec_fields_count - 1) {
st->print(",");
}
}
j += sec_fields_count;
}
} else {
format_helper(regalloc, st, fld_node, " [", j, &scobjs);
}

if (j < nf - 1) {
st->print(",");
format_helper(regalloc, st, fld_node, ", [", j, &scobjs);
}
}
}
Expand Down

0 comments on commit 6d74481

Please sign in to comment.