Merge
This commit is contained in:
commit
224db84b31
@ -1616,8 +1616,13 @@ methodHandle ClassFileParser::parse_method(constantPoolHandle cp, bool is_interf
|
||||
|
||||
AccessFlags access_flags;
|
||||
if (name == vmSymbols::class_initializer_name()) {
|
||||
// We ignore the access flags for a class initializer. (JVM Spec. p. 116)
|
||||
flags = JVM_ACC_STATIC;
|
||||
// We ignore the other access flags for a valid class initializer.
|
||||
// (JVM Spec 2nd ed., chapter 4.6)
|
||||
if (_major_version < 51) { // backward compatibility
|
||||
flags = JVM_ACC_STATIC;
|
||||
} else if ((flags & JVM_ACC_STATIC) == JVM_ACC_STATIC) {
|
||||
flags &= JVM_ACC_STATIC | JVM_ACC_STRICT;
|
||||
}
|
||||
} else {
|
||||
verify_legal_method_modifiers(flags, is_interface, name, CHECK_(nullHandle));
|
||||
}
|
||||
|
@ -1175,8 +1175,15 @@ void constantPoolOopDesc::copy_entry_to(constantPoolHandle from_cp, int from_i,
|
||||
|
||||
case JVM_CONSTANT_UnresolvedClass:
|
||||
{
|
||||
Symbol* k = from_cp->unresolved_klass_at(from_i);
|
||||
to_cp->unresolved_klass_at_put(to_i, k);
|
||||
// Can be resolved after checking tag, so check the slot first.
|
||||
CPSlot entry = from_cp->slot_at(from_i);
|
||||
if (entry.is_oop()) {
|
||||
assert(entry.get_oop()->is_klass(), "must be");
|
||||
// Already resolved
|
||||
to_cp->klass_at_put(to_i, (klassOop)entry.get_oop());
|
||||
} else {
|
||||
to_cp->unresolved_klass_at_put(to_i, entry.get_symbol());
|
||||
}
|
||||
} break;
|
||||
|
||||
case JVM_CONSTANT_UnresolvedClassInError:
|
||||
@ -1189,8 +1196,14 @@ void constantPoolOopDesc::copy_entry_to(constantPoolHandle from_cp, int from_i,
|
||||
|
||||
case JVM_CONSTANT_UnresolvedString:
|
||||
{
|
||||
Symbol* s = from_cp->unresolved_string_at(from_i);
|
||||
to_cp->unresolved_string_at_put(to_i, s);
|
||||
// Can be resolved after checking tag, so check the slot first.
|
||||
CPSlot entry = from_cp->slot_at(from_i);
|
||||
if (entry.is_oop()) {
|
||||
// Already resolved (either string or pseudo-string)
|
||||
to_cp->string_at_put(to_i, entry.get_oop());
|
||||
} else {
|
||||
to_cp->unresolved_string_at_put(to_i, entry.get_symbol());
|
||||
}
|
||||
} break;
|
||||
|
||||
case JVM_CONSTANT_Utf8:
|
||||
|
@ -735,7 +735,12 @@ void instanceKlass::call_class_initializer(TRAPS) {
|
||||
static int call_class_initializer_impl_counter = 0; // for debugging
|
||||
|
||||
methodOop instanceKlass::class_initializer() {
|
||||
return find_method(vmSymbols::class_initializer_name(), vmSymbols::void_method_signature());
|
||||
methodOop clinit = find_method(
|
||||
vmSymbols::class_initializer_name(), vmSymbols::void_method_signature());
|
||||
if (clinit != NULL && clinit->has_valid_initializer_flags()) {
|
||||
return clinit;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void instanceKlass::call_class_initializer_impl(instanceKlassHandle this_oop, TRAPS) {
|
||||
|
@ -883,7 +883,7 @@ void klassItable::initialize_itable_for_interface(int method_table_offset, Klass
|
||||
int ime_num = 0;
|
||||
|
||||
// Skip first methodOop if it is a class initializer
|
||||
int i = ((methodOop)methods()->obj_at(0))->name() != vmSymbols::class_initializer_name() ? 0 : 1;
|
||||
int i = ((methodOop)methods()->obj_at(0))->is_static_initializer() ? 1 : 0;
|
||||
|
||||
// m, method_name, method_signature, klass reset each loop so they
|
||||
// don't need preserving across check_signature_loaders call
|
||||
@ -1121,7 +1121,7 @@ int klassItable::compute_itable_index(methodOop m) {
|
||||
assert(index < methods->length(), "should find index for resolve_invoke");
|
||||
}
|
||||
// Adjust for <clinit>, which is left out of table if first method
|
||||
if (methods->length() > 0 && ((methodOop)methods->obj_at(0))->name() == vmSymbols::class_initializer_name()) {
|
||||
if (methods->length() > 0 && ((methodOop)methods->obj_at(0))->is_static_initializer()) {
|
||||
index--;
|
||||
}
|
||||
return index;
|
||||
@ -1135,7 +1135,7 @@ methodOop klassItable::method_for_itable_index(klassOop intf, int itable_index)
|
||||
|
||||
int index = itable_index;
|
||||
// Adjust for <clinit>, which is left out of table if first method
|
||||
if (methods->length() > 0 && ((methodOop)methods->obj_at(0))->name() == vmSymbols::class_initializer_name()) {
|
||||
if (methods->length() > 0 && ((methodOop)methods->obj_at(0))->is_static_initializer()) {
|
||||
index++;
|
||||
}
|
||||
|
||||
|
@ -228,7 +228,7 @@ public:
|
||||
return byte_offset_of(DataLayout, _header._struct._bci);
|
||||
}
|
||||
static ByteSize cell_offset(int index) {
|
||||
return byte_offset_of(DataLayout, _cells[index]);
|
||||
return byte_offset_of(DataLayout, _cells) + in_ByteSize(index * cell_size);
|
||||
}
|
||||
// Return a value which, when or-ed as a byte into _flags, sets the flag.
|
||||
static int flag_number_to_byte_constant(int flag_number) {
|
||||
|
@ -466,7 +466,20 @@ bool methodOopDesc::is_accessor() const {
|
||||
|
||||
|
||||
bool methodOopDesc::is_initializer() const {
|
||||
return name() == vmSymbols::object_initializer_name() || name() == vmSymbols::class_initializer_name();
|
||||
return name() == vmSymbols::object_initializer_name() || is_static_initializer();
|
||||
}
|
||||
|
||||
bool methodOopDesc::has_valid_initializer_flags() const {
|
||||
return (is_static() ||
|
||||
instanceKlass::cast(method_holder())->major_version() < 51);
|
||||
}
|
||||
|
||||
bool methodOopDesc::is_static_initializer() const {
|
||||
// For classfiles version 51 or greater, ensure that the clinit method is
|
||||
// static. Non-static methods with the name "<clinit>" are not static
|
||||
// initializers. (older classfiles exempted for backward compatibility)
|
||||
return name() == vmSymbols::class_initializer_name() &&
|
||||
has_valid_initializer_flags();
|
||||
}
|
||||
|
||||
|
||||
|
@ -497,6 +497,13 @@ class methodOopDesc : public oopDesc {
|
||||
// returns true if the method is an initializer (<init> or <clinit>).
|
||||
bool is_initializer() const;
|
||||
|
||||
// returns true if the method is static OR if the classfile version < 51
|
||||
bool has_valid_initializer_flags() const;
|
||||
|
||||
// returns true if the method name is <clinit> and the method has
|
||||
// valid static initializer flags.
|
||||
bool is_static_initializer() const;
|
||||
|
||||
// compiled code support
|
||||
// NOTE: code() is inherently racy as deopt can be clearing code
|
||||
// simultaneously. Use with caution.
|
||||
|
@ -1084,7 +1084,10 @@ bool VM_RedefineClasses::merge_constant_pools(constantPoolHandle old_cp,
|
||||
jbyte old_tag = old_cp->tag_at(old_i).value();
|
||||
switch (old_tag) {
|
||||
case JVM_CONSTANT_Class:
|
||||
case JVM_CONSTANT_UnresolvedClass:
|
||||
// revert the copy to JVM_CONSTANT_UnresolvedClass
|
||||
// May be resolving while calling this so do the same for
|
||||
// JVM_CONSTANT_UnresolvedClass (klass_name_at() deals with transition)
|
||||
(*merge_cp_p)->unresolved_klass_at_put(old_i,
|
||||
old_cp->klass_name_at(old_i));
|
||||
break;
|
||||
|
@ -3110,7 +3110,11 @@ jint Arguments::parse(const JavaVMInitArgs* args) {
|
||||
// Turn off biased locking for locking debug mode flags,
|
||||
// which are subtlely different from each other but neither works with
|
||||
// biased locking.
|
||||
if (!UseFastLocking || UseHeavyMonitors) {
|
||||
if (UseHeavyMonitors
|
||||
#ifdef COMPILER1
|
||||
|| !UseFastLocking
|
||||
#endif // COMPILER1
|
||||
) {
|
||||
if (!FLAG_IS_DEFAULT(UseBiasedLocking) && UseBiasedLocking) {
|
||||
// flag set to true on command line; warn the user that they
|
||||
// can't enable biased locking here
|
||||
|
@ -633,10 +633,10 @@ void os::free(void *memblock) {
|
||||
*q = (u_char)freeBlockPad;
|
||||
}
|
||||
if (PrintMalloc && tty != NULL)
|
||||
fprintf(stderr, "os::free " SIZE_FORMAT " bytes --> " PTR_FORMAT "\n", size, memblock);
|
||||
fprintf(stderr, "os::free " SIZE_FORMAT " bytes --> " PTR_FORMAT "\n", size, (uintptr_t)memblock);
|
||||
} else if (PrintMalloc && tty != NULL) {
|
||||
// tty->print_cr("os::free %p", memblock);
|
||||
fprintf(stderr, "os::free " PTR_FORMAT "\n", memblock);
|
||||
fprintf(stderr, "os::free " PTR_FORMAT "\n", (uintptr_t)memblock);
|
||||
}
|
||||
#endif
|
||||
::free((char*)memblock - space_before);
|
||||
|
Loading…
x
Reference in New Issue
Block a user