On Tue, 16 Jul 2024 18:34:00 GMT, Roger Riggs <rri...@openjdk.org> wrote:

> Is there a high level description of how these methods would be used?

They would be used identically to how the `readObjectForSerialization` and 
`writeObjectForSerialization` methods are used. The caller would pass the 
object as a pseudo-"receiver" and the OIS/OOS, and it would be as if the caller 
had called a method handle to a `readObject` or `writeObject` that writes or 
reads the serializable fields of the object based on acquiring a 
`GetField`/`PutField` object.

> There seems to be a lot of generation of code that duplicates what OIS/OOS 
> already do and that seems unnecessary.

The current iteration simulates the behavior described above by generating 
methods that exactly and literally implements the behavior as specified. That 
said, I agree that there could possibly be a way to reuse OIS/OOS code for this 
instead, so that the method works *as if* it had been generated (but instead 
would be a stub which calls the relevant OIS/OOS method(s) with the appropriate 
arguments). It might require some small refactoring. My initial thought was to 
avoid touching that code as much as possible, but I can look into reusing the 
existing `Unsafe`-based code more and see what that would look like.

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

PR Comment: https://git.openjdk.org/jdk/pull/19702#issuecomment-2243219626

Reply via email to