Changeset 10790


Ignore:
Timestamp:
Sep 17, 2008, 10:06:40 PM (11 years ago)
Author:
gb
Message:

Return callback results differently (requires changes in .SPcallback
subprim.)

Assume that .SPcallback has reserved a few words on entry; store
results there, and set a flag in a word that's zeroed by .SPcallback
to indicate whether the result is a float that needs to be loaded
into the x87.

(Need to do similar things on Darwinx8632).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/lib/ffi-linuxx8632.lisp

    r10758 r10790  
    156156      (format t "~&need to return structure ~s by value" return-type)
    157157      (let* ((return-type-keyword (foreign-type-to-representation-type return-type)))
    158         `(setf (,
    159                 (case return-type-keyword
    160                   (:address '%get-ptr)
    161                   (:signed-doubleword '%%get-signed-longlong)
    162                   (:unsigned-doubleword '%%get-unsigned-longlong)
    163                   (:double-float '%get-double-float)
    164                   (:single-float '%get-single-float)
    165                   (:unsigned-fullword '%get-unsigned-long)
    166                   (t '%get-signed-long)
    167                   ) ,stack-ptr 8) ,result)))))
     158        (ccl::collect ((forms))
     159          (forms 'progn)
     160          (case return-type-keyword
     161            (:single-float
     162             (forms `(setf (%get-unsigned-byte ,stack-ptr -16) 1)))
     163            (:double-float
     164             (forms `(setf (%get-unsigned-byte ,stack-ptr -16) 2))))
     165          (forms
     166           `(setf (,
     167                   (case return-type-keyword
     168                     (:address '%get-ptr)
     169                     (:signed-doubleword '%%get-signed-longlong)
     170                     (:unsigned-doubleword '%%get-unsigned-longlong)
     171                     (:double-float '%get-double-float)
     172                     (:single-float '%get-single-float)
     173                     (:unsigned-fullword '%get-unsigned-long)
     174                     (t '%get-signed-long)
     175                     ) ,stack-ptr -8) ,result))
     176          (forms))))))
    168177
Note: See TracChangeset for help on using the changeset viewer.