MCPcopy Create free account
hub / github.com/ZDoom/Raze / VMFillParams

Function VMFillParams

source/common/scripting/vm/vmexec.cpp:197–235  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

195//===========================================================================
196
197void VMFillParams(VMValue *params, VMFrame *callee, int numparam)
198{
199 unsigned int regd, regf, regs, rega;
200 VMScriptFunction *calleefunc = static_cast<VMScriptFunction *>(callee->Func);
201 const VMRegisters calleereg(callee);
202
203 assert(calleefunc != NULL && !(calleefunc->VarFlags & VARF_Native));
204 assert(numparam == calleefunc->NumArgs);
205 assert(REGT_INT == 0 && REGT_FLOAT == 1 && REGT_STRING == 2 && REGT_POINTER == 3);
206
207 regd = regf = regs = rega = 0;
208 const uint8_t *reginfo = calleefunc->RegTypes;
209 assert(reginfo != nullptr);
210 for (int i = 0; i < calleefunc->NumArgs; ++i, reginfo++)
211 {
212 // copy all parameters to the local registers.
213 VMValue &p = params[i];
214 if (*reginfo < REGT_STRING)
215 {
216 if (*reginfo == REGT_INT)
217 {
218 calleereg.d[regd++] = p.i;
219 }
220 else // p.Type == REGT_FLOAT
221 {
222 calleereg.f[regf++] = p.f;
223 }
224 }
225 else if (*reginfo == REGT_STRING)
226 {
227 calleereg.s[regs++] = p.s();
228 }
229 else
230 {
231 assert(*reginfo == REGT_POINTER);
232 calleereg.a[rega++] = p.a;
233 }
234 }
235}
236
237
238#ifndef NDEBUG

Callers 2

CreateFullVMFrameFunction · 0.85
ExecFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected