Changeset 10267


Ignore:
Timestamp:
Jul 31, 2008, 5:51:14 PM (11 years ago)
Author:
rme
Message:

%copy-function for x8632.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/level-0/X86/X8632/x8632-def.lisp

    r9679 r10267  
    8989      (declare (fixnum k) (list imms))
    9090      (setf (%svref newv k) (car imms)))))
     91
     92(defun %copy-function (proto &optional target)
     93  (let* ((protov (function-to-function-vector proto))
     94         (code-words (%function-code-words proto))
     95         (total-words (uvsize protov))
     96         (newv (if target
     97                 (function-to-function-vector target)
     98                 (allocate-typed-vector :function total-words))))
     99    (declare (fixnum code-words total-words))
     100    (when target
     101      (unless (and (eql code-words (%function-code-words target))
     102                   (eql total-words (uvsize newv)))
     103        (error "Wrong size target ~s" target)))
     104    (%copy-ivector-to-ivector protov 0 newv 0 (the fixnum (ash code-words target::word-shift)))
     105    (loop for k fixnum from code-words below total-words
     106      do (setf (%svref newv k) (%svref protov k)))
     107    (function-vector-to-function newv)))
    91108
    92109(defun replace-function-code (target proto)
Note: See TracChangeset for help on using the changeset viewer.