[00:20:15] Reifying the stack makes it relatively easy (but not fast) to implement some neat things like continuations & coroutines [00:21:06] But yeah, it's looking like my best bet is to inline stack combinators :/ [00:21:23] Maybe that'll be okay in practice [00:24:38] The only thing in common.ktn that doesn't work for is 'fix', which could be special-cased [00:25:44] I also wanted to add folds that use the stack as their accumulator [00:31:26] But that's more of a parlour trick [00:31:34] It's still possible. Just use registers for arguments that are expected to be used with known types, and another register with the address of the rest of the stack. [00:32:09] If it will be passed on without modification, passing the address is more efficient. [00:32:40] So you just have to determine what part of the stack will be used. [00:33:29] And this is pretty easy from the type signature. [00:36:20] Basically, anything without a concrete type (stack variables & quotes) are pointers, everything else is passed via register if it fits in a register. [00:38:36] I mean with something like "optional (R..., Optional, (R..., T -> S...), (R... -> S...) -> S...)" [00:39:00] It doesn't know how many values are consumed or produced [00:39:35] So it would need to have a "generic call" wrapper to load & store the values from the stack pointer [00:39:42] Or something like that [00:40:30] All it knows is "I have these two closures, and I can execute either of them type-safely" [00:44:58] You could support specialized versions, like GHC does. [00:45:19] So say R... = Float64, Float64 and S... = Int32, then these functions might expect to be called with the inputs in %xmm{0,1} and return the output in %eax, but "optional" doesn't know that, so it'd need to go through a "generic_call_f64_f64__i32" stub [00:45:21] Just generate specialized versions on demand with some pragma. [00:47:25] This isn't an optional feature, in my opinion. Unspecialized higher order functions in Haskell are often many times slower. [00:47:38] I mean, I could generate specialisations of "optional" for different values of R... and S..., it would just require keeping track of arity so it doesn't include the whole stack [00:48:04] I found that I had to specialize every function to get reasonable performance in a math heavy program. [00:48:32] So you'd have things like "optional__f64_f64__i32__Foo" (if you call it on an Optional) [00:48:53] Yeah, specialisation is often my preferred way to go as long as it doesn't make code size blow up too badly [00:49:52] I have never seen a situation where the program would have been faster without specialization. [00:50:38] Sure, it often results in simply *not* doing redundant work [00:50:57] Basically, there should be no type polymorphism in compiled code. [00:51:29] My strategy is to delay code generation until all variables are resolved. [00:56:10] I still compile polymorphic functions to IR, but they will later be inlined into monomorphic functions. [00:57:34] So no separate compilation? [00:59:52] Sort of. The conversion to C is fairly trivial. [01:01:02] I can compile each function into IR separately, but right now, functions are inlined exhaustively. [01:01:29] That will have to change eventually. [01:09:23] Yeah, separate compilation is a worthy feature, especially for large codebases [01:09:46] Even if you have a fast compiler [01:11:36] Whole-program optimisation is pretty juicy though [01:11:37] You can make so many more assumptions with a closed world [01:13:59] So far, compilation of all the code that I have to C takes a few milliseconds. I haven't timed compilation of the resulting C, though. [01:15:04] Anything is faster than compiling C++, though. [01:28:16] * jtimon [jtimon!~quassel@164.31.134.37.dynamic.jazztel.es] has quit (Ping timeout: 252 seconds). [02:57:04] * MDude [MDude!~MDude@c-73-187-225-46.hsd1.pa.comcast.net] has quit (Ping timeout: 248 seconds). [05:36:06] * flogbot [flogbot!~flogbot@2001:4800:7814:0:2804:b05a:ff04:4ba7] has quit (Ping timeout: 246 seconds). [05:36:15] * flogbot [flogbot!~flogbot@2001:4800:7814:0:2804:b05a:ff04:4ba7] has joined the channel. [05:36:16] :kornbluth.freenode.net 353 flogbot = #concatenative :flogbot xkapastel evincar MrBusiness3 aspect FreeFull hackerfoo m_hackerfoo groovy2shoes bmp shmibs jeaye earl Sonderblade Sgeo ecx86 ephe_meral rotty diginet mtp rgrinberg sclv zgrep amuck lonjil delvinj dustinm` pointfree rprimus apajx erg mollerse otoburb jeremyheiler strmpnk carvite jlewis merry @shapr shachaf cstrahan [05:36:16] :kornbluth.freenode.net 366 flogbot #concatenative :End of /NAMES list. [06:01:35] * evincar [evincar!~jon@173-228-12-171.dsl.dynamic.fusionbroadband.com] has quit (Ping timeout: 248 seconds). [07:41:02] * xkapastel [xkapastel!uid17782@gateway/web/irccloud.com/x-qsofhyqzznocrtxl] has quit (Quit: Connection closed for inactivity). [10:26:45] * FreeFull [FreeFull!~freefull@defocus/sausage-lover] has quit (Ping timeout: 260 seconds). [10:28:25] * FreeFull [FreeFull!~freefull@defocus/sausage-lover] has joined the channel. [10:30:00] * evincar [evincar!~jon@173-228-12-171.dsl.dynamic.fusionbroadband.com] has joined the channel. [10:57:23] * FreeFull [FreeFull!~freefull@defocus/sausage-lover] has quit (Ping timeout: 240 seconds). [11:21:05] * evincar [evincar!~jon@173-228-12-171.dsl.dynamic.fusionbroadband.com] has quit (Quit: leaving). [12:09:38] * jtimon [jtimon!~quassel@164.31.134.37.dynamic.jazztel.es] has joined the channel. [12:28:21] * FreeFull [FreeFull!~freefull@defocus/sausage-lover] has joined the channel. [12:47:04] * Sonderblade [Sonderblade!~fack@h-50-217.A157.priv.bahnhof.se] has quit (Quit: Leaving). [15:27:19] * MDude [MDude!~MDude@c-73-187-225-46.hsd1.pa.comcast.net] has joined the channel. [17:12:44] * tgunr [tgunr!~tgunr@cpe-76-173-79-238.hawaii.res.rr.com] has joined the channel. [17:57:19] * xkapastel [xkapastel!uid17782@gateway/web/irccloud.com/x-xfzpydoqgrqslslx] has joined the channel. [19:03:46] * MDude [MDude!~MDude@c-73-187-225-46.hsd1.pa.comcast.net] has quit (Quit: Going offline, see ya! (www.adiirc.com)). [19:25:25] * MDude [MDude!~MDude@c-73-187-225-46.hsd1.pa.comcast.net] has joined the channel. [19:36:22] * jtimon [jtimon!~quassel@164.31.134.37.dynamic.jazztel.es] has quit (Ping timeout: 264 seconds). [20:38:50] * jtimon [jtimon!~quassel@164.31.134.37.dynamic.jazztel.es] has joined the channel. [22:11:43] * Sgeo [Sgeo!~Sgeo@ool-18b98627.dyn.optonline.net] has quit (Read error: Connection reset by peer).