Skip to content
This repository has been archived by the owner on May 29, 2024. It is now read-only.

Commit

Permalink
[GR-45725] Merge tag jdk-17.0.7+7 (23.0).
Browse files Browse the repository at this point in the history
PullRequest: labsjdk-ce-17/111
  • Loading branch information
marwan-hallaoui committed Apr 19, 2023
2 parents 7eea82d + 9a7e3bd commit f0c27ed
Show file tree
Hide file tree
Showing 60 changed files with 1,116 additions and 241 deletions.
2 changes: 1 addition & 1 deletion ci.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ local labsjdk_builder_version = "2d6e93ddd626e9c0e9c862f1d80a5904e7a9165c";
},

# Downstream Graal branch to test against.
local downstream_branch = "master",
local downstream_branch = "release/graal-vm/23.0",

local clone_graal = {
run+: [
Expand Down
3 changes: 2 additions & 1 deletion make/autoconf/flags-cflags.m4
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,8 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER],
# JDK libraries.
STATIC_LIBS_CFLAGS="-DSTATIC_BUILD=1"
if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
STATIC_LIBS_CFLAGS="$STATIC_LIBS_CFLAGS -ffunction-sections -fdata-sections"
STATIC_LIBS_CFLAGS="$STATIC_LIBS_CFLAGS -ffunction-sections -fdata-sections \
-DJNIEXPORT='__attribute__((visibility(\"default\")))'"
else
STATIC_LIBS_CFLAGS="$STATIC_LIBS_CFLAGS -DJNIEXPORT="
fi
Expand Down
4 changes: 2 additions & 2 deletions make/conf/version-numbers.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 2023, 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
Expand Down Expand Up @@ -39,4 +39,4 @@ DEFAULT_VERSION_CLASSFILE_MINOR=0
DEFAULT_VERSION_DOCS_API_SINCE=11
DEFAULT_ACCEPTABLE_BOOT_VERSIONS="16 17"
DEFAULT_JDK_SOURCE_TARGET_VERSION=17
DEFAULT_PROMOTED_VERSION_PRE=ea
DEFAULT_PROMOTED_VERSION_PRE=
45 changes: 45 additions & 0 deletions src/hotspot/share/classfile/javaClasses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2719,6 +2719,51 @@ void java_lang_Throwable::get_stack_trace_elements(Handle throwable,
}
}

Handle java_lang_Throwable::get_cause_with_stack_trace(Handle throwable, TRAPS) {
// Call to JVM to fill in the stack trace and clear declaringClassObject to
// not keep classes alive in the stack trace.
// call this: public StackTraceElement[] getStackTrace()
assert(throwable.not_null(), "shouldn't be");

JavaValue result(T_ARRAY);
JavaCalls::call_virtual(&result, throwable,
vmClasses::Throwable_klass(),
vmSymbols::getStackTrace_name(),
vmSymbols::getStackTrace_signature(),
CHECK_NH);
Handle stack_trace(THREAD, result.get_oop());
assert(stack_trace->is_objArray(), "Should be an array");

// Throw ExceptionInInitializerError as the cause with this exception in
// the message and stack trace.

// Now create the message with the original exception and thread name.
Symbol* message = java_lang_Throwable::detail_message(throwable());
ResourceMark rm(THREAD);
stringStream st;
st.print("Exception %s%s ", throwable()->klass()->name()->as_klass_external_name(),
message == nullptr ? "" : ":");
if (message == NULL) {
st.print("[in thread \"%s\"]", THREAD->name());
} else {
st.print("%s [in thread \"%s\"]", message->as_C_string(), THREAD->name());
}

Symbol* exception_name = vmSymbols::java_lang_ExceptionInInitializerError();
Handle h_cause = Exceptions::new_exception(THREAD, exception_name, st.as_string());

// If new_exception returns a different exception while creating the exception, return null.
if (h_cause->klass()->name() != exception_name) {
log_info(class, init)("Exception thrown while saving initialization exception %s",
h_cause->klass()->external_name());
return Handle();
}
java_lang_Throwable::set_stacktrace(h_cause(), stack_trace());
// Clear backtrace because the stacktrace should be used instead.
set_backtrace(h_cause(), NULL);
return h_cause;
}

