# HG changeset patch # User Gilles Duboscq # Date 1431966643 -7200 # Node ID c2e58b2a2a761001541571eb6302abc202bf880a # Parent 4cc6793cda6909add70145c60ad4ea3911a5413e Extract options file to build diff -r 4cc6793cda69 -r c2e58b2a2a76 make/Makefile --- a/make/Makefile Mon May 18 17:59:40 2015 +0200 +++ b/make/Makefile Mon May 18 18:30:43 2015 +0200 @@ -638,6 +638,9 @@ $(EXPORT_JRE_LIB_GRAAL_SERVICES_DIR)/%: $(SHARED_DIR)/services/% $(install-file) +$(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/%: $(SHARED_DIR)/options/% + $(install-file) + $(EXPORT_INCLUDE_DIR)/%: $(HS_SRC_DIR)/share/vm/code/% $(install-file) diff -r 4cc6793cda69 -r c2e58b2a2a76 make/defs.make --- a/make/defs.make Mon May 18 17:59:40 2015 +0200 +++ b/make/defs.make Mon May 18 18:30:43 2015 +0200 @@ -370,5 +370,39 @@ EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_SERVICES_DIR)/com.oracle.graal.truffle.hotspot.nfi.RawNativeCallNodeFactory EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_SERVICES_DIR)/com.oracle.graal.truffle.OptimizedCallTargetInstrumentationFactory +EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/com.oracle.graal.compiler.common.GraalOptions +EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/com.oracle.graal.compiler.GraalCompiler +EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/com.oracle.graal.compiler.GraalDebugConfig +EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/com.oracle.graal.compiler.phases.HighTier +EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/com.oracle.graal.compiler.phases.LowTier +EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/com.oracle.graal.graph.Graph +EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/com.oracle.graal.hotspot.CompileTheWorld +EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/com.oracle.graal.hotspot.debug.BenchmarkCounters +EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/com.oracle.graal.hotspot.HotSpotBackend +EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/com.oracle.graal.hotspot.HotSpotGraalRuntime +EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/com.oracle.graal.hotspot.replacements.InstanceOfSnippets +EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/com.oracle.graal.hotspot.replacements.MonitorSnippets +EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/com.oracle.graal.hotspot.replacements.NewObjectSnippets +EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/com.oracle.graal.java.AbstractBytecodeParser +EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/com.oracle.graal.lir.alloc.lsra.LinearScan +EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/com.oracle.graal.lir.alloc.lsra.LocationMarker +EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/com.oracle.graal.lir.alloc.lsra.OptimizingLinearScanWalker +EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/com.oracle.graal.lir.constopt.ConstantLoadOptimization +EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/com.oracle.graal.lir.gen.LIRGenerator +EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/com.oracle.graal.lir.phases.LIRPhase +EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/com.oracle.graal.lir.phases.PostAllocationOptimizationStage +EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/com.oracle.graal.lir.ssa.SSADestructionPhase +EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/com.oracle.graal.lir.stackslotalloc.LSStackSlotAllocator +EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/com.oracle.graal.loop.LoopPolicies +EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/com.oracle.graal.phases.common.DeadCodeEliminationPhase +EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/com.oracle.graal.phases.common.inlining.InliningPhase +EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/com.oracle.graal.phases.tiers.Suites +EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/com.oracle.graal.printer.NoDeadCodeVerifyHandler +EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/com.oracle.graal.replacements.StandardGraphBuilderPlugins +EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/com.oracle.graal.truffle.PartialEvaluator +EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/com.oracle.graal.truffle.TruffleCompilerOptions +EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/com.oracle.graal.virtual.phases.ea.PartialEscapePhase + + .PHONY: $(HS_ALT_MAKE)/defs.make diff -r 4cc6793cda69 -r c2e58b2a2a76 mx/mx_graal.py --- a/mx/mx_graal.py Mon May 18 17:59:40 2015 +0200 +++ b/mx/mx_graal.py Mon May 18 18:30:43 2015 +0200 @@ -665,27 +665,41 @@ filtered.append(className) return filtered -def _extractGraalServiceFiles(graalJars, destination, cleanDestination=True): +def _extractGraalFiles(graalJars, servicesDir, optionsDir, cleanDestination=True): if cleanDestination: - if exists(destination): - shutil.rmtree(destination) - os.makedirs(destination) + if exists(servicesDir): + shutil.rmtree(servicesDir) + if exists(optionsDir): + shutil.rmtree(optionsDir) + if not exists(servicesDir): + os.makedirs(servicesDir) + if not exists(optionsDir): + os.makedirs(optionsDir) servicesMap = {} + optionsFiles = [] for jar in graalJars: if os.path.isfile(jar): with zipfile.ZipFile(jar) as zf: for member in zf.namelist(): - if not member.startswith('META-INF/services'): - continue - serviceName = basename(member) - # we don't handle directories - assert serviceName and member == 'META-INF/services/' + serviceName - with zf.open(member) as serviceFile: - serviceImpls = servicesMap.setdefault(serviceName, []) - for line in serviceFile.readlines(): - line = line.strip() - if line: - serviceImpls.append(line) + if member.startswith('META-INF/services'): + serviceName = basename(member) + # we don't handle directories + assert serviceName and member == 'META-INF/services/' + serviceName + with zf.open(member) as serviceFile: + serviceImpls = servicesMap.setdefault(serviceName, []) + for line in serviceFile.readlines(): + line = line.strip() + if line: + serviceImpls.append(line) + elif member.startswith('META-INF/options'): + filename = basename(member) + # we don't handle directories + assert filename and member == 'META-INF/options/' + filename + targetpath = join(optionsDir, filename) + optionsFiles.append(filename) + with zf.open(member) as optionsFile, \ + file(targetpath, "wb") as target: + shutil.copyfileobj(optionsFile, target) graalServices = _filterGraalService(servicesMap.keys(), graalJars) for serviceName in graalServices: serviceImpls = servicesMap[serviceName] @@ -693,18 +707,19 @@ f = os.fdopen(fd, 'w+') for serviceImpl in serviceImpls: f.write(serviceImpl + os.linesep) - target = join(destination, serviceName) + target = join(servicesDir, serviceName) f.close() shutil.move(tmp, target) if mx.get_os() != 'windows': os.chmod(target, JDK_UNIX_PERMISSIONS_FILE) - return graalServices - -def _updateGraalServiceFiles(jdkDir): + return (graalServices, optionsFiles) + +def _updateGraalFiles(jdkDir): jreGraalDir = join(jdkDir, 'jre', 'lib', 'graal') graalJars = [join(jreGraalDir, e) for e in os.listdir(jreGraalDir) if e.startswith('graal') and e.endswith('.jar')] jreGraalServicesDir = join(jreGraalDir, 'services') - _extractGraalServiceFiles(graalJars, jreGraalServicesDir) + jreGraalOptionsDir = join(jreGraalDir, 'options') + _extractGraalFiles(graalJars, jreGraalServicesDir, jreGraalOptionsDir) @@ -743,7 +758,7 @@ _copyToJdk(dist.sourcesPath, jdkDir) if deployableDist.isGraalClassLoader: # deploy service files - _updateGraalServiceFiles(jdkDir) + _updateGraalFiles(jdkDir) # run a command in the windows SDK Debug Shell def _runInDebugShell(cmd, workingDir, logFile=None, findInOutput=None, respondTo=None): @@ -918,11 +933,15 @@ if defLine not in defs: mx.abort('Missing following line in ' + defsPath + '\n' + defLine) shutil.copy(dist.path, opts2.export_dir) - services = _extractGraalServiceFiles(graalJars, join(opts2.export_dir, 'services')) + services, optionsFiles = _extractGraalFiles(graalJars, join(opts2.export_dir, 'services'), join(opts2.export_dir, 'options')) for service in services: defLine = 'EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_SERVICES_DIR)/' + service if defLine not in defs: mx.abort('Missing following line in ' + defsPath + ' for service from ' + dist.name + '\n' + defLine) + for optionsFile in optionsFiles: + defLine = 'EXPORT_LIST += $(EXPORT_JRE_LIB_GRAAL_OPTIONS_DIR)/' + optionsFile + if defLine not in defs: + mx.abort('Missing following line in ' + defsPath + ' for options from ' + dist.name + '\n' + defLine) graalOptions = join(_graal_home, 'graal.options') if exists(graalOptions): shutil.copy(graalOptions, opts2.export_dir)