x86-64 stub calling convention

Deneau, Tom tom.deneau at amd.com
Sat Jun 30 19:08:35 PDT 2012

OK, thanks, Vladimir.
Is there a good reason for using the OS's C calling convention for stubs?
(as opposed to, say, using whatever makes the most sense for Java).

-- Tom

-----Original Message-----
From: Vladimir Kozlov [mailto:vladimir.kozlov at oracle.com] 
Sent: Friday, June 29, 2012 10:46 PM
To: Krystal Mok
Cc: Deneau, Tom; hotspot-compiler-dev at openjdk.java.net
Subject: Re: x86-64 stub calling convention

I was not right that you can use all XMM registers. On windows64 only xmm0-xmm5 are available free, the rest are SOE 
(save on entry). For stabs calls we use C calling convention. It is described in .ad file where XMM registers are 
defined (second parameter):

// Linux ABI:   No register preserved across function calls
//              XMM0-XMM7 might hold parameters
// Windows ABI: XMM6-XMM15 preserved across function calls
//              XMM0-XMM3 might hold parameters

reg_def XMM5   (SOC, SOC, Op_RegF,  5, xmm5->as_VMReg());
reg_def XMM5_H (SOC, SOC, Op_RegF,  5, xmm5->as_VMReg()->next());

#ifdef _WIN64

reg_def XMM6   (SOC, SOE, Op_RegF,  6, xmm6->as_VMReg());
reg_def XMM6_H (SOC, SOE, Op_RegF,  6, xmm6->as_VMReg()->next());


reg_def XMM6   (SOC, SOC, Op_RegF,  6, xmm6->as_VMReg());
reg_def XMM6_H (SOC, SOC, Op_RegF,  6, xmm6->as_VMReg()->next());


On 6/29/12 7:25 PM, Krystal Mok wrote:
> Hi Tom,
> This is something I'd like to get an answer to, too. I did see in a comment in one of the older changes [1][2] that:
> +       // Spill because stubs can use any register they like and it's
> +       // easier to restore just those that we care about.
> Which doesn't really sound reassuring...
> - Kris
> [1]: http://hg.openjdk.java.net/hsx/hotspot-comp/hotspot/rev/28263a73ebfb
> [2]: http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/2011-May/005623.html
> On Sat, Jun 30, 2012 at 9:27 AM, Deneau, Tom <tom.deneau at amd.com <mailto:tom.deneau at amd.com>> wrote:
>     Hi --
>     Can someone point me to the x86-64 calling convention for stubs created
>     by stubGenerator?  In particular, which xmm registers if any must be preserved
>     and which are volatile.
>     -- Tom Deneau

More information about the hotspot-compiler-dev mailing list