8264711: More runtime TRAPS cleanups
Reviewed-by: lfoltan, pchilanomate, dholmes, dcubed
This commit is contained in:
parent
3aec2d9647
commit
af13c64f68
src/hotspot
os
share
classfile
javaClasses.cppjavaClasses.hppsystemDictionary.cppsystemDictionary.hppvmClasses.cppvmSymbols.cppvmSymbols.hpp
interpreter
memory
prims
runtime
@ -1311,7 +1311,7 @@ void PerfMemory::attach(const char* user, int vmid, PerfMemoryMode mode, char**
|
||||
// the indicated process's PerfData memory region from this
|
||||
// process's address space.
|
||||
//
|
||||
void PerfMemory::detach(char* addr, size_t bytes, TRAPS) {
|
||||
void PerfMemory::detach(char* addr, size_t bytes) {
|
||||
|
||||
assert(addr != 0, "address sanity check");
|
||||
assert(bytes > 0, "capacity sanity check");
|
||||
|
@ -1823,7 +1823,7 @@ void PerfMemory::attach(const char* user, int vmid, PerfMemoryMode mode,
|
||||
// the indicated process's PerfData memory region from this
|
||||
// process's address space.
|
||||
//
|
||||
void PerfMemory::detach(char* addr, size_t bytes, TRAPS) {
|
||||
void PerfMemory::detach(char* addr, size_t bytes) {
|
||||
|
||||
assert(addr != 0, "address sanity check");
|
||||
assert(bytes > 0, "capacity sanity check");
|
||||
|
@ -968,7 +968,7 @@ void java_lang_Class::initialize_mirror_fields(Klass* k,
|
||||
}
|
||||
|
||||
// Set the java.lang.Module module field in the java_lang_Class mirror
|
||||
void java_lang_Class::set_mirror_module_field(Klass* k, Handle mirror, Handle module, TRAPS) {
|
||||
void java_lang_Class::set_mirror_module_field(JavaThread* current, Klass* k, Handle mirror, Handle module) {
|
||||
if (module.is_null()) {
|
||||
// During startup, the module may be NULL only if java.base has not been defined yet.
|
||||
// Put the class on the fixup_module_list to patch later when the java.lang.Module
|
||||
@ -977,7 +977,7 @@ void java_lang_Class::set_mirror_module_field(Klass* k, Handle mirror, Handle mo
|
||||
|
||||
bool javabase_was_defined = false;
|
||||
{
|
||||
MutexLocker m1(THREAD, Module_lock);
|
||||
MutexLocker m1(current, Module_lock);
|
||||
// Keep list of classes needing java.base module fixup
|
||||
if (!ModuleEntryTable::javabase_defined()) {
|
||||
assert(k->java_mirror() != NULL, "Class's mirror is null");
|
||||
@ -994,7 +994,7 @@ void java_lang_Class::set_mirror_module_field(Klass* k, Handle mirror, Handle mo
|
||||
ModuleEntry *javabase_entry = ModuleEntryTable::javabase_moduleEntry();
|
||||
assert(javabase_entry != NULL && javabase_entry->module() != NULL,
|
||||
"Setting class module field, " JAVA_BASE_NAME " should be defined");
|
||||
Handle javabase_handle(THREAD, javabase_entry->module());
|
||||
Handle javabase_handle(current, javabase_entry->module());
|
||||
set_module(mirror(), javabase_handle());
|
||||
}
|
||||
} else {
|
||||
@ -1087,7 +1087,7 @@ void java_lang_Class::create_mirror(Klass* k, Handle class_loader,
|
||||
|
||||
// Set the module field in the java_lang_Class instance. This must be done
|
||||
// after the mirror is set.
|
||||
set_mirror_module_field(k, mirror, module, THREAD);
|
||||
set_mirror_module_field(THREAD->as_Java_thread(), k, mirror, module);
|
||||
|
||||
if (comp_mirror() != NULL) {
|
||||
// Set after k->java_mirror() is published, because compiled code running
|
||||
@ -1394,7 +1394,7 @@ bool java_lang_Class::restore_archived_mirror(Klass *k,
|
||||
|
||||
k->set_java_mirror(mirror);
|
||||
|
||||
set_mirror_module_field(k, mirror, module, THREAD);
|
||||
set_mirror_module_field(THREAD->as_Java_thread(), k, mirror, module);
|
||||
|
||||
if (log_is_enabled(Trace, cds, heap, mirror)) {
|
||||
ResourceMark rm(THREAD);
|
||||
@ -2881,7 +2881,7 @@ void java_lang_StackFrameInfo::set_method_and_bci(Handle stackFrame, const metho
|
||||
Handle mname(THREAD, stackFrame->obj_field(_memberName_offset));
|
||||
InstanceKlass* ik = method->method_holder();
|
||||
CallInfo info(method(), ik, CHECK);
|
||||
MethodHandles::init_method_MemberName(mname, info, THREAD);
|
||||
MethodHandles::init_method_MemberName(mname, info);
|
||||
// set bci
|
||||
java_lang_StackFrameInfo::set_bci(stackFrame(), bci);
|
||||
// method may be redefined; store the version
|
||||
|
@ -261,7 +261,7 @@ class java_lang_Class : AllStatic {
|
||||
static void set_component_mirror(oop java_class, oop comp_mirror);
|
||||
static void initialize_mirror_fields(Klass* k, Handle mirror, Handle protection_domain,
|
||||
Handle classData, TRAPS);
|
||||
static void set_mirror_module_field(Klass* K, Handle mirror, Handle module, TRAPS);
|
||||
static void set_mirror_module_field(JavaThread* current, Klass* K, Handle mirror, Handle module);
|
||||
public:
|
||||
static void allocate_fixup_lists();
|
||||
static void compute_offsets();
|
||||
|
@ -1214,11 +1214,11 @@ InstanceKlass* SystemDictionary::load_shared_class(InstanceKlass* ik,
|
||||
ik->restore_unshareable_info(loader_data, protection_domain, pkg_entry, CHECK_NULL);
|
||||
}
|
||||
|
||||
load_shared_class_misc(ik, loader_data, CHECK_NULL);
|
||||
load_shared_class_misc(ik, loader_data);
|
||||
return ik;
|
||||
}
|
||||
|
||||
void SystemDictionary::load_shared_class_misc(InstanceKlass* ik, ClassLoaderData* loader_data, TRAPS) {
|
||||
void SystemDictionary::load_shared_class_misc(InstanceKlass* ik, ClassLoaderData* loader_data) {
|
||||
ik->print_class_load_logging(loader_data, NULL, NULL);
|
||||
|
||||
// For boot loader, ensure that GetSystemPackage knows that a class in this
|
||||
@ -1240,7 +1240,7 @@ void SystemDictionary::load_shared_class_misc(InstanceKlass* ik, ClassLoaderData
|
||||
ik->set_has_passed_fingerprint_check(true);
|
||||
} else {
|
||||
if (log_is_enabled(Info, class, fingerprint)) {
|
||||
ResourceMark rm(THREAD);
|
||||
ResourceMark rm;
|
||||
log_info(class, fingerprint)("%s : expected = " PTR64_FORMAT " actual = " PTR64_FORMAT, ik->external_name(), aot_fp, cds_fp);
|
||||
}
|
||||
}
|
||||
|
@ -366,7 +366,7 @@ private:
|
||||
static bool check_shared_class_super_types(InstanceKlass* ik, Handle class_loader,
|
||||
Handle protection_domain, TRAPS);
|
||||
// Second part of load_shared_class
|
||||
static void load_shared_class_misc(InstanceKlass* ik, ClassLoaderData* loader_data, TRAPS) NOT_CDS_RETURN;
|
||||
static void load_shared_class_misc(InstanceKlass* ik, ClassLoaderData* loader_data) NOT_CDS_RETURN;
|
||||
protected:
|
||||
// Used by SystemDictionaryShared
|
||||
|
||||
|
@ -239,7 +239,7 @@ void vmClasses::resolve_shared_class(InstanceKlass* klass, ClassLoaderData* load
|
||||
}
|
||||
|
||||
klass->restore_unshareable_info(loader_data, domain, NULL, THREAD);
|
||||
SystemDictionary::load_shared_class_misc(klass, loader_data, CHECK);
|
||||
SystemDictionary::load_shared_class_misc(klass, loader_data);
|
||||
Dictionary* dictionary = loader_data->dictionary();
|
||||
unsigned int hash = dictionary->compute_hash(klass->name());
|
||||
dictionary->add_klass(hash, klass->name(), klass);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2021, 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
|
||||
@ -76,7 +76,7 @@ static const char* vm_symbol_enum_name(vmSymbolID sid) {
|
||||
#define VM_SYMBOL_BODY(name, string) string "\0"
|
||||
static const char* vm_symbol_bodies = VM_SYMBOLS_DO(VM_SYMBOL_BODY, VM_ALIAS_IGNORE);
|
||||
|
||||
void vmSymbols::initialize(TRAPS) {
|
||||
void vmSymbols::initialize() {
|
||||
assert(SID_LIMIT <= (1<<log2_SID_LIMIT), "must fit in this bitfield");
|
||||
assert(SID_LIMIT*5 > (1<<log2_SID_LIMIT), "make the bitfield smaller, please");
|
||||
assert(vmIntrinsics::FLAG_LIMIT <= (1 << vmIntrinsics::log2_FLAG_LIMIT), "must fit in this bitfield");
|
||||
|
@ -769,7 +769,7 @@ class vmSymbols: AllStatic {
|
||||
|
||||
public:
|
||||
// Initialization
|
||||
static void initialize(TRAPS);
|
||||
static void initialize();
|
||||
// Accessing
|
||||
#define VM_SYMBOL_DECLARE(name, ignore) \
|
||||
static Symbol* name() { \
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2021, 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
|
||||
@ -157,15 +157,6 @@ Method* Bytecode_invoke::static_target(TRAPS) {
|
||||
return LinkResolver::resolve_method_statically(bc, constants, index(), THREAD);
|
||||
}
|
||||
|
||||
Handle Bytecode_invoke::appendix(TRAPS) {
|
||||
ConstantPoolCacheEntry* cpce = cpcache_entry();
|
||||
if (cpce->has_appendix()) {
|
||||
constantPoolHandle cp(THREAD, constants());
|
||||
return Handle(THREAD, cpce->appendix_if_resolved(cp));
|
||||
}
|
||||
return Handle(); // usual case
|
||||
}
|
||||
|
||||
int Bytecode_member_ref::index() const {
|
||||
// Note: Rewriter::rewrite changes the Java_u2 of an invokedynamic to a native_u4,
|
||||
// at the same time it allocates per-call-site CP cache entries.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2021, 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
|
||||
@ -210,7 +210,6 @@ class Bytecode_invoke: public Bytecode_member_ref {
|
||||
|
||||
// Attributes
|
||||
Method* static_target(TRAPS); // "specified" method (from constant pool)
|
||||
Handle appendix(TRAPS); // if CPCE::has_appendix (from constant pool)
|
||||
|
||||
// Testers
|
||||
bool is_invokeinterface() const { return invoke_code() == Bytecodes::_invokeinterface; }
|
||||
|
@ -462,7 +462,7 @@ Method* LinkResolver::lookup_polymorphic_method(const LinkInfo& link_info,
|
||||
// Do not erase last argument type (MemberName) if it is a static linkTo method.
|
||||
bool keep_last_arg = MethodHandles::is_signature_polymorphic_static(iid);
|
||||
TempNewSymbol basic_signature =
|
||||
MethodHandles::lookup_basic_type_signature(full_signature, keep_last_arg, CHECK_NULL);
|
||||
MethodHandles::lookup_basic_type_signature(full_signature, keep_last_arg);
|
||||
log_info(methodhandles)("lookup_polymorphic_method %s %s => basic %s",
|
||||
name->as_C_string(),
|
||||
full_signature->as_C_string(),
|
||||
@ -519,7 +519,7 @@ Method* LinkResolver::lookup_polymorphic_method(const LinkInfo& link_info,
|
||||
ResourceMark rm(THREAD);
|
||||
|
||||
TempNewSymbol basic_signature =
|
||||
MethodHandles::lookup_basic_type_signature(full_signature, CHECK_NULL);
|
||||
MethodHandles::lookup_basic_type_signature(full_signature);
|
||||
int actual_size_of_params = result->size_of_parameters();
|
||||
int expected_size_of_params = ArgumentSizeComputer(basic_signature).size();
|
||||
// +1 for MethodHandle.this, +1 for trailing MethodType
|
||||
|
@ -329,7 +329,7 @@ void Universe::genesis(TRAPS) {
|
||||
}
|
||||
}
|
||||
|
||||
vmSymbols::initialize(CHECK);
|
||||
vmSymbols::initialize();
|
||||
|
||||
SystemDictionary::initialize(CHECK);
|
||||
|
||||
|
@ -1078,7 +1078,7 @@ static jmethodID get_method_id(JNIEnv *env, jclass clazz, const char *name_str,
|
||||
// Throw a NoSuchMethodError exception if we have an instance of a
|
||||
// primitive java.lang.Class
|
||||
if (java_lang_Class::is_primitive(mirror)) {
|
||||
ResourceMark rm;
|
||||
ResourceMark rm(THREAD);
|
||||
THROW_MSG_0(vmSymbols::java_lang_NoSuchMethodError(), err_msg("%s%s.%s%s", is_static ? "static " : "", klass->signature_name(), name_str, sig));
|
||||
}
|
||||
|
||||
@ -1102,7 +1102,7 @@ static jmethodID get_method_id(JNIEnv *env, jclass clazz, const char *name_str,
|
||||
}
|
||||
}
|
||||
if (m == NULL || (m->is_static() != is_static)) {
|
||||
ResourceMark rm;
|
||||
ResourceMark rm(THREAD);
|
||||
THROW_MSG_0(vmSymbols::java_lang_NoSuchMethodError(), err_msg("%s%s.%s%s", is_static ? "static " : "", klass->signature_name(), name_str, sig));
|
||||
}
|
||||
return m->jmethod_id();
|
||||
|
@ -1502,7 +1502,7 @@ JVM_ENTRY(jbyteArray, JVM_GetClassAnnotations(JNIEnv *env, jclass cls))
|
||||
JVM_END
|
||||
|
||||
|
||||
static bool jvm_get_field_common(jobject field, fieldDescriptor& fd, TRAPS) {
|
||||
static bool jvm_get_field_common(jobject field, fieldDescriptor& fd) {
|
||||
// some of this code was adapted from from jni_FromReflectedField
|
||||
|
||||
oop reflected = JNIHandles::resolve_non_null(field);
|
||||
@ -1593,7 +1593,7 @@ JVM_END
|
||||
JVM_ENTRY(jbyteArray, JVM_GetFieldTypeAnnotations(JNIEnv *env, jobject field))
|
||||
assert (field != NULL, "illegal field");
|
||||
fieldDescriptor fd;
|
||||
bool gotFd = jvm_get_field_common(field, fd, CHECK_NULL);
|
||||
bool gotFd = jvm_get_field_common(field, fd);
|
||||
if (!gotFd) {
|
||||
return NULL;
|
||||
}
|
||||
|
@ -214,7 +214,7 @@ oop MethodHandles::init_MemberName(Handle mname, Handle target, TRAPS) {
|
||||
if (m == NULL || is_signature_polymorphic(m->intrinsic_id()))
|
||||
return NULL; // do not resolve unless there is a concrete signature
|
||||
CallInfo info(m, k, CHECK_NULL);
|
||||
return init_method_MemberName(mname, info, THREAD);
|
||||
return init_method_MemberName(mname, info);
|
||||
}
|
||||
} else if (target_klass == vmClasses::reflect_Constructor_klass()) {
|
||||
oop clazz = java_lang_reflect_Constructor::clazz(target_oop);
|
||||
@ -224,13 +224,13 @@ oop MethodHandles::init_MemberName(Handle mname, Handle target, TRAPS) {
|
||||
Method* m = InstanceKlass::cast(k)->method_with_idnum(slot);
|
||||
if (m == NULL) return NULL;
|
||||
CallInfo info(m, k, CHECK_NULL);
|
||||
return init_method_MemberName(mname, info, THREAD);
|
||||
return init_method_MemberName(mname, info);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
oop MethodHandles::init_method_MemberName(Handle mname, CallInfo& info, TRAPS) {
|
||||
oop MethodHandles::init_method_MemberName(Handle mname, CallInfo& info) {
|
||||
assert(info.resolved_appendix().is_null(), "only normal methods here");
|
||||
methodHandle m(Thread::current(), info.resolved_method());
|
||||
assert(m.not_null(), "null method handle");
|
||||
@ -574,7 +574,7 @@ bool MethodHandles::is_basic_type_signature(Symbol* sig) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Symbol* MethodHandles::lookup_basic_type_signature(Symbol* sig, bool keep_last_arg, TRAPS) {
|
||||
Symbol* MethodHandles::lookup_basic_type_signature(Symbol* sig, bool keep_last_arg) {
|
||||
Symbol* bsig = NULL;
|
||||
if (sig == NULL) {
|
||||
return sig;
|
||||
@ -801,7 +801,7 @@ Handle MethodHandles::resolve_MemberName(Handle mname, Klass* caller, int lookup
|
||||
THROW_MSG_(vmSymbols::java_lang_InternalError(), "appendix", empty);
|
||||
}
|
||||
result.set_resolved_method_name(CHECK_(empty));
|
||||
oop mname2 = init_method_MemberName(mname, result, THREAD);
|
||||
oop mname2 = init_method_MemberName(mname, result);
|
||||
return Handle(THREAD, mname2);
|
||||
}
|
||||
case IS_CONSTRUCTOR:
|
||||
@ -824,7 +824,7 @@ Handle MethodHandles::resolve_MemberName(Handle mname, Klass* caller, int lookup
|
||||
}
|
||||
assert(result.is_statically_bound(), "");
|
||||
result.set_resolved_method_name(CHECK_(empty));
|
||||
oop mname2 = init_method_MemberName(mname, result, THREAD);
|
||||
oop mname2 = init_method_MemberName(mname, result);
|
||||
return Handle(THREAD, mname2);
|
||||
}
|
||||
case IS_FIELD:
|
||||
@ -1025,7 +1025,7 @@ int MethodHandles::find_MemberNames(Klass* k,
|
||||
if (!java_lang_invoke_MemberName::is_instance(result()))
|
||||
return -99; // caller bug!
|
||||
CallInfo info(m, NULL, CHECK_0);
|
||||
oop saved = MethodHandles::init_method_MemberName(result, info, THREAD);
|
||||
oop saved = MethodHandles::init_method_MemberName(result, info);
|
||||
if (saved != result())
|
||||
results->obj_at_put(rfill-1, saved); // show saved instance to user
|
||||
} else if (++overflow >= overflow_limit) {
|
||||
|
@ -69,7 +69,7 @@ class MethodHandles: AllStatic {
|
||||
static void expand_MemberName(Handle mname, int suppress, TRAPS); // expand defc/name/type if missing
|
||||
static oop init_MemberName(Handle mname_h, Handle target_h, TRAPS); // compute vmtarget/vmindex from target
|
||||
static oop init_field_MemberName(Handle mname_h, fieldDescriptor& fd, bool is_setter = false);
|
||||
static oop init_method_MemberName(Handle mname_h, CallInfo& info, TRAPS);
|
||||
static oop init_method_MemberName(Handle mname_h, CallInfo& info);
|
||||
static int find_MemberNames(Klass* k, Symbol* name, Symbol* sig,
|
||||
int mflags, Klass* caller,
|
||||
int skip, objArrayHandle results, TRAPS);
|
||||
@ -152,9 +152,9 @@ class MethodHandles: AllStatic {
|
||||
|
||||
public:
|
||||
static Symbol* lookup_signature(oop type_str, bool polymorphic, TRAPS); // use TempNewSymbol
|
||||
static Symbol* lookup_basic_type_signature(Symbol* sig, bool keep_last_arg, TRAPS); // use TempNewSymbol
|
||||
static Symbol* lookup_basic_type_signature(Symbol* sig, TRAPS) {
|
||||
return lookup_basic_type_signature(sig, false, THREAD);
|
||||
static Symbol* lookup_basic_type_signature(Symbol* sig, bool keep_last_arg); // use TempNewSymbol
|
||||
static Symbol* lookup_basic_type_signature(Symbol* sig) {
|
||||
return lookup_basic_type_signature(sig, false);
|
||||
}
|
||||
static bool is_basic_type_signature(Symbol* sig);
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 2021, 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
|
||||
@ -115,7 +115,7 @@ PERF_ENTRY(void, Perf_Detach(JNIEnv *env, jobject unused, jobject buffer))
|
||||
capacity = env->GetDirectBufferCapacity(buffer);
|
||||
}
|
||||
|
||||
PerfMemory::detach((char*)address, capacity, CHECK);
|
||||
PerfMemory::detach((char*)address, capacity);
|
||||
|
||||
PERF_END
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2021, 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
|
||||
@ -729,9 +729,7 @@ void BiasedLocking::walk_stack_and_revoke(oop obj, JavaThread* biased_locker) {
|
||||
assert(!obj->mark().has_bias_pattern(), "must not be biased");
|
||||
}
|
||||
|
||||
void BiasedLocking::revoke_own_lock(Handle obj, TRAPS) {
|
||||
JavaThread* thread = THREAD->as_Java_thread();
|
||||
|
||||
void BiasedLocking::revoke_own_lock(JavaThread* current, Handle obj) {
|
||||
markWord mark = obj->mark();
|
||||
|
||||
if (!mark.has_bias_pattern()) {
|
||||
@ -739,20 +737,20 @@ void BiasedLocking::revoke_own_lock(Handle obj, TRAPS) {
|
||||
}
|
||||
|
||||
Klass *k = obj->klass();
|
||||
assert(mark.biased_locker() == thread &&
|
||||
assert(mark.biased_locker() == current &&
|
||||
k->prototype_header().bias_epoch() == mark.bias_epoch(), "Revoke failed, unhandled biased lock state");
|
||||
ResourceMark rm;
|
||||
ResourceMark rm(current);
|
||||
log_info(biasedlocking)("Revoking bias by walking my own stack:");
|
||||
EventBiasedLockSelfRevocation event;
|
||||
BiasedLocking::walk_stack_and_revoke(obj(), thread);
|
||||
thread->set_cached_monitor_info(NULL);
|
||||
BiasedLocking::walk_stack_and_revoke(obj(), current);
|
||||
current->set_cached_monitor_info(NULL);
|
||||
assert(!obj->mark().has_bias_pattern(), "invariant");
|
||||
if (event.should_commit()) {
|
||||
post_self_revocation_event(&event, k);
|
||||
}
|
||||
}
|
||||
|
||||
void BiasedLocking::revoke(Handle obj, TRAPS) {
|
||||
void BiasedLocking::revoke(JavaThread* current, Handle obj) {
|
||||
assert(!SafepointSynchronize::is_at_safepoint(), "must not be called while at safepoint");
|
||||
|
||||
while (true) {
|
||||
@ -817,7 +815,7 @@ void BiasedLocking::revoke(Handle obj, TRAPS) {
|
||||
} else if (heuristics == HR_SINGLE_REVOKE) {
|
||||
JavaThread *blt = mark.biased_locker();
|
||||
assert(blt != NULL, "invariant");
|
||||
if (blt == THREAD) {
|
||||
if (blt == current) {
|
||||
// A thread is trying to revoke the bias of an object biased
|
||||
// toward it, again likely due to an identity hash code
|
||||
// computation. We can again avoid a safepoint/handshake in this case
|
||||
@ -825,7 +823,7 @@ void BiasedLocking::revoke(Handle obj, TRAPS) {
|
||||
// races with revocations occurring in other threads because we
|
||||
// reach no safepoints in the revocation path.
|
||||
EventBiasedLockSelfRevocation event;
|
||||
ResourceMark rm;
|
||||
ResourceMark rm(current);
|
||||
walk_stack_and_revoke(obj(), blt);
|
||||
blt->set_cached_monitor_info(NULL);
|
||||
assert(!obj->mark().has_bias_pattern(), "invariant");
|
||||
@ -834,7 +832,7 @@ void BiasedLocking::revoke(Handle obj, TRAPS) {
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
BiasedLocking::Condition cond = single_revoke_with_handshake(obj, THREAD->as_Java_thread(), blt);
|
||||
BiasedLocking::Condition cond = single_revoke_with_handshake(obj, current, blt);
|
||||
if (cond != NOT_REVOKED) {
|
||||
return;
|
||||
}
|
||||
@ -843,8 +841,7 @@ void BiasedLocking::revoke(Handle obj, TRAPS) {
|
||||
assert((heuristics == HR_BULK_REVOKE) ||
|
||||
(heuristics == HR_BULK_REBIAS), "?");
|
||||
EventBiasedLockClassRevocation event;
|
||||
VM_BulkRevokeBias bulk_revoke(&obj, THREAD->as_Java_thread(),
|
||||
(heuristics == HR_BULK_REBIAS));
|
||||
VM_BulkRevokeBias bulk_revoke(&obj, current, (heuristics == HR_BULK_REBIAS));
|
||||
VMThread::execute(&bulk_revoke);
|
||||
if (event.should_commit()) {
|
||||
post_class_revocation_event(&event, obj->klass(), &bulk_revoke);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2021, 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
|
||||
@ -188,10 +188,10 @@ public:
|
||||
static bool enabled();
|
||||
|
||||
// This should be called by JavaThreads to revoke the bias of an object
|
||||
static void revoke(Handle obj, TRAPS);
|
||||
static void revoke(JavaThread* current, Handle obj);
|
||||
|
||||
// This must only be called by a JavaThread to revoke the bias of an owned object.
|
||||
static void revoke_own_lock(Handle obj, TRAPS);
|
||||
static void revoke_own_lock(JavaThread* current, Handle obj);
|
||||
|
||||
static void revoke_at_safepoint(Handle obj);
|
||||
|
||||
|
@ -1653,7 +1653,7 @@ void Deoptimization::revoke_from_deopt_handler(JavaThread* thread, frame fr, Reg
|
||||
int len = objects_to_revoke->length();
|
||||
for (int i = 0; i < len; i++) {
|
||||
oop obj = (objects_to_revoke->at(i))();
|
||||
BiasedLocking::revoke_own_lock(objects_to_revoke->at(i), thread);
|
||||
BiasedLocking::revoke_own_lock(thread, objects_to_revoke->at(i));
|
||||
assert(!obj->mark().has_bias_pattern(), "biases should be revoked by now");
|
||||
}
|
||||
}
|
||||
@ -1686,7 +1686,7 @@ void Deoptimization::revoke_for_object_deoptimization(JavaThread* deoptee_thread
|
||||
// Deoptimization::relock_objects().
|
||||
continue;
|
||||
}
|
||||
BiasedLocking::revoke(objects_to_revoke->at(i), thread);
|
||||
BiasedLocking::revoke(thread, objects_to_revoke->at(i));
|
||||
assert(!objects_to_revoke->at(i)->mark().has_bias_pattern(), "biases should be revoked by now");
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 2021, 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
|
||||
@ -150,7 +150,7 @@ class PerfMemory : AllStatic {
|
||||
// memory segment of another JVM process on the same system.
|
||||
static void attach(const char* user, int vmid, PerfMemoryMode mode,
|
||||
char** addrp, size_t* size, TRAPS);
|
||||
static void detach(char* addr, size_t bytes, TRAPS);
|
||||
static void detach(char* addr, size_t bytes);
|
||||
|
||||
static void initialize();
|
||||
static void destroy();
|
||||
|
@ -951,7 +951,7 @@ static methodHandle resolve_interface_call(InstanceKlass* klass,
|
||||
}
|
||||
|
||||
// Conversion
|
||||
static BasicType basic_type_mirror_to_basic_type(oop basic_type_mirror, TRAPS) {
|
||||
static BasicType basic_type_mirror_to_basic_type(oop basic_type_mirror) {
|
||||
assert(java_lang_Class::is_primitive(basic_type_mirror),
|
||||
"just checking");
|
||||
return java_lang_Class::primitive_type(basic_type_mirror);
|
||||
@ -1103,7 +1103,7 @@ static oop invoke(InstanceKlass* klass,
|
||||
oop arg = args->obj_at(i);
|
||||
if (java_lang_Class::is_primitive(type_mirror)) {
|
||||
jvalue value;
|
||||
BasicType ptype = basic_type_mirror_to_basic_type(type_mirror, CHECK_NULL);
|
||||
BasicType ptype = basic_type_mirror_to_basic_type(type_mirror);
|
||||
BasicType atype = Reflection::unbox_for_primitive(arg, &value, CHECK_NULL);
|
||||
if (ptype != atype) {
|
||||
Reflection::widen(&value, atype, ptype, CHECK_NULL);
|
||||
@ -1175,7 +1175,7 @@ oop Reflection::invoke_method(oop method_mirror, Handle receiver, objArrayHandle
|
||||
oop return_type_mirror = java_lang_reflect_Method::return_type(method_mirror);
|
||||
BasicType rtype;
|
||||
if (java_lang_Class::is_primitive(return_type_mirror)) {
|
||||
rtype = basic_type_mirror_to_basic_type(return_type_mirror, CHECK_NULL);
|
||||
rtype = basic_type_mirror_to_basic_type(return_type_mirror);
|
||||
} else {
|
||||
rtype = T_OBJECT;
|
||||
}
|
||||
|
@ -456,10 +456,11 @@ ResolvingSignatureStream::ResolvingSignatureStream(fieldDescriptor& field)
|
||||
initialize_load_origin(field.field_holder());
|
||||
}
|
||||
|
||||
void ResolvingSignatureStream::cache_handles(TRAPS) {
|
||||
void ResolvingSignatureStream::cache_handles() {
|
||||
assert(_load_origin != NULL, "");
|
||||
_class_loader = Handle(THREAD, _load_origin->class_loader());
|
||||
_protection_domain = Handle(THREAD, _load_origin->protection_domain());
|
||||
JavaThread* current = JavaThread::current();
|
||||
_class_loader = Handle(current, _load_origin->class_loader());
|
||||
_protection_domain = Handle(current, _load_origin->protection_domain());
|
||||
}
|
||||
|
||||
Klass* ResolvingSignatureStream::as_klass_if_loaded(TRAPS) {
|
||||
|
@ -579,13 +579,13 @@ class ResolvingSignatureStream : public SignatureStream {
|
||||
_load_origin = load_origin;
|
||||
_handles_cached = (load_origin == NULL);
|
||||
}
|
||||
void need_handles(TRAPS) {
|
||||
void need_handles() {
|
||||
if (!_handles_cached) {
|
||||
cache_handles(THREAD);
|
||||
cache_handles();
|
||||
_handles_cached = true;
|
||||
}
|
||||
}
|
||||
void cache_handles(TRAPS);
|
||||
void cache_handles();
|
||||
|
||||
public:
|
||||
ResolvingSignatureStream(Symbol* signature, Klass* load_origin, bool is_method = true);
|
||||
@ -593,19 +593,19 @@ class ResolvingSignatureStream : public SignatureStream {
|
||||
ResolvingSignatureStream(const Method* method);
|
||||
ResolvingSignatureStream(fieldDescriptor& field);
|
||||
|
||||
Klass* load_origin() { return _load_origin; }
|
||||
Handle class_loader(TRAPS) { need_handles(THREAD); return _class_loader; }
|
||||
Handle protection_domain(TRAPS) { need_handles(THREAD); return _protection_domain; }
|
||||
Klass* load_origin() { return _load_origin; }
|
||||
Handle class_loader() { need_handles(); return _class_loader; }
|
||||
Handle protection_domain() { need_handles(); return _protection_domain; }
|
||||
|
||||
Klass* as_klass_if_loaded(TRAPS);
|
||||
Klass* as_klass(FailureMode failure_mode, TRAPS) {
|
||||
need_handles(THREAD);
|
||||
need_handles();
|
||||
return SignatureStream::as_klass(_class_loader, _protection_domain,
|
||||
failure_mode, THREAD);
|
||||
}
|
||||
oop as_java_mirror(FailureMode failure_mode, TRAPS) {
|
||||
if (is_reference()) {
|
||||
need_handles(THREAD);
|
||||
need_handles();
|
||||
}
|
||||
return SignatureStream::as_java_mirror(_class_loader, _protection_domain,
|
||||
failure_mode, THREAD);
|
||||
|
@ -431,7 +431,7 @@ void ObjectSynchronizer::enter(Handle obj, BasicLock* lock, JavaThread* current)
|
||||
}
|
||||
|
||||
if (UseBiasedLocking) {
|
||||
BiasedLocking::revoke(obj, current);
|
||||
BiasedLocking::revoke(current, obj);
|
||||
}
|
||||
|
||||
markWord mark = obj->mark();
|
||||
@ -535,7 +535,7 @@ void ObjectSynchronizer::exit(oop object, BasicLock* lock, JavaThread* current)
|
||||
// NOTE: must use heavy weight monitor to handle complete_exit/reenter()
|
||||
intx ObjectSynchronizer::complete_exit(Handle obj, JavaThread* current) {
|
||||
if (UseBiasedLocking) {
|
||||
BiasedLocking::revoke(obj, current);
|
||||
BiasedLocking::revoke(current, obj);
|
||||
assert(!obj->mark().has_bias_pattern(), "biases should be revoked by now");
|
||||
}
|
||||
|
||||
@ -549,7 +549,7 @@ intx ObjectSynchronizer::complete_exit(Handle obj, JavaThread* current) {
|
||||
// NOTE: must use heavy weight monitor to handle complete_exit/reenter()
|
||||
void ObjectSynchronizer::reenter(Handle obj, intx recursions, JavaThread* current) {
|
||||
if (UseBiasedLocking) {
|
||||
BiasedLocking::revoke(obj, current);
|
||||
BiasedLocking::revoke(current, obj);
|
||||
assert(!obj->mark().has_bias_pattern(), "biases should be revoked by now");
|
||||
}
|
||||
|
||||
@ -575,7 +575,7 @@ void ObjectSynchronizer::jni_enter(Handle obj, JavaThread* current) {
|
||||
|
||||
// the current locking is from JNI instead of Java code
|
||||
if (UseBiasedLocking) {
|
||||
BiasedLocking::revoke(obj, current);
|
||||
BiasedLocking::revoke(current, obj);
|
||||
assert(!obj->mark().has_bias_pattern(), "biases should be revoked by now");
|
||||
}
|
||||
current->set_current_pending_monitor_is_from_java(false);
|
||||
@ -596,7 +596,7 @@ void ObjectSynchronizer::jni_exit(oop obj, TRAPS) {
|
||||
JavaThread* current = THREAD->as_Java_thread();
|
||||
if (UseBiasedLocking) {
|
||||
Handle h_obj(current, obj);
|
||||
BiasedLocking::revoke(h_obj, current);
|
||||
BiasedLocking::revoke(current, h_obj);
|
||||
obj = h_obj();
|
||||
}
|
||||
assert(!obj->mark().has_bias_pattern(), "biases should be revoked by now");
|
||||
@ -638,7 +638,7 @@ ObjectLocker::~ObjectLocker() {
|
||||
int ObjectSynchronizer::wait(Handle obj, jlong millis, TRAPS) {
|
||||
JavaThread* current = THREAD->as_Java_thread();
|
||||
if (UseBiasedLocking) {
|
||||
BiasedLocking::revoke(obj, current);
|
||||
BiasedLocking::revoke(current, obj);
|
||||
assert(!obj->mark().has_bias_pattern(), "biases should be revoked by now");
|
||||
}
|
||||
if (millis < 0) {
|
||||
@ -664,7 +664,7 @@ int ObjectSynchronizer::wait(Handle obj, jlong millis, TRAPS) {
|
||||
// correct and we have to wait until notified - so no interrupts or timeouts.
|
||||
void ObjectSynchronizer::wait_uninterruptibly(Handle obj, JavaThread* current) {
|
||||
if (UseBiasedLocking) {
|
||||
BiasedLocking::revoke(obj, current);
|
||||
BiasedLocking::revoke(current, obj);
|
||||
assert(!obj->mark().has_bias_pattern(), "biases should be revoked by now");
|
||||
}
|
||||
// The ObjectMonitor* can't be async deflated because the _waiters
|
||||
@ -677,7 +677,7 @@ void ObjectSynchronizer::wait_uninterruptibly(Handle obj, JavaThread* current) {
|
||||
void ObjectSynchronizer::notify(Handle obj, TRAPS) {
|
||||
JavaThread* current = THREAD->as_Java_thread();
|
||||
if (UseBiasedLocking) {
|
||||
BiasedLocking::revoke(obj, current);
|
||||
BiasedLocking::revoke(current, obj);
|
||||
assert(!obj->mark().has_bias_pattern(), "biases should be revoked by now");
|
||||
}
|
||||
|
||||
@ -696,7 +696,7 @@ void ObjectSynchronizer::notify(Handle obj, TRAPS) {
|
||||
void ObjectSynchronizer::notifyall(Handle obj, TRAPS) {
|
||||
JavaThread* current = THREAD->as_Java_thread();
|
||||
if (UseBiasedLocking) {
|
||||
BiasedLocking::revoke(obj, current);
|
||||
BiasedLocking::revoke(current, obj);
|
||||
assert(!obj->mark().has_bias_pattern(), "biases should be revoked by now");
|
||||
}
|
||||
|
||||
@ -858,7 +858,7 @@ intptr_t ObjectSynchronizer::FastHashCode(Thread* current, oop obj) {
|
||||
if (SafepointSynchronize::is_at_safepoint()) {
|
||||
BiasedLocking::revoke_at_safepoint(hobj);
|
||||
} else {
|
||||
BiasedLocking::revoke(hobj, current);
|
||||
BiasedLocking::revoke(current->as_Java_thread(), hobj);
|
||||
}
|
||||
obj = hobj();
|
||||
assert(!obj->mark().has_bias_pattern(), "biases should be revoked by now");
|
||||
@ -985,7 +985,7 @@ intptr_t ObjectSynchronizer::identity_hash_value_for(Handle obj) {
|
||||
bool ObjectSynchronizer::current_thread_holds_lock(JavaThread* current,
|
||||
Handle h_obj) {
|
||||
if (UseBiasedLocking) {
|
||||
BiasedLocking::revoke(h_obj, current);
|
||||
BiasedLocking::revoke(current, h_obj);
|
||||
assert(!h_obj->mark().has_bias_pattern(), "biases should be revoked by now");
|
||||
}
|
||||
|
||||
@ -1016,7 +1016,7 @@ JavaThread* ObjectSynchronizer::get_lock_owner(ThreadsList * t_list, Handle h_ob
|
||||
if (SafepointSynchronize::is_at_safepoint()) {
|
||||
BiasedLocking::revoke_at_safepoint(h_obj);
|
||||
} else {
|
||||
BiasedLocking::revoke(h_obj, JavaThread::current());
|
||||
BiasedLocking::revoke(JavaThread::current(), h_obj);
|
||||
}
|
||||
assert(!h_obj->mark().has_bias_pattern(), "biases should be revoked by now");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user