Skip to content

Commit

Permalink
Move all non-prim instructions into Section
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisPenner committed Jan 3, 2025
1 parent b7b3439 commit e50ef74
Show file tree
Hide file tree
Showing 4 changed files with 385 additions and 270 deletions.
34 changes: 17 additions & 17 deletions unison-runtime/src/Unison/Runtime/Interface.hs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ import Unison.Runtime.Exception
import Unison.Runtime.MCode
( Args (..),
CombIx (..),
GInstr (..),
GSection (..),
RCombs,
RefNums (..),
Expand Down Expand Up @@ -1063,7 +1062,7 @@ executeMainComb ::
CCache ->
IO (Either (Pretty ColorText) ())
executeMainComb init cc = do
rSection <- resolveSection cc $ Ins (Pack RF.unitRef (PackedTag 0) ZArgs) $ Call True init init (VArg1 0)
rSection <- resolveSection cc $ Pack RF.unitRef (PackedTag 0) ZArgs $ Call True init init (VArg1 0)
result <-
UnliftIO.try . eval0 cc Nothing $ rSection
case result of
Expand Down Expand Up @@ -1440,18 +1439,19 @@ buildSCache crsrc cssrc cacheableCombs trsrc ftm fty int rtmsrc rtysrc sndbx =
restrictTyR m = Map.restrictKeys m typeRefs

standalone :: CCache -> Word64 -> IO StoredCache
standalone cc init = readTVarIO (combRefs cc) >>= \crs ->
case EC.lookup init crs of
Just rinit ->
buildSCache crs
<$> readTVarIO (srcCombs cc)
<*> readTVarIO (cacheableCombs cc)
<*> readTVarIO (tagRefs cc)
<*> readTVarIO (freshTm cc)
<*> readTVarIO (freshTy cc)
<*> (readTVarIO (intermed cc) >>= traceNeeded rinit)
<*> readTVarIO (refTm cc)
<*> readTVarIO (refTy cc)
<*> readTVarIO (sandbox cc)
Nothing ->
die $ "standalone: unknown combinator: " ++ show init
standalone cc init =
readTVarIO (combRefs cc) >>= \crs ->
case EC.lookup init crs of
Just rinit ->
buildSCache crs
<$> readTVarIO (srcCombs cc)
<*> readTVarIO (cacheableCombs cc)
<*> readTVarIO (tagRefs cc)
<*> readTVarIO (freshTm cc)
<*> readTVarIO (freshTy cc)
<*> (readTVarIO (intermed cc) >>= traceNeeded rinit)
<*> readTVarIO (refTm cc)
<*> readTVarIO (refTy cc)
<*> readTVarIO (sandbox cc)
Nothing ->
die $ "standalone: unknown combinator: " ++ show init
Loading

0 comments on commit e50ef74

Please sign in to comment.