Hi,

I counted references of external functions in MRI/trunk.

กกhttp://www.atdot.net/sp/readonly/yr0o6k

  [Function name, Reference count, Object file name]

(sorted by refcount, funcname).

It will be help for refactoring (some functions which have few
reference count should be review).


How to make it:

$ ./ruby -v
ruby 1.9.0 (2008-09-04 revision 19114) [i686-linux]

$ objdump -t libruby-static.a .ext/i686-linux/*.so
.ext/i686-linux/**/*.so > syms

$ cat t.rb

global_syms = {}
local_syms = {}
und_syms = Hash.new(0)
file = nil

File.read('syms').each{|line|
  info = line.split(/\s+/)
  if info[3] == '.text'
    if info[1] == 'g'
      global_syms[info[5]] = file
    elsif info[1] == 'l'
      local_syms[info[5]] = file
    else
      #
    end
  elsif info[1] == '*UND*'
    und_syms[info[3]] += 1
  elsif /^(.+\.(so|o)):/ =~ info[0]
    file = $1
  else
    # p line
  end
}

st = Hash.new(0)
global_syms.each{|m, f|
  st[m] = und_syms[m]
}

st.to_a.sort_by{|(m, c)| [c, m]}.each{|(m, c)|
  p [m, c, global_syms[m]]
}


Regards,
-- 
// SASADA Koichi at atdot dot net