-
-
Notifications
You must be signed in to change notification settings - Fork 925
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
[Truffle] Support ObjectSpace.each_object for classes without deoptimisation #3501
Comments
For another reference, Sidekiq is using ObjectSpace though it wouldn't hurt it that much to hit a hard stop as it hits only at boot: |
@nirvdrum do you know how JRuby is able to run Sidekiq when it's using |
@chrisseaton jruby/core/src/main/java/org/jruby/RubyObjectSpace.java Lines 124 to 149 in f9d03ff
|
@kares yes but this is calling it with
|
oh right, that's interesting. believe its not run with |
Closing because we've moved out of this repository. |
Truffle supports
ObjectSpace.each_object
but it is currently implemented using stop-and-deoptimise-the-world, which means it's expensive to use.That's ok, as
ObjectSpace.each_object
is pretty rare, and is probably (I'm guessing - no empirical data) that it's generally used in things like testing frameworks. There is one exception, which is when it's used with classes.For example: https://github.com/rails/rails/blob/master/activesupport/lib/active_support/core_ext/class/subclasses.rb
JRuby support this specific case by maintaining a weak set of potentially live classes, which they add to whenever a class is created. We should do the same.
Important: check how this interacts with singleton classes, which we may allocate in inner loops. It should just work with singleton classes on classes and modules, I believe.
The text was updated successfully, but these errors were encountered: