Commit e6379b99 authored by Marc Coiffier's avatar Marc Coiffier
Browse files

Start defining two new builtins, 'showExpr' and 'showSyntax', to help when...

Start defining two new builtins, 'showExpr' and 'showSyntax', to help when debugging the behaviour of macros
parent 5ab843be
...@@ -161,6 +161,10 @@ jit_exprInd pe = let ?sys = jit_machine in do ...@@ -161,6 +161,10 @@ jit_exprInd pe = let ?sys = jit_machine in do
mallocBytes (2*wordSize) <*= \pret -> do mallocBytes (2*wordSize) <*= \pret -> do
poke (castPtr pret) (2 :: Int) poke (castPtr pret) (2 :: Int)
poke (castPtr (pret`plusPtr`wordSize)) ps poke (castPtr (pret`plusPtr`wordSize)) ps
jit_showExpr :: JIT_Expr -> IO ()
jit_showExpr pe = do
e <- deRefStablePtr (castPtrToStablePtr pe)
print (e :: Expression String String)
jit_memextend_pool sz = getOrDefine TextSection ("memextend-pool-"+show sz) $ do jit_memextend_pool sz = getOrDefine TextSection ("memextend-pool-"+show sz) $ do
ccall (Just poolReg) mallocAddr [return (Constant pageSize)] ccall (Just poolReg) mallocAddr [return (Constant pageSize)]
...@@ -223,6 +227,11 @@ jit_builtin B_ExprApply = Just $ getOrDefineBuiltin0 TextSection "mkExprApply" $ ...@@ -223,6 +227,11 @@ jit_builtin B_ExprApply = Just $ getOrDefineBuiltin0 TextSection "mkExprApply" $
cst <- global_constant cst <- global_constant
thisReg!TypeOffset <-- cst thisReg!TypeOffset <-- cst
jmp cst jmp cst
jit_builtin B_ShowExpr = Just $ getOrDefineBuiltin0 TextSection "showExpr" $ do
[e,x] <- builtinArgs 2
pushing [thisReg] $ callThunk e
ccall1 ccall_void (hsAddr jit_showExpr) (pure (e!ValueOffset))
tailCall x
jit_builtin B_ExprInd = Just $ getOrDefineBuiltin0 TextSection "exprInd" $ mdo jit_builtin B_ExprInd = Just $ getOrDefineBuiltin0 TextSection "exprInd" $ mdo
[e,kl,ka,ks] <- builtinArgs 4 [e,kl,ka,ks] <- builtinArgs 4
pushing [thisReg] $ callThunk e pushing [thisReg] $ callThunk e
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment