[Mono-list] ppc patch

Paolo Molaro lupus@ximian.com
Mon, 21 Jan 2002 17:02:22 +0100


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).

>  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.

> 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;
	...
	}

lupus

-- 
-----------------------------------------------------------------
lupus@debian.org                                     debian/rules
lupus@ximian.com                             Monkeys do it better