Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [omr-dev] How to avoid OMR compiler static instance



On 31 May 2018 at 20:55, Irwin D'Souza <dsouzai@xxxxxxxxxx> wrote:


I believe the JitConfig is a singleton because it holds some global variables that are used at least in downstream projects such as OpenJ9. The MonitorTable is a singleton because it is a single repository that the compiler can use to get hold of monitors it might need; again, this is something that OpenJ9 uses.

Okay. It would be nice to document what is global state and why. 

What use case are you considering that would benefit from these objects not being singletons?

Depending on what is maintained globally it might not be a big issue. An immediate issue is having to initialize the global state - I work with Lua VM which is designed such that multiple instances can be easily created. Often users can create these instances and I don't have control over that. Having global state means I need to somehow initialize the state / and cleanup too - but how/when?  Right now I am trying out a reference counting approach for this. 

Regards
Dibyendu

Back to the top