diff options
author | dos-reis <gdr@axiomatics.org> | 2013-05-27 23:06:51 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2013-05-27 23:06:51 +0000 |
commit | 82ca7adccc719b3a3a3e260be596a6aa20608e08 (patch) | |
tree | 9317d2a92fc54482ecb6c061230e41883adca19c /src/interp | |
parent | 046ba395bff60fa8efd27b956ac3d37fd9e7eeb1 (diff) | |
download | open-axiom-82ca7adccc719b3a3a3e260be596a6aa20608e08.tar.gz |
Introduce a data structure for ephemeral compilation artifacts
Diffstat (limited to 'src/interp')
-rw-r--r-- | src/interp/c-util.boot | 18 | ||||
-rw-r--r-- | src/interp/define.boot | 7 | ||||
-rw-r--r-- | src/interp/lisplib.boot | 4 |
3 files changed, 20 insertions, 9 deletions
diff --git a/src/interp/c-util.boot b/src/interp/c-util.boot index 7203eca6..3ba88514 100644 --- a/src/interp/c-util.boot +++ b/src/interp/c-util.boot @@ -143,13 +143,21 @@ macro domainData d == --% usedEntities: VectorBuffer Pair(SourceEntity,Elaboration)) --% +structure %CompilationData == + Record(subst: %Substitution,idata: %Substitution,bytes: List %Fixnum, + items: %Buffer %Pair(%SourceEntity,%Elaboration)) with + cdSubstitution == (.subst) + cdImplicits == (.idata) + cdBytes == (.bytes) + cdItems == (.items) + ++ Make a fresh compilation data structure. makeCompilationData() == - [nil,nil,nil,[nil,:0]] + mk%CompilationData(nil,nil,nil,[nil,:0]) ++ Subsitution that replaces parameters with formals. macro dbFormalSubst db == - first dbCompilerData db + cdSubstitution dbCompilerData db ++ Return source-level parameters of this constructor. dbParameters db == @@ -159,17 +167,17 @@ dbParameters db == ++ information is active only during the elaboration of the ++ constructor associated with `db'. macro dbImplicitData db == - second dbCompilerData db + cdImplicits dbCompilerData db ++ Return the list of encoding bytes for a function during elaboration. ++ Transcient data. macro dbByteList db == - third dbCompilerData db + cdBytes dbCompilerData db ++ Return a buffer of entities referenced during elaboration ++ of current functor. macro dbEntityBuffer db == - fourth dbCompilerData db + cdItems dbCompilerData db ++ List (in reverse order) of used entities during elaboration of ++ current functor. diff --git a/src/interp/define.boot b/src/interp/define.boot index 8ad48282..62114a90 100644 --- a/src/interp/define.boot +++ b/src/interp/define.boot @@ -1117,6 +1117,7 @@ compDefineCategory2(form,signature,body,m,e,$formalArgList) == --Set in DomainSubstitutionFunction, used further down -- 1.1 augment e to add declaration $: <form> db := constructorDB $op + dbClearForCompilation! db dbCompilerData(db) := makeCompilationData() dbFormalSubst(db) := pairList(form.args,$TriangleVariableList) dbInstanceCache(db) := true @@ -1180,7 +1181,6 @@ compDefineCategory2(form,signature,body,m,e,$formalArgList) == dbPrincipals(db) := getParentsFor db dbAncestors(db) := computeAncestorsOf(form,nil) dbModemaps(db) := modemapsFromCategory(db,[op',:sargl],formalBody,signature') - dbCompilerData(db) := nil [fun,$Category,e] mkConstructor: %Form -> %Form @@ -1198,9 +1198,10 @@ compDefineCategory(df,m,e,fal) == db := constructorDB ctor kind := dbConstructorKind db kind ~= "category" => throwKeyedMsg("S2IC0016",[ctor,"category",kind]) - dbClearForCompilation! db dbConstructorForm(db) := lhs - $insideFunctorIfTrue => compDefineCategory1(df,m,e,fal) + $insideFunctorIfTrue => + try compDefineCategory1(df,m,e,fal) + finally dbCompilerData(db) := nil compDefineLisplib(df,m,e,fal,'compDefineCategory1) diff --git a/src/interp/lisplib.boot b/src/interp/lisplib.boot index 5da16dec..54220181 100644 --- a/src/interp/lisplib.boot +++ b/src/interp/lisplib.boot @@ -439,7 +439,9 @@ compDefineLisplib(df:=["DEF",[op,:.],:.],m,e,fal,fn) == leaveIfErrors(libName,dbConstructorKind db) sayMSG ['" finalizing ",$spadLibFT,:bright libName] ok := finalizeLisplib(db,libName) - finally RSHUT $libFile + finally + RSHUT $libFile + dbCompilerData(db) := nil if ok then lisplibDoRename(libName) filearg := makeFullFilePath [libName,$spadLibFT,$libraryDirectory] RPACKFILE filearg |