on master help sign in
javascript: disable all optimizations (temporary)
db43080raichoo
src/IRTS/CodegenJavaScript.hs+54−54
@@ -1237,24 +1237,24 @@ codegenJavaScript target definitions filename outputType = do
1237 compile =
1237 compile =
1238 map compileJS
1238 map compileJS
1239
1239
1240− opt =
1240+ opt = []
1241− [ map optimizeJS
1241+ {-[ map optimizeJS-}
1242− , removeIDs
1242+ {-, removeIDs-}
1243− , reduceJS
1243+ {-, reduceJS-}
1244− , map reduceConstants
1244+ {-, map reduceConstants-}
1245− , initConstructors
1245+ {-, initConstructors-}
1246− , map removeAllocations
1246+ {-, map removeAllocations-}
1247− , elimDeadLoop
1247+ {-, elimDeadLoop-}
1248− , map elimDuplicateEvals
1248+ {-, map elimDuplicateEvals-}
1249− , optimizeRuntimeCalls "__IDR__mEVAL0" "__IDRRT__EVALTC"
1249+ {-, optimizeRuntimeCalls "__IDR__mEVAL0" "__IDRRT__EVALTC"-}
1250− , optimizeRuntimeCalls "__IDR__mAPPLY0" "__IDRRT__APPLYTC"
1250+ {-, optimizeRuntimeCalls "__IDR__mAPPLY0" "__IDRRT__APPLYTC"-}
1251− , map removeInstanceChecks
1251+ {-, map removeInstanceChecks-}
1252− , inlineFunctions
1252+ {-, inlineFunctions-}
1253− , map reduceContinuations
1253+ {-, map reduceContinuations-}
1254− , extractLocalConstructors
1254+ {-, extractLocalConstructors-}
1255− , unfoldLookupTable
1255+ {-, unfoldLookupTable-}
1256− , evalCons
1256+ {-, evalCons-}
1257− ]
1257+ {-]-}
1258
1258
1259 prelude :: [JS]
1259 prelude :: [JS]
1260 prelude =
1260 prelude =
@@ -1413,42 +1413,42 @@ translateConstant c =
1413
1413
1414translateDeclaration :: (String, SDecl) -> [JS]
1414translateDeclaration :: (String, SDecl) -> [JS]
1415translateDeclaration (path, SFun name params stackSize body)
1415translateDeclaration (path, SFun name params stackSize body)
1416− | (MN _ ap) <- name
1416+ {-| (MN _ ap) <- name-}
1417− , (SLet var val next) <- body
1417+ {-, (SLet var val next) <- body-}
1418− , (SChkCase cvar cases) <- next
1418+ {-, (SChkCase cvar cases) <- next-}
1419− , ap == txt "APPLY" =
1419+ {-, ap == txt "APPLY" =-}
1420− let lvar = translateVariableName var
1420+ {-let lvar = translateVariableName var-}
1421− lookup t = (JSApp
1421+ {-lookup t = (JSApp-}
1422− (JSIndex (JSIdent t) (JSProj (JSIdent lvar) "tag"))
1422+ {-(JSIndex (JSIdent t) (JSProj (JSIdent lvar) "tag"))-}
1423− [JSIdent "fn0", JSIdent "arg0", JSIdent lvar]) in
1423+ {-[JSIdent "fn0", JSIdent "arg0", JSIdent lvar]) in-}
1424− [ lookupTable "APPLY" [(var, "chk")] var cases
1424+ {-[ lookupTable "APPLY" [(var, "chk")] var cases-}
1425− , jsDecl $ JSFunction ["fn0", "arg0"] (
1425+ {-, jsDecl $ JSFunction ["fn0", "arg0"] (-}
1426− JSSeq [ JSAlloc "__var_0" (Just $ JSIdent "fn0")
1426+ {-JSSeq [ JSAlloc "__var_0" (Just $ JSIdent "fn0")-}
1427− , JSAlloc (translateVariableName var) (
1427+ {-, JSAlloc (translateVariableName var) (-}
1428− Just $ translateExpression val
1428+ {-Just $ translateExpression val-}
1429− )
1429+ {-)-}
1430− , JSReturn $ (JSTernary (
1430+ {-, JSReturn $ (JSTernary (-}
1431− (JSVar var `jsInstanceOf` jsCon) `jsAnd`
1431+ {-(JSVar var `jsInstanceOf` jsCon) `jsAnd`-}
1432− (hasProp (idrLTNamespace ++ "APPLY") (translateVariableName var))
1432+ {-(hasProp (idrLTNamespace ++ "APPLY") (translateVariableName var))-}
1433− ) (lookup (idrLTNamespace ++ "APPLY")) JSNull)
1433+ {-) (lookup (idrLTNamespace ++ "APPLY")) JSNull)-}
1434− ]
1434+ {-]-}
1435− )
1435+ {-)-}
1436− ]
1436+ {-]-}
1437−
1437+
1438− | (MN _ ev) <- name
1438+ {-| (MN _ ev) <- name-}
1439− , (SChkCase var cases) <- body
1439+ {-, (SChkCase var cases) <- body-}
1440− , ev == txt "EVAL" =
1440+ {-, ev == txt "EVAL" =-}
1441− [ lookupTable "EVAL" [] var cases
1441+ {-[ lookupTable "EVAL" [] var cases-}
1442− , jsDecl $ JSFunction ["arg0"] (JSReturn $
1442+ {-, jsDecl $ JSFunction ["arg0"] (JSReturn $-}
1443− JSTernary (
1443+ {-JSTernary (-}
1444− (JSIdent "arg0" `jsInstanceOf` jsCon) `jsAnd`
1444+ {-(JSIdent "arg0" `jsInstanceOf` jsCon) `jsAnd`-}
1445− (hasProp (idrLTNamespace ++ "EVAL") "arg0")
1445+ {-(hasProp (idrLTNamespace ++ "EVAL") "arg0")-}
1446− ) (JSApp
1446+ {-) (JSApp-}
1447− (JSIndex (JSIdent (idrLTNamespace ++ "EVAL")) (JSProj (JSIdent "arg0") "tag"))
1447+ {-(JSIndex (JSIdent (idrLTNamespace ++ "EVAL")) (JSProj (JSIdent "arg0") "tag"))-}
1448− [JSIdent "arg0"]
1448+ {-[JSIdent "arg0"]-}
1449− ) (JSIdent "arg0")
1449+ {-) (JSIdent "arg0")-}
1450− )
1450+ {-)-}
1451− ]
1451+ {-]-}
1452 | otherwise =
1452 | otherwise =
1453 let fun = translateExpression body in
1453 let fun = translateExpression body in
1454 [jsDecl $ jsFun fun]
1454 [jsDecl $ jsFun fun]