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

8264711: More runtime TRAPS cleanups #3345

Closed
wants to merge 4 commits into from
Closed
Changes from all commits
Commits
File filter
Filter file types
Jump to
Jump to file
Failed to load files.

Always

Just for now

@@ -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 @@ class SystemDictionary : AllStatic {
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) {

This comment has been minimized.

@dcubed-ojdk

dcubed-ojdk Apr 7, 2021
Member

You might want to mention the removal of this function in
the bug report so that it will show up in a JBS search.

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

ProTip! Use n and p to navigate between commits in a pull request.