Skip to content

RyuJIT_x64 doesn't do as much optimization for an throw method as directly throw does? #9962

@yyjdelete

Description

@yyjdelete

Tested with netcore1.1/2.0/2.1(2.1.300-preview2-008347)/net471 x64, seems not happened with x86build.

Test Code
https://github.com/yyjdelete/JIT_Test

I'm not sure if it's an issue since I'm not familiar with JIT, but has some questions.

  1. Why all ThrowWithCall(Error.ThrowExpection(string.format(...));) has rep stos but not for ThrowDirect(throw Error.CreateExpection(string.format(...));), the latter one is about 50% faster with all cases in the test code.
  2. Why when call directly into CheckIndex0ThrowWithCall, the Branch Prediction didn't work well by move throw to the end but it's well for all others(RunThrowWithCall, which is just a call to CheckIndex0ThrowWithCall);
  3. What's the different between CheckIndexThrowDirect and CheckIndexThrowDirect2, why jmp Test in the first case and call Test for the second.

category:cq
theme:inlining
skill-level:expert
cost:small

Metadata

Metadata

Assignees

Labels

area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIoptimization

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions