Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename klass->is_value() to is_inline_klass(), rename oop->is_value t… #89

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2020, 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
@@ -148,7 +148,7 @@ int MacroAssembler::unpack_value_args_common(Compile* C, bool receiver_only) {
} else {
// Only unpack the receiver, all other arguments are already scalarized
InstanceKlass* holder = method->method_holder();
int rec_len = holder->is_value() ? ValueKlass::cast(holder)->extended_sig()->length() : 1;
int rec_len = holder->is_inline_klass() ? ValueKlass::cast(holder)->extended_sig()->length() : 1;
// Copy scalarized signature but skip receiver, value type delimiters and reserved entries
for (int i = 0; i < sig_cc->length(); i++) {
if (!SigEntry::is_reserved_entry(sig_cc, i)) {
@@ -422,7 +422,7 @@ JRT_ENTRY(void, Runtime1::new_value_array(JavaThread* thread, Klass* array_klass
assert(array_klass->is_klass(), "not a class");
Handle holder(THREAD, array_klass->klass_holder()); // keep the klass alive
Klass* elem_klass = ArrayKlass::cast(array_klass)->element_klass();
assert(elem_klass->is_value(), "must be");
assert(elem_klass->is_inline_klass(), "must be");
// Logically creates elements, ensure klass init
elem_klass->initialize(CHECK);
arrayOop obj = oopFactory::new_valueArray(elem_klass, length, CHECK);
@@ -41,7 +41,7 @@ ciType* ciMethodType::class_to_citype(oop klass_oop) const {
ciType* ciMethodType::rtype(bool& never_null) const {
GUARDED_VM_ENTRY(
oop rtype = java_lang_invoke_MethodType::rtype(get_oop());
never_null = (java_lang_Class::as_Klass(rtype)->is_value());
never_null = (java_lang_Class::as_Klass(rtype)->is_inline_klass());
return class_to_citype(rtype);
)
}
@@ -57,7 +57,7 @@ int ciMethodType::ptype_slot_count() const {
ciType* ciMethodType::ptype_at(int index, bool& never_null) const {
GUARDED_VM_ENTRY(
oop ptype = java_lang_invoke_MethodType::ptype(get_oop(), index);
never_null = (java_lang_Class::as_Klass(ptype)->is_value());
never_null = (java_lang_Class::as_Klass(ptype)->is_inline_klass());
return class_to_citype(ptype);
)
}
@@ -388,7 +388,7 @@ ciMetadata* ciObjectFactory::create_new_metadata(Metadata* o) {

if (o->is_klass()) {
Klass* k = (Klass*)o;
if (k->is_value()) {
if (k->is_inline_klass()) {
return new (arena()) ciValueKlass(k);
} else if (k->is_instance_klass()) {
return new (arena()) ciInstanceKlass(k);
@@ -46,7 +46,7 @@ ciType::ciType(BasicType basic_type) : ciMetadata() {
}

ciType::ciType(Klass* k) : ciMetadata(k) {
_basic_type = k->is_array_klass() ? T_ARRAY : (k->is_value() ? T_VALUETYPE : T_OBJECT);
_basic_type = k->is_array_klass() ? T_ARRAY : (k->is_inline_klass() ? T_VALUETYPE : T_OBJECT);
}


@@ -4996,7 +4996,7 @@ void ClassFileParser::set_precomputed_flags(InstanceKlass* ik) {
// Check if this klass supports the java.lang.Cloneable interface
if (SystemDictionary::Cloneable_klass_loaded()) {
if (ik->is_subtype_of(SystemDictionary::Cloneable_klass())) {
if (ik->is_value()) {
if (ik->is_inline_klass()) {
Thread *THREAD = Thread::current();
throwInlineTypeLimitation(THREAD_AND_LOCATION, "Inline Types do not support Cloneable");
return;
@@ -6174,7 +6174,7 @@ InstanceKlass* ClassFileParser::create_instance_klass(bool changed_by_loadhook,
}
}

if (ik->is_value()) {
if (ik->is_inline_klass()) {
ValueKlass* vk = ValueKlass::cast(ik);
oop val = ik->allocate_instance(CHECK_NULL);
vk->set_default_value(val);
@@ -6249,7 +6249,7 @@ void ClassFileParser::fill_instance_klass(InstanceKlass* ik,
// Not yet: supers are done below to support the new subtype-checking fields
ik->set_nonstatic_field_size(_field_info->_nonstatic_field_size);
ik->set_has_nonstatic_fields(_field_info->_has_nonstatic_fields);
if (_field_info->_is_naturally_atomic && ik->is_value()) {
if (_field_info->_is_naturally_atomic && ik->is_inline_klass()) {
ik->set_is_naturally_atomic();
}
if (_is_empty_inline_type) {
@@ -6430,7 +6430,7 @@ void ClassFileParser::fill_instance_klass(InstanceKlass* ik,
}

int nfields = ik->java_fields_count();
if (ik->is_value()) nfields++;
if (ik->is_inline_klass()) nfields++;
for (int i = 0; i < nfields; i++) {
if (ik->field_is_inline_type(i)) {
Symbol* klass_name = ik->field_signature(i)->fundamental_name(CHECK);
@@ -377,7 +377,7 @@ void ClassLoaderData::classes_do(void f(InstanceKlass*)) {
void ClassLoaderData::value_classes_do(void f(ValueKlass*)) {
// Lock-free access requires load_acquire
for (Klass* k = Atomic::load_acquire(&_klasses); k != NULL; k = k->next_link()) {
if (k->is_value()) {
if (k->is_inline_klass()) {
f(ValueKlass::cast(k));
}
assert(k != k->next_link(), "no loops!");
@@ -846,7 +846,7 @@ void ClassLoaderData::free_deallocate_list() {
} else if (m->is_constantPool()) {
MetadataFactory::free_metadata(this, (ConstantPool*)m);
} else if (m->is_klass()) {
if (!((Klass*)m)->is_value()) {
if (!((Klass*)m)->is_inline_klass()) {
MetadataFactory::free_metadata(this, (InstanceKlass*)m);
} else {
MetadataFactory::free_metadata(this, (ValueKlass*)m);
@@ -1009,7 +1009,7 @@ void java_lang_Class::create_mirror(Klass* k, Handle class_loader,
if (k->is_array_klass()) {
if (k->is_valueArray_klass()) {
Klass* element_klass = (Klass*) ValueArrayKlass::cast(k)->element_klass();
assert(element_klass->is_value(), "Must be value type component");
assert(element_klass->is_inline_klass(), "Must be inline type component");
ValueKlass* vk = ValueKlass::cast(InstanceKlass::cast(element_klass));
comp_mirror = Handle(THREAD, vk->java_mirror());
} else if (k->is_typeArray_klass()) {
@@ -1060,7 +1060,7 @@ void java_lang_Class::create_mirror(Klass* k, Handle class_loader,
release_set_array_klass(comp_mirror(), k);
}

if (k->is_value()) {
if (k->is_inline_klass()) {
InstanceKlass* super = k->java_super();
set_val_type_mirror(mirror(), mirror());

@@ -1232,8 +1232,8 @@ oop java_lang_Class::archive_mirror(Klass* k, TRAPS) {
}
}

if (k->is_value()) {
// Values have a val type mirror and a ref type mirror. Don't handle this for now. TODO:CDS
if (k->is_inline_klass()) {
// Inline types have a val type mirror and a ref type mirror. Don't handle this for now. TODO:CDS
k->set_java_mirror_handle(OopHandle());
return NULL;
}
@@ -1591,7 +1591,7 @@ void java_lang_Class::print_signature(oop java_class, outputStream* st) {
} else {
Klass* k = as_Klass(java_class);
is_instance = k->is_instance_klass();
is_value = k->is_value();
is_value = k->is_inline_klass();
name = k->name();
}
if (name == NULL) {
@@ -112,7 +112,7 @@ VerificationType StackMapFrame::set_locals_from_arg(
sig = sig_copy;
}
if (ss.type() == T_VALUETYPE) {
return VerificationType::inlinetype_type(sig);
return VerificationType::inline_type(sig);
}
return VerificationType::reference_type(sig);
}
@@ -194,7 +194,7 @@ VerificationType StackMapReader::parse_verification_type(u1* flags, TRAPS) {
_stream->stackmap_format_error("TBD something bad happened", THREAD);
return VerificationType::bogus_type();
}
return VerificationType::inlinetype_type(fund_name);
return VerificationType::inline_type(fund_name);
} else {
return VerificationType::reference_type(klass_name);
}
@@ -128,7 +128,7 @@ bool VerificationType::is_reference_assignable_from(
// This code implements non-covariance between inline type arrays and both
// arrays of objects and arrays of interface types. If covariance is
// supported for inline type arrays then this code should be removed.
if (comp_from.is_inlinetype() && !comp_this.is_null() && comp_this.is_reference()) {
if (comp_from.is_inline_type() && !comp_this.is_null() && comp_this.is_reference()) {
// An array of inline types is not assignable to an array of java.lang.Objects.
if (comp_this.name() == vmSymbols::java_lang_Object()) {
return false;
@@ -160,11 +160,11 @@ bool VerificationType::is_reference_assignable_from(
return false;
}

bool VerificationType::is_inlinetype_assignable_from(const VerificationType& from) const {
bool VerificationType::is_inline_type_assignable_from(const VerificationType& from) const {
// Check that 'from' is not null, is an inline type, and is the same inline type.
assert(is_inlinetype(), "called with a non-inlinetype type");
assert(!is_null(), "inlinetype is not null");
return (!from.is_null() && from.is_inlinetype() && name() == from.name());
assert(is_inline_type(), "called with a non-inline type");
assert(!is_null(), "inline type is not null");
return (!from.is_null() && from.is_inline_type() && name() == from.name());
}

bool VerificationType::is_ref_assignable_from_inline_type(const VerificationType& from, ClassVerifier* context, TRAPS) const {
@@ -221,7 +221,7 @@ VerificationType VerificationType::get_component(ClassVerifier *context, TRAPS)
Symbol* component_copy = context->create_temporary_symbol(component);
assert(component_copy == component, "symbols don't match");
return (ss.type() == T_VALUETYPE) ?
VerificationType::inlinetype_type(component_copy) :
VerificationType::inline_type(component_copy) :
VerificationType::reference_type(component_copy);
}
default:
@@ -258,7 +258,7 @@ void VerificationType::print_on(outputStream* st) const {
st->print("uninitializedThis");
} else if (is_uninitialized()) {
st->print("uninitialized %d", bci());
} else if (is_inlinetype()) {
} else if (is_inline_type()) {
name()->print_Qvalue_on(st);
} else {
if (name() != NULL) {
@@ -153,7 +153,7 @@ class VerificationType {
// any reference is assignable to reference_check.
static VerificationType reference_check()
{ return VerificationType(ReferenceQuery); }
static VerificationType inlinetype_check()
static VerificationType inline_type_check()
{ return VerificationType(InlineTypeQuery); }
static VerificationType category1_check()
{ return VerificationType(Category1Query); }
@@ -179,7 +179,7 @@ class VerificationType {

// For inline types, store the actual Symbol* and set the 3rd bit.
// Provides a way for an inline type to be distinguished from a reference type.
static VerificationType inlinetype_type(Symbol* sh) {
static VerificationType inline_type(Symbol* sh) {
assert(((uintptr_t)sh & TypeMask) == 0, "Symbols must be aligned");
assert((uintptr_t)sh != 0, "Null is not a valid inline type");
// If the above assert fails in the future because oop* isn't aligned,
@@ -203,8 +203,8 @@ class VerificationType {
bool is_double() const { return (_u._data == Double); }
bool is_long2() const { return (_u._data == Long_2nd); }
bool is_double2() const { return (_u._data == Double_2nd); }
bool is_reference() const { return (((_u._data & TypeMask) == Reference) && !is_inlinetype_check()); }
bool is_inlinetype() const { return ((_u._data & TypeMask) == InlineType); }
bool is_reference() const { return (((_u._data & TypeMask) == Reference) && !is_inline_type_check()); }
bool is_inline_type() const { return ((_u._data & TypeMask) == InlineType); }
bool is_category1() const {
// This should return true for all one-word types, which are category1
// primitives, references (including uninitialized refs) and inline types.
@@ -222,7 +222,7 @@ class VerificationType {
return ((_u._data & Category2_2nd) == Category2_2nd);
}
bool is_reference_check() const { return _u._data == ReferenceQuery; }
bool is_inlinetype_check() const { return _u._data == InlineTypeQuery; }
bool is_inline_type_check() const { return _u._data == InlineTypeQuery; }
bool is_nonscalar_check() const { return _u._data == NonScalarQuery; }
bool is_category1_check() const { return _u._data == Category1Query; }
bool is_category2_check() const { return _u._data == Category2Query; }
@@ -242,11 +242,11 @@ class VerificationType {
bool is_double_array() const { return is_x_array(JVM_SIGNATURE_DOUBLE); }
bool is_object_array() const { return is_x_array(JVM_SIGNATURE_CLASS); }
bool is_array_array() const { return is_x_array(JVM_SIGNATURE_ARRAY); }
bool is_inline_array() const { return is_x_array(JVM_SIGNATURE_INLINE_TYPE); }
bool is_inline_type_array() const { return is_x_array(JVM_SIGNATURE_INLINE_TYPE); }
bool is_reference_array() const
{ return is_object_array() || is_array_array(); }
bool is_nonscalar_array() const
{ return is_object_array() || is_array_array() || is_inline_array(); }
{ return is_object_array() || is_array_array() || is_inline_type_array(); }
bool is_object() const
{ return (is_reference() && !is_null() && name()->utf8_length() >= 1 &&
name()->char_at(0) != JVM_SIGNATURE_ARRAY); }
@@ -263,10 +263,10 @@ class VerificationType {
return VerificationType(is_long() ? Long_2nd : Double_2nd);
}

static VerificationType change_ref_to_inlinetype(VerificationType ref) {
static VerificationType change_ref_to_inline_type(VerificationType ref) {
assert(ref.is_reference(), "Bad arg");
assert(!ref.is_null(), "Unexpected NULL");
return inlinetype_type(ref.name());
return inline_type(ref.name());
}

u2 bci() const {
@@ -275,14 +275,14 @@ class VerificationType {
}

Symbol* name() const {
assert(!is_null() && (is_reference() || is_inlinetype()), "Must be a non-null reference or an inline type");
assert(!is_null() && (is_reference() || is_inline_type()), "Must be a non-null reference or an inline type");
return (is_reference() ? _u._sym : ((Symbol*)(_u._data & ~(uintptr_t)InlineType)));
}

bool equals(const VerificationType& t) const {
return (_u._data == t._u._data ||
(((is_reference() && t.is_reference()) ||
(is_inlinetype() && t.is_inlinetype())) &&
(is_inline_type() && t.is_inline_type())) &&
!is_null() && !t.is_null() && name() == t.name()));

}
@@ -315,19 +315,19 @@ class VerificationType {
return from.is_reference() || from.is_uninitialized();
case NonScalarQuery:
return from.is_reference() || from.is_uninitialized() ||
from.is_inlinetype();
from.is_inline_type();
case InlineTypeQuery:
return from.is_inlinetype();
return from.is_inline_type();
case Boolean:
case Byte:
case Char:
case Short:
// An int can be assigned to boolean, byte, char or short values.
return from.is_integer();
default:
if (is_inlinetype()) {
return is_inlinetype_assignable_from(from);
} else if (is_reference() && from.is_inlinetype()) {
if (is_inline_type()) {
return is_inline_type_assignable_from(from);
} else if (is_reference() && from.is_inline_type()) {
return is_ref_assignable_from_inline_type(from, context, THREAD);
} else if (is_reference() && from.is_reference()) {
return is_reference_assignable_from(from, context,
@@ -377,7 +377,7 @@ class VerificationType {
const VerificationType&, ClassVerifier*, bool from_field_is_protected,
TRAPS) const;

bool is_inlinetype_assignable_from(const VerificationType& from) const;
bool is_inline_type_assignable_from(const VerificationType& from) const;

bool is_ref_assignable_from_inline_type(const VerificationType& from, ClassVerifier* context, TRAPS) const;

@@ -588,9 +588,9 @@ void ErrorContext::stackmap_details(outputStream* ss, const Method* method) cons

// Methods in ClassVerifier

VerificationType reference_or_inlinetype(InstanceKlass* klass) {
if (klass->is_value()) {
return VerificationType::inlinetype_type(klass->name());
VerificationType reference_or_inline_type(InstanceKlass* klass) {
if (klass->is_inline_klass()) {
return VerificationType::inline_type(klass->name());
} else {
return VerificationType::reference_type(klass->name());
}
@@ -600,7 +600,7 @@ ClassVerifier::ClassVerifier(
InstanceKlass* klass, TRAPS)
: _thread(THREAD), _previous_symbol(NULL), _symbols(NULL), _exception_type(NULL),
_message(NULL), _method_signatures_table(NULL), _klass(klass) {
_this_type = reference_or_inlinetype(klass);
_this_type = reference_or_inline_type(klass);
}

ClassVerifier::~ClassVerifier() {
@@ -1761,7 +1761,7 @@ void ClassVerifier::verify_method(const methodHandle& m, TRAPS) {
return;
}
VerificationType inline_type =
VerificationType::change_ref_to_inlinetype(ref_type);
VerificationType::change_ref_to_inline_type(ref_type);
current_frame.push_stack(inline_type, CHECK_VERIFY(this));
no_control_flow = false; break;
}
@@ -2402,9 +2402,9 @@ void ClassVerifier::verify_field_instructions(RawBytecodeStream* bcs,
}
// stack_object_type and target_class_type must be the same inline type.
stack_object_type =
current_frame->pop_stack(VerificationType::inlinetype_check(), CHECK_VERIFY(this));
current_frame->pop_stack(VerificationType::inline_type_check(), CHECK_VERIFY(this));
VerificationType target_inline_type =
VerificationType::change_ref_to_inlinetype(target_class_type);
VerificationType::change_ref_to_inline_type(target_class_type);
if (!stack_object_type.equals(target_inline_type)) {
verify_error(ErrorContext::bad_inline_type(bci,
current_frame->stack_top_ctx(),
@@ -2941,7 +2941,7 @@ void ClassVerifier::verify_invoke_instructions(
current_type(), this, false, CHECK_VERIFY(this));
} else {
InstanceKlass* unsafe_host = current_class()->unsafe_anonymous_host();
VerificationType unsafe_anonymous_host_type = reference_or_inlinetype(unsafe_host);
VerificationType unsafe_anonymous_host_type = reference_or_inline_type(unsafe_host);
subtype = ref_class_type.is_assignable_from(unsafe_anonymous_host_type, this, false, CHECK_VERIFY(this));

// If invokespecial of IMR, need to recheck for same or
@@ -2995,7 +2995,7 @@ void ClassVerifier::verify_invoke_instructions(
VerificationType top = current_frame->pop_stack(CHECK_VERIFY(this));

InstanceKlass* unsafe_host = current_class()->unsafe_anonymous_host();
VerificationType host_type = reference_or_inlinetype(unsafe_host);
VerificationType host_type = reference_or_inline_type(unsafe_host);
bool subtype = host_type.is_assignable_from(top, this, false, CHECK_VERIFY(this));
if (!subtype) {
verify_error( ErrorContext::bad_type(current_frame->offset(),
@@ -3119,7 +3119,7 @@ void ClassVerifier::verify_anewarray(
assert(n == length, "Unexpected number of characters in string");
} else { // it's an object or interface
const char* component_name = component_type.name()->as_utf8();
char Q_or_L = component_type.is_inlinetype() ? JVM_SIGNATURE_INLINE_TYPE : JVM_SIGNATURE_CLASS;
char Q_or_L = component_type.is_inline_type() ? JVM_SIGNATURE_INLINE_TYPE : JVM_SIGNATURE_CLASS;
// add one dimension to component with 'L' or 'Q' prepended and ';' appended.
length = (int)strlen(component_name) + 3;
arr_sig_str = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, length + 1);