From 068804b3971dc7d29e7a070ff1d0eaa4509229f7 Mon Sep 17 00:00:00 2001 From: Mike Gerwitz Date: Fri, 28 Apr 2023 16:40:26 -0400 Subject: [PATCH] tamer: Remove {ret}map:___{head,tail} These have been a pain in the ass since TAMER began. It seemed like a good idea at the time to have static code generated in this way, but the lack of explicit dependencies just makes this a mess and works against the operating theory of the system. Furthermore, the _same_ static fragments were generated for each and every map package. There is still a post-link step (standalones) handled in XSLT; the previously-static code has been moved there. This will eventually be integrated into tameld itself, once TAMER has facilities for JS generation. (This was discovered while trying to parent identifiers to packages.) DEV-13162 --- .rev-xmle | 2 +- src/current/compiler/map.xsl | 43 ------------------------------ src/current/standalone.xsl | 34 ++++++------------------ tamer/src/ld/xmle/lower.rs | 28 +------------------- tamer/src/ld/xmle/lower/test.rs | 46 ++------------------------------- tamer/src/sym/prefill.rs | 5 ---- 6 files changed, 12 insertions(+), 146 deletions(-) diff --git a/.rev-xmle b/.rev-xmle index d5f323cf..85496b67 100644 --- a/.rev-xmle +++ b/.rev-xmle @@ -1,4 +1,4 @@ # This number is incremented for every linker change to force rebuilding # of xmle files. -4 +5 # Removal of {ret,}map:___{head,tail} diff --git a/src/current/compiler/map.xsl b/src/current/compiler/map.xsl index 101355b7..bc75214b 100644 --- a/src/current/compiler/map.xsl +++ b/src/current/compiler/map.xsl @@ -127,27 +127,12 @@ $pkg-with-symtable/preproc:sym-deps" /> - - - - function( input, callback ) { - var output = {}; - - - - - - - callback(output); - }; - @@ -204,27 +189,12 @@ $pkg-with-symtable/preproc:sym-deps" /> - - - - function( input, callback ) { - var output = {}; - - - - - - - callback(output); - }; - @@ -236,19 +206,6 @@ - - - diff --git a/src/current/standalone.xsl b/src/current/standalone.xsl index 7a3b591b..f6f9362b 100644 --- a/src/current/standalone.xsl +++ b/src/current/standalone.xsl @@ -75,34 +75,16 @@ - rater.fromMap = - - - - - - - - - function(d,c){c(d);} - - - ; + rater.fromMap=function(input,callback){ + var output={}; + + callback(output);}; - rater._retmap = - - - - - - - - - function(d,c){c(d);} - - - ; + rater._retmap=function(input,callback){ + var output={}; + + callback(output);}; module.exports = function( args_base, _canterm ) { diff --git a/tamer/src/ld/xmle/lower.rs b/tamer/src/ld/xmle/lower.rs index edb05da7..85e26281 100644 --- a/tamer/src/ld/xmle/lower.rs +++ b/tamer/src/ld/xmle/lower.rs @@ -23,12 +23,10 @@ use super::section::{SectionsError, XmleSections}; use crate::{ - asg::{visit::topo_sort, Asg, AsgError, Ident, Object}, + asg::{visit::topo_sort, Asg, AsgError, Object}, diagnose::{Annotate, Diagnostic}, diagnostic_unreachable, - parse::util::SPair, span::UNKNOWN_SPAN, - sym::{st, GlobalSymbolResolve, SymbolId}, }; // Result of [`sort`]. @@ -41,12 +39,6 @@ pub fn sort<'a, S: XmleSections<'a>>(asg: &'a Asg, mut dest: S) -> SortResult where S: XmleSections<'a>, { - // These are always generated by the map compiler, - // but do not have edges that would allow them to be properly ordered - // (adding an edge to every map object would be wasteful). - dest.push(get_ident(asg, st::L_MAP_UUUHEAD))?; - dest.push(get_ident(asg, st::L_RETMAP_UUUHEAD))?; - let roots = [asg.root(UNKNOWN_SPAN).widen()].into_iter(); for result in topo_sort(asg, roots) { @@ -72,27 +64,9 @@ where } } - dest.push(get_ident(asg, st::L_MAP_UUUTAIL))?; - dest.push(get_ident(asg, st::L_RETMAP_UUUTAIL))?; - Ok(dest) } -fn get_ident(depgraph: &Asg, name: S) -> &Ident -where - S: Into, -{ - let oi_root = depgraph.root(UNKNOWN_SPAN); - let sym = name.into(); - - depgraph - .lookup(oi_root, SPair(sym, UNKNOWN_SPAN)) - .and_then(|id| depgraph.get(id)) - .unwrap_or_else(|| { - panic!("missing internal identifier: {}", sym.lookup_str()) - }) -} - /// Error during graph sorting. /// /// These errors reflect barriers to meaningfully understanding the diff --git a/tamer/src/ld/xmle/lower/test.rs b/tamer/src/ld/xmle/lower/test.rs index 74e51395..b8b1d63a 100644 --- a/tamer/src/ld/xmle/lower/test.rs +++ b/tamer/src/ld/xmle/lower/test.rs @@ -23,7 +23,7 @@ use crate::{ ld::xmle::{section::PushResult, Sections}, parse::util::SPair, span::dummy::*, - sym::GlobalSymbolIntern, + sym::SymbolId, }; fn declare( @@ -43,43 +43,7 @@ fn lookup_or_missing(asg: &mut Asg, name: SPair) -> ObjectIndex { /// Create a graph with the expected {ret,}map head/tail identifiers. fn make_asg() -> Asg { - let mut asg = Asg::new(); - - let text = "dummy fragment".intern(); - - { - let sym = SPair(st::L_MAP_UUUHEAD.into(), S1); - declare(&mut asg, sym, IdentKind::MapHead, Default::default()) - .unwrap() - .set_fragment(&mut asg, text) - .unwrap(); - } - - { - let sym = SPair(st::L_MAP_UUUTAIL.into(), S2); - declare(&mut asg, sym, IdentKind::MapTail, Default::default()) - .unwrap() - .set_fragment(&mut asg, text) - .unwrap(); - } - - { - let sym = SPair(st::L_RETMAP_UUUHEAD.into(), S3); - declare(&mut asg, sym, IdentKind::RetMapHead, Default::default()) - .unwrap() - .set_fragment(&mut asg, text) - .unwrap(); - } - - { - let sym = SPair(st::L_RETMAP_UUUTAIL.into(), S4); - declare(&mut asg, sym, IdentKind::RetMapTail, Default::default()) - .unwrap() - .set_fragment(&mut asg, text) - .unwrap(); - } - - asg + Asg::new() } #[test] @@ -156,16 +120,10 @@ fn graph_sort() -> SortResult<()> { assert_eq!( sections.pushed, vec![ - // Static head - get_ident(&asg, st::L_MAP_UUUHEAD), - get_ident(&asg, st::L_RETMAP_UUUHEAD), // Post-order asg.get(adepdep).unwrap(), asg.get(adep).unwrap(), asg.get(a).unwrap(), - // Static tail - get_ident(&asg, st::L_MAP_UUUTAIL), - get_ident(&asg, st::L_RETMAP_UUUTAIL), ] .into_iter() .collect::>() diff --git a/tamer/src/sym/prefill.rs b/tamer/src/sym/prefill.rs index 2f2b82ee..9c2ac454 100644 --- a/tamer/src/sym/prefill.rs +++ b/tamer/src/sym/prefill.rs @@ -720,11 +720,6 @@ pub mod st { CC_ANY_OF: cid "anyOf", - L_MAP_UUUHEAD: str ":map:___head", - L_MAP_UUUTAIL: str ":map:___tail", - L_RETMAP_UUUHEAD: str ":retmap:___head", - L_RETMAP_UUUTAIL: str ":retmap:___tail", - U_TRUE: cid "TRUE", URI_LV_CALC: uri "http://www.lovullo.com/calc",