source: branches/arm/level-0/ARM/arm-hash.lisp @ 13756

Last change on this file since 13756 was 13756, checked in by gb, 9 years ago

More code.

File size: 3.2 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  (bl .SPudiv32)
35  (box-fixnum arg_z imm1)
36  (return-lisp-frame imm0))
37
38
39(defarmlapfunction fast-mod-3 ((number arg_x) (divisor arg_y) (recip arg_z))
40  (mov imm0 (:lsr number (:$ arm::fixnumshift)))
41  (smull imm1 imm2 imm0 recip)
42  (smull imm2 imm0 imm1 divisor)
43  (sub number number imm0)
44  (sub number number divisor)
45  (mov imm0 (:asr number (:$ (1- arm::nbits-in-word))))
46  (and divisor divisor imm0)
47  (add arg_z number divisor)
48  (bx lr))
49
50(defarmlapfunction %dfloat-hash ((key arg_z))
51  (ldr imm0 (:@ key (:$ arm::double-float.value)))
52  (ldr imm1 (:@ key (:$ arm::double-float.val-low)))
53  (add imm0 imm0 imm1)
54  (box-fixnum arg_z imm0)
55  (bx lr))
56
57
58
59(defarmlapfunction %sfloat-hash ((key arg_z))
60  (ldr imm0 (:@ key (:$ arm::single-float.value)))
61  (box-fixnum arg_z imm0)
62  (bx lr))
63
64
65
66(defarmlapfunction %macptr-hash ((key arg_z))
67  (ldr imm0 (:@ key (:$ arm::macptr.address)))
68  (add imm0 imm0 (:lsr imm0 (:$ 24)))
69  (bic arg_z imm0 (:$ arm::fixnummask))
70  (bx lr))
71
72(defarmlapfunction %bignum-hash ((key arg_z))
73  (let ((header imm1)
74        (offset imm2)
75        (ndigits temp1)
76        (immhash imm0))
77    (mov immhash (:$ 0))
78    (mov offset (:$ arm::misc-data-offset))
79    (getvheader header key)
80    (header-length ndigits header)
81    (let ((next header))
82      @loop
83      (subs ndigits ndigits '1)
84      (ldr next (:@ key offset))
85      (add offset offset (:$ 4))
86      (add immhash next (:ror immhash (:$ 19)))
87      (bne @loop))
88    (bic arg_z immhash (:$ arm::fixnummask))
89    (bx lr)))
90
91
92
93
94(defarmlapfunction %get-fwdnum ()
95  (ref-global arg_z arm::fwdnum)
96  (bx lr))
97
98
99(defarmlapfunction %get-gc-count ()
100  (ref-global arg_z arm::gc-count)
101  (bx lr))
102
103
104;;; Setting a key in a hash-table vector needs to
105;;; ensure that the vector header gets memoized as well
106(defarmlapfunction %set-hash-table-vector-key ((vector arg_x) (index arg_y) (value arg_z))
107  (ba .SPset-hash-key))
108
109(defarmlapfunction %set-hash-table-vector-key-conditional ((offset 0) (vector arg_x) (old arg_y) (new arg_z))
110  (ba .SPset-hash-key-conditional))
111
112;;; Strip the tag bits to turn x into a fixnum
113(defarmlapfunction strip-tag-to-fixnum ((x arg_z))
114  (bic arg_z x (:$ arm::fixnummask))
115  (bx lr))
116
117;;; end of arm-hash.lisp
Note: See TracBrowser for help on using the repository browser.