Project

General

Profile

Backport #8149

[patch] iseq: remove duplicate strings for file paths

Added by tmm1 (Aman Gupta) over 6 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Normal
[ruby-core:53639]

Description

with:
./ruby -Ilib -e' GC.start; p ObjectSpace.each_object(String).to_a.select{ |s| s =~ /rubygems\/defaults/ }.inject(Hash.new 0){|h,s| h[s]+=1; h} '

before:
{"/Users/test/code/ruby-trunk/lib/rubygems/defaults.rb"=>3}

after:
{"/Users/test/code/ruby-trunk/lib/rubygems/defaults.rb"=>1}

diff --git a/iseq.c b/iseq.c
index 288d3bf..72c92bd 100644
--- a/iseq.c
+++ b/iseq.c
@@ -188,7 +188,10 @@ iseq_location_setup(rb_iseq_t *iseq, VALUE path, VALUE absolute_path, VALUE name
{
rb_iseq_location_t *loc = &iseq->location;
loc->path = path;

  • loc->absolute_path = absolute_path;
  • if (RTEST(absolute_path) && rb_str_cmp(path, absolute_path) == 0)
  • loc->absolute_path = path;
  • else
  • loc->absolute_path = absolute_path; loc->label = loc->base_label = name; loc->first_lineno = first_lineno; return loc;

Associated revisions

Revision cef6a377
Added by tmm1 (Aman Gupta) over 6 years ago

iseq.c: remove duplicated strings for file paths

  • iseq.c (iseq_location_setup): re-use existing string when iseq has the same path and absolute_path. [Bug #8149]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40334 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 40334
Added by tmm1 (Aman Gupta) over 6 years ago

iseq.c: remove duplicated strings for file paths

  • iseq.c (iseq_location_setup): re-use existing string when iseq has the same path and absolute_path. [Bug #8149]

Revision 40334
Added by tmm1 (Aman Gupta) over 6 years ago

iseq.c: remove duplicated strings for file paths

  • iseq.c (iseq_location_setup): re-use existing string when iseq has the same path and absolute_path. [Bug #8149]

Revision 40334
Added by tmm1 (Aman Gupta) over 6 years ago

iseq.c: remove duplicated strings for file paths

  • iseq.c (iseq_location_setup): re-use existing string when iseq has the same path and absolute_path. [Bug #8149]

Revision 40334
Added by tmm1 (Aman Gupta) over 6 years ago

iseq.c: remove duplicated strings for file paths

  • iseq.c (iseq_location_setup): re-use existing string when iseq has the same path and absolute_path. [Bug #8149]

Revision 40334
Added by tmm1 (Aman Gupta) over 6 years ago

iseq.c: remove duplicated strings for file paths

  • iseq.c (iseq_location_setup): re-use existing string when iseq has the same path and absolute_path. [Bug #8149]

Revision 40334
Added by tmm1 (Aman Gupta) over 6 years ago

iseq.c: remove duplicated strings for file paths

  • iseq.c (iseq_location_setup): re-use existing string when iseq has the same path and absolute_path. [Bug #8149]

Revision 5f628a07
Added by naruse (Yui NARUSE) over 6 years ago

iseq.c: remove duplicated strings for file paths

  • iseq.c (iseq_location_setup): re-use existing string when iseq has the same path and absolute_path. [Bug #8149]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40350 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 40350
Added by naruse (Yui NARUSE) over 6 years ago

iseq.c: remove duplicated strings for file paths

  • iseq.c (iseq_location_setup): re-use existing string when iseq has the same path and absolute_path. [Bug #8149]

Revision 40350
Added by naruse (Yui NARUSE) over 6 years ago

iseq.c: remove duplicated strings for file paths

  • iseq.c (iseq_location_setup): re-use existing string when iseq has the same path and absolute_path. [Bug #8149]

Revision 40350
Added by naruse (Yui NARUSE) over 6 years ago

iseq.c: remove duplicated strings for file paths

  • iseq.c (iseq_location_setup): re-use existing string when iseq has the same path and absolute_path. [Bug #8149]

Revision 40350
Added by naruse (Yui NARUSE) over 6 years ago

iseq.c: remove duplicated strings for file paths

  • iseq.c (iseq_location_setup): re-use existing string when iseq has the same path and absolute_path. [Bug #8149]

Revision 40350
Added by naruse (Yui NARUSE) over 6 years ago

iseq.c: remove duplicated strings for file paths

  • iseq.c (iseq_location_setup): re-use existing string when iseq has the same path and absolute_path. [Bug #8149]

Revision 40350
Added by naruse (Yui NARUSE) over 6 years ago

iseq.c: remove duplicated strings for file paths

  • iseq.c (iseq_location_setup): re-use existing string when iseq has the same path and absolute_path. [Bug #8149]

Revision 3207cfce
Added by nagachika (Tomoyuki Chikanaga) about 6 years ago

merge revision(s) 40334: [Backport #8149]

    * iseq.c (iseq_location_setup): re-use existing string when iseq has
      the same path and absolute_path. [Bug #8149]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@42089 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 42089
Added by nagachika (Tomoyuki Chikanaga) about 6 years ago

merge revision(s) 40334: [Backport #8149]

* iseq.c (iseq_location_setup): re-use existing string when iseq has
  the same path and absolute_path. [Bug #8149]

History

#1

Updated by tmm1 (Aman Gupta) over 6 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r40334.
Aman, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


iseq.c: remove duplicated strings for file paths

  • iseq.c (iseq_location_setup): re-use existing string when iseq has the same path and absolute_path. [Bug #8149]
#2

Updated by tmm1 (Aman Gupta) over 6 years ago

  • Tracker changed from Bug to Backport
  • Project changed from Ruby master to Backport200
  • Status changed from Closed to Assigned
  • Assignee changed from ko1 (Koichi Sasada) to nagachika (Tomoyuki Chikanaga)
#3

Updated by nagachika (Tomoyuki Chikanaga) about 6 years ago

  • Status changed from Assigned to Closed

This issue was solved with changeset r42089.
Aman, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


merge revision(s) 40334: [Backport #8149]

* iseq.c (iseq_location_setup): re-use existing string when iseq has
  the same path and absolute_path. [Bug #8149]

Also available in: Atom PDF