Skip to content
Permalink
Browse files
8264004: Don't use TRAPS if no exceptions are thrown
Reviewed-by: dholmes, iklam, hseigel, dcubed
  • Loading branch information
coleenp committed Mar 24, 2021
1 parent 9ee0b9a commit 5d7e93c86dc5ad4a02ebcde30bca6069584dbf04
Show file tree
Hide file tree
Showing 4 changed files with 168 additions and 202 deletions.
@@ -1268,7 +1268,7 @@ void ConstantPool::unreference_symbols() {
// Compare this constant pool's entry at index1 to the constant pool
// cp2's entry at index2.
bool ConstantPool::compare_entry_to(int index1, const constantPoolHandle& cp2,
int index2, TRAPS) {
int index2) {

// The error tags are equivalent to non-error tags when comparing
jbyte t1 = tag_at(index1).non_error_value();
@@ -1287,8 +1287,8 @@ bool ConstantPool::compare_entry_to(int index1, const constantPoolHandle& cp2,
switch (t1) {
case JVM_CONSTANT_Class:
{
Klass* k1 = klass_at(index1, CHECK_false);
Klass* k2 = cp2->klass_at(index2, CHECK_false);
Klass* k1 = resolved_klass_at(index1);
Klass* k2 = cp2->resolved_klass_at(index2);
if (k1 == k2) {
return true;
}
@@ -1298,8 +1298,7 @@ bool ConstantPool::compare_entry_to(int index1, const constantPoolHandle& cp2,
{
int recur1 = klass_index_at(index1);
int recur2 = cp2->klass_index_at(index2);
bool match = compare_entry_to(recur1, cp2, recur2, CHECK_false);
if (match) {
if (compare_entry_to(recur1, cp2, recur2)) {
return true;
}
} break;
@@ -1319,12 +1318,11 @@ bool ConstantPool::compare_entry_to(int index1, const constantPoolHandle& cp2,
{
int recur1 = uncached_klass_ref_index_at(index1);
int recur2 = cp2->uncached_klass_ref_index_at(index2);
bool match = compare_entry_to(recur1, cp2, recur2, CHECK_false);
bool match = compare_entry_to(recur1, cp2, recur2);
if (match) {
recur1 = uncached_name_and_type_ref_index_at(index1);
recur2 = cp2->uncached_name_and_type_ref_index_at(index2);
match = compare_entry_to(recur1, cp2, recur2, CHECK_false);
if (match) {
if (compare_entry_to(recur1, cp2, recur2)) {
return true;
}
}
@@ -1361,12 +1359,10 @@ bool ConstantPool::compare_entry_to(int index1, const constantPoolHandle& cp2,
{
int recur1 = name_ref_index_at(index1);
int recur2 = cp2->name_ref_index_at(index2);
bool match = compare_entry_to(recur1, cp2, recur2, CHECK_false);
if (match) {
if (compare_entry_to(recur1, cp2, recur2)) {
recur1 = signature_ref_index_at(index1);
recur2 = cp2->signature_ref_index_at(index2);
match = compare_entry_to(recur1, cp2, recur2, CHECK_false);
if (match) {
if (compare_entry_to(recur1, cp2, recur2)) {
return true;
}
}
@@ -1376,8 +1372,7 @@ bool ConstantPool::compare_entry_to(int index1, const constantPoolHandle& cp2,
{
int recur1 = string_index_at(index1);
int recur2 = cp2->string_index_at(index2);
bool match = compare_entry_to(recur1, cp2, recur2, CHECK_false);
if (match) {
if (compare_entry_to(recur1, cp2, recur2)) {
return true;
}
} break;
@@ -1395,8 +1390,7 @@ bool ConstantPool::compare_entry_to(int index1, const constantPoolHandle& cp2,
{
int k1 = method_type_index_at(index1);
int k2 = cp2->method_type_index_at(index2);
bool match = compare_entry_to(k1, cp2, k2, CHECK_false);
if (match) {
if (compare_entry_to(k1, cp2, k2)) {
return true;
}
} break;
@@ -1408,8 +1402,7 @@ bool ConstantPool::compare_entry_to(int index1, const constantPoolHandle& cp2,
if (k1 == k2) {
int i1 = method_handle_index_at(index1);
int i2 = cp2->method_handle_index_at(index2);
bool match = compare_entry_to(i1, cp2, i2, CHECK_false);
if (match) {
if (compare_entry_to(i1, cp2, i2)) {
return true;
}
}
@@ -1421,9 +1414,8 @@ bool ConstantPool::compare_entry_to(int index1, const constantPoolHandle& cp2,
int k2 = cp2->bootstrap_name_and_type_ref_index_at(index2);
int i1 = bootstrap_methods_attribute_index(index1);
int i2 = cp2->bootstrap_methods_attribute_index(index2);
// separate statements and variables because CHECK_false is used
bool match_entry = compare_entry_to(k1, cp2, k2, CHECK_false);
bool match_operand = compare_operand_to(i1, cp2, i2, CHECK_false);
bool match_entry = compare_entry_to(k1, cp2, k2);
bool match_operand = compare_operand_to(i1, cp2, i2);
return (match_entry && match_operand);
} break;

@@ -1433,9 +1425,8 @@ bool ConstantPool::compare_entry_to(int index1, const constantPoolHandle& cp2,
int k2 = cp2->bootstrap_name_and_type_ref_index_at(index2);
int i1 = bootstrap_methods_attribute_index(index1);
int i2 = cp2->bootstrap_methods_attribute_index(index2);
// separate statements and variables because CHECK_false is used
bool match_entry = compare_entry_to(k1, cp2, k2, CHECK_false);
bool match_operand = compare_operand_to(i1, cp2, i2, CHECK_false);
bool match_entry = compare_entry_to(k1, cp2, k2);
bool match_operand = compare_operand_to(i1, cp2, i2);
return (match_entry && match_operand);
} break;

@@ -1616,7 +1607,7 @@ void ConstantPool::copy_cp_to_impl(const constantPoolHandle& from_cp, int start_
int dest_i = to_i; // leave original alone for debug purposes

for (int src_i = start_i; src_i <= end_i; /* see loop bottom */ ) {
copy_entry_to(from_cp, src_i, to_cp, dest_i, CHECK);
copy_entry_to(from_cp, src_i, to_cp, dest_i);

switch (from_cp->tag_at(src_i).value()) {
case JVM_CONSTANT_Double:
@@ -1641,8 +1632,7 @@ void ConstantPool::copy_cp_to_impl(const constantPoolHandle& from_cp, int start_
// Copy this constant pool's entry at from_i to the constant pool
// to_cp's entry at to_i.
void ConstantPool::copy_entry_to(const constantPoolHandle& from_cp, int from_i,
const constantPoolHandle& to_cp, int to_i,
TRAPS) {
const constantPoolHandle& to_cp, int to_i) {

int tag = from_cp->tag_at(from_i).value();
switch (tag) {
@@ -1786,11 +1776,11 @@ void ConstantPool::copy_entry_to(const constantPoolHandle& from_cp, int from_i,
// constant pool's entry at pattern_i. Returns the index of a
// matching entry or zero (0) if there is no matching entry.
int ConstantPool::find_matching_entry(int pattern_i,
const constantPoolHandle& search_cp, TRAPS) {
const constantPoolHandle& search_cp) {

// index zero (0) is not used
for (int i = 1; i < search_cp->length(); i++) {
bool found = compare_entry_to(pattern_i, search_cp, i, CHECK_0);
bool found = compare_entry_to(pattern_i, search_cp, i);
if (found) {
return i;
}
@@ -1802,10 +1792,10 @@ int ConstantPool::find_matching_entry(int pattern_i,

// Compare this constant pool's bootstrap specifier at idx1 to the constant pool
// cp2's bootstrap specifier at idx2.
bool ConstantPool::compare_operand_to(int idx1, const constantPoolHandle& cp2, int idx2, TRAPS) {
bool ConstantPool::compare_operand_to(int idx1, const constantPoolHandle& cp2, int idx2) {
int k1 = operand_bootstrap_method_ref_index_at(idx1);
int k2 = cp2->operand_bootstrap_method_ref_index_at(idx2);
bool match = compare_entry_to(k1, cp2, k2, CHECK_false);
bool match = compare_entry_to(k1, cp2, k2);

if (!match) {
return false;
@@ -1815,7 +1805,7 @@ bool ConstantPool::compare_operand_to(int idx1, const constantPoolHandle& cp2, i
for (int j = 0; j < argc; j++) {
k1 = operand_argument_index_at(idx1, j);
k2 = cp2->operand_argument_index_at(idx2, j);
match = compare_entry_to(k1, cp2, k2, CHECK_false);
match = compare_entry_to(k1, cp2, k2);
if (!match) {
return false;
}
@@ -1829,9 +1819,9 @@ bool ConstantPool::compare_operand_to(int idx1, const constantPoolHandle& cp2, i
// this constant pool's bootstrap specifier data at pattern_i index.
// Return the index of a matching bootstrap attribute record or (-1) if there is no match.
int ConstantPool::find_matching_operand(int pattern_i,
const constantPoolHandle& search_cp, int search_len, TRAPS) {
const constantPoolHandle& search_cp, int search_len) {
for (int i = 0; i < search_len; i++) {
bool found = compare_operand_to(pattern_i, search_cp, i, CHECK_(-1));
bool found = compare_operand_to(pattern_i, search_cp, i);
if (found) {
return i;
}
@@ -660,10 +660,10 @@ class ConstantPool : public Metadata {
}
// Compare a bootstrap specifier data in the operands arrays
bool compare_operand_to(int bsms_attribute_index1, const constantPoolHandle& cp2,
int bsms_attribute_index2, TRAPS);
int bsms_attribute_index2);
// Find a bootstrap specifier data in the operands array
int find_matching_operand(int bsms_attribute_index, const constantPoolHandle& search_cp,
int operands_cur_len, TRAPS);
int operands_cur_len);
// Resize the operands array with delta_len and delta_size
void resize_operands(int delta_len, int delta_size, TRAPS);
// Extend the operands array with the length and size of the ext_cp operands
@@ -903,15 +903,15 @@ class ConstantPool : public Metadata {
static void throw_resolution_error(const constantPoolHandle& this_cp, int which, TRAPS);

// Merging ConstantPool* support:
bool compare_entry_to(int index1, const constantPoolHandle& cp2, int index2, TRAPS);
bool compare_entry_to(int index1, const constantPoolHandle& cp2, int index2);
void copy_cp_to(int start_i, int end_i, const constantPoolHandle& to_cp, int to_i, TRAPS) {
constantPoolHandle h_this(THREAD, this);
copy_cp_to_impl(h_this, start_i, end_i, to_cp, to_i, THREAD);
}
static void copy_cp_to_impl(const constantPoolHandle& from_cp, int start_i, int end_i, const constantPoolHandle& to_cp, int to_i, TRAPS);
static void copy_entry_to(const constantPoolHandle& from_cp, int from_i, const constantPoolHandle& to_cp, int to_i, TRAPS);
static void copy_entry_to(const constantPoolHandle& from_cp, int from_i, const constantPoolHandle& to_cp, int to_i);
static void copy_operands(const constantPoolHandle& from_cp, const constantPoolHandle& to_cp, TRAPS);
int find_matching_entry(int pattern_i, const constantPoolHandle& search_cp, TRAPS);
int find_matching_entry(int pattern_i, const constantPoolHandle& search_cp);
int version() const { return _saved._version; }
void set_version(int version) { _saved._version = version; }
void increment_and_save_version(int version) {

0 comments on commit 5d7e93c

Please sign in to comment.