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

Commit f0c27ed

Browse files
[GR-45725] Merge tag jdk-17.0.7+7 (23.0).
PullRequest: labsjdk-ce-17/111
2 parents 7eea82d + 9a7e3bd commit f0c27ed

File tree

60 files changed

+1116
-241
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+1116
-241
lines changed

ci.jsonnet

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ local labsjdk_builder_version = "2d6e93ddd626e9c0e9c862f1d80a5904e7a9165c";
261261
},
262262

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

266266
local clone_graal = {
267267
run+: [

make/autoconf/flags-cflags.m4

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,8 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER],
640640
# JDK libraries.
641641
STATIC_LIBS_CFLAGS="-DSTATIC_BUILD=1"
642642
if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
643-
STATIC_LIBS_CFLAGS="$STATIC_LIBS_CFLAGS -ffunction-sections -fdata-sections"
643+
STATIC_LIBS_CFLAGS="$STATIC_LIBS_CFLAGS -ffunction-sections -fdata-sections \
644+
-DJNIEXPORT='__attribute__((visibility(\"default\")))'"
644645
else
645646
STATIC_LIBS_CFLAGS="$STATIC_LIBS_CFLAGS -DJNIEXPORT="
646647
fi

make/conf/version-numbers.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved.
33
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
#
55
# This code is free software; you can redistribute it and/or modify it
@@ -39,4 +39,4 @@ DEFAULT_VERSION_CLASSFILE_MINOR=0
3939
DEFAULT_VERSION_DOCS_API_SINCE=11
4040
DEFAULT_ACCEPTABLE_BOOT_VERSIONS="16 17"
4141
DEFAULT_JDK_SOURCE_TARGET_VERSION=17
42-
DEFAULT_PROMOTED_VERSION_PRE=ea
42+
DEFAULT_PROMOTED_VERSION_PRE=

src/hotspot/share/classfile/javaClasses.cpp

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2719,6 +2719,51 @@ void java_lang_Throwable::get_stack_trace_elements(Handle throwable,
27192719
}
27202720
}
27212721

2722+
Handle java_lang_Throwable::get_cause_with_stack_trace(Handle throwable, TRAPS) {
2723+
// Call to JVM to fill in the stack trace and clear declaringClassObject to
2724+
// not keep classes alive in the stack trace.
2725+
// call this: public StackTraceElement[] getStackTrace()
2726+
assert(throwable.not_null(), "shouldn't be");
2727+
2728+
JavaValue result(T_ARRAY);
2729+
JavaCalls::call_virtual(&result, throwable,
2730+
vmClasses::Throwable_klass(),
2731+
vmSymbols::getStackTrace_name(),
2732+
vmSymbols::getStackTrace_signature(),
2733+
CHECK_NH);
2734+
Handle stack_trace(THREAD, result.get_oop());
2735+
assert(stack_trace->is_objArray(), "Should be an array");
2736+
2737+
// Throw ExceptionInInitializerError as the cause with this exception in
2738+
// the message and stack trace.
2739+
2740+
// Now create the message with the original exception and thread name.
2741+
Symbol* message = java_lang_Throwable::detail_message(throwable());
2742+
ResourceMark rm(THREAD);
2743+
stringStream st;
2744+
st.print("Exception %s%s ", throwable()->klass()->name()->as_klass_external_name(),
2745+
message == nullptr ? "" : ":");
2746+
if (message == NULL) {
2747+
st.print("[in thread \"%s\"]", THREAD->name());
2748+
} else {
2749+
st.print("%s [in thread \"%s\"]", message->as_C_string(), THREAD->name());
2750+
}
2751+
2752+
Symbol* exception_name = vmSymbols::java_lang_ExceptionInInitializerError();
2753+
Handle h_cause = Exceptions::new_exception(THREAD, exception_name, st.as_string());
2754+
2755+
// If new_exception returns a different exception while creating the exception, return null.
2756+
if (h_cause->klass()->name() != exception_name) {
2757+
log_info(class, init)("Exception thrown while saving initialization exception %s",
2758+
h_cause->klass()->external_name());
2759+
return Handle();
2760+
}
2761+
java_lang_Throwable::set_stacktrace(h_cause(), stack_trace());
2762+
// Clear backtrace because the stacktrace should be used instead.
2763+
set_backtrace(h_cause(), NULL);
2764+
return h_cause;
2765+
}
2766+
27222767
bool java_lang_Throwable::get_top_method_and_bci(oop throwable, Method** method, int* bci) {
27232768
JavaThread* current = JavaThread::current();
27242769
objArrayHandle result(current, objArrayOop(backtrace(throwable)));

src/hotspot/share/classfile/javaClasses.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -567,6 +567,10 @@ class java_lang_Throwable: AllStatic {
567567
static void fill_in_stack_trace(Handle throwable, const methodHandle& method = methodHandle());
568568
// Programmatic access to stack trace
569569
static void get_stack_trace_elements(Handle throwable, objArrayHandle stack_trace, TRAPS);
570+
571+
// For recreating class initialization error exceptions.
572+
static Handle get_cause_with_stack_trace(Handle throwable, TRAPS);
573+
570574
// Printing
571575
static void print(oop throwable, outputStream* st);
572576
static void print_stack_trace(Handle throwable, outputStream* st);

src/hotspot/share/classfile/systemDictionary.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1626,6 +1626,8 @@ bool SystemDictionary::do_unloading(GCTimer* gc_timer) {
16261626
} else {
16271627
assert(_pd_cache_table->number_of_entries() == 0, "should be empty");
16281628
}
1629+
1630+
InstanceKlass::clean_initialization_error_table();
16291631
}
16301632

16311633
return unloading_occurred;

src/hotspot/share/classfile/vmSymbols.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,7 @@
370370
template(class_initializer_name, "<clinit>") \
371371
template(println_name, "println") \
372372
template(printStackTrace_name, "printStackTrace") \
373+
template(getStackTrace_name, "getStackTrace") \
373374
template(main_name, "main") \
374375
template(name_name, "name") \
375376
template(priority_name, "priority") \
@@ -595,7 +596,9 @@
595596
template(int_String_signature, "(I)Ljava/lang/String;") \
596597
template(boolean_boolean_int_signature, "(ZZ)I") \
597598
template(big_integer_shift_worker_signature, "([I[IIII)V") \
598-
template(reflect_method_signature, "Ljava/lang/reflect/Method;") \
599+
template(reflect_method_signature, "Ljava/lang/reflect/Method;") \
600+
template(getStackTrace_signature, "()[Ljava/lang/StackTraceElement;") \
601+
\
599602
/* signature symbols needed by intrinsics */ \
600603
VM_INTRINSICS_DO(VM_INTRINSIC_IGNORE, VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, template, VM_ALIAS_IGNORE) \
601604
\

src/hotspot/share/gc/g1/g1CollectedHeap.cpp

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3201,6 +3201,31 @@ class G1CopyingKeepAliveClosure: public OopClosure {
32013201
}
32023202
};
32033203

