[foreign-memaccess+abi] RFR: 8262118: Specialize upcalls [v2]

Maurizio Cimadamore mcimadamore at openjdk.java.net
Tue Feb 23 13:04:53 UTC 2021


On Tue, 23 Feb 2021 12:53:58 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> When trying this on my machine (Ubuntu 20.04) I get this:
>> In file included from ../../src/hotspot/share/prims/foreign_globals.cpp:25:
>> ../../src/hotspot/share/prims/foreign_globals.hpp:40:46: error: 'VMRegPair' has not been declared
>>    40 |   void calling_convention(BasicType* sig_bt, VMRegPair *parm_regs, uint argcnt) const;
>>       |                                              ^~~~~~~~~
>> ../../src/hotspot/share/prims/foreign_globals.cpp:102:6: error: no declaration matches 'void CallRegs::calling_convention(BasicType*, VMRegPair*, uint) const'
>>   102 | void CallRegs::calling_convention(BasicType* sig_bt, VMRegPair *parm_regs, uint argcnt) const {
>>       |      ^~~~~~~~
>> In file included from ../../src/hotspot/share/prims/foreign_globals.cpp:25:
>> ../../src/hotspot/share/prims/foreign_globals.hpp:40:8: note: candidate is: 'void CallRegs::calling_convention(BasicType*, int*, uint) const'
>>    40 |   void calling_convention(BasicType* sig_bt, VMRegPair *parm_regs, uint argcnt) const;
>>       |        ^~~~~~~~~~~~~~~~~~
>> ../../src/hotspot/share/prims/foreign_globals.hpp:33:8: note: 'struct CallRegs' defined here
>>    33 | struct CallRegs {
>>       |        ^~~~~~~~
>> 
>> I compile with disabled precompiled headers, which typically causes issues like this - is there some include missing somewhere?
>> 
>> It seems like I need to add this:
>> 
>> #include "code/vmreg.hpp"
>> 
>> In foreign_globals.hpp to get things working.
>
> Other includes seem to be missing - here's the patch I needed to get it working:
> 
> +++ b/src/hotspot/cpu/x86/universalUpcallHandler_x86_64.cpp
> @@ -31,6 +31,8 @@
>  #include "memory/resourceArea.hpp"
>  #include "prims/universalUpcallHandler.hpp"
>  #include "runtime/sharedRuntime.hpp"
> +#include "runtime/signature.hpp"
> +#include "utilities/formatBuffer.hpp"
>  #include "utilities/globalDefinitions.hpp"
>  
>  #define __ _masm->
> diff --git a/src/hotspot/share/prims/foreign_globals.hpp b/src/hotspot/share/prims/foreign_globals.hpp
> index 4f02ee625cb..44c65771e7c 100644
> --- a/src/hotspot/share/prims/foreign_globals.hpp
> +++ b/src/hotspot/share/prims/foreign_globals.hpp
> @@ -27,6 +27,7 @@
>  #include "oops/oopsHierarchy.hpp"
>  #include "utilities/growableArray.hpp"
>  #include "utilities/macros.hpp"
> +#include "code/vmreg.hpp"
>  
>  #include CPU_HEADER(foreign_globals)

Executed benchmark on my machine:

Benchmark                Mode  Cnt    Score   Error  Units
Upcalls.jni_args10       avgt   30  102.245 ? 1.952  ns/op
Upcalls.jni_args5        avgt   30   59.715 ? 1.488  ns/op
Upcalls.jni_blank        avgt   30   43.189 ? 0.642  ns/op
Upcalls.jni_identity     avgt   30   90.224 ? 1.775  ns/op
Upcalls.panama_args10    avgt   30   24.633 ? 0.260  ns/op
Upcalls.panama_args5     avgt   30   18.708 ? 0.314  ns/op
Upcalls.panama_blank     avgt   30   15.925 ? 0.262  ns/op
Upcalls.panama_identity  avgt   30   19.769 ? 0.266  ns/op
Seems to be from 2x to 4x faster - awesome!

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

PR: https://git.openjdk.java.net/panama-foreign/pull/457


More information about the panama-dev mailing list