[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] tcg, tci: Add TCG and interpreter for bytecode
From: |
malc |
Subject: |
Re: [Qemu-devel] [PATCH] tcg, tci: Add TCG and interpreter for bytecode (virtual machine) |
Date: |
Mon, 12 Oct 2009 16:55:43 +0400 (MSD) |
On Mon, 12 Oct 2009, malc wrote:
> On Mon, 12 Oct 2009, Stuart Brady wrote:
>
> > On Mon, Oct 12, 2009 at 03:50:31AM +0400, malc wrote:
> > > yOn Mon, 12 Oct 2009, Stuart Brady wrote:
> > >
> > > No it's not, given that there are ABIs with argument alignment and
> > > the fact that information about the types doesn't exist at the point
> > > of op_call things just aren't that simple.
> >
> > Huh? If you're using a function pointer with the *correct* type,
> > I hardly see how that's not sufficient.
>
> Let me give you an example:
>
[..snip overcomplication..]
> tcg$ uname -mo
> ppc GNU/Linux
>
> I hope it's self explanatory.
>
~$ gcc-4.4.1 -O2 -o - -S -x c - <<eof
> unsigned long long moo1 (int dummy, unsigned long long a)
> {
> asm ("# dummy is %0" : : "r" (dummy));
> return a;
> }
>
> unsigned long long moo2 (int dummy1, int dummy2, unsigned long long a)
> {
> asm ("# dummy1 is %0, dummy2 is %1" : : "r" (dummy1), "r" (dummy2));
> return a;
> }
> .file ""
.gnu_attribute 4, 1
.gnu_attribute 8, 1
.gnu_attribute 12, 2
.section ".text"
.align 2
.globl moo1
.type moo1, @function
moo1:
#APP
# 3 "<stdin>" 1
# dummy is 3
# 0 "" 2
#NO_APP
mr 3,5
mr 4,6
blr
.size moo1, .-moo1
.align 2
.globl moo2
.type moo2, @function
moo2:
#APP
# 9 "<stdin>" 1
# dummy1 is 3, dummy2 is 4
# 0 "" 2
#NO_APP
mr 3,5
mr 4,6
blr
.size moo2, .-moo2
.ident "GCC: (GNU) 4.4.1"
.section .note.GNU-stack,"",@progbits
(BTW 64 bit values are returned in r3 r4 pair under SV4 ABI rules)
And a quote from SVR4abippc.pdf itself:
The following algorithm specifies where argument data is passed for the
C language. For this purpose, consider the arguments as ordered from
left (First argument) to right, although the order of evaluation of the
arguments is unspecified. In this algorithm, fr contains the number of
the next available Floating-point register, gr contains the number of
the next available general purpose register, and starg is the address
of the next available stack argument word.
INITIALIZE:
Set fr=1, gr=3, and starg to the address of parameter word 1.
SCAN:
If there are no more arguments, terminate. Otherwise, select
one of the following depending on the type of the next
argument:
DOUBLE_OR_FLOAT:
If fr>8 (that is, there are no more available
Flating-point registers), go to OTHER. Otherwise, load
the argument value into Floating-point register fr, set
fr to fr+1, and go to SCAN.
SIMPLE_ARG:
A SIMPLE_ARG is one of the following:
. One of the simple integer types no more than 32 bits
wide (char, short, int, long, enum), or
. A pointer to an object of any type, or
. A struct, union, or long double, any of which shall
be treated as a pointer to the object, or to a copy
of the object where necessary to enforce
call-by-value semantics. Only if the caller can
ascertain that the object is "constant" can it pass a
pointer to the object itself.
If gr>10, go to OTHER. Otherwise, load the argument value into
general register gr, set gr to gr+1, and go to SCAN. Values
shorter than 32 bits are sign-extended or zero-extended,
depending on whether they are signed or unsigned.
LONG_LONG:
Note that implementations are not required to support a long
long data type, but if they do, the following treatment is
required. If gr>9, go to OTHER. If gr is even, set gr to
gr+1. Load the lower- addressed word of the long long into gr
and the higher-addressed word into gr+1, set gr to gr+2, and
go to SCAN.
--
mailto:address@hidden
- Re: [Qemu-devel] [PATCH] tcg, tci: Add TCG and interpreter for bytecode (virtual machine), Stuart Brady, 2009/10/04
- Re: [Qemu-devel] [PATCH] tcg, tci: Add TCG and interpreter for bytecode (virtual machine), Stefan Weil, 2009/10/11
- Re: [Qemu-devel] [PATCH] tcg, tci: Add TCG and interpreter for bytecode (virtual machine), Stuart Brady, 2009/10/11
- Re: [Qemu-devel] [PATCH] tcg, tci: Add TCG and interpreter for bytecode (virtual machine), malc, 2009/10/11
- Re: [Qemu-devel] [PATCH] tcg, tci: Add TCG and interpreter for bytecode (virtual machine), Stuart Brady, 2009/10/12
- Re: [Qemu-devel] [PATCH] tcg, tci: Add TCG and interpreter for bytecode (virtual machine), malc, 2009/10/12
- Re: [Qemu-devel] [PATCH] tcg, tci: Add TCG and interpreter for bytecode (virtual machine),
malc <=
- Re: [Qemu-devel] [PATCH] tcg, tci: Add TCG and interpreter for bytecode (virtual machine), Stuart Brady, 2009/10/12
- Re: [Qemu-devel] [PATCH] tcg, tci: Add TCG and interpreter for bytecode (virtual machine), malc, 2009/10/12
- Re: [Qemu-devel] [PATCH] tcg, tci: Add TCG and interpreter for bytecode (virtual machine), Stuart Brady, 2009/10/12