You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[x64 Unix|arm64] Incorrect fastTailCall decision leads to bad codegen #11380
Current decision process requires nCalleeArgs >= nCallerArgs. This can be met, with a caller having a struct that needs to be copied onto the callee's virtual stack frame when the arg is > 8 bytes. If this is the case, only one slot is copied. See example below:
// 6 int registers on x64 unix and 16 byte stack
bool callee(long one, long two, long three, long four, long five, long six, long seven, long eight)
{
// Callee will have incorrect incoming args.
return ((one == 1) && (two == 2) && (three == 3) && (four == 4) && (five == 5) && (six == 6) && (seven == 7) && (eight == 8));
}
// 6 int registers on x64 unix and 24 byte stack
bool caller(StructSize16 one, long two, long three, long four, long five, long six, long seven, long eight)
{
// hasStackArgs && nCalleeArgs > nCallerArgs Therefore will fastTailCall
return callee(1, two, three, four, five, six, seven, eight);
}
Note this can be generalized to any caller that has more or equal arguments to the callee, and the callee has stack args. Only affects targets with #FEATURE_MULTIREG_ARGS
changed the title [-][x64|arm64] Incorrect fastTailCall decision leads to bad codegen[/-][+][x64 Unix|arm64] Incorrect fastTailCall decision leads to bad codegen[/+]on Oct 31, 2018
Wouldn't this also affect, e.g. x86, which passes structs by value (and so it is the size of the args, not the number of args that needs to be considered)?
Activity
jashook commentedon Oct 31, 2018
/cc @dotnet/jit-contrib
jashook commentedon Oct 31, 2018
Note this can be generalized to any caller that has more or equal arguments to the callee, and the callee has stack args. Only affects targets with #FEATURE_MULTIREG_ARGS
[-][x64|arm64] Incorrect fastTailCall decision leads to bad codegen[/-][+][x64 Unix|arm64] Incorrect fastTailCall decision leads to bad codegen[/+]CarolEidt commentedon Oct 31, 2018
Wouldn't this also affect, e.g. x86, which passes structs by value (and so it is the size of the args, not the number of args that needs to be considered)?
jashook commentedon Oct 31, 2018
We only support fast tail calls on x64 unix|Windows and arm64 :)
CarolEidt commentedon Oct 31, 2018
Oh, of course. Thanks.