RFR: 8334232: Optimize C1 classes layout

Neethu Prasad nprasad at openjdk.org
Wed Jul 24 21:15:32 UTC 2024


On Tue, 9 Jul 2024 21:20:03 GMT, Paul Hohensee <phh at openjdk.org> wrote:

>> **Notes**
>> 
>> Rearrange C1 class fields to optimize footprint.
>> 
>> 
>> **Verification**
>> 
>> 1. Ran tier2_compiler, hotspot_compiler, tier 1 & tier 2 tests.
>> 2. Ran pahole on 64 bit machine post re-ordering and verified that there are no holes / reduction in total bytes.
>> 
>> | Class | Size | Cachelines | Holes | Sum holes | Last Cacheline | Padding |
>> | ----- | ----- | ---------- | ----- | ---------- | --------------- | -------- |
>> | Instruction | 96 -> 88 | 2 -> 2  |  2 -> 0  |  8 -> 0  | 32 -> 24  | 1 -> 1  |
>> | Intrinsic | 136 -> 120 | 3 -> 2  |  1 -> 1  | 4 -> 96   |  8 ->  56 |  4-> 0 |
>> | LIR_Address | 48 -> 40 | 1 -> 1  |  1-> 0  | 4 -> 0  |  48 -> 40 | 7 -> 3   |
>> | LIR_Op2 | 128 -> 120  | 2 -> 2  | 2 -> 0  |  11 -> 0  | N/A -> 56  | 4 -> 7  |
>> | LIR_Op4 | 136 -> 128  | 3 -> 2  | 1-> 0  |  7 -> 0 |  8-> 0  |  4 ->  3 |
>> | LIR_OpAllocArray  | 120 -> 112  | 2 -> 2  | 1-> 0   |  7 -> 0  | 56 -> 48 |  7 -> 6 |
>> |LIR_OpTypeCheck  | 144 -> 136  | 3 -> 3  | 1-> 0  |  7 -> 0  |  16 ->  8 |  3 -> 2  |
>> 
>> 
>> 
>> /* class CompilationResourceObj <ancestor>; */   /*     0     0 */
>> 
>> 	/* XXX last struct has 1 byte of padding */
>> 
>> 	int ()(void) * *           _vptr.Instruction;    /*     0     8 */
>> 	int                        _id;                  /*     8     4 */
>> 	int                        _use_count;           /*    12     4 */
>> 	int                        _pin_state;           /*    16     4 */
>> 	unsigned int               _flags;               /*    20     4 */
>> 	class ValueType *          _type;                /*    24     8 */
>> 	class Instruction *        _next;                /*    32     8 */
>> 	class Instruction *        _subst;               /*    40     8 */
>> 	class LIR_Opr             _operand;              /*    48     8 */
>> 	class ValueStack *         _state_before;        /*    56     8 */
>> 	/* --- cacheline 1 boundary (64 bytes) --- */
>> 	class ValueStack *         _exception_state;     /*    64     8 */
>> 	class XHandlers *          _exception_handlers;  /*    72     8 */
>> protected:
>> 
>> 	class BlockBegin *         _block;               /*    80     8 */
>> public:
>> 
>> 
>> 	/* Bitfield combined with previous fields */
>> 
>> 	static const int                  no_bci;        /*     0     0 */
>> protected:
>> 
>> public:
>> 
>> 
>> 	/* size: 88, cachelines: 2, members: 14, static members: 1 */
>> 	/* paddings: 1, sum paddings: 1 */
>> 	/* last cacheline: 24 bytes */
>> };
>> 
>> 
>> 
>> 
>> class LIR_Address : public LIR_OprPtr {
> ...
>
> Lgtm.

@phohensee @vnkozlov 
Thanks for the review & approval.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/20017#issuecomment-2248906941


More information about the hotspot-compiler-dev mailing list