RFR: 8308899: Introduce Classfile.Context and improve Classfile.Option(s) [v10]

Adam Sotona asotona at openjdk.org
Fri Jun 9 06:19:42 UTC 2023


On Thu, 8 Jun 2023 16:35:28 GMT, Brian Goetz <briangoetz at openjdk.org> wrote:

> I have a hard time imagining heavy parallel use here; concurrency against the same cache would most likely come from accidental sharing.  So this is not necessarily a problem.  Are you imagining differnet use cases?

I think it is common practice for example in web services to pre-configure as much of the common parts as possible (and Classfile context logically falls into that category) and then register the service to the server, which use group of thread workers to handle individual requests.
With (non-reusable) virtual threads and structured concurrency on the table makes internal use of thread locals even less sense. I can imagine a new virtual thread launched (and finished) for each individual transformation. Our `CorpusTest` relying on Junit parallelization  is not so far from that scenario (I'm not sure if Junit already uses virtual threads or just a group of workers).

It is technically irrelevant if user will share the context directly or through a `ClassModel` (for example an instrumentor class used to transform all incoming code - this BTW an idea of faster `j.l.r.ProxyGenerator` I'm thinking about). I think we should be sure that `Classfile` context (and also expansion of `ClassModel`) does not fail in parallel environments.

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

PR Comment: https://git.openjdk.org/jdk/pull/14180#issuecomment-1584034695


More information about the core-libs-dev mailing list