Merge pull request #387 from mflatt/fpstr
fix string allocation for foreign-callable argument or foreign-call return original commit: f2cc62974a26f4dd54677d8b3ad8f25108862deb
This commit is contained in:
commit
60702ca3fc
5
LOG
5
LOG
|
@ -1045,4 +1045,7 @@
|
|||
- fixed a bug in cp0 bug that could fold the apply of a primitive, where
|
||||
the last argument is not a list, as if it were a call to the primitive
|
||||
with those arguments
|
||||
cp0.ss, cp0.ms
|
||||
cp0.ss, cp0.ms
|
||||
- fix allocation of string/bytevector for a foreign-callable argument
|
||||
or foreign-call return
|
||||
cpnanopass.ss, foreign.ms, foreign2.c
|
|
@ -2539,6 +2539,29 @@
|
|||
v)
|
||||
14995143)
|
||||
|
||||
;; regression test related to saving registers that hold allocated
|
||||
;; callable argument
|
||||
(let* ([call-with-many-args (foreign-procedure "call_with_many_args" (void*) boolean)]
|
||||
[result #f]
|
||||
[cb (foreign-callable
|
||||
(lambda (i s1 s2 s3 s4 i2 s6 s7 i3)
|
||||
(set! result
|
||||
(and (eqv? i 0)
|
||||
(equal? (string->utf8 "this") s1)
|
||||
(equal? (string->utf8 "is") s2)
|
||||
(equal? (string->utf8 "working") s3)
|
||||
(equal? (string->utf8 "just") s4)
|
||||
(eqv? i2 1)
|
||||
(equal? (string->utf8 "fine") s6)
|
||||
(equal? (string->utf8 "or does it?") s7)
|
||||
(eqv? i3 2))))
|
||||
(int u8* u8* u8* u8* int u8* u8* int)
|
||||
void)])
|
||||
(lock-object cb)
|
||||
(call-with-many-args (foreign-callable-entry-point cb))
|
||||
(unlock-object cb)
|
||||
result)
|
||||
|
||||
)
|
||||
|
||||
(machine-case
|
||||
|
|
|
@ -443,3 +443,10 @@ EXPORT void call_many_times(void (*f)(iptr))
|
|||
j = k+2; k = l+2; l = m+2; m = m+2;
|
||||
}
|
||||
}
|
||||
|
||||
typedef void (*many_arg_callback_t)(int i, const char* s1, const char* s2, const char* s3,
|
||||
const char* s4, int i2, const char* s6, const char* s7, int i3);
|
||||
EXPORT void call_with_many_args(many_arg_callback_t callback)
|
||||
{
|
||||
callback(0, "this", "is", "working", "just", 1, "fine", "or does it?", 2);
|
||||
}
|
||||
|
|
|
@ -898,9 +898,9 @@
|
|||
(constant-case ptr-bits
|
||||
[(32) (declare-intrinsic dofretuns64 dofretuns64 (%ts %td %xp) (%ac0 %ac1) (%ac0))]
|
||||
[(64) (declare-intrinsic dofretuns64 dofretuns64 (%ts %td %xp) (%ac0) (%ac0))])
|
||||
(declare-intrinsic dofretu8* dofretu8* (%ac0 %ts %td %cp) (%ac0) (%xp))
|
||||
(declare-intrinsic dofretu16* dofretu16* (%ac0 %ts %td %cp) (%ac0) (%xp))
|
||||
(declare-intrinsic dofretu32* dofretu32* (%ac0 %ts %td %cp) (%ac0) (%xp))
|
||||
(declare-intrinsic dofretu8* dofretu8* (%ac0 %ts %td %cp %ac1) (%ac0) (%xp))
|
||||
(declare-intrinsic dofretu16* dofretu16* (%ac0 %ts %td %cp %ac1) (%ac0) (%xp))
|
||||
(declare-intrinsic dofretu32* dofretu32* (%ac0 %ts %td %cp %ac1) (%ac0) (%xp))
|
||||
(declare-intrinsic get-room get-room () (%xp) (%xp))
|
||||
(declare-intrinsic scan-remembered-set scan-remembered-set () () ())
|
||||
(declare-intrinsic dooverflow dooverflow () () ())
|
||||
|
@ -11863,7 +11863,6 @@
|
|||
(set! ,%xp (literal ,(make-info-literal #f 'object #vu8() 0)))
|
||||
(asm-return ,return-live* ...))
|
||||
,(%seq
|
||||
; TODO: avoid use of ac1 by insisting that get-room preserve ts & td
|
||||
(set! ,(ref-reg %ac1) ,%td)
|
||||
(set! ,%td ,(%inline + ,%td
|
||||
(immediate
|
||||
|
|
Loading…
Reference in New Issue
Block a user