changeset 8214:aadd8f02449a

Merge.
author Doug Simon <doug.simon@oracle.com>
date Mon, 11 Mar 2013 20:10:27 +0100
parents 3ebe0b86736e (diff) 74896b25297a (current diff)
children 169ec449974a
files
diffstat 8 files changed, 126 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/make/Makefile	Mon Mar 11 19:21:31 2013 +0100
+++ b/make/Makefile	Mon Mar 11 20:10:27 2013 +0100
@@ -84,6 +84,9 @@
   ALT_OUT=
 endif
 
+# Directory for shared code (e.g. graal.jar)
+SHARED_DIR=$(OUTPUTDIR)/shared
+
 # Typical C1/C2 targets made available with this Makefile
 C1_VM_TARGETS=product1 fastdebug1 optimized1 jvmg1
 C2_VM_TARGETS=product  fastdebug  optimized  jvmg
@@ -187,7 +190,7 @@
 	$(MAKE) VM_TARGET=$@ generic_buildgraal $(ALT_OUT)
 
 # Build compiler1 (client) rule, different for platforms
-generic_build1:
+generic_build1: buildshared
 	$(MKDIR) -p $(OUTPUTDIR)
 ifeq ($(OSNAME),windows)
   ifeq ($(ARCH_DATA_MODEL), 32)
@@ -208,7 +211,7 @@
 endif
 
 # Build compiler2 (server) rule, different for platforms
-generic_build2:
+generic_build2: buildshared
 	$(MKDIR) -p $(OUTPUTDIR)
 ifeq ($(OSNAME),windows)
 	$(CD) $(OUTPUTDIR); \
@@ -257,12 +260,16 @@
 	@$(ECHO) "Error: trying to build a minimal target but JVM_VARIANT_MINIMAL1 is not true."
 endif
 
-generic_buildgraal:
+generic_buildgraal: buildshared
 	$(MKDIR) -p $(OUTPUTDIR)
 	$(CD) $(OUTPUTDIR); \
 		$(MAKE) -f $(ABS_OS_MAKEFILE) \
 			$(MAKE_ARGS) $(VM_TARGET) 
 
+# Builds code that can be shared among different build flavors
+buildshared:
+	$(REMOTE) $(ANT) -f $(GAMMADIR)/make/build-graal.xml -Dgamma.dir=$(GAMMADIR) -Dshared.dir=$(SHARED_DIR)
+
 # Export file rule
 generic_export: $(EXPORT_LIST)
 export_product:
@@ -386,6 +393,7 @@
 # Shared Library
 ifneq ($(OSNAME),windows)
     ifeq ($(JVM_VARIANT_SERVER), true)
+	# C2
         $(EXPORT_JRE_LIB_ARCH_DIR)/%.$(LIBRARY_SUFFIX): $(C2_DIR)/%.$(LIBRARY_SUFFIX)
 		$(install-file)
         $(EXPORT_SERVER_DIR)/%.$(LIBRARY_SUFFIX):       $(C2_DIR)/%.$(LIBRARY_SUFFIX)
@@ -404,7 +412,27 @@
 		$(install-file)
         $(EXPORT_SERVER_DIR)/64/%.diz:    			$(C2_DIR)/%.diz
 		$(install-file)
