Module: dood Synopsis: The Dylan object-oriented database Author: Jonathan Bachrach Copyright: Original Code is Copyright (c) 1995-2004 Functional Objects, Inc. All rights reserved. License: Functional Objects Library Public License Version 1.0 Dual-license: GNU Lesser General Public License Warranty: Distributed WITHOUT WARRANTY OF ANY KIND /* define sealed class () end class; define sealed domain make (singleton()); define sealed domain initialize (); // COPIED HERE FROM MACHINE-WORD-LOWLEVEL define inline-only function machine-word-as-hash-index (x :: ) => (hi :: ) interpret-machine-word-as-integer(force-integer-tag(x)) end function; define function dood-pointer-id-hash (object :: , hash-state :: ) => (hi :: , hash-state :: ) primitive-mps-ld-add(hash-state, object); values(machine-word-as-hash-index(address-of(object)), hash-state) end function; define function dood-pointer-id? (x, y) => (res :: ) primitive-id?(x, y) end function; define sealed method table-protocol (table :: ) => (test :: , hash :: ) values(dood-pointer-id?, dood-pointer-id-hash) end method; define constant = ; */ define constant = ; define constant = ; define inline-only function dood-word-shift-right (x :: , y :: ) => (z :: ) machine-word-shift-right(x, y) end function; define inline-only function dood-word-shift-left (x :: , y :: ) => (z :: ) machine-word-shift-left-with-overflow(x, y) end function; define inline-only function dood-word-logior (x :: , y :: ) => (z :: ) machine-word-logior(x, y) end function; define inline-only function dood-word-logand (x :: , y :: ) => (z :: ) machine-word-logand(x, y) end function; define constant dood-instance-slot-descriptors = instance-slot-descriptors; define method dood-repeated-slot? (dood :: , class :: ) repeated-slot-descriptor(class) end method; define method dood-repeated-byte-slot? (dood :: , class :: ) let sd = repeated-slot-descriptor(class); sd & slot-type(sd) == end method; /* define method dood-reinitialize (dood :: , object :: ) => () next-method(); rehash-table(object); end method; */ define inline function dood-standard-object (dood :: , object) object end function; /// DOUBLE-INTEGER define method read-object-using-class-at (dood :: , class == , address ::
) => (res :: ) let low = dood-read-machine-word-at(dood, address + 1); let high = dood-read-machine-word-at(dood, address + 2); make(, low: low, high: high); end method; define method walk-slots (dood :: , info :: , object :: ) => () walk-slot(dood, info, object, ); if (walk-info-commit?(info)) dood-write-machine-word(dood, %double-integer-low(object)); dood-write-machine-word(dood, %double-integer-high(object)); end if; end method; define inline method dood-compute-instance-size (dood :: , object == ) => (address ::
) dood-compute-instance-size(dood, ) + dood-compute-instance-size(dood, ) end method; /// BIG-SMALL-INTEGER define class () constant slot big-value :: , required-init-keyword: value:; end class; define method read-object-using-class-at (dood :: , class == , address ::
) => (res :: ) as(, dood-read-machine-word-at(dood, address + 1)); end method; define method dood-compute-instance-size (dood :: , object == ) => (address ::
) dood-compute-instance-size(dood, ) end method; define method walk-slots (dood :: , info :: , object :: ) => () walk-slot(dood, info, object, ); if (walk-info-commit?(info)) dood-write-machine-word(dood, big-value(object)); end if; end method; /// SYMBOL define inline function dood-symbol-class (object :: ) end; /// INTEGER define inline function small-integer? (object) => (res :: ) let object :: = object; object <= $max-dood-integer & object >= $min-dood-integer end function; // define constant $indirect-kind = 0; // define constant $integer-kind = 1; // define constant $byte-character-kind = 2; // // define inline function object-kind (object) => (res :: ) // raw-as-integer // (primitive-machine-word-logand // (primitive-cast-pointer-as-raw(object), integer-as-raw(3))) // end function; define method dood-disk-object (dood :: , object :: ) => (disk-object) make(, value: as(, object)) end method; define inline function dood-integer-disk-pointer+object (dood :: , object :: ) => (pointer :: , disk-object) dood-format("MAKING INTEGER %=\n", object); if (object > $max-dood-integer | object < $min-dood-integer) dood-disk-pointer+object(dood, dood-disk-object(dood, object)) else values(tag-as-integer(object), object) end if end function; define inline function dood-character-disk-pointer+object (dood :: , object :: ) => (pointer :: , disk-object) dood-format("WRITING BYTE-CHARACTER %=\n", object); values(tag-as-byte-character(as(, object)), object) end function; define inline function address-as-integer (x :: ) => (res :: ) x end function; // eof