Skip to content

Commit

Permalink
Fix bad arg serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisPenner committed Oct 15, 2024
1 parent 584bb40 commit a78e986
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
3 changes: 3 additions & 0 deletions unison-runtime/src/Unison/Runtime/ANF.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1535,8 +1535,11 @@ type ANFD v = Compose (ANFM v) (Directed ())
data GroupRef = GR Reference Word64
deriving (Show)

-- | A value which is either unboxed or boxed.
type UBValue = Either Word64 Value

-- | A list of either unboxed or boxed values.
-- Each slot is one of unboxed or boxed but not both.
type ValList = [UBValue]

data Value
Expand Down
2 changes: 1 addition & 1 deletion unison-runtime/src/Unison/Runtime/Decompile.hs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@ decompile backref topTerms = \case
-- Only match lists of boxed args.
| ([], bs) <- partitionEithers vs ->
apps' (con rf ct) <$> traverse (decompile backref topTerms) bs
(DataC rf _ _) -> err (BadData rf) $ bug "<Data>"
(PApV (CIx rf rt k) _ (partitionEithers -> ([], bs)))
| rf == Builtin "jumpCont" ->
err Cont $ bug "<Continuation>"
Expand All @@ -179,6 +178,7 @@ decompile backref topTerms = \case
| otherwise -> err (UnkComb rf) $ ref () rf
(PAp (CIx rf _ _) _ _) ->
err (BadPAp rf) $ bug "<Unknown>"
(DataC rf _ _) -> err (BadData rf) $ bug "<Data>"
BlackHole -> err Exn $ bug "<Exception>"
(Captured {}) -> err Cont $ bug "<Continuation>"
(Foreign f) ->
Expand Down
3 changes: 1 addition & 2 deletions unison-runtime/src/Unison/Runtime/MCode.hs
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,7 @@ data Args
| VArg2 !Int !Int
| VArgR !Int !Int
| VArgN {-# UNPACK #-} !(PrimArray Int)
| -- TODO: What do I do with this?
VArgV !Int
| VArgV !Int
deriving (Show, Eq, Ord)

argsToLists :: Args -> [Int]
Expand Down
2 changes: 1 addition & 1 deletion unison-runtime/src/Unison/Runtime/MCode/Serialize.hs
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ instance Tag ArgsT where
putArgs :: (MonadPut m) => Args -> m ()
putArgs ZArgs = putTag ZArgsT
putArgs (VArg1 i) = putTag Arg1T *> pInt i
putArgs (VArg2 i j) = putTag Arg1T *> pInt i *> pInt j
putArgs (VArg2 i j) = putTag Arg2T *> pInt i *> pInt j
putArgs (VArgR i j) = putTag ArgRT *> pInt i *> pInt j
putArgs (VArgN pa) = putTag ArgNT *> putIntArr pa
putArgs (VArgV i) = putTag ArgVT *> pInt i
Expand Down

0 comments on commit a78e986

Please sign in to comment.