freenode/#sbcl - IRC Chatlog
Search
14:06:43
flip214
within swank I get a type error - #<SYNONYM-STREAM :SYMBOL SWANK::*CURRENT-STANDARD-OUTPUT* {1009730593}> is not of type SB-SYS:FD-STREAM
15:15:32
flip214
stassats: can SBCL encapsulate the runtime environment into a (void*) that can be passed to foreign functions, so that a lisp callback function can run closures that were defined outside the foreign call)
15:19:02
flip214
the callback is started and gets a (void*) to communicate some information (in C, typically a heap-allocated data structure)
15:21:17
Bike
you want to reference a closure in C as a function pointer plus a pointer to the closure environment?
15:22:49
flip214
and the lisp callback wants to use closures that got passed in to the outer lisp function (the one calling a foreign function)
15:27:07
flip214
the issue is that I actually get to pass in a vtable of functions, and one (void)* for the lexical scope
15:27:57
flip214
and I'd like to avoid reproducing the vtable as a structure in lisp, which I have to do if I need to store many individual closures in that structure
15:28:32
flip214
If I could pass the lexixal scope via the single void*, then the vtable can stay a foreign struct and can contain just the lisp functions' addresses
15:29:59
g_o
but doesn't that mean that you know where the vtable is from the get go? what if you have aslr?
15:31:52
flip214
g_o: the vtable gets allocated with another foreign function, and then individual members get set to the actual functions
16:11:01
stassats
now that the freebsd port has continuous integration, i wonder what it would take for other bsds
16:11:17
stassats
probably doing something manually on some cloud service, but that'll probably cost money
16:13:01
stassats
all the other arches being tested would be great too, i guess i could write some automated scripts for the gcc compiler farm
17:12:08
karlosz
i was worried that the locall optimization would be limited in use but examples like (labels ((f (x y) ...) (g (z w) ...) (cond ((...) (f 5 6)) ((...) (f 2 9)) ((...) (g 193 3)) ((...) (g 5 91)))) have convinced me that its worthwhile to do it for general functions, not just ones that tail call themselves
17:14:59
karlosz
right, i haven't looked into how to optimize functions which have to be local themselves, only on how to eliminate them
17:21:47
stassats
but there probably not a lot of leaf global functions which also don't use any stack space
17:27:14
karlosz
the only problem is that leaf functions are less common on x86 because of less registers
17:31:53
stassats
a function that only tail calls basically becomes the same as the callee (and you don't see it in the backtrace)
17:33:35
karlosz
i would pick off the local case first because that messes less with global call conventions
17:34:09
karlosz
and local leafs should be easy to recognize in IR1 - the tools are in locall.lisp alreadty
17:35:34
karlosz
it's low priority in the local case anyway - would shave off a few bytes here and there
17:47:49
karlosz
even that's not so obvious. the full call could be much more expensive than the local call
17:50:15
karlosz
the point is that i think ir2 vops are pretty much as high level as you can get for any good policy heuristic
17:51:01
karlosz
but what if some other big local function mentions those closure vars in the parent fnuction
17:52:30
karlosz
anyway, it sounds harder to do right than just rewiring local calls which are called multiple times but only return in one place, since that always reduces code size
17:53:17
karlosz
maybe it would be useful to have those heuristics anyway, since they could apply to global functions
18:01:06
stassats
(flet ((f (x) x)) (f 1) (f 2)) is derived as (integer 1 2), while we know it to be (integer 2 2)
18:03:32
stassats
suppose we have a lot of time to waste, and inline each local function, use that inline expansion only to derive the type
19:23:00
pkhuong
we need to insert type derivation in constraint, and start with an aggressive assumption that local functions don't return
22:37:12
g_o
hey im working on the alien struct bug thing and wrote a function that should work, but got really stuck: i want to insert the call at alien-funcall on the target but there are several definitions, some are deftransform that are on the host part... can anyone help me understand how it decides where to go from define-alien-routine for example? sorry im a noob