Skip to content
This repository has been archived by the owner on Nov 24, 2022. It is now read-only.

Use V8 lazy compilation/validation for TH splices #633

Merged
merged 3 commits into from
May 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion asterius/src/Asterius/GHCi/Internals.hs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ newGHCiJSSession = do
defJSSessionOpts
{ nodeExtraArgs =
[ "--experimental-wasm-return-call",
"--wasm-interpret-all",
"--wasm-lazy-compilation",
"--wasm-lazy-validation",
"--wasm-max-mem-pages=65536"
],
nodeExtraEnv =
Expand Down
1 change: 1 addition & 0 deletions asterius/src/Asterius/JSRun/NonMain.hs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ distNonMain p extra_syms =
inputHS = p,
outputDirectory = takeDirectory p,
outputBaseName = takeBaseName p,
validate = False,
tailCalls = True,
yolo = True,
Asterius.Main.Task.hasMain = False,
Expand Down
8 changes: 5 additions & 3 deletions asterius/src/Asterius/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ parseTask args = case err_msgs of
str_opt "output-directory" $ \s t -> t {outputDirectory = s},
str_opt "output-prefix" $ \s t -> t {outputBaseName = s},
bool_opt "no-main" $ \t -> t {hasMain = False},
bool_opt "no-validate" $ \t -> t {validate = False},
bool_opt "tail-calls" $ \t -> t {tailCalls = True},
bool_opt "no-gc-sections" $ \t -> t {gcSections = False},
bool_opt "bundle" $ \t -> t {bundle = True},
Expand Down Expand Up @@ -317,9 +318,10 @@ ahcDistMain logger task (final_m, report) = do
when (optimizeLevel task > 0 || shrinkLevel task > 0) $ do
logger "[INFO] Running binaryen optimization"
Binaryen.optimize m_ref
logger "[INFO] Validating binaryen IR"
pass_validation <- Binaryen.validate m_ref
when (pass_validation /= 1) $ fail "[ERROR] binaryen validation failed"
when (validate task) $ do
logger "[INFO] Validating binaryen IR"
pass_validation <- Binaryen.validate m_ref
when (pass_validation /= 1) $ fail "[ERROR] binaryen validation failed"
m_bin <- Binaryen.serializeModule m_ref
logger $ "[INFO] Writing WebAssembly binary to " <> show out_wasm
BS.writeFile out_wasm m_bin
Expand Down
4 changes: 3 additions & 1 deletion asterius/src/Asterius/Main/Task.hs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ module Asterius.Main.Task
outputDirectory,
outputBaseName,
hasMain,
validate,
tailCalls,
gcSections,
bundle,
Expand Down Expand Up @@ -51,7 +52,7 @@ data Task
inputEntryMJS :: Maybe FilePath,
outputDirectory :: FilePath,
outputBaseName :: String,
hasMain, tailCalls, gcSections, bundle, debug, outputIR, run, verboseErr, yolo, consoleHistory :: Bool,
hasMain, validate, tailCalls, gcSections, bundle, debug, outputIR, run, verboseErr, yolo, consoleHistory :: Bool,
extraGHCFlags :: [String],
exportFunctions, extraRootSymbols :: [EntitySymbol],
gcThreshold :: Int
Expand All @@ -68,6 +69,7 @@ defTask = Task
outputBaseName = error "Asterius.Main.parseTask: missing outputBaseName",
inputEntryMJS = Nothing,
hasMain = True,
validate = True,
tailCalls = False,
gcSections = True,
bundle = False,
Expand Down