RFR: [panama foreign] Build tweak to enable build on Windows
Henry Jen
henry.jen at oracle.com
Mon Oct 29 15:36:10 UTC 2018
On Oct 29, 2018, at 6:03 AM, Jorn Vernee <jbvernee at xs4all.nl> wrote:
>
> Thanks Henry, the files are now copied over as expected :)
>
> Just now I was also looking at the way you're solving the problem of missing `alloca` in `jdk_internal_clang.cpp`, which I've ran into myself in other places.
>
Uh, I wasn’t paying attention, thanks for catching this.
> I see you've switched to calloc, but you're not freeing the pointer it creates, so this is a memory leak (this problem doesn't exist with alloca since it allocates space on the stack). You can put `free(filteredTokens);` after the `out:` label to ensure that it gets freed in the case of an exception as well.
>
> I remember seeing some talk recently about bumping up the C/C++ standard the JDK operates on, so soon we could hopefully use C99 variable length arrays and this won't be a problem :)
>
> I'm currently using the C++ version of alloca (called _alloca) using this macro:
>
> #ifdef _WIN64
> #include <malloc.h>
> #define alloca _alloca
> #endif
>
> Which also seems to work.
>
I like this approach better.
> ---
>
> I'm also looking at /hotspot/cpu/x86/directUpcallHandler_x86.cpp
>
> You're putting `mask` and `rec_adr` into rdi and rsi, but those or not argument registers on MSx64 [1], so this won't work.
>
I am justing get it compiled, should have put a “FIXME” on it.
Those two registers picked based on src/hotspot/cpu/x86/assembler_x86.hpp
Cheers,
Henry
> The direct invoker doesn't work for Windows currently since it can't handle the argument shuffling and it uses a different number of registers, so I've also put in that compiler switch, but left the Windows branch with a FIXME, since there's no real quick-fix.
>
> Picking which invoker is used is done by the binder code, so on Windows it will just choose not to use the direct invoker at all for now.
>
> Cheers,
> Jorn
>
> [1] : https://docs.microsoft.com/en-us/cpp/build/parameter-passing?view=vs-2017
>
> Henry Jen schreef op 2018-10-29 06:55:
>> Updated webrev[1] fix the link issue and revert CXX CXXCPP as suggested by Erik.
>> [1] https://cr.openjdk.java.net/~henryjen/panama/build-windows/webrev.01/webrev/
>> Cheers,
>> Henry
More information about the panama-dev
mailing list