Граф коммитов

227 Коммитов

Автор SHA1 Сообщение Дата
tmm1 393b9e65e9 gc.c: split GC_END event into GC_END_MARK and GC_END_SWEEP
* include/ruby/ruby.h: remove INTERNAL_EVENT_GC_END and replace with
  two new events: GC_END_MARK and GC_END_SWEEP
* gc.c (gc_after_sweep): emit GC_END_SWEEP after lazy sweep is done
* gc.c (gc_marks_body): emit GC_END_MARK at end of minor/major mark
* ext/-test-/tracepoint/tracepoint.c (struct tracepoint_track): tests
  for new events.
* test/-ext-/tracepoint/test_tracepoint.rb (class TestTracepointObj):
  ditto.
* NEWS: remove ObjectSpace.after_gc_*_hook. These are only a sample,
  and will be removed before ruby 2.1.
* ext/objspace/gc_hook.c: remove ObjectSpace.after_gc_end_hook=

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43997 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-05 04:26:04 +00:00
ko1 8ca8d7afb3 * ext/objspace/object_tracing.c (newobj_i): skip class_path if class
is frozen.
  rb_class_path() can modify frozen classes (and causes errors).
  This patch is temporary. We need no-modification/no-allocation
  class path function.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43856 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-26 10:26:41 +00:00
tmm1 adcd0174b9 * ext/objspace/objspace_dump.c (dump_append_string_value): Escape
control characters for strict json parsers.
* ext/objspace/objspace_dump.c (objspace_dump): Document File/IO
  output option.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43852 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-26 05:27:22 +00:00
