Align instance fields to optimize object size

Project:JNode Core
Component:Code
Category:feature request
Priority:normal
Assigned:admin
Status:closed
Description

All instance fields are now aligned on 4 byte boundaries.

The instance fields should be aligned on their smallest boundary,
this means that:

boolean,byte aligned on 1 byte
char,short aligned on 2 byte
int,float aligned on 4 byte
long,double aligned on 8 byte
reference aligned on reference size

This change will impact:
- The class decoder,
- The native code compilers,
- The reflection implementation,
- The ObjectEmitter in the build
- Maybe some parts of assembler code

and in 64 bit architecture

Hi,
but in a 64 bit architecture (like AMD64) would use this:

int, float aligned on 64 byte (1x64-bit word)
long, double aligned on 128 byte (2x64-bit word)

Or not ?

And in this case will be JNode 32-bit generated classes compatibles with 64-bit classes ?

Bye,
Sandro

No need

On AMD64 it can be exactly the same as on x86.

Ewout

#1

Status:active» closed

Change has been implemented.
Limited results, since most classes use int's instead of smaller types like bytes & shorts.

#2