3204+
// Special closure for enqueuing discovered fields: during enqueue the card table
3205+
// may not be in shape to properly handle normal barrier calls (e.g. card marks
3206+
// in regions that failed evacuation, scribbling of various values by card table
3207+
// scan code). Additionally the regular barrier enqueues into the "global"
3208+
// DCQS, but during GC we need these to-be-refined entries in the GC local queue
3209+
// so that after clearing the card table, the redirty cards phase will properly
3210+
// mark all dirty cards to be picked up by refinement.
3211+
class G1EnqueueDiscoveredFieldClosure : public EnqueueDiscoveredFieldClosure {
3212+
G1CollectedHeap* _g1h;
3213+
G1ParScanThreadState* _pss;
3214+
3215+
public:
3216+
G1EnqueueDiscoveredFieldClosure(G1CollectedHeap* g1h, G1ParScanThreadState* pss) : _g1h(g1h), _pss(pss) { }
3217+
3218+
virtual void enqueue(HeapWord* discovered_field_addr, oop value) {
3219+
assert(_g1h->is_in(discovered_field_addr), PTR_FORMAT " is not in heap ", p2i(discovered_field_addr));
3220+
// Store the value first, whatever it is.
3221+
RawAccess<>::oop_store(discovered_field_addr, value);
3222+
if (value == NULL) {
3223+
return;
3224+
}
3225+
_pss->write_ref_field_post(discovered_field_addr, value);
3226+
}
3227+
};
3228+
32043229
// Serial drain queue closure. Called as the 'complete_gc'
32053230
// closure for each discovered list in some of the
32063231
// reference processing phases.
@@ -3245,7 +3270,8 @@ class G1STWRefProcProxyTask : public RefProcProxyTask {
32453270
G1STWIsAliveClosure is_alive(&_g1h);
32463271
G1CopyingKeepAliveClosure keep_alive(&_g1h, _pss.state_for_worker(index));
32473272
G1ParEvacuateFollowersClosure complete_gc(&_g1h, _pss.state_for_worker(index), &_task_queues, _tm == RefProcThreadModel::Single ? nullptr : &_terminator, G1GCPhaseTimes::ObjCopy);
3248-
_rp_task->rp_work(worker_id, &is_alive, &keep_alive, &complete_gc);
3273+
G1EnqueueDiscoveredFieldClosure enqueue(&_g1h, _pss.state_for_worker(index));
3274+
_rp_task->rp_work(worker_id, &is_alive, &keep_alive, &enqueue, &complete_gc);
32493275
}
32503276

32513277
void prepare_run_task_hook() override {

src/hotspot/share/gc/g1/g1ConcurrentMark.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1478,8 +1478,9 @@ class G1CMRefProcProxyTask : public RefProcProxyTask {
14781478
G1CMIsAliveClosure is_alive(&_g1h);
14791479
uint index = (_tm == RefProcThreadModel::Single) ? 0 : worker_id;
14801480
G1CMKeepAliveAndDrainClosure keep_alive(&_cm, _cm.task(index), _tm == RefProcThreadModel::Single);
1481+
BarrierEnqueueDiscoveredFieldClosure enqueue;
14811482
G1CMDrainMarkingStackClosure complete_gc(&_cm, _cm.task(index), _tm == RefProcThreadModel::Single);
1482-
_rp_task->rp_work(worker_id, &is_alive, &keep_alive, &complete_gc);
1483+
_rp_task->rp_work(worker_id, &is_alive, &keep_alive, &enqueue, &complete_gc);
14831484
}
14841485

14851486
void prepare_run_task_hook() override {

src/hotspot/share/gc/g1/g1FullCollector.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,9 @@ class G1FullGCRefProcProxyTask : public RefProcProxyTask {
259259
G1IsAliveClosure is_alive(&_collector);
260260
uint index = (_tm == RefProcThreadModel::Single) ? 0 : worker_id;
261261
G1FullKeepAliveClosure keep_alive(_collector.marker(index));
262+
BarrierEnqueueDiscoveredFieldClosure enqueue;
262263
G1FollowStackClosure* complete_gc = _collector.marker(index)->stack_closure();
263-
_rp_task->rp_work(worker_id, &is_alive, &keep_alive, complete_gc);
264+
_rp_task->rp_work(worker_id, &is_alive, &keep_alive, &enqueue, complete_gc);
264265
}
265266
};
266267

0 commit comments

Comments
 (0)