Changeset 5724


Ignore:
Timestamp:
Jan 18, 2007, 3:05:51 AM (18 years ago)
Author:
Gary Byers
Message:

WITH-FFCALL-RESULTS. Start to sketch out structure return code (structures
are often "returned" by returning field values in registers pn DarwinPPC64.)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ccl/compiler/PPC/PPC64/ppc64-arch.lisp

    r5645 r5724  
    972972  v)
    973973
    974 
     974(defppc64archmacro ccl::with-ffcall-results ((buf) &body body)
     975  (let* ((size (+ (* 8 8) (* 31 8))))
     976    `(ccl::%stack-block ((,buf ,size))
     977      ,@body)))
     978
     979#+darwinppc-target
     980#+notyet
     981(defun struct-from-regbuf (type-name structptr regbuf)
     982  (let* ((type (ccl::%foreign-type-or-record type-name)))
     983    (unless (typep type 'ccl::foreign-record-type)
     984      (error "Not a structure type : ~s" type-name))
     985    (let* ((bits (ccl::ensure-foreign-type-bits type)))
     986      (ccl::collect ((forms))
     987        (cond ((= bits 128)             ;(and (eql day 'tuesday) ...)
     988               (forms `(setf (ccl::%%get-signed-longlong ,structptr 0)
     989                        (ccl::%%get-signed-longlong ,regbuf 0)
     990                        (ccl::%%get-signed-longlong ,structptr 8)
     991                        (ccl::%%get-signed-longlong ,regbuf 8))))
     992              (t
     993               (let* ((gpr-offset 0)
     994                      (fpr-offset (* 8 8))
     995                      (bit-offset 0)
     996                      (fields (ccl::foreign-record-type-fields type)))
     997                 (ccl::collect ((bit-offset)
     998                                (field-width))
     999                   (flet ((next-gpr-offset ()
     1000                            (prog1 gpr-offset
     1001                              (incf gpr-offset 8)))
     1002                          (next-fpr-offset ()
     1003                            (prog1 fpr-offset
     1004                              (incf gpr-offset 8)
     1005                              (incf fptr-offset 8))))
     1006                     (flet ((assign-field (f)
     1007                              (let* ((field-type (ccl::foreign-record-field-type field))))))
     1008                       (dolist (field fields)
     1009                       
     1010                   )))))))))))
     1011                             
    9751012(provide "PPC64-ARCH")
Note: See TracChangeset for help on using the changeset viewer.