[Git][cmucl/cmucl][arm64-dev-1] 3 commits: First cut at arm64 subprim.lisp
Raymond Toy pushed to branch arm64-dev-1 at cmucl / cmucl Commits: f4345a37 by Raymond Toy at 2026-03-23T10:17:34-07:00 First cut at arm64 subprim.lisp Basically the sparc version but updated for arm64. Compiles, but no other testing, obviously. [skip-ci] - - - - - d5343317 by Raymond Toy at 2026-03-23T10:35:39-07:00 Rudimentary arm64_linux config Need this so we can create cross-compile targets using arm64_linux as the config. Untested. [skip-ci] - - - - - d0734459 by Raymond Toy at 2026-03-23T10:36:40-07:00 Update for arm64 for symbol stuff. Just do what we already do for sparc, but also do the amd64 stuff. Mostly untested, but we do need symbol-hash as a known function. [skip-ci] - - - - - 3 changed files: - + src/compiler/arm64/subprim.lisp - src/compiler/generic/objdef.lisp - + src/lisp/Config.arm64_linux Changes: ===================================== src/compiler/arm64/subprim.lisp ===================================== @@ -0,0 +1,62 @@ +;;; -*- Package: ARM64 -*- +;;; +;;; ********************************************************************** +;;; This code was written as part of the CMU Common Lisp project at +;;; Carnegie Mellon University, and has been placed in the public domain. +;;; +(ext:file-comment + "$Header: src/compiler/arm64/subprim.lisp $") +;;; +;;; ********************************************************************** +;;; +;;; Linkage information for standard static functions, and random vops. +;;; +;;; Written by William Lott. +;;; ARM64 port derived from the SPARC implementation. +;;; +(in-package "ARM64") + + + + +;;;; Length + +(define-vop (length/list) + (:translate length) + (:args (object :scs (descriptor-reg) :target ptr)) + (:arg-types list) + (:temporary (:scs (descriptor-reg) :from (:argument 0)) ptr) + (:temporary (:scs (non-descriptor-reg)) temp) + (:temporary (:scs (any-reg) :type fixnum :to (:result 0) :target result) + count) + (:results (result :scs (any-reg descriptor-reg))) + (:policy :fast-safe) + (:vop-var vop) + (:save-p :compute-only) + (:generator 50 + (emit-not-implemented) + (let ((done (gen-label)) + (loop (gen-label)) + (not-list (generate-cerror-code vop object-not-list-error object))) + (move ptr object) + (move count zero-tn) + + (emit-label loop) + + ;; Unlike SPARC, ARM64 has no branch delay slots; no NOP needed. + (inst cmp ptr null-tn) + (inst b :eq done) + + (test-type ptr temp not-list t vm:list-pointer-type) + + (loadw ptr ptr vm:cons-cdr-slot vm:list-pointer-type) + (inst add count count (fixnumize 1)) + (test-type ptr temp loop nil vm:list-pointer-type) + + (cerror-call vop done object-not-list-error ptr) + + (emit-label done) + (move result count)))) + + +(define-static-function length (object) :translate length) ===================================== src/compiler/generic/objdef.lisp ===================================== @@ -478,15 +478,15 @@ ;;;; Symbols -#+(or gengc sparc x86 amd64 ppc) +#+(or gengc sparc x86 amd64 ppc arm64) (defknown %make-symbol (fixnum simple-string) symbol (flushable movable)) -#+(or gengc sparc x86 amd64 ppc) +#+(or gengc sparc x86 amd64 ppc arm64) (defknown symbol-hash (symbol) fixnum (flushable movable)) -#+(or gencgc sparc x86 amd64 ppc) +#+(or gencgc sparc x86 amd64 ppc arm64) (defknown %set-symbol-hash (symbol index) t (unsafe)) @@ -500,12 +500,12 @@ (define-primitive-object (symbol :lowtag other-pointer-type :header symbol-header-type :alloc-trans - #-(or gengc x86 amd64 sparc ppc) make-symbol - #+(or gengc x86 amd64 sparc ppc) %make-symbol) + #-(or gengc x86 amd64 sparc ppc arm64) make-symbol + #+(or gengc x86 amd64 sparc ppc arm64) %make-symbol) (value :set-trans %set-symbol-value :init :unbound) - #-(or gengc x86 amd64 sparc ppc) unused - #+(or gengc x86 amd64 sparc ppc) + #-(or gengc x86 amd64 sparc ppc arm64) unused + #+(or gengc x86 amd64 sparc ppc arm64) (hash :init :arg) (plist :ref-trans symbol-plist :set-trans %set-symbol-plist @@ -518,7 +518,7 @@ ;; We couldn't use the nil/symbol trick in 32-bit, because the difference ;; between the low tags of nil and symbol is 4 but the word-size is 8. This is ;; a slow workaround. -#+amd64 +#+(and amd64 arm64) (deftransform symbol-name ((symbol) (*)) '(if (eq symbol nil) "NIL" ===================================== src/lisp/Config.arm64_linux ===================================== @@ -0,0 +1,40 @@ +# -*- Mode: makefile -*- + +PATH1 = ../../src/lisp +vpath %.h $(PATH1) +vpath %.c $(PATH1) +vpath %.S $(PATH1) + +CMULOCALE = ../../src/i18n/locale +vpath %.pot $(CMULOCALE) +vpath %.po $(CMULOCALE) +vpath %.mo $(CMULOCALE) + +GC_SRC := gc.c + +CPPFLAGS := -DUNICODE -iquote . -iquote $(PATH1) +CFLAGS += -marm -Wstrict-prototypes -Wall -O0 -ggdb3 -fno-omit-frame-pointer -ffp-contract=off +ASFLAGS = -g + +ARCH_SRC = arm-arch.c + +NM = $(PATH1)/linux-nm +DEPEND_FLAGS = -MM + +ASSEM_SRC = arm64-assem.S undefineds-assem.S +OS_SRC += Linux-os.c os-common.c elf.c +OS_LIBS = -ldl -lutil +OS_LINK_FLAGS = -marm -rdynamic -Wl,-Map,foo -Wl,-z,noexecstack + +EXEC_FINAL_OBJ = exec-final.o + +# Convert undefineds.h to a set of stubs. Preprocess undefineds.h, +# remove preprocessor junk and take each symbol and make a stub out of +# it. +# +# TODO: Modify undefineds.h and get rid of the F(foo) and D(foo) stuff. +undefineds-assem.S: undefineds.h + $(CPP) '-DF(x)=x' '-DD(x)' $< | \ + sed -e '/^#/d' -e '/^ *$$/d' -e 's/,$$//' | \ + sort | \ + 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 }' > $@ View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/2668dee30d0ee65b80e277f... -- View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/2668dee30d0ee65b80e277f... You're receiving this email because of your account on gitlab.common-lisp.net. Manage all notifications: https://gitlab.common-lisp.net/-/profile/notifications | Help: https://gitlab.common-lisp.net/help
participants (1)
-
Raymond Toy (@rtoy)