-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Drew McDermott <[EMAIL PROTECTED]> writes:
> Some implementations store type information in the low-order bits, so > you don't have to follow the pointer to find out if, say, its a cons > cell. Of course, that means to follow the pointer you have to zero > the type bits out. I don't know what CMUCL does, but it's probably > documented somewhere. I think it's a fair bet that Raymond Toy does know, however, as he's one of the CMUCL developers ;-) FYI, currently CMUCL has 8 byte alignment allowing three tag bits 000 even-fixnum 001 function-pointer 010 other-immediate-0 011 list-pointer 100 odd-fixnum 101 instance-pointer 110 other-immediate-1 111 other-pointer (list taken from src/compiler/generic/objdef.lisp) Note that fixnums get the zero tags, so that arithmetic operations on them are cheap. Most pointer dereferences involve a fixed offset already (e.g. retrieving the cdr slot of a cons, or almost any slot in a symbol ..) so it's easy enough to subtract the tag bits from the pointer before adding on the slot offset. For example, here's partial disassemble of #'symbol-plist (from SBCL, but it's basically the same) ; 5E: L0: MOV EAX, ESI ; 60: MOV EDX, [EAX+5] plist is the third slot in symbol, so can be found at offset 3*4=12, The argument passed in is an other-pointer, so already 'points' 7 past the start of the object. 12-7=5, hence the code generated (I hope I'm not suffering from off-by-one errors in the above explanation. I seem to have made them cancel out if so. It doesn't invalidate the general priniciple even if I have, though) - -dan - -- http://www.cliki.net/ - Link farm for free CL-on-Unix resources -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQE+5NaNHDK5ZnWQiRMRAmAwAJ9msnaiDqwYk5fgMyhBWKY7STtkswCgqVv9 HqSIwX80CBJN9Uiio2rCZWY= =YB+b -----END PGP SIGNATURE-----
