ko1 / atdot.net wrote:
> Sorry for late, and thank you for catching up recent changes.
No problem. I had some time today. I will be busy and have little
computer time for the next 5-7 days.
> My comments:
>
> 1. (negative) Incompatibility
> To solve this incompatibility, I have several ideas.
>
> (1-1) Make new instruction to replace with receiver.
I added a new opt_str_lit_yoda instruction. It only handles one receiver
location for now, I'm not sure if other cases (e.g. gsub) can trigger
the incompatibility.
patch: http://80x24.org/spew/m/38d41def78f16bca14fbc7fccd160ef0a8d06479.txt
Right now, I do not optimize `str.gsub("bar", method_call)', yet,
only optimizing: `str.gsub(anything, "bar")'
"foo" == bar
Compiles to:
[:putobject, "foo"],
[:putself],
[:opt_send_without_block,
{:mid=>:bar, :flag=>280, :orig_argc=>0, :blockptr=>nil}],
[:opt_str_lit_yoda, ["foo", 17, 1]],
[:opt_eq, {:mid=>:==, :flag=>256, :orig_argc=>1, :blockptr=>nil}],
> (1-3) Ignore such incompatibility because nobody write such code
However, I hope we can ignore the strange case and new insn.
> 2. (negative) Live patching
I've removed live patching for now:
http://80x24.org/spew/m/86739be08df5b4128e84bce15a2853cd7947a6fa.txt
It was a good learning experience, at least.
> 3. (neutral/not big issue) target methods
>
> opt_method.def format is a bit difficult to read which methods are
> target. Maybe we can make more pretty like:
I prefer to leave the format unchanged for now, because compile.c still
uses id{PLUS,ASET,AREF} names.
> 4. (neutral/not big issue) warning on VC (windows)
Untested patch (cast to unsigned):
http://80x24.org/spew/m/30c309d1ad24319ad53813f8814e09be0554ccb0.txt
> Have you measure performance improvement on non-microbenchmarks?
"make rdoc" performance improved from 66.3 => 63.3 sec in original test
However, the difference seems is smaller now: 66.1 => 64.9 sec
Full patch for convenience:
http://80x24.org/spew/m/opt-str-lit-v7%40m.txt