OK, there much to say about this but really i don't like write essays
You can force the compiler to not introduce a stack frame by using .noframe in the x64 assembly block.
so the code can be like this
Code:
PROCEDURE test;
const
pExClass : ExceptClass = (
Exception);
sErr : String = ' My message ';
asm
{$IfDef CPUX86}
mov ecx,sErr
mov
dl ,1
mov eax,pExClass
call
Exception .Create
call System.@RaiseExcept
{$Else}
.noframe // crucial here
push rbp
sub rsp,$20
mov rbp,rsp
mov r8,sErr
mov
dl ,$01
mov rcx,pExClass
call
Exception .Create
mov rcx,rax
call System.@RaiseExcept
lea rsp,[rbp+$20]
pop rbp
{$EndIf}
end ;
Yet again, use that on your risk !
Edit: to fix an extra pop useless in that example but will cause problem in real life code.