-
Notifications
You must be signed in to change notification settings - Fork 706
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create an OpenJ9 JCL preprocessor config for Java 8 #72
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, this looks pretty reasonable.
jcl/jpp_configuration.xml
Outdated
flags="Sidecar18-SE-OpenJ9,CUDA4J" | ||
dependencies="SIDECAR18-SE" | ||
jdkcompliance="1.8"> | ||
<classpathentry kind="lib" path="/binaries/vm/third/rt-compressed.sun180.jar"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This relies on a binary file - a stripped down version of rt.jar - which isn't available here. Can it be based on a unmodified rt.jar? Or can we produce a script that knows how to strip rt.jar?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can (now) be based on an unmodified rt.jar from Java 8, plus the tools.jar. There is no need to use a stripped down rt.jar. The modified version was created only to save repo & disk space, and build time. This part of the preprocessor configuration is only used by the Eclipse Java Preprocessor plugin, which at this time isn't contributed to open source. I don't see any reason to change from the existing classpathentry, or have an idea of what I would change it to.
static ClassLoader getClassLoader(Class<?> clz) { | ||
if (null != clz) { | ||
return clz.getClassLoader0(); | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
< grumbles about else blocks after return unconditional returns >
(I don't expect this to be changed here as it was pre-existing code)
@@ -172,15 +172,19 @@ static void afterClinitInitialization() { | |||
/*[PR JAZZ 58297] - continue with the rules defined by JAZZ 57070 - Build a Java 8 J9 JCL using the SIDECAR18 preprocessor configuration */ | |||
// Check the default encoding | |||
/*[Bug 102075] J2SE Setting -Dfile.encoding=junk fails to run*/ | |||
/*[IF Sidecar19-SE]*/ | |||
/*[IF !Sidecar19-SE]*/ | |||
StringCoding.encode(new char[1], 0, 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does moving this effect initialization order? We've had issues with initializing string encoding-related functions at the wrong time....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The resulting post processed code is the same in all cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From code history, StringCoding.encode
was invoked before setErr
& setOut
for both Java 8 & 9 around five weeks ago. StringCoding.encode
was moved after setErr
& setOut
unintentionally in a changeset for this code area. I suggest to put StringCoding.encode
for Java 9
back to initial location in same order as Java 8
as following code snippet:
/*[IF Sidecar19-SE]*/
StringCoding.encode(String.LATIN1, new byte[1]);
/*[ELSE]*/
StringCoding.encode(new char[1], 0, 1);
/*[ENDIF]*/
/*[IF Sidecar19-SE|Sidecar18-SE-OpenJ9]*/
setErr(new PrintStream(new BufferedOutputStream(new FileOutputStream(FileDescriptor.err)), true));
setOut(new PrintStream(new BufferedOutputStream(new FileOutputStream(FileDescriptor.out)), true));
/*[IF Sidecar19-SE_RAWPLUSJ9]*/
setIn(new BufferedInputStream(new FileInputStream(FileDescriptor.in)));
/*[ENDIF]*/
/*[ELSE]*/
/*[PR s66168] - ConsoleInputStream initialization may write to System.err */
/*[PR s73550, s74314] ConsolePrintStream incorrectly initialized */
setErr(com.ibm.jvm.io.ConsolePrintStream.localize(new BufferedOutputStream(new FileOutputStream(FileDescriptor.err)), true));
setOut(com.ibm.jvm.io.ConsolePrintStream.localize(new BufferedOutputStream(new FileOutputStream(FileDescriptor.out)), true));
/*[ENDIF]*/
@@ -1236,9 +1236,11 @@ BoundMethodHandle rebind() { | |||
throw OpenJDKCompileStub.OpenJDKCompileStubThrowError(); | |||
} | |||
|
|||
/*[IF Sidecar19-SE-OpenJ9]*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this have to be Java 9 only? Given it's a compile stub, I'd be tempted to leave it in for Java 8 as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its not used in Java 8 atm, but it doesn't need to be Java 9 only. Including it makes Java 8 code slightly bigger for no reason, but I can include it if you like.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with leaving it. Its written now and is unlikely to need to be modified being compile stubs.
@@ -29,6 +29,12 @@ | |||
*/ | |||
|
|||
final class MemberName { | |||
/*[IF Sidecar18-SE-OpenJ9]*/ | |||
static final class Factory { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This wasn't previously needed: perhaps the condition ought to be ! Sidecar19-SE-OpenJ9
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A positive condition is better than a negative one, as the negative condition could end up including the code in unexpected places.
@@ -59,6 +59,12 @@ | |||
MethodHandle resolvedHandle() { | |||
throw OpenJDKCompileStub.OpenJDKCompileStubThrowError(); | |||
} | |||
|
|||
/*[IF Sidecar18-SE-OpenJ9]*/ | |||
MethodHandle resolve() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This wasn't previously needed: perhaps the condition ought to be ! Sidecar19-SE-OpenJ9
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A positive condition is better than a negative one, as the negative condition could end up including the code in unexpected places.
|
Makes sense, I can make Sidecar19-SE-OpenJ9 imply Sidecar18-SE-OpenJ9. I'll have to change the places which are Java 8 only to Sidecar18-SE-OpenJ9&!Sidecar19-SE-OpenJ9, which is only 3 places. |
I've left the separate commits for easier further review. I plan to squash them. |
>> Sidecar19-SE implies Sidecar18-SE: I think the use of flags in conditionals should assume that Sidecar19-SE-OpenJ9 implies Sidecar18-SE-OpenJ9. Since there is no really b174 builds, those Later when |
Agree with Jason's statements about preprocessor flag cleanup, but I think that is better left for a separate commit. Even though Sidecar19-SE-B174 is obsolete, I though it was better to leave it as-is than do a partial cleanup. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
Jenkins test sanity |
As per the merged #58, I've rebased and added the new openj9.jvm module to the source path of the SIDECAR18-SE-OPENJ9 jpp config |
Create a new java preprocessor configuration SIDECAR18-SE-OPENJ9 based on the existing SIDECAR18-SE configuration which is used internally by IBM to create Java 8 builds. Add the additional flag Sidecar18-SE-OpenJ9 and use this flag to include additional stub classes and code that are required to compile the OpenJDK JCL code when the OpenJ9 JCL is overlayed. Sidecar19-SE-OpenJ9 also includes Sidecar18-SE-OpenJ9. Enable the CUDA4J flag to include the com.ibm.cuda classes. Enable the DAA flag to include the com.ibm.dataaccess classes. Move Java 9 initialization call to StringCoding.encode() earlier. This move matches how it was originally, until the call was inadvertently moved by an earlier change. Signed-off-by: Peter Shipton <Peter_Shipton@ca.ibm.com>
I've squashed all the commits, this is ready to be merged. |
I will merge this either later tonight or tomorrow depending on when the OMR-related build issue is merged across - see eclipse/omr#1710 edit: change merged - see eclipse-openj9/openj9-omr#5 for status of merges to openj9-omr/openj9 |
Jenkins test sanity |
…n_fix Set default variables from extensions
Create a new preprocessor configuration SIDECAR18-SE-OPENJ9 based on the
existing SIDECAR18-SE configuration which is used internally by IBM to
create Java 8 builds. Add the additional flag Sidecar18-SE-OpenJ9 and
use this flag to include additional stub classes and code that are
required to compile the OpenJDK JCL code when the OpenJ9 JCL is
overlayed.
Also enable the CUDA4J flag to include the com.ibm.cuda classes.
@keithc-ca @DanHeidinga @JasonFengJ9 @andrew-m-leonard
Signed-off-by: Peter Shipton Peter_Shipton@ca.ibm.com