-
Notifications
You must be signed in to change notification settings - Fork 28
/
lpinterpreter_doinvoke.inc
192 lines (161 loc) · 8.35 KB
/
lpinterpreter_doinvoke.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
{
Author: Niels A.D
Project: Lape (https://github.com/nielsAD/lape)
License: GNU Lesser GPL (http://www.gnu.org/licenses/lgpl.html)
All the invoke related handling functions.
}
{%MainUnit lpinterpreter.pas}
procedure DoIncCall_Stk; {$IFDEF Lape_Inline}inline;{$ENDIF}
begin
with POC_Invoke_Stk(PtrUInt(Code) + ocSize)^ do
DoIncCall(SizeOf(TOC_Invoke_Stk), PCodePos(@FStack[FStackPos - SOffset])^, ParamSize, ParamSize - SOffset);
end;
procedure DoIncCall_PStk; {$IFDEF Lape_Inline}inline;{$ENDIF}
var
ParamSize: TParamSize;
begin
ParamSize := PParamSize(PtrUInt(Code) + ocSize)^;
DoIncCall(SizeOf(TParamSize), PCodePos(PPointer(@FStack[FStackPos - ParamSize - SizeOf(Pointer)])^)^, ParamSize, -SizeOf(Pointer));
end;
procedure DoIncCall_Var; {$IFDEF Lape_Inline}inline;{$ENDIF}
begin
with POC_Invoke_Var(PtrUInt(Code) + ocSize)^ do
DoIncCall(SizeOf(TOC_Invoke_Var), PCodePos(@FVarStack[FVarStackPos + VOffset])^, ParamSize);
end;
procedure DoIncCall_PVar; {$IFDEF Lape_Inline}inline;{$ENDIF}
begin
with POC_Invoke_PVar(PtrUInt(Code) + ocSize)^ do
DoIncCall(SizeOf(TOC_Invoke_PVar), PCodePos(PtrInt(PPointer(@FVarStack[FVarStackPos + VOffset])^) + POffset)^, ParamSize);
end;
procedure DoIncCall_Ptr; {$IFDEF Lape_Inline}inline;{$ENDIF}
begin
with POC_Invoke_Ptr(PtrUInt(Code) + ocSize)^ do
DoIncCall(SizeOf(TOC_Invoke_Ptr), PCodePos(Ptr)^, ParamSize);
end;
procedure DoInvokeImported_Stk; {$IFDEF Lape_Inline}inline;{$ENDIF}
begin
with POC_Invoke_Stk(PtrUInt(Code) + ocSize)^ do
DoInvokeImportedProc(SizeOf(TOC_Invoke_Stk), PPointer(@FStack[FStackPos - SOffset])^, ParamSize, ParamSize - SOffset);
end;
procedure DoInvokeImported_PStk; {$IFDEF Lape_Inline}inline;{$ENDIF}
var
ParamSize: TParamSize;
begin
ParamSize := PParamSize(PtrUInt(Code) + ocSize)^;
DoInvokeImportedProc(SizeOf(TParamSize), PPointer(PPointer(@FStack[FStackPos - ParamSize - SizeOf(Pointer)])^)^, ParamSize, -SizeOf(Pointer));
end;
procedure DoInvokeImported_Var; {$IFDEF Lape_Inline}inline;{$ENDIF}
begin
with POC_Invoke_Var(PtrUInt(Code) + ocSize)^ do
DoInvokeImportedProc(SizeOf(TOC_Invoke_Var), PPointer(@FVarStack[FVarStackPos + VOffset])^, ParamSize);
end;
procedure DoInvokeImported_PVar; {$IFDEF Lape_Inline}inline;{$ENDIF}
begin
with POC_Invoke_PVar(PtrUInt(Code) + ocSize)^ do
DoInvokeImportedProc(SizeOf(TOC_Invoke_PVar), PPointer(PtrInt(PPointer(@FVarStack[FVarStackPos + VOffset])^) + POffset)^, ParamSize);
end;
procedure DoInvokeImported_Ptr; {$IFDEF Lape_Inline}inline;{$ENDIF}
begin
with POC_Invoke_Ptr(PtrUInt(Code) + ocSize)^ do
DoInvokeImportedProc(SizeOf(TOC_Invoke_Ptr), PPointer(Ptr)^, ParamSize);
end;
procedure DoInvokeImported_Stk_Stk; {$IFDEF Lape_Inline}inline;{$ENDIF}
begin
with POC_Invoke_Stk_Stk(PtrUInt(Code) + ocSize)^ do
DoInvokeImportedFunc(SizeOf(TOC_Invoke_Stk_Stk), PPointer(@FStack[FStackPos - SOffset])^, @FStack[FStackPos - SOffset], ParamSize, ParamSize - SOffset + UInt32(StackInc));
end;
procedure DoInvokeImported_Stk_PStk; {$IFDEF Lape_Inline}inline;{$ENDIF}
begin
with POC_Invoke_Stk_PStk(PtrUInt(Code) + ocSize)^ do
DoInvokeImportedFunc(SizeOf(TOC_Invoke_Stk_PStk), PPointer(@FStack[FStackPos - SOffset])^, PPointer(@FStack[FStackPos - SOffset])^, ParamSize, ParamSize - SOffset);
end;
procedure DoInvokeImported_Stk_Var; {$IFDEF Lape_Inline}inline;{$ENDIF}
begin
with POC_Invoke_Stk_Var(PtrUInt(Code) + ocSize)^ do
DoInvokeImportedFunc(SizeOf(TOC_Invoke_Stk_Var), PPointer(@FStack[FStackPos - SOffset])^, @FVarStack[FVarStackPos + VOffsetD], ParamSize);
end;
procedure DoInvokeImported_Stk_PVar; {$IFDEF Lape_Inline}inline;{$ENDIF}
begin
with POC_Invoke_Stk_PVar(PtrUInt(Code) + ocSize)^ do
DoInvokeImportedFunc(SizeOf(TOC_Invoke_Stk_PVar), PPointer(@FStack[FStackPos - SOffset])^, Pointer(PtrInt(PPointer(@FVarStack[FVarStackPos + VOffsetD])^) + POffset), ParamSize);
end;
procedure DoInvokeImported_Stk_Ptr; {$IFDEF Lape_Inline}inline;{$ENDIF}
begin
with POC_Invoke_Stk_Ptr(PtrUInt(Code) + ocSize)^ do
DoInvokeImportedFunc(SizeOf(TOC_Invoke_Stk_Ptr), PPointer(@FStack[FStackPos - SOffset])^, PtrD, ParamSize);
end;
procedure DoInvokeImported_Var_Stk; {$IFDEF Lape_Inline}inline;{$ENDIF}
begin
with POC_Invoke_Var_Stk(PtrUInt(Code) + ocSize)^ do
DoInvokeImportedFunc(SizeOf(TOC_Invoke_Var_Stk), PPointer(@FVarStack[FVarStackPos + VOffsetS])^, @FStack[FStackPos - ParamSize], ParamSize, StackInc);
end;
procedure DoInvokeImported_Var_PStk; {$IFDEF Lape_Inline}inline;{$ENDIF}
begin
with POC_Invoke_Var_PStk(PtrUInt(Code) + ocSize)^ do
DoInvokeImportedFunc(SizeOf(TOC_Invoke_Var_PStk), PPointer(@FVarStack[FVarStackPos + VOffsetS])^, PPointer(@FStack[FStackPos - ParamSize])^, ParamSize);
end;
procedure DoInvokeImported_Var_Var; {$IFDEF Lape_Inline}inline;{$ENDIF}
begin
with POC_Invoke_Var_Var(PtrUInt(Code) + ocSize)^ do
DoInvokeImportedFunc(SizeOf(TOC_Invoke_Var_Var), PPointer(@FVarStack[FVarStackPos + VOffsetS])^, @FVarStack[FVarStackPos + VOffsetD], ParamSize);
end;
procedure DoInvokeImported_Var_PVar; {$IFDEF Lape_Inline}inline;{$ENDIF}
begin
with POC_Invoke_Var_PVar(PtrUInt(Code) + ocSize)^ do
DoInvokeImportedFunc(SizeOf(TOC_Invoke_Var_PVar), PPointer(@FVarStack[FVarStackPos + VOffsetS])^, Pointer(PtrInt(PPointer(@FVarStack[FVarStackPos + VOffsetD])^) + POffset), ParamSize);
end;
procedure DoInvokeImported_Var_Ptr; {$IFDEF Lape_Inline}inline;{$ENDIF}
begin
with POC_Invoke_Var_Ptr(PtrUInt(Code) + ocSize)^ do
DoInvokeImportedFunc(SizeOf(TOC_Invoke_Var_Ptr), PPointer(@FVarStack[FVarStackPos + VOffsetS])^, PtrD, ParamSize);
end;
procedure DoInvokeImported_PVar_Stk; {$IFDEF Lape_Inline}inline;{$ENDIF}
begin
with POC_Invoke_PVar_Stk(PtrUInt(Code) + ocSize)^ do
DoInvokeImportedFunc(SizeOf(TOC_Invoke_PVar_Stk), PPointer(PtrInt(PPointer(@FVarStack[FVarStackPos + VOffsetS])^) + POffsetS)^, @FStack[FStackPos - ParamSize], ParamSize, StackInc);
end;
procedure DoInvokeImported_PVar_PStk; {$IFDEF Lape_Inline}inline;{$ENDIF}
begin
with POC_Invoke_PVar_PStk(PtrUInt(Code) + ocSize)^ do
DoInvokeImportedFunc(SizeOf(TOC_Invoke_PVar_PStk), PPointer(PtrInt(PPointer(@FVarStack[FVarStackPos + VOffsetS])^) + POffsetS)^, PPointer(@FStack[FStackPos - ParamSize])^, ParamSize);
end;
procedure DoInvokeImported_PVar_Var; {$IFDEF Lape_Inline}inline;{$ENDIF}
begin
with POC_Invoke_PVar_Var(PtrUInt(Code) + ocSize)^ do
DoInvokeImportedFunc(SizeOf(TOC_Invoke_PVar_Var), PPointer(PtrInt(PPointer(@FVarStack[FVarStackPos + VOffsetS])^) + POffsetS)^, @FVarStack[FVarStackPos + VOffsetD], ParamSize);
end;
procedure DoInvokeImported_PVar_PVar; {$IFDEF Lape_Inline}inline;{$ENDIF}
begin
with POC_Invoke_PVar_PVar(PtrUInt(Code) + ocSize)^ do
DoInvokeImportedFunc(SizeOf(TOC_Invoke_PVar_PVar), PPointer(PtrInt(PPointer(@FVarStack[FVarStackPos + VOffsetS])^) + POffsetS)^, Pointer(PtrInt(PPointer(@FVarStack[FVarStackPos + VOffsetD])^) + POffsetD), ParamSize);
end;
procedure DoInvokeImported_PVar_Ptr; {$IFDEF Lape_Inline}inline;{$ENDIF}
begin
with POC_Invoke_PVar_Ptr(PtrUInt(Code) + ocSize)^ do
DoInvokeImportedFunc(SizeOf(TOC_Invoke_PVar_Ptr), PPointer(PtrInt(PPointer(@FVarStack[FVarStackPos + VOffsetS])^) + POffsetS)^, PtrD, ParamSize);
end;
procedure DoInvokeImported_Ptr_Stk; {$IFDEF Lape_Inline}inline;{$ENDIF}
begin
with POC_Invoke_Ptr_Stk(PtrUInt(Code) + ocSize)^ do
DoInvokeImportedFunc(SizeOf(TOC_Invoke_Ptr_Stk), PPointer(PtrS)^, @FStack[FStackPos - ParamSize], ParamSize, StackInc);
end;
procedure DoInvokeImported_Ptr_PStk; {$IFDEF Lape_Inline}inline;{$ENDIF}
begin
with POC_Invoke_Ptr_PStk(PtrUInt(Code) + ocSize)^ do
DoInvokeImportedFunc(SizeOf(TOC_Invoke_Ptr_PStk), PPointer(PtrS)^, PPointer(@FStack[FStackPos - ParamSize])^, ParamSize);
end;
procedure DoInvokeImported_Ptr_Var; {$IFDEF Lape_Inline}inline;{$ENDIF}
begin
with POC_Invoke_Ptr_Var(PtrUInt(Code) + ocSize)^ do
DoInvokeImportedFunc(SizeOf(TOC_Invoke_Ptr_Var), PPointer(PtrS)^, @FVarStack[FVarStackPos + VOffsetD], ParamSize);
end;
procedure DoInvokeImported_Ptr_PVar; {$IFDEF Lape_Inline}inline;{$ENDIF}
begin
with POC_Invoke_Ptr_PVar(PtrUInt(Code) + ocSize)^ do
DoInvokeImportedFunc(SizeOf(TOC_Invoke_Ptr_PVar), PPointer(PtrS)^, Pointer(PtrInt(PPointer(@FVarStack[FVarStackPos + VOffsetD])^) + POffset), ParamSize);
end;
procedure DoInvokeImported_Ptr_Ptr; {$IFDEF Lape_Inline}inline;{$ENDIF}
begin
with POC_Invoke_Ptr_Ptr(PtrUInt(Code) + ocSize)^ do
DoInvokeImportedFunc(SizeOf(TOC_Invoke_Ptr_Ptr), PPointer(PtrS)^, PtrD, ParamSize);
end;