add elem.drop and extend call_indirect to accept table index

This commit is contained in:
Ilya Rezvov
2022-06-04 21:58:34 -06:00
parent 6eb3acde17
commit 82defff076
7 changed files with 74 additions and 29 deletions
+3 -3
View File
@@ -365,7 +365,7 @@ instance Serialize (Instruction Natural) where
put (BrTable labels label) = putWord8 0x0E >> putVec (map Index labels) >> putULEB128 label
put Return = putWord8 0x0F
put (Call funcIdx) = putWord8 0x10 >> putULEB128 funcIdx
put (CallIndirect typeIdx) = putWord8 0x11 >> putULEB128 typeIdx >> putWord8 0x00
put (CallIndirect tableIdx typeIdx) = putWord8 0x11 >> putULEB128 typeIdx >> putULEB128 tableIdx
-- Parametric instructions
put Drop = putWord8 0x1A
put Select = putWord8 0x1B
@@ -565,8 +565,8 @@ instance Serialize (Instruction Natural) where
0x10 -> Call <$> getULEB128 32
0x11 -> do
typeIdx <- getULEB128 32
byteGuard 0x00
return $ CallIndirect typeIdx
tableIdx <- getULEB128 32
return $ CallIndirect tableIdx typeIdx
-- Parametric instructions
0x1A -> return $ Drop
0x1B -> return $ Select