changeset 21926:607a5d806916

Merge
author Christian Wimmer <christian.wimmer@oracle.com>
date Thu, 11 Jun 2015 09:51:50 -0700
parents 64475dbf6aec (current diff) c0744b24b230 (diff)
children 6a93800d10f1
files
diffstat 18 files changed, 208 insertions(+), 237 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler.sparc/src/com/oracle/graal/compiler/sparc/SPARCAddressLowering.java	Wed Jun 10 17:23:19 2015 -0700
+++ b/graal/com.oracle.graal.compiler.sparc/src/com/oracle/graal/compiler/sparc/SPARCAddressLowering.java	Thu Jun 11 09:51:50 2015 -0700
@@ -48,15 +48,14 @@
     public AddressNode lower(ValueNode base, ValueNode offset) {
         JavaConstant immBase = asImmediate(base);
         if (immBase != null && SPARCAssembler.isSimm13(immBase)) {
-            return lower(offset, immBase.asLong());
+            return lower(signExtend(offset), immBase.asLong());
         }
 
         JavaConstant immOffset = asImmediate(offset);
         if (immOffset != null && SPARCAssembler.isSimm13(immOffset)) {
             return lower(base, immOffset.asLong());
         }
-
-        return base.graph().unique(new SPARCIndexedAddressNode(base, offset));
+        return base.graph().unique(new SPARCIndexedAddressNode(base, signExtend(offset)));
     }
 
     private AddressNode lower(ValueNode base, long displacement) {
@@ -82,6 +81,10 @@
         return base.graph().unique(new SPARCImmediateAddressNode(base, (int) displacement));
     }
 
+    private static SignExtendNode signExtend(ValueNode node) {
+        return node.graph().unique(new SignExtendNode(node, Kind.Long.getBitCount()));
+    }
+
     private JavaConstant asImmediate(ValueNode value) {
         JavaConstant c = value.asJavaConstant();
         if (c != null && c.getKind().isNumericInteger() && !codeCache.needsDataPatch(c)) {
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotAddressLowering.java	Wed Jun 10 17:23:19 2015 -0700
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotAddressLowering.java	Thu Jun 11 09:51:50 2015 -0700
@@ -102,9 +102,10 @@
                 ValueNode base = compression.graph().unique(new HeapBaseNode(heapBaseRegister));
                 addr.setBase(base);
             } else if (encoding.base != 0) {
-                long disp = addr.getDisplacement() + heapBase;
+                long disp = addr.getDisplacement() + encoding.base;
                 if (NumUtil.isInt(disp)) {
                     addr.setDisplacement((int) disp);
+                    addr.setBase(null);
                 } else {
                     return false;
                 }
--- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/BytecodeParser.java	Wed Jun 10 17:23:19 2015 -0700
+++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/BytecodeParser.java	Thu Jun 11 09:51:50 2015 -0700
@@ -2974,6 +2974,13 @@
     }
 
     private ValueNode appendNullCheck(ValueNode object) {
+        if (object.stamp() instanceof AbstractPointerStamp) {
+            AbstractPointerStamp stamp = (AbstractPointerStamp) object.stamp();
+            if (stamp.nonNull()) {
+                return object;
+            }
+        }
+
         IsNullNode isNull = append(new IsNullNode(object));
         FixedGuardNode fixedGuard = append(new FixedGuardNode(isNull, DeoptimizationReason.NullCheckException, DeoptimizationAction.InvalidateReprofile, true));
         return append(new PiNode(object, object.stamp().join(StampFactory.objectNonNull()), fixedGuard));
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/IntegerSwitchNode.java	Wed Jun 10 17:23:19 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/IntegerSwitchNode.java	Thu Jun 11 09:51:50 2015 -0700
@@ -118,6 +118,8 @@
             for (Node successor : successors()) {
                 if (successor != survivingSuccessor) {
                     tool.deleteBranch(successor);
+                    // deleteBranch can change the successors so reload it
+                    survivingSuccessor = successorAtKey(constant);
                 }
             }
             tool.addToWorkList(survivingSuccessor);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/JavaWriteNode.java	Wed Jun 10 17:23:19 2015 -0700
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/JavaWriteNode.java	Thu Jun 11 09:51:50 2015 -0700
@@ -34,7 +34,7 @@
  * Write a raw memory location according to Java field or array write semantics. It will perform
  * write barriers, implicit conversions and optionally oop compression.
  */
-@NodeInfo
+@NodeInfo(nameTemplate = "JavaWrite#{p#location/s}")
 public final class JavaWriteNode extends AbstractWriteNode implements Lowerable, StateSplit, MemoryAccess, MemoryCheckpoint.Single {
 
     public static final NodeClass<JavaWriteNode> TYPE = NodeClass.create(JavaWriteNode.class);
--- a/graal/com.oracle.truffle.object.basic/src/com/oracle/truffle/object/basic/ShapeBasic.java	Wed Jun 10 17:23:19 2015 -0700
+++ b/graal/com.oracle.truffle.object.basic/src/com/oracle/truffle/object/basic/ShapeBasic.java	Thu Jun 11 09:51:50 2015 -0700
@@ -42,17 +42,6 @@
 
     @Override
     public ShapeImpl replaceProperty(Property oldProperty, Property newProperty) {
-        assert oldProperty.getKey().equals(newProperty.getKey());
-        onPropertyTransition(oldProperty);
-
-        Transition replacePropertyTransition = new Transition.DirectReplacePropertyTransition(oldProperty, newProperty);
-        ShapeImpl cachedShape = queryTransition(replacePropertyTransition);
-        if (cachedShape != null) {
-            return cachedShape;
-        }
-        PropertyMap newPropertyMap = this.getPropertyMap().replaceCopy(oldProperty, newProperty);
-        ShapeImpl newShape = createShape(getLayout(), getSharedData(), this, getObjectType(), newPropertyMap, replacePropertyTransition, allocator(), getId());
-        addDirectTransition(replacePropertyTransition, newShape);
-        return newShape;
+        return directReplaceProperty(oldProperty, newProperty);
     }
 }
--- a/graal/com.oracle.truffle.object/src/com/oracle/truffle/object/ShapeImpl.java	Wed Jun 10 17:23:19 2015 -0700
+++ b/graal/com.oracle.truffle.object/src/com/oracle/truffle/object/ShapeImpl.java	Thu Jun 11 09:51:50 2015 -0700
@@ -80,7 +80,6 @@
 
     protected final int depth;
     protected final int propertyCount;
-    protected Property[] propertyArray;
 
     protected final Assumption validAssumption;
     @CompilationFinal protected volatile Assumption leafAssumption;
@@ -121,11 +120,9 @@
 
         if (parent != null) {
             this.propertyCount = makePropertyCount(parent, propertyMap);
-            this.propertyArray = makePropertiesList(parent, propertyMap);
             this.depth = parent.depth + 1;
         } else {
             this.propertyCount = 0;
-            this.propertyArray = null;
             this.depth = 0;
         }
 
@@ -156,30 +153,6 @@
         return parent.propertyCount + ((propertyMap.size() > parent.propertyMap.size() && !propertyMap.getLastProperty().isHidden() && !propertyMap.getLastProperty().isShadow()) ? 1 : 0);
     }
 
-    private static Property[] makePropertiesList(ShapeImpl parent, PropertyMap propertyMap) {
-        Property[] properties = parent.propertyArray;
-        if (properties != null && propertyMap.size() != parent.propertyMap.size()) {
-            Property lastProperty = propertyMap.getLastProperty();
-            if (lastProperty != null && !lastProperty.isHidden()) {
-                propertyListAllocCount.inc();
-                if (!lastProperty.isShadow()) {
-                    properties = Arrays.copyOf(properties, properties.length + 1);
-                    properties[properties.length - 1] = lastProperty;
-                } else {
-                    properties = Arrays.copyOf(properties, properties.length);
-                    for (int i = 0; i < properties.length; i++) {
-                        if (properties[i].isSame(lastProperty)) {
-                            properties[i] = lastProperty;
-                        }
-                    }
-                }
-            } else {
-                propertyListShareCount.inc();
-            }
-        }
-        return properties;
-    }
-
     @Override
     public final Property getLastProperty() {
         return propertyMap.getLastProperty();
@@ -343,7 +316,7 @@
         return addPropertyInternal(property);
     }
 
-    protected final void onPropertyTransition(Property property) {
+    private void onPropertyTransition(Property property) {
         if (sharedData instanceof ShapeListener) {
             ((ShapeListener) sharedData).onPropertyTransition(property.getKey());
         }
@@ -698,6 +671,10 @@
      */
     @Override
     public ShapeImpl replaceProperty(Property oldProperty, Property newProperty) {
+        return indirectReplaceProperty(oldProperty, newProperty);
+    }
+
+    protected final ShapeImpl indirectReplaceProperty(Property oldProperty, Property newProperty) {
         assert oldProperty.getKey().equals(newProperty.getKey());
 
         Transition replacePropertyTransition = new Transition.IndirectReplacePropertyTransition(oldProperty, newProperty);
@@ -726,10 +703,27 @@
                 newShape = newShape.applyTransition(transition, false);
             }
         }
+
         addIndirectTransition(replacePropertyTransition, newShape);
         return newShape;
     }
 
+    protected final ShapeImpl directReplaceProperty(Property oldProperty, Property newProperty) {
+        assert oldProperty.getKey().equals(newProperty.getKey());
+        onPropertyTransition(oldProperty);
+
+        Transition replacePropertyTransition = new Transition.DirectReplacePropertyTransition(oldProperty, newProperty);
+        ShapeImpl cachedShape = queryTransition(replacePropertyTransition);
+        if (cachedShape != null) {
+            return cachedShape;
+        }
+        PropertyMap newPropertyMap = this.getPropertyMap().replaceCopy(oldProperty, newProperty);
+        ShapeImpl newShape = createShape(getLayout(), getSharedData(), this, getObjectType(), newPropertyMap, replacePropertyTransition, allocator(), getId());
+
+        addDirectTransition(replacePropertyTransition, newShape);
+        return newShape;
+    }
+
     /**
      * Find lowest common ancestor of two related shapes.
      */
@@ -880,43 +874,7 @@
 
     @Override
     public final Iterable<Property> getProperties() {
-        if (getPropertyCount() != 0 && propertyArray == null) {
-            CompilerDirectives.transferToInterpreter();
-            propertyArray = createPropertiesArray();
-        }
-        return new Iterable<Property>() {
-            public Iterator<Property> iterator() {
-                return new Iterator<Property>() {
-                    private int cursor;
-
-                    public boolean hasNext() {
-                        return cursor < getPropertyCount();
-                    }
-
-                    public Property next() {
-                        if (hasNext()) {
-                            return propertyArray[cursor++];
-                        }
-                        throw new NoSuchElementException();
-                    }
-
-                    public void remove() {
-                        throw new UnsupportedOperationException();
-                    }
-                };
-            }
-        };
-    }
-
-    private Property[] createPropertiesArray() {
-        propertyListAllocCount.inc();
-        Property[] propertiesArray = new Property[getPropertyCount()];
-        List<Property> ownProperties = getPropertyList();
-        assert ownProperties.size() == getPropertyCount();
-        for (int i = 0; i < getPropertyCount(); i++) {
-            propertiesArray[i] = ownProperties.get(i);
-        }
-        return propertiesArray;
+        return getPropertyList();
     }
 
     @Override
@@ -1122,9 +1080,6 @@
     private static final DebugCounter shapeCacheHitCount = DebugCounter.create("Shape cache hits");
     private static final DebugCounter shapeCacheMissCount = DebugCounter.create("Shape cache misses");
 
-    protected static final DebugCounter propertyListAllocCount = DebugCounter.create("Property lists allocated");
-    protected static final DebugCounter propertyListShareCount = DebugCounter.create("Property lists shared");
-
     public ForeignAccess getForeignAccessFactory() {
         return getObjectType().getForeignAccessFactory();
     }
--- a/make/Makefile	Wed Jun 10 17:23:19 2015 -0700
+++ b/make/Makefile	Thu Jun 11 09:51:50 2015 -0700
@@ -315,7 +315,8 @@
 		TARGET=build/make \
 		HS_COMMON_SRC=$(HS_COMMON_SRC) \
 		ABS_BOOTDIR=$(ABS_BOOTDIR) \
-		EXPORT_DIR=$(SHARED_DIR) export
+		SHARED_DIR=$(SHARED_DIR) \
+		MAKE_VERBOSE=$(MAKE_VERBOSE) export
 
 # Export file rule
 generic_export: $(EXPORT_LIST)
--- a/make/aix/makefiles/defs.make	Wed Jun 10 17:23:19 2015 -0700
+++ b/make/aix/makefiles/defs.make	Thu Jun 11 09:51:50 2015 -0700
@@ -192,9 +192,9 @@
 #    EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libjsig.debuginfo
 #  endif
 #endif
-EXPORT_SERVER_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/server
-EXPORT_CLIENT_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/client
-EXPORT_MINIMAL_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/minimal
+EXPORT_SERVER_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/server$(COMPILER_DIR_SUFFIX)
+EXPORT_CLIENT_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/client$(COMPILER_DIR_SUFFIX)
+EXPORT_MINIMAL_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/minimal$(COMPILER_DIR_SUFFIX)
 
 ifeq ($(findstring true, $(JVM_VARIANT_SERVER) $(JVM_VARIANT_ZERO) $(JVM_VARIANT_ZEROSHARK) $(JVM_VARIANT_CORE)), true)
   EXPORT_LIST += $(EXPORT_SERVER_DIR)/Xusage.txt
--- a/make/bsd/makefiles/defs.make	Wed Jun 10 17:23:19 2015 -0700
+++ b/make/bsd/makefiles/defs.make	Thu Jun 11 09:51:50 2015 -0700
@@ -280,9 +280,9 @@
   endif
 endif
 
-EXPORT_SERVER_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/server
-EXPORT_CLIENT_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/client
-EXPORT_MINIMAL_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/minimal
+EXPORT_SERVER_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/server$(COMPILER_DIR_SUFFIX)
+EXPORT_CLIENT_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/client$(COMPILER_DIR_SUFFIX)
+EXPORT_MINIMAL_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/minimal$(COMPILER_DIR_SUFFIX)
 
 ifeq ($(findstring true, $(JVM_VARIANT_SERVER) $(JVM_VARIANT_ZERO) $(JVM_VARIANT_ZEROSHARK)), true)
   EXPORT_LIST += $(EXPORT_SERVER_DIR)/Xusage.txt
--- a/make/defs.make	Wed Jun 10 17:23:19 2015 -0700
+++ b/make/defs.make	Thu Jun 11 09:51:50 2015 -0700
@@ -113,6 +113,11 @@
   endif
 endif
 
+# If we build a no-jvmci-version, we suffix the compiler dir with -nojvmci
+ifeq ($(COMPILER_DIR_SUFFIX)$(subst false,,$(INCLUDE_JVMCI)),)
+	COMPILER_DIR_SUFFIX=-nojvmci
+endif
+
 # hotspot version definitions
 include $(GAMMADIR)/make/hotspot_version
 
@@ -364,6 +369,9 @@
 EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_DIR)/jvmci-hotspot.jar
 
 EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_SERVICES_DIR)/com.oracle.jvmci.hotspot.HotSpotJVMCIBackendFactory
+EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_SERVICES_DIR)/com.oracle.jvmci.hotspot.HotSpotVMEventListener
+EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_SERVICES_DIR)/com.oracle.jvmci.options.Options
+EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_SERVICES_DIR)/com.oracle.jvmci.debug.TTYStreamProvider
 
 ifneq ("$(wildcard $(SHARED_DIR)/services/com.oracle.jvmci.hotspot.events.EventProvider)","")
 EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_SERVICES_DIR)/com.oracle.jvmci.hotspot.events.EventProvider
@@ -375,6 +383,7 @@
 EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_OPTIONS_DIR)/com.oracle.jvmci.hotspot.HotSpotResolvedJavaMethodImpl
 EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_OPTIONS_DIR)/com.oracle.jvmci.hotspot.CompileTheWorld
 EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_OPTIONS_DIR)/com.oracle.jvmci.compiler.Compiler
+EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_OPTIONS_DIR)/com.oracle.jvmci.debug.JVMCIDebugConfig
 
 
 .PHONY: $(HS_ALT_MAKE)/defs.make
--- a/make/jvmci.make	Wed Jun 10 17:23:19 2015 -0700
+++ b/make/jvmci.make	Thu Jun 11 09:51:50 2015 -0700
@@ -19,73 +19,102 @@
 ifeq ($(ABS_BOOTDIR),)
     $(error Variable ABS_BOOTDIR must be set to a JDK installation.)
 endif
-ifneq ($(MAKE_VERBOSE),)
-    SHELL=sh -x
+ifeq ($(MAKE_VERBOSE),)
+    QUIETLY=@
 endif
 
+# Required to construct a whitespace for use with subst
+space :=
+space +=
+
+# Takes the option files of the options annotation processor and merges them into a single file
+# Arguments:
+#  1: directory with contents of the JAR file
 define process_options
     $(eval providers=$(1)/$(PROVIDERS_INF))
     $(eval services=$(1)/$(SERVICES_INF))
     $(eval options=$(1)/$(OPTIONS_INF))
-    test -d $(services) || mkdir -p $(services)
-    test ! -d $(providers) || (cd $(providers) && for i in $$(ls); do c=$$(cat $$i); echo $$i >> $(abspath $(services))/$$c; rm $$i; done)
+    $(QUIETLY) test -d $(services) || mkdir -p $(services)
+    $(QUIETLY) test ! -d $(providers) || (cd $(providers) && for i in $$(ls); do c=$$(cat $$i); echo $$i >> $(abspath $(services))/$$c; rm $$i; done)
 
-    # Since all projects are built together with one javac call we cannot determine
-    # which project contains HotSpotVMConfig.inline.hpp so we hardcode it.
+    @# Since all projects are built together with one javac call we cannot determine
+    @# which project contains HotSpotVMConfig.inline.hpp so we hardcode it.
     $(eval vmconfig=$(1)/hotspot/HotSpotVMConfig.inline.hpp)
     $(eval vmconfigDest=$(HS_COMMON_SRC)/../jvmci/com.oracle.jvmci.hotspot/src_gen/hotspot)
-    test ! -f $(vmconfig) || (mkdir -p $(vmconfigDest) && cp $(vmconfig) $(vmconfigDest))
+    $(QUIETLY) test ! -f $(vmconfig) || (mkdir -p $(vmconfigDest) && cp $(vmconfig) $(vmconfigDest))
 endef
 
+# Extracts META-INF/services and META-INF/options of a JAR file into a given directory
+# Arguments:
+#  1: JAR file to extract
+#  2: target directory
 define extract
-    $(eval TMP := $(shell mktemp -d $(1)_XXXXX))
-    mkdir -p $(2);
-    cd $(TMP) && $(JAR) xf $(abspath $(1)) && \
+    $(eval TMP := $(shell mktemp -d $(TARGET)/tmp_XXXXX))
+    $(QUIETLY) mkdir -p $(2);
+    $(QUIETLY) cd $(TMP) && $(JAR) xf $(abspath $(1)) && \
         ((test ! -d .$(SERVICES_INF) || cp -r .$(SERVICES_INF) $(abspath $(2))) &&  (test ! -d .$(OPTIONS_INF) || cp -r .$(OPTIONS_INF) $(abspath $(2))));
-    rm -r $(TMP);
-    cp $(1) $(2);
+    $(QUIETLY) rm -r $(TMP);
+    $(QUIETLY) cp $(1) $(2);
 endef
 
+# Calls $(JAVAC) with the bootclasspath $(JDK_BOOTCLASSPATH); sources are taken from the automatic variable $^
+# Arguments:
+#  1: processorpath
+#  2: classpath
+#  3: resources to copy
+#  4: target JAR file
+define build_and_jar
+    $(info Building $(4))
+    $(eval TMP := $(shell mkdir -p $(TARGET) && mktemp -d $(TARGET)/tmp_XXXXX))
+    $(QUIETLY) $(JAVAC) -d $(TMP) -processorpath :$(1) -bootclasspath $(JDK_BOOTCLASSPATH) -cp :$(2) $(filter %.java,$^);
+    $(QUIETLY) test "$(3)" = "" || cp -r $(3) $(TMP);
+    $(QUIETLY) $(call process_options,$(TMP));
+    $(QUIETLY) mkdir -p $(shell dirname $(4))
+    $(QUIETLY) $(JAR) cf $(4) -C $(TMP) .
+    $(QUIETLY) rm -r $(TMP);
+endef
+
+# Verifies if the defs.make contain the exported files of services/
+define verify_export_def_make
+    $(foreach file,$(1),$(if $(shell grep '$(2)$(file)' $(3) > /dev/null && echo found), , $(error "Pattern '$(2)$(file)' not found in $(3)")))
+endef
 
 all: default
 
 export: all
