-
Enhancement
-
Resolution: Fixed
-
P4
-
17, 21, 22
-
b11
The constructor of MemAllocator::Allocation calls JavaThread::current()
https://github.com/openjdk/jdk/blob/a9d21c61fb12a11e18c6bb8aa903e5a8e42473f1/src/hotspot/share/gc/shared/memAllocator.cpp#L73
Allocation(const MemAllocator& allocator, oop* obj_ptr)
: _allocator(allocator),
_thread(JavaThread::current()),
This can cause slow down when we allocate a lot of objects inside a tight loop in native code (E.g.,JDK-8310823)
Since the code assumes that the current thread by a Java thread, we can replace the JavaThread::current() call with:
assert(Thread::current()->is_Java_thread(), "must be used by JavaThreads only");
assert(Thread::current() == allocator._thread, "must be");
_thread = JavaThread::cast(allocator._thread);
https://github.com/openjdk/jdk/blob/a9d21c61fb12a11e18c6bb8aa903e5a8e42473f1/src/hotspot/share/gc/shared/memAllocator.cpp#L73
Allocation(const MemAllocator& allocator, oop* obj_ptr)
: _allocator(allocator),
_thread(JavaThread::current()),
This can cause slow down when we allocate a lot of objects inside a tight loop in native code (E.g.,
Since the code assumes that the current thread by a Java thread, we can replace the JavaThread::current() call with:
assert(Thread::current()->is_Java_thread(), "must be used by JavaThreads only");
assert(Thread::current() == allocator._thread, "must be");
_thread = JavaThread::cast(allocator._thread);
- relates to
-
JDK-8310823 CDS archived object streaming
- Closed