Raymond Toy pushed to branch arm64-dev-1 at cmucl / cmucl
Commits:
-
f4345a37
by Raymond Toy at 2026-03-23T10:17:34-07:00
-
d5343317
by Raymond Toy at 2026-03-23T10:35:39-07:00
-
d0734459
by Raymond Toy at 2026-03-23T10:36:40-07:00
3 changed files:
Changes:
| 1 | +;;; -*- Package: ARM64 -*-
|
|
| 2 | +;;;
|
|
| 3 | +;;; **********************************************************************
|
|
| 4 | +;;; This code was written as part of the CMU Common Lisp project at
|
|
| 5 | +;;; Carnegie Mellon University, and has been placed in the public domain.
|
|
| 6 | +;;;
|
|
| 7 | +(ext:file-comment
|
|
| 8 | + "$Header: src/compiler/arm64/subprim.lisp $")
|
|
| 9 | +;;;
|
|
| 10 | +;;; **********************************************************************
|
|
| 11 | +;;;
|
|
| 12 | +;;; Linkage information for standard static functions, and random vops.
|
|
| 13 | +;;;
|
|
| 14 | +;;; Written by William Lott.
|
|
| 15 | +;;; ARM64 port derived from the SPARC implementation.
|
|
| 16 | +;;;
|
|
| 17 | +(in-package "ARM64")
|
|
| 18 | + |
|
| 19 | + |
|
| 20 | +
|
|
| 21 | + |
|
| 22 | +;;;; Length
|
|
| 23 | + |
|
| 24 | +(define-vop (length/list)
|
|
| 25 | + (:translate length)
|
|
| 26 | + (:args (object :scs (descriptor-reg) :target ptr))
|
|
| 27 | + (:arg-types list)
|
|
| 28 | + (:temporary (:scs (descriptor-reg) :from (:argument 0)) ptr)
|
|
| 29 | + (:temporary (:scs (non-descriptor-reg)) temp)
|
|
| 30 | + (:temporary (:scs (any-reg) :type fixnum :to (:result 0) :target result)
|
|
| 31 | + count)
|
|
| 32 | + (:results (result :scs (any-reg descriptor-reg)))
|
|
| 33 | + (:policy :fast-safe)
|
|
| 34 | + (:vop-var vop)
|
|
| 35 | + (:save-p :compute-only)
|
|
| 36 | + (:generator 50
|
|
| 37 | + (emit-not-implemented)
|
|
| 38 | + (let ((done (gen-label))
|
|
| 39 | + (loop (gen-label))
|
|
| 40 | + (not-list (generate-cerror-code vop object-not-list-error object)))
|
|
| 41 | + (move ptr object)
|
|
| 42 | + (move count zero-tn)
|
|
| 43 | + |
|
| 44 | + (emit-label loop)
|
|
| 45 | + |
|
| 46 | + ;; Unlike SPARC, ARM64 has no branch delay slots; no NOP needed.
|
|
| 47 | + (inst cmp ptr null-tn)
|
|
| 48 | + (inst b :eq done)
|
|
| 49 | + |
|
| 50 | + (test-type ptr temp not-list t vm:list-pointer-type)
|
|
| 51 | + |
|
| 52 | + (loadw ptr ptr vm:cons-cdr-slot vm:list-pointer-type)
|
|
| 53 | + (inst add count count (fixnumize 1))
|
|
| 54 | + (test-type ptr temp loop nil vm:list-pointer-type)
|
|
| 55 | + |
|
| 56 | + (cerror-call vop done object-not-list-error ptr)
|
|
| 57 | + |
|
| 58 | + (emit-label done)
|
|
| 59 | + (move result count))))
|
|
| 60 | + |
|
| 61 | + |
|
| 62 | +(define-static-function length (object) :translate length) |
| ... | ... | @@ -478,15 +478,15 @@ |
| 478 | 478 | |
| 479 | 479 | ;;;; Symbols
|
| 480 | 480 | |
| 481 | -#+(or gengc sparc x86 amd64 ppc)
|
|
| 481 | +#+(or gengc sparc x86 amd64 ppc arm64)
|
|
| 482 | 482 | (defknown %make-symbol (fixnum simple-string) symbol
|
| 483 | 483 | (flushable movable))
|
| 484 | 484 | |
| 485 | -#+(or gengc sparc x86 amd64 ppc)
|
|
| 485 | +#+(or gengc sparc x86 amd64 ppc arm64)
|
|
| 486 | 486 | (defknown symbol-hash (symbol) fixnum
|
| 487 | 487 | (flushable movable))
|
| 488 | 488 | |
| 489 | -#+(or gencgc sparc x86 amd64 ppc)
|
|
| 489 | +#+(or gencgc sparc x86 amd64 ppc arm64)
|
|
| 490 | 490 | (defknown %set-symbol-hash (symbol index)
|
| 491 | 491 | t (unsafe))
|
| 492 | 492 | |
| ... | ... | @@ -500,12 +500,12 @@ |
| 500 | 500 | (define-primitive-object (symbol :lowtag other-pointer-type
|
| 501 | 501 | :header symbol-header-type
|
| 502 | 502 | :alloc-trans
|
| 503 | - #-(or gengc x86 amd64 sparc ppc) make-symbol
|
|
| 504 | - #+(or gengc x86 amd64 sparc ppc) %make-symbol)
|
|
| 503 | + #-(or gengc x86 amd64 sparc ppc arm64) make-symbol
|
|
| 504 | + #+(or gengc x86 amd64 sparc ppc arm64) %make-symbol)
|
|
| 505 | 505 | (value :set-trans %set-symbol-value
|
| 506 | 506 | :init :unbound)
|
| 507 | - #-(or gengc x86 amd64 sparc ppc) unused
|
|
| 508 | - #+(or gengc x86 amd64 sparc ppc)
|
|
| 507 | + #-(or gengc x86 amd64 sparc ppc arm64) unused
|
|
| 508 | + #+(or gengc x86 amd64 sparc ppc arm64)
|
|
| 509 | 509 | (hash :init :arg)
|
| 510 | 510 | (plist :ref-trans symbol-plist
|
| 511 | 511 | :set-trans %set-symbol-plist
|
| ... | ... | @@ -518,7 +518,7 @@ |
| 518 | 518 | ;; We couldn't use the nil/symbol trick in 32-bit, because the difference
|
| 519 | 519 | ;; between the low tags of nil and symbol is 4 but the word-size is 8. This is
|
| 520 | 520 | ;; a slow workaround.
|
| 521 | -#+amd64
|
|
| 521 | +#+(and amd64 arm64)
|
|
| 522 | 522 | (deftransform symbol-name ((symbol) (*))
|
| 523 | 523 | '(if (eq symbol nil)
|
| 524 | 524 | "NIL"
|
| 1 | +# -*- Mode: makefile -*-
|
|
| 2 | + |
|
| 3 | +PATH1 = ../../src/lisp
|
|
| 4 | +vpath %.h $(PATH1)
|
|
| 5 | +vpath %.c $(PATH1)
|
|
| 6 | +vpath %.S $(PATH1)
|
|
| 7 | + |
|
| 8 | +CMULOCALE = ../../src/i18n/locale
|
|
| 9 | +vpath %.pot $(CMULOCALE)
|
|
| 10 | +vpath %.po $(CMULOCALE)
|
|
| 11 | +vpath %.mo $(CMULOCALE)
|
|
| 12 | + |
|
| 13 | +GC_SRC := gc.c
|
|
| 14 | + |
|
| 15 | +CPPFLAGS := -DUNICODE -iquote . -iquote $(PATH1)
|
|
| 16 | +CFLAGS += -marm -Wstrict-prototypes -Wall -O0 -ggdb3 -fno-omit-frame-pointer -ffp-contract=off
|
|
| 17 | +ASFLAGS = -g
|
|
| 18 | + |
|
| 19 | +ARCH_SRC = arm-arch.c
|
|
| 20 | + |
|
| 21 | +NM = $(PATH1)/linux-nm
|
|
| 22 | +DEPEND_FLAGS = -MM
|
|
| 23 | + |
|
| 24 | +ASSEM_SRC = arm64-assem.S undefineds-assem.S
|
|
| 25 | +OS_SRC += Linux-os.c os-common.c elf.c
|
|
| 26 | +OS_LIBS = -ldl -lutil
|
|
| 27 | +OS_LINK_FLAGS = -marm -rdynamic -Wl,-Map,foo -Wl,-z,noexecstack
|
|
| 28 | + |
|
| 29 | +EXEC_FINAL_OBJ = exec-final.o
|
|
| 30 | + |
|
| 31 | +# Convert undefineds.h to a set of stubs. Preprocess undefineds.h,
|
|
| 32 | +# remove preprocessor junk and take each symbol and make a stub out of
|
|
| 33 | +# it.
|
|
| 34 | +#
|
|
| 35 | +# TODO: Modify undefineds.h and get rid of the F(foo) and D(foo) stuff.
|
|
| 36 | +undefineds-assem.S: undefineds.h
|
|
| 37 | + $(CPP) '-DF(x)=x' '-DD(x)' $< | \
|
|
| 38 | + sed -e '/^#/d' -e '/^ *$$/d' -e 's/,$$//' | \
|
|
| 39 | + sort | \
|
|
| 40 | + awk 'BEGIN { print "\t.text\n" } { printf "\t.align 2\n\t.global stub_%s\nstub_%s:\n\tb %s\n\n", $$1, $$1, $$1 }' > $@ |