Skip to content

Commit

Permalink
Merge pull request #2458 from JasonFengJ9/jvminitarch
Browse files Browse the repository at this point in the history
Bringup JDK12
  • Loading branch information
pshipton authored Jul 24, 2018
2 parents 7e06804 + 253f73e commit c73c3d8
Show file tree
Hide file tree
Showing 12 changed files with 251 additions and 8 deletions.
4 changes: 3 additions & 1 deletion runtime/bcutil/defineclass.c
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,9 @@ internalLoadROMClass(J9VMThread * vmThread, J9LoadROMClassData *loadData, J9Tran

/* Determine allowed class file version */
#ifdef J9VM_OPT_SIDECAR
if (J2SE_VERSION(vm) >= J2SE_V11) {
if (J2SE_VERSION(vm) >= J2SE_V12) {
translationFlags |= BCT_Java12MajorVersionShifted;
} else if (J2SE_VERSION(vm) >= J2SE_V11) {
translationFlags |= BCT_Java11MajorVersionShifted;
} else if (J2SE_VERSION(vm) >= J2SE_V10) {
translationFlags |= BCT_Java10MajorVersionShifted;
Expand Down
1 change: 1 addition & 0 deletions runtime/j9vm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ target_sources(jvm_common INTERFACE
${CMAKE_CURRENT_SOURCE_DIR}/j8vmi.c
${CMAKE_CURRENT_SOURCE_DIR}/j9memcategories.c
${CMAKE_CURRENT_SOURCE_DIR}/java11vmi.c
${CMAKE_CURRENT_SOURCE_DIR}/javanextvmi.c
${CMAKE_CURRENT_SOURCE_DIR}/jvm.c
${CMAKE_CURRENT_SOURCE_DIR}/vmi.c
#TODO this is gross
Expand Down
31 changes: 31 additions & 0 deletions runtime/j9vm/javanextvmi.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*******************************************************************************
* Copyright (c) 2018, 2018 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
* distribution and is available at https://www.eclipse.org/legal/epl-2.0/
* or the Apache License, Version 2.0 which accompanies this distribution and
* is available at https://www.apache.org/licenses/LICENSE-2.0.
*
* This Source Code may also be made available under the following
* Secondary Licenses when the conditions for such availability set
* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
* General Public License, version 2 with the GNU Classpath
* Exception [1] and GNU General Public License, version 2 with the
* OpenJDK Assembly Exception [2].
*
* [1] https://www.gnu.org/software/classpath/license.html
* [2] http://openjdk.java.net/legal/assembly-exception.html
*
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception
*******************************************************************************/

#include <jni.h>

#if J9VM_JCL_SE12
JNIEXPORT void JNICALL
JVM_InitializeFromArchive(JNIEnv *env, jclass clz)
{
/* To be implemented via https://github.com/eclipse/openj9/issues/2452 */
}
#endif /* J9VM_JCL_SE12 */
7 changes: 6 additions & 1 deletion runtime/j9vm/jvm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1475,12 +1475,13 @@ getVersionFromClasslibPropertiesFile(void)
* "9[.x.x]" --- Java 9, 'J2SE_19 | J2SE_SHAPE_B165';
* "10[.x.x]" --- Java 10, 'J2SE_V10 | J2SE_SHAPE_V10';
* "11[.x.x]" --- Java 11, 'J2SE_V11 | J2SE_SHAPE_V11';
* "12[.x.x]" --- Java 12, 'J2SE_V12 | J2SE_SHAPE_V12';
* Others --- Latest Java, 'J2SE_LATEST | J2SE_SHAPE_LATEST'.
* Otherwise, 0 is returned.
*
* @return 'J2SE_18 | J2SE_SHAPE_OPENJDK', 'J2SE_19 | J2SE_SHAPE_B165',
* 'J2SE_V10 | J2SE_SHAPE_V10', 'J2SE_V11 | J2SE_SHAPE_V11',
* 'J2SE_LATEST | J2SE_SHAPE_LATEST'
* 'J2SE_V12 | J2SE_SHAPE_V12', 'J2SE_LATEST | J2SE_SHAPE_LATEST'
* according to the 'JAVA_VERSION' value found in 'release';
* or 0 if otherwise.
*/
Expand Down Expand Up @@ -1516,6 +1517,10 @@ getVersionFromReleaseFile(void)
} else if (!strncmp(version, JAVA_VERSION_11, sizeof(JAVA_VERSION_11) - 1)) {
#undef JAVA_VERSION_11
finalVersion = J2SE_V11 | J2SE_SHAPE_V11;
#define JAVA_VERSION_12 "\"12" /* its usual format is "12[.x.x]" */
} else if (!strncmp(version, JAVA_VERSION_12, sizeof(JAVA_VERSION_12) - 1)) {
#undef JAVA_VERSION_12
finalVersion = J2SE_V12 | J2SE_SHAPE_V12;
} else {
/* Assume latest Java version and shape */
finalVersion = J2SE_LATEST | J2SE_SHAPE_LATEST;
Expand Down
123 changes: 123 additions & 0 deletions runtime/j9vm_jdk12/module.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--
Copyright (c) 2018, 2018 IBM Corp. and others
This program and the accompanying materials are made available under
the terms of the Eclipse Public License 2.0 which accompanies this
distribution and is available at https://www.eclipse.org/legal/epl-2.0/
or the Apache License, Version 2.0 which accompanies this distribution and
is available at https://www.apache.org/licenses/LICENSE-2.0.
This Source Code may also be made available under the following
Secondary Licenses when the conditions for such availability set
forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
General Public License, version 2 with the GNU Classpath
Exception [1] and GNU General Public License, version 2 with the
OpenJDK Assembly Exception [2].
[1] https://www.gnu.org/software/classpath/license.html
[2] http://openjdk.java.net/legal/assembly-exception.html
SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception
-->

<module xmlns:xi="http://www.w3.org/2001/XInclude">
<xi:include href="../j9vm/j9vmnatives.xml"><xi:fallback/></xi:include>

<exports group="all">
<export name="JNI_CreateJavaVM"/>
<export name="JNI_GetCreatedJavaVMs"/>
<export name="JNI_GetDefaultJavaVMInitArgs"/>
<export name="_JVM_GetCallerClass@4" />
<export name="JVM_BeforeHalt" />
<export name="JVM_GetNestHost" />
<export name="JVM_GetNestMembers" />
<export name="JVM_AreNestMates" />
<export name="JVM_InitializeFromArchive" />
</exports>

<artifact type="shared" name="jvm" scope="jdk12" loadgroup="top" buildlocal="true" appendrelease="false">
<include-if condition="spec.flags.module_j9vm"/>
<options>
<option name="requiresPrimitiveTable"/>
<option name="prototypeHeaderFileNames" data="jvm.h"/>
</options>
<phase>core quick j2se</phase>
<dependencies>
<dependency name="generate_j9vm"/>
</dependencies>
<exports>
<group name="all"/>
<group name="j9vmnatives"/>
</exports>
<flags>
<flag name="J9VM_JAVA9_BUILD" value="156"/>
<flag name="J9VM_JCL_SE11"/>
<flag name="J9VM_JCL_SE12"/>
</flags>
<includes>
<include path="j9include"/>
<include path="j9oti"/>
<include path="harmony_include"/>
<include path="jclcommon">
<include-if condition="spec.flags.build_realtime"/>
</include>
<include path="$(OMR_DIR)/gc/include" type="relativepath"/>
<include path="j9gcgluejava"/>
</includes>
<makefilestubs>
<makefilestub data="UMA_TREAT_WARNINGS_AS_ERRORS=1"/>
</makefilestubs>
<vpaths>
<vpath path="harmony_jvm" pattern="%.c" augmentIncludes="true">
<include-if condition="spec.flags.opt_harmony"/>
</vpath>
<vpath pattern="copyright.c" path="../makelib" augmentObjects="true" augmentIncludes="true" type="relativepath"/>
<vpath pattern="j7verify.c" path="../j9vm" augmentObjects="true" augmentIncludes="true" type="relativepath"/>
<vpath pattern="j7vmi.c" path="../j9vm" augmentObjects="true" augmentIncludes="true" type="relativepath"/>
<vpath pattern="j8vmi.c" path="../j9vm" augmentObjects="true" augmentIncludes="true" type="relativepath"/>
<vpath pattern="j9memcategories.c" path="../j9vm" augmentObjects="true" augmentIncludes="true" type="relativepath"/>
<vpath pattern="java11vmi.c" path="../j9vm" augmentObjects="true" augmentIncludes="true" type="relativepath"/>
<vpath pattern="javanextvmi.c" path="../j9vm" augmentObjects="true" augmentIncludes="true" type="relativepath"/>
<vpath pattern="jvm.c" path="../j9vm" augmentObjects="true" augmentIncludes="true" type="relativepath"/>
<vpath pattern="ut_j9scar.c" path="../j9vm" augmentObjects="true" augmentIncludes="true" type="relativepath"/>
<vpath pattern="vmi.c" path="../j9vm" augmentObjects="true" augmentIncludes="true" type="relativepath"/>
</vpaths>
<objects>
<object name="javanextvmi"/>
<object name="java11vmi"/>
<object name="j8vmi"/>
<object name="j7vmi"/>
<object name="j7verify"/>
<object name="jvm"/>
<object name="vmi"/>
<object name="ut_j9scar"/>
<object name="j9memcategories"/>
<object name="harmony_vm">
<include-if condition="spec.flags.opt_harmony"/>
</object>
</objects>

<!--
WARNING: DO NOT LINK SHARED LIBRARIES AGAINST THIS SHARED LIBRARY
WE NEED TO BE ABLE TO LOAD IT WITHOUT ANYTHING ELSE ON THE
LIBPATH.
This is required because of sidecar configurations.
-->
<libraries>
<library name="socket" type="macro"/>
<library name="j9exelib"/>
<library name="j9util_b156"/>
<library name="j9utilcore"/>
<library name="j9avl" type="external"/>
<library name="j9hashtable" type="external"/>
<library name="j9pool" type="external"/>
<library name="j9vmi"/>
<!-- for advance toolchain pthread must be last in the link order -->
<library name="pthread" type="system">
<include-if condition="spec.linux.* and not spec.linux_ztpf.*"/>
</library>
</libraries>
</artifact>
</module>
7 changes: 7 additions & 0 deletions runtime/jcl/common/jclcinit.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,13 @@ jint computeFullVersionString(J9JavaVM* vm)
j2se_version_info = "11.?";
}
break;
case J2SE_V12:
if ((J2SE_VERSION(vm) & J2SE_RELEASE_MASK) == J2SE_V12) {
j2se_version_info = "12";
} else {
j2se_version_info = "12.?";
}
break;
default:
j2se_version_info = "?.?.?";
}
Expand Down
10 changes: 7 additions & 3 deletions runtime/oti/j2sever.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#define J2SE_19 0x0900
#define J2SE_V10 0x0A00 /* This refers Java 10 */
#define J2SE_V11 0x0B00 /* This refers Java 11 */
#define J2SE_V12 0x0C00 /* This refers Java 12 */
/* Shared class cache is using JAVA_SPEC_VERSION_FROM_J2SE(j2seVersion) to get the Java version.
* So bits 9 to 16 of the J2SE constant should match the java version number.
*/
Expand All @@ -45,8 +46,10 @@
#define J2SE_LATEST J2SE_19
#elif JAVA_SPEC_VERSION == 10
#define J2SE_LATEST J2SE_V10
#else
#elif JAVA_SPEC_VERSION == 11
#define J2SE_LATEST J2SE_V11
#else
#define J2SE_LATEST J2SE_V12
#endif

/**
Expand Down Expand Up @@ -81,8 +84,9 @@
#define J2SE_SHAPE_B165 0x60000
#define J2SE_SHAPE_V10 0x70000
#define J2SE_SHAPE_V11 0x80000
#define J2SE_SHAPE_RAWPLUSJ9 0x80000
#define J2SE_SHAPE_RAW 0x90000
#define J2SE_SHAPE_V12 0x90000
#define J2SE_SHAPE_RAWPLUSJ9 0xA0000
#define J2SE_SHAPE_RAW 0xB0000
#define J2SE_SHAPE_MASK 0xF0000
#define J2SE_SHAPE_SHIFT 16
#define J2SE_JAVA_SPEC_VERSION_SHIFT 8
Expand Down
3 changes: 2 additions & 1 deletion runtime/oti/j9nonbuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -2104,7 +2104,8 @@ typedef struct J9BCTranslationData {
#define BCT_Java9MajorVersionShifted 0x35000000
#define BCT_Java10MajorVersionShifted 0x36000000
#define BCT_Java11MajorVersionShifted 0x37000000
#define BCT_JavaMaxMajorVersionShifted BCT_Java11MajorVersionShifted
#define BCT_Java12MajorVersionShifted 0x38000000
#define BCT_JavaMaxMajorVersionShifted BCT_Java12MajorVersionShifted

#define BCT_ActionUnused 6
#define BCT_ErrFallOffLastInstruction 8
Expand Down
2 changes: 2 additions & 0 deletions runtime/redirector/forwarders.m4
Original file line number Diff line number Diff line change
Expand Up @@ -319,3 +319,5 @@ _IF([defined(J9VM_JCL_SE11)],
[_X(JVM_GetNestMembers,JNICALL,false,jobjectArray,JNIEnv *env,jclass clz)])
_IF([defined(J9VM_JCL_SE11)],
[_X(JVM_AreNestMates,JNICALL,false,jboolean,JNIEnv *env,jclass clzOne, jclass clzTwo)])
_IF([defined(J9VM_JCL_SE12)],
[_X(JVM_InitializeFromArchive, JNICALL, false, void, JNIEnv *env, jclass clz)])
60 changes: 60 additions & 0 deletions runtime/redirector/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
<export name="JVM_GetNestMembers" />
<export name="JVM_AreNestMates" />
</exports>
<exports group="jdk12">
<export name="JVM_InitializeFromArchive" />
</exports>
<exports group="prejdk11">
<export name="_JVM_GetCallerClass@8" />
</exports>
Expand Down Expand Up @@ -222,6 +225,63 @@
</commands>
</artifact>

<artifact type="shared" name="jvm_jdk12" scope="redirector" loadgroup="top" buildlocal="true" appendrelease="false">
<include-if condition="spec.flags.module_j9vm"/>
<options>
<!-- Need this for compatibility with older UMA versions in ifix streams -->
<option name="linuxVersionName" data ="JVM_2.3"/>
</options>
<phase>core quick j2se</phase>
<dependencies>
<dependency name="generate_j9vm"/>
<dependency name="generate_redirector"/>
</dependencies>
<exports>
<group name="jdk12"/>
<group name="jdk11"/>
<group name="all"/>
<group name="j9vmnatives"/>
</exports>
<flags>
<flag name="J9VM_JAVA9_BUILD" value="156"/>
<flag name="J9VM_JCL_SE11"/>
<flag name="J9VM_JCL_SE12"/>
</flags>
<includes>
<include path="j9include"/>
<include path="j9oti"/>
<include path="jvm"/>
<include path="$(OMRPORT_SRCDIR)zos390" type="relativepath">
<include-if condition="spec.zos_390.*"/>
</include>
</includes>
<makefilestubs>
<makefilestub data="UMA_TREAT_WARNINGS_AS_ERRORS=1"/>
<makefilestub data="OMRPORT_SRCDIR=$(OMR_DIR)/port/"/>
</makefilestubs>
<objects>
<object name="generated"/>
<object name="redirector"/>
</objects>
<libraries>
<library name="omrutil" type="external"/>
</libraries>
</artifact>

<!-- The makefile target from following artifact is expected to clean the object files generated by the makefile of the artifact jvm_jdk11
such that a clean build for the makefile of the artifact jvm can proceed.
Hence this relies on the execution order of makefile targets generated by UMA, i.e.,
first the makefile target of the artifact jvm_jdk11,
second the makefile target of the artifact jvm_jdk11_clean,
and last the makefile target of the artifact jvm -->
<artifact type="shared" name="jvm_jdk12_clean" scope="redirector" loadgroup="top" buildlocal="true" appendrelease="false">
<include-if condition="spec.flags.module_j9vm"/>
<phase>core quick j2se</phase>
<commands>
<command line="$(MAKE) -f redirector_jvm.mk clean" type="all"/>
</commands>
</artifact>

<!-- This artifact must be last because the ones above do a 'clean' after they run, removing libjvm.so. -->
<artifact type="shared" name="jvm" scope="redirector" loadgroup="top" buildlocal="true" appendrelease="false">
<include-if condition="spec.flags.module_j9vm" />
Expand Down
2 changes: 2 additions & 0 deletions runtime/vm/rasdump.c
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,8 @@ j9rasSetServiceLevel(J9JavaVM *vm, const char *runtimeVersion) {
javaVersion = "JRE 10";
} else if ((J2SE_VERSION(vm) & J2SE_RELEASE_MASK) == J2SE_V11) {
javaVersion = "JRE 11";
} else if ((J2SE_VERSION(vm) & J2SE_RELEASE_MASK) == J2SE_V12) {
javaVersion = "JRE 12";
} else {
javaVersion = "UNKNOWN";
}
Expand Down
9 changes: 7 additions & 2 deletions runtime/vm/vmprops.c
Original file line number Diff line number Diff line change
Expand Up @@ -612,11 +612,16 @@ initializeSystemProperties(J9JavaVM * vm)
break;

case J2SE_V11:
/* FALLTHROUGH */
default:
classVersion = "55.0";
specificationVersion = "11";
break;

case J2SE_V12:
/* FALLTHROUGH */
default:
classVersion = "56.0";
specificationVersion = "12";
break;
}
rc = addSystemProperty(vm, "java.class.version", classVersion, 0);
if (J9SYSPROP_ERROR_NONE != rc) {
Expand Down

0 comments on commit c73c3d8

Please sign in to comment.