tmm1 302743d3e7 * NEWS: Add ObjectSpace.after_gc_{start,end}_hook=
* ext/objspace/objspace_dump.c: [DOC] catch up dump/dump_all to r43679

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43847 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-25 21:46:00 +00:00
tmm1 34176b023e * ext/objspace/objspace_dump.c: test fixes and win32 compatibility
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43824 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-24 00:22:19 +00:00
nobu 91aa8da578 objspace_dump.c: refine output
* ext/objspace/objspace_dump.c (dump_output): allow IO object as
  output, and use Tempfile.create and return open file instead of
  mkstemp() and path name for :file output.
  [ruby-core:58266] [Bug #9102]
* test/objspace/test_objspace.rb (TestObjSpace#dump_my_heap_please):
  remove temporary output file.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43679 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-14 16:06:09 +00:00
tmm1 8f3934261a * internal.h: move common string/hash flags to include file.
* ext/objspace/objspace_dump.c: remove flags shared above.
* hash.c: ditto.
* string.c: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43647 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-11 09:39:13 +00:00
nobu 00dab76f20 objspace_dump.c: fix declaration
* ext/objspace/objspace_dump.c (dump_output): fix declaration,
  mkstemp() needs a writable buffer.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43615 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-09 13:34:53 +00:00
nari baf3cf128e * ext/objspace/object_tracing.c: use declarations in internal.h.
* ext/objspace/objspace.c: ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43613 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-09 12:00:04 +00:00
nobu 671707b546 objspace_dump.c: fix portability issue
* ext/objspace/objspace_dump.c (dump_output): fix portability issue.
  mkstemp() may not be available.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43608 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-09 06:16:58 +00:00
nobu 90feeb6ab9 objspace_dump.c: extract output option utilities
* ext/objspace/objspace_dump.c (dump_output, dump_result): extract
  output option utility functions from objspace_dump() and
  objspace_dump_all().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43607 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-09 06:16:53 +00:00
nobu a50bbcfecb objspace_dump.c: suppress warnings
* ext/objspace/objspace_dump.c (dump_object): remove unused variables,
  and cast size_t to long.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43606 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-09 06:16:48 +00:00
nobu b60079fe95 objspace_dump.c: indent
* ext/objspace/objspace_dump.c: adjust indent.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43605 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-09 06:16:42 +00:00
tmm1 d0d6e2ecfa * ext/objspace/object_tracing.c: Add experimental methods to dump
objectspace as json: ObjectSpace.dump_all and ObjectSpace.dump(obj).
These methods are useful for debugging reference leaks and memory growth
in large ruby applications. [Bug #9026] [ruby-core:57893] [Fixes GH-423]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43585 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-08 17:06:55 +00:00
zzak 2cfdbd7d72 * ext/objspace/object_tracing.c: [DOC] trace_object_allocations_stop
By @srawlins [Fixes GH-421] https://github.com/ruby/ruby/pull/421


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43572 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-07 17:44:43 +00:00
ko1 d1674ef67b * gc.c: add support to estimate increase of oldspace memory usage.
This is another approach to solve an issue discussed at r43530.
  This feature is diabled as default.
  This feature measures an increment of memory consuption by oldgen
  objects. It measures memory consumption for each objects when
  the object is promoted. However, measurement of memory consumption
  is not accurate now. So that this measurement is `estimation'.
  To implement this feature, move memsize_of() function from
  ext/objspace/objspace.c and expose rb_obj_memsize_of().
  Some memsize() functions for T_DATA (T_TYPEDDATA) have problem to
  measure memory size, so that we ignores T_DATA objects now.
  For example, some functions skip NULL check for pointer.
  The macro RGENGC_ESTIMATE_OLDSPACE enables/disables this feature,
  and turned off as default.
  We need to compare 3gen GC and this feature carefully.
  (it is possible to enable both feature)
  We need a help to compare them.
* internal.h: expose rb_obj_memsize_of().
* ext/objspace/objspace.c: use rb_obj_memsize_of() function.
* cont.c (fiber_memsize): fix to check NULL.
* variable.c (autoload_memsize): ditto.
* vm.c (vm_memsize): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43532 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-05 04:51:01 +00:00
ko1 c5e08b764e * add RUBY_TYPED_FREE_IMMEDIATELY to data types which only use
safe functions during garbage collection such as xfree().
  On default, T_DATA objects are freed at same points as fianlizers.
  This approach protects issues such as reported by [ruby-dev:35578].
  However, freeing T_DATA objects immediately helps heap usage.
  Most of T_DATA (in other words, most of dfree functions) are safe.
  However, we turned off RUBY_TYPED_FREE_IMMEDIATELY by default
  for safety.
* cont.c: ditto.
* dir.c: ditto.
* encoding.c: ditto.
* enumerator.c: ditto.
* error.c: ditto.
* file.c: ditto.
* gc.c: ditto.
* io.c: ditto.
* iseq.c: ditto.
* marshal.c: ditto.
* parse.y: ditto.
* proc.c: ditto.
* process.c: ditto.
* random.c: ditto.
* thread.c: ditto.
* time.c: ditto.
* transcode.c: ditto.
* variable.c: ditto.
* vm.c: ditto.
* vm_backtrace.c: ditto.
* vm_trace.c: ditto.
* ext/bigdecimal/bigdecimal.c: ditto.
* ext/objspace/objspace.c: ditto.
* ext/stringio/stringio.c: ditto.
* ext/strscan/strscan.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-29 11:16:54 +00:00
akr 674f14a0bc * common.mk, ext/objspace/depend, ext/coverage/depend,
ext/-test-/debug/depend, ext/date/depend: Update dependencies.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43445 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-28 03:43:17 +00:00
ko1 3f28280782 * ext/objspace/object_tracing.c (newobj_i): fix memory leak.
There is possibility to remain info due to missing FREEOBJ event.
  FREEOBJ events are skipped while suppress_tracing state, for example,
  during trace events are invoking.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43327 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-17 05:07:21 +00:00
ko1 3304eb208a * ext/objspace/object_tracing.c (newobj_i): add workaround.
some bugs hits this check.
* ext/objspace/object_tracing.c (object_allocations_reporter_i): cast as pointer.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43318 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-16 23:09:41 +00:00
ko1 17e1c7237b * ext/objspace/object_tracing.c: add new method
ObjectSpace.trace_object_allocations_debug_start for GC debugging.
  If you encounter the BUG "... is T_NONE" (and so on) on your
  application, please try this method at the beggining of your app.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43310 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-16 20:21:04 +00:00
ko1 ede6826186 * ext/objspace/objspace.c: add a new method `reachable_objects_from_root'.
ObjectSpace.reachable_objects_from_root returns all objects refered
  from root (called "root objects").
  This feature is for deep object analysis.
* test/objspace/test_objspace.rb: add a test.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43301 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-16 06:13:41 +00:00
ko1 33ab98f9e6 * ext/objspace/gc_hook.c: prohibit reentrant.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43253 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-11 09:13:18 +00:00
zzak e1bb07105f * ext/objspace/objspace.c: [DOC] Cleaned up many rdoc formatting
issues and several duplicate grammar bugs.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43099 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-30 14:15:41 +00:00
zzak 8073bd792c * ext/objspace/object_tracing.c: [DOC] Adjust rdoc formatting and fix
small grammar typo


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43097 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-30 14:02:31 +00:00
ko1 1d4e3d48c2 * ext/objspace/object_tracing.c: [DOC] add some nots for
ObjectSpace::trace_object_allocations.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43096 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-30 08:29:30 +00:00
ko1 1450e0b5ac * ext/objspace/object_tracing.c: add new 3 methods to control tracing.
* ObjectSpace::trace_object_allocations_start
* ObjectSpace::trace_object_allocations_stop
* ObjectSpace::trace_object_allocations_clear
  And some refactoring.
* test/objspace/test_objspace.rb: add a test for new methods.
* NEWS: add a description for new methods.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43095 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-30 08:17:30 +00:00
zzak 31e1c32676 * ext/objspace/object_tracing.c: Return for ::allocation_generation
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41387 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-18 13:10:25 +00:00
zzak b8df950282 * ext/objspace/object_tracing.c: Document object_tracing methods.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41385 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-18 13:05:32 +00:00
zzak a8ba051341 * ext/objspace/objspace.c: Document ObjectSpace::InternalObjectWrapper.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41383 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-18 11:56:03 +00:00
zzak b46df185b2 * ext/objspace/object_tracing.c: Teach rdoc object_tracing.c [Bug #8537]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41382 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-18 11:41:28 +00:00
zzak 765b9e962f * ext/objspace/objspace.c: rdoc on require to overview from r41355
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41380 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-18 11:21:38 +00:00
eregon ba49a1e025 * ext/objspace/objspace.c: let rdoc know about objspace methods.
Specify 'objspace' should be required. See #8537.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41355 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-17 09:16:32 +00:00
eregon 089dd1a1ca * gc.c (ObjectSpace): is a module not a class.
* ext/objspace/objspace.c: try to include overview in rdoc,
  see #8537.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41354 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-17 08:44:56 +00:00
nari fbece268c7 * ext/objspace/object_tracing.c: rename allocation_info to
lookup_allocation_info. At times I confused "struct
  allocation_info" with "function allocation_info".

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41104 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-06 05:18:40 +00:00
nari 15d26c3fd9 * ext/objspace/object_tracing.c: allocation_info function isn't
called by any other file.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41103 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-06 05:10:31 +00:00
eregon 71b6077a53 * ext/objspace/objspace.c: improve wording and remove duplicated comment.
Based on a patch by Dave Goodchild. [Fixes GH-299]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41061 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-04 14:09:25 +00:00
tmm1 0a814e9b13 fix typo
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40977 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-28 20:57:14 +00:00
nobu 7d3fbdeacb object_tracing.c: fix argument type
* ext/objspace/object_tracing.c (make_unique_str): fix argument type.
  use long for string length.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40975 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-28 04:52:07 +00:00
ko1 7453c53b08 * ext/objspace/object_tracing.c: fix a bug reported at
"[ruby-core:55182] [ruby-trunk - Bug #8456][Open] Sugfault in Ruby Head"
  Care about the case TracePoint#path #=> `nil'.
* ext/objspace/object_tracing.c: add two new methods:
* ObjectSpace.allocation_class_path(o)
* ObjectSpace.allocation_method_id(o)
  They are not useful for Object.new because they are always
  "Class" and :new.
  To trace more useful information, we need to maintain call-tree
  using call/return hooks, which is implemented by
  ll-prof <http://sunagae.net/wiki/doku.php?id=software:llprof>
* test/objspace/test_objspace.rb: add a test.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40974 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-28 03:36:34 +00:00
nobu c9f982d4e8 ext/objspace: unexpand Author keywords
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40972 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-28 02:23:52 +00:00
nobu 40fe524bf3 * properties.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40971 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-27 18:16:05 +00:00
ko1 30dbed3837 * ext/objspace/gc_hook.c, ext/objspace/objspace.c: add new methods to
hook GC invocation.
* ObjectSpace.after_gc_start_hook=(proc)
* ObjectSpace.after_gc_end_hook=(proc)
  Note that hooks are not kicked immediately. Procs are kicked
  at postponed_job.
  This feature is a sample of new internal event and
  rb_postponed_job API.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40970 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-27 18:14:28 +00:00
nobu 462804fce4 suppress warnings
* ext/-test-/postponed_job/postponed_job.c (pjob_register),
  (pjob_call_direct): none void function.

* ext/-test-/tracepoint/tracepoint.c (tracepoint_track_objspace_events):
  adjust type to get rid of implicit cast.

* ext/objspace/object_tracing.c (newobj_i): ditto.

* ext/tk/tkutil/tkutil.c (tk_conv_args): adjust type against
  RHASH_SIZE().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40965 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-27 16:48:15 +00:00
ko1 f0b6cb6fc7 * include/ruby/ruby.h: rename RUBY_INTERNAL_EVENT_FREE to
RUBY_INTERNAL_EVENT_FREEOBJ.
* ext/-test-/tracepoint/tracepoint.c,
  ext/objspace/object_tracing.c,
  gc.c, vm_trace.c: catch up this change.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40959 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-27 10:28:25 +00:00
ko1 050dd10d6f * ext/objspace/objspace.c: support ObjectSpace.trace_object_allocations.
Read the following test to know HOWTO.
  This feature is a sample of RUBY_INTERNAL_EVENT.
* test/objspace/test_objspace.rb: add a test.
* ext/objspace/object_tracing.c: ditto.
* gc.c (rb_gc_count): add. THis function returns GC count.
* internal.h: add decl. of rb_gc_count(). Same as `GC.count'.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40957 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-27 10:01:45 +00:00
akr b47138580c * lib/mkmf.rb: Add ruby/ruby.h, ruby/missing.h, ruby/intern.h,
ruby/st.h and ruby/subst.h for ruby_headers in generated Makefile.

* ext/-test-/old_thread_select/depend: Update dependencies.

* ext/-test-/wait_for_single_fd/depend: Ditto.

* ext/bigdecimal/depend: Ditto.

* ext/curses/depend: Ditto.

* ext/digest/bubblebabble/depend: Ditto.

* ext/digest/depend: Ditto.

* ext/digest/md5/depend: Ditto.

* ext/digest/rmd160/depend: Ditto.

* ext/digest/sha1/depend: Ditto.

* ext/digest/sha2/depend: Ditto.

* ext/dl/callback/depend: Ditto.

* ext/dl/depend: Ditto.

* ext/etc/depend: Ditto.

* ext/nkf/depend: Ditto.

* ext/objspace/depend: Ditto.

* ext/pty/depend: Ditto.

* ext/readline/depend: Ditto.

* ext/ripper/depend: Ditto.

* ext/sdbm/depend: Ditto.

* ext/socket/depend: Ditto.

* ext/stringio/depend: Ditto.

* ext/strscan/depend: Ditto.

* ext/syslog/depend: Ditto.

* ext/-test-/num2int/depend: Removed.

* ext/dbm/depend: Ditto.

* ext/fcntl/depend: Ditto.

* ext/gdbm/depend: Ditto.

* ext/racc/cparse/depend: Ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40268 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-13 00:46:29 +00:00
sorah 3ee89c6277 * ext/objspace/objspace.c: Fix typo in doc. Patch by Sho Hashimoto.
[Bug #8116] [ruby-dev:47177]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39817 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-19 01:09:46 +00:00
nobu b4a117f8d3 objspace.c: newly added nodes
* ext/objspace/objspace.c (count_nodes): count also newly added nodes,
  and fix key for unknown node.  patch by tmm1 (Aman Gupta) in
  [ruby-core:53130] [Bug #8014]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39595 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-05 01:40:52 +00:00
nari 68d131d6a5 fix typos
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38951 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-26 09:51:34 +00:00
ko1 1c5b309211 * ext/objspace/objspace.c (iow_size): return size of internal object
for ObjectSpace.memsize_of().
* test/objspace/test_objspace.rb: add a test.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38266 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-08 00:18:42 +00:00
nobu e59e5e90c0 objspace.c: enum ruby_value_type
* ext/objspace/objspace.c (type2sym, count_objects_size): use enum
  instead of size_t which may be larger than actual values.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37316 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-24 09:49:18 +00:00
ko1 04c177e277 * ext/objspace/objspace.c (reachable_object_from_i): change data
structure of the result of reachable objects. Keys of table
  contains object_id of each reachable objects. Value of table
  is an object itself or an instance of InternalObjectWrapper.
  To avoid duplication, we use st_table and object_id keys.
* ext/objspace/objspace.c (type2sym): bug fix.
  Should use `i' instead of `type'.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37310 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-24 03:00:39 +00:00
ko1 6cbd18d7ef * ext/objspace/objspace.c (Init_objspace): add a new method
`ObjectSpace::InternalObjectWrapper#internal_object_id' which returns
  an object id of a wrapped internal object.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37308 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-24 01:21:13 +00:00
ko1 6c6dece7f1 * ext/objspace/objspace.c (ObjectSpace.reachable_objects_from):
internal object support.
  If given object `obj' has references to internal objects
  (such as T_NODE objects), then this method returns instances of
  `ObjectSpace::InternalObjectWrapper' instead of that internal objects.
  This instance contains a refereance to an internal object and you can
  check the type of internal object using
  `ObjectSpace::InternalObjectWrapper#type' method.
  Rdoc of `InternalObjectWrapper' is not prepared yet.
* gc.c (rb_objspace_reachable_objects_from), gc.h: change
  an interface of 'rb_objspace_reachable_objects_from()'
* gc.c, gc.h: add two APIs
  - rb_objspace_markable_object_p(obj): check markable or not.
  - rb_objspace_internal_object_p(obj): check internal or not.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37307 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-24 00:04:56 +00:00
ko1 e03d6d9eb8 * ext/objspace/objspace.c: add ObjectSpace#reachable_objects_from.
This method returns an array of objects referenced by given object.
  If given object is special objects such as true/false/nil/Fixnum etc
  then it returns nil. See rdoc for details.
  [ruby-core:39772]
* test/objspace/test_objspace.rb: add a test for this method.
* gc.c: add rb_objspace_reachable_objects_from().
  To make this function, add several member `mark_func_data'
  to rb_objspace_t.  If mark_func_data is not null, then
  gc_mark() calls mark_func_data::mark_func.
* gc.h: export rb_objspace_reachable_objects_from().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37094 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-05 08:14:09 +00:00
ko1 e3990633cb * insns.def (opt_checkenv): remove unused instruction `opt_checkenv'.
* compile.c (iseq_compile_each): ditto.
* node.h: remove unused node `NODE_OPTBLOCK'.
* ext/objspace/objspace.c, gc.c (gc_mark_children): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37045 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-09-28 06:44:24 +00:00
nobu 28cb8f5d20 fix null m_tbl
* ext/objspace/objspace.c (memsize_of): m_tbl in prepended
  class/module is NULL.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36235 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-27 11:36:15 +00:00
nobu b0dd250dc9 use RB_TYPE_P() instead of comparison of TYPE()
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35763 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-23 07:13:21 +00:00
nobu 84dcc38273 * regcomp.c (onig_region_memsize): implemented for memsize_of().
* ext/objspace/objspace.c (memsize_of): use it.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34050 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-15 04:15:54 +00:00
ktsj bc647cbdfb * ext/objspace/objspace.c: fix typos in a document.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32876 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-07 05:13:02 +00:00
ko1 3b32735546 * ext/objspace/objspace.c (ObjectSpace.count_tdata_objects):
Fix rdoc.
* ext/objspace/objspace.c (ObjectSpace.count_tdata_objects):
  Change key type if the klass of a object is zero (internal object).
  Read rdoc for details.
* internal.h: export rb_objspace_data_type_name().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32323 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-30 08:37:06 +00:00
ko1 7b614a53dd * ext/objspace/objspace.c (total_i): fix to skip no ruby objects.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32035 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-12 19:44:48 +00:00
nobu 52f5f410e4 * internal.h: add for internal use only.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31627 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-18 13:41:54 +00:00
ko1 0a0c657285 * ext/objspace/objspace.c (memsize_of): take care of
T_CLASS/const_tbl.
  a patch from nagachika <nagachika00@gmail.com> [ruby-dev:42490]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29628 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-29 15:29:16 +00:00
ko1 8121a4f5a8 * ext/objspace/objspace.c (ObjectSpace.memsize_of_all): rename
ObjectSpace.total_memsize_of_all_objects() to
  ObjectSpace.memsize_of_all([klass]).
  Accept Class object to filter the objects.
* test/objspace/test_objspace.rb: fix test for above change.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29624 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-28 20:23:21 +00:00
ko1 b36aa7af03 * ext/objspace/objspace.c (memsize_of): fix rdoc.
* ext/objspace/objspace.c (total_memsize_of_all_objects): added.
* test/objspace/test_objspace.rb:
  - add a test for ObjectSpace.total_memsize_of_all_objects.
  - add two tests for ObjectSpace.memsize_of (for nil and Fixnum).



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29614 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-27 18:16:39 +00:00
nobu 9f41782ec8 * ext/{coverage,objspace}/extconf.rb ($INCFLAGS): explicitly add
topdir and top_srcdir.  [ruby-dev:42031]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28987 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-14 10:12:13 +00:00
nari e573186407 * test/objspace/test_objspace.rb: added test for objspace.
* ext/objspace/objspace.c: considers T_ZOMBIE by lazy sweep GC.

* gc.c: considers that dsize was 0. [ruby-dev:42022]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28986 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-14 09:01:12 +00:00
nobu a23b1f7450 * io.c (rb_io_memsize): constified.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28981 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-14 06:19:57 +00:00
nobu a979eb4548 * regcomp.c (onig_memsize): constified.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28980 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-14 06:17:38 +00:00
nobu 23b1a3d3fa * gc.h (rb_objspace_each_objects): used in objspace.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-14 06:11:03 +00:00
nobu 977267c2e0 * ext/**/*.[ch]: removed trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27437 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-22 08:04:13 +00:00
takano32 bc664b878c Wed Sep 9 15:24:32 2009 TAKANO Mitsuhiro (takano32) <tak@no32.tk>
* include/ruby/st.h : revert previous commit.
	* ext/objspace/objspace.c : remove st_memsize declare.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24816 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-09 06:27:35 +00:00
ko1 c330876d7c * method.h, vm_core.h: add rb_method_entry_t. Remove nodes around
method management.  This change affect some VM control stack structure.
* vm.c, vm_insnhelper.c, vm_method.c, vm_eval.c: ditto.  and make some
  refactoring.
* insns.def, class.c, eval.c, proc.c, vm_dump.c : ditto.
* vm_core.h, compile.c (iseq_specialized_instruction): remove
  VM_CALL_SEND_BIT.  use another optimization tech for Kernel#send.
* node.h: remove unused node types.
* ext/objspace/objspace.c (count_nodes): ditto.
* gc.c: add mark/free functions for method entry.
* include/ruby/intern.h: remove decl of
  rb_define_notimplement_method_id().  nobody can use it
  because noex is not opend.
* iseq.c (iseq_mark): fix to check ic_method is available.
* iseq.c (rb_iseq_disasm): fix to use rb_method_get_iseq().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24128 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-15 14:59:41 +00:00
matz e0d24f31ed * variable.c (rb_generic_ivar_memsize): typo fixed. a patch from
Kazuhiro NISHIYAMA.  [ruby-dev:38700]

* ext/objspace/objspace.c (memsize_of): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23820 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-22 14:25:04 +00:00
ko1 39a770b720 * ext/objspace: added. objspace library extends some methods to
ObjectSpace module.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23719 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-16 23:56:48 +00:00