source: release/1.9/source/level-0/ARM/arm-hash.lisp @ 15779

Last change on this file since 15779 was 15779, checked in by gb, 6 years ago

propagate r15775 to 1.9

File size: 3.3 KB
Line 
1;;; -*- Mode: Lisp; Package: CCL -*-
2;;;
3;;;   Copyright (C) 2010 Clozure Associates
4;;;   This file is part of Clozure CL. 
5;;;
6;;;   Clozure CL is licensed under the terms of the Lisp Lesser GNU Public
7;;;   License , known as the LLGPL and distributed with Clozure CL as the
8;;;   file "LICENSE".  The LLGPL consists of a preamble and the LGPL,
9;;;   which is distributed with Clozure CL as the file "LGPL".  Where these
10;;;   conflict, the preamble takes precedence. 
11;;;
12;;;   Clozure CL is referenced in the preamble as the "LIBRARY."
13;;;
14;;;   The LLGPL is also available online at
15;;;   http://opensource.franz.com/preamble.html
16
17;;; level-0;ARM;arm-hash.lisp
18
19
20(in-package "CCL")
21
22(eval-when (:compile-toplevel :execute)
23  (require "HASHENV" "ccl:xdump;hashenv"))
24
25
26
27
28;;; This should stay in LAP so that it's fast
29;;; Equivalent to cl:mod when both args are positive fixnums
30(defarmlapfunction fast-mod ((number arg_y) (divisor arg_z))
31  (build-lisp-frame imm0)
32  (mov imm0 (:lsr number (:$ arm::fixnumshift)))
33  (mov imm1 (:lsr divisor (:$ arm::fixnumshift)))
34  (sploadlr .SPudiv32)
35  (blx lr)
36  (box-fixnum arg_z imm1)
37  (return-lisp-frame imm0))
38
39
40(defarmlapfunction fast-mod-3 ((number arg_x) (divisor arg_y) (recip arg_z))
41  (mov imm0 (:lsr number (:$ arm::fixnumshift)))
42  (smull imm2 imm1 imm0 recip)
43  (mul imm0 imm1 divisor)
44  (sub number number imm0)
45  (sub number number divisor)
46  (mov imm0 (:asr number (:$ (1- arm::nbits-in-word))))
47  (and divisor divisor imm0)
48  (add arg_z number divisor)
49  (bx lr))
50
51(defarmlapfunction %dfloat-hash ((key arg_z))
52  (ldr imm0 (:@ key (:$ arm::double-float.value)))
53  (ldr imm1 (:@ key (:$ arm::double-float.val-low)))
54  (add imm0 imm0 imm1)
55  (box-fixnum arg_z imm0)
56  (bx lr))
57
58
59
60(defarmlapfunction %sfloat-hash ((key arg_z))
61  (ldr imm0 (:@ key (:$ arm::single-float.value)))
62  (box-fixnum arg_z imm0)
63  (bx lr))
64
65
66
67(defarmlapfunction %macptr-hash ((key arg_z))
68  (ldr imm0 (:@ key (:$ arm::macptr.address)))
69  (add imm0 imm0 (:lsr imm0 (:$ 24)))
70  (bic arg_z imm0 (:$ arm::fixnummask))
71  (bx lr))
72
73(defarmlapfunction %bignum-hash ((key arg_z))
74  (let ((header imm1)
75        (offset imm2)
76        (ndigits temp1)
77        (immhash imm0))
78    (mov immhash (:$ 0))
79    (mov offset (:$ arm::misc-data-offset))
80    (getvheader header key)
81    (header-length ndigits header)
82    (let ((next header))
83      @loop
84      (subs ndigits ndigits '1)
85      (ldr next (:@ key offset))
86      (add offset offset (:$ 4))
87      (add immhash next (:ror immhash (:$ 19)))
88      (bne @loop))
89    (bic arg_z immhash (:$ arm::fixnummask))
90    (bx lr)))
91
92
93
94
95(defarmlapfunction %get-fwdnum ()
96  (ref-global arg_z arm::fwdnum)
97  (bx lr))
98
99
100(defarmlapfunction %get-gc-count ()
101  (ref-global arg_z arm::gc-count)
102  (bx lr))
103
104
105;;; Setting a key in a hash-table vector needs to
106;;; ensure that the vector header gets memoized as well
107(defarmlapfunction %set-hash-table-vector-key ((vector arg_x) (index arg_y) (value arg_z))
108  (spjump .SPset-hash-key))
109
110(defarmlapfunction %set-hash-table-vector-key-conditional ((offset 0) (vector arg_x) (old arg_y) (new arg_z))
111  (spjump .SPset-hash-key-conditional))
112
113;;; Strip the tag bits to turn x into a fixnum
114(defarmlapfunction strip-tag-to-fixnum ((x arg_z))
115  (tst x (:$ arm::fixnummask))
116  (bxeq lr)
117  (bic arg_z x (:$ arm::fulltagmask))
118  (mov arg_z (:lsr arg_z (:$ (- arm::ntagbits arm::nfixnumtagbits))))
119  (bx lr))
120
121;;; end of arm-hash.lisp
Note: See TracBrowser for help on using the repository browser.