-
Notifications
You must be signed in to change notification settings - Fork 4
/
lpinterpreter_doinvoke.inc
192 lines (161 loc) · 8.28 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 (http://code.google.com/p/la-pe/)
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(@Stack[StackPos - 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(@Stack[StackPos - 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(@VarStack[VarStackPos + 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(@VarStack[VarStackPos + 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(@Stack[StackPos - 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(@Stack[StackPos - 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(@VarStack[VarStackPos + 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(@VarStack[VarStackPos + 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(@Stack[StackPos - SOffset])^, @Stack[StackPos - 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(@Stack[StackPos - SOffset])^, PPointer(@Stack[StackPos - 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(@Stack[StackPos - SOffset])^, @VarStack[VarStackPos + 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(@Stack[StackPos - SOffset])^, Pointer(PtrInt(PPointer(@VarStack[VarStackPos + 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(@Stack[StackPos - 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(@VarStack[VarStackPos + VOffsetS])^, @Stack[StackPos - 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(@VarStack[VarStackPos + VOffsetS])^, PPointer(@Stack[StackPos - 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(@VarStack[VarStackPos + VOffsetS])^, @VarStack[VarStackPos + 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(@VarStack[VarStackPos + VOffsetS])^, Pointer(PtrInt(PPointer(@VarStack[VarStackPos + 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(@VarStack[VarStackPos + 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(@VarStack[VarStackPos + VOffsetS])^) + POffsetS)^, @Stack[StackPos - 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(@VarStack[VarStackPos + VOffsetS])^) + POffsetS)^, PPointer(@Stack[StackPos - 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(@VarStack[VarStackPos + VOffsetS])^) + POffsetS)^, @VarStack[VarStackPos + 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(@VarStack[VarStackPos + VOffsetS])^) + POffsetS)^, Pointer(PtrInt(PPointer(@VarStack[VarStackPos + 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(@VarStack[VarStackPos + 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)^, @Stack[StackPos - 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(@Stack[StackPos - 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)^, @VarStack[VarStackPos + 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(@VarStack[VarStackPos + 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;