Created
March 22, 2020 22:39
-
-
Save gr33n7007h/fb17b14d1f1ef6e621713a6dd81b4d50 to your computer and use it in GitHub Desktop.
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
>> puts RubyVM::InstructionSequence.compile('-2 ** 2').disasm | |
== disasm: #<ISeq:<compiled>@<compiled>:1 (1,0)-(1,7)> (catch: FALSE) | |
0000 putobject 2 ( 1)[Li] | |
0002 putobject 2 | |
0004 opt_send_without_block <calldata!mid:**, argc:1, ARGS_SIMPLE> | |
0006 opt_send_without_block <calldata!mid:-@, argc:0, ARGS_SIMPLE> | |
0008 leave | |
=> nil | |
>> puts RubyVM::InstructionSequence.compile('-2.itself ** 2').disasm | |
== disasm: #<ISeq:<compiled>@<compiled>:1 (1,0)-(1,14)> (catch: FALSE) | |
0000 putobject -2 ( 1)[Li] | |
0002 opt_send_without_block <calldata!mid:itself, argc:0, ARGS_SIMPLE> | |
0004 putobject 2 | |
0006 opt_send_without_block <calldata!mid:**, argc:1, ARGS_SIMPLE> | |
0008 leave | |
=> nil | |
>> puts RubyVM::InstructionSequence.compile('-(2.itself) ** 2').disasm | |
== disasm: #<ISeq:<compiled>@<compiled>:1 (1,0)-(1,16)> (catch: FALSE) | |
0000 putobject 2 ( 1)[Li] | |
0002 opt_send_without_block <calldata!mid:itself, argc:0, ARGS_SIMPLE> | |
0004 putobject 2 | |
0006 opt_send_without_block <calldata!mid:**, argc:1, ARGS_SIMPLE> | |
0008 opt_send_without_block <calldata!mid:-@, argc:0, ARGS_SIMPLE> | |
0010 leave | |
=> nil |
havenwood
commented
Mar 22, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment