Skip to content
Permalink
Browse files

Automatic merge of jdk:master into master

  • Loading branch information
duke committed Jul 22, 2020
2 parents 841f43c + 2d8e74d commit 136874ba8a18d59a1379a34d03fedc016a3c42ac
@@ -413,6 +413,7 @@ void TemplateTable::fast_aldc(bool wide)
// Stash null_sentinel address to get its value later
__ movptr(rarg, (uintptr_t)Universe::the_null_sentinel_addr());
__ ldr(tmp, Address(rarg));
__ resolve_oop_handle(tmp);
__ cmpoop(result, tmp);
__ br(Assembler::NE, notNull);
__ mov(result, 0); // NULL object reference
@@ -462,6 +462,7 @@ void TemplateTable::fast_aldc(bool wide) {
// Stash null_sentinel address to get its value later
__ mov_slow(rarg, (uintptr_t)Universe::the_null_sentinel_addr());
__ ldr(tmp, Address(rarg));
__ resolve_oop_handle(tmp);
__ cmp(result, tmp);
__ b(notNull, ne);
__ mov(result, 0); // NULL object reference
@@ -317,9 +317,10 @@ void TemplateTable::fast_aldc(bool wide) {
__ get_cache_index_at_bcp(Rscratch, 1, index_size); // Load index.
__ load_resolved_reference_at_index(R17_tos, Rscratch, &is_null);

// Convert null sentinel to NULL.
// Convert null sentinel to NULL
int simm16_rest = __ load_const_optimized(Rscratch, Universe::the_null_sentinel_addr(), R0, true);
__ ld(Rscratch, simm16_rest, Rscratch);
__ resolve_oop_handle(Rscratch);
__ cmpld(CCR0, R17_tos, Rscratch);
if (VM_Version::has_isel()) {
__ isel_0(R17_tos, CCR0, Assembler::equal);
@@ -466,6 +466,7 @@ void TemplateTable::fast_aldc(bool wide) {

// Convert null sentinel to NULL.
__ load_const_optimized(Z_R1_scratch, (intptr_t)Universe::the_null_sentinel_addr());
__ resolve_oop_handle(Z_R1_scratch);
__ z_cg(Z_tos, Address(Z_R1_scratch));
__ z_brne(L_resolved);
__ clear_reg(Z_tos);
@@ -448,6 +448,7 @@ void TemplateTable::fast_aldc(bool wide) {
Label notNull;
ExternalAddress null_sentinel((address)Universe::the_null_sentinel_addr());
__ movptr(tmp, null_sentinel);
__ resolve_oop_handle(tmp);
__ cmpoop(tmp, result);
__ jccb(Assembler::notEqual, notNull);
__ xorptr(result, result); // NULL object reference

Large diffs are not rendered by default.

@@ -27,6 +27,7 @@

#include "gc/shared/verifyOption.hpp"
#include "oops/array.hpp"
#include "oops/oopHandle.hpp"
#include "runtime/handles.hpp"
#include "utilities/growableArray.hpp"

@@ -106,31 +107,27 @@ class Universe: AllStatic {
static oop _short_mirror;
static oop _void_mirror;

static oop _main_thread_group; // Reference to the main thread group object
static oop _system_thread_group; // Reference to the system thread group object
static OopHandle _main_thread_group; // Reference to the main thread group object
static OopHandle _system_thread_group; // Reference to the system thread group object

static OopHandle _the_empty_class_array; // Canonicalized obj array of type java.lang.Class
static OopHandle _the_null_string; // A cache of "null" as a Java string
static OopHandle _the_min_jint_string; // A cache of "-2147483648" as a Java string

static OopHandle _the_null_sentinel; // A unique object pointer unused except as a sentinel for null.

// preallocated error objects (no backtrace)
static OopHandle _out_of_memory_errors;

// preallocated cause message for delayed StackOverflowError
static OopHandle _delayed_stack_overflow_error_message;

static objArrayOop _the_empty_class_klass_array; // Canonicalized obj array of type java.lang.Class
static oop _the_null_sentinel; // A unique object pointer unused except as a sentinel for null.
static oop _the_null_string; // A cache of "null" as a Java string
static oop _the_min_jint_string; // A cache of "-2147483648" as a Java string
static LatestMethodCache* _finalizer_register_cache; // static method for registering finalizable objects
static LatestMethodCache* _loader_addClass_cache; // method for registering loaded classes in class loader vector
static LatestMethodCache* _throw_illegal_access_error_cache; // Unsafe.throwIllegalAccessError() method
static LatestMethodCache* _throw_no_such_method_error_cache; // Unsafe.throwNoSuchMethodError() method
static LatestMethodCache* _do_stack_walk_cache; // method for stack walker callback

// preallocated error objects (no backtrace)
static oop _out_of_memory_error_java_heap;
static oop _out_of_memory_error_metaspace;
static oop _out_of_memory_error_class_metaspace;
static oop _out_of_memory_error_array_size;
static oop _out_of_memory_error_gc_overhead_limit;
static oop _out_of_memory_error_realloc_objects;
static oop _out_of_memory_error_retry;

// preallocated cause message for delayed StackOverflowError
static oop _delayed_stack_overflow_error_message;

static Array<int>* _the_empty_int_array; // Canonicalized int array
static Array<u2>* _the_empty_short_array; // Canonicalized short array
static Array<Klass*>* _the_empty_klass_array; // Canonicalized klass array
@@ -140,17 +137,14 @@ class Universe: AllStatic {
static Array<Klass*>* _the_array_interfaces_array;

// array of preallocated error objects with backtrace
static objArrayOop _preallocated_out_of_memory_error_array;
static OopHandle _preallocated_out_of_memory_error_array;

// number of preallocated error objects available for use
static volatile jint _preallocated_out_of_memory_error_avail_count;

static oop _null_ptr_exception_instance; // preallocated exception object
static oop _arithmetic_exception_instance; // preallocated exception object
static oop _virtual_machine_error_instance; // preallocated exception object
// The object used as an exception dummy when exceptions are thrown for
// the vm thread.
static oop _vm_exception;
static OopHandle _null_ptr_exception_instance; // preallocated exception object
static OopHandle _arithmetic_exception_instance; // preallocated exception object
static OopHandle _virtual_machine_error_instance; // preallocated exception object

// References waiting to be transferred to the ReferenceHandler
static oop _reference_pending_list;
@@ -161,8 +155,7 @@ class Universe: AllStatic {
static intptr_t _non_oop_bits;

// array of dummy objects used with +FullGCAlot
debug_only(static objArrayOop _fullgc_alot_dummy_array;)
// index of next entry to clear
debug_only(static OopHandle _fullgc_alot_dummy_array;)
debug_only(static int _fullgc_alot_dummy_next;)

// Compiler/dispatch support
@@ -174,8 +167,9 @@ class Universe: AllStatic {
static bool _fully_initialized; // true after universe_init and initialize_vtables called

// the array of preallocated errors with backtraces
static objArrayOop preallocated_out_of_memory_errors() { return _preallocated_out_of_memory_error_array; }
static objArrayOop preallocated_out_of_memory_errors();

static objArrayOop out_of_memory_errors();
// generate an out of memory error; if possible using an error with preallocated backtrace;
// otherwise return the given default error.
static oop gen_out_of_memory_error(oop default_err);
@@ -265,17 +259,23 @@ class Universe: AllStatic {
assert((uint)t < T_VOID+1, "range check");
return check_mirror(_mirrors[t]);
}
static oop main_thread_group() { return _main_thread_group; }
static void set_main_thread_group(oop group) { _main_thread_group = group;}
static oop main_thread_group();
static void set_main_thread_group(oop group);

static oop system_thread_group() { return _system_thread_group; }
static void set_system_thread_group(oop group) { _system_thread_group = group;}
static oop system_thread_group();
static void set_system_thread_group(oop group);

static objArrayOop the_empty_class_klass_array () { return _the_empty_class_klass_array; }
static Array<Klass*>* the_array_interfaces_array() { return _the_array_interfaces_array; }
static oop the_null_string() { return _the_null_string; }
static oop the_min_jint_string() { return _the_min_jint_string; }
static objArrayOop the_empty_class_array ();

static oop the_null_string();
static oop the_min_jint_string();

static oop null_ptr_exception_instance();
static oop arithmetic_exception_instance();
static oop virtual_machine_error_instance();
static oop vm_exception() { return virtual_machine_error_instance(); }

static Array<Klass*>* the_array_interfaces_array() { return _the_array_interfaces_array; }
static Method* finalizer_register_method() { return _finalizer_register_cache->get_method(); }
static Method* loader_addClass_method() { return _loader_addClass_cache->get_method(); }

@@ -284,16 +284,13 @@ class Universe: AllStatic {

static Method* do_stack_walk_method() { return _do_stack_walk_cache->get_method(); }

static oop the_null_sentinel() { return _the_null_sentinel; }
static oop the_null_sentinel();
static address the_null_sentinel_addr() { return (address) &_the_null_sentinel; }

// Function to initialize these
static void initialize_known_methods(TRAPS);

static oop null_ptr_exception_instance() { return _null_ptr_exception_instance; }
static oop arithmetic_exception_instance() { return _arithmetic_exception_instance; }
static oop virtual_machine_error_instance() { return _virtual_machine_error_instance; }
static oop vm_exception() { return _vm_exception; }
static void create_preallocated_out_of_memory_errors(TRAPS);

// Reference pending list manipulation. Access is protected by
// Heap_lock. The getter, setter and predicate require the caller
@@ -302,7 +299,7 @@ class Universe: AllStatic {
// Heap_lock, so requires the lock is locked, but not necessarily by
// the current thread.
static oop reference_pending_list();
static void set_reference_pending_list(oop list);
static void clear_reference_pending_list();
static bool has_reference_pending_list();
static oop swap_reference_pending_list(oop list);

@@ -315,15 +312,16 @@ class Universe: AllStatic {
// OutOfMemoryError support. Returns an error with the required message. The returned error
// may or may not have a backtrace. If error has a backtrace then the stack trace is already
// filled in.
static oop out_of_memory_error_java_heap() { return gen_out_of_memory_error(_out_of_memory_error_java_heap); }
static oop out_of_memory_error_metaspace() { return gen_out_of_memory_error(_out_of_memory_error_metaspace); }
static oop out_of_memory_error_class_metaspace() { return gen_out_of_memory_error(_out_of_memory_error_class_metaspace); }
static oop out_of_memory_error_array_size() { return gen_out_of_memory_error(_out_of_memory_error_array_size); }
static oop out_of_memory_error_gc_overhead_limit() { return gen_out_of_memory_error(_out_of_memory_error_gc_overhead_limit); }
static oop out_of_memory_error_realloc_objects() { return gen_out_of_memory_error(_out_of_memory_error_realloc_objects); }
static oop out_of_memory_error_java_heap();
static oop out_of_memory_error_metaspace();
static oop out_of_memory_error_class_metaspace();
static oop out_of_memory_error_array_size();
static oop out_of_memory_error_gc_overhead_limit();
static oop out_of_memory_error_realloc_objects();

// Throw default _out_of_memory_error_retry object as it will never propagate out of the VM
static oop out_of_memory_error_retry() { return _out_of_memory_error_retry; }
static oop delayed_stack_overflow_error_message() { return _delayed_stack_overflow_error_message; }
static oop out_of_memory_error_retry();
static oop delayed_stack_overflow_error_message();

// The particular choice of collected heap.
static CollectedHeap* heap() { return _collectedHeap; }
@@ -805,7 +805,7 @@ bool Method::needs_clinit_barrier() const {
objArrayHandle Method::resolved_checked_exceptions_impl(Method* method, TRAPS) {
int length = method->checked_exceptions_length();
if (length == 0) { // common case
return objArrayHandle(THREAD, Universe::the_empty_class_klass_array());
return objArrayHandle(THREAD, Universe::the_empty_class_array());
} else {
methodHandle h_this(THREAD, method);
objArrayOop m_oop = oopFactory::new_objArray(SystemDictionary::Class_klass(), length, CHECK_(objArrayHandle()));
@@ -48,6 +48,8 @@ class OopHandle {
inline oop resolve() const;
inline oop peek() const;

bool is_empty() const { return _obj == NULL; }

inline void release(OopStorage* storage);

// Used only for removing handle.
@@ -3409,7 +3409,7 @@ JVM_ENTRY(jobject, JVM_GetAndClearReferencePendingList(JNIEnv* env))
MonitorLocker ml(Heap_lock);
oop ref = Universe::reference_pending_list();
if (ref != NULL) {
Universe::set_reference_pending_list(NULL);
Universe::clear_reference_pending_list();
}
return JNIHandles::make_local(THREAD, ref);
JVM_END
@@ -812,8 +812,7 @@ oop Reflection::new_method(const methodHandle& method, bool for_constant_pool_ac
Handle return_type(THREAD, return_type_oop);

objArrayHandle exception_types = get_exception_types(method, CHECK_NULL);

if (exception_types.is_null()) return NULL;
assert(!exception_types.is_null(), "cannot return null");

Symbol* method_name = method->name();
oop name_oop = StringTable::intern(method_name, CHECK_NULL);
@@ -859,7 +858,7 @@ oop Reflection::new_constructor(const methodHandle& method, TRAPS) {
if (parameter_types.is_null()) return NULL;

objArrayHandle exception_types = get_exception_types(method, CHECK_NULL);
if (exception_types.is_null()) return NULL;
assert(!exception_types.is_null(), "cannot return null");

const int modifiers = method->access_flags().as_int() & JVM_RECOGNIZED_METHOD_MODIFIERS;

@@ -369,23 +369,7 @@ typedef HashtableEntry<InstanceKlass*, mtClass> KlassHashtableEntry;
/************/ \
/* Universe */ \
/************/ \
\
static_field(Universe, _mirrors[0], oop) \
static_field(Universe, _main_thread_group, oop) \
static_field(Universe, _system_thread_group, oop) \
static_field(Universe, _the_empty_class_klass_array, objArrayOop) \
static_field(Universe, _null_ptr_exception_instance, oop) \
static_field(Universe, _arithmetic_exception_instance, oop) \
static_field(Universe, _vm_exception, oop) \
static_field(Universe, _collectedHeap, CollectedHeap*) \
static_field(Universe, _base_vtable_size, int) \
static_field(Universe, _bootstrapping, bool) \
static_field(Universe, _fully_initialized, bool) \
static_field(Universe, _verify_count, int) \
static_field(Universe, _verify_oop_mask, uintptr_t) \
static_field(Universe, _verify_oop_bits, uintptr_t) \
static_field(Universe, _non_oop_bits, intptr_t) \
\
/******************/ \
/* CompressedOops */ \
/******************/ \
@@ -51,8 +51,6 @@
public class Universe {
private static AddressField collectedHeapField;
private static VirtualConstructor heapConstructor;
private static sun.jvm.hotspot.types.OopField mainThreadGroupField;
private static sun.jvm.hotspot.types.OopField systemThreadGroupField;

static {
VM.registerVMInitializedObserver(new Observer() {
@@ -91,9 +89,6 @@ private static synchronized void initialize(TypeDataBase db) {
addHeapTypeIfInDB(db, ZCollectedHeap.class);
addHeapTypeIfInDB(db, ShenandoahHeap.class);

mainThreadGroupField = type.getOopField("_main_thread_group");
systemThreadGroupField = type.getOopField("_system_thread_group");

UniverseExt.initialize(heapConstructor);
}

@@ -114,19 +109,6 @@ public boolean isInReserved(Address p) {
return heap().isInReserved(p);
}

private Oop newOop(OopHandle handle) {
return VM.getVM().getObjectHeap().newOop(handle);
}

public Oop mainThreadGroup() {
return newOop(mainThreadGroupField.getValue());
}

public Oop systemThreadGroup() {
return newOop(systemThreadGroupField.getValue());
}


public void print() { printOn(System.out); }
public void printOn(PrintStream tty) {
heap().printOn(tty);
@@ -71,9 +71,7 @@ public static void main(String[] args) throws Exception {
"_number_of_threads", "_number_of_non_daemon_threads"));
expStrMap.put("printstatics Universe", List.of(
"Static fields of Universe",
"uintptr_t Universe::_verify_oop_mask",
"intptr_t Universe::_non_oop_bits",
"bool Universe::_fully_initialized"));
"Universe::_collectedHeap"));
expStrMap.put("printstatics JvmtiExport", List.of(
"Static fields of JvmtiExport",
"bool JvmtiExport::_can_access_local_variables",

0 comments on commit 136874b

Please sign in to comment.