On Thu, Sep 24, 2009 at 5:29 PM, Phil Dawes <[email protected]> wrote:
> Am I doing something obviously stupid?:
>
> +M:: x86.32 %call-gc ( gc-root-count -- )
> +    12 [
> +        push-vm-ptr
> +        ! Pass number of roots as second parameter
> +        temp-reg gc-root-count MOV
> +        temp-reg PUSH
> +        ! Pass pointer to start of GC roots as first parameter
> +        temp-reg gc-root-base param@ LEA
> +        temp-reg PUSH
> +        ! Call GC
> +        "inline_gc" f %alien-invoke
> +    ] with-aligned-stack ;

This instruction adds an offset to ESP and stores the result in temp-reg:

temp-reg gc-root-base param@ LEA

However by that point with-aligned-stack has already changed ESP, so
you're passing a nonsensical buffer to inline_gc().

What you need to do is compute the gc root base before aligning the stack.

Also, you shouldn't be using temp-reg there. Instead, change
compiler.codegen to pass the temporary registers from the _gc
instruction to %call-gc so it can store the parameters there.

Finally, how about removing VM_ASM_API and renaming
VM_ASM_API_OVERFLOW to VM_ASM_API? For two-arg functions, regparm(3)
should behave just like regparm(2).

Slava

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to