RFR: Implement JEP 509: JFR CPU-Time Profiling [v45]

Johan Sjölen jsjolen at openjdk.org
Mon May 5 13:29:57 UTC 2025


On Mon, 5 May 2025 13:20:44 GMT, Johannes Bechberger <jbechberger at openjdk.org> wrote:

>> ```c++
>> struct Node { volatile Node* next; int x; static volatile Node* get_next(Node& n)  { return n->next; } }
>> static Node nodes[16];
>> static i = 0;
>> Node* alloc() {
>>   return nodes[i++]:
>> }
>> 
>> void foo() {
>>   LockFreeStack<Node, Node::get_next> lfs;
>>   Node* n = alloc();
>>   n->x = 0;
>>   lfs.push(n*);
>>   Node* n2 = lfs.top();
>>   tty->print_cr("%d\n", n2->x);
>>   lfs.pop();
>> }
>
> Wouldn't this defeat its purpose? I would need to get the next free element from an array whenever I want to enqueue.

But eh, if I'm reading Zenghyu's comments correctly then what I'm saying doesn't matter???

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/20752#discussion_r2073440671


More information about the hotspot-dev mailing list