This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <new> | |
#include <cstdlib> | |
// malloc cannot fail on Emscripten, so don't even bother checking. | |
// We also know that `malloc(0)` will return a non-null pointer, so | |
// don't check that `count` is positive.. | |
__attribute__((__always_inline__)) void* operator new(std::size_t count) { | |
return std::malloc(count); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__Z7averagePN9northstar7Color32ES1_: ## @_Z7averagePN9northstar7Color32ES1_ | |
.cfi_startproc | |
## BB#0: | |
push rbp | |
Ltmp29: | |
.cfi_def_cfa_offset 16 | |
Ltmp30: | |
.cfi_offset rbp, -16 | |
mov rbp, rsp | |
Ltmp31: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
walk :: FilePath -> ((FilePath, [FilePath], [FilePath]) -> IO ()) -> IO () | |
walk root action = do | |
entries <- Directory.getDirectoryContents root | |
directories <- newIORef [] | |
files <- newIORef [] | |
forM_ entries $ \entry -> do | |
let fullPath = combine root entry | |
isFile <- Directory.doesFileExist fullPath | |
if isFile then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let imqQueue = Envelope.updateMountForNode feedId | |
_ <- RestIMQ.setupQueue imqQueue authCid | |
forM_ feed $ \(elementId, _, _, _) -> do | |
let updates = Envelope.updateMountForNode elementId | |
let comments = updateMountForComments elementId | |
let likes = updateMountForLikes elementId | |
_ <- RestIMQ.setupQueue comments authCid | |
_ <- RestIMQ.setupQueue likes authCid | |
_ <- RestIMQ.setupQueue updates authCid | |
return () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
getEntityBodies :: Envelope -> [EntityBody] | |
getEntityBodies Envelope{..} = ePrimary : HashMap.elems eDenormalized | |
gatherMounts :: Envelope -> [Imq.ImqUpdateMount] | |
gatherMounts envelope = catMaybes $ map eUpdates $ getEntityBodies envelope | |
setupQueuesForEnvelope :: World m => CustomerId -> Envelope -> m () | |
setupQueuesForEnvelope cid envelope = do | |
RestIMQ.setupQueues cid $ gatherMounts envelope |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE MagicHash, RankNTypes, UnboxedTuples #-} | |
import GHC.Base | |
newtype Counter s a = Counter (STRep s a) | |
type STRep s a = Int# -> (# Int#, a #) | |
instance Functor (Counter s) where | |
fmap f (Counter m) = Counter $ \ s -> | |
case (m s) of { (# new_s, r #) -> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE MagicHash, RankNTypes, UnboxedTuples #-} | |
import GHC.Base | |
newtype Counter s a = Counter (CRep s a) | |
type CRep s a = (# State# s, Int# #) -> (# State# s, Int#, a #) | |
instance Functor (Counter s) where | |
fmap f (Counter m) = Counter $ \ s -> | |
case (m s) of { (# new_s, n, r #) -> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
grow :: (# State# RealWorld, Buffer# #) -> (# State# RealWorld, Buffer# #) | |
grow (# s0, (# _, size, cap, _ #) #) = | |
let newCap# = cap *# 2# in | |
let (IO iorep) = mallocForeignPtrBytes (I# newCap#) in | |
case iorep s0 of { | |
(# s1, fp@(ForeignPtr addr# _) #) -> (# s1, (# addr#, size, newCap#, fp #) #) } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
s4YQ_ret() | |
{ Just s4YQ_info: | |
const 16777170; | |
const 32; | |
} | |
c5l5: | |
_s4YI::I64 = I64[Sp + 136] + I64[Sp + 128]; | |
_c5lG::I64 = I64[R1 + 7]; | |
_c5lH::I64 = I64[Sp + 144]; | |
foreign "ccall" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
s4YQ_ret() | |
{ Just s4YQ_info: | |
const 16777170; | |
const 32; | |
} | |
c5l5: | |
_s4YI::I64 = I64[Sp + 136] + I64[Sp + 128]; | |
_c5lG::I64 = I64[R1 + 7]; | |
_c5lH::I64 = I64[Sp + 144]; | |
foreign "ccall" |