Skip to content

Instantly share code, notes, and snippets.

View csabahruska's full-sized avatar

Csaba Hruska csabahruska

View GitHub Profile
@csabahruska
csabahruska / TestIndentation.hs
Created January 30, 2015 18:04
indentation example
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
@csabahruska
csabahruska / asteroids.lc
Created May 10, 2017 08:19
asteroids graphics pipeline in lambdacube3d
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
@csabahruska
csabahruska / bug.ll
Created February 24, 2018 22:45
LLVM jump table crash with x64 JIT
; 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 / sum_simple_grin.hs
Created November 28, 2018 14:37
optimized sum simple code with boxed literals
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 / minimal.mil
Last active November 17, 2019 11:42
Hello world program for Intel Labs Functional Language Research Compiler (FLRC)
(*
only block comment exists
https://github.com/IntelLabs/flrc
compile: hrc minimal.mil
*)
Includes:
"stdio" : C
{ v1_printf : (CcUnmanaged cdecl; CStr, SInt64) -> ()
}
@csabahruska
csabahruska / StgSample.hs
Last active January 22, 2020 10:44
FloatRep vs DoubleRep ADT Argument in STG (GHC 8.6.1 64 bit)
module StgSample where
import StgLoopback
-- Compiler
import GHC
import DynFlags
import Outputable
-- Stg Types
@csabahruska
csabahruska / Printf.idr
Created October 11, 2021 12:02
printf example: idris performance regression 0.5.x (0.4 works fine)
module Printf
import Prelude
import Data.String
data Arg
= AInt Arg
| AOther Char Arg
| AEnd