On Tue, 16 Apr 2024 16:33:18 GMT, Coleen Phillimore <cole...@openjdk.org> wrote:

>> Vladimir Kozlov has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   Use 16-bits types for header_size and frame_complete_offset arguments
>
> src/hotspot/share/code/codeBlob.cpp line 106:
> 
>> 104: 
>> 105: // Simple CodeBlob used for simple BufferBlob.
>> 106: CodeBlob::CodeBlob(const char* name, CodeBlobKind kind, int size, 
>> uint16_t header_size) :
> 
> Just a drive-by comment.  You might be able to use delegating constructors 
> for CodeBlob so you don't have to have the field initializations twice.  
> Maybe the same for nmethod ?

Thank you, @coleenp, foe looking on these changes.

Which fields are initialized twice? Only `_oop_maps` is set to `nullptr` before 
we proper build oop maps in first constructor.

The only saving could be lines of code but then I would have to check that `cb 
!= nullptr` and do other additional checks which I don't think will save much 
lines.

Separation of `nmethod` constructor for native wrappers is helping clear see 
the difference and I would like to keep them separate. We have 
`init_defaults()` method for similar code and I can move more code into it from 
both constructors.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18768#discussion_r1567814189

Reply via email to