X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcompiler%2Falpha%2Fstatic-fn.lisp;h=bffe879fd940f58423f01ff530a4758a6e7a28e9;hb=e049902f5e7c30501d2dbb7a41d058a0c717fc1f;hp=6a32c4272e38aa382a85063aa0666624328d98ee;hpb=dfa55a883f94470267b626dae77ce7e7dfac3df6;p=sbcl.git diff --git a/src/compiler/alpha/static-fn.lisp b/src/compiler/alpha/static-fn.lisp index 6a32c42..bffe879 100644 --- a/src/compiler/alpha/static-fn.lisp +++ b/src/compiler/alpha/static-fn.lisp @@ -1,25 +1,17 @@ -;;; -*- Package: ALPHA -*- -;;; -;;; ********************************************************************** -;;; This code was written as part of the CMU Common Lisp project at -;;; Carnegie Mellon University, and has been placed in the public domain. -;;; - -;;; -;;; ********************************************************************** -;;; -;;; This file contains the VOPs and macro magic necessary to call static -;;; functions. -;;; -;;; Written by William Lott. -;;; Converted by Sean Hallgren. -;;; -(in-package "SB!VM") - +;;;; VOPs and macro magic for calling static functions +;;;; This software is part of the SBCL system. See the README file for +;;;; more information. +;;;; +;;;; This software is derived from the CMU CL system, which was +;;;; written at Carnegie Mellon University and released into the +;;;; public domain. The software is in the public domain and is +;;;; provided with absolutely no warranty. See the COPYING and CREDITS +;;;; files for more information. +(in-package "SB!VM") -(define-vop (static-function-template) +(define-vop (static-fun-template) (:save-p t) (:policy :safe) (:variant-vars symbol) @@ -32,15 +24,12 @@ (:temporary (:sc any-reg :offset ocfp-offset) ocfp) (:temporary (:sc control-stack :offset nfp-save-offset) nfp-save)) - (eval-when (:compile-toplevel :load-toplevel :execute) - -(defun static-function-template-name (num-args num-results) - (intern (format nil "~:@(~R-arg-~R-result-static-function~)" +(defun static-fun-template-name (num-args num-results) + (intern (format nil "~:@(~R-arg-~R-result-static-fun~)" num-args num-results))) - (defun moves (src dst) (collect ((moves)) (do ((dst dst (cdr dst)) @@ -49,11 +38,11 @@ (moves `(move ,(car src) ,(car dst)))) (moves))) -(defun static-function-template-vop (num-args num-results) +(defun static-fun-template-vop (num-args num-results) (assert (and (<= num-args register-arg-count) (<= num-results register-arg-count)) (num-args num-results) - "Either too many args (~D) or too many results (~D). Max = ~D" + "Either too many args (~W) or too many results (~W). Max = ~W" num-args num-results register-arg-count) (let ((num-temps (max num-args num-results))) (collect ((temp-names) (temps) (arg-names) (args) (result-names) (results)) @@ -78,8 +67,8 @@ (args `(,arg-name :scs (any-reg descriptor-reg null zero) :target ,(nth i (temp-names)))))) - `(define-vop (,(static-function-template-name num-args num-results) - static-function-template) + `(define-vop (,(static-fun-template-name num-args num-results) + static-fun-template) (:args ,@(args)) ,@(temps) (:results ,@(results)) @@ -88,7 +77,7 @@ (cur-nfp (current-nfp-tn vop))) ,@(moves (arg-names) (temp-names)) (inst li (fixnumize ,num-args) nargs) - (inst ldl entry-point (static-function-offset symbol) null-tn) + (inst ldl entry-point (static-fun-offset symbol) null-tn) (when cur-nfp (store-stack-tn nfp-save cur-nfp)) (inst move cfp-tn ocfp) @@ -116,24 +105,21 @@ (maybe-load-stack-nfp-tn cur-nfp nfp-save temp)) ,@(moves (temp-names) (result-names)))))))) - -) ; eval-when (compile load eval) - +) ; EVAL-WHEN (expand (collect ((templates (list 'progn))) (dotimes (i register-arg-count) - (templates (static-function-template-vop i 1))) + (templates (static-fun-template-vop i 1))) (templates))) - -(defmacro define-static-function (name args &key (results '(x)) translate +(defmacro define-static-fun (name args &key (results '(x)) translate policy cost arg-types result-types) `(define-vop (,name - ,(static-function-template-name (length args) - (length results))) + ,(static-fun-template-name (length args) + (length results))) (:variant ',name) - (:note ,(format nil "static-function ~@(~S~)" name)) + (:note ,(format nil "static-fun ~@(~S~)" name)) ,@(when translate `((:translate ,translate))) ,@(when policy