On Fri, 7 Aug 2026 15:25:24 GMT, Chris Plummer <[email protected]> wrote:
>> For now, value objects can be tagged. The important thing that JVMTI agent >> maintainers needs to understsand is that there isn't an ObjectFree event for >> value objects so can't be used to know when a value object is GC'ed. There >> is a sentence in the "Object Tags" section but that's deep in the spec and I >> think the intention with the "Identity and Value Objects" section was to >> have a summary of differences in the introduction. >> >> Yes, it's hard to explain what an object tag means for a value object. The >> JLS and API docs are moving to use the term "indistinguishable" which makes >> me wonder if something along these lines could work here: >> >> "Value objects can be tagged by <jvmti/>, but the tag is associated with the >> object’s class and field values, as it has no identity. Two value object >> references are indistinguishable if they are the same class and their fields >> have indistinguishable values. Indistinguishable value objects have the same >> tag." > > Maybe you can also add something like "Tagging a value object effectively > tags all indistinguishable value objects", although I think the wording could > be better. > > I think one thing we lost sight of is the text that comes in the just before > the text being added: > > "...but some specific functions will behave differently if invoked upon a > Java object that does not have identity. Such differences in behavior are > described by the individual functions and events where they apply." > > Yet we are describing the difference here rather than in the tagging section. > The ObjectFree section does mention it not being call for value objects. If > we want a summary here, it should be a summary of where there are > differences, but instead of fully describing each difference, just include a > link to the text the more fully describes the difference. > > Also, I just noticed GetObjectsWithTags, which might need some clarification > w.r.t. value objects to make it clear it only returns one of each > indistinguishable value object. The intention of this tweak was to be minor and satisfy Alan's request. It looks like this becomes not minor anymore as we are discussing a bigger scope. :) What I would like to avoid is going to different directions force and back. This intro section is itself a compromise. The intention was to provide summary of differences. Now we want to make those differences understandable right away which is not always possible without going into details. The JVMTI spec is full of spots which are not perfect and under-specified sometimes. But we do not want it to be over-specified either. There has to be some balance here. Now I'm lost in what direction to go. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/32211#discussion_r3738641120
