Permalink
Browse files

Make debugging of global serial bumping easier

This gives us an option to see where the global serial is increased, to
find for example cases where this causes constant lookup caches to
invalidate.
  • Loading branch information...
dbussink committed Feb 26, 2013
1 parent ce3aa52 commit 4d029101608faa6164391f6aba192f2fd5198dff
Showing with 10 additions and 2 deletions.
  1. +3 −0 lib/rubinius/configuration.rb
  2. +1 −0 vm/agent_components.cpp
  3. +5 −1 vm/builtin/system.cpp
  4. +1 −1 vm/builtin/system.hpp
@@ -164,6 +164,9 @@
c.vm_variable "ic.debug", false,
"Print out when inline caches are reset"
+ c.vm_variable "serial.debug", false,
+ "Print out when the global serial increases"
+
c.vm_variable "allocation_tracking", false,
"Enable allocation tracking for new objects"
View
@@ -527,6 +527,7 @@ namespace agent {
Tree* jit = system_->get_tree("jit");
jit->add(new ReadAtomicInteger("cache_resets", state->shared().stats.methods_cache_resets));
+ jit->add(new ReadInteger<int>("global_serial", state->shared().global_serial_address()));
jit->add(new ReadAtomicInteger("methods", state->shared().stats.jitted_methods));
jit->add(new ReadAtomicInteger("time", state->shared().stats.jit_time_spent));
View
@@ -1066,7 +1066,11 @@ namespace rubinius {
return obj->kind_of_p(state, mod) ? cTrue : cFalse;
}
- Object* System::vm_inc_global_serial(STATE) {
+ Object* System::vm_inc_global_serial(STATE, CallFrame* calling_environment) {
+ if(state->shared().config.serial_debug) {
+ std::cout << "[Global serial increased from " << state->shared().global_serial() << "]" << std::endl;
+ calling_environment->print_backtrace(state, 6, true);
+ }
return Fixnum::from(state->shared().inc_global_serial(state));
}
View
@@ -249,7 +249,7 @@ namespace rubinius {
// Increment the internal global serial number, used for caching
// Rubinius.primitive :vm_inc_global_serial
- static Object* vm_inc_global_serial(STATE);
+ static Object* vm_inc_global_serial(STATE, CallFrame* calling_environment);
// Print out the current backtrace of ruby code
// Rubinius.primitive :vm_show_backtrace

0 comments on commit 4d02910

Please sign in to comment.