8210470: Remove unused Verifier::verify() Verifier::Mode argument

Remove the unused argument.

Reviewed-by: coleenp, jiangli
This commit is contained in:
Harold Seigel 2018-09-11 09:53:41 -04:00
parent edef78fbe1
commit 18bbeb53e6
5 changed files with 17 additions and 25 deletions

View file

@ -130,7 +130,7 @@ void Verifier::log_end_verification(outputStream* st, const char* klassName, Sym
st->print_cr("End class verification for: %s", klassName); st->print_cr("End class verification for: %s", klassName);
} }
bool Verifier::verify(InstanceKlass* klass, Verifier::Mode mode, bool should_verify_class, TRAPS) { bool Verifier::verify(InstanceKlass* klass, bool should_verify_class, TRAPS) {
HandleMark hm(THREAD); HandleMark hm(THREAD);
ResourceMark rm(THREAD); ResourceMark rm(THREAD);

View file

@ -42,16 +42,11 @@ class Verifier : AllStatic {
NO_RELAX_ACCESS_CTRL_CHECK_VERSION = 52, NO_RELAX_ACCESS_CTRL_CHECK_VERSION = 52,
DYNAMICCONSTANT_MAJOR_VERSION = 55 DYNAMICCONSTANT_MAJOR_VERSION = 55
}; };
typedef enum { ThrowException, NoException } Mode;
/** // Verify the bytecodes for a class.
* Verify the bytecodes for a class. If 'throw_exception' is true static bool verify(InstanceKlass* klass, bool should_verify_class, TRAPS);
* then the appropriate VerifyError or ClassFormatError will be thrown.
* Otherwise, no exception is thrown and the return indicates the
* error.
*/
static void log_end_verification(outputStream* st, const char* klassName, Symbol* exception_name, TRAPS); static void log_end_verification(outputStream* st, const char* klassName, Symbol* exception_name, TRAPS);
static bool verify(InstanceKlass* klass, Mode mode, bool should_verify_class, TRAPS);
// Return false if the class is loaded by the bootstrap loader, // Return false if the class is loaded by the bootstrap loader,
// or if defineClass was called requesting skipping verification // or if defineClass was called requesting skipping verification

View file

@ -643,7 +643,7 @@ void InstanceKlass::eager_initialize_impl() {
if (!is_not_initialized()) return; // note: not equivalent to is_initialized() if (!is_not_initialized()) return; // note: not equivalent to is_initialized()
ClassState old_state = init_state(); ClassState old_state = init_state();
link_class_impl(true, THREAD); link_class_impl(THREAD);
if (HAS_PENDING_EXCEPTION) { if (HAS_PENDING_EXCEPTION) {
CLEAR_PENDING_EXCEPTION; CLEAR_PENDING_EXCEPTION;
// Abort if linking the class throws an exception. // Abort if linking the class throws an exception.
@ -681,11 +681,9 @@ void InstanceKlass::initialize(TRAPS) {
} }
bool InstanceKlass::verify_code(bool throw_verifyerror, TRAPS) { bool InstanceKlass::verify_code(TRAPS) {
// 1) Verify the bytecodes // 1) Verify the bytecodes
Verifier::Mode mode = return Verifier::verify(this, should_verify_class(), THREAD);
throw_verifyerror ? Verifier::ThrowException : Verifier::NoException;
return Verifier::verify(this, mode, should_verify_class(), THREAD);
} }
@ -700,7 +698,7 @@ void InstanceKlass::unlink_class() {
void InstanceKlass::link_class(TRAPS) { void InstanceKlass::link_class(TRAPS) {
assert(is_loaded(), "must be loaded"); assert(is_loaded(), "must be loaded");
if (!is_linked()) { if (!is_linked()) {
link_class_impl(true, CHECK); link_class_impl(CHECK);
} }
} }
@ -709,12 +707,12 @@ void InstanceKlass::link_class(TRAPS) {
bool InstanceKlass::link_class_or_fail(TRAPS) { bool InstanceKlass::link_class_or_fail(TRAPS) {
assert(is_loaded(), "must be loaded"); assert(is_loaded(), "must be loaded");
if (!is_linked()) { if (!is_linked()) {
link_class_impl(false, CHECK_false); link_class_impl(CHECK_false);
} }
return is_linked(); return is_linked();
} }
bool InstanceKlass::link_class_impl(bool throw_verifyerror, TRAPS) { bool InstanceKlass::link_class_impl(TRAPS) {
if (DumpSharedSpaces && is_in_error_state()) { if (DumpSharedSpaces && is_in_error_state()) {
// This is for CDS dumping phase only -- we use the in_error_state to indicate that // This is for CDS dumping phase only -- we use the in_error_state to indicate that
// the class has failed verification. Throwing the NoClassDefFoundError here is just // the class has failed verification. Throwing the NoClassDefFoundError here is just
@ -756,7 +754,7 @@ bool InstanceKlass::link_class_impl(bool throw_verifyerror, TRAPS) {
} }
InstanceKlass* ik_super = InstanceKlass::cast(super_klass); InstanceKlass* ik_super = InstanceKlass::cast(super_klass);
ik_super->link_class_impl(throw_verifyerror, CHECK_false); ik_super->link_class_impl(CHECK_false);
} }
// link all interfaces implemented by this class before linking this class // link all interfaces implemented by this class before linking this class
@ -764,7 +762,7 @@ bool InstanceKlass::link_class_impl(bool throw_verifyerror, TRAPS) {
int num_interfaces = interfaces->length(); int num_interfaces = interfaces->length();
for (int index = 0; index < num_interfaces; index++) { for (int index = 0; index < num_interfaces; index++) {
InstanceKlass* interk = interfaces->at(index); InstanceKlass* interk = interfaces->at(index);
interk->link_class_impl(throw_verifyerror, CHECK_false); interk->link_class_impl(CHECK_false);
} }
// in case the class is linked in the process of linking its superclasses // in case the class is linked in the process of linking its superclasses
@ -794,7 +792,7 @@ bool InstanceKlass::link_class_impl(bool throw_verifyerror, TRAPS) {
if (!is_linked()) { if (!is_linked()) {
if (!is_rewritten()) { if (!is_rewritten()) {
{ {
bool verify_ok = verify_code(throw_verifyerror, THREAD); bool verify_ok = verify_code(THREAD);
if (!verify_ok) { if (!verify_ok) {
return false; return false;
} }

View file

@ -1285,8 +1285,8 @@ public:
private: private:
void fence_and_clear_init_lock(); void fence_and_clear_init_lock();
bool link_class_impl (bool throw_verifyerror, TRAPS); bool link_class_impl (TRAPS);
bool verify_code (bool throw_verifyerror, TRAPS); bool verify_code (TRAPS);
void initialize_impl (TRAPS); void initialize_impl (TRAPS);
void initialize_super_interfaces (TRAPS); void initialize_super_interfaces (TRAPS);
void eager_initialize_impl (); void eager_initialize_impl ();

View file

@ -1231,8 +1231,7 @@ jvmtiError VM_RedefineClasses::load_new_class_versions(TRAPS) {
// verifier. Please, refer to jvmtiThreadState.hpp for the detailed // verifier. Please, refer to jvmtiThreadState.hpp for the detailed
// description. // description.
RedefineVerifyMark rvm(the_class, scratch_class, state); RedefineVerifyMark rvm(the_class, scratch_class, state);
Verifier::verify( Verifier::verify(scratch_class, true, THREAD);
scratch_class, Verifier::ThrowException, true, THREAD);
} }
if (HAS_PENDING_EXCEPTION) { if (HAS_PENDING_EXCEPTION) {
@ -1263,7 +1262,7 @@ jvmtiError VM_RedefineClasses::load_new_class_versions(TRAPS) {
// verify what we have done during constant pool merging // verify what we have done during constant pool merging
{ {
RedefineVerifyMark rvm(the_class, scratch_class, state); RedefineVerifyMark rvm(the_class, scratch_class, state);
Verifier::verify(scratch_class, Verifier::ThrowException, true, THREAD); Verifier::verify(scratch_class, true, THREAD);
} }
if (HAS_PENDING_EXCEPTION) { if (HAS_PENDING_EXCEPTION) {