Skip to content

Instantly share code, notes, and snippets.

Avatar

Csaba Hruska csabahruska

View GitHub Profile
@csabahruska
csabahruska / Printf.idr
Created Oct 11, 2021
printf example: idris performance regression 0.5.x (0.4 works fine)
View Printf.idr
module Printf
import Prelude
import Data.String
data Arg
= AInt Arg
| AOther Char Arg
| AEnd
@csabahruska
csabahruska / StgSample.hs
Last active Jan 22, 2020
FloatRep vs DoubleRep ADT Argument in STG (GHC 8.6.1 64 bit)
View StgSample.hs
module StgSample where
import StgLoopback
-- Compiler
import GHC
import DynFlags
import Outputable
-- Stg Types
@csabahruska
csabahruska / minimal.mil
Last active Nov 17, 2019
Hello world program for Intel Labs Functional Language Research Compiler (FLRC)
View minimal.mil
(*
only block comment exists
https://github.com/IntelLabs/flrc
compile: hrc minimal.mil
*)
Includes:
"stdio" : C
{ v1_printf : (CcUnmanaged cdecl; CStr, SInt64) -> ()
}
@csabahruska
csabahruska / sum_simple_grin.hs
Created Nov 28, 2018
optimized sum simple code with boxed literals
View sum_simple_grin.hs
grinMain =
v.0 <- pure (Cint64 1)
ptr_lit.1.0 <- store v.0
v.3 <- pure (Cint64 10)
ptr_lit.2.0 <- store v.3
ww.s15120.0.56.3.arity.1.0 <- pure 1
ww1.s15121.0.56.3.arity.1.0 <- pure 10
r_45.0.0 <- _prim_int_gt $ ww.s15120.0.56.3.arity.1.0 ww1.s15121.0.56.3.arity.1.0
unboxed.Cint64.3.0 <- case r_45.0.0 of
#False ->
@csabahruska
csabahruska / bug.ll
Created Feb 24, 2018
LLVM jump table crash with x64 JIT
View bug.ll
; ModuleID = 'basic'
source_filename = "<string>"
declare i64 @_prim_int_print(i64)
define <{ i64*, i64 }> @grinMain(i64* %_heap_ptr_.0) {
grinMain.entry:
%nodeAddress.4 = bitcast i64* %_heap_ptr_.0 to <{ i64, [1 x i64] }>*
store <{ i64, [1 x i64] }> <{ i64 0, [1 x i64] [i64 1] }>, <{ i64, [1 x i64] }>* %nodeAddress.4, align 1
%_heap_ptr_.5 = bitcast i64* %_heap_ptr_.0 to <{ i64, [2 x i64*], [1 x i64] }>*
@csabahruska
csabahruska / asteroids.lc
Created May 10, 2017
asteroids graphics pipeline in lambdacube3d
View asteroids.lc
makeFrame (time :: Float)
(color :: Vec 4 Float)
(angle :: Float)
(position :: Vec 3 Float)
(texture :: Texture)
(prims :: PrimitiveStream Triangle (Vec 4 Float, Vec 3 Float, Vec 3 Float))
= imageFrame (emptyDepthImage 1, emptyColorImage (V4 0 0 0.4 1))
`overlay`
prims
View TestIndentation.hs
import Data.ByteString.Char8 (unpack,pack)
import qualified Data.ByteString.Char8 as BS
import Control.Applicative
import Text.Trifecta
import Text.Trifecta.Indentation as I
import Text.Trifecta.Delta
import Text.Parser.Token.Style
import qualified Data.HashSet as HashSet
type EName = String