Re: [go-nuts] gc: optimize JMP to RET instructions

2024-08-15 Thread Arseny Samoylov
I guess you are right. Thank you very much for the discussion! On Wednesday 14 August 2024 at 20:21:01 UTC+3 robert engels wrote: > My understanding is that optimizations like this are almost never worth it > on modern processors - the increased code size works against the modern > branch predi

Re: [go-nuts] gc: optimize JMP to RET instructions

2024-08-14 Thread robert engels
My understanding is that optimizations like this are almost never worth it on modern processors - the increased code size works against the modern branch predictor and speculative executions - vs the single shared piece of code - there is less possibilities and thus instructions to preload. > O

Re: [go-nuts] gc: optimize JMP to RET instructions

2024-08-14 Thread Arseny Samoylov
> Won’t the speculative/parallel execution by most processors make the JMP essentially a no-op? I guess you are right, but this is true when JMP destination already in instruction buffer. I guess most of these cases are when JMP leads to RET inside on function, so indeed this optimization will h

Re: [go-nuts] gc: optimize JMP to RET instructions

2024-08-14 Thread robert engels
Won’t the speculative/parallel execution by most processors make the JMP essentially a no-op? See https://stackoverflow.com/questions/5127833/meaningful-cost-of-the-jump-instruction > On Aug 14, 2024, at 11:31 AM, Arseny Samoylov > wrote: > > Thank you for your answer! > > > We generally do

[go-nuts] gc: optimize JMP to RET instructions

2024-08-13 Thread Arseny Samoylov
Hello community, recently I found that gc generates a lot of JMP to RET instructions and there is no optimization for that. Consider this example: ``` // asm_arm64.s #include "textflag.h" TEXT ·jmp_to_ret(SB), NOSPLIT, $0-0 JMP *ret* ret: *RET* *```* This compiles to : ``` TE