-    endif
+
+	# Graal
+        $(EXPORT_JRE_LIB_ARCH_DIR)/%.$(LIBRARY_SUFFIX): $(GRAAL_DIR)/%.$(LIBRARY_SUFFIX)
+		$(install-file)
+        $(EXPORT_SERVER_DIR)/%.$(LIBRARY_SUFFIX):       $(GRAAL_DIR)/%.$(LIBRARY_SUFFIX)
+		$(install-file)
+        $(EXPORT_SERVER_DIR)/64/%.$(LIBRARY_SUFFIX):    $(GRAAL_DIR)/%.$(LIBRARY_SUFFIX)
+		$(install-file)
+        $(EXPORT_JRE_LIB_ARCH_DIR)/%.debuginfo: 		$(GRAAL_DIR)/%.debuginfo
+		$(install-file)
+        $(EXPORT_SERVER_DIR)/%.debuginfo:       		$(GRAAL_DIR)/%.debuginfo
+		$(install-file)
+        $(EXPORT_SERVER_DIR)/64/%.debuginfo:    		$(GRAAL_DIR)/%.debuginfo
+		$(install-file)
+        $(EXPORT_JRE_LIB_ARCH_DIR)/%.diz: 			$(GRAAL_DIR)/%.diz
+		$(install-file)
+        $(EXPORT_SERVER_DIR)/%.diz:       			$(GRAAL_DIR)/%.diz
+		$(install-file)
+        $(EXPORT_SERVER_DIR)/64/%.diz:    			$(GRAAL_DIR)/%.diz
+		$(install-file)
+     endif
     ifeq ($(JVM_VARIANT_CLIENT), true)
         $(EXPORT_JRE_LIB_ARCH_DIR)/%.$(LIBRARY_SUFFIX): $(C1_DIR)/%.$(LIBRARY_SUFFIX)
 		$(install-file)
@@ -479,6 +507,10 @@
 $(EXPORT_LIB_DIR)/%.jar: $(GEN_DIR)/%.jar
 	$(install-file)
 
+# Shared jar files
+$(EXPORT_JRE_LIB_DIR)/%.jar: $(SHARED_DIR)/%.jar
+	$(install-file)
+
 # Include files (jvmti.h, jvmticmlr.h, jni.h, $(JDK_INCLUDE_SUBDIR)/jni_md.h, jmm.h, jfr.h)
 $(EXPORT_INCLUDE_DIR)/%: $(GEN_DIR)/jvmtifiles/%
 	$(install-file)
@@ -521,6 +553,7 @@
 #
 clobber clean: clean_build clean_export clean_jdk
 clean_build:
+	$(RM) -r $(SHARED_DIR)
 	$(RM) -r $(C1_DIR)
 	$(RM) -r $(C2_DIR)
 	$(RM) -r $(ZERO_DIR)
--- a/make/bsd/makefiles/buildtree.make	Mon Mar 11 19:21:31 2013 +0100
+++ b/make/bsd/makefiles/buildtree.make	Mon Mar 11 20:10:27 2013 +0100
@@ -354,7 +354,7 @@
 	$(BUILDTREE_COMMENT); \
 	[ -n "$$JAVA_HOME" ] && { echo ": \$${JAVA_HOME:=$${JAVA_HOME}}"; }; \
 	{ \
-	echo "CLASSPATH=$${CLASSPATH:+$$CLASSPATH:}.:\$${JAVA_HOME}/jre/lib/rt.jar:\$${JAVA_HOME}/jre/lib/i18n.jar"; \
+	echo "CLASSPATH=$${CLASSPATH:+$$CLASSPATH:}.:\$${JAVA_HOME}/jre/lib/rt.jar:$(OUTPUTDIR)/shared/graal.jar:\$${JAVA_HOME}/jre/lib/i18n.jar"; \
 	} | sed s:$${JAVA_HOME:--------}:\$${JAVA_HOME}:g; \
 	echo "HOTSPOT_BUILD_USER=\"$${LOGNAME:-$$USER} in `basename $(GAMMADIR)`\""; \
 	echo "export JAVA_HOME CLASSPATH HOTSPOT_BUILD_USER"; \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/build-graal.xml	Mon Mar 11 20:10:27 2013 +0100
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ This code is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License version 2 only, as
+ published by the Free Software Foundation.  Oracle designates this
+ particular file as subject to the "Classpath" exception as provided
+ by Oracle in the LICENSE file that accompanied this code.
+
+ This code is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ version 2 for more details (a copy is included in the LICENSE file that
+ accompanied this code).
+
+ You should have received a copy of the GNU General Public License version
+ 2 along with this work; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+ Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ or visit www.oracle.com if you need additional information or have any
+ questions.
+-->
+
+<project name="graal" basedir="." default="main">
+  <property name="src.dir"     value="${gamma.dir}/graal"/>
+  <property name="classes.dir" value="${shared.dir}/graal"/>
+  <property name="jar.dir"     value="${shared.dir}"/>
+  <property name="jar.file"    value="${jar.dir}/graal.jar"/>
+
+  <target name="main" depends="jar"/>
+
+  <target name="compile">
+    <mkdir dir="${classes.dir}"/>
+    <javac srcdir="${src.dir}" destdir="${classes.dir}" debug="on">
+      <include name="com.oracle.graal.*/**"/>
+      <exclude name="com.oracle.graal.test/**"/>
+      <exclude name="com.oracle.graal.*.test/**"/>
+      <exclude name="com.oracle.graal.jtt/**"/>
+      <compilerarg value="-XDignore.symbol.file"/>
+    </javac>
+  </target>
+
+  <target name="jar" depends="compile">
+    <mkdir dir="${jar.dir}"/>
+    <jar destfile="${jar.file}" basedir="${classes.dir}"/>
+  </target>
+
+  <target name="clean">
+    <delete dir="${classes.dir}"/>
+    <delete file="${jar.file}"/>
+  </target>
+</project>
--- a/make/defs.make	Mon Mar 11 19:21:31 2013 +0100
+++ b/make/defs.make	Mon Mar 11 20:10:27 2013 +0100
@@ -236,6 +236,33 @@
   JDK_IMAGE_DIR=$(ALT_JDK_IMAGE_DIR)
 endif
 
