RFR : 8195857 : Posix platforms : move os::is_headless_jre check coding to os::Posix and remove test for libmawt
Bob Vandette
bob.vandette at oracle.com
Wed Jan 24 13:16:56 UTC 2018
> On Jan 23, 2018, at 5:50 PM, David Holmes <david.holmes at oracle.com> wrote:
>
> Hi Bob,
>
> On 24/01/2018 1:25 AM, Bob Vandette wrote:
>> If we are going to preserve this functionality and make alterations, I suggest that
>> we try to move this into the desktop module and remove it from the hotspot sources.
>> Other than finding an appropriate path at startup to initialize the property, there is
>> no reason why this check can’t be written in Java. This functionality has nothing to
>> do with Hotspot or VMs. (I should have probably done this when I first added this check).
>
> Well we hacked it into the SE Embedded builds so we knew what lib was missing.
>
> I don't think what you suggest really makes sense in a modular world because I don't think we expect to have java.desktop but not some of its native parts - so there would be no trigger to force into headless mode. More likely there is simply no java.desktop module at all.
The automatic setting of java.awt.headless has nothing to do with compact profiles. This support was available in JDK 7 before profiles even existed. This
automatic headless detection was added in order to allow Java to be ported to platforms that do not have a native windowing toolkit available. This was
used in embedded to also reduce the size of the binary by removing this big library. A configuration that contains java.desktop can absolutely be supported
and the JCK can be passed without this native library.
This Java property is only referenced by the desktop module. This is why I suggested that this functionality be moved out of the hotspot VM.
Bob.
>
> That said I was reminded that this is also used by the Compact Profiles that were added in Java 8, but for which support was removed as from Java 9 (and modules). However the build logic is still present, and they still use this functionality. I think we can remove compact profiles completely in JDK 11, but that's a seperate tasks.
>
> Meanwhile if we kill off the os::is_headless_jre() logic then the compact profiles would not default to headless mode even though they can't run headful (due to the missing native library as well as other Java APIs). But the only impact I can see there would be for running tests - and we're not testing compact profiles. So ... I still think this can be removed, but want to do a couple more checks.
>
> Cheers,
> David
>
>> Bob.
>>> On Jan 23, 2018, at 5:57 AM, Baesken, Matthias <matthias.baesken at sap.com> wrote:
>>>
>>> Hi David, thanks for the comments.
>>>
>>>> I'd need to do some checking but I think this may all be effectively
>>>> dead code.
>>>
>>> Please do the checking, maybe we can completely remove it.
>>>
>>> Best Regards, Matthias
>>>
>>>
>>>> -----Original Message-----
>>>> From: David Holmes [mailto:david.holmes at oracle.com]
>>>> Sent: Dienstag, 23. Januar 2018 11:30
>>>> To: Baesken, Matthias <matthias.baesken at sap.com>; 'hotspot-
>>>> dev at openjdk.java.net' <hotspot-dev at openjdk.java.net>
>>>> Subject: Re: RFR : 8195857 : Posix platforms : move os::is_headless_jre check
>>>> coding to os::Posix and remove test for libmawt
>>>>
>>>> Hi Matthias,
>>>>
>>>> Some preliminary comments ...
>>>>
>>>> On 23/01/2018 6:24 PM, Baesken, Matthias wrote:
>>>>> Hello, I noticed that os::is_headless_jre() still checks on the Posix
>>>> platforms for libmawt which is not present any longer.
>>>>
>>>> I wonder why that comment was put in but the code not changed ...
>>>>
>>>>> Additionally the os::is_headless_jre() function could be put in a central
>>>> place at os_posix to avoid code duplication.
>>>>
>>>> I think you could simplify further and just define in os.cpp with three
>>>> cases: windows, OS X, posix. I normally wouldn't suggest that but given
>>>> Windows and OS X are always false, it's quite trivial.
>>>>
>>>> That said this may simplify even further because I don't know if the
>>>> concept of a headless JRE is even meaningful anymore. This what put in
>>>> place in 2010 to support Java SE Embedded. We had a special build
>>>> process that would remove the library from the JRE image, then a runtime
>>>> check os::is_headless_jre() run during argument processing, that if
>>>> true, caused the java.awt.headless property to be set to true (unless
>>>> already set). I don't think we can even build a "headless JRE" any more.
>>>>
>>>> I'd need to do some checking but I think this may all be effectively
>>>> dead code.
>>>>
>>>> Thanks,
>>>> David
>>>> -------
>>>>
>>>>> Could you please review my change .
>>>>>
>>>>> Webrev :
>>>>>
>>>>> http://cr.openjdk.java.net/~mbaesken/webrevs/8195857/
>>>>>
>>>>> Bug :
>>>>>
>>>>> https://bugs.openjdk.java.net/browse/JDK-8195857
>>>>>
>>>>>
>>>>>
>>>>> Thanks, Matthias
>>>>>
More information about the hotspot-dev
mailing list