Changeset 6609
- Timestamp:
- May 25, 2007, 5:08:01 AM (18 years ago)
- File:
-
- 1 edited
-
branches/ide-1.0/ccl/examples/objc-runtime.lisp (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/ide-1.0/ccl/examples/objc-runtime.lisp
r6586 r6609 1460 1460 #+apple-objc 1461 1461 (eval-when (:compile-toplevel :execute) 1462 #+x8664-target 1463 (%def-foreign-type :<MARG> (foreign-pointer-type-to (parse-foreign-type :x86_64_marg_list))) 1464 #+ppc-target 1462 #+(and ppc-target (not apple-objc-2.0)) 1465 1463 (def-foreign-type :<MARG> 1466 1464 (:struct nil … … 1472 1470 1473 1471 1474 #+(and apple-objc x8664-target)1472 #+(and apple-objc-2.0 x8664-target) 1475 1473 (defun %compile-varargs-send-function-for-signature (sig) 1476 (let* ((return-type-spec (car sig)) 1474 (let* ((return-type-spec (foreign-type-to-representation-type (car sig))) 1475 (op (case return-type-spec 1476 (:address '%get-ptr) 1477 (:unsigned-byte '%get-unsigned-byte) 1478 (:signed-byte '%get-signed-byte) 1479 (:unsigned-halfword '%get-unsigned-word) 1480 (:signed-halfword '%get-signed-word) 1481 (:unsigned-fullword '%get-unsigned-long) 1482 (:signed-fullword '%get-signed-long) 1483 (:unsigned-doubleword '%get-natural) 1484 (:signed-doubleword '%get-signed-natural) 1485 (:single-float '%get-single-float) 1486 (:double-float '%get-double-float))) 1487 (result-offset 1488 (case op 1489 ((:single-float :double-float) 0) 1490 (t -8))) 1477 1491 (arg-type-specs (butlast (cdr sig))) 1478 1492 (args (objc-gen-message-arglist (length arg-type-specs))) … … 1481 1495 (rest-arg (gensym)) 1482 1496 (arg-temp (gensym)) 1483 (marg-ptr (gensym))1484 1497 (regparams (gensym)) 1485 1498 (stackparams (gensym)) 1499 (fpparams (gensym)) 1500 (cframe (gensym)) 1486 1501 (selptr (gensym)) 1487 1502 (gpr-total (gensym)) … … 1501 1516 (static-arg-type (parse-foreign-type spec)) 1502 1517 (gpr-base (if (< n-static-gprs 6) regparams stackparams)) 1503 (fpr-base (if (< n-static-fprs 8) marg-ptrstackparams))1518 (fpr-base (if (< n-static-fprs 8) fpparams stackparams)) 1504 1519 (gpr-offset (if (< n-static-gprs 6) n-static-gprs n-static-stack-args)) 1505 1520 (fpr-offset (if (< n-static-fprs 8) 1506 (* 16n-static-fprs)1521 (* 8 n-static-fprs) 1507 1522 (* 8 n-static-stack-args)))) 1508 1523 (etypecase static-arg-type … … 1521 1536 (incf n-static-stack-args))) 1522 1537 (foreign-single-float-type 1523 (if (eq fpr-base stackparams)1524 (setq fpr-offset (* 2 fpr-offset)))1525 1538 (static-arg-forms 1526 1539 `(setf (%get-single-float ,fpr-base ,fpr-offset) ,arg)) … … 1557 1570 (incf ,gpr-total) 1558 1571 (incf ,stack-total)))) 1559 (%stack-block ((,marg-ptr (+ ,(%foreign-type-or-record-size 1560 :<MARG> :bytes) 1561 (* 8 ,stack-total)))) 1562 1563 (setf (pref ,marg-ptr :<MARG>.rax) ,fpr-total) 1564 (with-macptrs ((,regparams (pref ,marg-ptr :<MARG>.reg<P>arams)) 1565 (,stackparams (pref ,marg-ptr :<MARG>.stack<P>arams))) 1566 (progn ,@(static-arg-forms)) 1567 (%process-varargs-list ,regparams ,marg-ptr ,stackparams ,n-static-gprs ,n-static-fprs ,n-static-stack-args ,rest-arg) 1568 (external-call "_objc_msgSendv" 1569 :address ,receiver 1570 :address ,selptr 1571 :size_t (+ 48 (* 8 ,stack-total)) 1572 :address ,marg-ptr 1573 ,return-type-spec))))))))) 1572 (%stack-block ((,fpparams (* 8 8))) 1573 (with-macptrs (,regparams ,stackparams) 1574 (with-variable-c-frame 1575 (+ 8 ,stack-total) ,cframe 1576 (%setf-macptr-to-object ,regparams (+ ,cframe 2)) 1577 (%setf-macptr-to-object ,stackparams (+ ,cframe 8)) 1578 (progn ,@(static-arg-forms)) 1579 (%process-varargs-list ,regparams ,fpparams ,stackparams ,n-static-gprs ,n-static-fprs ,n-static-stack-args ,rest-arg) 1580 (%do-ff-call ,fpr-total ,cframe ,fpparams (%reference-external-entry-point (load-time-value (external "_objc_msgSend")))) 1581 ,@(if op 1582 `((,op ,regparams ,result-offset)) 1583 `(()))))))))))) 1584 1574 1585 1575 1586 #+(and apple-objc ppc32-target)
Note:
See TracChangeset
for help on using the changeset viewer.
