Skip to content

Commit

Permalink
Fix assignment of float register when this present for System V systems
Browse files Browse the repository at this point in the history
This change addresses few issues:
1. It shuts off an assert that is relevant for Windows AMD64 calling conventions.
2. It doesn't initialize stack offset for any args - on System V there is no outgoing args space for the callee reserved. And the spilled param offsets are calculated later than the init of arg vars.
3. It stops assigning the first float register to use  to the last used int register. The float registers are managed independently. In presence of this pointer the first float register on the callee side was calculated wrongly.

No asmdiffs for Windows. DDR tests passed.

[tfs-changeset: 1413622]
  • Loading branch information
Lubomir Litchev committed Feb 11, 2015
1 parent 8778e99 commit cebf2f8
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/jit/lclvars.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,8 @@ void Compiler::lvaInitUserArgs(InitVarDscInfo * varDscInfo)
#if defined(_TARGET_X86_)
// Only (some of) the implicit args are enregistered for varargs
varDscInfo->maxIntRegArgNum = info.compIsVarArgs ? varDscInfo->intRegArgNum : MAX_REG_ARG;
#elif defined(_TARGET_AMD64_)
#elif defined(_TARGET_AMD64_) && !defined(UNIX_AMD64_ABI)
// On System V type environment the float registers are not indexed together with the int ones.
varDscInfo->floatRegArgNum = varDscInfo->intRegArgNum;
#endif // _TARGET_*

Expand Down Expand Up @@ -3726,7 +3727,10 @@ void Compiler::lvaFixVirtualFrameOffsets()
}
}
#endif
#ifndef UNIX_AMD64_ABI
// On System V environments the stkOffs could be 0 for params passed in registers.
assert(codeGen->isFramePointerUsed() || varDsc->lvStkOffs >= 0); // Only EBP relative references can have negative offsets
#endif // !UNIX_AMD64_ABI
}
}

Expand Down Expand Up @@ -4040,15 +4044,12 @@ int Compiler::lvaAssignVirtualFrameOffsetToArg(unsigned lclNum, unsigned argSize
#if defined(_TARGET_X86_)
argOffs += sizeof(void *);
#elif defined(_TARGET_AMD64_)
#ifdef UNIX_AMD64_ABI
// Reserve space on the stack only for OnFrame variables.
// No need to do that for OutgoingArg. No such thing on Linux.
if (varDsc->lvOnFrame)
#endif // UNIX_AMD64_ABI
{
varDsc->lvStkOffs = argOffs;
argOffs += sizeof(void *);
}
#ifndef UNIX_AMD64_ABI
// The offset for args need not to be set for System V.
// No outgoing args for callees. The spilled args offsets will be set later.
varDsc->lvStkOffs = argOffs;
argOffs += sizeof(void *);
#endif // !UNIX_AMD64_ABI
#elif defined(_TARGET_ARM64_)
// Register arguments don't take stack space.
#elif defined(_TARGET_ARM_)
Expand Down

0 comments on commit cebf2f8

Please sign in to comment.