bool java_lang_Throwable::get_top_method_and_bci(oop throwable, Method** method, int* bci) {
JavaThread* current = JavaThread::current();
objArrayHandle result(current, objArrayOop(backtrace(throwable)));
Expand Down
4 changes: 4 additions & 0 deletions src/hotspot/share/classfile/javaClasses.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,10 @@ class java_lang_Throwable: AllStatic {
static void fill_in_stack_trace(Handle throwable, const methodHandle& method = methodHandle());
// Programmatic access to stack trace
static void get_stack_trace_elements(Handle throwable, objArrayHandle stack_trace, TRAPS);

// For recreating class initialization error exceptions.
static Handle get_cause_with_stack_trace(Handle throwable, TRAPS);

// Printing
static void print(oop throwable, outputStream* st);
static void print_stack_trace(Handle throwable, outputStream* st);
Expand Down
2 changes: 2 additions & 0 deletions src/hotspot/share/classfile/systemDictionary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1626,6 +1626,8 @@ bool SystemDictionary::do_unloading(GCTimer* gc_timer) {
} else {
assert(_pd_cache_table->number_of_entries() == 0, "should be empty");
}

InstanceKlass::clean_initialization_error_table();
}

return unloading_occurred;
Expand Down
5 changes: 4 additions & 1 deletion src/hotspot/share/classfile/vmSymbols.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,7 @@
template(class_initializer_name, "<clinit>") \
template(println_name, "println") \
template(printStackTrace_name, "printStackTrace") \
template(getStackTrace_name, "getStackTrace") \
template(main_name, "main") \
template(name_name, "name") \
template(priority_name, "priority") \
Expand Down Expand Up @@ -595,7 +596,9 @@
template(int_String_signature, "(I)Ljava/lang/String;") \
template(boolean_boolean_int_signature, "(ZZ)I") \
template(big_integer_shift_worker_signature, "([I[IIII)V") \
template(reflect_method_signature, "Ljava/lang/reflect/Method;") \
template(reflect_method_signature, "Ljava/lang/reflect/Method;") \
template(getStackTrace_signature, "()[Ljava/lang/StackTraceElement;") \
\
/* signature symbols needed by intrinsics */ \
VM_INTRINSICS_DO(VM_INTRINSIC_IGNORE, VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, template, VM_ALIAS_IGNORE) \
\
Expand Down
28 changes: 27 additions & 1 deletion src/hotspot/share/gc/g1/g1CollectedHeap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3201,6 +3201,31 @@ class G1CopyingKeepAliveClosure: public OopClosure {
}
};

// Special closure for enqueuing discovered fields: during enqueue the card table
// may not be in shape to properly handle normal barrier calls (e.g. card marks
// in regions that failed evacuation, scribbling of various values by card table
// scan code). Additionally the regular barrier enqueues into the "global"
// DCQS, but during GC we need these to-be-refined entries in the GC local queue
// so that after clearing the card table, the redirty cards phase will properly
// mark all dirty cards to be picked up by refinement.
class G1EnqueueDiscoveredFieldClosure : public EnqueueDiscoveredFieldClosure {
G1CollectedHeap* _g1h;
G1ParScanThreadState* _pss;

public:
G1EnqueueDiscoveredFieldClosure(G1CollectedHeap* g1h, G1ParScanThreadState* pss) : _g1h(g1h), _pss(pss) { }

virtual void enqueue(HeapWord* discovered_field_addr, oop value) {
assert(_g1h->is_in(discovered_field_addr), PTR_FORMAT " is not in heap ", p2i(discovered_field_addr));
// Store the value first, whatever it is.
RawAccess<>::oop_store(discovered_field_addr, value);
if (value == NULL) {
return;
}
_pss->write_ref_field_post(discovered_field_addr, value);
}
};

