freenode/#sicl - IRC Chatlog
Search
10:22:59
shka_
beach: no need to, it is my issue now, i also know how to profile SBCL programs so i should manage to do it on my own
10:40:27
no-defun-allowed
I'd presume a heap size of around 2gb would be where the gc time stops decreasing, as after a second look at TIME 20 entire seconds of 100 are in GC. (I started SBCL lazily in a terminal since I was working on something in Emacs that time.)
10:42:11
beach
Here is an interesting experiment for those who want to get more involved at this point:
10:42:23
beach
2. Do (funcall (fd 'sicl-clos:generic-function-name ee4) (fd 'sicl-clos:generic-function-name ee4)). It will fail because the generic function can not operate on itself.
10:42:31
beach
3. Do (funcall (fd 'sicl-clos:generic-function-name ee4) (fd 'sicl-clos:generic-function-name ee5)), it will return the name of the generic function named GENERIC-FUNCTION-NAME in E5, which it was designed to do.
10:42:36
beach
4. Now again do (funcall (fd 'sicl-clos:generic-function-name ee4) (fd 'sicl-clos:generic-function-name ee4)). This time it will work on itself. :)
11:26:01
_heisig
beach: Thank you, this figure is extremely useful. (minor remark, you labeled the dashed arrow with "operantes on")
11:34:24
beach
So to "tie the knot" I want to keep the red stuff, but class slot should point to red stuff as well.
11:36:08
_heisig
What makes the blue stuff not "viable"? I thought it is almost the same as the red stuff?
11:36:12
beach
Many red generic functions have their call caches filled. I need to fill the remaining ones. The small exercise above illustrates what needs to be done. All red classes are finalized.
11:36:38
beach
Blue generic functions have never been used for anything, so their call caches are empty.
11:37:10
beach
Plus, in E4, there are tons more generic functions like SHARED-INITIALIZE, INITIALIZE-INSTANCE, etc. There are no blue versions of those.
11:38:59
_heisig
Ok, so the blue classes and methods are essentially sentinels whose purpose is to simplify the previous stages.
11:39:33
beach
You can say that, yes. They exist in order to exercise the red stuff sufficiently that it is viable.
13:47:17
jcowan
"As he ordered a hypo of bicyclidine and a bottle of electrolyte solution and sat down in the big rocking chair with her, he took a second to glance up at the portrait."
13:58:07
beach
Either use satiation, or make sure that all the critical functions have been called on all the relevant argument types so that the call history is filled.
14:04:27
beach
Good idea. Though the entire specification is online. Not the rest of the book though.
15:12:30
scymtym
i managed to specialize my s-expression syntax library on concrete syntax trees with fake symbols. this does not intern at all: https://techfak.de/~jmoringe/s-expressino-syntax.ogv
15:18:57
scymtym
beach: it more a collection of parts for compilers, editors, etc, but i guess you could still say that
15:58:29
beach
OK, suppose I wanted to "tie the knot". I would have to look at the structure of the red objects (ersatz objects that are instances of bridge classes and fix them up so that, instead of being instances of bridge classes, I alter the CLASS slot of the header to refer to the equivalent red ersatz class. But that's not all there is to it.
15:59:10
beach
The second index of every rack contains a list of effective-slot metaobjects of the class (as it was when the instance was created).
16:01:45
beach
The METHOD-CLASS slot of a red generic function is a bridge class, so it has to be replaced.
16:05:22
beach
Of course, finding all red objects is non-trivial. Every class has a list of direct slot definitions and a list of effective slot definitions. Those are reachable only from the class.
16:06:13
beach
Similarly, every generic function has a list of methods that must be traversed so that the method metaobjects are updated.
16:11:10
_heisig
Could one just add an auxiliary method to MAKE-INSTANCE or ALLOCATE-INSTANCE to create the list of all red objects?
16:14:15
beach
It would have to be ALLOCATE-INSTANCE I think, because class prototypes are not allocated with make-instance.
16:15:47
beach
Anyway, I am very pleased that I am finally able to think in those terms. Getting those four phases to work has been a long journey.
16:36:13
beach
Wow, this is great! I can modify some core MOP generic function, re-run the boot procedure, and verify that I didn't break anything. And it only takes a few minutes.
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