RFR 8222243 [lworld] Calling convention - C2 to C1 (fixed point params only)

Ioi Lam ioi.lam at oracle.com
Wed Apr 10 05:56:57 UTC 2019


https://bugs.openjdk.java.net/browse/JDK-8222243
http://cr.openjdk.java.net/~iklam/valhalla/8222243-c2-calls-c1-fixed-point-params.v01/

Implement Method::verified_entry and Method::verified_value_ro_entry for 
C1-compiled methods. This allows C2 to call C1 with scalarized parameters.

In this RFR, we only support passing of fixed point parameters (boolean, 
byte, char, short, int and long), along with value objects that contain 
fields of these types. Support for other types of parameters/fields will 
be implemented in subsequent steps.

The C1 code uses the same functionality as the code in sharedRuntime.cpp 
that handles the signature of the different compiled entries. Hence, I 
refactored the code into a new class CompiledEntrySignature.

The code is littered with lots of FIXME (no support for floats, oops, 
GC, etc). I intend to fix those soon.

Thanks
- Ioi

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

Example of parameter shuffling in C1 verified_entry

static void test(int a, Point p, int b) {...}

C2 passes outgoing parameters as

   # parm0:    rsi       = int a
   # parm1:    rdx       = int p.x
   # parm2:    rcx       = int p.y
   # parm3:    r8        = int b


C1 expects incoming parameters as

   # parm0:    rsi       = int   a
   # parm1:    rdx       = Point p
   # parm2:    rcx       = int   b


The C1 Verified Entry Point will pack the scalarized parameters (p.x,
p.y) back into a Point reference, and shuffle the rest of the params:

     0: push   %rbp
     1: sub    $0x30,%rsp
     5: mov    $0x7f0b154f9448,%rbx  ; Method test(IQPoint;I)
    15: callq  0x00007f0b4c7d2cc0    ;  {runtime_call buffer_value_args}
                                     ;  no need to shuffle rsi (a)
    20: mov    0x10(%rax),%r11d
    24: shl    $0x3,%r11             ;  r11 = p
    28: mov    %edx,0x10(%r11)       ;  set p.x
    32: mov    %ecx,0x14(%r11)       ;  set p.y
    36: mov    %r11,%rdx             ;  rdx = p
    39: mov    %r8,%rcx              ;  rcx = a
    42: pop    %rbp
    43: add    $0x30,%rsp
    47: jmpq   verified_value_entry






More information about the valhalla-dev mailing list