// Serial drain queue closure. Called as the 'complete_gc'
// closure for each discovered list in some of the
// reference processing phases.
Expand Down Expand Up @@ -3245,7 +3270,8 @@ class G1STWRefProcProxyTask : public RefProcProxyTask {
G1STWIsAliveClosure is_alive(&_g1h);
G1CopyingKeepAliveClosure keep_alive(&_g1h, _pss.state_for_worker(index));
G1ParEvacuateFollowersClosure complete_gc(&_g1h, _pss.state_for_worker(index), &_task_queues, _tm == RefProcThreadModel::Single ? nullptr : &_terminator, G1GCPhaseTimes::ObjCopy);
_rp_task->rp_work(worker_id, &is_alive, &keep_alive, &complete_gc);
G1EnqueueDiscoveredFieldClosure enqueue(&_g1h, _pss.state_for_worker(index));
_rp_task->rp_work(worker_id, &is_alive, &keep_alive, &enqueue, &complete_gc);
}

void prepare_run_task_hook() override {
Expand Down
3 changes: 2 additions & 1 deletion src/hotspot/share/gc/g1/g1ConcurrentMark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1478,8 +1478,9 @@ class G1CMRefProcProxyTask : public RefProcProxyTask {
G1CMIsAliveClosure is_alive(&_g1h);
uint index = (_tm == RefProcThreadModel::Single) ? 0 : worker_id;
G1CMKeepAliveAndDrainClosure keep_alive(&_cm, _cm.task(index), _tm == RefProcThreadModel::Single);
BarrierEnqueueDiscoveredFieldClosure enqueue;
G1CMDrainMarkingStackClosure complete_gc(&_cm, _cm.task(index), _tm == RefProcThreadModel::Single);
_rp_task->rp_work(worker_id, &is_alive, &keep_alive, &complete_gc);
_rp_task->rp_work(worker_id, &is_alive, &keep_alive, &enqueue, &complete_gc);
}

void prepare_run_task_hook() override {
Expand Down
3 changes: 2 additions & 1 deletion src/hotspot/share/gc/g1/g1FullCollector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,9 @@ class G1FullGCRefProcProxyTask : public RefProcProxyTask {
G1IsAliveClosure is_alive(&_collector);
uint index = (_tm == RefProcThreadModel::Single) ? 0 : worker_id;
G1FullKeepAliveClosure keep_alive(_collector.marker(index));
BarrierEnqueueDiscoveredFieldClosure enqueue;
G1FollowStackClosure* complete_gc = _collector.marker(index)->stack_closure();
_rp_task->rp_work(worker_id, &is_alive, &keep_alive, complete_gc);
_rp_task->rp_work(worker_id, &is_alive, &keep_alive, &enqueue, complete_gc);
}
};

Expand Down
9 changes: 1 addition & 8 deletions src/hotspot/share/gc/g1/g1ParScanThreadState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,14 +203,7 @@ void G1ParScanThreadState::do_oop_evac(T* p) {
}
RawAccess<IS_NOT_NULL>::oop_store(p, obj);

assert(obj != NULL, "Must be");
if (HeapRegion::is_in_same_region(p, obj)) {
return;
}
HeapRegion* from = _g1h->heap_region_containing(p);
if (!from->is_young()) {
enqueue_card_if_tracked(_g1h->region_attr(obj), p, obj);
}
write_ref_field_post(p, obj);
}

