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

8264142: Remove TRAPS/THREAD parameters for verifier related functions #3194

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

Always

Just for now

@@ -5632,8 +5632,8 @@ void ClassFileParser::update_class_name(Symbol* new_class_name) {
// For an unsafe anonymous class that is in the unnamed package, move it to its host class's
// package by prepending its host class's package name to its class name and setting
// its _class_name field.
void ClassFileParser::prepend_host_package_name(const InstanceKlass* unsafe_anonymous_host) {
ResourceMark rm;
void ClassFileParser::prepend_host_package_name(Thread* current, const InstanceKlass* unsafe_anonymous_host) {
ResourceMark rm(current);
assert(strrchr(_class_name->as_C_string(), JVM_SIGNATURE_SLASH) == NULL,
"Unsafe anonymous class should not be in a package");
TempNewSymbol host_pkg_name =
@@ -5669,7 +5669,7 @@ void ClassFileParser::fix_unsafe_anonymous_class_name(TRAPS) {
const jbyte* anon_last_slash = UTF8::strrchr((const jbyte*)_class_name->base(),
_class_name->utf8_length(), JVM_SIGNATURE_SLASH);
if (anon_last_slash == NULL) { // Unnamed package
prepend_host_package_name(_unsafe_anonymous_host);
prepend_host_package_name(THREAD, _unsafe_anonymous_host);
} else {
if (!_unsafe_anonymous_host->is_same_class_package(_unsafe_anonymous_host->class_loader(), _class_name)) {
ResourceMark rm(THREAD);
@@ -211,7 +211,7 @@ class ClassFileParser {
ConstantPool* cp,
TRAPS);

void prepend_host_package_name(const InstanceKlass* unsafe_anonymous_host);
void prepend_host_package_name(Thread* current, const InstanceKlass* unsafe_anonymous_host);
void fix_unsafe_anonymous_class_name(TRAPS);

void fill_instance_klass(InstanceKlass* ik, bool cf_changed_in_CFLH,
@@ -134,19 +134,19 @@ void Verifier::trace_class_resolution(Klass* resolve_class, InstanceKlass* verif
}

// Prints the end-verification message to the appropriate output.
void Verifier::log_end_verification(outputStream* st, const char* klassName, Symbol* exception_name) {
void Verifier::log_end_verification(outputStream* st, const char* klassName, Symbol* exception_name, oop pending_exception) {
Thread* THREAD = Thread::current();

This comment has been minimized.

@dholmes-ora

dholmes-ora Mar 26, 2021
Member

This is not needed.

This comment has been minimized.

@hseigel

hseigel Mar 26, 2021
Author Member

removed. Thanks for pointing that out.


This conversation was marked as resolved by hseigel

This comment has been minimized.

@coleenp

coleenp Mar 25, 2021

This one would be better if you passed THREAD->pending_exception() as an oop. Then you wouldn't have to have HAS_PENDING_EXCEPTION.

This comment has been minimized.

@coleenp

coleenp Mar 25, 2021

This is logging so I guess it doesn't really matter.

This comment has been minimized.

@hseigel

hseigel Mar 25, 2021
Author Member

Changed to passing it as an oop.

This comment has been minimized.

@coleenp

coleenp Mar 25, 2021

that looks good!

if (HAS_PENDING_EXCEPTION) {
if (pending_exception != NULL) {
st->print("Verification for %s has", klassName);
oop message = java_lang_Throwable::message(PENDING_EXCEPTION);

This comment has been minimized.

@dholmes-ora

dholmes-ora Mar 26, 2021
Member

This should be pending_exception

This comment has been minimized.

@hseigel

hseigel Mar 26, 2021
Author Member

fixed

if (message != NULL) {
char* ex_msg = java_lang_String::as_utf8_string(message);
st->print_cr(" exception pending '%s %s'",
PENDING_EXCEPTION->klass()->external_name(), ex_msg);
pending_exception->klass()->external_name(), ex_msg);
} else {
st->print_cr(" exception pending %s ",
PENDING_EXCEPTION->klass()->external_name());
pending_exception->klass()->external_name());
}
} else if (exception_name != NULL) {
st->print_cr("Verification for %s failed", klassName);
@@ -230,12 +230,12 @@ bool Verifier::verify(InstanceKlass* klass, bool should_verify_class, TRAPS) {
LogTarget(Info, class, init) lt1;
if (lt1.is_enabled()) {
LogStream ls(lt1);
log_end_verification(&ls, klass->external_name(), exception_name);
log_end_verification(&ls, klass->external_name(), exception_name, PENDING_EXCEPTION);
}
LogTarget(Info, verification) lt2;
if (lt2.is_enabled()) {
LogStream ls(lt2);
log_end_verification(&ls, klass->external_name(), exception_name);
log_end_verification(&ls, klass->external_name(), exception_name, PENDING_EXCEPTION);
}

if (HAS_PENDING_EXCEPTION) {
@@ -46,7 +46,8 @@ class Verifier : AllStatic {
// Verify the bytecodes for a class.
static bool verify(InstanceKlass* klass, bool should_verify_class, TRAPS);

static void log_end_verification(outputStream* st, const char* klassName, Symbol* exception_name);
static void log_end_verification(outputStream* st, const char* klassName, Symbol* exception_name,
oop pending_exception);

// Return false if the class is loaded by the bootstrap loader,
// or if defineClass was called requesting skipping verification
ProTip! Use n and p to navigate between commits in a pull request.