review fixes: rename CallingConvention→CallConvention, seal, edge cases
HIGH: rename CallingConvention to CallConvention to avoid BCL collision with System.Runtime.InteropServices.CallingConvention. FIXES: - checked(uint) casts for x86 pointer truncation (ArgumentOverflow) - checked distance for E8 rel32 range (>2 GiB → throw) - add esp, imm32 (81 /0 id) when cleanup > 127 bytes - pointerSize validation (throw on != 4 and != 8) - switch default: throw on unknown convention - track argIndex instead of args[1..] slicing - EmitMovRegImm32 helper (avoids manual ip tracking bugs) - seal StubAssembler - IAssembler doc: note BuildCallStub is StubAssembler-specific - thiscall 0-args throws test; fastcall 0-args is valid - update remote-execution spec example to CallConvention.Cdecl All passing (total: 93).
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
namespace WhiteMagic.Assembly;
|
||||
|
||||
/// <summary>
|
||||
/// x86/x86-64 calling conventions for call-stub generation.
|
||||
/// Named <c>CallConvention</c> (not <c>CallingConvention</c>) to avoid ambiguity with
|
||||
/// <see cref="System.Runtime.InteropServices.CallingConvention"/>.
|
||||
/// </summary>
|
||||
public enum CallConvention
|
||||
{
|
||||
/// <summary>Caller pushes args right-to-left and cleans the stack (x86).</summary>
|
||||
Cdecl,
|
||||
|
||||
/// <summary>Caller pushes args right-to-left; callee cleans the stack (x86).</summary>
|
||||
Stdcall,
|
||||
|
||||
/// <summary>ECX receives the <c>this</c> pointer; remaining args on stack right-to-left; callee cleans (x86).</summary>
|
||||
Thiscall,
|
||||
|
||||
/// <summary>ECX/EDX receive the first two args; remaining on stack right-to-left; callee cleans (x86).</summary>
|
||||
Fastcall,
|
||||
}
|
||||
Reference in New Issue
Block a user