Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a simpler approach to compute class flags #4269

Closed
wants to merge 3 commits into from
Closed

Conversation

eregon
Copy link
Member

@eregon eregon commented Nov 8, 2016

  • The concerned core classes are all subclasses of Object,
    so there is only one set of shared flags and no need
    to decide that at runtime with complex logic.
  • Avoids loading core classes in Constants.java.
  • jruby -v is a tiny bit faster now: 0.083s vs 0.089s.

@headius Could you have a look at this?
This avoids loading a good part of JRuby classic just when using the Constants :)

* The concerned core classes are all subclasses of Object,
  so there is only one set of shared flags and no need
  to decide that at runtime with complex logic.
* Avoids loading core classes in Constants.java.
@headius
Copy link
Member

headius commented Dec 11, 2016

0.006s is not a very substantial gain for essentially reversing my Flag Registry change completely. The purpose of this registry is to avoid user error when adding new flags, which will become important as we have more specialized object forms. Your version makes it easy (again) to mess up a flag and accidentally be using it for two things, possibly by overlapping a superclass.

I think we can deal with the Constants issue another way.

@headius
Copy link
Member

headius commented Dec 11, 2016

FWIW, I intended to do a code-generation pass to make the constants in Constants be truly literal constants, since these flags can be determined at build time. That would keep the safety of the registry and address your concerns.

We could also just move these constants elsewhere.

@eregon
Copy link
Member Author

eregon commented Dec 11, 2016

I was mostly interested in the simplicity of the approach, since it seems these flags didn't change in a long time. But indeed, if many flags are added then the current system is safer.

I was in particular looking at how JRuby+Truffle uses these constants, but there is now a different Constants.java to help AOT compilation.
I'll close this then as it became a non-issue and indeed is not a big deal for startup time.

@eregon eregon closed this Dec 11, 2016
@headius headius deleted the simplify_flags branch December 15, 2016 20:36
@headius headius added this to the Invalid or Duplicate milestone Dec 15, 2016
headius added a commit that referenced this pull request Dec 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants