more green test
This commit is contained in:
@@ -948,7 +948,7 @@ eval budget store FunctionInstance { funcType, moduleInstance, code = Function {
|
|||||||
let dest = fromIntegral d
|
let dest = fromIntegral d
|
||||||
let len = fromIntegral n
|
let len = fromIntegral n
|
||||||
dropped <- readIORef isDropped
|
dropped <- readIORef isDropped
|
||||||
if dropped || src + len > LBS.length bytes || dest + len > size
|
if (dropped && len > 0) || src + len > LBS.length bytes || dest + len > size
|
||||||
then return Trap
|
then return Trap
|
||||||
else do
|
else do
|
||||||
mapM_ (uncurry $ ByteArray.writeByteArray memory) $ zip [fromIntegral d..] $
|
mapM_ (uncurry $ ByteArray.writeByteArray memory) $ zip [fromIntegral d..] $
|
||||||
@@ -974,7 +974,7 @@ eval budget store FunctionInstance { funcType, moduleInstance, code = Function {
|
|||||||
isDropped <- readIORef dropFlag
|
isDropped <- readIORef dropFlag
|
||||||
if src + len > Vector.length refs
|
if src + len > Vector.length refs
|
||||||
|| dst + len > MVector.length els
|
|| dst + len > MVector.length els
|
||||||
|| isDropped
|
|| (isDropped && len > 0)
|
||||||
|| isDeclarative mode
|
|| isDeclarative mode
|
||||||
then return Trap
|
then return Trap
|
||||||
else do
|
else do
|
||||||
|
|||||||
@@ -550,9 +550,15 @@ getExpressionTypeWithInput inp = fmap (inp `Arrow`) . foldM go inp
|
|||||||
if isRef v
|
if isRef v
|
||||||
then throwError $ TypeMismatch (empty ==> empty) (empty ==> empty)
|
then throwError $ TypeMismatch (empty ==> empty) (empty ==> empty)
|
||||||
else matchStack stack (subst args) (subst res)
|
else matchStack stack (subst args) (subst res)
|
||||||
|
matchStack (Var:stack) (NonRefVar:args) res =
|
||||||
|
let subst = replace NonRefVar NonRefVar in
|
||||||
|
matchStack stack (subst args) (subst res)
|
||||||
|
matchStack (NonRefVar:stack) (Var:args) res =
|
||||||
|
let subst = replace Var NonRefVar in
|
||||||
|
matchStack stack (subst args) (subst res)
|
||||||
matchStack stack [] res = return $ res ++ stack
|
matchStack stack [] res = return $ res ++ stack
|
||||||
matchStack [] args res = throwError $ TypeMismatch ((reverse args) `Arrow` res) ([] `Arrow` [])
|
matchStack [] args res = throwError $ TypeMismatch ((reverse args) `Arrow` res) ([] `Arrow` [])
|
||||||
matchStack _ _ _ = error "inconsistent checker state"
|
matchStack st args res = error $ "inconsistent checker state: " ++ show (st, args, res)
|
||||||
|
|
||||||
getExpressionType :: Expression -> Checker Arrow
|
getExpressionType :: Expression -> Checker Arrow
|
||||||
getExpressionType = getExpressionTypeWithInput []
|
getExpressionType = getExpressionTypeWithInput []
|
||||||
|
|||||||
+1
-1
@@ -19,7 +19,7 @@ main = do
|
|||||||
files <-
|
files <-
|
||||||
filter (not . List.isPrefixOf "simd") . filter (List.isSuffixOf ".wast")
|
filter (not . List.isPrefixOf "simd") . filter (List.isSuffixOf ".wast")
|
||||||
<$> Directory.listDirectory "tests/spec"
|
<$> Directory.listDirectory "tests/spec"
|
||||||
-- let files = ["imports.wast"]
|
-- let files = ["unreached-valid.wast"]
|
||||||
scriptTestCases <- (`mapM` files) $ \file -> do
|
scriptTestCases <- (`mapM` files) $ \file -> do
|
||||||
test <- LBS.readFile ("tests/spec/" ++ file)
|
test <- LBS.readFile ("tests/spec/" ++ file)
|
||||||
return $ testCase file $ do
|
return $ testCase file $ do
|
||||||
|
|||||||
Reference in New Issue
Block a user