+# Utilities ant
+ifeq ($(PLATFORM), windows)
+  ifeq ($(ANT_HOME),)
+    ANT_HOME := $(call DirExists,$(JDK_DEVTOOLS_DIR)/share/ant/latest,,)
+  endif
+endif
+
+# There are few problems with ant we need to workaround:
+#  1) ant is using temporary directory java.io.tmpdir
+#     However, this directory is not unique enough and two separate ant processes
+#     can easily end up using the exact same temp directory. This may lead to weird build failures
+#     To workaround this we will define tmp dir explicitly
+#  2) ant attempts to detect JDK location based on java.exe location
+#     This is fragile as developer may have JRE first on the PATH.
+#     To workaround this we will specify JAVA_HOME explicitly
+#  3) Sometimes we need to run ant with the boot jdk, sometimes with the import
+#     jdk, sometimes with the jdk we are building (see deploy repo).
+
+ANT_TMPDIR = $(OUTPUTDIR)/tmp
+ANT_WORKAROUNDS = ANT_OPTS=-Djava.io.tmpdir='$(ANT_TMPDIR)'
+
+ifeq ($(ANT_HOME),)
+  ANT = $(ANT_WORKAROUNDS) JAVA_HOME='$(BOOTDIR)' ant
+else
+  ANT = $(ANT_WORKAROUNDS) JAVA_HOME='$(BOOTDIR)' $(ANT_HOME)/bin/ant
+endif
+
 # The platform dependent defs.make defines platform specific variable such 
 # as ARCH, EXPORT_LIST etc. We must place the include here after BOOTDIR is defined.
 include $(GAMMADIR)/make/$(OSNAME)/makefiles/defs.make
@@ -336,6 +363,7 @@
 EXPORT_LIST += $(EXPORT_INCLUDE_DIR)/jni.h
 EXPORT_LIST += $(EXPORT_INCLUDE_DIR)/$(JDK_INCLUDE_SUBDIR)/jni_md.h
 EXPORT_LIST += $(EXPORT_INCLUDE_DIR)/jmm.h
+EXPORT_LIST += $(EXPORT_JRE_LIB_DIR)/graal.jar
 
 # By default, run Queens test after building
 TEST_IN_BUILD ?= true
