From github.com+318788+s1ck at openjdk.java.net Sun May 2 10:49:59 2021 From: github.com+318788+s1ck at openjdk.java.net (Martin Junghanns) Date: Sun, 2 May 2021 10:49:59 GMT Subject: RFR: Bring back support for GPR visitors In-Reply-To: References: Message-ID: On Mon, 12 Apr 2021 16:00:49 GMT, Martin Junghanns wrote: > Hey @shipilev First of all: Thanks for this useful library. I wanted to switch from jol 0.10 to 0.15 in one of my projects because of some issues on openJDK 15. I discovered that the ability to register visitors had been removed at some point. The interface `org.openjdk.jol.info.GraphVisitor` is actually still around. I find that feature quite useful as it allows users to compute some custom statistics of the object graph. I tried to use the `GraphLayout` to access the GPRs, but it's all package-private. > > It would be nice if we could bring the feature back. Also, if you think the approach is not ideal, we can maybe figure out something else. > > Thanks for your time. gentle ping @shipilev Would be great if we could get this merged and released :) ------------- PR: https://git.openjdk.java.net/jol/pull/15 From shade at openjdk.java.net Wed May 5 17:31:58 2021 From: shade at openjdk.java.net (Aleksey Shipilev) Date: Wed, 5 May 2021 17:31:58 GMT Subject: RFR: Bring back support for GPR visitors In-Reply-To: References: Message-ID: <8JfisoWof4E2TFv6Dh_xC1zxMhZsCDhspQaaSI9Jcn4=.e2e76000-d152-4e29-a805-21696985160a@github.com> On Mon, 12 Apr 2021 16:00:49 GMT, Martin Junghanns wrote: > Hey @shipilev First of all: Thanks for this useful library. I wanted to switch from jol 0.10 to 0.15 in one of my projects because of some issues on openJDK 15. I discovered that the ability to register visitors had been removed at some point. The interface `org.openjdk.jol.info.GraphVisitor` is actually still around. I find that feature quite useful as it allows users to compute some custom statistics of the object graph. I tried to use the `GraphLayout` to access the GPRs, but it's all package-private. > > It would be nice if we could bring the feature back. Also, if you think the approach is not ideal, we can maybe figure out something else. > > Thanks for your time. Sorry this got neglected. The underlying reason to remove GPRs was to simplify (and thus optimize) the walkers. I'll try to arrange time to see what can be done here without sacrificing that again. ------------- PR: https://git.openjdk.java.net/jol/pull/15 From github.com+318788+s1ck at openjdk.java.net Fri May 7 15:24:59 2021 From: github.com+318788+s1ck at openjdk.java.net (Martin Junghanns) Date: Fri, 7 May 2021 15:24:59 GMT Subject: RFR: Bring back support for GPR visitors In-Reply-To: References: Message-ID: <0xLnEshGtIuRA7cL5EKpz25TYwIazZVJrNj2XC7DYZY=.b5384351-164a-4924-aba3-4bbb13a4f886@github.com> On Mon, 12 Apr 2021 16:00:49 GMT, Martin Junghanns wrote: > Hey @shipilev First of all: Thanks for this useful library. I wanted to switch from jol 0.10 to 0.15 in one of my projects because of some issues on openJDK 15. I discovered that the ability to register visitors had been removed at some point. The interface `org.openjdk.jol.info.GraphVisitor` is actually still around. I find that feature quite useful as it allows users to compute some custom statistics of the object graph. I tried to use the `GraphLayout` to access the GPRs, but it's all package-private. > > It would be nice if we could bring the feature back. Also, if you think the approach is not ideal, we can maybe figure out something else. > > Thanks for your time. I can share our usage pattern. We are interested in the `path` and the `size`. Maybe it helps when designing a different / faster visitor logic: https://github.com/neo4j/graph-data-science/blob/master/proc/catalog/src/main/java/org/neo4j/gds/catalog/GraphMemoryUsageProc.java#L98-L149 ------------- PR: https://git.openjdk.java.net/jol/pull/15 From shade at openjdk.java.net Mon May 10 12:12:04 2021 From: shade at openjdk.java.net (Aleksey Shipilev) Date: Mon, 10 May 2021 12:12:04 GMT Subject: RFR: CODETOOLS-7902930: JOL: Bring back GraphWalker visitors In-Reply-To: References: Message-ID: On Mon, 12 Apr 2021 16:00:49 GMT, Martin Junghanns wrote: > Hey @shipilev First of all: Thanks for this useful library. I wanted to switch from jol 0.10 to 0.15 in one of my projects because of some issues on openJDK 15. I discovered that the ability to register visitors had been removed at some point. The interface `org.openjdk.jol.info.GraphVisitor` is actually still around. I find that feature quite useful as it allows users to compute some custom statistics of the object graph. I tried to use the `GraphLayout` to access the GPRs, but it's all package-private. > > It would be nice if we could bring the feature back. Also, if you think the approach is not ideal, we can maybe figure out something else. > > Thanks for your time. I did some benchmarking, and I think what you have is nearly the best we can do. I would like to avoid a few (sometimes virtual) calls on the walker hotpath. To that extent, please consider this change (note the `Map` -> `HashMap` rewrite too): private final GraphVisitor[] visitors; private final HashMap, Long> sizeCache; public GraphWalker(GraphVisitor... visitors) { this.visitors = visitors; sizeCache = new HashMap<>(); } ...and then inline `visitObject` into two use sites. I think you would be able to do `new GraphWalker(gpr -> { ... }).walk(...)` then. ------------- Changes requested by shade (Committer). PR: https://git.openjdk.java.net/jol/pull/15 From shade at redhat.com Mon May 10 12:35:09 2021 From: shade at redhat.com (Aleksey Shipilev) Date: Mon, 10 May 2021 14:35:09 +0200 Subject: JOL is broken on module path In-Reply-To: References: Message-ID: On 4/17/21 1:19 PM, Zheka Kozlov wrote: > What do you think? Ha, hm. I think the whole trampoline thing does not work on JDK 17, and needs a bit of redesign. Let me take a look. -- Thanks, -Aleksey From shade at redhat.com Mon May 10 18:04:06 2021 From: shade at redhat.com (Aleksey Shipilev) Date: Mon, 10 May 2021 20:04:06 +0200 Subject: JOL is broken on module path In-Reply-To: References: Message-ID: On 5/10/21 2:35 PM, Aleksey Shipilev wrote: > On 4/17/21 1:19 PM, Zheka Kozlov wrote: >> What do you think? > > Ha, hm. I think the whole trampoline thing does not work on JDK 17, and needs a bit of redesign. Let > me take a look. This would be "fixed" (in some sense of the word) with: https://bugs.openjdk.java.net/browse/CODETOOLS-7902931 https://github.com/openjdk/jol/pull/16 -- Thanks, -Aleksey From shade at openjdk.java.net Mon May 10 18:09:24 2021 From: shade at openjdk.java.net (Aleksey Shipilev) Date: Mon, 10 May 2021 18:09:24 GMT Subject: RFR: CODETOOLS-7902931: JOL: Rework magic field offset accessor Message-ID: <1zELq89HkmpMzLp8zMuofFoLlwzUkaKvKhV82YZgd24=.adc31b78-16ce-4e51-af99-903f3a657d05@github.com> See the bug report for discussion. Current JDK 17 EA: $ cat MyRecord.java record MyRecord(int x, int y) {} $ java -jar jol-cli/target/jol-cli.jar internals -cp . MyRecord ... java.lang.RuntimeException: Cannot get the field offset, try with -Djol.magicFieldOffset=true at org.openjdk.jol.vm.HotspotUnsafe.fieldOffset(HotspotUnsafe.java:455) at org.openjdk.jol.layouters.CurrentLayouter.layout(CurrentLayouter.java:70) at org.openjdk.jol.info.ClassLayout.parseInstance(ClassLayout.java:102) at org.openjdk.jol.info.ClassLayout.parseInstance(ClassLayout.java:85) at org.openjdk.jol.operations.ObjectInternals.runWith(ObjectInternals.java:51) at org.openjdk.jol.operations.ClasspathedOperation.run(ClasspathedOperation.java:76) at org.openjdk.jol.Main.main(Main.java:58) Caused by: java.lang.UnsupportedOperationException: can't get field offset on a record class: private final int MyRecord.x at jdk.unsupported/sun.misc.Unsafe.objectFieldOffset(Unsafe.java:648) at org.openjdk.jol.vm.HotspotUnsafe.fieldOffset(HotspotUnsafe.java:448) ... 6 more $ java -Djol.magicFieldOffset=true -jar jol-cli/target/jol-cli.jar internals -cp . MyRecord ... MyRecord object internals: OFF SZ TYPE DESCRIPTION VALUE 0 8 (object header: mark) 0x0000000000000001 (non-biasable; age: 0) 8 4 (object header: class) 0x00218180 12 4 int MyRecord.x 0 16 4 int MyRecord.y 0 20 4 (object alignment gap) Instance size: 24 bytes Space losses: 0 bytes internal + 4 bytes external = 4 bytes total ------------- Commit messages: - Rework magic field offset Changes: https://git.openjdk.java.net/jol/pull/16/files Webrev: https://webrevs.openjdk.java.net/?repo=jol&pr=16&range=00 Issue: https://bugs.openjdk.java.net/browse/CODETOOLS-7902931 Stats: 235 lines in 2 files changed: 106 ins; 121 del; 8 mod Patch: https://git.openjdk.java.net/jol/pull/16.diff Fetch: git fetch https://git.openjdk.java.net/jol pull/16/head:pull/16 PR: https://git.openjdk.java.net/jol/pull/16 From shade at openjdk.java.net Mon May 10 18:24:18 2021 From: shade at openjdk.java.net (Aleksey Shipilev) Date: Mon, 10 May 2021 18:24:18 GMT Subject: RFR: CODETOOLS-7902931: JOL: Rework magic field offset accessor [v2] In-Reply-To: <1zELq89HkmpMzLp8zMuofFoLlwzUkaKvKhV82YZgd24=.adc31b78-16ce-4e51-af99-903f3a657d05@github.com> References: <1zELq89HkmpMzLp8zMuofFoLlwzUkaKvKhV82YZgd24=.adc31b78-16ce-4e51-af99-903f3a657d05@github.com> Message-ID: > See the bug report for discussion. > > Basic sanity test: > > > $ cat MyRecord.java > record MyRecord(int x, int y) {} > > > Current JDK 17 EA, out-of-box: > > > $ java -jar jol-cli/target/jol-cli.jar internals -cp . MyRecord > ... > > java.lang.RuntimeException: Cannot get the field offset, try with -Djol.magicFieldOffset=true > at org.openjdk.jol.vm.HotspotUnsafe.fieldOffset(HotspotUnsafe.java:455) > at org.openjdk.jol.layouters.CurrentLayouter.layout(CurrentLayouter.java:70) > at org.openjdk.jol.info.ClassLayout.parseInstance(ClassLayout.java:102) > at org.openjdk.jol.info.ClassLayout.parseInstance(ClassLayout.java:85) > at org.openjdk.jol.operations.ObjectInternals.runWith(ObjectInternals.java:51) > at org.openjdk.jol.operations.ClasspathedOperation.run(ClasspathedOperation.java:76) > at org.openjdk.jol.Main.main(Main.java:58) > Caused by: java.lang.UnsupportedOperationException: can't get field offset on a record class: private final int MyRecord.x > at jdk.unsupported/sun.misc.Unsafe.objectFieldOffset(Unsafe.java:648) > at org.openjdk.jol.vm.HotspotUnsafe.fieldOffset(HotspotUnsafe.java:448) > ... 6 more > > > Current JDK 17 EA, with `-Djol.magicFieldOffset=true`: > > > $ java -Djol.magicFieldOffset=true -jar jol-cli/target/jol-cli.jar internals -cp . MyRecord > ... > > MyRecord object internals: > OFF SZ TYPE DESCRIPTION VALUE > 0 8 (object header: mark) 0x0000000000000001 (non-biasable; age: 0) > 8 4 (object header: class) 0x00218180 > 12 4 int MyRecord.x 0 > 16 4 int MyRecord.y 0 > 20 4 (object alignment gap) > Instance size: 24 bytes > Space losses: 0 bytes internal + 4 bytes external = 4 bytes total Aleksey Shipilev has updated the pull request incrementally with one additional commit since the last revision: Update comments ------------- Changes: - all: https://git.openjdk.java.net/jol/pull/16/files - new: https://git.openjdk.java.net/jol/pull/16/files/45f3822d..e4f8bce2 Webrevs: - full: https://webrevs.openjdk.java.net/?repo=jol&pr=16&range=01 - incr: https://webrevs.openjdk.java.net/?repo=jol&pr=16&range=00-01 Stats: 19 lines in 1 file changed: 7 ins; 0 del; 12 mod Patch: https://git.openjdk.java.net/jol/pull/16.diff Fetch: git fetch https://git.openjdk.java.net/jol pull/16/head:pull/16 PR: https://git.openjdk.java.net/jol/pull/16 From shade at openjdk.java.net Mon May 10 18:33:23 2021 From: shade at openjdk.java.net (Aleksey Shipilev) Date: Mon, 10 May 2021 18:33:23 GMT Subject: RFR: CODETOOLS-7902931: JOL: Rework magic field offset accessor [v3] In-Reply-To: <1zELq89HkmpMzLp8zMuofFoLlwzUkaKvKhV82YZgd24=.adc31b78-16ce-4e51-af99-903f3a657d05@github.com> References: <1zELq89HkmpMzLp8zMuofFoLlwzUkaKvKhV82YZgd24=.adc31b78-16ce-4e51-af99-903f3a657d05@github.com> Message-ID: > See the bug report for discussion. > > Basic sanity test: > > > $ cat MyRecord.java > record MyRecord(int x, int y) {} > > > Current JDK 17 EA, out-of-box: > > > $ java -jar jol-cli/target/jol-cli.jar internals -cp . MyRecord > ... > > java.lang.RuntimeException: Cannot get the field offset, try with -Djol.magicFieldOffset=true > at org.openjdk.jol.vm.HotspotUnsafe.fieldOffset(HotspotUnsafe.java:455) > at org.openjdk.jol.layouters.CurrentLayouter.layout(CurrentLayouter.java:70) > at org.openjdk.jol.info.ClassLayout.parseInstance(ClassLayout.java:102) > at org.openjdk.jol.info.ClassLayout.parseInstance(ClassLayout.java:85) > at org.openjdk.jol.operations.ObjectInternals.runWith(ObjectInternals.java:51) > at org.openjdk.jol.operations.ClasspathedOperation.run(ClasspathedOperation.java:76) > at org.openjdk.jol.Main.main(Main.java:58) > Caused by: java.lang.UnsupportedOperationException: can't get field offset on a record class: private final int MyRecord.x > at jdk.unsupported/sun.misc.Unsafe.objectFieldOffset(Unsafe.java:648) > at org.openjdk.jol.vm.HotspotUnsafe.fieldOffset(HotspotUnsafe.java:448) > ... 6 more > > > Current JDK 17 EA, with `-Djol.magicFieldOffset=true`: > > > $ java -Djol.magicFieldOffset=true -jar jol-cli/target/jol-cli.jar internals -cp . MyRecord > ... > > MyRecord object internals: > OFF SZ TYPE DESCRIPTION VALUE > 0 8 (object header: mark) 0x0000000000000001 (non-biasable; age: 0) > 8 4 (object header: class) 0x00218180 > 12 4 int MyRecord.x 0 > 16 4 int MyRecord.y 0 > 20 4 (object alignment gap) > Instance size: 24 bytes > Space losses: 0 bytes internal + 4 bytes external = 4 bytes total Aleksey Shipilev has updated the pull request incrementally with one additional commit since the last revision: Even more comments ------------- Changes: - all: https://git.openjdk.java.net/jol/pull/16/files - new: https://git.openjdk.java.net/jol/pull/16/files/e4f8bce2..062d106f Webrevs: - full: https://webrevs.openjdk.java.net/?repo=jol&pr=16&range=02 - incr: https://webrevs.openjdk.java.net/?repo=jol&pr=16&range=01-02 Stats: 7 lines in 1 file changed: 5 ins; 0 del; 2 mod Patch: https://git.openjdk.java.net/jol/pull/16.diff Fetch: git fetch https://git.openjdk.java.net/jol pull/16/head:pull/16 PR: https://git.openjdk.java.net/jol/pull/16 From github.com+415502+stokito at openjdk.java.net Mon May 10 18:51:03 2021 From: github.com+415502+stokito at openjdk.java.net (Sergey Ponomarev) Date: Mon, 10 May 2021 18:51:03 GMT Subject: RFR: CODETOOLS-7902931: JOL: Rework magic field offset accessor [v3] In-Reply-To: References: <1zELq89HkmpMzLp8zMuofFoLlwzUkaKvKhV82YZgd24=.adc31b78-16ce-4e51-af99-903f3a657d05@github.com> Message-ID: On Mon, 10 May 2021 18:33:23 GMT, Aleksey Shipilev wrote: >> See the bug report for discussion. >> >> Basic sanity test: >> >> >> $ cat MyRecord.java >> record MyRecord(int x, int y) {} >> >> >> Current JDK 17 EA, out-of-box: >> >> >> $ java -jar jol-cli/target/jol-cli.jar internals -cp . MyRecord >> ... >> >> java.lang.RuntimeException: Cannot get the field offset, try with -Djol.magicFieldOffset=true >> at org.openjdk.jol.vm.HotspotUnsafe.fieldOffset(HotspotUnsafe.java:455) >> at org.openjdk.jol.layouters.CurrentLayouter.layout(CurrentLayouter.java:70) >> at org.openjdk.jol.info.ClassLayout.parseInstance(ClassLayout.java:102) >> at org.openjdk.jol.info.ClassLayout.parseInstance(ClassLayout.java:85) >> at org.openjdk.jol.operations.ObjectInternals.runWith(ObjectInternals.java:51) >> at org.openjdk.jol.operations.ClasspathedOperation.run(ClasspathedOperation.java:76) >> at org.openjdk.jol.Main.main(Main.java:58) >> Caused by: java.lang.UnsupportedOperationException: can't get field offset on a record class: private final int MyRecord.x >> at jdk.unsupported/sun.misc.Unsafe.objectFieldOffset(Unsafe.java:648) >> at org.openjdk.jol.vm.HotspotUnsafe.fieldOffset(HotspotUnsafe.java:448) >> ... 6 more >> >> >> Current JDK 17 EA, with `-Djol.magicFieldOffset=true`: >> >> >> $ java -Djol.magicFieldOffset=true -jar jol-cli/target/jol-cli.jar internals -cp . MyRecord >> ... >> >> MyRecord object internals: >> OFF SZ TYPE DESCRIPTION VALUE >> 0 8 (object header: mark) 0x0000000000000001 (non-biasable; age: 0) >> 8 4 (object header: class) 0x00218180 >> 12 4 int MyRecord.x 0 >> 16 4 int MyRecord.y 0 >> 20 4 (object alignment gap) >> Instance size: 24 bytes >> Space losses: 0 bytes internal + 4 bytes external = 4 bytes total > > Aleksey Shipilev has updated the pull request incrementally with one additional commit since the last revision: > > Even more comments Marked as reviewed by stokito at github.com (no known OpenJDK username). ------------- PR: https://git.openjdk.java.net/jol/pull/16 From shade at openjdk.java.net Tue May 11 06:38:26 2021 From: shade at openjdk.java.net (Aleksey Shipilev) Date: Tue, 11 May 2021 06:38:26 GMT Subject: RFR: CODETOOLS-7902931: JOL: Rework magic field offset accessor [v4] In-Reply-To: <1zELq89HkmpMzLp8zMuofFoLlwzUkaKvKhV82YZgd24=.adc31b78-16ce-4e51-af99-903f3a657d05@github.com> References: <1zELq89HkmpMzLp8zMuofFoLlwzUkaKvKhV82YZgd24=.adc31b78-16ce-4e51-af99-903f3a657d05@github.com> Message-ID: > See the bug report for discussion. > > Basic sanity test: > > > $ cat MyRecord.java > record MyRecord(int x, int y) {} > > > Current JDK 17 EA, out-of-box: > > > $ java -jar jol-cli/target/jol-cli.jar internals -cp . MyRecord > ... > > java.lang.RuntimeException: Cannot get the field offset, try with -Djol.magicFieldOffset=true > at org.openjdk.jol.vm.HotspotUnsafe.fieldOffset(HotspotUnsafe.java:455) > at org.openjdk.jol.layouters.CurrentLayouter.layout(CurrentLayouter.java:70) > at org.openjdk.jol.info.ClassLayout.parseInstance(ClassLayout.java:102) > at org.openjdk.jol.info.ClassLayout.parseInstance(ClassLayout.java:85) > at org.openjdk.jol.operations.ObjectInternals.runWith(ObjectInternals.java:51) > at org.openjdk.jol.operations.ClasspathedOperation.run(ClasspathedOperation.java:76) > at org.openjdk.jol.Main.main(Main.java:58) > Caused by: java.lang.UnsupportedOperationException: can't get field offset on a record class: private final int MyRecord.x > at jdk.unsupported/sun.misc.Unsafe.objectFieldOffset(Unsafe.java:648) > at org.openjdk.jol.vm.HotspotUnsafe.fieldOffset(HotspotUnsafe.java:448) > ... 6 more > > > Current JDK 17 EA, with `-Djol.magicFieldOffset=true`: > > > $ java -Djol.magicFieldOffset=true -jar jol-cli/target/jol-cli.jar internals -cp . MyRecord > ... > > MyRecord object internals: > OFF SZ TYPE DESCRIPTION VALUE > 0 8 (object header: mark) 0x0000000000000001 (non-biasable; age: 0) > 8 4 (object header: class) 0x00218180 > 12 4 int MyRecord.x 0 > 16 4 int MyRecord.y 0 > 20 4 (object alignment gap) > Instance size: 24 bytes > Space losses: 0 bytes internal + 4 bytes external = 4 bytes total Aleksey Shipilev has updated the pull request incrementally with one additional commit since the last revision: Simplify the verification loop ------------- Changes: - all: https://git.openjdk.java.net/jol/pull/16/files - new: https://git.openjdk.java.net/jol/pull/16/files/062d106f..0d6380ef Webrevs: - full: https://webrevs.openjdk.java.net/?repo=jol&pr=16&range=03 - incr: https://webrevs.openjdk.java.net/?repo=jol&pr=16&range=02-03 Stats: 6 lines in 1 file changed: 1 ins; 0 del; 5 mod Patch: https://git.openjdk.java.net/jol/pull/16.diff Fetch: git fetch https://git.openjdk.java.net/jol pull/16/head:pull/16 PR: https://git.openjdk.java.net/jol/pull/16 From duke at openjdk.java.net Tue May 11 07:14:34 2021 From: duke at openjdk.java.net (duke) Date: Tue, 11 May 2021 07:14:34 GMT Subject: git: openjdk/jol: CODETOOLS-7902931: JOL: Rework magic field offset accessor Message-ID: <0e1a7b22-113b-40f3-bb6d-0826e5f2bd48@openjdk.java.net> Changeset: 5dafe85a Author: Aleksey Shipil?v Committer: GitHub Date: 2021-05-11 09:13:44 +0000 URL: https://git.openjdk.java.net/jol/commit/5dafe85a1fca52342cb965e673513b76768ab945 CODETOOLS-7902931: JOL: Rework magic field offset accessor - jol-core/src/main/java/java/lang/JOLUnsafeTrampoline.java ! jol-core/src/main/java/org/openjdk/jol/vm/HotspotUnsafe.java From shade at openjdk.java.net Tue May 11 07:16:02 2021 From: shade at openjdk.java.net (Aleksey Shipilev) Date: Tue, 11 May 2021 07:16:02 GMT Subject: Withdrawn: CODETOOLS-7902931: JOL: Rework magic field offset accessor In-Reply-To: <1zELq89HkmpMzLp8zMuofFoLlwzUkaKvKhV82YZgd24=.adc31b78-16ce-4e51-af99-903f3a657d05@github.com> References: <1zELq89HkmpMzLp8zMuofFoLlwzUkaKvKhV82YZgd24=.adc31b78-16ce-4e51-af99-903f3a657d05@github.com> Message-ID: On Mon, 10 May 2021 18:02:51 GMT, Aleksey Shipilev wrote: > See the bug report for discussion. > > Basic sanity test: > > > $ cat MyRecord.java > record MyRecord(int x, int y) {} > > > Current JDK 17 EA, out-of-box: > > > $ java -jar jol-cli/target/jol-cli.jar internals -cp . MyRecord > ... > > java.lang.RuntimeException: Cannot get the field offset, try with -Djol.magicFieldOffset=true > at org.openjdk.jol.vm.HotspotUnsafe.fieldOffset(HotspotUnsafe.java:455) > at org.openjdk.jol.layouters.CurrentLayouter.layout(CurrentLayouter.java:70) > at org.openjdk.jol.info.ClassLayout.parseInstance(ClassLayout.java:102) > at org.openjdk.jol.info.ClassLayout.parseInstance(ClassLayout.java:85) > at org.openjdk.jol.operations.ObjectInternals.runWith(ObjectInternals.java:51) > at org.openjdk.jol.operations.ClasspathedOperation.run(ClasspathedOperation.java:76) > at org.openjdk.jol.Main.main(Main.java:58) > Caused by: java.lang.UnsupportedOperationException: can't get field offset on a record class: private final int MyRecord.x > at jdk.unsupported/sun.misc.Unsafe.objectFieldOffset(Unsafe.java:648) > at org.openjdk.jol.vm.HotspotUnsafe.fieldOffset(HotspotUnsafe.java:448) > ... 6 more > > > Current JDK 17 EA, with `-Djol.magicFieldOffset=true`: > > > $ java -Djol.magicFieldOffset=true -jar jol-cli/target/jol-cli.jar internals -cp . MyRecord > ... > > MyRecord object internals: > OFF SZ TYPE DESCRIPTION VALUE > 0 8 (object header: mark) 0x0000000000000001 (non-biasable; age: 0) > 8 4 (object header: class) 0x00218180 > 12 4 int MyRecord.x 0 > 16 4 int MyRecord.y 0 > 20 4 (object alignment gap) > Instance size: 24 bytes > Space losses: 0 bytes internal + 4 bytes external = 4 bytes total This pull request has been closed without being integrated. ------------- PR: https://git.openjdk.java.net/jol/pull/16 From shade at openjdk.java.net Tue May 11 07:52:20 2021 From: shade at openjdk.java.net (Aleksey Shipilev) Date: Tue, 11 May 2021 07:52:20 GMT Subject: RFR: CODETOOLS-7902932: JOL: Update test JDK lists for GHA Message-ID: Align test JDK lists with the currently released/important JDKs. ------------- Commit messages: - Update JDK lists Changes: https://git.openjdk.java.net/jol/pull/17/files Webrev: https://webrevs.openjdk.java.net/?repo=jol&pr=17&range=00 Issue: https://bugs.openjdk.java.net/browse/CODETOOLS-7902932 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod Patch: https://git.openjdk.java.net/jol/pull/17.diff Fetch: git fetch https://git.openjdk.java.net/jol pull/17/head:pull/17 PR: https://git.openjdk.java.net/jol/pull/17 From duke at openjdk.java.net Tue May 11 07:57:04 2021 From: duke at openjdk.java.net (duke) Date: Tue, 11 May 2021 07:57:04 GMT Subject: git: openjdk/jol: CODETOOLS-7902932: JOL: Update test JDK lists for GHA Message-ID: <26629caf-11bf-4991-a4a9-158e0482ee1d@openjdk.java.net> Changeset: eb9083e1 Author: Aleksey Shipil?v Committer: GitHub Date: 2021-05-11 09:56:19 +0000 URL: https://git.openjdk.java.net/jol/commit/eb9083e1cc2ef6befa1feb5d780d380c0400d737 CODETOOLS-7902932: JOL: Update test JDK lists for GHA ! .github/workflows/pre-integration.yml From shade at openjdk.java.net Tue May 11 07:59:02 2021 From: shade at openjdk.java.net (Aleksey Shipilev) Date: Tue, 11 May 2021 07:59:02 GMT Subject: Withdrawn: CODETOOLS-7902932: JOL: Update test JDK lists for GHA In-Reply-To: References: Message-ID: On Tue, 11 May 2021 07:48:26 GMT, Aleksey Shipilev wrote: > Align test JDK lists with the currently released/important JDKs. This pull request has been closed without being integrated. ------------- PR: https://git.openjdk.java.net/jol/pull/17 From github.com+761899+orionll at openjdk.java.net Tue May 11 10:50:03 2021 From: github.com+761899+orionll at openjdk.java.net (Zheka Kozlov) Date: Tue, 11 May 2021 10:50:03 GMT Subject: RFR: CODETOOLS-7902931: JOL: Rework magic field offset accessor [v4] In-Reply-To: References: <1zELq89HkmpMzLp8zMuofFoLlwzUkaKvKhV82YZgd24=.adc31b78-16ce-4e51-af99-903f3a657d05@github.com> Message-ID: On Tue, 11 May 2021 06:38:26 GMT, Aleksey Shipilev wrote: >> See the bug report for discussion. >> >> Basic sanity test: >> >> >> $ cat MyRecord.java >> record MyRecord(int x, int y) {} >> >> >> Current JDK 17 EA, out-of-box: >> >> >> $ java -jar jol-cli/target/jol-cli.jar internals -cp . MyRecord >> ... >> >> java.lang.RuntimeException: Cannot get the field offset, try with -Djol.magicFieldOffset=true >> at org.openjdk.jol.vm.HotspotUnsafe.fieldOffset(HotspotUnsafe.java:455) >> at org.openjdk.jol.layouters.CurrentLayouter.layout(CurrentLayouter.java:70) >> at org.openjdk.jol.info.ClassLayout.parseInstance(ClassLayout.java:102) >> at org.openjdk.jol.info.ClassLayout.parseInstance(ClassLayout.java:85) >> at org.openjdk.jol.operations.ObjectInternals.runWith(ObjectInternals.java:51) >> at org.openjdk.jol.operations.ClasspathedOperation.run(ClasspathedOperation.java:76) >> at org.openjdk.jol.Main.main(Main.java:58) >> Caused by: java.lang.UnsupportedOperationException: can't get field offset on a record class: private final int MyRecord.x >> at jdk.unsupported/sun.misc.Unsafe.objectFieldOffset(Unsafe.java:648) >> at org.openjdk.jol.vm.HotspotUnsafe.fieldOffset(HotspotUnsafe.java:448) >> ... 6 more >> >> >> Current JDK 17 EA, with `-Djol.magicFieldOffset=true`: >> >> >> $ java -Djol.magicFieldOffset=true -jar jol-cli/target/jol-cli.jar internals -cp . MyRecord >> ... >> >> MyRecord object internals: >> OFF SZ TYPE DESCRIPTION VALUE >> 0 8 (object header: mark) 0x0000000000000001 (non-biasable; age: 0) >> 8 4 (object header: class) 0x00218180 >> 12 4 int MyRecord.x 0 >> 16 4 int MyRecord.y 0 >> 20 4 (object alignment gap) >> Instance size: 24 bytes >> Space losses: 0 bytes internal + 4 bytes external = 4 bytes total > > Aleksey Shipilev has updated the pull request incrementally with one additional commit since the last revision: > > Simplify the verification loop jol-core/src/main/java/org/openjdk/jol/vm/HotspotUnsafe.java line 58: > 56: > 57: private static final boolean MAGIC_FIELD_OFFSET = > 58: Boolean.parseBoolean(System.getProperty(MAGIC_FIELD_OFFSET_OPTION, "false")); Can be replaced with `Boolean.getBoolean(MAGIC_FIELD_OFFSET_OPTION)` ------------- PR: https://git.openjdk.java.net/jol/pull/16 From shade at openjdk.java.net Wed May 12 05:36:59 2021 From: shade at openjdk.java.net (Aleksey Shipilev) Date: Wed, 12 May 2021 05:36:59 GMT Subject: RFR: CODETOOLS-7902930: JOL: Bring back GraphWalker visitors In-Reply-To: <0xLnEshGtIuRA7cL5EKpz25TYwIazZVJrNj2XC7DYZY=.b5384351-164a-4924-aba3-4bbb13a4f886@github.com> References: <0xLnEshGtIuRA7cL5EKpz25TYwIazZVJrNj2XC7DYZY=.b5384351-164a-4924-aba3-4bbb13a4f886@github.com> Message-ID: On Fri, 7 May 2021 15:22:27 GMT, Martin Junghanns wrote: >> Hey @shipilev First of all: Thanks for this useful library. I wanted to switch from jol 0.10 to 0.15 in one of my projects because of some issues on openJDK 15. I discovered that the ability to register visitors had been removed at some point. The interface `org.openjdk.jol.info.GraphVisitor` is actually still around. I find that feature quite useful as it allows users to compute some custom statistics of the object graph. I tried to use the `GraphLayout` to access the GPRs, but it's all package-private. >> >> It would be nice if we could bring the feature back. Also, if you think the approach is not ideal, we can maybe figure out something else. >> >> Thanks for your time. > > I can share our usage pattern. We are interested in the `path` and the `size`. Maybe it helps when designing a different / faster visitor logic: https://github.com/neo4j/graph-data-science/blob/master/proc/catalog/src/main/java/org/neo4j/gds/catalog/GraphMemoryUsageProc.java#L98-L149 @s1ck, if you want to release it this week, please finish this up :) Otherwise, the release would slip until next week. ------------- PR: https://git.openjdk.java.net/jol/pull/15 From shade at openjdk.java.net Mon May 17 09:56:48 2021 From: shade at openjdk.java.net (Aleksey Shipilev) Date: Mon, 17 May 2021 09:56:48 GMT Subject: RFR: CODETOOLS-7902930: JOL: Bring back GraphWalker visitors In-Reply-To: <0xLnEshGtIuRA7cL5EKpz25TYwIazZVJrNj2XC7DYZY=.b5384351-164a-4924-aba3-4bbb13a4f886@github.com> References: <0xLnEshGtIuRA7cL5EKpz25TYwIazZVJrNj2XC7DYZY=.b5384351-164a-4924-aba3-4bbb13a4f886@github.com> Message-ID: On Fri, 7 May 2021 15:22:27 GMT, Martin Junghanns wrote: >> Hey @shipilev First of all: Thanks for this useful library. I wanted to switch from jol 0.10 to 0.15 in one of my projects because of some issues on openJDK 15. I discovered that the ability to register visitors had been removed at some point. The interface `org.openjdk.jol.info.GraphVisitor` is actually still around. I find that feature quite useful as it allows users to compute some custom statistics of the object graph. I tried to use the `GraphLayout` to access the GPRs, but it's all package-private. >> >> It would be nice if we could bring the feature back. Also, if you think the approach is not ideal, we can maybe figure out something else. >> >> Thanks for your time. > > I can share our usage pattern. We are interested in the `path` and the `size`. Maybe it helps when designing a different / faster visitor logic: https://github.com/neo4j/graph-data-science/blob/master/proc/catalog/src/main/java/org/neo4j/gds/catalog/GraphMemoryUsageProc.java#L98-L149 Hey @s1ck, tell me what your plan is, so we can... err... plan accordingly. I think everything is ready for the release, if you want to hook this patch up there too. ------------- PR: https://git.openjdk.java.net/jol/pull/15 From shade at openjdk.java.net Thu May 20 15:34:44 2021 From: shade at openjdk.java.net (Aleksey Shipilev) Date: Thu, 20 May 2021 15:34:44 GMT Subject: RFR: CODETOOLS-7902930: JOL: Bring back GraphWalker visitors In-Reply-To: <0xLnEshGtIuRA7cL5EKpz25TYwIazZVJrNj2XC7DYZY=.b5384351-164a-4924-aba3-4bbb13a4f886@github.com> References: <0xLnEshGtIuRA7cL5EKpz25TYwIazZVJrNj2XC7DYZY=.b5384351-164a-4924-aba3-4bbb13a4f886@github.com> Message-ID: On Fri, 7 May 2021 15:22:27 GMT, Martin Junghanns wrote: >> Hey @shipilev First of all: Thanks for this useful library. I wanted to switch from jol 0.10 to 0.15 in one of my projects because of some issues on openJDK 15. I discovered that the ability to register visitors had been removed at some point. The interface `org.openjdk.jol.info.GraphVisitor` is actually still around. I find that feature quite useful as it allows users to compute some custom statistics of the object graph. I tried to use the `GraphLayout` to access the GPRs, but it's all package-private. >> >> It would be nice if we could bring the feature back. Also, if you think the approach is not ideal, we can maybe figure out something else. >> >> Thanks for your time. > > I can share our usage pattern. We are interested in the `path` and the `size`. Maybe it helps when designing a different / faster visitor logic: https://github.com/neo4j/graph-data-science/blob/master/proc/catalog/src/main/java/org/neo4j/gds/catalog/GraphMemoryUsageProc.java#L98-L149 Pinging @s1ck again! ------------- PR: https://git.openjdk.java.net/jol/pull/15 From github.com+318788+s1ck at openjdk.java.net Fri May 21 09:33:07 2021 From: github.com+318788+s1ck at openjdk.java.net (Martin Junghanns) Date: Fri, 21 May 2021 09:33:07 GMT Subject: RFR: CODETOOLS-7902930: JOL: Bring back GraphWalker visitors [v2] In-Reply-To: References: Message-ID: > Hey @shipilev First of all: Thanks for this useful library. I wanted to switch from jol 0.10 to 0.15 in one of my projects because of some issues on openJDK 15. I discovered that the ability to register visitors had been removed at some point. The interface `org.openjdk.jol.info.GraphVisitor` is actually still around. I find that feature quite useful as it allows users to compute some custom statistics of the object graph. I tried to use the `GraphLayout` to access the GPRs, but it's all package-private. > > It would be nice if we could bring the feature back. Also, if you think the approach is not ideal, we can maybe figure out something else. > > Thanks for your time. Martin Junghanns has updated the pull request incrementally with one additional commit since the last revision: Avoid virtual calls in GraphWalker#walk ------------- Changes: - all: https://git.openjdk.java.net/jol/pull/15/files - new: https://git.openjdk.java.net/jol/pull/15/files/0d75043b..c47ac838 Webrevs: - full: https://webrevs.openjdk.java.net/?repo=jol&pr=15&range=01 - incr: https://webrevs.openjdk.java.net/?repo=jol&pr=15&range=00-01 Stats: 25 lines in 1 file changed: 5 ins; 14 del; 6 mod Patch: https://git.openjdk.java.net/jol/pull/15.diff Fetch: git fetch https://git.openjdk.java.net/jol pull/15/head:pull/15 PR: https://git.openjdk.java.net/jol/pull/15 From shade at openjdk.java.net Fri May 21 09:50:38 2021 From: shade at openjdk.java.net (Aleksey Shipilev) Date: Fri, 21 May 2021 09:50:38 GMT Subject: RFR: CODETOOLS-7902930: JOL: Bring back GraphWalker visitors [v2] In-Reply-To: References: Message-ID: <4TqJqQqOrPzaYhZ9PfgC7XQ6B9VW7ONrUvX3710Hjgk=.24214935-322a-4e31-9b72-d92757c9db50@github.com> On Fri, 21 May 2021 09:33:07 GMT, Martin Junghanns wrote: >> Hey @shipilev First of all: Thanks for this useful library. I wanted to switch from jol 0.10 to 0.15 in one of my projects because of some issues on openJDK 15. I discovered that the ability to register visitors had been removed at some point. The interface `org.openjdk.jol.info.GraphVisitor` is actually still around. I find that feature quite useful as it allows users to compute some custom statistics of the object graph. I tried to use the `GraphLayout` to access the GPRs, but it's all package-private. >> >> It would be nice if we could bring the feature back. Also, if you think the approach is not ideal, we can maybe figure out something else. >> >> Thanks for your time. > > Martin Junghanns has updated the pull request incrementally with one additional commit since the last revision: > > Avoid virtual calls in GraphWalker#walk Thanks, this is good to go in. ------------- Marked as reviewed by shade (Committer). PR: https://git.openjdk.java.net/jol/pull/15 From github.com+318788+s1ck at openjdk.java.net Fri May 21 10:04:39 2021 From: github.com+318788+s1ck at openjdk.java.net (Martin Junghanns) Date: Fri, 21 May 2021 10:04:39 GMT Subject: RFR: CODETOOLS-7902930: JOL: Bring back GraphWalker visitors In-Reply-To: References: <0xLnEshGtIuRA7cL5EKpz25TYwIazZVJrNj2XC7DYZY=.b5384351-164a-4924-aba3-4bbb13a4f886@github.com> Message-ID: On Thu, 20 May 2021 15:32:05 GMT, Aleksey Shipilev wrote: >> I can share our usage pattern. We are interested in the `path` and the `size`. Maybe it helps when designing a different / faster visitor logic: https://github.com/neo4j/graph-data-science/blob/master/proc/catalog/src/main/java/org/neo4j/gds/catalog/GraphMemoryUsageProc.java#L98-L149 > > Pinging @s1ck again! @shipilev thanks for the review and sorry for not reacting so quickly ?? ------------- PR: https://git.openjdk.java.net/jol/pull/15 From shade at openjdk.java.net Fri May 21 10:19:37 2021 From: shade at openjdk.java.net (Aleksey Shipilev) Date: Fri, 21 May 2021 10:19:37 GMT Subject: RFR: CODETOOLS-7902930: JOL: Bring back GraphWalker visitors [v2] In-Reply-To: References: Message-ID: On Fri, 21 May 2021 09:33:07 GMT, Martin Junghanns wrote: >> Hey @shipilev First of all: Thanks for this useful library. I wanted to switch from jol 0.10 to 0.15 in one of my projects because of some issues on openJDK 15. I discovered that the ability to register visitors had been removed at some point. The interface `org.openjdk.jol.info.GraphVisitor` is actually still around. I find that feature quite useful as it allows users to compute some custom statistics of the object graph. I tried to use the `GraphLayout` to access the GPRs, but it's all package-private. >> >> It would be nice if we could bring the feature back. Also, if you think the approach is not ideal, we can maybe figure out something else. >> >> Thanks for your time. > > Martin Junghanns has updated the pull request incrementally with one additional commit since the last revision: > > Avoid virtual calls in GraphWalker#walk No problem at all. ------------- PR: https://git.openjdk.java.net/jol/pull/15 From github.com+318788+s1ck at openjdk.java.net Fri May 21 10:19:38 2021 From: github.com+318788+s1ck at openjdk.java.net (Martin Junghanns) Date: Fri, 21 May 2021 10:19:38 GMT Subject: Integrated: CODETOOLS-7902930: JOL: Bring back GraphWalker visitors In-Reply-To: References: Message-ID: <2sfEkft_wfD5eU1hFjXZ96WsQtZA87kM-CW-PBzgKAE=.d58f49fc-fb8d-479f-8bbe-4d25b92b61d0@github.com> On Mon, 12 Apr 2021 16:00:49 GMT, Martin Junghanns wrote: > Hey @shipilev First of all: Thanks for this useful library. I wanted to switch from jol 0.10 to 0.15 in one of my projects because of some issues on openJDK 15. I discovered that the ability to register visitors had been removed at some point. The interface `org.openjdk.jol.info.GraphVisitor` is actually still around. I find that feature quite useful as it allows users to compute some custom statistics of the object graph. I tried to use the `GraphLayout` to access the GPRs, but it's all package-private. > > It would be nice if we could bring the feature back. Also, if you think the approach is not ideal, we can maybe figure out something else. > > Thanks for your time. This pull request has now been integrated. Changeset: 517f7e17 Author: Martin Junghanns Committer: Aleksey Shipilev URL: https://git.openjdk.java.net/jol/commit/517f7e179c31eb44e5ffd1785b91176a3e385e4d Stats: 19 lines in 4 files changed: 9 ins; 2 del; 8 mod 7902930: JOL: Bring back GraphWalker visitors Reviewed-by: shade ------------- PR: https://git.openjdk.java.net/jol/pull/15 From shade at redhat.com Fri May 21 12:18:28 2021 From: shade at redhat.com (Aleksey Shipilev) Date: Fri, 21 May 2021 14:18:28 +0200 Subject: JOL 0.16 Message-ID: <3bceb7f7-9261-bb64-f276-0b883f47932a@redhat.com> Hi, JOL 0.16 is released and available on Maven Central. This release ships with a few compatibility fixes. *) API change: Neo4J apparently uses some of the API that was rolled back for performance reasons. This patch re-instantiates the visitors that use case wants. (Note: this whole thing is still an experimental API, but we are trying to play nice where possible). Initial patch provided by Martin Junghanns. 7902930: JOL: Bring back GraphWalker visitors *) The hack to get Record internals was reworked to again be possible on JDK 17+. Unfortunately, it becomes ever so dangerous, and so it is disabled by default. Users can opt-in when they need deeper introspection with "internals" dump. This also solves the split-package problem when using JOL as module: we no longer ship anything from java.lang.* 7902931: JOL: Rework magic field offset accessor -- Thanks, -Aleksey From duke at openjdk.java.net Fri May 21 13:59:58 2021 From: duke at openjdk.java.net (duke) Date: Fri, 21 May 2021 13:59:58 GMT Subject: git: openjdk/jol: 2 new changesets Message-ID: Changeset: 8e6f172b Author: Aleksey Shipilev Date: 2021-05-21 12:49:49 +0000 URL: https://git.openjdk.java.net/jol/commit/8e6f172b0940a725bf217ab9acb473d4d8082120 JOL v0.16. ! jol-benchmarks/pom.xml ! jol-cli/pom.xml ! jol-core/pom.xml ! jol-samples/pom.xml ! pom.xml Changeset: 5d72f262 Author: Aleksey Shipilev Date: 2021-05-21 12:50:11 +0000 URL: https://git.openjdk.java.net/jol/commit/5d72f262b215a05cd66d71c06a0e38ac437490a0 Continue in 0.17-SNAPSHOT ! jol-benchmarks/pom.xml ! jol-cli/pom.xml ! jol-core/pom.xml ! jol-samples/pom.xml ! pom.xml From shade at openjdk.java.net Fri May 21 14:12:22 2021 From: shade at openjdk.java.net (Aleksey Shipilev) Date: Fri, 21 May 2021 14:12:22 GMT Subject: RFR: CODETOOLS-7902930: JOL: Bring back GraphWalker visitors [v2] In-Reply-To: References: Message-ID: On Fri, 21 May 2021 09:33:07 GMT, Martin Junghanns wrote: >> Hey @shipilev First of all: Thanks for this useful library. I wanted to switch from jol 0.10 to 0.15 in one of my projects because of some issues on openJDK 15. I discovered that the ability to register visitors had been removed at some point. The interface `org.openjdk.jol.info.GraphVisitor` is actually still around. I find that feature quite useful as it allows users to compute some custom statistics of the object graph. I tried to use the `GraphLayout` to access the GPRs, but it's all package-private. >> >> It would be nice if we could bring the feature back. Also, if you think the approach is not ideal, we can maybe figure out something else. >> >> Thanks for your time. > > Martin Junghanns has updated the pull request incrementally with one additional commit since the last revision: > > Avoid virtual calls in GraphWalker#walk Delivered in JOL 0.16. ------------- PR: https://git.openjdk.java.net/jol/pull/15 From inikonov at sdl.com Wed May 26 10:15:20 2021 From: inikonov at sdl.com (Igor Nikonov) Date: Wed, 26 May 2021 10:15:20 +0000 Subject: JOL has an thread-safe issue with Message-ID: We had to change GraphLayout.parseInstance(this) .totalSize(); with GraphLayout graphLayout = null; synchronized (Sizeable.class) { graphLayout = GraphLayout.parseInstance(this); } return (int) graphLayout.totalSize(); in order to avoid getting Igor Nikonov | R&D, Tridion | RWS Group Group Technology 61, Kopernika street 16, Kyiv, Ukraine M: +38 (0)66 400 8171 www.rws.com This email including any files transmitted with it are confidential and may contain privileged information intended solely for the use of the individual or entity to whom they are addressed. If you are not the named addressee you must not use, disclose, copy, disseminate or print its contents or any attachments. If you have received this email in error please notify the sender by replying to this message. Emails sent or received can be recorded and may be monitored for internal compliance purposes. SECURITY WARNING: Although this e-mail and its attachments have been screened and are believed to be free from any virus, it is the responsibility of the recipient to ensure that they are virus free. The originator will not accept any liability for any loss or damage caused by a virus. From shade at redhat.com Wed May 26 10:28:54 2021 From: shade at redhat.com (Aleksey Shipilev) Date: Wed, 26 May 2021 12:28:54 +0200 Subject: JOL has an thread-safe issue with In-Reply-To: References: Message-ID: <77aa1bcf-05e4-92ab-8feb-434e2887e0a0@redhat.com> On 5/26/21 12:15 PM, Igor Nikonov wrote: > We had to change > > GraphLayout.parseInstance(this) .totalSize(); > > with > > GraphLayout graphLayout = null; > synchronized (Sizeable.class) { > graphLayout = GraphLayout.parseInstance(this); > } > return (int) graphLayout.totalSize(); > > in order to avoid getting (this message seem to be truncated) Avoid getting what? -- Thanks, -Aleksey