[Mono-list] ppc patch
Radek Doulík
rodo@ximian.com
21 Jan 2002 19:04:33 -0500
On Po, 2002-01-21 at 11:02, Paolo Molaro wrote:
> On 01/21/02 Radek Doulík wrote:
> > Otherwise it passes all but delegate tests as on x86. Delegates are not
> > implemented at all at this point.
>
> (delegates should work on x86).
Yeah, what I wanted to say was: ppc now passes all tests which x86 does
with only one exception. delegate.cs passes on x86 but not on ppc
(because we don't have delegates generation for ppc yet).
> > typedef enum {
> > + f0 = 0,
> [...]
> > + f31
> > +} PPCFloatRegister;
>
> In the interest of avoiding namespace pollution I suggest prefixing
> all the identifiers withh ppc_ and PPC_ as appropriate.
I think ppc-codegen.h is private to tramp.c, but OK, I've prefixed
everything there.
> > Index: mono/metadata/icall.c
> [...]
> > +#if G_BYTE_ORDER != G_LITTLE_ENDIAN
> > +#define SWAP(n) \
> > + gint i; \
> > + guint ## n tmp; \
> > + guint ## n *data = (guint ## n *) mono_array_addr (array, char, 0); \
> > +\
> > + for (i = 0; i < size; i += n/8, data++) { \
> > + tmp = read ## n (data); \
> > + *data = tmp; \
> > + }
> > +
> > + name = klass->element_class->name;
> > + printf ("Initialize array with elements of %s type\n", name);
> > +
> > + if (name [0] == 'I') {
> > + if (name [1] == 'n' && name [2] == 't') {
> > + if (name [3] == '3' && name [4] == '2' && name [5] == 0) {
> > + SWAP (32);
>
> Here you should simply switch on the simple type in element class:
>
> switch (klass->element_class->byval_arg.type) {
> case MONO_TYPE_CHAR:
> case MONO_TYPE_I2:
> case MONO_TYPE_U2:
> SWAP (16);
> break;
> case MONO_TYPE_I4:
> case MONO_TYPE_U4:
> SWAP (32);
> break;
> ...
Cool, this is what I've been looking for, thanks a lot!
Updated patch is commited.
Best wishes
Radek