Great! So making sure that the callback stack is aligned on a 16-byte
boundary should be sufficient. Here's a patch to do just that:
Thanks,
Cyrus
--- c-call.lisp 19 Oct 2005 00:31:17 -0700 1.12
+++ c-call.lisp 25 Oct 2005 01:07:25 -0700
@@ -400,7 +400,8 @@
(flet ((make-gpr (n)
(make-random-tn :kind :normal :sc (sc-or-lose 'any-
reg) :offset n))
(make-fpr (n)
- (make-random-tn :kind :normal :sc (sc-or-lose 'double-
reg) :offset n)))
+ (make-random-tn :kind :normal :sc (sc-or-lose 'double-
reg) :offset n))
+ (round-up-16 (n) (* 16 (ceiling n 16))))
(let* ((segment (make-segment)))
(assemble (segment)
;; To save our arguments, we follow the algorithm
sketched in the
@@ -460,7 +461,7 @@
(args-size (* 3 n-word-bytes))
;; FIXME: n-frame-bytes?
(frame-size
- (+ n-foreign-linkage-area-bytes n-return-area-
bytes args-size)))
+ (round-up-16 (+ n-foreign-linkage-area-bytes n-
return-area-bytes args-size))))
(destructuring-bind (sp r0 arg1 arg2 arg3 arg4)
(mapcar #'make-gpr '(1 0 3 4 5 6))
(flet ((load-address-into (reg addr)
On Oct 25, 2005, at 12:25 AM, Nikodemus Siivola wrote:
> On Mon, 24 Oct 2005, Cyrus Harmon wrote:
>
>
>> The following patch uses a lot less stack space by not creating on
>> extra stack frame and only storing reg_NFP (r13 for darwin, r12
>> otherwise) and enough padding to align the portion of the stack
>> used to store this register to a 16-byte boundary. Also, this
>> patch is a bit less "invasive" than the last and is much shorter.
>> But this leaves a couple questions:
>>
>> 1. should the linkage table stuff restore r13 so we don't have to
>> do this?
>>
>
> See my previsous message: there should be no need for this in SBCL
> at all:
> normal calls to C aren't affected by this, and funcall3 doesn't go
> thru the linkage table.
>
> A test case is needed, however.
>
>
>> 2. is it ok not to build a whole extra stack frame for this? will
>> it mess up debuggability to do it this way?
>>
>
> No idea.
>
>
>> 3. why is reg_NFP 13 for darwin and 12 for linux? Raymond Toy said
>> (I think) that cmucl uses r13 for NFP on both platforms now. Can
>> we do the same?
>>
>
> No idea.
>
> Cheers,
>
> -- Nikodemus Schemer: "Buddha is small, clean, and
> serious."
> Lispnik: "Buddha is big, has hairy armpits, and
> laughs."
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by the JBoss Inc.
> Get Certified Today * Register for a JBoss Training Course
> Free Certification Exam for All Training Attendees Through End of 2005
> Visit http://www.jboss.com/services/certification for more information
> _______________________________________________
> Sbcl-devel mailing list
> Sbcl-devel@...
> https://lists.sourceforge.net/lists/listinfo/sbcl-devel
>
|