Integrated: 8334230: Optimize C2 classes layout

Neethu Prasad nprasad at openjdk.org
Tue Jul 30 14:10:37 UTC 2024


On Mon, 24 Jun 2024 15:53:24 GMT, Neethu Prasad <nprasad at openjdk.org> wrote:

> **Notes**
> 
> Rearrange C2 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 | Sum Members | Holes | Sum holes | Last Cacheline | Padding |
> | ----- | ----- | ---------- | --------------- | ----- | ---------- | --------------- | -------- |
> | ArrayPointer | 56 -> 48 | 1 -> 1 | 45 -> 0 | 2 ->  0 | 11 -> 0  | 56 bytes -> 48 | 0 -> 3 |
> | CallJavaNode | 152 -> 144 | 3 -> 3 | 12 -> 0 | 1 ->  0 | 5 -> 0  | 24 bytes -> 16 | 7 -> 4 |
> | C2Access | 56 -> 48 | 1-> 1 | 42 -> 0 | 1 ->  0 | 7 -> 0  | 56 bytes -> 48 | 7 -> 6 |
> | VectorSet| 32 -> 24 | 1-> 1 | 24 -> 0 | 1 ->  0 | 8 -> 0  | 32 bytes -> 24 | 1 -> 1 |
> 
> class ArrayPointer {
> 	const class Node  *        _pointer;             /*     0     8 */
> 	const class Node  *        _base;                /*     8     8 */
> 	const jlong                _constant_offset;     /*    16     8 */
> 	const class Node  *        _int_offset;          /*    24     8 */
> 	const class GrowableArray<Node*>  * _other_offsets; /*    32     8 */
> 	const jint                 _int_offset_shift;    /*    40     4 */
> 	const bool                 _is_valid;            /*    44     1 */
> public:
> 
> 
> 	/* size: 48, cachelines: 1, members: 7 */
> 	/* padding: 3 */
> 	/* last cacheline: 48 bytes */
> };
> 
> 
> 
> class CallJavaNode : public CallNode {
> public:
> 
> 	/* class CallNode            <ancestor>; */      /*     0   128 */
> protected:
> 
> 	/* --- cacheline 2 boundary (128 bytes) --- */
> 	class ciMethod *           _method;              /*   128     8 */
> 	bool                       _optimized_virtual;   /*   136     1 */
> 	bool                       _method_handle_invoke; /*   137     1 */
> 	bool                       _override_symbolic_info; /*   138     1 */
> 	bool                       _arg_escape;          /*   139     1 */
> public:
> 
> protected:
> 
> public:
> 
> 
> 	/* size: 144, cachelines: 3, members: 6 */
> 	/* padding: 4 */
> 	/* last cacheline: 16 bytes */
> 
> 	/* BRAIN FART ALERT! 144 bytes != 12 (member bytes) + 0 (member bits) + 0 (byte holes) + 0 (bit holes), diff = 1024 bits */
> };
> 
> 
> 
> class C2Access : public StackObj {
> public:
> 
> 	/* class StackObj            <ancestor>; */      /*     0     0 */
> 
> 	/* XXX last struct has 1 byte of padding */
> 
> 	int ()(void) * *           _vptr.C2Access;       /*     0     8 */
> protected:
> 
> 	DecoratorSet               _decorators;          /*     8  ...

This pull request has now been integrated.

Changeset: 1cb27f7e
Author:    Neethu Prasad <nprasad at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/1cb27f7e2355ccb911bb274fc004e5bc57fd5dc9
Stats:     17 lines in 4 files changed: 8 ins; 8 del; 1 mod

8334230: Optimize C2 classes layout

Reviewed-by: shade, kvn, thartmann

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

PR: https://git.openjdk.org/jdk/pull/19861


More information about the hotspot-dev mailing list