MAYBE_INLINE_EVACUATION
Expand Down
6 changes: 6 additions & 0 deletions src/hotspot/share/gc/g1/g1ParScanThreadState.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,12 @@ class G1ParScanThreadState : public CHeapObj<mtGC> {

void push_on_queue(ScannerTask task);

// Apply the post barrier to the given reference field. Enqueues the card of p
// if the barrier does not filter out the reference for some reason (e.g.
// p and q are in the same region, p is in survivor, p is in collection set)
// To be called during GC if nothing particular about p and obj are known.
template <class T> void write_ref_field_post(T* p, oop obj);

template <class T> void enqueue_card_if_tracked(G1HeapRegionAttr region_attr, T* p, oop o) {
assert(!HeapRegion::is_in_same_region(p, o), "Should have filtered out cross-region references already.");
assert(!_g1h->heap_region_containing(p)->is_young(), "Should have filtered out from-young references already.");
Expand Down
12 changes: 12 additions & 0 deletions src/hotspot/share/gc/g1/g1ParScanThreadState.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,16 @@ G1OopStarChunkedList* G1ParScanThreadState::oops_into_optional_region(const Heap
return &_oops_into_optional_regions[hr->index_in_opt_cset()];
}

template <class T> void G1ParScanThreadState::write_ref_field_post(T* p, oop obj) {
assert(obj != NULL, "Must be");
if (HeapRegion::is_in_same_region(p, obj)) {
return;
}
HeapRegion* from = _g1h->heap_region_containing(p);
if (!from->is_young()) {
enqueue_card_if_tracked(_g1h->region_attr(obj), p, obj);
}
}


#endif // SHARE_GC_G1_G1PARSCANTHREADSTATE_INLINE_HPP
3 changes: 2 additions & 1 deletion src/hotspot/share/gc/parallel/psParallelCompact.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2067,8 +2067,9 @@ class ParallelCompactRefProcProxyTask : public RefProcProxyTask {
assert(worker_id < _max_workers, "sanity");
ParCompactionManager* cm = (_tm == RefProcThreadModel::Single) ? ParCompactionManager::get_vmthread_cm() : ParCompactionManager::gc_thread_compaction_manager(worker_id);
PCMarkAndPushClosure keep_alive(cm);
BarrierEnqueueDiscoveredFieldClosure enqueue;
ParCompactionManager::FollowStackClosure complete_gc(cm, (_tm == RefProcThreadModel::Single) ? nullptr : &_terminator, worker_id);
_rp_task->rp_work(worker_id, PSParallelCompact::is_alive_closure(), &keep_alive, &complete_gc);
_rp_task->rp_work(worker_id, PSParallelCompact::is_alive_closure(), &keep_alive, &enqueue, &complete_gc);
}

void prepare_run_task_hook() override {
Expand Down
5 changes: 3 additions & 2 deletions src/hotspot/share/gc/parallel/psScavenge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,10 @@ class ParallelScavengeRefProcProxyTask : public RefProcProxyTask {
assert(worker_id < _max_workers, "sanity");
PSPromotionManager* promotion_manager = (_tm == RefProcThreadModel::Single) ? PSPromotionManager::vm_thread_promotion_manager() : PSPromotionManager::gc_thread_promotion_manager(worker_id);
PSIsAliveClosure is_alive;
PSKeepAliveClosure keep_alive(promotion_manager);;
PSKeepAliveClosure keep_alive(promotion_manager);
BarrierEnqueueDiscoveredFieldClosure enqueue;
PSEvacuateFollowersClosure complete_gc(promotion_manager, (_marks_oops_alive && _tm == RefProcThreadModel::Multi) ? &_terminator : nullptr, worker_id);;
_rp_task->rp_work(worker_id, &is_alive, &keep_alive, &complete_gc);
_rp_task->rp_work(worker_id, &is_alive, &keep_alive, &enqueue, &complete_gc);
}

void prepare_run_task_hook() override {
Expand Down
3 changes: 2 additions & 1 deletion src/hotspot/share/gc/serial/serialGcRefProcProxyTask.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ class SerialGCRefProcProxyTask : public RefProcProxyTask {

void work(uint worker_id) override {
assert(worker_id < _max_workers, "sanity");
_rp_task->rp_work(worker_id, &_is_alive, &_keep_alive, &_complete_gc);
BarrierEnqueueDiscoveredFieldClosure enqueue;
_rp_task->rp_work(worker_id, &_is_alive, &_keep_alive, &enqueue, &_complete_gc);
}
};

Expand Down
Loading

0 comments on commit f0c27ed

Please sign in to comment.