RFR: 8326583: Remove over-generalized DefineNativeToolchain solution [v4]

Claudio Nieder duke at openjdk.org
Mon Mar 4 00:02:48 UTC 2024


On Tue, 27 Feb 2024 11:19:59 GMT, Magnus Ihse Bursie <ihse at openjdk.org> wrote:

>> The idea of setting up general "toolchains" in the native build was good, but it turned out that we really only need a single toolchain, with a single twist: if it should use CC or CPP to link. This is better described by a specific argument to SetupNativeCompilation, LANG := C++ or LANG := C (the default).
>> 
>> There is a single exception to this rule, and that is if we want to compile for the build platform rather than the target platform. (This is only done for adlc) To keep expressing this difference, introduce TARGET_TYPE := BUILD (or TARGET_TYPE := TARGET, the default).
>> 
>> The final odd-case was the hack for building hsdis/bin on mingw. This can be resolved using direct variables to SetupNativeCompilation, instead of first creating a toolchain.
>> 
>> Doing this refactoring will simplify the SetupNativeCompilation code, and make it much clearer if we use the C or C++ linker.
>
> Magnus Ihse Bursie has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains five commits:
> 
>  - Merge branch 'master' into remove-toolchain-define
>  - Rename LANG to LINK_TYPE
>  - Reword "lib" comment to fit in better
>  - Merge branch 'master' into remove-toolchain-define
>  - 8326583: Remove over-generalized DefineNativeToolchain solution

As a side note, I now did time the effect of ccache using the below script. This is the result without ccache


real	3m42.896s
user	20m49.584s
sys	2m56.578s


this is the result with --enable-ccache

real	4m56.290s
user	26m16.230s
sys	5m50.993s


Thus at least on my MacBook Pro M1 using ccache slows down the compilation!

Script

#!/bin/bash

export LANG=en_US
export LC_ALL=en_US

preceedingCommit=bceaed6d

d1=noCCache
d2=ccache

cd /tmp
rm -rf $d1
mkdir $d1
cd $d1
git clone "https://github.com/openjdk/jdk.git"
cd jdk
git checkout $preceedingCommit
bash ./configure --disable-warnings-as-errors --with-debug-level=fastdebug \
  --enable-hsdis-bundling --with-hsdis=capstone
make clean
time make images 2>&1 | tee /tmp/$d1/time.txt

cd /tmp
rm -rf $d2
mkdir $d2
cd $d2
git clone "https://github.com/openjdk/jdk.git"
cd jdk
git checkout $preceedingCommit
bash ./configure --disable-warnings-as-errors --with-debug-level=fastdebug \
  --enable-ccache --enable-hsdis-bundling --with-hsdis=capstone
make clean
time make images 2>&1 | tee /tmp/$d2/time.txt

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

PR Comment: https://git.openjdk.org/jdk/pull/17986#issuecomment-1975406744


More information about the build-dev mailing list