changeset 56916:2392106362e3 records-and-sealed

simplifying accessor name extraction
author vromero
date Wed, 03 Jul 2019 16:16:15 -0400
parents 47cdf3544a0a
children b9beeba97204
files src/hotspot/share/oops/recordParamInfo.hpp src/hotspot/share/oops/recordParamStreams.hpp src/hotspot/share/prims/jvm.cpp
diffstat 3 files changed, 14 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/share/oops/recordParamInfo.hpp	Wed Jul 03 14:55:00 2019 -0400
+++ b/src/hotspot/share/oops/recordParamInfo.hpp	Wed Jul 03 16:16:15 2019 -0400
@@ -62,6 +62,15 @@
   }
 
   u2 accessor_index() const                                { return _shorts[accessor_index_offset];   }
+
+  Symbol* name(const constantPoolHandle& cp) const {
+    int accessor_index = _shorts[accessor_index_offset];
+    int method_ref_info = cp->int_at(accessor_index);
+    int name_and_type_index = extract_high_short_from_int(method_ref_info);
+    int name_and_type_info = cp->int_at(name_and_type_index);
+    int name_index = extract_low_short_from_int(name_and_type_info);
+    return cp->symbol_at(name_index);
+  }
 };
 
 #endif // SHARE_VM_OOPS_RECORDPARAMINFO_HPP
--- a/src/hotspot/share/oops/recordParamStreams.hpp	Wed Jul 03 14:55:00 2019 -0400
+++ b/src/hotspot/share/oops/recordParamStreams.hpp	Wed Jul 03 16:16:15 2019 -0400
@@ -79,6 +79,10 @@
   int accessor_index() const {
     return record_param()->accessor_index();
   }
+
+  Symbol* name() const {
+    return record_param()->name(_constants);
+  }
 };
 
 // Iterate over the record parameters
--- a/src/hotspot/share/prims/jvm.cpp	Wed Jul 03 14:55:00 2019 -0400
+++ b/src/hotspot/share/prims/jvm.cpp	Wed Jul 03 16:16:15 2019 -0400
@@ -1689,14 +1689,7 @@
 
   int out_idx = 0;
   for (JavaRecordParameterStream recordParamsStream(k); !recordParamsStream.done(); recordParamsStream.next()) {
-    int accessor_index = recordParamsStream.accessor_index();
-    //tty->print_cr("accessor index == %d", accessor_index);
-    int method_ref_info = (int)k->constants()->int_at(accessor_index);
-    int name_and_type_index = extract_high_short_from_int(method_ref_info);
-    int name_and_type_info = (int)k->constants()->int_at(name_and_type_index);
-    int name_index = extract_low_short_from_int(name_and_type_info);
-    //tty->print_cr("name index == %d", name_index);
-    Handle str = java_lang_String::create_from_symbol(k->constants()->symbol_at(name_index), CHECK_NULL);
+    Handle str = java_lang_String::create_from_symbol(recordParamsStream.name() , CHECK_NULL);
     dest->obj_at_put(out_idx, str());
     ++out_idx;
   }