mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-25 13:54:38 +02:00
6830542: Performance: JVM_DefineClass already verified
Reviewed-by: kamg, phh
This commit is contained in:
parent
c04761e799
commit
488e99efd8
19 changed files with 103 additions and 34 deletions
|
@ -74,6 +74,7 @@ SUNWprivate_1.1 {
|
||||||
JVM_CurrentTimeMillis;
|
JVM_CurrentTimeMillis;
|
||||||
JVM_DefineClass;
|
JVM_DefineClass;
|
||||||
JVM_DefineClassWithSource;
|
JVM_DefineClassWithSource;
|
||||||
|
JVM_DefineClassWithSourceCond;
|
||||||
JVM_DesiredAssertionStatus;
|
JVM_DesiredAssertionStatus;
|
||||||
JVM_DisableCompiler;
|
JVM_DisableCompiler;
|
||||||
JVM_DoPrivileged;
|
JVM_DoPrivileged;
|
||||||
|
|
|
@ -74,6 +74,7 @@ SUNWprivate_1.1 {
|
||||||
JVM_CurrentTimeMillis;
|
JVM_CurrentTimeMillis;
|
||||||
JVM_DefineClass;
|
JVM_DefineClass;
|
||||||
JVM_DefineClassWithSource;
|
JVM_DefineClassWithSource;
|
||||||
|
JVM_DefineClassWithSourceCond;
|
||||||
JVM_DesiredAssertionStatus;
|
JVM_DesiredAssertionStatus;
|
||||||
JVM_DisableCompiler;
|
JVM_DisableCompiler;
|
||||||
JVM_DoPrivileged;
|
JVM_DoPrivileged;
|
||||||
|
|
|
@ -74,6 +74,7 @@ SUNWprivate_1.1 {
|
||||||
JVM_CurrentTimeMillis;
|
JVM_CurrentTimeMillis;
|
||||||
JVM_DefineClass;
|
JVM_DefineClass;
|
||||||
JVM_DefineClassWithSource;
|
JVM_DefineClassWithSource;
|
||||||
|
JVM_DefineClassWithSourceCond;
|
||||||
JVM_DesiredAssertionStatus;
|
JVM_DesiredAssertionStatus;
|
||||||
JVM_DisableCompiler;
|
JVM_DisableCompiler;
|
||||||
JVM_DoPrivileged;
|
JVM_DoPrivileged;
|
||||||
|
|
|
@ -2547,6 +2547,7 @@ instanceKlassHandle ClassFileParser::parseClassFile(symbolHandle name,
|
||||||
KlassHandle host_klass,
|
KlassHandle host_klass,
|
||||||
GrowableArray<Handle>* cp_patches,
|
GrowableArray<Handle>* cp_patches,
|
||||||
symbolHandle& parsed_name,
|
symbolHandle& parsed_name,
|
||||||
|
bool verify,
|
||||||
TRAPS) {
|
TRAPS) {
|
||||||
// So that JVMTI can cache class file in the state before retransformable agents
|
// So that JVMTI can cache class file in the state before retransformable agents
|
||||||
// have modified it
|
// have modified it
|
||||||
|
@ -2591,7 +2592,7 @@ instanceKlassHandle ClassFileParser::parseClassFile(symbolHandle name,
|
||||||
instanceKlassHandle nullHandle;
|
instanceKlassHandle nullHandle;
|
||||||
|
|
||||||
// Figure out whether we can skip format checking (matching classic VM behavior)
|
// Figure out whether we can skip format checking (matching classic VM behavior)
|
||||||
_need_verify = Verifier::should_verify_for(class_loader());
|
_need_verify = Verifier::should_verify_for(class_loader(), verify);
|
||||||
|
|
||||||
// Set the verify flag in stream
|
// Set the verify flag in stream
|
||||||
cfs->set_verify(_need_verify);
|
cfs->set_verify(_need_verify);
|
||||||
|
@ -3205,6 +3206,9 @@ instanceKlassHandle ClassFileParser::parseClassFile(symbolHandle name,
|
||||||
|
|
||||||
// Fill in information already parsed
|
// Fill in information already parsed
|
||||||
this_klass->set_access_flags(access_flags);
|
this_klass->set_access_flags(access_flags);
|
||||||
|
if (verify) {
|
||||||
|
this_klass->set_should_verify_class();
|
||||||
|
}
|
||||||
jint lh = Klass::instance_layout_helper(instance_size, false);
|
jint lh = Klass::instance_layout_helper(instance_size, false);
|
||||||
this_klass->set_layout_helper(lh);
|
this_klass->set_layout_helper(lh);
|
||||||
assert(this_klass->oop_is_instance(), "layout is correct");
|
assert(this_klass->oop_is_instance(), "layout is correct");
|
||||||
|
@ -3213,7 +3217,9 @@ instanceKlassHandle ClassFileParser::parseClassFile(symbolHandle name,
|
||||||
//this_klass->set_super(super_klass());
|
//this_klass->set_super(super_klass());
|
||||||
this_klass->set_class_loader(class_loader());
|
this_klass->set_class_loader(class_loader());
|
||||||
this_klass->set_nonstatic_field_size(nonstatic_field_size);
|
this_klass->set_nonstatic_field_size(nonstatic_field_size);
|
||||||
this_klass->set_has_nonstatic_fields(has_nonstatic_fields);
|
if (has_nonstatic_fields) {
|
||||||
|
this_klass->set_has_nonstatic_fields();
|
||||||
|
}
|
||||||
this_klass->set_static_oop_field_size(fac.static_oop_count);
|
this_klass->set_static_oop_field_size(fac.static_oop_count);
|
||||||
cp->set_pool_holder(this_klass());
|
cp->set_pool_holder(this_klass());
|
||||||
this_klass->set_constants(cp());
|
this_klass->set_constants(cp());
|
||||||
|
|
|
@ -257,9 +257,10 @@ class ClassFileParser VALUE_OBJ_CLASS_SPEC {
|
||||||
Handle class_loader,
|
Handle class_loader,
|
||||||
Handle protection_domain,
|
Handle protection_domain,
|
||||||
symbolHandle& parsed_name,
|
symbolHandle& parsed_name,
|
||||||
|
bool verify,
|
||||||
TRAPS) {
|
TRAPS) {
|
||||||
KlassHandle no_host_klass;
|
KlassHandle no_host_klass;
|
||||||
return parseClassFile(name, class_loader, protection_domain, no_host_klass, NULL, parsed_name, THREAD);
|
return parseClassFile(name, class_loader, protection_domain, no_host_klass, NULL, parsed_name, verify, THREAD);
|
||||||
}
|
}
|
||||||
instanceKlassHandle parseClassFile(symbolHandle name,
|
instanceKlassHandle parseClassFile(symbolHandle name,
|
||||||
Handle class_loader,
|
Handle class_loader,
|
||||||
|
@ -267,6 +268,7 @@ class ClassFileParser VALUE_OBJ_CLASS_SPEC {
|
||||||
KlassHandle host_klass,
|
KlassHandle host_klass,
|
||||||
GrowableArray<Handle>* cp_patches,
|
GrowableArray<Handle>* cp_patches,
|
||||||
symbolHandle& parsed_name,
|
symbolHandle& parsed_name,
|
||||||
|
bool verify,
|
||||||
TRAPS);
|
TRAPS);
|
||||||
|
|
||||||
// Verifier checks
|
// Verifier checks
|
||||||
|
|
|
@ -874,6 +874,7 @@ instanceKlassHandle ClassLoader::load_classfile(symbolHandle h_name, TRAPS) {
|
||||||
class_loader,
|
class_loader,
|
||||||
protection_domain,
|
protection_domain,
|
||||||
parsed_name,
|
parsed_name,
|
||||||
|
false,
|
||||||
CHECK_(h));
|
CHECK_(h));
|
||||||
|
|
||||||
// add to package table
|
// add to package table
|
||||||
|
|
|
@ -970,6 +970,7 @@ klassOop SystemDictionary::parse_stream(symbolHandle class_name,
|
||||||
host_klass,
|
host_klass,
|
||||||
cp_patches,
|
cp_patches,
|
||||||
parsed_name,
|
parsed_name,
|
||||||
|
true,
|
||||||
THREAD);
|
THREAD);
|
||||||
|
|
||||||
|
|
||||||
|
@ -1025,6 +1026,7 @@ klassOop SystemDictionary::resolve_from_stream(symbolHandle class_name,
|
||||||
Handle class_loader,
|
Handle class_loader,
|
||||||
Handle protection_domain,
|
Handle protection_domain,
|
||||||
ClassFileStream* st,
|
ClassFileStream* st,
|
||||||
|
bool verify,
|
||||||
TRAPS) {
|
TRAPS) {
|
||||||
|
|
||||||
// Classloaders that support parallelism, e.g. bootstrap classloader,
|
// Classloaders that support parallelism, e.g. bootstrap classloader,
|
||||||
|
@ -1055,6 +1057,7 @@ klassOop SystemDictionary::resolve_from_stream(symbolHandle class_name,
|
||||||
class_loader,
|
class_loader,
|
||||||
protection_domain,
|
protection_domain,
|
||||||
parsed_name,
|
parsed_name,
|
||||||
|
verify,
|
||||||
THREAD);
|
THREAD);
|
||||||
|
|
||||||
const char* pkg = "java/";
|
const char* pkg = "java/";
|
||||||
|
|
|
@ -259,7 +259,9 @@ public:
|
||||||
TRAPS);
|
TRAPS);
|
||||||
|
|
||||||
// Resolve from stream (called by jni_DefineClass and JVM_DefineClass)
|
// Resolve from stream (called by jni_DefineClass and JVM_DefineClass)
|
||||||
static klassOop resolve_from_stream(symbolHandle class_name, Handle class_loader, Handle protection_domain, ClassFileStream* st, TRAPS);
|
static klassOop resolve_from_stream(symbolHandle class_name, Handle class_loader,
|
||||||
|
Handle protection_domain,
|
||||||
|
ClassFileStream* st, bool verify, TRAPS);
|
||||||
|
|
||||||
// Lookup an already loaded class. If not found NULL is returned.
|
// Lookup an already loaded class. If not found NULL is returned.
|
||||||
static klassOop find(symbolHandle class_name, Handle class_loader, Handle protection_domain, TRAPS);
|
static klassOop find(symbolHandle class_name, Handle class_loader, Handle protection_domain, TRAPS);
|
||||||
|
|
|
@ -53,8 +53,8 @@ static void* verify_byte_codes_fn() {
|
||||||
|
|
||||||
// Methods in Verifier
|
// Methods in Verifier
|
||||||
|
|
||||||
bool Verifier::should_verify_for(oop class_loader) {
|
bool Verifier::should_verify_for(oop class_loader, bool should_verify_class) {
|
||||||
return class_loader == NULL ?
|
return (class_loader == NULL || !should_verify_class) ?
|
||||||
BytecodeVerificationLocal : BytecodeVerificationRemote;
|
BytecodeVerificationLocal : BytecodeVerificationRemote;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ bool Verifier::relax_verify_for(oop loader) {
|
||||||
return !need_verify;
|
return !need_verify;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Verifier::verify(instanceKlassHandle klass, Verifier::Mode mode, TRAPS) {
|
bool Verifier::verify(instanceKlassHandle klass, Verifier::Mode mode, bool should_verify_class, TRAPS) {
|
||||||
ResourceMark rm(THREAD);
|
ResourceMark rm(THREAD);
|
||||||
HandleMark hm;
|
HandleMark hm;
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ bool Verifier::verify(instanceKlassHandle klass, Verifier::Mode mode, TRAPS) {
|
||||||
// If the class should be verified, first see if we can use the split
|
// If the class should be verified, first see if we can use the split
|
||||||
// verifier. If not, or if verification fails and FailOverToOldVerifier
|
// verifier. If not, or if verification fails and FailOverToOldVerifier
|
||||||
// is set, then call the inference verifier.
|
// is set, then call the inference verifier.
|
||||||
if (is_eligible_for_verification(klass)) {
|
if (is_eligible_for_verification(klass, should_verify_class)) {
|
||||||
if (TraceClassInitialization) {
|
if (TraceClassInitialization) {
|
||||||
tty->print_cr("Start class verification for: %s", klassName);
|
tty->print_cr("Start class verification for: %s", klassName);
|
||||||
}
|
}
|
||||||
|
@ -141,12 +141,13 @@ bool Verifier::verify(instanceKlassHandle klass, Verifier::Mode mode, TRAPS) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Verifier::is_eligible_for_verification(instanceKlassHandle klass) {
|
bool Verifier::is_eligible_for_verification(instanceKlassHandle klass, bool should_verify_class) {
|
||||||
symbolOop name = klass->name();
|
symbolOop name = klass->name();
|
||||||
klassOop refl_magic_klass = SystemDictionary::reflect_magic_klass();
|
klassOop refl_magic_klass = SystemDictionary::reflect_magic_klass();
|
||||||
|
|
||||||
return (should_verify_for(klass->class_loader()) &&
|
return (should_verify_for(klass->class_loader(), should_verify_class) &&
|
||||||
// return if the class is a bootstrapping class
|
// return if the class is a bootstrapping class
|
||||||
|
// or defineClass specified not to verify by default (flags override passed arg)
|
||||||
// We need to skip the following four for bootstraping
|
// We need to skip the following four for bootstraping
|
||||||
name != vmSymbols::java_lang_Object() &&
|
name != vmSymbols::java_lang_Object() &&
|
||||||
name != vmSymbols::java_lang_Class() &&
|
name != vmSymbols::java_lang_Class() &&
|
||||||
|
|
|
@ -34,16 +34,18 @@ class Verifier : AllStatic {
|
||||||
* Otherwise, no exception is thrown and the return indicates the
|
* Otherwise, no exception is thrown and the return indicates the
|
||||||
* error.
|
* error.
|
||||||
*/
|
*/
|
||||||
static bool verify(instanceKlassHandle klass, Mode mode, TRAPS);
|
static bool verify(instanceKlassHandle 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,
|
||||||
static bool should_verify_for(oop class_loader);
|
// or if defineClass was called requesting skipping verification
|
||||||
|
// -Xverify:all/none override this value
|
||||||
|
static bool should_verify_for(oop class_loader, bool should_verify_class);
|
||||||
|
|
||||||
// Relax certain verifier checks to enable some broken 1.1 apps to run on 1.2.
|
// Relax certain verifier checks to enable some broken 1.1 apps to run on 1.2.
|
||||||
static bool relax_verify_for(oop class_loader);
|
static bool relax_verify_for(oop class_loader);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static bool is_eligible_for_verification(instanceKlassHandle klass);
|
static bool is_eligible_for_verification(instanceKlassHandle klass, bool should_verify_class);
|
||||||
static symbolHandle inference_verify(
|
static symbolHandle inference_verify(
|
||||||
instanceKlassHandle klass, char* msg, size_t msg_len, TRAPS);
|
instanceKlassHandle klass, char* msg, size_t msg_len, TRAPS);
|
||||||
};
|
};
|
||||||
|
|
|
@ -1464,7 +1464,7 @@ void DepChange::initialize() {
|
||||||
for (ContextStream str(*this); str.next(); ) {
|
for (ContextStream str(*this); str.next(); ) {
|
||||||
klassOop d = str.klass();
|
klassOop d = str.klass();
|
||||||
assert(!instanceKlass::cast(d)->is_marked_dependent(), "checking");
|
assert(!instanceKlass::cast(d)->is_marked_dependent(), "checking");
|
||||||
instanceKlass::cast(d)->set_is_marked_dependent(true);
|
instanceKlass::cast(d)->set_is_marked_dependent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1473,7 +1473,7 @@ DepChange::~DepChange() {
|
||||||
// Unmark transitive interfaces
|
// Unmark transitive interfaces
|
||||||
for (ContextStream str(*this); str.next(); ) {
|
for (ContextStream str(*this); str.next(); ) {
|
||||||
klassOop d = str.klass();
|
klassOop d = str.klass();
|
||||||
instanceKlass::cast(d)->set_is_marked_dependent(false);
|
instanceKlass::cast(d)->clear_is_marked_dependent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -110,7 +110,7 @@ bool instanceKlass::verify_code(
|
||||||
// 1) Verify the bytecodes
|
// 1) Verify the bytecodes
|
||||||
Verifier::Mode mode =
|
Verifier::Mode mode =
|
||||||
throw_verifyerror ? Verifier::ThrowException : Verifier::NoException;
|
throw_verifyerror ? Verifier::ThrowException : Verifier::NoException;
|
||||||
return Verifier::verify(this_oop, mode, CHECK_false);
|
return Verifier::verify(this_oop, mode, this_oop->should_verify_class(), CHECK_false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -114,6 +114,15 @@ class instanceKlass: public Klass {
|
||||||
initialization_error // error happened during initialization
|
initialization_error // error happened during initialization
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// smaller footprint for boolean flags
|
||||||
|
enum ClassFlags {
|
||||||
|
_noflags = 0, // initial value
|
||||||
|
_rewritten = 0x00000001U, // rewritten
|
||||||
|
_should_verify = 0x00000002U, // defineClass specified conditional verification
|
||||||
|
_has_nonstatic_fields = 0x00000004U, // for sizing with UseCompressedOops
|
||||||
|
_is_marked_dependent = 0x00000008U // used for marking during flushing and deoptimization
|
||||||
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
oop* oop_block_beg() const { return adr_array_klasses(); }
|
oop* oop_block_beg() const { return adr_array_klasses(); }
|
||||||
oop* oop_block_end() const { return adr_methods_default_annotations() + 1; }
|
oop* oop_block_end() const { return adr_methods_default_annotations() + 1; }
|
||||||
|
@ -192,9 +201,7 @@ class instanceKlass: public Klass {
|
||||||
int _static_field_size; // number words used by static fields (oop and non-oop) in this klass
|
int _static_field_size; // number words used by static fields (oop and non-oop) in this klass
|
||||||
int _static_oop_field_size;// number of static oop fields in this klass
|
int _static_oop_field_size;// number of static oop fields in this klass
|
||||||
int _nonstatic_oop_map_size;// number of nonstatic oop-map blocks allocated at end of this klass
|
int _nonstatic_oop_map_size;// number of nonstatic oop-map blocks allocated at end of this klass
|
||||||
bool _is_marked_dependent; // used for marking during flushing and deoptimization
|
int _class_flags; // internal class state flags
|
||||||
bool _rewritten; // methods rewritten.
|
|
||||||
bool _has_nonstatic_fields; // for sizing with UseCompressedOops
|
|
||||||
u2 _minor_version; // minor version number of class file
|
u2 _minor_version; // minor version number of class file
|
||||||
u2 _major_version; // major version number of class file
|
u2 _major_version; // major version number of class file
|
||||||
ClassState _init_state; // state of class
|
ClassState _init_state; // state of class
|
||||||
|
@ -230,8 +237,8 @@ class instanceKlass: public Klass {
|
||||||
friend class SystemDictionary;
|
friend class SystemDictionary;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
bool has_nonstatic_fields() const { return _has_nonstatic_fields; }
|
bool has_nonstatic_fields() const { return (_class_flags & _has_nonstatic_fields) != 0; }
|
||||||
void set_has_nonstatic_fields(bool b) { _has_nonstatic_fields = b; }
|
void set_has_nonstatic_fields() { _class_flags |= _has_nonstatic_fields; }
|
||||||
|
|
||||||
// field sizes
|
// field sizes
|
||||||
int nonstatic_field_size() const { return _nonstatic_field_size; }
|
int nonstatic_field_size() const { return _nonstatic_field_size; }
|
||||||
|
@ -338,11 +345,16 @@ class instanceKlass: public Klass {
|
||||||
bool is_in_error_state() const { return _init_state == initialization_error; }
|
bool is_in_error_state() const { return _init_state == initialization_error; }
|
||||||
bool is_reentrant_initialization(Thread *thread) { return thread == _init_thread; }
|
bool is_reentrant_initialization(Thread *thread) { return thread == _init_thread; }
|
||||||
int get_init_state() { return _init_state; } // Useful for debugging
|
int get_init_state() { return _init_state; } // Useful for debugging
|
||||||
bool is_rewritten() const { return _rewritten; }
|
bool is_rewritten() const { return (_class_flags & _rewritten) != 0; }
|
||||||
|
|
||||||
|
// defineClass specified verification
|
||||||
|
bool should_verify_class() const { return (_class_flags & _should_verify) != 0; }
|
||||||
|
void set_should_verify_class() { _class_flags |= _should_verify; }
|
||||||
|
|
||||||
// marking
|
// marking
|
||||||
bool is_marked_dependent() const { return _is_marked_dependent; }
|
bool is_marked_dependent() const { return (_class_flags & _is_marked_dependent) != 0; }
|
||||||
void set_is_marked_dependent(bool value) { _is_marked_dependent = value; }
|
void set_is_marked_dependent() { _class_flags |= _is_marked_dependent; }
|
||||||
|
void clear_is_marked_dependent() { _class_flags &= ~_is_marked_dependent; }
|
||||||
|
|
||||||
// initialization (virtuals from Klass)
|
// initialization (virtuals from Klass)
|
||||||
bool should_be_initialized() const; // means that initialize should be called
|
bool should_be_initialized() const; // means that initialize should be called
|
||||||
|
@ -715,7 +727,8 @@ private:
|
||||||
#else
|
#else
|
||||||
void set_init_state(ClassState state) { _init_state = state; }
|
void set_init_state(ClassState state) { _init_state = state; }
|
||||||
#endif
|
#endif
|
||||||
void set_rewritten() { _rewritten = true; }
|
void clear_class_flags() { _class_flags = _noflags; }
|
||||||
|
void set_rewritten() { _class_flags |= _rewritten; }
|
||||||
void set_init_thread(Thread *thread) { _init_thread = thread; }
|
void set_init_thread(Thread *thread) { _init_thread = thread; }
|
||||||
|
|
||||||
u2 idnum_allocated_count() const { return _idnum_allocated_count; }
|
u2 idnum_allocated_count() const { return _idnum_allocated_count; }
|
||||||
|
|
|
@ -450,9 +450,9 @@ klassOop instanceKlassKlass::allocate_instance_klass(int vtable_len, int itable_
|
||||||
ik->set_inner_classes(NULL);
|
ik->set_inner_classes(NULL);
|
||||||
ik->set_static_oop_field_size(0);
|
ik->set_static_oop_field_size(0);
|
||||||
ik->set_nonstatic_field_size(0);
|
ik->set_nonstatic_field_size(0);
|
||||||
ik->set_is_marked_dependent(false);
|
|
||||||
ik->set_init_state(instanceKlass::allocated);
|
ik->set_init_state(instanceKlass::allocated);
|
||||||
ik->set_init_thread(NULL);
|
ik->set_init_thread(NULL);
|
||||||
|
ik->clear_class_flags();
|
||||||
ik->set_reference_type(rt);
|
ik->set_reference_type(rt);
|
||||||
ik->set_oop_map_cache(NULL);
|
ik->set_oop_map_cache(NULL);
|
||||||
ik->set_jni_ids(NULL);
|
ik->set_jni_ids(NULL);
|
||||||
|
|
|
@ -299,7 +299,8 @@ JNI_ENTRY(jclass, jni_DefineClass(JNIEnv *env, const char *name, jobject loaderR
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
klassOop k = SystemDictionary::resolve_from_stream(class_name, class_loader,
|
klassOop k = SystemDictionary::resolve_from_stream(class_name, class_loader,
|
||||||
Handle(), &st, CHECK_NULL);
|
Handle(), &st, true,
|
||||||
|
CHECK_NULL);
|
||||||
|
|
||||||
if (TraceClassResolution && k != NULL) {
|
if (TraceClassResolution && k != NULL) {
|
||||||
trace_class_resolution(k);
|
trace_class_resolution(k);
|
||||||
|
|
|
@ -762,7 +762,11 @@ static void is_lock_held_by_thread(Handle loader, PerfCounter* counter, TRAPS) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// common code for JVM_DefineClass() and JVM_DefineClassWithSource()
|
// common code for JVM_DefineClass() and JVM_DefineClassWithSource()
|
||||||
static jclass jvm_define_class_common(JNIEnv *env, const char *name, jobject loader, const jbyte *buf, jsize len, jobject pd, const char *source, TRAPS) {
|
// and JVM_DefineClassWithSourceCond()
|
||||||
|
static jclass jvm_define_class_common(JNIEnv *env, const char *name,
|
||||||
|
jobject loader, const jbyte *buf,
|
||||||
|
jsize len, jobject pd, const char *source,
|
||||||
|
jboolean verify, TRAPS) {
|
||||||
if (source == NULL) source = "__JVM_DefineClass__";
|
if (source == NULL) source = "__JVM_DefineClass__";
|
||||||
|
|
||||||
assert(THREAD->is_Java_thread(), "must be a JavaThread");
|
assert(THREAD->is_Java_thread(), "must be a JavaThread");
|
||||||
|
@ -803,6 +807,7 @@ static jclass jvm_define_class_common(JNIEnv *env, const char *name, jobject loa
|
||||||
Handle protection_domain (THREAD, JNIHandles::resolve(pd));
|
Handle protection_domain (THREAD, JNIHandles::resolve(pd));
|
||||||
klassOop k = SystemDictionary::resolve_from_stream(class_name, class_loader,
|
klassOop k = SystemDictionary::resolve_from_stream(class_name, class_loader,
|
||||||
protection_domain, &st,
|
protection_domain, &st,
|
||||||
|
verify != 0,
|
||||||
CHECK_NULL);
|
CHECK_NULL);
|
||||||
|
|
||||||
if (TraceClassResolution && k != NULL) {
|
if (TraceClassResolution && k != NULL) {
|
||||||
|
@ -816,16 +821,24 @@ static jclass jvm_define_class_common(JNIEnv *env, const char *name, jobject loa
|
||||||
JVM_ENTRY(jclass, JVM_DefineClass(JNIEnv *env, const char *name, jobject loader, const jbyte *buf, jsize len, jobject pd))
|
JVM_ENTRY(jclass, JVM_DefineClass(JNIEnv *env, const char *name, jobject loader, const jbyte *buf, jsize len, jobject pd))
|
||||||
JVMWrapper2("JVM_DefineClass %s", name);
|
JVMWrapper2("JVM_DefineClass %s", name);
|
||||||
|
|
||||||
return jvm_define_class_common(env, name, loader, buf, len, pd, NULL, THREAD);
|
return jvm_define_class_common(env, name, loader, buf, len, pd, NULL, true, THREAD);
|
||||||
JVM_END
|
JVM_END
|
||||||
|
|
||||||
|
|
||||||
JVM_ENTRY(jclass, JVM_DefineClassWithSource(JNIEnv *env, const char *name, jobject loader, const jbyte *buf, jsize len, jobject pd, const char *source))
|
JVM_ENTRY(jclass, JVM_DefineClassWithSource(JNIEnv *env, const char *name, jobject loader, const jbyte *buf, jsize len, jobject pd, const char *source))
|
||||||
JVMWrapper2("JVM_DefineClassWithSource %s", name);
|
JVMWrapper2("JVM_DefineClassWithSource %s", name);
|
||||||
|
|
||||||
return jvm_define_class_common(env, name, loader, buf, len, pd, source, THREAD);
|
return jvm_define_class_common(env, name, loader, buf, len, pd, source, true, THREAD);
|
||||||
JVM_END
|
JVM_END
|
||||||
|
|
||||||
|
JVM_ENTRY(jclass, JVM_DefineClassWithSourceCond(JNIEnv *env, const char *name,
|
||||||
|
jobject loader, const jbyte *buf,
|
||||||
|
jsize len, jobject pd,
|
||||||
|
const char *source, jboolean verify))
|
||||||
|
JVMWrapper2("JVM_DefineClassWithSourceCond %s", name);
|
||||||
|
|
||||||
|
return jvm_define_class_common(env, name, loader, buf, len, pd, source, verify, THREAD);
|
||||||
|
JVM_END
|
||||||
|
|
||||||
JVM_ENTRY(jclass, JVM_FindLoadedClass(JNIEnv *env, jobject loader, jstring name))
|
JVM_ENTRY(jclass, JVM_FindLoadedClass(JNIEnv *env, jobject loader, jstring name))
|
||||||
JVMWrapper("JVM_FindLoadedClass");
|
JVMWrapper("JVM_FindLoadedClass");
|
||||||
|
|
|
@ -417,6 +417,17 @@ JVM_DefineClassWithSource(JNIEnv *env, const char *name, jobject loader,
|
||||||
const jbyte *buf, jsize len, jobject pd,
|
const jbyte *buf, jsize len, jobject pd,
|
||||||
const char *source);
|
const char *source);
|
||||||
|
|
||||||
|
/* Define a class with a source with conditional verification (added HSX 14)
|
||||||
|
* -Xverify:all will verify anyway, -Xverify:none will not verify,
|
||||||
|
* -Xverify:remote (default) will obey this conditional
|
||||||
|
* i.e. true = should_verify_class
|
||||||
|
*/
|
||||||
|
JNIEXPORT jclass JNICALL
|
||||||
|
JVM_DefineClassWithSourceCond(JNIEnv *env, const char *name,
|
||||||
|
jobject loader, const jbyte *buf,
|
||||||
|
jsize len, jobject pd, const char *source,
|
||||||
|
jboolean verify);
|
||||||
|
|
||||||
/* Define a class with a source (MLVM) */
|
/* Define a class with a source (MLVM) */
|
||||||
JNIEXPORT jclass JNICALL
|
JNIEXPORT jclass JNICALL
|
||||||
JVM_DefineClassWithCP(JNIEnv *env, const char *name, jobject loader,
|
JVM_DefineClassWithCP(JNIEnv *env, const char *name, jobject loader,
|
||||||
|
|
|
@ -933,7 +933,7 @@ jvmtiError VM_RedefineClasses::load_new_class_versions(TRAPS) {
|
||||||
// description.
|
// description.
|
||||||
RedefineVerifyMark rvm(&the_class, &scratch_class, state);
|
RedefineVerifyMark rvm(&the_class, &scratch_class, state);
|
||||||
Verifier::verify(
|
Verifier::verify(
|
||||||
scratch_class, Verifier::ThrowException, THREAD);
|
scratch_class, Verifier::ThrowException, true, THREAD);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (HAS_PENDING_EXCEPTION) {
|
if (HAS_PENDING_EXCEPTION) {
|
||||||
|
@ -959,7 +959,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, THREAD);
|
Verifier::verify(scratch_class, Verifier::ThrowException, true, THREAD);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (HAS_PENDING_EXCEPTION) {
|
if (HAS_PENDING_EXCEPTION) {
|
||||||
|
|
|
@ -108,7 +108,7 @@ static inline uint64_t cast_uint64_t(size_t x)
|
||||||
nonstatic_field(instanceKlass, _static_field_size, int) \
|
nonstatic_field(instanceKlass, _static_field_size, int) \
|
||||||
nonstatic_field(instanceKlass, _static_oop_field_size, int) \
|
nonstatic_field(instanceKlass, _static_oop_field_size, int) \
|
||||||
nonstatic_field(instanceKlass, _nonstatic_oop_map_size, int) \
|
nonstatic_field(instanceKlass, _nonstatic_oop_map_size, int) \
|
||||||
nonstatic_field(instanceKlass, _is_marked_dependent, bool) \
|
nonstatic_field(instanceKlass, _class_flags, int) \
|
||||||
nonstatic_field(instanceKlass, _minor_version, u2) \
|
nonstatic_field(instanceKlass, _minor_version, u2) \
|
||||||
nonstatic_field(instanceKlass, _major_version, u2) \
|
nonstatic_field(instanceKlass, _major_version, u2) \
|
||||||
nonstatic_field(instanceKlass, _init_state, instanceKlass::ClassState) \
|
nonstatic_field(instanceKlass, _init_state, instanceKlass::ClassState) \
|
||||||
|
@ -1245,6 +1245,7 @@ static inline uint64_t cast_uint64_t(size_t x)
|
||||||
declare_integer_type(Bytecodes::Code) \
|
declare_integer_type(Bytecodes::Code) \
|
||||||
declare_integer_type(Generation::Name) \
|
declare_integer_type(Generation::Name) \
|
||||||
declare_integer_type(instanceKlass::ClassState) \
|
declare_integer_type(instanceKlass::ClassState) \
|
||||||
|
declare_integer_type(instanceKlass::ClassFlags) \
|
||||||
declare_integer_type(JavaThreadState) \
|
declare_integer_type(JavaThreadState) \
|
||||||
declare_integer_type(Location::Type) \
|
declare_integer_type(Location::Type) \
|
||||||
declare_integer_type(Location::Where) \
|
declare_integer_type(Location::Where) \
|
||||||
|
@ -1526,6 +1527,16 @@ static inline uint64_t cast_uint64_t(size_t x)
|
||||||
declare_constant(instanceKlass::initialization_error) \
|
declare_constant(instanceKlass::initialization_error) \
|
||||||
\
|
\
|
||||||
/*********************************/ \
|
/*********************************/ \
|
||||||
|
/* instanceKlass ClassFlags enum */ \
|
||||||
|
/*********************************/ \
|
||||||
|
\
|
||||||
|
declare_constant(instanceKlass::_noflags) \
|
||||||
|
declare_constant(instanceKlass::_rewritten) \
|
||||||
|
declare_constant(instanceKlass::_should_verify) \
|
||||||
|
declare_constant(instanceKlass::_has_nonstatic_fields) \
|
||||||
|
declare_constant(instanceKlass::_is_marked_dependent) \
|
||||||
|
\
|
||||||
|
/*********************************/ \
|
||||||
/* symbolOop - symbol max length */ \
|
/* symbolOop - symbol max length */ \
|
||||||
/*********************************/ \
|
/*********************************/ \
|
||||||
\
|
\
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue