[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Lightning] Re: lightning and i386
From: |
Shawn W. |
Subject: |
Re: [Lightning] Re: lightning and i386 |
Date: |
Sun, 12 Aug 2007 07:43:23 -0700 |
On Aug 12, 2007, at 6:56 AM, Shawn W. wrote:
Okay. One issue solved, one to go... I've got lightning working on
i386, but the functions it's producing aren't returning the same
results as the ones on powerpc. Progress of a sort.
And... figured that out. A bug in 1.2c compared to 1.2 (Remember,
I've been trying to use 1.2c to get amd64 support. The plt version
someone mentioned won't work for my purposes, even though it has
amd64 support, because it only works with function calls with up to 3
arguments. Some of the bytecode I'm trying to turn into native binary
ends up using more arguments to functions. Unless that's just for how
many arguments you can pass to lightning-generated functions, not how
many you can pass to external functions the generated functions are
calling?)
Anyways, the following snippet:
f = (pifi)(jit_set_ip(codebuffer).iptr);
jit_leaf(1);
arg = jit_arg_i();
jit_getarg_i(JIT_R0, arg);
jit_movi_i(JIT_R1, 1);
jit_eqr_i(JIT_V0, JIT_R0, JIT_R1);
jit_movr_i(JIT_RET, JIT_V0);
jit_ret();
compiles to, using 1.2 i386 (Skipping the prologue bits):
mov %esp,%ebp
mov 0x8(%ebp),%eax
mov $0x1,%ecx
cmp %ecx,%eax
mov $0x0,%ebx
sete %bl
mov %ebx,%eax
and, using 1.2c i386:
mov %esp,%ebp
mov 0x14(%ebp),%eax
mov $0x1,%ecx
cmp %ecx,%eax
mov $0x0,%ebx
sete %al
mov %ebx,%eax
The sete line's causing the problem I'm seeing (I don't know if
that's responsible for all the incorrect results, but returning the
equality of two numbers is something many paths in my bytecode take.)
It's also present in 1.2c amd64.
Okay. I can live without amd64 support for a while if i386 works.
However, another problem with just using 1.2 in my project is that
what I've done so far uses jit_allocai() in places (To allocate a
pointer, and then pass its address to a function that sets it after
doing other stuff), and I don't know how to do the equivalent in 1.2.
--
Shawn W.
address@hidden