3 (define-assembly-routine
6 (:translate allocate-vector)
7 (:arg-types positive-fixnum
10 ((:arg type any-reg a0-offset)
11 (:arg length any-reg a1-offset)
12 (:arg words any-reg a2-offset)
13 (:res result descriptor-reg a0-offset)
15 (:temp ndescr non-descriptor-reg nl0-offset)
16 (:temp vector descriptor-reg a3-offset))
18 (move alloc-tn vector)
19 (inst dep other-pointer-lowtag 31 3 vector)
20 (inst addi (* (1+ vector-data-offset) n-word-bytes) words ndescr)
21 (inst dep 0 31 3 ndescr)
22 (inst add ndescr alloc-tn alloc-tn)
23 (inst srl type word-shift ndescr)
24 (storew ndescr vector 0 other-pointer-lowtag)
25 (storew length vector vector-length-slot other-pointer-lowtag))
32 ;;; FIXME: This looks kludgy bad and wrong.
34 (defparameter *sxhash-simple-substring-entry* (gen-label))
36 (define-assembly-routine
38 (:translate %sxhash-simple-string)
40 (:result-types positive-fixnum))
41 ((:arg string descriptor-reg a0-offset)
42 (:res result any-reg a0-offset)
44 (:temp length any-reg a1-offset)
45 (:temp accum non-descriptor-reg nl0-offset)
46 (:temp data non-descriptor-reg nl1-offset)
47 (:temp offset non-descriptor-reg nl2-offset))
49 (declare (ignore result accum data offset))
51 ;; Save the return address.
52 (inst b *sxhash-simple-substring-entry*)
53 (loadw length string vector-length-slot other-pointer-lowtag))
55 (define-assembly-routine
56 (sxhash-simple-substring
57 (:translate %sxhash-simple-substring)
59 (:arg-types * positive-fixnum)
60 (:result-types positive-fixnum))
62 ((:arg string descriptor-reg a0-offset)
63 (:arg length any-reg a1-offset)
64 (:res result any-reg a0-offset)
66 (:temp accum non-descriptor-reg nl0-offset)
67 (:temp data non-descriptor-reg nl1-offset)
68 (:temp offset non-descriptor-reg nl2-offset))
70 (emit-label *sxhash-simple-substring-entry*)
72 (inst li (- (* vector-data-offset n-word-bytes) other-pointer-lowtag) offset)
77 (inst xor accum data accum)
78 (inst shd accum accum 5 accum)
81 (inst ldwx offset string data)
82 (inst addib :>= (fixnumize -4) length loop)
83 (inst addi (fixnumize 1) offset offset)
85 (inst addi (fixnumize 4) length length)
86 (inst comb := zero-tn length done :nullify t)
87 (inst sub zero-tn length length)
88 (inst sll length 1 length)
89 (inst mtctl length :sar)
90 (inst shd zero-tn data :variable data)
91 (inst xor accum data accum)
95 (inst sll accum 5 result)
96 (inst srl result 3 result))