Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions make/modules/jdk.crypto.cryptoki/Lib.gmk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 2026, 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 @@ -35,8 +35,6 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBJ2PKCS11, \
NAME := j2pkcs11, \
OPTIMIZATION := LOW, \
EXTRA_HEADER_DIRS := java.base:libjava, \
DISABLED_WARNINGS_gcc_p11_md.c := unused-variable, \
DISABLED_WARNINGS_clang_p11_md.c := unused-variable, \
DISABLED_WARNINGS_clang_p11_util.c := format-nonliteral, \
LIBS_unix := $(LIBDL), \
))
Expand Down
10 changes: 8 additions & 2 deletions src/hotspot/cpu/aarch64/vm_version_aarch64.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2020, Red Hat Inc. All rights reserved.
* Copyright 2025 Arm Limited and/or its affiliates.
* 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 @@ -223,10 +224,13 @@ void VM_Version::initialize() {
// Neoverse
// N1: 0xd0c
// N2: 0xd49
// N3: 0xd8e
// V1: 0xd40
// V2: 0xd4f
// V3: 0xd84
if (_cpu == CPU_ARM && (model_is(0xd0c) || model_is(0xd49) ||
model_is(0xd40) || model_is(0xd4f))) {
model_is(0xd40) || model_is(0xd4f) ||
model_is(0xd8e) || model_is(0xd84))) {
if (FLAG_IS_DEFAULT(UseSIMDForMemoryOps)) {
FLAG_SET_DEFAULT(UseSIMDForMemoryOps, true);
}
Expand Down Expand Up @@ -261,7 +265,9 @@ void VM_Version::initialize() {
// Neoverse
// V1: 0xd40
// V2: 0xd4f
if (_cpu == CPU_ARM && (model_is(0xd40) || model_is(0xd4f))) {
// V3: 0xd84
if (_cpu == CPU_ARM &&
(model_is(0xd40) || model_is(0xd4f) || model_is(0xd84))) {
if (FLAG_IS_DEFAULT(UseCryptoPmullForCRC32)) {
FLAG_SET_DEFAULT(UseCryptoPmullForCRC32, true);
}
Expand Down
21 changes: 21 additions & 0 deletions src/hotspot/cpu/riscv/riscv.ad
Original file line number Diff line number Diff line change
Expand Up @@ -1608,6 +1608,27 @@ uint MachSpillCopyNode::implementation(C2_MacroAssembler *masm, PhaseRegAlloc *r
int src_offset = ra_->reg2offset(src_lo);
int dst_offset = ra_->reg2offset(dst_lo);

// Stack-to-stack copies use t0 for the value. Bail out if a destination
// address also needs t0 to materialize an offset outside the 12-bit range.
if (src_lo_rc == rc_stack && dst_lo_rc == rc_stack) {
int last_dst_offset = dst_offset;
if (bottom_type()->isa_vectmask()) {
int vmask_size_in_bytes = Matcher::scalable_predicate_reg_slots() * 32 / 8;
last_dst_offset += vmask_size_in_bytes - 4;
} else if (ideal_reg() == Op_VecA) {
int vector_reg_size_in_bytes = Matcher::scalable_vector_reg_size(T_BYTE);
last_dst_offset += vector_reg_size_in_bytes - 8;
}

if (masm != nullptr && !Assembler::is_simm12(last_dst_offset)) {
// size() emits into a scratch buffer where recording a failure is not allowed.
if (!C->output()->in_scratch_emit_size()) {
C->record_method_not_compilable("unsupported large stack-to-stack spill copy");
}
return 0;
}
}

if (bottom_type()->isa_vect() != nullptr) {
uint ireg = ideal_reg();
if (ireg == Op_VecA && masm) {
Expand Down
6 changes: 3 additions & 3 deletions src/hotspot/share/gc/g1/g1OopClosures.inline.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2025, 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 @@ -50,8 +50,8 @@ inline void G1ScanClosureBase::prefetch_and_push(T* p, const oop obj) {
// stall. We'll try to prefetch the object (for write, given that
// we might need to install the forwarding reference) and we'll
// get back to it when pop it from the queue
Prefetch::write(obj->mark_addr(), 0);
Prefetch::read(obj->mark_addr(), (HeapWordSize*2));
Prefetch::write(obj->base_addr(), oopDesc::mark_offset_in_bytes());
Prefetch::read(obj->base_addr(), oopDesc::mark_offset_in_bytes() + (HeapWordSize*2));

// slightly paranoid test; I'm trying to catch potential
// problems before we go into push_on_queue to know where the
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/gc/parallel/psPromotionManager.inline.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2025, 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 @@ -61,7 +61,7 @@ inline void PSPromotionManager::claim_or_forward_depth(T* p) {
if (PSScavenge::is_obj_in_young(heap_oop)) {
oop obj = CompressedOops::decode_not_null(heap_oop);
assert(!PSScavenge::is_obj_in_to_space(obj), "revisiting object?");
Prefetch::write(obj->mark_addr(), 0);
Prefetch::write(obj->base_addr(), oopDesc::mark_offset_in_bytes());
push_depth(ScannerTask(p));
}
}
Expand Down
27 changes: 15 additions & 12 deletions src/hotspot/share/gc/shenandoah/shenandoahControlThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -307,22 +307,25 @@ void ShenandoahControlThread::service_concurrent_normal_cycle(GCCause::Cause cau
}

bool ShenandoahControlThread::check_cancellation_or_degen(ShenandoahGC::ShenandoahDegenPoint point) {
// Only read the cancellation cause once. Other threads may change it.
ShenandoahHeap* heap = ShenandoahHeap::heap();
if (heap->cancelled_gc()) {
if (heap->cancelled_cause() == GCCause::_shenandoah_stop_vm) {
return true;
}
const GCCause::Cause cancelled_cause = heap->cancelled_cause();
if (cancelled_cause == GCCause::_no_gc) {
return false;
}

if (ShenandoahCollectorPolicy::is_allocation_failure(heap->cancelled_cause())) {
assert (_degen_point == ShenandoahGC::_degenerated_outside_cycle,
"Should not be set yet: %s", ShenandoahGC::degen_point_to_string(_degen_point));
_degen_point = point;
return true;
}
if (cancelled_cause == GCCause::_shenandoah_stop_vm) {
return true;
}

fatal("Unexpected reason for cancellation: %s", GCCause::to_string(heap->cancelled_cause()));
if (ShenandoahCollectorPolicy::is_allocation_failure(cancelled_cause)) {
assert (_degen_point == ShenandoahGC::_degenerated_outside_cycle,
"Should not be set yet: %s", ShenandoahGC::degen_point_to_string(_degen_point));
_degen_point = point;
return true;
}
return false;

fatal("Unexpected reason for cancellation: %s", GCCause::to_string(cancelled_cause));
}

void ShenandoahControlThread::stop_service() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -581,28 +581,31 @@ void ShenandoahGenerationalControlThread::service_concurrent_cycle(ShenandoahGen
}

bool ShenandoahGenerationalControlThread::check_cancellation_or_degen(ShenandoahGC::ShenandoahDegenPoint point) {
if (!_heap->cancelled_gc()) {
// Only read the cancellation cause once. Other threads may change it.
const GCCause::Cause cancelled_cause = _heap->cancelled_cause();
if (cancelled_cause == GCCause::_no_gc) {
return false;
}

if (_heap->cancelled_cause() == GCCause::_shenandoah_stop_vm
|| _heap->cancelled_cause() == GCCause::_shenandoah_concurrent_gc) {
log_debug(gc, thread)("Cancellation detected, reason: %s", GCCause::to_string(_heap->cancelled_cause()));
if (cancelled_cause == GCCause::_shenandoah_stop_vm
|| cancelled_cause == GCCause::_shenandoah_concurrent_gc) {
log_debug(gc, thread)("Cancellation detected, reason: %s", GCCause::to_string(cancelled_cause));
return true;
}

if (ShenandoahCollectorPolicy::is_allocation_failure(_heap->cancelled_cause())) {
if (ShenandoahCollectorPolicy::is_allocation_failure(cancelled_cause)) {
assert(_degen_point == ShenandoahGC::_degenerated_unset,
"Should not be set yet: %s", ShenandoahGC::degen_point_to_string(_degen_point));
MonitorLocker ml(&_control_lock, Mutex::_no_safepoint_check_flag);
_requested_gc_cause = cancelled_cause;
_degen_point = point;
log_debug(gc, thread)("Cancellation detected:, reason: %s, degen point: %s",
GCCause::to_string(_heap->cancelled_cause()),
GCCause::to_string(cancelled_cause),
ShenandoahGC::degen_point_to_string(_degen_point));
return true;
}

fatal("Cancel GC either for alloc failure GC, or gracefully exiting, or to pause old generation marking");
return false;
}

void ShenandoahGenerationalControlThread::service_stw_full_cycle(GCCause::Cause cause) {
Expand Down
14 changes: 12 additions & 2 deletions src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2224,8 +2224,18 @@ size_t ShenandoahHeap::tlab_used(Thread* thread) const {
}

bool ShenandoahHeap::try_cancel_gc(GCCause::Cause cause) {
const GCCause::Cause prev = _cancelled_gc.xchg(cause);
return prev == GCCause::_no_gc || prev == GCCause::_shenandoah_concurrent_gc;
while (true) {
const GCCause::Cause prev = _cancelled_gc.get();
if (prev != GCCause::_no_gc && prev != GCCause::_shenandoah_concurrent_gc && cause != GCCause::_shenandoah_stop_vm) {
// Only when the gc has not been cancelled, or it has been cancelled to interrupt an old marking cycle
// do we allow the new cancellation request to happen. We make an exception for stopping the VM.
return false;
}

if (_cancelled_gc.cmpxchg(cause, prev) == prev) {
return true;
}
}
}

void ShenandoahHeap::cancel_concurrent_mark() {
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/gc/shenandoah/shenandoahMark.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ class ShenandoahMark: public StackObj {
inline void do_task(ShenandoahObjToScanQueue* q, T* cl, ShenandoahLiveData* live_data, StringDedup::Requests* const req, ShenandoahMarkTask* task, uint worker_id);

template <class T>
inline void do_chunked_array_start(ShenandoahObjToScanQueue* q, T* cl, oop array, bool weak);
inline void do_chunked_array_start(ShenandoahObjToScanQueue* q, T* cl, oop array, Klass* klass, bool weak);

template <class T>
inline void do_chunked_array(ShenandoahObjToScanQueue* q, T* cl, oop array, int chunk, int pow, bool weak);

template <ShenandoahGenerationType GENERATION>
inline void count_liveness(ShenandoahLiveData* live_data, oop obj, uint worker_id);
inline void count_liveness(ShenandoahLiveData* live_data, oop obj, Klass* klass, uint worker_id);

template <class T, ShenandoahGenerationType GENERATION, bool CANCELLABLE, StringDedupMode STRING_DEDUP>
void mark_loop_work(T* cl, ShenandoahLiveData* live_data, uint worker_id, TaskTerminator *t, StringDedup::Requests* const req);
Expand Down
21 changes: 11 additions & 10 deletions src/hotspot/share/gc/shenandoah/shenandoahMark.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,31 +75,32 @@ void ShenandoahMark::do_task(ShenandoahObjToScanQueue* q, T* cl, ShenandoahLiveD
cl->set_weak(weak);

if (task->is_not_chunked()) {
if (obj->is_instance()) {
Klass* klass = obj->klass();
if (klass->is_instance_klass()) {
// Case 1: Normal oop, process as usual.
if (obj->is_stackChunk()) {
if (klass->is_stack_chunk_instance_klass()) {
// Loom doesn't support mixing of weak marking and strong marking of stack chunks.
cl->set_weak(false);
}

obj->oop_iterate(cl);
dedup_string<STRING_DEDUP>(obj, req);
} else if (obj->is_objArray()) {
} else if (klass->is_objArray_klass()) {
// Case 2: Object array instance and no chunk is set. Must be the first
// time we visit it, start the chunked processing.
do_chunked_array_start<T>(q, cl, obj, weak);
do_chunked_array_start<T>(q, cl, obj, klass, weak);
} else {
// Case 3: Primitive array. Do nothing, no oops there. We use the same
// performance tweak TypeArrayKlass::oop_oop_iterate_impl is using:
// We skip iterating over the klass pointer since we know that
// Universe::TypeArrayKlass never moves.
assert (obj->is_typeArray(), "should be type array");
assert(klass->is_typeArray_klass(), "should be type array");
}
// Count liveness the last: push the outstanding work to the queues first
// Avoid double-counting objects that are visited twice due to upgrade
// from final- to strong mark.
if (task->count_liveness()) {
count_liveness<GENERATION>(live_data, obj, worker_id);
count_liveness<GENERATION>(live_data, obj, klass, worker_id);
}
} else {
// Case 4: Array chunk, has sensible chunk id. Process it.
Expand All @@ -108,11 +109,11 @@ void ShenandoahMark::do_task(ShenandoahObjToScanQueue* q, T* cl, ShenandoahLiveD
}

template <ShenandoahGenerationType GENERATION>
inline void ShenandoahMark::count_liveness(ShenandoahLiveData* live_data, oop obj, uint worker_id) {
inline void ShenandoahMark::count_liveness(ShenandoahLiveData* live_data, oop obj, Klass* klass, uint worker_id) {
const ShenandoahHeap* const heap = ShenandoahHeap::heap();
const size_t region_idx = heap->heap_region_index_containing(obj);
ShenandoahHeapRegion* const region = heap->get_region(region_idx);
const size_t size = obj->size();
const size_t size = obj->size_given_klass(klass);

// Age census for objects in the young generation
if (GENERATION == YOUNG || (GENERATION == GLOBAL && region->is_young())) {
Expand Down Expand Up @@ -152,14 +153,14 @@ inline void ShenandoahMark::count_liveness(ShenandoahLiveData* live_data, oop ob
}

template <class T>
inline void ShenandoahMark::do_chunked_array_start(ShenandoahObjToScanQueue* q, T* cl, oop obj, bool weak) {
inline void ShenandoahMark::do_chunked_array_start(ShenandoahObjToScanQueue* q, T* cl, oop obj, Klass* klass, bool weak) {
assert(obj->is_objArray(), "expect object array");
objArrayOop array = objArrayOop(obj);
int len = array->length();

// Mark objArray klass metadata
if (Devirtualizer::do_metadata(cl)) {
Devirtualizer::do_klass(cl, array->klass());
Devirtualizer::do_klass(cl, klass);
}

if (len <= (int) ObjArrayMarkingStride*2) {
Expand Down
4 changes: 3 additions & 1 deletion src/hotspot/share/oops/oop.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,11 @@ class oopDesc {
// Must be trivial; see verifying static assert after the class.
oopDesc() = default;

inline void* base_addr();
inline const void* base_addr() const;

inline markWord mark() const;
inline markWord mark_acquire() const;
inline markWord* mark_addr() const;

inline void set_mark(markWord m);
static inline void set_mark(HeapWord* mem, markWord m);
Expand Down
7 changes: 3 additions & 4 deletions src/hotspot/share/oops/oop.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@
// Implementation of all inlined member functions defined in oop.hpp
// We need a separate file to avoid circular references

void* oopDesc::base_addr() { return this; }
const void* oopDesc::base_addr() const { return this; }

markWord oopDesc::mark() const {
return Atomic::load(&_mark);
}
Expand All @@ -55,10 +58,6 @@ markWord oopDesc::mark_acquire() const {
return Atomic::load_acquire(&_mark);
}

markWord* oopDesc::mark_addr() const {
return (markWord*) &_mark;
}

void oopDesc::set_mark(markWord m) {
Atomic::store(&_mark, m);
}
Expand Down
40 changes: 20 additions & 20 deletions src/jdk.crypto.cryptoki/unix/native/libj2pkcs11/p11_md.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2026, Oracle and/or its affiliates. All rights reserved.
*/

/* Copyright (c) 2002 Graz University of Technology. All rights reserved.
Expand Down Expand Up @@ -79,10 +79,6 @@ JNIEXPORT jobject JNICALL Java_sun_security_pkcs11_wrapper_PKCS11_connect
jstring jGetFunctionList) {

void *hModule;
int i;
CK_ULONG ulCount = 0;
CK_C_GetInterfaceList C_GetInterfaceList = NULL;
CK_INTERFACE_PTR iList = NULL;
CK_C_GetInterface C_GetInterface = NULL;
CK_INTERFACE_PTR interface = NULL;
CK_C_GetFunctionList C_GetFunctionList = NULL;
Expand Down Expand Up @@ -124,27 +120,31 @@ JNIEXPORT jobject JNICALL Java_sun_security_pkcs11_wrapper_PKCS11_connect
}

#ifdef DEBUG
C_GetInterfaceList = (CK_C_GetInterfaceList) dlsym(hModule,
"C_GetInterfaceList");
CK_C_GetInterfaceList C_GetInterfaceList = (CK_C_GetInterfaceList) dlsym(hModule, "C_GetInterfaceList");
if (C_GetInterfaceList != NULL) {
CK_ULONG ulCount = 0;
TRACE0("Connect: Found C_GetInterfaceList func\n");
rv = (C_GetInterfaceList)(NULL, &ulCount);
if (rv == CKR_OK) {
TRACE1("Connect: interface list size %ld \n", ulCount);
// retrieve available interfaces and report their info
iList = (CK_INTERFACE_PTR)
malloc(ulCount*sizeof(CK_INTERFACE));
rv = C_GetInterfaceList(iList, &ulCount);
if (ckAssertReturnValueOK(env, rv) != CK_ASSERT_OK) {
TRACE0("Connect: error polling interface list\n");
goto cleanup;
}
for (i=0; i < (int)ulCount; i++) {
TRACE4("Connect: name %s, version %d.%d, flags 0x%lX\n",
iList[i].pInterfaceName,
((CK_VERSION *)iList[i].pFunctionList)->major,
((CK_VERSION *)iList[i].pFunctionList)->minor,
iList[i].flags);
CK_INTERFACE_PTR iList = (CK_INTERFACE_PTR) malloc(ulCount*sizeof(CK_INTERFACE));
if (iList == NULL) {
TRACE0("Connect: error allocating interface list\n");
} else {
rv = C_GetInterfaceList(iList, &ulCount);
if (ckAssertReturnValueOK(env, rv) != CK_ASSERT_OK) {
TRACE0("Connect: error polling interface list\n");
goto cleanup;
}
for (int i=0; i < (int)ulCount; i++) {
TRACE4("Connect: name %s, version %d.%d, flags 0x%lX\n",
iList[i].pInterfaceName,
((CK_VERSION *)iList[i].pFunctionList)->major,
((CK_VERSION *)iList[i].pFunctionList)->minor,
iList[i].flags);
}
free(iList);
}
} else {
TRACE0("Connect: error polling interface list size\n");
Expand Down
Loading
Loading