freenode/#lisp - IRC Chatlog
Search
17:46:16
phoe
link them to https://pvk.ca/Blog/2014/03/15/sbcl-the-ultimate-assembly-code-breadboard/
17:46:30
Bike
i mean, you're right, lisp does not let you specify memory layouts even to the limited extent C does.
17:47:28
phoe
when it comes to allocating memory then you can go full FFI way and allocate and access it yourself
17:49:21
galex-713
Bike: I know someone else who defined a language that allows to *specify* that kind of low-level memory nitpicking in a turing complete way, his language/software is called Poke
19:31:37
aeth
galex-713: I mention a few of the differences between Common Lisp and Scheme here: https://gitlab.com/mbabich/airship-scheme/-/blob/master/CONTRIBUTING.md
19:33:17
aeth
I leave out some of them (like Common Lisp macros preferring TAGBODY and Scheme macros prefering tail recursion... also Schemers prefering hygienic macros... well, maybe I should add something for that) that are irrelevant for the project of implementing Scheme in Common Lisp.
19:34:37
aeth
I put it all in CONTRIBUTING.md because it's quite possibly the only project where knowing the differences between Scheme and Common Lisp is relevant and almost a prerequisite for contributing. :-)
19:46:47
pve
Hi, I wonder if someone could shed some light on how conses are (generally) represented in memory. I'm looking at the output from (room) on SBCL, and dividing the number of bytes (used by conses) with the number of cons objects gives me 16 bytes.
19:47:51
pve
so does that mean a cons in this case is simply 8 bytes for the car and 8 bytes for the cdr?
19:52:05
White_Flame
if you disassemble CONSP checks, it hcecks to see that the pointer's low 4 bits has the value 7
19:52:46
White_Flame
I believe the allocation granularity is 16 bytes (two 64-bit words), so the bottom 4 bits can be used for tagging
19:53:28
White_Flame
so if you know it's a cons pointer, the car is at [ptr-7] and cdr is at [ptr+1], since the pointer already contains an offset of 7 for the tag
19:56:35
pve
White_Flame: thank you, so would a fixnum sit directly in the car? (i'm not super familiar with this stuff)
19:57:05
White_Flame
yes, fixnums have a low 4 bits of xxx0, and all other types use xxx1. So the fixnums can use 63 bits of the 64-bit word
19:57:32
White_Flame
and are shifted left 1 bit, so plain adds/subtracts/etc can work directly without masking off a tag
19:59:17
White_Flame
fixnums, characters, and single-floats all reside literally in a word without indirecting
19:59:44
White_Flame
double-floats have to be boxed, as they require the full 64 bits of a word, and obviously multi-word elements are always pointed to as well
20:01:24
pve
ok great, this brings me to my second question: when I do (defclass kons (car cdr)) and allocate a long chain of them with fixnums (< 100000) in the car, i get something very close to 48 bytes per kons instance
20:01:57
White_Flame
well, the allocation reporting is probably rounding up to whatever block size it uses
20:02:29
White_Flame
but for an object instance, that'd be 6 words per, which probably isn't that bad?
20:02:50
White_Flame
obviously 2 words for the data, but 4 words of overhead does smell a little high. I think structs only have 1 word of overhead
20:03:29
Bike
a standard object is probably going to indirect its slots in a vector, plus there's a link back to the class somehow, and possibly more header
20:04:25
White_Flame
pve: I do default to structs, and only move to defclass if I really need it, to keep things lightweight
20:05:30
Bike
so four words of overhead could be the object header, pointer to the class, pointer to the slots vector, vector header
20:32:41
aeth
galex-713: If you *really* want to hate the modern web and Gitlab in particular, try using Gitlab's snippits (pastebin-esque) system. I used it for > 1.5 years after lisp paste shut down, but it's now entirely unusable for about 4 months because the dumb text input is gone
20:33:09
aeth
Now, it has a "smart" editor that reindents anything that you paste into it, and has no knowledge of Lisp, thus ruining any code you paste into it.
20:36:26
aeth
I think I'll just make a git repository next time I need pastebin-like functionality, and maybe I'd link to the /raw/ which doesn't appear to require JS
22:19:57
dim
if you're after a self-hosted web git thingy I've been told nice things about https://gitea.io/en-us/
22:42:00
z3t0
how is lisp land these days! I've been out of touch for a few weeks playing with freebsd
22:45:06
dra
z3t0: I doubt you have missed much. A new book was announced: https://www.apress.com/gp/book/9781484261330
23:32:04
sm2n
aeth, sourcehut is quite nice because it avoids modern web practices like the plague but this is offtopic
0:15:40
_death
I took a first step towards that not long ago.. porting the pertinent bits from gogs and creating a hunchentoot dispatcher to support git-clone
0:17:01
_death
but gogs seems to work ok with javascript off, so I'm not pressed to take further steps
3:56:56
contrapunctus
(Oh god. I can't believe it took me this long to realize the Strandh/beach pun 🤦)
4:16:03
contrapunctus
beach: been designing a markup language - https://github.com/contrapunctus-1/TheatreScript ...thinking of making a fork of 3bmd to parse it. (Or maybe it can be extended instead of forking...)