On Wed, 25 Oct 2023 09:13:56 GMT, Aleksey Shipilev <sh...@openjdk.org> wrote:
>> Explicitly handle UpcallStub allocation failures by terminating. We >> currently might try to use the returned `nullptr` which would fail sooner or >> later. This patch just makes the termination explicit. > > src/hotspot/share/code/codeBlob.cpp line 761: > >> 759: MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); >> 760: blob = new (size) UpcallStub(name, cb, size, receiver, >> frame_data_offset); >> 761: if (blob == nullptr) { > > I think it would be safer to call into `fatal` without having > `CodeCache_lock` held. Move it out of `MutexLocker` scope? This pattern follows what is done in `RuntimeStub::new_runtime_stub`, which also calls `fatal` under the lock. I agree it's probably better to call outside of the lock (and that is something I noticed in the original change for RuntimeStub as well). I'm happy to fix it for both. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/16311#discussion_r1371450770