On Fri, 7 Apr 2023 06:03:11 GMT, Thomas Stuefe <stu...@openjdk.org> wrote:

>>> What did you use as the example that would not compile on the other 
>>> architecture? 
>> 
>> https://github.com/openjdk/jdk/blob/52ca4a70fc3de9e285964f9545ea8cd54e2d9924/src/java.base/share/classes/jdk/internal/util/OperatingSystemProps.java.template#L40
>> 
>> I don't understand how the above code can be compiled on architectures such 
>> as LongArch64, MIPS64el, or ARM32 without modifying the source file.
>> 
>>> Did you make the other changes to the build that would be needed for a new 
>>> architecture?
>> 
>> I'm not talking about the new architecture, I'm talking about the 
>> architecture that OpenJDK already supports. 
>> 
>> According to my understanding, the above code breaks the support of all 
>> architectures not listed in `Architecture`. But has `Architecture` really 
>> listed all the supported architectures in the OpenJDK mainline?
>> 
>> For example, I want to compile OpenJDK for 32-bit ARM.  I think in this PR, 
>> I cannot compile without modifying the source code because `TARGET_ARCH_arm` 
>> does not exist. But before this PR, I was able to compile.
>
> @Glavo Arm32 builds, though, see GHAs (crossbuilding test). As for the 
> others, as long as the ports have not been integrated into mainline, I expect 
> port maintainers will adapt the enum downstream. They do this anyway.
> 
> Edit: I now understand your point better and agree in parts, see my reply 
> below.

Refactored the way that build time architecture values are mapped to the 
Architecture enum.
It now uses strings and does not require predefined names in the template file.
Explicitly maps some build time arch values to the corresponding (but not 
identical Arch enum); for example x86_64 to X64.
Added a method to expose the endian-ness of the build; this allows it to be 
separated from the architecture.
So for example "ppc64le" maps to PPC64 and the endian-ness is little.
Added an "OTHER" to the enum values so that unrecognized architecture values 
from the build can be mapped to that enum.
Renamed the template file so it can more naturally cover the os, architecture, 
endianness, and 64bit'ness of the implementation.
Reworked OperatingSystem to use the same string based interface between the 
build and the enum.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13357#discussion_r1160968389

Reply via email to