--- a/make/linux/makefiles/buildtree.make	Mon Mar 11 19:21:31 2013 +0100
+++ b/make/linux/makefiles/buildtree.make	Mon Mar 11 20:10:27 2013 +0100
@@ -347,7 +347,7 @@
 	$(BUILDTREE_COMMENT); \
 	[ -n "$$JAVA_HOME" ] && { echo ": \$${JAVA_HOME:=$${JAVA_HOME}}"; }; \
 	{ \
-	echo "CLASSPATH=$${CLASSPATH:+$$CLASSPATH:}.:\$${JAVA_HOME}/jre/lib/rt.jar:\$${JAVA_HOME}/jre/lib/i18n.jar"; \
+	echo "CLASSPATH=$${CLASSPATH:+$$CLASSPATH:}.:\$${JAVA_HOME}/jre/lib/rt.jar:$(OUTPUTDIR)/shared/graal.jar:\$${JAVA_HOME}/jre/lib/i18n.jar"; \
 	} | sed s:$${JAVA_HOME:--------}:\$${JAVA_HOME}:g; \
 	echo "HOTSPOT_BUILD_USER=\"$${LOGNAME:-$$USER} in `basename $(GAMMADIR)`\""; \
 	echo "export JAVA_HOME CLASSPATH HOTSPOT_BUILD_USER"; \
--- a/make/solaris/makefiles/buildtree.make	Mon Mar 11 19:21:31 2013 +0100
+++ b/make/solaris/makefiles/buildtree.make	Mon Mar 11 20:10:27 2013 +0100
@@ -336,7 +336,7 @@
 	$(BUILDTREE_COMMENT); \
 	[ -n "$$JAVA_HOME" ] && { echo ": \$${JAVA_HOME:=$${JAVA_HOME}}"; }; \
 	{ \
-	echo "CLASSPATH=$${CLASSPATH:+$$CLASSPATH:}.:\$${JAVA_HOME}/jre/lib/rt.jar:\$${JAVA_HOME}/jre/lib/i18n.jar"; \
+	echo "CLASSPATH=$${CLASSPATH:+$$CLASSPATH:}.:\$${JAVA_HOME}/jre/lib/rt.jar:$(OUTPUTDIR)/shared/graal.jar:\$${JAVA_HOME}/jre/lib/i18n.jar"; \
 	} | sed s:$${JAVA_HOME:--------}:\$${JAVA_HOME}:g; \
 	echo "HOTSPOT_BUILD_USER=\"$${LOGNAME:-$$USER} in `basename $(GAMMADIR)`\""; \
 	echo "export JAVA_HOME LD_LIBRARY_PATH CLASSPATH HOTSPOT_BUILD_USER"; \
--- a/src/share/vm/runtime/arguments.cpp	Mon Mar 11 19:21:31 2013 +0100
+++ b/src/share/vm/runtime/arguments.cpp	Mon Mar 11 20:10:27 2013 +0100
@@ -2222,20 +2222,6 @@
     FREE_C_HEAP_ARRAY(char, altclasses_path, mtInternal);
   }
 
-#ifdef GRAAL
-  {
-    // Append graal.jar to bootclasspath if enabled
-    const char* jar_file = "graal.jar";
-    const size_t path_len = strlen(get_meta_index_dir()) + 1 + strlen(jar_file);
-    char* path = NEW_C_HEAP_ARRAY(char, path_len, mtInternal);
-    strcpy(path, get_meta_index_dir());
-    strcat(path, jar_file);
-    scp.add_suffix(path);
-    scp_assembly_required = true;
-    FREE_C_HEAP_ARRAY(char, path, mtInternal);
-  }
-#endif
-
   // Parse _JAVA_OPTIONS environment variable (if present) (mimics classic VM)
   result = parse_java_options_environment_variable(&scp, &scp_assembly_required);
   if (result != JNI_OK) {
--- a/src/share/vm/runtime/os.cpp	Mon Mar 11 19:21:31 2013 +0100
+++ b/src/share/vm/runtime/os.cpp	Mon Mar 11 20:10:27 2013 +0100
@@ -1149,6 +1149,9 @@
 #ifdef __APPLE__
         "%/lib/JObjC.jar:"
 #endif
+#ifdef GRAAL
+        "%/lib/graal.jar:"
+#endif
         "%/classes";
     char* sysclasspath = format_boot_path(classpath_format, home, home_len, fileSep, pathSep);
     if (sysclasspath == NULL) return false;