Useless external functions

Hi,

I counted references of external functions in MRI/trunk.

e$B!!e(Bhttp://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)):confused: =~ 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,

Hello

While you are looking at this - are the visible symbols in libruby
prefixed with something like ruby_ or rb_?

There seem to be a few random functions here and there, the st_, vm_
iseq_ and insn_ stuff.
Also oniguruma has many symbols in that list. As I understand it Ruby
uses a modified Oniguruma so people who would like to use Ruby and
Oniguruma might have a hard time putting it together.

With 1.8 I had some trouble linking a program using a standalone regex
library with libruby as there was something like regex_start in both.

Thanks

Michal

On 06/09/2008, Charles Oliver N. [email protected] wrote:

uses a modified Oniguruma so people who would like to use Ruby and
Oniguruma might have a hard time putting it together.

With 1.8 I had some trouble linking a program using a standalone regex
library with libruby as there was something like regex_start in both.

The oniguruma thing should definitely be addressed. The version
incorporated into 1.9 would conflict if an application wanted to link both
1.9 and Oniguruma.

I do not see how onigiruma is different from the other symbols that
are not prefixed. Any other language interpreter (and even other
programs) can have insn_ vm_ iseq_ or any of the other symbols.

Thanks

Michal

SASADA Koichi wrote:

I counted references of external functions in MRI/trunk.

e$B!!e(Bhttp://www.atdot.net/sp/readonly/yr0o6k

Here is a variable version:
http://www.atdot.net/sp/readonly/4p8o6k

Michal S. wrote:

With 1.8 I had some trouble linking a program using a standalone regex
library with libruby as there was something like regex_start in both.

The oniguruma thing should definitely be addressed. The version
incorporated into 1.9 would conflict if an application wanted to link
both 1.9 and Oniguruma.

I suppose it’s also worth asking why Oniguruma was imported and directly
modified too. Why?

  • Charlie