[Mono-devel-list] Re: Alpha corlib mismatched sizes. (64-bit issues)

Laramie Leavitt lar at leavitt.us
Wed Jul 2 02:35:05 EDT 2003

Laramie Leavitt said:
> One of the problems is verify.c, around line 2560
> 			if (klass->valuetype)
> 				struct_offset = 8
> 			else
> 				struct_offset = 0;
> change to:
> 			if( klass->valuetype )
> 				struct_offset = 2 * sizeof( void * );
> 			else
> 				struct_offset = 0;
> Laramie.
Ok, that results in the following:

field `types' mismatch in class ModuleBuilder (64 != 56)
field `cattrs' mismatch in class ModuleBuilder (72 != 64)
field `guid' mismatch in class ModuleBuilder (80 != 72)
field `table_idx' mismatch in class ModuleBuilder (88 != 80)

field `hresult' mismatch in class Exception (80 != 76)
field `source' mismatch in class Exception (88 != 80)

Looking at these, for example,

typedef struct {
	MonoObject object;
	MonoArray  *trace_ips;
	MonoObject *inner_ex;
	MonoString *message;
	MonoString *help_link;
	MonoString *class_name;
	MonoString *stack_trace;
	MonoString *remote_stack_trace;
	gint32     *remote_stack_index;
	gint32      hresult;
	MonoString *source;
} MonoException;

We see that for some reason the remote_stack_index appears to
be only 4 bytes, and then 4 bytes for the hresult.

I assume that on x86 this is from an optimization to store the pointer
in the index slot, instead of just the index. This ignores the fact that
pointers are aligned to 8 bytes on alpha, and other 64 bit archs.
Remote_stack_index should then be an gint32 instead of a gint32*.

And on to the other case:

typedef struct {
	MonoObject	obj;
	MonoImage  *image;
	MonoReflectionAssembly *assembly;
	MonoString *fqname;
	MonoString *name;
	MonoString *scopename;
	gboolean is_resource;
} MonoReflectionModule;

typedef struct {
	MonoReflectionModule module;
	MonoArray *types;
	MonoArray *cattrs;
	MonoArray *guid;
	guint32    table_idx;
	MonoReflectionAssemblyBuilder *assemblyb;
	MonoArray *global_methods;
	MonoArray *global_fields;
} MonoReflectionModuleBuilder;

This one looks like MonoReflectionModule is too large.
I suspect that adding the gboolean is_resource is the culprit,
but I don't know who did it.


More information about the Mono-devel-list mailing list