-	mkdir -p $(EXPORT_DIR)
-	$(foreach export,$(EXPORTED_FILES),$(call extract,$(export),$(EXPORT_DIR)))
+	$(info Put $(EXPORTED_FILES) into SHARED_DIR $(SHARED_DIR))
+	$(QUIETLY) mkdir -p $(SHARED_DIR)
+	$(foreach export,$(EXPORTED_FILES),$(call extract,$(export),$(SHARED_DIR)))
+	$(call verify_export_def_make,$(notdir $(wildcard $(SHARED_DIR)/services/*)),EXPORT_LIST += $$(EXPORT_JRE_LIB_JVMCI_SERVICES_DIR)/,make/defs.make)
+	$(call verify_export_def_make,$(notdir $(wildcard $(SHARED_DIR)/options/*)),EXPORT_LIST += $$(EXPORT_JRE_LIB_JVMCI_OPTIONS_DIR)/,make/defs.make)
 .PHONY: export
 
 
 
 JDK_BOOTCLASSPATH = $(ABS_BOOTDIR)/jre/lib/resources.jar:$(ABS_BOOTDIR)/jre/lib/rt.jar:$(ABS_BOOTDIR)/jre/lib/jsse.jar:$(ABS_BOOTDIR)/jre/lib/jce.jar:$(ABS_BOOTDIR)/jre/lib/charsets.jar:$(ABS_BOOTDIR)/jre/lib/jfr.jar
 
-JVMCI_OPTIONS_PROCESSOR_SRC = $(shell find jvmci/com.oracle.jvmci.options/src -type f -name '*.java' 2> /dev/null)
-JVMCI_OPTIONS_PROCESSOR_SRC += $(shell find jvmci/com.oracle.jvmci.options.processor/src -type f -name '*.java' 2> /dev/null)
+JVMCI_OPTIONS_PROCESSOR_SRC = $(shell find jvmci/com.oracle.jvmci.options/src -type f 2> /dev/null)
+JVMCI_OPTIONS_PROCESSOR_SRC += $(shell find jvmci/com.oracle.jvmci.options.processor/src -type f 2> /dev/null)
 
 JVMCI_OPTIONS_PROCESSOR_JAR = $(TARGET)/jvmci/com.oracle.jvmci.options.processor/ap/com.oracle.jvmci.options.processor.jar
 
-JVMCI_HOTSPOTVMCONFIG_PROCESSOR_SRC = $(shell find jvmci/com.oracle.jvmci.hotspotvmconfig/src -type f -name '*.java' 2> /dev/null)
-JVMCI_HOTSPOTVMCONFIG_PROCESSOR_SRC += $(shell find jvmci/com.oracle.jvmci.common/src -type f -name '*.java' 2> /dev/null)
-JVMCI_HOTSPOTVMCONFIG_PROCESSOR_SRC += $(shell find jvmci/com.oracle.jvmci.hotspotvmconfig.processor/src -type f -name '*.java' 2> /dev/null)
+JVMCI_HOTSPOTVMCONFIG_PROCESSOR_SRC = $(shell find jvmci/com.oracle.jvmci.hotspotvmconfig/src -type f 2> /dev/null)
+JVMCI_HOTSPOTVMCONFIG_PROCESSOR_SRC += $(shell find jvmci/com.oracle.jvmci.common/src -type f 2> /dev/null)
+JVMCI_HOTSPOTVMCONFIG_PROCESSOR_SRC += $(shell find jvmci/com.oracle.jvmci.hotspotvmconfig.processor/src -type f 2> /dev/null)
 
 JVMCI_HOTSPOTVMCONFIG_PROCESSOR_JAR = $(TARGET)/jvmci/com.oracle.jvmci.hotspotvmconfig.processor/ap/com.oracle.jvmci.hotspotvmconfig.processor.jar
 
-JVMCI_SERVICE_PROCESSOR_SRC = $(shell find jvmci/com.oracle.jvmci.service/src -type f -name '*.java' 2> /dev/null)
-JVMCI_SERVICE_PROCESSOR_SRC += $(shell find jvmci/com.oracle.jvmci.service.processor/src -type f -name '*.java' 2> /dev/null)
+JVMCI_SERVICE_PROCESSOR_SRC = $(shell find jvmci/com.oracle.jvmci.service/src -type f 2> /dev/null)
+JVMCI_SERVICE_PROCESSOR_SRC += $(shell find jvmci/com.oracle.jvmci.service.processor/src -type f 2> /dev/null)
 
 JVMCI_SERVICE_PROCESSOR_JAR = $(TARGET)/jvmci/com.oracle.jvmci.service.processor/ap/com.oracle.jvmci.service.processor.jar
 
-JVMCI_API_SRC = $(shell find jvmci/com.oracle.jvmci.meta/src -type f -name '*.java' 2> /dev/null)
-JVMCI_API_SRC += $(shell find jvmci/com.oracle.jvmci.meta/jvmci/com.oracle.jvmci.meta/src_gen -type f -name '*.java' 2> /dev/null)
-JVMCI_API_SRC += $(shell find jvmci/com.oracle.jvmci.code/src -type f -name '*.java' 2> /dev/null)
-JVMCI_API_SRC += $(shell find jvmci/com.oracle.jvmci.code/jvmci/com.oracle.jvmci.code/src_gen -type f -name '*.java' 2> /dev/null)
-JVMCI_API_SRC += $(shell find jvmci/com.oracle.jvmci.runtime/src -type f -name '*.java' 2> /dev/null)
-JVMCI_API_SRC += $(shell find jvmci/com.oracle.jvmci.runtime/jvmci/com.oracle.jvmci.runtime/src_gen -type f -name '*.java' 2> /dev/null)
-JVMCI_API_SRC += $(shell find jvmci/com.oracle.jvmci.options/src -type f -name '*.java' 2> /dev/null)
-JVMCI_API_SRC += $(shell find jvmci/com.oracle.jvmci.options/jvmci/com.oracle.jvmci.options/src_gen -type f -name '*.java' 2> /dev/null)
-JVMCI_API_SRC += $(shell find jvmci/com.oracle.jvmci.common/src -type f -name '*.java' 2> /dev/null)
-JVMCI_API_SRC += $(shell find jvmci/com.oracle.jvmci.common/jvmci/com.oracle.jvmci.common/src_gen -type f -name '*.java' 2> /dev/null)
-JVMCI_API_SRC += $(shell find jvmci/com.oracle.jvmci.debug/src -type f -name '*.java' 2> /dev/null)
-JVMCI_API_SRC += $(shell find jvmci/com.oracle.jvmci.debug/jvmci/com.oracle.jvmci.debug/src_gen -type f -name '*.java' 2> /dev/null)
+JVMCI_API_SRC = $(shell find jvmci/com.oracle.jvmci.meta/src -type f 2> /dev/null)
+JVMCI_API_SRC += $(shell find jvmci/com.oracle.jvmci.code/src -type f 2> /dev/null)
+JVMCI_API_SRC += $(shell find jvmci/com.oracle.jvmci.runtime/src -type f 2> /dev/null)
+JVMCI_API_SRC += $(shell find jvmci/com.oracle.jvmci.options/src -type f 2> /dev/null)
+JVMCI_API_SRC += $(shell find jvmci/com.oracle.jvmci.common/src -type f 2> /dev/null)
+JVMCI_API_SRC += $(shell find jvmci/com.oracle.jvmci.debug/src -type f 2> /dev/null)
 
 JVMCI_API_JAR = $(TARGET)/build/jvmci-api.jar
 
@@ -93,7 +122,7 @@
 
 EXPORTED_FILES += $(JVMCI_API_JAR)
 
-JVMCI_SERVICE_SRC = $(shell find jvmci/com.oracle.jvmci.service/src -type f -name '*.java' 2> /dev/null)
+JVMCI_SERVICE_SRC = $(shell find jvmci/com.oracle.jvmci.service/src -type f 2> /dev/null)
 
 JVMCI_SERVICE_JAR = $(TARGET)/build/jvmci-service.jar
 
@@ -101,22 +130,14 @@
 
 EXPORTED_FILES += $(JVMCI_SERVICE_JAR)
 
-JVMCI_HOTSPOT_SRC = $(shell find jvmci/com.oracle.jvmci.hotspotvmconfig/src -type f -name '*.java' 2> /dev/null)
-JVMCI_HOTSPOT_SRC += $(shell find jvmci/com.oracle.jvmci.hotspotvmconfig/jvmci/com.oracle.jvmci.hotspotvmconfig/src_gen -type f -name '*.java' 2> /dev/null)
-JVMCI_HOTSPOT_SRC += $(shell find jvmci/com.oracle.jvmci.amd64/src -type f -name '*.java' 2> /dev/null)
-JVMCI_HOTSPOT_SRC += $(shell find jvmci/com.oracle.jvmci.amd64/jvmci/com.oracle.jvmci.amd64/src_gen -type f -name '*.java' 2> /dev/null)
-JVMCI_HOTSPOT_SRC += $(shell find jvmci/com.oracle.jvmci.compiler/src -type f -name '*.java' 2> /dev/null)
-JVMCI_HOTSPOT_SRC += $(shell find jvmci/com.oracle.jvmci.compiler/jvmci/com.oracle.jvmci.compiler/src_gen -type f -name '*.java' 2> /dev/null)
-JVMCI_HOTSPOT_SRC += $(shell find jvmci/com.oracle.jvmci.hotspot/src -type f -name '*.java' 2> /dev/null)
-JVMCI_HOTSPOT_SRC += $(shell find jvmci/com.oracle.jvmci.hotspot/jvmci/com.oracle.jvmci.hotspot/src_gen -type f -name '*.java' 2> /dev/null)
-JVMCI_HOTSPOT_SRC += $(shell find jvmci/com.oracle.jvmci.hotspot.amd64/src -type f -name '*.java' 2> /dev/null)
-JVMCI_HOTSPOT_SRC += $(shell find jvmci/com.oracle.jvmci.hotspot.amd64/jvmci/com.oracle.jvmci.hotspot.amd64/src_gen -type f -name '*.java' 2> /dev/null)
-JVMCI_HOTSPOT_SRC += $(shell find jvmci/com.oracle.jvmci.sparc/src -type f -name '*.java' 2> /dev/null)
-JVMCI_HOTSPOT_SRC += $(shell find jvmci/com.oracle.jvmci.sparc/jvmci/com.oracle.jvmci.sparc/src_gen -type f -name '*.java' 2> /dev/null)
-JVMCI_HOTSPOT_SRC += $(shell find jvmci/com.oracle.jvmci.hotspot.sparc/src -type f -name '*.java' 2> /dev/null)
-JVMCI_HOTSPOT_SRC += $(shell find jvmci/com.oracle.jvmci.hotspot.sparc/jvmci/com.oracle.jvmci.hotspot.sparc/src_gen -type f -name '*.java' 2> /dev/null)
-JVMCI_HOTSPOT_SRC += $(shell find jvmci/com.oracle.jvmci.hotspot.jfr/src -type f -name '*.java' 2> /dev/null)
-JVMCI_HOTSPOT_SRC += $(shell find jvmci/com.oracle.jvmci.hotspot.jfr/jvmci/com.oracle.jvmci.hotspot.jfr/src_gen -type f -name '*.java' 2> /dev/null)
+JVMCI_HOTSPOT_SRC = $(shell find jvmci/com.oracle.jvmci.hotspotvmconfig/src -type f 2> /dev/null)
+JVMCI_HOTSPOT_SRC += $(shell find jvmci/com.oracle.jvmci.amd64/src -type f 2> /dev/null)
+JVMCI_HOTSPOT_SRC += $(shell find jvmci/com.oracle.jvmci.compiler/src -type f 2> /dev/null)
+JVMCI_HOTSPOT_SRC += $(shell find jvmci/com.oracle.jvmci.hotspot/src -type f 2> /dev/null)
+JVMCI_HOTSPOT_SRC += $(shell find jvmci/com.oracle.jvmci.hotspot.amd64/src -type f 2> /dev/null)
+JVMCI_HOTSPOT_SRC += $(shell find jvmci/com.oracle.jvmci.sparc/src -type f 2> /dev/null)
+JVMCI_HOTSPOT_SRC += $(shell find jvmci/com.oracle.jvmci.hotspot.sparc/src -type f 2> /dev/null)
+JVMCI_HOTSPOT_SRC += $(shell find jvmci/com.oracle.jvmci.hotspot.jfr/src -type f 2> /dev/null)
 
 JVMCI_HOTSPOT_JAR = $(TARGET)/build/jvmci-hotspot.jar
 
@@ -125,58 +146,28 @@
 EXPORTED_FILES += $(JVMCI_HOTSPOT_JAR)
 
 $(JVMCI_OPTIONS_PROCESSOR_JAR): $(JVMCI_OPTIONS_PROCESSOR_SRC)  
-	$(eval TMP := $(shell mktemp -d JVMCI_OPTIONS_PROCESSOR_XXXXX))
-	$(JAVAC) -d $(TMP)  -bootclasspath $(JDK_BOOTCLASSPATH)  $(JVMCI_OPTIONS_PROCESSOR_SRC)
-	cp -r jvmci/com.oracle.jvmci.options.processor/src/META-INF $(TMP)
-	$(call process_options,$(TMP),False)
-	mkdir -p $$(dirname $(JVMCI_OPTIONS_PROCESSOR_JAR))
-	$(JAR) cf $(JVMCI_OPTIONS_PROCESSOR_JAR) -C $(TMP) .
-	rm -r $(TMP)
+	$(call build_and_jar,,$(subst  $(space),:,),jvmci/com.oracle.jvmci.options.processor/src/META-INF,$(JVMCI_OPTIONS_PROCESSOR_JAR))
+
 
 $(JVMCI_HOTSPOTVMCONFIG_PROCESSOR_JAR): $(JVMCI_HOTSPOTVMCONFIG_PROCESSOR_SRC)  
-	$(eval TMP := $(shell mktemp -d JVMCI_HOTSPOTVMCONFIG_PROCESSOR_XXXXX))
-	$(JAVAC) -d $(TMP)  -bootclasspath $(JDK_BOOTCLASSPATH)  $(JVMCI_HOTSPOTVMCONFIG_PROCESSOR_SRC)
-	cp -r jvmci/com.oracle.jvmci.hotspotvmconfig.processor/src/META-INF $(TMP)
-	$(call process_options,$(TMP),False)
-	mkdir -p $$(dirname $(JVMCI_HOTSPOTVMCONFIG_PROCESSOR_JAR))
-	$(JAR) cf $(JVMCI_HOTSPOTVMCONFIG_PROCESSOR_JAR) -C $(TMP) .
-	rm -r $(TMP)
+	$(call build_and_jar,,$(subst  $(space),:,),jvmci/com.oracle.jvmci.hotspotvmconfig.processor/src/META-INF,$(JVMCI_HOTSPOTVMCONFIG_PROCESSOR_JAR))
+
 
 $(JVMCI_SERVICE_PROCESSOR_JAR): $(JVMCI_SERVICE_PROCESSOR_SRC)  
-	$(eval TMP := $(shell mktemp -d JVMCI_SERVICE_PROCESSOR_XXXXX))
-	$(JAVAC) -d $(TMP)  -bootclasspath $(JDK_BOOTCLASSPATH)  $(JVMCI_SERVICE_PROCESSOR_SRC)
-	cp -r jvmci/com.oracle.jvmci.service.processor/src/META-INF $(TMP)
-	$(call process_options,$(TMP),False)
-	mkdir -p $$(dirname $(JVMCI_SERVICE_PROCESSOR_JAR))
-	$(JAR) cf $(JVMCI_SERVICE_PROCESSOR_JAR) -C $(TMP) .
-	rm -r $(TMP)
+	$(call build_and_jar,,$(subst  $(space),:,),jvmci/com.oracle.jvmci.service.processor/src/META-INF,$(JVMCI_SERVICE_PROCESSOR_JAR))
+
 
 $(JVMCI_API_JAR): $(JVMCI_API_SRC) $(JVMCI_OPTIONS_PROCESSOR_JAR) $(JVMCI_API_DEP_JARS)
-	$(eval TMP := $(shell mktemp -d JVMCI_API_XXXXX))
-	$(JAVAC) -d $(TMP) -processorpath $(JVMCI_OPTIONS_PROCESSOR_JAR) -bootclasspath $(JDK_BOOTCLASSPATH) -cp $(shell echo $(JVMCI_API_DEP_JARS) | tr ' ' ':') $(JVMCI_API_SRC)
-	
-	$(call process_options,$(TMP),True)
-	mkdir -p $$(dirname $(JVMCI_API_JAR))
-	$(JAR) cf $(JVMCI_API_JAR) -C $(TMP) .
-	rm -r $(TMP)
+	$(call build_and_jar,$(JVMCI_OPTIONS_PROCESSOR_JAR),$(subst  $(space),:,$(JVMCI_API_DEP_JARS)),,$(JVMCI_API_JAR))
+
 
 $(JVMCI_SERVICE_JAR): $(JVMCI_SERVICE_SRC)  $(JVMCI_SERVICE_DEP_JARS)
-	$(eval TMP := $(shell mktemp -d JVMCI_SERVICE_XXXXX))
-	$(JAVAC) -d $(TMP)  -bootclasspath $(JDK_BOOTCLASSPATH) -cp $(shell echo $(JVMCI_SERVICE_DEP_JARS) | tr ' ' ':') $(JVMCI_SERVICE_SRC)
-	
-	$(call process_options,$(TMP),True)
-	mkdir -p $$(dirname $(JVMCI_SERVICE_JAR))
-	$(JAR) cf $(JVMCI_SERVICE_JAR) -C $(TMP) .
-	rm -r $(TMP)
+	$(call build_and_jar,,$(subst  $(space),:,$(JVMCI_SERVICE_DEP_JARS)),,$(JVMCI_SERVICE_JAR))
+
 
 $(JVMCI_HOTSPOT_JAR): $(JVMCI_HOTSPOT_SRC) $(JVMCI_HOTSPOTVMCONFIG_PROCESSOR_JAR) $(JVMCI_OPTIONS_PROCESSOR_JAR) $(JVMCI_SERVICE_PROCESSOR_JAR) $(JVMCI_HOTSPOT_DEP_JARS)
-	$(eval TMP := $(shell mktemp -d JVMCI_HOTSPOT_XXXXX))
-	$(JAVAC) -d $(TMP) -processorpath $(JVMCI_HOTSPOTVMCONFIG_PROCESSOR_JAR):$(JVMCI_OPTIONS_PROCESSOR_JAR):$(JVMCI_SERVICE_PROCESSOR_JAR) -bootclasspath $(JDK_BOOTCLASSPATH) -cp $(shell echo $(JVMCI_HOTSPOT_DEP_JARS) | tr ' ' ':') $(JVMCI_HOTSPOT_SRC)
-	
-	$(call process_options,$(TMP),True)
-	mkdir -p $$(dirname $(JVMCI_HOTSPOT_JAR))
-	$(JAR) cf $(JVMCI_HOTSPOT_JAR) -C $(TMP) .
-	rm -r $(TMP)
+	$(call build_and_jar,$(JVMCI_HOTSPOTVMCONFIG_PROCESSOR_JAR):$(JVMCI_OPTIONS_PROCESSOR_JAR):$(JVMCI_SERVICE_PROCESSOR_JAR),$(subst  $(space),:,$(JVMCI_HOTSPOT_DEP_JARS)),,$(JVMCI_HOTSPOT_JAR))
+
 
 default: $(JVMCI_API_JAR) $(JVMCI_SERVICE_JAR) $(JVMCI_HOTSPOT_JAR)
 .PHONY: default
\ No newline at end of file
--- a/make/linux/makefiles/defs.make	Wed Jun 10 17:23:19 2015 -0700
+++ b/make/linux/makefiles/defs.make	Thu Jun 11 09:51:50 2015 -0700
@@ -265,9 +265,9 @@
     EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libjsig.debuginfo
   endif
 endif
-EXPORT_SERVER_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/server
-EXPORT_CLIENT_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/client
-EXPORT_MINIMAL_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/minimal
+EXPORT_SERVER_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/server$(COMPILER_DIR_SUFFIX)
+EXPORT_CLIENT_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/client$(COMPILER_DIR_SUFFIX)
+EXPORT_MINIMAL_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/minimal$(COMPILER_DIR_SUFFIX)
 
 ifeq ($(findstring true, $(JVM_VARIANT_SERVER) $(JVM_VARIANT_ZERO) $(JVM_VARIANT_ZEROSHARK) $(JVM_VARIANT_CORE)), true)
   EXPORT_LIST += $(EXPORT_SERVER_DIR)/Xusage.txt
--- a/make/linux/makefiles/vm.make	Wed Jun 10 17:23:19 2015 -0700
+++ b/make/linux/makefiles/vm.make	Thu Jun 11 09:51:50 2015 -0700
@@ -383,10 +383,7 @@
 DEST_JVM_DEBUGINFO = $(DEST_SUBDIR)/$(LIBJVM_DEBUGINFO)
 DEST_JVM_DIZ       = $(DEST_SUBDIR)/$(LIBJVM_DIZ)
 
-$(DEST_SUBDIR):
-	mkdir $(DEST_SUBDIR)
-
-install_jvm: $(LIBJVM) $(DEST_SUBDIR)
+install_jvm: $(LIBJVM)
 	@echo "Copying $(LIBJVM) to $(DEST_JVM)"
 	$(QUIETLY) test ! -f $(LIBJVM_DEBUGINFO) || \
 	    cp -f $(LIBJVM_DEBUGINFO) $(DEST_JVM_DEBUGINFO)
--- a/make/solaris/makefiles/defs.make	Wed Jun 10 17:23:19 2015 -0700
+++ b/make/solaris/makefiles/defs.make	Thu Jun 11 09:51:50 2015 -0700
@@ -233,8 +233,8 @@
   endif
 endif
 
-EXPORT_SERVER_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/server
-EXPORT_CLIENT_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/client
+EXPORT_SERVER_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/server$(COMPILER_DIR_SUFFIX)
+EXPORT_CLIENT_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/client$(COMPILER_DIR_SUFFIX)
 
 ifeq ($(JVM_VARIANT_SERVER),true)
   EXPORT_LIST += $(EXPORT_SERVER_DIR)/Xusage.txt
--- a/make/solaris/makefiles/vm.make	Wed Jun 10 17:23:19 2015 -0700
+++ b/make/solaris/makefiles/vm.make	Thu Jun 11 09:51:50 2015 -0700
@@ -334,10 +334,7 @@
 DEST_JVM_DEBUGINFO = $(DEST_SUBDIR)/$(LIBJVM_DEBUGINFO)
 DEST_JVM_DIZ       = $(DEST_SUBDIR)/$(LIBJVM_DIZ)
 
-$(DEST_SUBDIR):
-	mkdir $(DEST_SUBDIR)
-
-install_jvm: $(LIBJVM) $(DEST_SUBDIR)
+install_jvm: $(LIBJVM)
 	@echo "Copying $(LIBJVM) to $(DEST_JVM)"
 	$(QUIETLY) test ! -f $(LIBJVM_DEBUGINFO) || \
 	    cp -f $(LIBJVM_DEBUGINFO) $(DEST_JVM_DEBUGINFO)
--- a/mx/mx_graal.py	Wed Jun 10 17:23:19 2015 -0700
+++ b/mx/mx_graal.py	Thu Jun 11 09:51:50 2015 -0700
@@ -1013,9 +1013,7 @@
             setMakeVar('ZIP_DEBUGINFO_FILES', '0', env=env)
 
             if buildSuffix == "1":
-                setMakeVar("JVM_VARIANTS", "client")
-            elif buildSuffix == "":
-                setMakeVar("JVM_VARIANTS", "server")
+                setMakeVar("BUILD_CLIENT_ONLY", "true")
 
             # Clear this variable as having it set can cause very confusing build problems
             env.pop('CLASSPATH', None)
--- a/mx/mx_graal_makefile.py	Wed Jun 10 17:23:19 2015 -0700
+++ b/mx/mx_graal_makefile.py	Thu Jun 11 09:51:50 2015 -0700
@@ -78,7 +78,7 @@
         if e not in li:
             li.append(e)
 
-def make_dist_rule(dist, mf, bootClassPath=None):
+def make_dist_rule(dist, mf):
     def path_dist_relative(p):
         return os.path.relpath(p, dist.suite.dir)
     def short_dist_name(name):
@@ -109,11 +109,8 @@
     for p in projects:
         projectDir = path_dist_relative(p.dir)
         if p not in distDepProjects and p not in annotationProcessorDeps:
-            generatedSource = [path_dist_relative(p.source_gen_dir())] if len(annotationProcessorDeps) > 0 else []
-
-            for d in p.srcDirs + generatedSource:
-                src = projectDir + os.path.sep + d
-                sources.append("$(shell find {} -type f -name '*.java' 2> /dev/null)".format(src))
+            for src in [projectDir + os.path.sep + d for d in p.srcDirs]:
+                sources.append("$(shell find {} -type f 2> /dev/null)".format(src))
                 metaInf = src + os.path.sep + "META-INF"
                 if os.path.exists(metaInf):
                     resources.append(metaInf)
@@ -132,19 +129,14 @@
     props = {
            "name": shortName,
            "jarPath": targetPathPrefix + jarPath,
-           "depends": "",
            "depJarsVariableAccess": "$(" + depJarVariableName + ")" if len(classPath) > 0 else "",
            "depJarsVariable": depJarVariableName,
            "sourceLines": sourceLines,
            "sourcesVariableName": sourcesVariableName,
            "annotationProcessors": " ".join(apDistVariableNames),
-           "cpAnnotationProcessors": "-processorpath " + ":".join(apDistVariableNames) if len(apDistVariableNames) > 0 else "",
-           "bootCp": ("-bootclasspath " + bootClassPath) if bootClassPath != None else "",
-           "cpDeps": ("-cp $(shell echo $(" + depJarVariableName + ") | tr ' ' ':')") if len(classPath) > 0 else "",
+           "cpAnnotationProcessors": ":".join(apDistVariableNames),
            "jarDeps": " ".join(classPath),
-           "copyResources": "cp -r {} $(TMP)".format(" ".join(resources)) if len(resources) > 0 else "",
-           "targetPathPrefix": targetPathPrefix,
-           "shouldExport": shouldExport,
+           "copyResources": " ".join(resources)
            }
 
     mf.add_definition(sourceLines)
@@ -152,13 +144,8 @@
     if len(classPath) > 0: mf.add_definition("{depJarsVariable} = {jarDeps}".format(**props))
     if shouldExport: mf.add_definition("EXPORTED_FILES += $({name}_JAR)".format(**props))
     mf.add_rule("""$({name}_JAR): $({sourcesVariableName}) {annotationProcessors} {depJarsVariableAccess}
-\t$(eval TMP := $(shell mktemp -d {name}_XXXXX))
-\t$(JAVAC) -d $(TMP) {cpAnnotationProcessors} {bootCp} {cpDeps} $({sourcesVariableName})
-\t{copyResources}
-\t$(call process_options,$(TMP),{shouldExport})
-\tmkdir -p $$(dirname $({name}_JAR))
-\t$(JAR) cf $({name}_JAR) -C $(TMP) .
-\trm -r $(TMP)""".format(**props))
+\t$(call build_and_jar,{cpAnnotationProcessors},$(subst  $(space),:,{depJarsVariableAccess}),{copyResources},$({name}_JAR))
+""".format(**props))
     return
 
 
@@ -190,39 +177,74 @@
 ifeq ($(ABS_BOOTDIR),)
     $(error Variable ABS_BOOTDIR must be set to a JDK installation.)
 endif
-ifneq ($(MAKE_VERBOSE),)
-    SHELL=sh -x
+ifeq ($(MAKE_VERBOSE),)
+    QUIETLY=@
 endif
 
+# Required to construct a whitespace for use with subst
+space :=
+space +=
+
+# Takes the option files of the options annotation processor and merges them into a single file
+# Arguments:
+#  1: directory with contents of the JAR file
 define process_options
     $(eval providers=$(1)/$(PROVIDERS_INF))
     $(eval services=$(1)/$(SERVICES_INF))
     $(eval options=$(1)/$(OPTIONS_INF))
-    test -d $(services) || mkdir -p $(services)
-    test ! -d $(providers) || (cd $(providers) && for i in $$(ls); do c=$$(cat $$i); echo $$i >> $(abspath $(services))/$$c; rm $$i; done)
+    $(QUIETLY) test -d $(services) || mkdir -p $(services)
+    $(QUIETLY) test ! -d $(providers) || (cd $(providers) && for i in $$(ls); do c=$$(cat $$i); echo $$i >> $(abspath $(services))/$$c; rm $$i; done)
 
-    # Since all projects are built together with one javac call we cannot determine
-    # which project contains HotSpotVMConfig.inline.hpp so we hardcode it.
+    @# Since all projects are built together with one javac call we cannot determine
+    @# which project contains HotSpotVMConfig.inline.hpp so we hardcode it.
     $(eval vmconfig=$(1)/hotspot/HotSpotVMConfig.inline.hpp)
     $(eval vmconfigDest=$(HS_COMMON_SRC)/../jvmci/com.oracle.jvmci.hotspot/src_gen/hotspot)
-    test ! -f $(vmconfig) || (mkdir -p $(vmconfigDest) && cp $(vmconfig) $(vmconfigDest))
+    $(QUIETLY) test ! -f $(vmconfig) || (mkdir -p $(vmconfigDest) && cp $(vmconfig) $(vmconfigDest))
 endef
 
+# Extracts META-INF/services and META-INF/options of a JAR file into a given directory
+# Arguments:
+#  1: JAR file to extract
+#  2: target directory
 define extract
-    $(eval TMP := $(shell mktemp -d $(1)_XXXXX))
-    mkdir -p $(2);
-    cd $(TMP) && $(JAR) xf $(abspath $(1)) && \\
+    $(eval TMP := $(shell mktemp -d $(TARGET)/tmp_XXXXX))
+    $(QUIETLY) mkdir -p $(2);
+    $(QUIETLY) cd $(TMP) && $(JAR) xf $(abspath $(1)) && \\
         ((test ! -d .$(SERVICES_INF) || cp -r .$(SERVICES_INF) $(abspath $(2))) &&  (test ! -d .$(OPTIONS_INF) || cp -r .$(OPTIONS_INF) $(abspath $(2))));
-    rm -r $(TMP);
-    cp $(1) $(2);
+    $(QUIETLY) rm -r $(TMP);
+    $(QUIETLY) cp $(1) $(2);
 endef
 
+# Calls $(JAVAC) with the bootclasspath $(JDK_BOOTCLASSPATH); sources are taken from the automatic variable $^
+# Arguments:
+#  1: processorpath
+#  2: classpath
+#  3: resources to copy
+#  4: target JAR file
+define build_and_jar
+    $(info Building $(4))
+    $(eval TMP := $(shell mkdir -p $(TARGET) && mktemp -d $(TARGET)/tmp_XXXXX))
+    $(QUIETLY) $(JAVAC) -d $(TMP) -processorpath :$(1) -bootclasspath $(JDK_BOOTCLASSPATH) -cp :$(2) $(filter %.java,$^);
+    $(QUIETLY) test "$(3)" = "" || cp -r $(3) $(TMP);
+    $(QUIETLY) $(call process_options,$(TMP));
+    $(QUIETLY) mkdir -p $(shell dirname $(4))
+    $(QUIETLY) $(JAR) cf $(4) -C $(TMP) .
+    $(QUIETLY) rm -r $(TMP);
+endef
+
+# Verifies if the defs.make contain the exported files of services/
+define verify_export_def_make
+    $(foreach file,$(1),$(if $(shell grep '$(2)$(file)' $(3) > /dev/null && echo found), , $(error "Pattern '$(2)$(file)' not found in $(3)")))
+endef
 
 all: default
 
 export: all
-\tmkdir -p $(EXPORT_DIR)
-\t$(foreach export,$(EXPORTED_FILES),$(call extract,$(export),$(EXPORT_DIR)))
+\t$(info Put $(EXPORTED_FILES) into SHARED_DIR $(SHARED_DIR))
+\t$(QUIETLY) mkdir -p $(SHARED_DIR)
+\t$(foreach export,$(EXPORTED_FILES),$(call extract,$(export),$(SHARED_DIR)))
+\t$(call verify_export_def_make,$(notdir $(wildcard $(SHARED_DIR)/services/*)),EXPORT_LIST += $$(EXPORT_JRE_LIB_JVMCI_SERVICES_DIR)/,make/defs.make)
+\t$(call verify_export_def_make,$(notdir $(wildcard $(SHARED_DIR)/options/*)),EXPORT_LIST += $$(EXPORT_JRE_LIB_JVMCI_OPTIONS_DIR)/,make/defs.make)
 .PHONY: export
 
 """)
@@ -244,9 +266,8 @@
 
     if len(dists) > 0:
         mf.add_definition(jdkBootClassPathVariableName + " = " + bootClassPath)
-        bootClassPathVarAccess = "$(" + jdkBootClassPathVariableName + ")"
-        for d in ap: make_dist_rule(d, mf, bootClassPathVarAccess)
-        for d in dists: make_dist_rule(d, mf, bootClassPathVarAccess)
+        for d in ap: make_dist_rule(d, mf)
+        for d in dists: make_dist_rule(d, mf)
         mf.add_rule("default: $({}_JAR)\n.PHONY: default".format("_JAR) $(".join([d.name for d in dists])))
         return True
     else: