--- old/src/share/vm/ci/ciValueKlass.cpp 2016-12-02 14:22:05.927886117 +0100 +++ new/src/share/vm/ci/ciValueKlass.cpp 2016-12-02 14:22:05.487886103 +0100 @@ -28,20 +28,29 @@ // Number of value type factory parameters int ciValueKlass::param_count() const { + VM_ENTRY_MARK valueKlassHandle vklass_h(ValueKlass::cast(get_Klass())); methodHandle factory_h(vklass_h->factory_method()); - return factory_h->constMethod()->valuefactory_parameter_mapping_length(); + int count = factory_h->constMethod()->valuefactory_parameter_mapping_length(); + return count; } // Size of value type factory parameters in words int ciValueKlass::param_size() { int size = 0; - for (int i = 0; i < param_count(); ++i) { + for (int i = 0; i < nof_declared_nonstatic_fields(); ++i) { size += get_field_type_by_index(i)->size(); } return size; } +int ciValueKlass::field_index_for_argument(int argument) { + VM_ENTRY_MARK + valueKlassHandle vklass_h(ValueKlass::cast(get_Klass())); + methodHandle factory_h(vklass_h->factory_method()); + return factory_h->constMethod()->valuefactory_parameter_mapping_start()[argument].data.field_index; +} + // Returns the value factory parameter index of the field with the given offset. // If the field at 'offset' belongs to a flattened value type field, return the // index of the ValueType parameter corresponding to this flattened value type. @@ -50,7 +59,7 @@ int best_offset = 0; int best_index = -1; // Search the field with the given offset - for (int i = 0; i < param_count(); ++i) { + for (int i = 0; i < nof_declared_nonstatic_fields(); ++i) { int field_offset = get_field_offset_by_index(i); if (field_offset == offset) { // Exact match @@ -71,22 +80,23 @@ // Returns the field offset of the value factory parameter with the given index int ciValueKlass::get_field_offset_by_index(int index) const { // Compute the field index from the factory parameter index - valueKlassHandle vklass_h(ValueKlass::cast(get_Klass())); - methodHandle factory_h(vklass_h->factory_method()); - int field_index = factory_h->constMethod()->valuefactory_parameter_mapping_start()[index].data.field_index; - // Get the field offset - return vklass_h->field_offset(field_index); + GUARDED_VM_ENTRY( + valueKlassHandle vklass_h(ValueKlass::cast(get_Klass())); + return vklass_h->field_offset(index); + ) } -// Returns the field type of the value factory parameter with the given index +// Returns the field type of the field with the given index ciType* ciValueKlass::get_field_type_by_index(int index) { + VM_ENTRY_MARK int offset = get_field_offset_by_index(index); - VM_ENTRY_MARK; return get_field_type_by_offset(offset); } // Offset of the first field in the value type int ciValueKlass::get_first_field_offset() const { - valueKlassHandle vklass_h(ValueKlass::cast(get_Klass())); - return vklass_h()->first_field_offset(); + GUARDED_VM_ENTRY( + valueKlassHandle vklass_h(ValueKlass::cast(get_Klass())); + return vklass_h()->first_field_offset(); + ) }