提交 f378773d 编写于 作者: B brutisso

Merge

......@@ -2503,26 +2503,38 @@ Array<Method*>* ClassFileParser::parse_methods(ClassLoaderData* loader_data,
*has_default_methods = true;
}
methods->at_put(index, method());
if (*methods_annotations == NULL) {
*methods_annotations =
MetadataFactory::new_array<AnnotationArray*>(loader_data, length, NULL, CHECK_NULL);
if (method_annotations != NULL) {
if (*methods_annotations == NULL) {
*methods_annotations =
MetadataFactory::new_array<AnnotationArray*>(loader_data, length, NULL, CHECK_NULL);
}
(*methods_annotations)->at_put(index, method_annotations);
}
(*methods_annotations)->at_put(index, method_annotations);
if (*methods_parameter_annotations == NULL) {
*methods_parameter_annotations =
MetadataFactory::new_array<AnnotationArray*>(loader_data, length, NULL, CHECK_NULL);
if (method_parameter_annotations != NULL) {
if (*methods_parameter_annotations == NULL) {
*methods_parameter_annotations =
MetadataFactory::new_array<AnnotationArray*>(loader_data, length, NULL, CHECK_NULL);
}
(*methods_parameter_annotations)->at_put(index, method_parameter_annotations);
}
(*methods_parameter_annotations)->at_put(index, method_parameter_annotations);
if (*methods_default_annotations == NULL) {
*methods_default_annotations =
MetadataFactory::new_array<AnnotationArray*>(loader_data, length, NULL, CHECK_NULL);
if (method_default_annotations != NULL) {
if (*methods_default_annotations == NULL) {
*methods_default_annotations =
MetadataFactory::new_array<AnnotationArray*>(loader_data, length, NULL, CHECK_NULL);
}
(*methods_default_annotations)->at_put(index, method_default_annotations);
}
(*methods_default_annotations)->at_put(index, method_default_annotations);
if (*methods_type_annotations == NULL) {
*methods_type_annotations =
MetadataFactory::new_array<AnnotationArray*>(loader_data, length, NULL, CHECK_NULL);
if (method_type_annotations != NULL) {
if (*methods_type_annotations == NULL) {
*methods_type_annotations =
MetadataFactory::new_array<AnnotationArray*>(loader_data, length, NULL, CHECK_NULL);
}
(*methods_type_annotations)->at_put(index, method_type_annotations);
}
(*methods_type_annotations)->at_put(index, method_type_annotations);
}
if (_need_verify && length > 1) {
......@@ -3338,8 +3350,7 @@ instanceKlassHandle ClassFileParser::parseClassFile(Symbol* name,
bool has_final_method = false;
AccessFlags promoted_flags;
promoted_flags.set_flags(0);
// These need to be oop pointers because they are allocated lazily
// inside parse_methods inside a nested HandleMark
Array<AnnotationArray*>* methods_annotations = NULL;
Array<AnnotationArray*>* methods_parameter_annotations = NULL;
Array<AnnotationArray*>* methods_default_annotations = NULL;
......
......@@ -318,6 +318,7 @@ ClassLoaderData::~ClassLoaderData() {
}
Metaspace* ClassLoaderData::metaspace_non_null() {
assert(!DumpSharedSpaces, "wrong metaspace!");
// If the metaspace has not been allocated, create a new one. Might want
// to create smaller arena for Reflection class loaders also.
// The reason for the delayed allocation is because some class loaders are
......
......@@ -1285,13 +1285,15 @@ static void merge_in_new_methods(InstanceKlass* klass,
enum { ANNOTATIONS, PARAMETERS, DEFAULTS, NUM_ARRAYS };
Array<AnnotationArray*>* original_annots[NUM_ARRAYS];
Array<AnnotationArray*>* original_annots[NUM_ARRAYS] = { NULL };
Array<Method*>* original_methods = klass->methods();
Annotations* annots = klass->annotations();
original_annots[ANNOTATIONS] = annots->methods_annotations();
original_annots[PARAMETERS] = annots->methods_parameter_annotations();
original_annots[DEFAULTS] = annots->methods_default_annotations();
if (annots != NULL) {
original_annots[ANNOTATIONS] = annots->methods_annotations();
original_annots[PARAMETERS] = annots->methods_parameter_annotations();
original_annots[DEFAULTS] = annots->methods_default_annotations();
}
Array<int>* original_ordering = klass->method_ordering();
Array<int>* merged_ordering = Universe::the_empty_int_array();
......@@ -1370,9 +1372,15 @@ static void merge_in_new_methods(InstanceKlass* klass,
// Replace klass methods with new merged lists
klass->set_methods(merged_methods);
annots->set_methods_annotations(merged_annots[ANNOTATIONS]);
annots->set_methods_parameter_annotations(merged_annots[PARAMETERS]);
annots->set_methods_default_annotations(merged_annots[DEFAULTS]);
if (annots != NULL) {
annots->set_methods_annotations(merged_annots[ANNOTATIONS]);
annots->set_methods_parameter_annotations(merged_annots[PARAMETERS]);
annots->set_methods_default_annotations(merged_annots[DEFAULTS]);
} else {
assert(merged_annots[ANNOTATIONS] == NULL, "Must be");
assert(merged_annots[PARAMETERS] == NULL, "Must be");
assert(merged_annots[DEFAULTS] == NULL, "Must be");
}
ClassLoaderData* cld = klass->class_loader_data();
MetadataFactory::free_array(cld, original_methods);
......
......@@ -687,19 +687,6 @@ void java_lang_Class::set_array_klass(oop java_class, Klass* klass) {
}
Method* java_lang_Class::resolved_constructor(oop java_class) {
Metadata* constructor = java_class->metadata_field(_resolved_constructor_offset);
assert(constructor == NULL || constructor->is_method(), "should be method");
return ((Method*)constructor);
}
void java_lang_Class::set_resolved_constructor(oop java_class, Method* constructor) {
assert(constructor->is_method(), "should be method");
java_class->metadata_field_put(_resolved_constructor_offset, constructor);
}
bool java_lang_Class::is_primitive(oop java_class) {
// should assert:
//assert(java_lang_Class::is_instance(java_class), "must be a Class object");
......@@ -2949,7 +2936,6 @@ int java_lang_System::err_offset_in_bytes() {
int java_lang_Class::_klass_offset;
int java_lang_Class::_array_klass_offset;
int java_lang_Class::_resolved_constructor_offset;
int java_lang_Class::_oop_size_offset;
int java_lang_Class::_static_oop_field_count_offset;
GrowableArray<Klass*>* java_lang_Class::_fixup_mirror_list = NULL;
......@@ -3303,7 +3289,6 @@ void JavaClasses::check_offsets() {
// Fake fields
// CHECK_OFFSET("java/lang/Class", java_lang_Class, klass); // %%% this needs to be checked
// CHECK_OFFSET("java/lang/Class", java_lang_Class, array_klass); // %%% this needs to be checked
// CHECK_OFFSET("java/lang/Class", java_lang_Class, resolved_constructor); // %%% this needs to be checked
// java.lang.Throwable
......
......@@ -206,7 +206,6 @@ class java_lang_String : AllStatic {
#define CLASS_INJECTED_FIELDS(macro) \
macro(java_lang_Class, klass, intptr_signature, false) \
macro(java_lang_Class, resolved_constructor, intptr_signature, false) \
macro(java_lang_Class, array_klass, intptr_signature, false) \
macro(java_lang_Class, oop_size, int_signature, false) \
macro(java_lang_Class, static_oop_field_count, int_signature, false)
......@@ -218,7 +217,6 @@ class java_lang_Class : AllStatic {
// The fake offsets are added by the class loader when java.lang.Class is loaded
static int _klass_offset;
static int _resolved_constructor_offset;
static int _array_klass_offset;
static int _oop_size_offset;
......@@ -254,15 +252,11 @@ class java_lang_Class : AllStatic {
static bool is_primitive(oop java_class);
static BasicType primitive_type(oop java_class);
static oop primitive_mirror(BasicType t);
// JVM_NewInstance support
static Method* resolved_constructor(oop java_class);
static void set_resolved_constructor(oop java_class, Method* constructor);
// JVM_NewArray support
static Klass* array_klass(oop java_class);
static void set_array_klass(oop java_class, Klass* klass);
// compiler support for class operations
static int klass_offset_in_bytes() { return _klass_offset; }
static int resolved_constructor_offset_in_bytes() { return _resolved_constructor_offset; }
static int array_klass_offset_in_bytes() { return _array_klass_offset; }
// Support for classRedefinedCount field
static int classRedefinedCount(oop the_class_mirror);
......
......@@ -386,7 +386,6 @@
template(basicType_name, "basicType") \
template(append_name, "append") \
template(klass_name, "klass") \
template(resolved_constructor_name, "resolved_constructor") \
template(array_klass_name, "array_klass") \
template(oop_size_name, "oop_size") \
template(static_oop_field_count_name, "static_oop_field_count") \
......
/*
* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2013, 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
......@@ -287,24 +287,24 @@
"The number of times we'll force an overflow during " \
"concurrent marking") \
\
experimental(uintx, G1NewSizePercent, 20, \
experimental(uintx, G1NewSizePercent, 5, \
"Percentage (0-100) of the heap size to use as default " \
"minimum young gen size.") \
\
experimental(uintx, G1MaxNewSizePercent, 80, \
experimental(uintx, G1MaxNewSizePercent, 60, \
"Percentage (0-100) of the heap size to use as default " \
" maximum young gen size.") \
\
experimental(uintx, G1MixedGCLiveThresholdPercent, 90, \
experimental(uintx, G1MixedGCLiveThresholdPercent, 65, \
"Threshold for regions to be considered for inclusion in the " \
"collection set of mixed GCs. " \
"Regions with live bytes exceeding this will not be collected.") \
\
product(uintx, G1HeapWastePercent, 5, \
product(uintx, G1HeapWastePercent, 10, \
"Amount of space, expressed as a percentage of the heap size, " \
"that G1 is willing not to collect to avoid expensive GCs.") \
\
product(uintx, G1MixedGCCountTarget, 4, \
product(uintx, G1MixedGCCountTarget, 8, \
"The target number of mixed GCs after a marking cycle.") \
\
experimental(uintx, G1OldCSetRegionThresholdPercent, 10, \
......
......@@ -878,12 +878,6 @@ void EvacuateFollowersClosureGeneral::do_void() {
bool ParNewGeneration::_avoid_promotion_undo = false;
void ParNewGeneration::adjust_desired_tenuring_threshold() {
// Set the desired survivor size to half the real survivor space
_tenuring_threshold =
age_table()->compute_tenuring_threshold(to()->capacity()/HeapWordSize);
}
// A Generation that does parallel young-gen collection.
void ParNewGeneration::collect(bool full,
......@@ -1013,6 +1007,8 @@ void ParNewGeneration::collect(bool full,
size_policy->reset_gc_overhead_limit_count();
assert(to()->is_empty(), "to space should be empty now");
adjust_desired_tenuring_threshold();
} else {
assert(_promo_failure_scan_stack.is_empty(), "post condition");
_promo_failure_scan_stack.clear(true); // Clear cached segments.
......@@ -1035,7 +1031,6 @@ void ParNewGeneration::collect(bool full,
from()->set_concurrent_iteration_safe_limit(from()->top());
to()->set_concurrent_iteration_safe_limit(to()->top());
adjust_desired_tenuring_threshold();
if (ResizePLAB) {
plab_stats()->adjust_desired_plab_sz(n_workers);
}
......
......@@ -347,10 +347,6 @@ class ParNewGeneration: public DefNewGeneration {
bool survivor_overflow() { return _survivor_overflow; }
void set_survivor_overflow(bool v) { _survivor_overflow = v; }
// Adjust the tenuring threshold. See the implementation for
// the details of the policy.
virtual void adjust_desired_tenuring_threshold();
public:
ParNewGeneration(ReservedSpace rs, size_t initial_byte_size, int level);
......
......@@ -550,6 +550,11 @@ HeapWord* DefNewGeneration::expand_and_allocate(size_t size,
return allocate(size, is_tlab);
}
void DefNewGeneration::adjust_desired_tenuring_threshold() {
// Set the desired survivor size to half the real survivor space
_tenuring_threshold =
age_table()->compute_tenuring_threshold(to()->capacity()/HeapWordSize);
}
void DefNewGeneration::collect(bool full,
bool clear_all_soft_refs,
......@@ -649,9 +654,7 @@ void DefNewGeneration::collect(bool full,
assert(to()->is_empty(), "to space should be empty now");
// Set the desired survivor size to half the real survivor space
_tenuring_threshold =
age_table()->compute_tenuring_threshold(to()->capacity()/HeapWordSize);
adjust_desired_tenuring_threshold();
// A successful scavenge should restart the GC time limit count which is
// for full GC's.
......
......@@ -124,7 +124,9 @@ protected:
_should_allocate_from_space = true;
}
protected:
// Tenuring
void adjust_desired_tenuring_threshold();
// Spaces
EdenSpace* _eden_space;
ContiguousSpace* _from_space;
......
......@@ -66,7 +66,11 @@ class MetadataFactory : AllStatic {
if (data != NULL) {
assert(loader_data != NULL, "shouldn't pass null");
int size = data->size();
loader_data->metaspace_non_null()->deallocate((MetaWord*)data, size, false);
if (DumpSharedSpaces) {
loader_data->ro_metaspace()->deallocate((MetaWord*)data, size, false);
} else {
loader_data->metaspace_non_null()->deallocate((MetaWord*)data, size, false);
}
}
}
......@@ -77,6 +81,7 @@ class MetadataFactory : AllStatic {
assert(loader_data != NULL, "shouldn't pass null");
int size = md->size();
// Call metadata's deallocate function which will call deallocate fields
assert(!DumpSharedSpaces, "cannot deallocate metadata when dumping CDS archive");
assert(!md->on_stack(), "can't deallocate things on stack");
md->deallocate_contents(loader_data);
loader_data->metaspace_non_null()->deallocate((MetaWord*)md, size, md->is_klass());
......
......@@ -2890,11 +2890,7 @@ void InstanceKlass::oop_print_on(oop obj, outputStream* st) {
st->print(BULLET"fake entry for mirror: ");
mirrored_klass->print_value_on_maybe_null(st);
st->cr();
st->print(BULLET"fake entry resolved_constructor: ");
Method* ctor = java_lang_Class::resolved_constructor(obj);
ctor->print_value_on_maybe_null(st);
Klass* array_klass = java_lang_Class::array_klass(obj);
st->cr();
st->print(BULLET"fake entry for array: ");
array_klass->print_value_on_maybe_null(st);
st->cr();
......
......@@ -1582,8 +1582,11 @@ JVM_ENTRY(jbyteArray, JVM_GetClassTypeAnnotations(JNIEnv *env, jclass cls))
if (!java_lang_Class::is_primitive(JNIHandles::resolve(cls))) {
Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve(cls));
if (k->oop_is_instance()) {
typeArrayOop a = Annotations::make_java_array(InstanceKlass::cast(k)->type_annotations()->class_annotations(), CHECK_NULL);
return (jbyteArray) JNIHandles::make_local(env, a);
Annotations* type_annotations = InstanceKlass::cast(k)->type_annotations();
if (type_annotations != NULL) {
typeArrayOop a = Annotations::make_java_array(type_annotations->class_annotations(), CHECK_NULL);
return (jbyteArray) JNIHandles::make_local(env, a);
}
}
}
return NULL;
......
......@@ -972,18 +972,6 @@ class CommandLineFlags {
notproduct(uintx, WarnOnStalledSpinLock, 0, \
"Prints warnings for stalled SpinLocks") \
\
develop(bool, InitializeJavaLangSystem, true, \
"Initialize java.lang.System - turn off for individual " \
"method debugging") \
\
develop(bool, InitializeJavaLangString, true, \
"Initialize java.lang.String - turn off for individual " \
"method debugging") \
\
develop(bool, InitializeJavaLangExceptionsErrors, true, \
"Initialize various error and exception classes - turn off for " \
"individual method debugging") \
\
product(bool, RegisterFinalizersAtInit, true, \
"Register finalizable objects at end of Object.<init> or " \
"after allocation") \
......
......@@ -1716,7 +1716,6 @@ static void ensure_join(JavaThread* thread) {
// cleanup_failed_attach_current_thread as well.
void JavaThread::exit(bool destroy_vm, ExitType exit_type) {
assert(this == JavaThread::current(), "thread consistency check");
if (!InitializeJavaLangSystem) return;
HandleMark hm(this);
Handle uncaught_exception(this, this->pending_exception());
......@@ -3469,11 +3468,7 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) {
create_vm_init_libraries();
}
if (InitializeJavaLangString) {
initialize_class(vmSymbols::java_lang_String(), CHECK_0);
} else {
warning("java.lang.String not initialized");
}
initialize_class(vmSymbols::java_lang_String(), CHECK_0);
if (AggressiveOpts) {
{
......@@ -3514,53 +3509,39 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) {
}
// Initialize java_lang.System (needed before creating the thread)
if (InitializeJavaLangSystem) {
initialize_class(vmSymbols::java_lang_System(), CHECK_0);
initialize_class(vmSymbols::java_lang_ThreadGroup(), CHECK_0);
Handle thread_group = create_initial_thread_group(CHECK_0);
Universe::set_main_thread_group(thread_group());
initialize_class(vmSymbols::java_lang_Thread(), CHECK_0);
oop thread_object = create_initial_thread(thread_group, main_thread, CHECK_0);
main_thread->set_threadObj(thread_object);
// Set thread status to running since main thread has
// been started and running.
java_lang_Thread::set_thread_status(thread_object,
java_lang_Thread::RUNNABLE);
// The VM creates & returns objects of this class. Make sure it's initialized.
initialize_class(vmSymbols::java_lang_Class(), CHECK_0);
// The VM preresolves methods to these classes. Make sure that they get initialized
initialize_class(vmSymbols::java_lang_reflect_Method(), CHECK_0);
initialize_class(vmSymbols::java_lang_ref_Finalizer(), CHECK_0);
call_initializeSystemClass(CHECK_0);
// get the Java runtime name after java.lang.System is initialized
JDK_Version::set_runtime_name(get_java_runtime_name(THREAD));
JDK_Version::set_runtime_version(get_java_runtime_version(THREAD));
} else {
warning("java.lang.System not initialized");
}
initialize_class(vmSymbols::java_lang_System(), CHECK_0);
initialize_class(vmSymbols::java_lang_ThreadGroup(), CHECK_0);
Handle thread_group = create_initial_thread_group(CHECK_0);
Universe::set_main_thread_group(thread_group());
initialize_class(vmSymbols::java_lang_Thread(), CHECK_0);
oop thread_object = create_initial_thread(thread_group, main_thread, CHECK_0);
main_thread->set_threadObj(thread_object);
// Set thread status to running since main thread has
// been started and running.
java_lang_Thread::set_thread_status(thread_object,
java_lang_Thread::RUNNABLE);
// The VM creates & returns objects of this class. Make sure it's initialized.
initialize_class(vmSymbols::java_lang_Class(), CHECK_0);
// The VM preresolves methods to these classes. Make sure that they get initialized
initialize_class(vmSymbols::java_lang_reflect_Method(), CHECK_0);
initialize_class(vmSymbols::java_lang_ref_Finalizer(), CHECK_0);
call_initializeSystemClass(CHECK_0);
// get the Java runtime name after java.lang.System is initialized
JDK_Version::set_runtime_name(get_java_runtime_name(THREAD));
JDK_Version::set_runtime_version(get_java_runtime_version(THREAD));
// an instance of OutOfMemory exception has been allocated earlier
if (InitializeJavaLangExceptionsErrors) {
initialize_class(vmSymbols::java_lang_OutOfMemoryError(), CHECK_0);
initialize_class(vmSymbols::java_lang_NullPointerException(), CHECK_0);
initialize_class(vmSymbols::java_lang_ClassCastException(), CHECK_0);
initialize_class(vmSymbols::java_lang_ArrayStoreException(), CHECK_0);
initialize_class(vmSymbols::java_lang_ArithmeticException(), CHECK_0);
initialize_class(vmSymbols::java_lang_StackOverflowError(), CHECK_0);
initialize_class(vmSymbols::java_lang_IllegalMonitorStateException(), CHECK_0);
initialize_class(vmSymbols::java_lang_IllegalArgumentException(), CHECK_0);
} else {
warning("java.lang.OutOfMemoryError has not been initialized");
warning("java.lang.NullPointerException has not been initialized");
warning("java.lang.ClassCastException has not been initialized");
warning("java.lang.ArrayStoreException has not been initialized");
warning("java.lang.ArithmeticException has not been initialized");
warning("java.lang.StackOverflowError has not been initialized");
warning("java.lang.IllegalArgumentException has not been initialized");
}
initialize_class(vmSymbols::java_lang_OutOfMemoryError(), CHECK_0);
initialize_class(vmSymbols::java_lang_NullPointerException(), CHECK_0);
initialize_class(vmSymbols::java_lang_ClassCastException(), CHECK_0);
initialize_class(vmSymbols::java_lang_ArrayStoreException(), CHECK_0);
initialize_class(vmSymbols::java_lang_ArithmeticException(), CHECK_0);
initialize_class(vmSymbols::java_lang_StackOverflowError(), CHECK_0);
initialize_class(vmSymbols::java_lang_IllegalMonitorStateException(), CHECK_0);
initialize_class(vmSymbols::java_lang_IllegalArgumentException(), CHECK_0);
}
// See : bugid 4211085.
......
......@@ -1198,7 +1198,6 @@ typedef BinaryTreeDictionary<Metablock, FreeList> MetablockTreeDictionary;
/*********************************/ \
\
static_field(java_lang_Class, _klass_offset, int) \
static_field(java_lang_Class, _resolved_constructor_offset, int) \
static_field(java_lang_Class, _array_klass_offset, int) \
static_field(java_lang_Class, _oop_size_offset, int) \
static_field(java_lang_Class, _static_oop_field_count_offset, int) \
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册