freenode/#sicl - IRC Chatlog
Search
17:40:02
beach
Here is a fun thing: Since the bootstrapping is totally consistent between the phases, a class is always assigned the same class number, depending only on the order between the loading of the classes. Now, for generic dispatch, I want to compute the `stamp' of an instance. Well, in the native system, immediate values and CONS cells have permanent stamp values, whereas general instances have their stamp values as the first element of
17:41:35
beach
(defun stemp (object) (cond ((fixnump object) #.(class-number (find-class 'fixnum))) ((characterp object) #.(....) (t (standard-instance-access object 0)))))
17:42:05
beach
Then fixnump, characterp, consp get inlined to check the tag bits, so that's very fast.
17:43:48
beach
During bootstrapping, I can define stamp differently because execution time is not important. But I will still check for those special cases, and more, because I need to assign stamps to host objects too.
17:44:51
beach
The important thing here is that the generic dispatch function will just call STAMP for every required argument. And it will do that during bootstrapping and in the native system alike.
17:49:22
copec
I understand the overall concepts but would like to get a feel for how everything ties together similar to understanding what is going on with the reader and the repl
17:51:07
beach
copec: When the compiler sees (setf (hello ...) new) and there is no setf-expansion for HELLO, it generates something like (funcall (setf hello) new ...).
17:52:13
beach
copec: If you go to the root directory and you do a git grep setf-expansion you will find some examples of that use.
17:53:48
Bike
https://github.com/robert-strandh/SICL/blob/master/Code/Compiler/Extrinsic-environment/define-default-setf-expander.lisp is the default expansion function to set that up
18:04:21
Bike
https://github.com/robert-strandh/SICL/blob/master/Code/Data-and-control-flow/setf.lisp here is the definition of setf.
18:05:27
Bike
hm, that little optimization should probably be moved to the definition of multiple-value-bind
18:08:27
copec
https://github.com/robert-strandh/SICL/blob/master/Code/Data-and-control-flow/defun-defmacro.lisp defun-expander parses it it looks like
18:11:18
jcowan
Something should be done to optimize /= in simple cases. The CL definition is perverse.
18:11:18
Bike
https://github.com/robert-strandh/SICL/blob/master/Code/Data-and-control-flow/defun-support.lisp the definition of defun-expander.
18:19:40
copec
Moving that little optimization would still have it check ,(if (= 1 (length store-variables)) during runtime though, right?
18:19:58
copec
It seems the definitions could be updated during runtime, so it would always have to check that
18:20:34
pfdietz
Issue of /= optimization has been raised for SBCL. https://bugs.launchpad.net/sbcl/+bug/1745196
18:21:42
copec
Does the standard say/imply if setf definitions are changed than code that depends on them needs to be re-expanded?
18:23:37
pfdietz
You want your build system set up so there are dependencies from macro defns to the files that use them, so changing the former causes the latter to be recompiled.
18:32:47
copec
pfdietz in reply to #5 in https://bugs.launchpad.net/sbcl/+bug/1745196 "That's what she said"
21:46:33
jcowan
The simplest approach is just to sort the numbers and then in a single pass determine that every pair of adjacent numbers is distinct. Granted, this takes more space than the trivial quadratic algorithm.
21:47:35
Shinmera
I would be willing to bet that the number of uses of /= with a number of arguments where the O matters is zero