-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Implement class hierarchy method caching #387
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
Conversation
How will this affect #extend? Will #extend still clear the global method cache? |
@judofyr No. extend calls rb_include_module on the singleton class which takes care of hierarchical invalidation. Because singleton classes have no descendants, #extend is now quite cheap! |
Whoaw. Great work, as always. |
Conflicts: vm_insnhelper.h
@@ -785,12 +785,18 @@ struct RObject { | |||
/** @internal */ | |||
typedef struct rb_classext_struct rb_classext_t; | |||
|
|||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment should be at internal.h.
@ko1 I have addressed your feedback |
rb_class_remove_from_super_subclasses(obj); | ||
if (RANY(obj)->as.klass.ptr) | ||
xfree(RANY(obj)->as.klass.ptr); | ||
RANY(obj)->as.klass.ptr = NULL; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't need to clear RANY(obj)->as.klass.ptr .
I read whole of patch and it seems good.(no problem) I and Nobu discussed about this patch and we consider 32bit restriction of sp_ar_index_t is not desireble for future. Trivial points: (b) function and type names |
I agree this is the best option. I will remove sp_ar from this patch and then we can discuss adding it back later.
I don't, sorry.
Do you mean that you will fix naming after I commit this to trunk? I'm ok with this. |
Thank you for additional effort.
Ok. I'll check it.
Yes. It is trivial problem. |
This is other comments for future: (1) Can we unify method table and method caching table? (2) do you want to replace st.[ch] with sp_ar.[ch] for ID key tables? |
@charliesome: But it will cause lots of method cache misses, right? def foo(x)
x.bar
end
a = Foo.new.extend Helpers
foo(a)
b = Foo.new.extend Helpers
foo(b) // Magnus Holm |
Memory consumption for test-all. |
@judofyr Yep, the |
@ko1 I have removed sparse array, so I hope I can merge this into trunk today if it looks good to you. |
variable.c, vm.c, vm_core.c, vm_insnhelper.c, vm_insnhelper.h, vm_method.c: Implement class hierarchy method cache invalidation. [ruby-core:55053] [Feature ruby#8426] [rubyGH-387]
variable.c, vm.c, vm_core.c, vm_insnhelper.c, vm_insnhelper.h, vm_method.c: Implement class hierarchy method cache invalidation. [ruby-core:55053] [Feature ruby#8426] [rubyGH-387] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42822 b2dd03c8-39d4-4d8f-98ff-823fe69b080e Conflicts: ChangeLog class.c eval.c internal.h variable.c vm_insnhelper.c
variable.c, vm.c, vm_core.c, vm_insnhelper.c, vm_insnhelper.h, vm_method.c: Implement class hierarchy method cache invalidation. [ruby-core:55053] [Feature ruby#8426] [rubyGH-387] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42822 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
I've implemented class hierarchy method caching against the current trunk.
I've skipped a bunch of commits relating to constant caching in this pull request that were in the
klasscache-trunk
branch, because they were causing hard to resolve merge conflicts.Once this patch set is reviewed and I have merged it into SVN trunk, I'll work on implementing better constant caching again.
cc @ko1