Search
Tuesday, 15th of May 2018, 13:34:01 UTC
16:18:16
Bike
signal handlers can be per thread, so that's nice, except since mps uses sigsegv we can't just control the handler ourselves, probably
16:19:51
Bike
trying to understand what sbcl does,but simple itis not
16:26:08
Bike
sbcl also makes it seem like posix systems are kind of all over the place with important details, so that's pretty unfortunate
16:26:24
Bike
but i'd reeeeeally like it if sigsegv didn't core dump
16:50:32
Bike
feel free to use a more ridiculous internet codename
20:36:16
karlosz
eesh, clisp doesn't expose anything about types at all on the bytecode level
20:36:25
karlosz
no instructions for checking types etc...
20:36:40
karlosz
i think typep is just implemented at the c level
20:36:54
karlosz
that will make it harder to do type inference
20:38:44
Bike
calling functions to do type checks is fine
20:39:04
karlosz
yeah ill have to make typeq just punt
20:39:28
karlosz
i can still elide typechecks
20:39:54
karlosz
whats the best way to inline function calls?
20:40:08
karlosz
right not HIR just compiles everything to fdefinition + funcall
20:40:29
karlosz
but if the function is known, like #'+ or otherwise
20:40:59
karlosz
wouild i have to resort to adding new instruction types on the MIR level to take advantage of specializing?
20:41:37
Bike
typeq also won't be generated by the compiler
20:41:42
Bike
you could just not implement it
20:42:20
Bike
for cleavir to inline functions you have to let it know about ASTs
20:42:29
Bike
the function-info objects can have an AST in them.
20:43:07
karlosz
i don't exactly mean inline functions
20:43:15
Bike
we have a lessthan operation defined on filesystem paths
20:43:38
karlosz
as in system provided functions don't need to go through fdefinition and computed funcall
20:44:15
karlosz
ie. clisp compiles (lambda (x) (funcall (fdefinition '1+) x)) the same as cleavir compiles (llambda (x) (1+ x)) right now
20:44:44
karlosz
whereas (lambda (x) (1+ x)) in clisp compiles to a shorter instruction sequence since 1+ is in a specialized 'funtab'
20:45:15
Bike
the funtab being written in what, the vm language?
20:46:10
karlosz
no, i think the functions in funtab are foregin functions implemented in c
20:46:22
karlosz
for example, dissassemble on '1+ drops into gdb in clisp
20:46:51
karlosz
the bytecode instruction is ex. (CALLS2 177) ; 1+
20:47:02
karlosz
corresponding to calling (1+ x)
20:47:42
karlosz
whereas what cleavir generates now is calling fdefinition on '1+
20:47:44
karlosz
pushing it on the stack
20:47:50
karlosz
then pushing all the args on the stack
20:47:53
karlosz
and then calling (FUNCALL)
20:48:04
karlosz
(this is the clisp instruction set)
20:48:50
Bike
you could add a hir instruction for "system call" or the like
20:48:59
Bike
clasp does that too, for C++ calls
20:49:09
Bike
add an ast as well, have 1+ expand into it
20:49:11
karlosz
okay, then that is the right approach
20:50:18
karlosz
does clasp just lookup C++ functions in a table to determine whether to produce the C++ all ast node?
20:51:06
Bike
I don't understand what you mean.
20:51:30
karlosz
how does clasp determine a priori whtehrt o compile a function to a c++ ast node
20:52:00
Bike
it's part of the information about the function.
20:52:15
Bike
Like, the function-info for 1+ or whatever has an AST, and that AST is the foreign call thing.
20:53:03
karlosz
okay, that makes sense.
20:54:31
Bike
So I guess you'd write a definition like (declaim (inline 1+)) (defun 1+ (n) (system-call 177 n))
20:54:40
Bike
and then define a thing so system-call is a special operator.
20:56:22
karlosz
clisp already has a function that queries whether a function is 'system'. so i could just ask the function and convert the appropriate ast node during cst to ast conversion, right?
20:57:54
karlosz
i.e. convert function calls differently to ast depending on whether they are system or not during cst->ast
20:59:30
Bike
Yes, in that case you'd do it as part of your method on function-info I would say
21:00:45
karlosz
and why doesn't typeq get generated?
21:00:58
karlosz
arent those nodes needed for type inference?
21:01:13
karlosz
im a little confused why HIR doesn't convert to half the instructions documented
21:01:39
Bike
well, what would generate typeq?
21:01:43
karlosz
are those introudced by later transformation?
21:02:00
Bike
right, but typep is a function.
21:02:11
Bike
if you want it to generate typeq you'll need to provide a definition for typep that uses typeq.
21:02:35
karlosz
definition in what senese?
21:02:52
karlosz
same with eq-instruction
21:03:07
Bike
probably an inline definition
21:03:10
karlosz
(if (eq x y) x y) converts to a function call to eq
21:03:13
karlosz
and then produces eq instruction
21:03:28
Bike
clasp has (defun eq (x y) (if (cleavir-primop:eq x y) t nil))
21:04:03
Bike
so the ast doesn't have a function call, just the eq ast, which is converted into the eq instruction.
21:04:11
Bike
cleavir is pretty heavily designed around inlining.
21:04:55
karlosz
then i would need to redefine clisp's CL functions
21:05:01
karlosz
and declaim them inline
21:05:10
karlosz
at least for things like eq and typep
21:05:22
karlosz
if i want to take advantage of those primops
21:05:57
Bike
or just have function-info return an appropriate ast.
21:06:14
karlosz
great, thanks for your help
23:21:50
Kevslinger
Google cloud now has a machine you can rent out with 160 virtual CPUs and 3.75 TB of RAM.
23:21:57
Kevslinger
We can build clasp in no time with that!
0:22:04
drmeister
Just saw Avengers: Infinity war - has everyone seen it?
0:22:33
drmeister
All my arguments about how pointless it is are back on the table.
0:26:21
stassats`
so, you prefer Arrow?
0:27:26
stassats`
some superhero tv show
0:27:55
Bike
wasn't that the one with Snart
0:27:56
drmeister
Ah - no - I'm more of a Tick fan.
0:28:07
Bike
who wears sunglasses at night
0:30:33
karlosz
still not quite sure what i should be subclassing. in function-info, if i make an instance of global-function-info with :inline set, should i return an subclass of fdefinition-ast, maybe system-fdefinition?
0:30:47
karlosz
i was looking through clasp but i couldn't find how core:cleavir-ast is defined
0:31:29
Bike
just return an fdefinition-ast. why would you need a subclass?
0:32:29
karlosz
well, i don't want to start redefining things like eq and 1+ and declaring them inline in order to get specialized system call HIR nodes
0:32:47
karlosz
it would destroy the image
0:33:01
Bike
you don't have to redefine them, just have function-info return an fdefinition-ast without actually redefining the class
0:33:08
Bike
redefining the function*
0:35:37
karlosz
then how are system functions distinguished from normal functions? or are you saying that theres no need to distinguish them at the AST level?
0:36:00
karlosz
should i only check and treat them differently at AST->HIR?
0:36:24
Bike
okay maybe i didn't make my strategy clear.
0:36:48
Bike
also i messed up, the inline ast isn't an fdefinition ast
0:36:53
Bike
it's a function-ast, which has a body
0:37:12
Bike
what i'm saying is for 1+, you return a function-ast with a body consisting of your custom syscall-ast or whatever you want to call it
0:37:21
Bike
cleavir will then use the syscall-ast as the call
1:24:22
drmeister
I've got compile working.
1:25:18
Bike
so did we need that debug stuff?
1:25:48
drmeister
I tried to get rid of it - I'll keep trying.
Wednesday, 16th of May 2018, 1:34:01 UTC