Last active
April 17, 2019 22:11
-
-
Save siman-man/0b43dafbe6a56e228fc55dac3b0d92f1 to your computer and use it in GitHub Desktop.
最適化されて TracePoint で取得できなくなっている `+` 演算子を最適化 OFF にして取得する
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RubyVM::InstructionSequence.compile_option = false | |
class RubyVM::InstructionSequence | |
def self.load_iseq(fpath) | |
RubyVM::InstructionSequence.compile_file(fpath) | |
end | |
end | |
require_relative 'add' | |
TracePoint.trace(:c_call) do |tp| | |
p tp.method_id | |
end | |
add(1, 2) |
実行結果
$ ruby trace_plus_ope.rb
:+
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
add.rb