From 3ed3fd6296612f961ede5c7a776ea5530e1617a3 Mon Sep 17 00:00:00 2001 From: Davy Landman Date: Tue, 22 Oct 2024 08:59:52 +0200 Subject: [PATCH 1/5] [maven-release-plugin] prepare release v0.12.10 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 4db3b744..fd56f843 100644 --- a/pom.xml +++ b/pom.xml @@ -3,13 +3,13 @@ org.rascalmpl rascal-core - 0.12.10-SNAPSHOT + 0.12.10 jar scm:git:ssh://git@github.com/usethesource/rascal-core.git - v0.10.0-BOOT1 + v0.12.10 From 279384d61693e3d150fbffe75d918aee3d704296 Mon Sep 17 00:00:00 2001 From: Davy Landman Date: Tue, 22 Oct 2024 09:00:05 +0200 Subject: [PATCH 2/5] [maven-release-plugin] prepare for next development iteration --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index fd56f843..17c789a4 100644 --- a/pom.xml +++ b/pom.xml @@ -3,13 +3,13 @@ org.rascalmpl rascal-core - 0.12.10 + 0.12.11-SNAPSHOT jar scm:git:ssh://git@github.com/usethesource/rascal-core.git - v0.12.10 + v0.10.0-BOOT1 From fc7ba404f2b31515aa62c6119b9b0c853761f604 Mon Sep 17 00:00:00 2001 From: paulklint Date: Fri, 25 Oct 2024 16:01:58 +0200 Subject: [PATCH 3/5] Introduced nextClosure (backported) --- .../library/lang/rascalcore/check/CheckerCommon.rsc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/org/rascalmpl/core/library/lang/rascalcore/check/CheckerCommon.rsc b/src/org/rascalmpl/core/library/lang/rascalcore/check/CheckerCommon.rsc index 41360124..82c585f3 100644 --- a/src/org/rascalmpl/core/library/lang/rascalcore/check/CheckerCommon.rsc +++ b/src/org/rascalmpl/core/library/lang/rascalcore/check/CheckerCommon.rsc @@ -273,4 +273,16 @@ tuple[bool, TModel, ModuleStatus] getTModelForModule(str qualifiedModuleName, Mo //ms.status[qualifiedModuleName] ? {} += rsc_not_found(); return ", |unknown:///|)]), ms>; // throw IO("Cannot read tpl for "); +} + +int closureCounter = 0; + +int nextClosure(){ + counter = closureCounter; + closureCounter += 1; + return counter; +} + +void resetClosureCounter(){ + closureCounter = 0; } \ No newline at end of file From e71ab1eb8190ceeabbd39d15ab39ed6ab4488343 Mon Sep 17 00:00:00 2001 From: paulklint Date: Fri, 25 Oct 2024 16:03:38 +0200 Subject: [PATCH 4/5] Adapted closureName (backported) --- .../core/library/lang/rascalcore/check/CollectExpression.rsc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/org/rascalmpl/core/library/lang/rascalcore/check/CollectExpression.rsc b/src/org/rascalmpl/core/library/lang/rascalcore/check/CollectExpression.rsc index 510e6ac8..dd55c2e2 100644 --- a/src/org/rascalmpl/core/library/lang/rascalcore/check/CollectExpression.rsc +++ b/src/org/rascalmpl/core/library/lang/rascalcore/check/CollectExpression.rsc @@ -190,8 +190,8 @@ void collect(current: (Expression) `( )`, Collector c){ // ---- closure str closureName(Expression closure){ - l = getLoc(closure); - return "$CLOSURE_A"; + //l = getLoc(closure); + return "$CLOSURE_"; //"$CLOSURE_A"; } void collect(current: (Expression) ` { }`, Collector c){ From 159f8e5e6d89514ee4eafa9b06bba336e4aba096 Mon Sep 17 00:00:00 2001 From: paulklint Date: Fri, 25 Oct 2024 17:09:08 +0200 Subject: [PATCH 5/5] Added missing (backported) call to resetClosureCounter --- .../library/lang/rascalcore/check/Checker.rsc | 105 +++++++++--------- 1 file changed, 53 insertions(+), 52 deletions(-) diff --git a/src/org/rascalmpl/core/library/lang/rascalcore/check/Checker.rsc b/src/org/rascalmpl/core/library/lang/rascalcore/check/Checker.rsc index 0cfacea0..f3475648 100644 --- a/src/org/rascalmpl/core/library/lang/rascalcore/check/Checker.rsc +++ b/src/org/rascalmpl/core/library/lang/rascalcore/check/Checker.rsc @@ -14,10 +14,10 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND module lang::rascalcore::check::Checker /* - Top level driver for the checker (rascalTModelForLocsNote). + Top level driver for the checker (rascalTModelForLocsNote). Note that the checker calls the code generator (given as parameter) when there are no type errors. */ - + /* * TODO: * Potential additions/improvements @@ -65,7 +65,7 @@ data PathConfig( loc resources = |unknown:///|, loc testResources =|unknown:///| ); - + void rascalPreCollectInitialization(map[str, Tree] _namedTrees, Collector c){ c.push(patternContainer, "toplevel"); @@ -74,7 +74,7 @@ void rascalPreCollectInitialization(map[str, Tree] _namedTrees, Collector c){ list[Message] validatePathConfigForChecker(PathConfig pcfg, loc mloc) { msgs = []; - + if(isEmpty(pcfg.srcs)) msgs += error("PathConfig: `srcs` is empty", mloc); for(src <- pcfg.srcs){ if(!exists(src)) msgs += error("PathConfig `srcs`: does not exist", src); @@ -82,7 +82,7 @@ list[Message] validatePathConfigForChecker(PathConfig pcfg, loc mloc) { for(lb <- pcfg.libs){ if(!exists(lb)) msgs += warning("PathConfig `libs`: does not exist (yet)", lb); } - + if(!exists(pcfg.resources)) { try { mkDirectory(pcfg.resources); @@ -90,7 +90,7 @@ list[Message] validatePathConfigForChecker(PathConfig pcfg, loc mloc) { msgs += error("PathConfig `resources`: ", pcfg.resources); } } - + return msgs; } @@ -114,20 +114,20 @@ list[Message] dummy_compile1(str _qualifiedModuleName, lang::rascal::\syntax::Ra = []; // rascalTModelForLocs is the basic work horse - + ModuleStatus rascalTModelForLocs( - list[loc] mlocs, + list[loc] mlocs, RascalCompilerConfig compilerConfig, list[Message](str qualifiedModuleName, lang::rascal::\syntax::Rascal::Module M, map[str,TModel] transient_tms, ModuleStatus ms, RascalCompilerConfig compilerConfig) codgen -){ +){ pcfg = compilerConfig.typepalPathConfig; if(compilerConfig.logPathConfig) { iprintln(pcfg); } - + msgs = validatePathConfigForChecker(pcfg, mlocs[0]); - - ModuleStatus ms = newModuleStatus(compilerConfig); + + ModuleStatus ms = newModuleStatus(compilerConfig); topModuleNames = {}; - + for (mloc <- mlocs) { m = getModuleName(mloc, pcfg); if(isModuleLocationInLibs(mloc, pcfg)){ @@ -137,30 +137,30 @@ ModuleStatus rascalTModelForLocs( ms.moduleLocs[m] = mloc; msgs += ms.messages[m] ? []; } - + str jobName = ""; - + try { ms = getImportAndExtendGraph(topModuleNames, compilerConfig); - + if(/error(_,_) := ms.messages){ return ms; } - + if(compilerConfig.forceCompilationTopModule){ for(str nm <- topModuleNames){ ms.status[nm] = {}; } } - + imports_and_extends = ms.strPaths<0,2>; - + = stronglyConnectedComponentsAndTopSort(imports_and_extends); - + map[str, set[str]] module2component = (m : c | c <- components, m <- c); - + list[str] ordered = []; - + if(isEmpty(sorted)){ ordered = toList(topModuleNames); for(str topModuleName <- topModuleNames){ @@ -174,15 +174,15 @@ ModuleStatus rascalTModelForLocs( module2component[singleton] = {singleton}; } } - + map[str, loc] moduleScopes = (); map[str,str] path2module = (ms.moduleLocs[mname].path : mname | mname <- ms.moduleLocs); mi = 0; nmodules = size(ordered); - + jobName = "Compiling "; jobStart(jobName, totalWork=nmodules); - + while(mi < nmodules) { component = module2component[ordered[mi]]; jobStep(jobName, intercalate(" + ", [*component]), work=size(component)); @@ -193,9 +193,9 @@ ModuleStatus rascalTModelForLocs( if(!recheck){ if(tpl_uptodate() notin ms.status[m]){ = getTModelForModule(m, ms); - if(found){ + if(found){ ms.status[m] += {tpl_uptodate(), checked()}; - } + } } } } @@ -224,8 +224,8 @@ ModuleStatus rascalTModelForLocs( if(!ms.status[iname]?){ ms.status[iname] = {}; } - if(iname notin usedModules){ - if(iname == "ParseTree" && implicitlyUsesParseTree(ms.moduleLocs[m].path, tm)){ + if(iname notin usedModules){ + if(iname == "ParseTree" && implicitlyUsesParseTree(ms.moduleLocs[m].path, tm)){ continue check_imports; } if(ms.moduleLocs[iname]? && implicitlyUsesLayoutOrLexical(ms.moduleLocs[m].path, ms.moduleLocs[iname].path, tm)){ @@ -248,20 +248,20 @@ ModuleStatus rascalTModelForLocs( } if(ms.messages[m]?){ tm.messages += ms.messages[m]; - } + } ms.messages[m] ? [] += tm.messages; - + ms.status[m] += {tpl_uptodate(), checked()}; if(!isEmpty([ e | e:error(_,_) <- ms.messages[m] ])){ ms.status[m] += {check_error()}; } } // prepare the TModels of the modules in this component for compilation - + = prepareForCompilation(component, m_imports, m_extends, ms, moduleScopes, tm); - + // generate code for the modules in this component - + for(str m <- component, MStatus::ignored() notin ms.status[m]){ = getModuleParseTree(m, ms); if(success){ @@ -332,10 +332,10 @@ tuple[set[str], ModuleStatus] loadImportsAndExtends(str moduleName, ModuleStatus } tuple[TModel, ModuleStatus] rascalTModelComponent(set[str] moduleNames, ModuleStatus ms){ - + pcfg = ms.pathConfig; compilerConfig = ms.compilerConfig; - modelName = intercalate(" + ", toList(moduleNames)); + modelName = intercalate(" + ", toList(moduleNames)); map[str, Module] namedTrees = (); for(str nm <- moduleNames){ ms.status[nm] = {}; @@ -347,48 +347,49 @@ tuple[TModel, ModuleStatus] rascalTModelComponent(set[str] moduleNames, ModuleSt = getModuleParseTree(nm, ms); if(success){ tagsMap = getTags(pt.header.tags); - + if(ignoreCompiler(tagsMap)) { ms.messages[nm] ? [] += [ Message::info("Ignoring module ", pt@\loc) ]; ms.status[nm] += MStatus::ignored(); } else { namedTrees[nm] = pt; } - } + } //else { // ms.messages[nm] += error("Cannot get parse tree for module ``", ms.moduleLocs[nm]); //} } if(!isEmpty(namedTrees)){ if(compilerConfig.verbose) { println("Checking ... "); } - - start_check = cpuTime(); + + start_check = cpuTime(); + resetClosureCounter(); c = newCollector(modelName, namedTrees, compilerConfig); c.push(key_pathconfig, pcfg); - + rascalPreCollectInitialization(namedTrees, c); - + added = {}; for(str nm <- domain(namedTrees)){ = loadImportsAndExtends(nm, ms, c, added); added += a; } - + for(str nm <- namedTrees){ collect(namedTrees[nm], c); } tm = c.run(); - + tm.paths = ms.paths; - + if(!isEmpty(namedTrees)){ s = newSolver(namedTrees, tm); tm = s.run(); } //iprintln(tm.messages); - + check_time = (cpuTime() - start_check)/1000000; - + if(compilerConfig.verbose) { println("Checked .... in ms"); } return ; } else { @@ -400,11 +401,11 @@ tuple[TModel, ModuleStatus] rascalTModelComponent(set[str] moduleNames, ModuleSt // ---- rascalTModelForName a checker version that works on module names -ModuleStatus rascalTModelForNames(list[str] moduleNames, - RascalCompilerConfig compilerConfig, +ModuleStatus rascalTModelForNames(list[str] moduleNames, + RascalCompilerConfig compilerConfig, list[Message] (str qualifiedModuleName, lang::rascal::\syntax::Rascal::Module M, map[str,TModel] transient_tms, ModuleStatus ms, RascalCompilerConfig compilerConfig) codgen){ - + pcfg = compilerConfig.typepalPathConfig; mlocs = []; for(moduleName <- moduleNames){ @@ -425,7 +426,7 @@ ModuleStatus rascalTModelForNames(list[str] moduleNames, // name of the production has to mirror the Kernel compile result data ModuleMessages = program(loc src, set[Message] messages); - + list[ModuleMessages] check(list[loc] moduleLocs, RascalCompilerConfig compilerConfig){ pcfg1 = compilerConfig.typepalPathConfig; pcfg1.classloaders = []; pcfg1.javaCompilerPath = []; compilerConfig.typepalPathConfig = pcfg1; @@ -438,7 +439,7 @@ list[ModuleMessages] checkAll(loc root, RascalCompilerConfig compilerConfig){ } // ---- Convenience check function during development ------------------------- - + map[str, list[Message]] checkModules(list[str] moduleNames, RascalCompilerConfig compilerConfig) { ModuleStatus ms = rascalTModelForNames(moduleNames, compilerConfig, dummy_compile1); tmodels = ms.tmodels;