Changeset 13532 in project for chicken


Ignore:
Timestamp:
03/06/09 07:16:55 (11 years ago)
Author:
Kon Lovett
Message:

Chgd block-word to wordblock & block-byte to byteblock. Fix for set-cdr names.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • chicken/trunk/chicken-primitive-object-inlines.scm

    r13525 r13532  
    303303;; Byte access
    304304
    305 (define-inline (%make-block-byte n f a?) (%block-allocate n #t f a?))
    306 
    307 (define-inline (%block-byte-ref x i) (##core#inline "C_subbyte" x i))
    308 (define-inline (%block-byte-set! x i n) (##core#inline "C_setsubbyte" x i n))
     305(define-inline (%make-byteblock n f a?) (%block-allocate n #t f a?))
     306
     307(define-inline (%byteblock-ref x i) (##core#inline "C_subbyte" x i))
     308(define-inline (%byteblock-set! x i n) (##core#inline "C_setsubbyte" x i n))
    309309
    310310
    311311;; Word access
    312312
    313 (define-inline (%make-block-word n f a?) (%block-allocate n #f f a?))
    314 
    315 (define-inline (%block-word-ref x i) (##core#inline "C_slot" x i))
    316 
    317 (define-inline (%block-word-set! x i y) (##core#inline "C_i_setslot" x i y))
    318 (define-inline (%block-word-set!/immediate x i y) (##core#inline "C_i_set_i_slot" x i y))
    319 
    320 (define-inline (%block-word-set!/maybe-immediate x i y)
     313(define-inline (%make-wordblock n f a?) (%block-allocate n #f f a?))
     314
     315(define-inline (%wordblock-ref x i) (##core#inline "C_slot" x i))
     316
     317(define-inline (%wordblock-set! x i y) (##core#inline "C_i_setslot" x i y))
     318(define-inline (%wordblock-set!/immediate x i y) (##core#inline "C_i_set_i_slot" x i y))
     319
     320(define-inline (%wordblock-set!/maybe-immediate x i y)
    321321  (if (%immediate? y)
    322       (%block-word-set!/immediate x i y)
    323       (%block-word-set! x i y) ) )
     322      (%wordblock-set!/immediate x i y)
     323      (%wordblock-set! x i y) ) )
    324324
    325325
     
    334334;; String (byteblock)
    335335
    336 (define-inline (%make-string size fill) (%make-block-byte size fill #f))
     336(define-inline (%make-string size fill) (%make-byteblock size fill #f))
    337337
    338338(define-inline (%string-ref s i) (##core#inline "C_subchar" s i))
     
    361361;; Vector (wordblock)
    362362
    363 (define-inline (%make-vector size fill) (%make-word-block size fill #f))
    364 
    365 (define-inline (%vector-ref v i) (%block-word-ref v i))
    366 
    367 (define-inline (%vector-set! v i x) (%block-word-set! v i x))
    368 (define-inline (%vector-set!/immediate v i x) (%block-word-set!/immediate v i x))
    369 (define-inline (%vector-set!/maybe-immediate v i x) (%block-word-set!/maybe-immediate v i x))
     363(define-inline (%make-vector size fill) (%make-wordblock size fill #f))
     364
     365(define-inline (%vector-ref v i) (%wordblock-ref v i))
     366
     367(define-inline (%vector-set! v i x) (%wordblock-set! v i x))
     368(define-inline (%vector-set!/immediate v i x) (%wordblock-set!/immediate v i x))
     369(define-inline (%vector-set!/maybe-immediate v i x) (%wordblock-set!/maybe-immediate v i x))
    370370
    371371(define-inline (%vector-length v) (%block-size v))
     
    379379    bv ) )
    380380
    381 (define-inline (%bytevector-ref bv i) (%block-byte-ref bv i))
    382 
    383 (define-inline (%bytevector-set! bv i x) (%block-byte-set! bv i x))
     381(define-inline (%bytevector-ref bv i) (%byteblock-ref bv i))
     382
     383(define-inline (%bytevector-set! bv i x) (%byteblock-set! bv i x))
    384384
    385385(define-inline (%bytevector-length bv) (%block-size bv))
     
    428428(define-inline (%length ls) (##core#inline "C_i_length" ls))
    429429
    430 (define-inline (%car pr) (%block-word-ref pr 0))
    431 (define-inline (%cdr pr) (%block-word-ref pr 1))
     430(define-inline (%car pr) (%wordblock-ref pr 0))
     431(define-inline (%cdr pr) (%wordblock-ref pr 1))
    432432
    433433(define-inline (%caar pr) (%car (%car pr)))
     
    445445(define-inline (%cdddr pr) (%cdr (%cddr pr)))
    446446
    447 (define-inline (%set-car! pr x) (%block-word-set! pr 0 x))
    448 (define-inline (%set-cdr! pr x) (%block-word-set! pr 1 x))
    449 (define-inline (%set-car/immediate! pr x) (%block-word-set!/immediate pr 0 x))
    450 (define-inline (%set-cdr/immediate! pr x) (%block-word-set!/immediate pr 1 x))
    451 (define-inline (%set-car!/maybe-immediate pr x) (%block-word-set!/maybe-immediate pr 0 x))
    452 (define-inline (%set-cdr!/maybe-immediate pr x) (%block-word-set!/maybe-immediate pr 1 x))
     447(define-inline (%set-car! pr x) (%wordblock-set! pr 0 x))
     448(define-inline (%set-cdr! pr x) (%wordblock-set! pr 1 x))
     449(define-inline (%set-car!/immediate pr x) (%wordblock-set!/immediate pr 0 x))
     450(define-inline (%set-cdr!/immediate pr x) (%wordblock-set!/immediate pr 1 x))
     451(define-inline (%set-car!/maybe-immediate pr x) (%wordblock-set!/maybe-immediate pr 0 x))
     452(define-inline (%set-cdr!/maybe-immediate pr x) (%wordblock-set!/maybe-immediate pr 1 x))
    453453
    454454;; These are safe
     
    545545(define-inline (%structure-instance? x s) (##core#inline "C_i_structurep" x s))
    546546
    547 (define-inline (%structure-ref r i) (%block-word-ref r i))
    548 
    549 (define-inline (%structure-set! r i x) (%block-word-set! r i x))
    550 (define-inline (%structure-set!/immediate r i x) (%block-word-set!/immediate r i x))
    551 (define-inline (%structure-set!/maybe-immediate r i x) (%block-word-set!/maybe-immediate r i x))
     547(define-inline (%structure-ref r i) (%wordblock-ref r i))
     548
     549(define-inline (%structure-set! r i x) (%wordblock-set! r i x))
     550(define-inline (%structure-set!/immediate r i x) (%wordblock-set!/immediate r i x))
     551(define-inline (%structure-set!/maybe-immediate r i x) (%wordblock-set!/maybe-immediate r i x))
    552552
    553553(define-inline (%structure-length r) (%block-size r))
    554554
    555 (define-inline (%structure-tag r) (%block-word-ref r 0))
     555(define-inline (%structure-tag r) (%wordblock-ref r 0))
    556556
    557557
     
    577577
    578578(define-inline (%port-filep port) (%peek-unsigned-integer port 0))
    579 (define-inline (%port-input-mode? port) (%block-word-ref? port 1))
    580 (define-inline (%port-class port) (%block-word-ref? port 2))
    581 (define-inline (%port-name port) (%block-word-ref? port 3))
    582 (define-inline (%port-row port) (%block-word-ref? port 4))
    583 (define-inline (%port-column port) (%block-word-ref? port 5))
    584 (define-inline (%port-eof? port) (%block-word-ref? port 6))
    585 (define-inline (%port-type port) (%block-word-ref? port 7))
    586 (define-inline (%port-closed? port) (%block-word-ref? port 8))
    587 (define-inline (%port-data port) (%block-word-ref? port 9))
     579(define-inline (%port-input-mode? port) (%wordblock-ref? port 1))
     580(define-inline (%port-class port) (%wordblock-ref? port 2))
     581(define-inline (%port-name port) (%wordblock-ref? port 3))
     582(define-inline (%port-row port) (%wordblock-ref? port 4))
     583(define-inline (%port-column port) (%wordblock-ref? port 5))
     584(define-inline (%port-eof? port) (%wordblock-ref? port 6))
     585(define-inline (%port-type port) (%wordblock-ref? port 7))
     586(define-inline (%port-closed? port) (%wordblock-ref? port 8))
     587(define-inline (%port-data port) (%wordblock-ref? port 9))
    588588
    589589(define-inline (%port-filep-set! port fp) (%poke-integer port 0 fp))
    590 (define-inline (%port-input-mode-set! port f) (%block-word-set!/immediate port 1 f))
    591 (define-inline (%port-class port v) (%block-word-set! port 2 v))
    592 (define-inline (%port-name-set! port s) (%block-word-set! port 3 s))
    593 (define-inline (%port-row-set! port n) (%block-word-set!/immediate port 4 n))
    594 (define-inline (%port-column-set! port n) (%block-word-set!/immediate port 5 n))
    595 (define-inline (%port-eof-set! port f) (%block-word-set!/immediate port 6 f))
    596 (define-inline (%port-type-set! port s) (%block-word-set! port 7 s))
    597 (define-inline (%port-closed-set! port f) (%block-word-set!/immediate port 8 f))
    598 (define-inline (%port-data-set! port port) (%block-word-set! port 9 x))
     590(define-inline (%port-input-mode-set! port f) (%wordblock-set!/immediate port 1 f))
     591(define-inline (%port-class port v) (%wordblock-set! port 2 v))
     592(define-inline (%port-name-set! port s) (%wordblock-set! port 3 s))
     593(define-inline (%port-row-set! port n) (%wordblock-set!/immediate port 4 n))
     594(define-inline (%port-column-set! port n) (%wordblock-set!/immediate port 5 n))
     595(define-inline (%port-eof-set! port f) (%wordblock-set!/immediate port 6 f))
     596(define-inline (%port-type-set! port s) (%wordblock-set! port 7 s))
     597(define-inline (%port-closed-set! port f) (%wordblock-set!/immediate port 8 f))
     598(define-inline (%port-data-set! port port) (%wordblock-set! port 9 x))
    599599
    600600; Port-class layout
     
    622622;; Symbol (wordblock)
    623623
    624 (define-inline (%symbol-binding s) (%block-word-ref s 0))
    625 (define-inline (%symbol-string s) (%block-word-ref s 1))
    626 (define-inline (%symbol-bucket s) (%block-word-ref s 2))
     624(define-inline (%symbol-binding s) (%wordblock-ref s 0))
     625(define-inline (%symbol-string s) (%wordblock-ref s 1))
     626(define-inline (%symbol-bucket s) (%wordblock-ref s 2))
    627627
    628628(define-inline (%string->symbol-interned s) ((##core#primitive "C_string_to_symbol") s))
     
    639639(define-inline (%keyword? x)
    640640  (and (%symbol? x)
    641        (%eq? 0 (%block-byte-ref (%symbol-string x) 0)) ) )
     641       (%eq? 0 (%byteblock-ref (%symbol-string x) 0)) ) )
    642642
    643643
     
    665665
    666666;%locative-address - see Pointer
    667 (define-inline (%locative-offset lv) (%block-word-ref lv 1))
    668 (define-inline (%locative-type lv) (%block-word-ref lv 2))
    669 (define-inline (%locative-weak? lv) (not (%block-word-ref lv 3)))
    670 (define-inline (%locative-object lv) (%block-word-ref lv 3))
     667(define-inline (%locative-offset lv) (%wordblock-ref lv 1))
     668(define-inline (%locative-type lv) (%wordblock-ref lv 2))
     669(define-inline (%locative-weak? lv) (not (%wordblock-ref lv 3)))
     670(define-inline (%locative-object lv) (%wordblock-ref lv 3))
    671671
    672672
     
    681681; These operate on pointer-like objects
    682682
    683 (define-inline (%pointer-ref ptr) (%block-word-ref ptr 0))
    684 (define-inline (%pointer-set! ptr y) (%block-word-set! ptr 0 y))
     683(define-inline (%pointer-ref ptr) (%wordblock-ref ptr 0))
     684(define-inline (%pointer-set! ptr y) (%wordblock-set! ptr 0 y))
    685685
    686686(define-inline (%peek-byte ptr i) (##core#inline "C_peek_byte" ptr i))
Note: See TracChangeset for help on using the changeset viewer.