Help with generating library call

Andrew Haley aph at
Mon Jul 31 08:18:02 UTC 2017

On 31/07/17 05:33, Rohit Arul Raj wrote:
> Can any one point me in the right direction? Any reference to similar
> implementation of any other C or Math library function will be
> helpful?
> I ended up doing the following, but not sure if this is the right way
> to go about it.
> push (c_rarg2);
> push (c_rarg1);
> push (c_rarg0);
> call_VM_leaf(CAST_FROM_FN_PTR(address, memset),3);

This doesn't look totally wrong.

There are many examples in the source.  For example, look at any calls
to MacroAssembler::call_VM and call_VM_leaf.  Be aware, however, that
if you're calling this from compiled code most registers are live so
you're going to have to be extremely careful to save and restore them.
One of the advantages of using HotSpot's builtins for zeroing is that
we can know exactly which registers are used.

Andrew Haley
Java Platform Lead Engineer
Red Hat UK Ltd. <>
EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671

More information about the hotspot-dev mailing list