RFR: JDK-8294947: Use 64bit atomics in patch_verified_entry on x86_64

Dmitry Samersoff dsamersoff at openjdk.org
Fri Nov 11 11:47:33 UTC 2022


On Thu, 10 Nov 2022 02:37:50 GMT, Dean Long <dlong at openjdk.org> wrote:

>> src/hotspot/cpu/x86/nativeInst_x86.cpp line 514:
>> 
>>> 512:   // complete jump instruction (to be inserted) is in code_buffer;
>>> 513: #ifdef AMD64
>>> 514:   unsigned char code_buffer[8];
>> 
>> Should we align this buffer too (to 8/jlong)?
>
> I suggest using a union.

@dean-long  
Complete decomposition to union, like one below, looks really nice, but requires gcc-specific attribute, that I would like to avoid. 

  union {
    jlong cb_long;
    struct {
      char code;
      int32_t disp;
    } __attribute__((packed)) instr;
  } u;
  ```
  Do you prefer  
  
  ```
  union {
    jlong cb_long;
    unsigned char code_buffer[8];
 } u;
 ``` 
 over the cast that is similar to one in 32bit version?

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

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


More information about the hotspot-compiler-dev mailing list