pascalscript: added proc modifier vectorcall, patch #33134

git-svn-id: trunk@57289 -
This commit is contained in:
mattias 2018-02-12 14:55:38 +00:00
parent 43543a0cbb
commit 488478cd6e
5 changed files with 14 additions and 1 deletions

View File

@ -30,6 +30,7 @@ type
, clPascal , clPascal
, ClCdecl , ClCdecl
, ClStdCall , ClStdCall
, clVectorCall
); );
var var
@ -125,6 +126,7 @@ begin
if FuncCC = 'CDECL' then cc := ClCdecl else if FuncCC = 'CDECL' then cc := ClCdecl else
if FuncCC = 'REGISTER' then cc := clRegister else if FuncCC = 'REGISTER' then cc := clRegister else
if FuncCC = 'PASCAL' then cc := clPascal else if FuncCC = 'PASCAL' then cc := clPascal else
if FuncCC = 'VECTORCALL' then cc := clVectorCall else
begin begin
Sender.MakeError('', ecCustomError, tbtstring(RPS_InvalidCallingConvention)); Sender.MakeError('', ecCustomError, tbtstring(RPS_InvalidCallingConvention));
Result := nil; Result := nil;

View File

@ -16,6 +16,8 @@ const
CdStdCall = uPSRuntime.CdStdCall; CdStdCall = uPSRuntime.CdStdCall;
cdVectorCall = uPSRuntime.cdVectorCall;
type type
TPSScript = class; TPSScript = class;

View File

@ -23,6 +23,8 @@ const
{alias to @link(ifps3.cdStdcall)} {alias to @link(ifps3.cdStdcall)}
CdStdCall = uPSRuntime.CdStdCall; CdStdCall = uPSRuntime.CdStdCall;
cdVectorCall = uPSRuntime.cdVectorCall;
type type
{Alias to @link(ifps3.TPSCallingConvention)} {Alias to @link(ifps3.TPSCallingConvention)}
TDelphiCallingConvention = uPSRuntime.TPSCallingConvention; TDelphiCallingConvention = uPSRuntime.TPSCallingConvention;

View File

@ -1080,6 +1080,8 @@ const
cdStdCall = uPSUtils.cdStdCall; cdStdCall = uPSUtils.cdStdCall;
cdVectorCall = uPSUtils.cdVectorCall;
InvalidVal = Cardinal(-1); InvalidVal = Cardinal(-1);
function PSDynArrayGetLength(arr: Pointer; aType: TPSTypeRec): Longint; function PSDynArrayGetLength(arr: Pointer; aType: TPSTypeRec): Longint;
@ -11996,6 +11998,10 @@ function DelphiFunctionProc_Safecall(Caller: TPSExec; p: TPSExternalProcRec; Glo
begin begin
Result := DelphiFunctionProc(Caller, p, Global, Stack, cdSafeCall); Result := DelphiFunctionProc(Caller, p, Global, Stack, cdSafeCall);
end; end;
function DelphiFunctionProc_Vectorcall(Caller: TPSExec; p: TPSExternalProcRec; Global, Stack: TPSStack): Boolean;
begin
Result := DelphiFunctionProc(Caller, p, Global, Stack, cdVectorCall);
end;
procedure TPSExec.RegisterDelphiFunction(ProcPtr: Pointer; procedure TPSExec.RegisterDelphiFunction(ProcPtr: Pointer;
const Name: tbtString; CC: TPSCallingConvention); const Name: tbtString; CC: TPSCallingConvention);
@ -12012,6 +12018,7 @@ begin
cdStdCall: RegisterFunctionName(FastUppercase(Name), DelphiFunctionProc_Stdcall, ProcPtr, Slf); cdStdCall: RegisterFunctionName(FastUppercase(Name), DelphiFunctionProc_Stdcall, ProcPtr, Slf);
cdSafeCall: RegisterFunctionName(FastUppercase(Name), DelphiFunctionProc_Safecall, ProcPtr, Slf); cdSafeCall: RegisterFunctionName(FastUppercase(Name), DelphiFunctionProc_Safecall, ProcPtr, Slf);
cdCdecl: RegisterFunctionName(FastUppercase(Name), DelphiFunctionProc_CDECL, ProcPtr, Slf); cdCdecl: RegisterFunctionName(FastUppercase(Name), DelphiFunctionProc_CDECL, ProcPtr, Slf);
cdVectorCall: RegisterFunctionName(FastUppercase(Name), DelphiFunctionProc_Vectorcall, ProcPtr, Slf);
end; end;
end; end;

View File

@ -323,7 +323,7 @@ type
{$ELSE} {$ELSE}
{$IFDEF CPU64} IPointer = LongWord;{$ELSE} IPointer = Cardinal;{$ENDIF}{$ENDIF} {$IFDEF CPU64} IPointer = LongWord;{$ELSE} IPointer = Cardinal;{$ENDIF}{$ENDIF}
{$ENDIF} {$ENDIF}
TPSCallingConvention = (cdRegister, cdPascal, cdCdecl, cdStdCall, cdSafeCall); TPSCallingConvention = (cdRegister, cdPascal, cdCdecl, cdStdCall, cdSafeCall, cdVectorCall);
const const