On Fri, 21 Feb 2025 16:04:57 GMT, Chen Liang <li...@openjdk.org> wrote:
>> src/java.base/share/classes/java/lang/invoke/X-VarHandleSegmentView.java.template >> line 77: >> >>> 75: } >>> 76: >>> 77: @ForceInline >> >> Question: can this and the `offset` method go in the >> `VarHandleSegmentViewBase` class? They don't seem to depend on anything in >> these classes - so it seems mostly duplicated code? > > Now this will require code update to static import `offset` from > `VarHandleSegmentViewBase`. Is that acceptable? Maybe let's leave it, at least in this round >> src/java.base/share/classes/jdk/internal/foreign/layout/ValueLayouts.java >> line 164: >> >>> 162: @ForceInline >>> 163: public final VarHandle varHandle() { >>> 164: record VarHandleCache() implements >>> Function<AbstractValueLayout<?>, VarHandle> { >> >> Can this cache be removed? The var handles created here should be "direct" >> -- meaning that we don't expect LayoutPath to add any adaptations on top of >> what's already done in the "raw" var handle returned by >> `Utils:makeRawSegmentViewVarHandle`? > > We have two caches, one in `ValueLayouts` and another in `Utils`. Should we > remove both? I'm not convinced about the one in ValueLayouts *e.g. where this comment was added) -- if you agree that the other cache should already handle this -- then maybe we can only keep one ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/23720#discussion_r1966002718 PR Review Comment: https://git.openjdk.org/jdk/pull/23720#discussion_r1965999335