On Mon, 13 Mar 2023 06:22:21 GMT, David Holmes <dhol...@openjdk.org> wrote:

>> Markus Grönlund has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   more cleanup
>
> src/hotspot/share/prims/agent.cpp line 34:
> 
>> 32: }
>> 33: 
>> 34: static const char* allocate_copy(const char* str) {
> 
> Why not just use `os::strdup`?

Better alternative, thanks David.

> src/hotspot/share/prims/agentList.cpp line 227:
> 
>> 225:  * store data in their JvmtiEnv local storage.
>> 226:  *
>> 227:  * Please see JPLISAgent.c in module java.instrument, see JPLISAgent.h 
>> and JPLISAgent.c.
> 
> No need to mention the .c file twice.

Good point.

> src/hotspot/share/prims/agentList.cpp line 419:
> 
>> 417:     const jint err = (*on_load_entry)(&main_vm, 
>> const_cast<char*>(agent->options()), NULL);
>> 418:     if (err != JNI_OK) {
>> 419:       vm_exit_during_initialization("-Xrun library failed to init", 
>> agent->name());
> 
> Do you need to be back in `_thread_in_vm` before exiting?

Hmm. This was ported as is. I will double-check.

> src/hotspot/share/prims/agentList.cpp line 542:
> 
>> 540: 
>> 541:   // Invoke the Agent_OnAttach function
>> 542:   JavaThread* THREAD = JavaThread::current(); // For exception macros.
> 
> Nit: just use `current` rather than `THREAD` and don't use the exception 
> macros.

Ported as is but good point, will update.

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

PR: https://git.openjdk.org/jdk/pull/12923

Reply via email to