Mercurial > hg > graal-jvmci-8
changeset 11670:891fa65ef9ec
Merge.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Mon, 16 Sep 2013 19:56:54 +0200 |
parents | a625d254e137 (current diff) 929a03fbbbaf (diff) |
children | 3522f7c99c5f |
files | |
diffstat | 21 files changed, 118 insertions(+), 71 deletions(-) [+] |
line wrap: on
line diff
--- a/.hgignore Mon Sep 16 19:54:36 2013 +0200 +++ b/.hgignore Mon Sep 16 19:56:54 2013 +0200 @@ -1,5 +1,7 @@ ^mx/env ^mx/checkstyle-timestamps +^mx/eclipseinit.timestamp +^mx/netbeansinit.timestamp ^mx/eclipse-launches ^mx/ecj.jar ^mx/includes
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/BoxingEliminationTest.java Mon Sep 16 19:54:36 2013 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/BoxingEliminationTest.java Mon Sep 16 19:56:54 2013 +0200 @@ -300,8 +300,8 @@ final ValueNode getResult(String snippet) { processMethod(snippet); - assertEquals(1, graph.getNodes(ReturnNode.class).count()); - return graph.getNodes(ReturnNode.class).first().result(); + assertEquals(1, graph.getNodes().filter(ReturnNode.class).count()); + return graph.getNodes().filter(ReturnNode.class).first().result(); } private void processMethod(final String snippet) {
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java Mon Sep 16 19:54:36 2013 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java Mon Sep 16 19:56:54 2013 +0200 @@ -114,8 +114,8 @@ protected void assertConstantReturn(StructuredGraph graph, int value) { String graphString = getCanonicalGraphString(graph, false); - Assert.assertEquals("unexpected number of ReturnNodes: " + graphString, graph.getNodes(ReturnNode.class).count(), 1); - ValueNode result = graph.getNodes(ReturnNode.class).first().result(); + Assert.assertEquals("unexpected number of ReturnNodes: " + graphString, graph.getNodes().filter(ReturnNode.class).count(), 1); + ValueNode result = graph.getNodes().filter(ReturnNode.class).first().result(); Assert.assertTrue("unexpected ReturnNode result node: " + graphString, result.isConstant()); Assert.assertEquals("unexpected ReturnNode result kind: " + graphString, result.asConstant().getKind(), Kind.Int); Assert.assertEquals("unexpected ReturnNode result: " + graphString, result.asConstant().asInt(), value);
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/MemoryScheduleTest.java Mon Sep 16 19:54:36 2013 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/MemoryScheduleTest.java Mon Sep 16 19:56:54 2013 +0200 @@ -221,7 +221,7 @@ public void testArrayCopy() { SchedulePhase schedule = getFinalSchedule("testArrayCopySnippet", TestMode.INLINED_WITHOUT_FRAMESTATES, MemoryScheduling.OPTIMAL); StructuredGraph graph = schedule.getCFG().getStartBlock().getBeginNode().graph(); - ReturnNode ret = graph.getNodes(ReturnNode.class).first(); + ReturnNode ret = graph.getNodes().filter(ReturnNode.class).first(); assertTrue(ret.result() instanceof FloatingReadNode); assertEquals(schedule.getCFG().blockFor(ret), schedule.getCFG().blockFor(ret.result())); assertReadWithinReturnBlock(schedule, true);
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/EscapeAnalysisTest.java Mon Sep 16 19:54:36 2013 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/EscapeAnalysisTest.java Mon Sep 16 19:56:54 2013 +0200 @@ -238,8 +238,8 @@ new DeadCodeEliminationPhase().apply(graph); new CanonicalizerPhase(true).apply(graph, context); new PartialEscapePhase(iterativeEscapeAnalysis, new CanonicalizerPhase(true)).apply(graph, context); - Assert.assertEquals(1, graph.getNodes(ReturnNode.class).count()); - ReturnNode returnNode = graph.getNodes(ReturnNode.class).first(); + Assert.assertEquals(1, graph.getNodes().filter(ReturnNode.class).count()); + ReturnNode returnNode = graph.getNodes().filter(ReturnNode.class).first(); if (expectedConstantResult != null) { Assert.assertTrue(returnNode.result().toString(), returnNode.result().isConstant()); Assert.assertEquals(expectedConstantResult, returnNode.result().asConstant());
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/IterativeInliningTest.java Mon Sep 16 19:54:36 2013 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/IterativeInliningTest.java Mon Sep 16 19:56:54 2013 +0200 @@ -82,8 +82,8 @@ final ReturnNode getReturn(String snippet) { processMethod(snippet); - assertEquals(1, graph.getNodes(ReturnNode.class).count()); - return graph.getNodes(ReturnNode.class).first(); + assertEquals(1, graph.getNodes().filter(ReturnNode.class).count()); + return graph.getNodes().filter(ReturnNode.class).first(); } private void processMethod(final String snippet) {
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/PEAReadEliminationTest.java Mon Sep 16 19:54:36 2013 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/ea/PEAReadEliminationTest.java Mon Sep 16 19:56:54 2013 +0200 @@ -236,8 +236,8 @@ final ReturnNode getReturn(String snippet) { processMethod(snippet); - assertEquals(1, graph.getNodes(ReturnNode.class).count()); - return graph.getNodes(ReturnNode.class).first(); + assertEquals(1, graph.getNodes().filter(ReturnNode.class).count()); + return graph.getNodes().filter(ReturnNode.class).first(); } protected void processMethod(final String snippet) {
--- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/AheadOfTimeCompilationTest.java Mon Sep 16 19:54:36 2013 +0200 +++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/AheadOfTimeCompilationTest.java Mon Sep 16 19:56:54 2013 +0200 @@ -66,7 +66,7 @@ assertEquals(1, result.getNodes().filter(ConstantNode.class).count()); assertEquals(runtime.getTarget().wordKind, result.getNodes().filter(ConstantNode.class).first().kind()); assertEquals(2, result.getNodes(FloatingReadNode.class).count()); - assertEquals(0, result.getNodes(ReadNode.class).count()); + assertEquals(0, result.getNodes().filter(ReadNode.class).count()); } @Test @@ -75,7 +75,7 @@ assertEquals(1, result.getNodes().filter(ConstantNode.class).count()); assertEquals(Kind.Object, result.getNodes().filter(ConstantNode.class).first().kind()); assertEquals(0, result.getNodes(FloatingReadNode.class).count()); - assertEquals(0, result.getNodes(ReadNode.class).count()); + assertEquals(0, result.getNodes().filter(ReadNode.class).count()); } public static Class getClassObject() { @@ -92,7 +92,7 @@ assertEquals(type.klass(), filter.first().asConstant()); assertEquals(1, result.getNodes(FloatingReadNode.class).count()); - assertEquals(0, result.getNodes(ReadNode.class).count()); + assertEquals(0, result.getNodes().filter(ReadNode.class).count()); } @Test @@ -106,7 +106,7 @@ assertEquals(AheadOfTimeCompilationTest.class, mirror); assertEquals(0, result.getNodes(FloatingReadNode.class).count()); - assertEquals(0, result.getNodes(ReadNode.class).count()); + assertEquals(0, result.getNodes().filter(ReadNode.class).count()); } public static Class getPrimitiveClassObject() { @@ -121,7 +121,7 @@ assertEquals(runtime.getTarget().wordKind, filter.first().kind()); assertEquals(2, result.getNodes(FloatingReadNode.class).count()); - assertEquals(0, result.getNodes(ReadNode.class).count()); + assertEquals(0, result.getNodes().filter(ReadNode.class).count()); } @Test @@ -134,7 +134,7 @@ assertEquals(Integer.TYPE, mirror); assertEquals(0, result.getNodes(FloatingReadNode.class).count()); - assertEquals(0, result.getNodes(ReadNode.class).count()); + assertEquals(0, result.getNodes().filter(ReadNode.class).count()); } public static String getStringObject() { @@ -162,7 +162,7 @@ assertEquals("test string", mirror); assertEquals(0, result.getNodes(FloatingReadNode.class).count()); - assertEquals(0, result.getNodes(ReadNode.class).count()); + assertEquals(0, result.getNodes().filter(ReadNode.class).count()); } public static Boolean getBoxedBoolean() {
--- a/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/WriteBarrierAdditionTest.java Mon Sep 16 19:54:36 2013 +0200 +++ b/graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/WriteBarrierAdditionTest.java Mon Sep 16 19:56:54 2013 +0200 @@ -262,7 +262,7 @@ barriers = graph.getNodes(SerialWriteBarrier.class).count(); } Assert.assertEquals(expectedBarriers, barriers); - for (WriteNode write : graph.getNodes(WriteNode.class)) { + for (WriteNode write : graph.getNodes().filter(WriteNode.class)) { if (useG1GC()) { if (write.getBarrierType() != BarrierType.NONE) { Assert.assertEquals(1, write.successors().count()); @@ -277,7 +277,7 @@ } } - for (ReadNode read : graph.getNodes(ReadNode.class)) { + for (ReadNode read : graph.getNodes().filter(ReadNode.class)) { if (read.getBarrierType() != BarrierType.NONE) { if (read.location() instanceof ConstantLocationNode) { Assert.assertEquals(referentOffset(), ((ConstantLocationNode) (read.location())).getDisplacement());
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java Mon Sep 16 19:54:36 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java Mon Sep 16 19:56:54 2013 +0200 @@ -432,7 +432,7 @@ bootstrapRunning = false; - TTY.println(" in %d ms", System.currentTimeMillis() - startTime); + TTY.println(" in %d ms (compiled %d methods)", System.currentTimeMillis() - startTime, compileQueue.getCompletedTaskCount()); if (graalRuntime.getCache() != null) { graalRuntime.getCache().clear(); }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/WriteBarrierAdditionPhase.java Mon Sep 16 19:54:36 2013 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/WriteBarrierAdditionPhase.java Mon Sep 16 19:56:54 2013 +0200 @@ -24,6 +24,7 @@ import static com.oracle.graal.hotspot.replacements.HotSpotReplacementsUtil.*; +import com.oracle.graal.graph.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.HeapAccess.BarrierType; import com.oracle.graal.nodes.extended.*; @@ -37,18 +38,18 @@ @Override protected void run(StructuredGraph graph) { - for (ReadNode node : graph.getNodes(ReadNode.class)) { - addReadNodeBarriers(node, graph); - } - for (WriteNode node : graph.getNodes(WriteNode.class)) { - addWriteNodeBarriers(node, graph); - } - for (LoweredCompareAndSwapNode node : graph.getNodes(LoweredCompareAndSwapNode.class)) { - addCASBarriers(node, graph); - } - for (ArrayRangeWriteNode node : graph.getNodes(ArrayRangeWriteNode.class)) { - if (node.isObjectArray()) { - addArrayRangeBarriers(node, graph); + for (Node n : graph.getNodes()) { + if (n instanceof ReadNode) { + addReadNodeBarriers((ReadNode) n, graph); + } else if (n instanceof WriteNode) { + addWriteNodeBarriers((WriteNode) n, graph); + } else if (n instanceof LoweredCompareAndSwapNode) { + addCASBarriers((LoweredCompareAndSwapNode) n, graph); + } else if (n instanceof ArrayRangeWriteNode) { + ArrayRangeWriteNode node = (ArrayRangeWriteNode) n; + if (node.isObjectArray()) { + addArrayRangeBarriers(node, graph); + } } } }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ReturnNode.java Mon Sep 16 19:54:36 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ReturnNode.java Mon Sep 16 19:56:54 2013 +0200 @@ -22,11 +22,10 @@ */ package com.oracle.graal.nodes; -import com.oracle.graal.graph.*; import com.oracle.graal.nodes.spi.*; import com.oracle.graal.nodes.type.*; -public final class ReturnNode extends ControlSinkNode implements LIRLowerable, IterableNodeType { +public final class ReturnNode extends ControlSinkNode implements LIRLowerable { @Input private ValueNode result;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ArrayRangeWriteNode.java Mon Sep 16 19:54:36 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ArrayRangeWriteNode.java Mon Sep 16 19:56:54 2013 +0200 @@ -22,14 +22,13 @@ */ package com.oracle.graal.nodes.extended; -import com.oracle.graal.graph.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.type.*; /** * Base class for nodes that modify a range of an array. */ -public abstract class ArrayRangeWriteNode extends AbstractStateSplit implements IterableNodeType { +public abstract class ArrayRangeWriteNode extends AbstractStateSplit { protected ArrayRangeWriteNode(Stamp stamp) { super(stamp);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ReadNode.java Mon Sep 16 19:54:36 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ReadNode.java Mon Sep 16 19:56:54 2013 +0200 @@ -23,7 +23,6 @@ package com.oracle.graal.nodes.extended; import com.oracle.graal.api.meta.*; -import com.oracle.graal.graph.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.spi.*; import com.oracle.graal.nodes.type.*; @@ -32,7 +31,7 @@ /** * Reads an {@linkplain AccessNode accessed} value. */ -public final class ReadNode extends FloatableAccessNode implements IterableNodeType, LIRLowerable, Canonicalizable, PiPushable, Virtualizable { +public final class ReadNode extends FloatableAccessNode implements LIRLowerable, Canonicalizable, PiPushable, Virtualizable { public ReadNode(ValueNode object, ValueNode location, Stamp stamp, BarrierType barrierType, boolean compressible) { super(object, location, stamp, barrierType, compressible);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/WriteNode.java Mon Sep 16 19:54:36 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/WriteNode.java Mon Sep 16 19:56:54 2013 +0200 @@ -23,7 +23,6 @@ package com.oracle.graal.nodes.extended; import com.oracle.graal.api.meta.*; -import com.oracle.graal.graph.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.extended.LocationNode.Location; import com.oracle.graal.nodes.spi.*; @@ -33,7 +32,7 @@ /** * Writes a given {@linkplain #value() value} a {@linkplain AccessNode memory location}. */ -public final class WriteNode extends AccessNode implements StateSplit, LIRLowerable, MemoryCheckpoint.Single, IterableNodeType, Virtualizable { +public final class WriteNode extends AccessNode implements StateSplit, LIRLowerable, MemoryCheckpoint.Single, Virtualizable { @Input private ValueNode value; @Input(notDataflow = true) private FrameState stateAfter;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoweredCompareAndSwapNode.java Mon Sep 16 19:54:36 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/LoweredCompareAndSwapNode.java Mon Sep 16 19:56:54 2013 +0200 @@ -23,7 +23,6 @@ package com.oracle.graal.nodes.java; import com.oracle.graal.api.meta.*; -import com.oracle.graal.graph.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.extended.*; import com.oracle.graal.nodes.spi.*; @@ -32,7 +31,7 @@ /** * Represents the lowered version of an atomic compare-and-swap operation{@code CompareAndSwapNode}. */ -public class LoweredCompareAndSwapNode extends AccessNode implements StateSplit, LIRLowerable, MemoryCheckpoint.Single, IterableNodeType { +public class LoweredCompareAndSwapNode extends AccessNode implements StateSplit, LIRLowerable, MemoryCheckpoint.Single { @Input private ValueNode expectedValue; @Input private ValueNode newValue;
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InsertStateAfterPlaceholderPhase.java Mon Sep 16 19:54:36 2013 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InsertStateAfterPlaceholderPhase.java Mon Sep 16 19:56:54 2013 +0200 @@ -72,7 +72,7 @@ } } if (needsPlaceHolder) { - for (ReturnNode ret : graph.getNodes(ReturnNode.class)) { + for (ReturnNode ret : graph.getNodes().filter(ReturnNode.class)) { PlaceholderNode p = graph.add(new PlaceholderNode()); p.setStateAfter(graph.add(new FrameState(FrameState.AFTER_BCI))); graph.addBeforeFixed(ret, p);
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/SafepointInsertionPhase.java Mon Sep 16 19:54:36 2013 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/SafepointInsertionPhase.java Mon Sep 16 19:56:54 2013 +0200 @@ -47,7 +47,7 @@ if (GenSafepoints.getValue()) { if (!OptEliminateSafepoints.getValue() || graph.getNodes(MethodCallTargetNode.class).isNotEmpty()) { - for (ReturnNode returnNode : graph.getNodes(ReturnNode.class)) { + for (ReturnNode returnNode : graph.getNodes().filter(ReturnNode.class)) { SafepointNode safepoint = graph.add(new SafepointNode()); graph.addBeforeFixed(returnNode, safepoint); }
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/graph/ComputeProbabilityClosure.java Mon Sep 16 19:54:36 2013 +0200 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/graph/ComputeProbabilityClosure.java Mon Sep 16 19:56:54 2013 +0200 @@ -152,7 +152,7 @@ } private static boolean doesNotAlwaysDeopt(StructuredGraph graph) { - return graph.getNodes(ReturnNode.class).iterator().hasNext(); + return graph.getNodes().filter(ReturnNode.class).iterator().hasNext(); } private void computeLoopFactors() {
--- a/mx/sanitycheck.py Mon Sep 16 19:54:36 2013 +0200 +++ b/mx/sanitycheck.py Mon Sep 16 19:56:54 2013 +0200 @@ -252,13 +252,15 @@ return Test("Scala-DaCapo-" + name, ['-jar', dacapo, name] + _noneAsEmptyList(dacapoArgs), [dacapoSuccess], [dacapoFail], [dacapoMatcher], ['-Xms2g', '-XX:+' + gc, '-XX:-UseCompressedOops']) def getBootstraps(): - time = re.compile(r"Bootstrapping Graal\.+ in (?P<time>[0-9]+) ms") + time = re.compile(r"Bootstrapping Graal\.+ in (?P<time>[0-9]+) ms( \(compiled (?P<methods>[0-9]+) methods\))?") scoreMatcher = ValuesMatcher(time, {'group' : 'Bootstrap', 'name' : 'BootstrapTime', 'score' : '<time>'}) + methodMatcher = ValuesMatcher(time, {'group' : 'Bootstrap', 'name' : 'BootstrapMethods', 'score' : '<methods>'}) scoreMatcherBig = ValuesMatcher(time, {'group' : 'Bootstrap-bigHeap', 'name' : 'BootstrapTime', 'score' : '<time>'}) + methodMatcherBig = ValuesMatcher(time, {'group' : 'Bootstrap-bigHeap', 'name' : 'BootstrapMethods', 'score' : '<methods>'}) tests = [] - tests.append(Test("Bootstrap", ['-version'], successREs=[time], scoreMatchers=[scoreMatcher], ignoredVMs=['client', 'server'], benchmarkCompilationRate=False)) - tests.append(Test("Bootstrap-bigHeap", ['-version'], successREs=[time], scoreMatchers=[scoreMatcherBig], vmOpts=['-Xms2g'], ignoredVMs=['client', 'server'], benchmarkCompilationRate=False)) + tests.append(Test("Bootstrap", ['-version'], successREs=[time], scoreMatchers=[scoreMatcher, methodMatcher], ignoredVMs=['client', 'server'], benchmarkCompilationRate=False)) + tests.append(Test("Bootstrap-bigHeap", ['-version'], successREs=[time], scoreMatchers=[scoreMatcherBig, methodMatcherBig], vmOpts=['-Xms2g'], ignoredVMs=['client', 'server'], benchmarkCompilationRate=False)) return tests class CTWMode:
--- a/mxtool/mx.py Mon Sep 16 19:54:36 2013 +0200 +++ b/mxtool/mx.py Mon Sep 16 19:56:54 2013 +0200 @@ -1559,6 +1559,9 @@ else: sortedProjects = sorted_deps(projects, includeAnnotationProcessors=True) + if args.java: + ideinit([], refreshOnly=True, buildProcessorJars=False) + for p in sortedProjects: if p.native: if args.native: @@ -1962,7 +1965,7 @@ changedFiles = 0 for s in suites(): - projectsFile = join(s.dir, 'mx', 'projects') + projectsFile = join(s.mxDir, 'projects') if not exists(projectsFile): continue with open(projectsFile) as f: @@ -2013,6 +2016,34 @@ changedFiles += 1 return changedFiles +class TimeStampFile: + def __init__(self, path): + self.path = path + self.timestamp = os.path.getmtime(path) if exists(path) else None + + def outOfDate(self, arg): + if not self.timestamp: + return True + if isinstance(arg, types.ListType): + files = arg + else: + files = [arg] + for f in files: + if os.path.getmtime(f) > self.timestamp: + return True + return False + + def exists(self): + return exists(self.path) + + def touch(self): + if exists(self.path): + os.utime(self.path, None) + else: + if not isdir(dirname(self.path)): + os.makedirs(dirname(self.path)) + file(self.path, 'a') + def checkstyle(args): """run Checkstyle on the Java sources @@ -2047,16 +2078,10 @@ logv('[no Java sources in {0} - skipping]'.format(sourceDir)) continue - timestampFile = join(p.suite.mxDir, 'checkstyle-timestamps', sourceDir[len(p.suite.dir) + 1:].replace(os.sep, '_') + '.timestamp') - if not exists(dirname(timestampFile)): - os.makedirs(dirname(timestampFile)) + timestamp = TimeStampFile(join(p.suite.mxDir, 'checkstyle-timestamps', sourceDir[len(p.suite.dir) + 1:].replace(os.sep, '_') + '.timestamp')) mustCheck = False - if not args.force and exists(timestampFile): - timestamp = os.path.getmtime(timestampFile) - for f in javafilelist: - if os.path.getmtime(f) > timestamp: - mustCheck = True - break + if not args.force and timestamp.exists(): + mustCheck = timestamp.outOfDate(javafilelist) else: mustCheck = True @@ -2141,10 +2166,7 @@ map(log, errors) totalErrors = totalErrors + len(errors) else: - if exists(timestampFile): - os.utime(timestampFile, None) - else: - file(timestampFile, 'a') + timestamp.touch() finally: if exists(auditfileName): os.unlink(auditfileName) @@ -2352,12 +2374,21 @@ os.makedirs(eclipseLaunches) return update_file(join(eclipseLaunches, name + '.launch'), launch) -def eclipseinit(args, suite=None, buildProcessorJars=True): +def eclipseinit(args, suite=None, buildProcessorJars=True, refreshOnly=False): """(re)generate Eclipse project configurations and working sets""" if suite is None: suite = _mainSuite + projectsFile = join(suite.mxDir, 'projects') + timestamp = TimeStampFile(join(suite.mxDir, 'eclipseinit.timestamp')) + if refreshOnly and not timestamp.exists(): + return + + if not timestamp.outOfDate(projectsFile): + logv('[Eclipse configurations are up to date - skipping]') + return + if buildProcessorJars: processorjars() @@ -2543,7 +2574,7 @@ make_eclipse_attach('localhost', '8000', deps=projects()) generate_eclipse_workingsets(suite) - + timestamp.touch() def _isAnnotationProcessorDependency(p): """ @@ -2720,12 +2751,21 @@ def _workingset_element(wsdoc, p): wsdoc.element('item', {'elementID': '=' + p, 'factoryID': 'org.eclipse.jdt.ui.PersistableJavaElementFactory'}) -def netbeansinit(args, suite=None): +def netbeansinit(args, suite=None, refreshOnly=False, buildProcessorJars=True): """(re)generate NetBeans project configurations""" if suite is None: suite = _mainSuite + projectsFile = join(suite.mxDir, 'projects') + timestamp = TimeStampFile(join(suite.mxDir, 'netbeansinit.timestamp')) + if refreshOnly and not timestamp.exists(): + return + + if not timestamp.outOfDate(projectsFile): + logv('[NetBeans configurations are up to date - skipping]') + return + updated = False for p in projects(): if p.native: @@ -2940,12 +2980,18 @@ log(' 1. Ensure that a platform named "JDK_' + str(java().version) + '" is defined (Tools -> Java Platforms)') log(' 2. Open/create a Project Group for the directory containing the projects (File -> Project Group -> New Group... -> Folder of Projects)') + timestamp.touch() + def ideclean(args, suite=None): """remove all Eclipse and NetBeans project configurations""" def rm(path): if exists(path): os.remove(path) + for s in suites(): + rm(join(s.mxDir, 'eclipseinit.timestamp')) + rm(join(s.mxDir, 'netbeansinit.timestamp')) + for p in projects(): if p.native: continue @@ -2964,11 +3010,12 @@ log("Error removing {0}".format(p.name + '.jar')) -def ideinit(args, suite=None): +def ideinit(args, suite=None, refreshOnly=False, buildProcessorJars=True): """(re)generate Eclipse and NetBeans project configurations""" - eclipseinit(args, suite) - netbeansinit(args, suite) - fsckprojects([]) + eclipseinit(args, suite, refreshOnly=refreshOnly, buildProcessorJars=buildProcessorJars) + netbeansinit(args, suite, refreshOnly=refreshOnly, buildProcessorJars=buildProcessorJars) + if not refreshOnly: + fsckprojects([]) def fsckprojects(args): """find directories corresponding to deleted Java projects and delete them""" @@ -3466,7 +3513,7 @@ def show_projects(args): """show all loaded projects""" for s in suites(): - projectsFile = join(s.dir, 'mx', 'projects') + projectsFile = join(s.mxDir, 'projects') if exists(projectsFile): log(projectsFile) for p in s.projects: