RFR: 8338007: [JVMCI] ResolvedJavaMethod.reprofile can crash ciMethodData
    Tom Rodriguez 
    never at openjdk.org
       
    Tue Oct 29 17:31:15 UTC 2024
    
    
  
On Tue, 29 Oct 2024 17:05:26 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:
>> Graal unit testing uses ResolvedJavaMethod.reprofile to reset profiles between test but the current code rewrites the layout in a non-atomic way which can break other readers.  Instead perform the reinitialization at a safepoint which should protect all readers from seeing any transient initialization states.
>
> src/hotspot/share/oops/methodData.cpp line 66:
> 
>> 64:   temp._header._struct._tag = tag;
>> 65:   temp._header._struct._bci = bci;
>> 66:   _header = temp._header;  // Write the cell atomtically
> 
> Should we use `Atomic::store()` here?
I don't think it's necessary.  It just needs to write the whole value once instead of performing 3 writes of differing sizes to the same cell.  The value being written is always that same as the value that was already there from the original initialization.  Maybe `atomically` is the wrong comment.  Maybe `Write the cell as an intptr_t unit`?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/21746#discussion_r1821274798
    
    
More information about the graal-dev
mailing list