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

Function ExecScriptFunc

source/common/scripting/vm/vmexec.h:40–1952  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38#endif
39
40static int ExecScriptFunc(VMFrameStack *stack, VMReturn *ret, int numret)
41{
42#if COMPGOTO
43 static void * const ops[256] =
44 {
45#define xx(op,sym,mode,alt,kreg,ktype) &&op,
46#include "vmops.h"
47 };
48#endif
49 //const VMOP *exception_frames[MAX_TRY_DEPTH];
50 //int try_depth = 0;
51 VMFrame *f = stack->TopFrame();
52 VMScriptFunction *sfunc = static_cast<VMScriptFunction *>(f->Func);
53 const int *konstd = sfunc->KonstD;
54 const double *konstf = sfunc->KonstF;
55 const FString *konsts = sfunc->KonstS;
56 const FVoidObj *konsta = sfunc->KonstA;
57 const VMOP *pc = sfunc->Code;
58
59 assert(!(f->Func->VarFlags & VARF_Native) && "Only script functions should ever reach VMExec");
60
61 const VMRegisters reg(f);
62
63 void *ptr;
64 double fb, fc;
65 const double *fbp, *fcp;
66 int a, b, c;
67
68//begin:
69 try
70 {
71#if !COMPGOTO
72 VM_UBYTE op;
73 for(;;) switch(op = pc->op, a = pc->a, op)
74#else
75 pc--;
76 NEXTOP;
77#endif
78 {
79#if !COMPGOTO
80 default:
81 assert(0 && "Undefined opcode hit");
82 NEXTOP;
83#endif
84 OP(LI):
85 ASSERTD(a);
86 reg.d[a] = BCs;
87 NEXTOP;
88 OP(LK):
89 ASSERTD(a); ASSERTKD(BC);
90 reg.d[a] = konstd[BC];
91 NEXTOP;
92 OP(LKF):
93 ASSERTF(a); ASSERTKF(BC);
94 reg.f[a] = konstf[BC];
95 NEXTOP;
96 OP(LKS):
97 ASSERTS(a); ASSERTKS(BC);

Callers 1

ExecFunction · 0.85

Calls 15

ThrowAbortExceptionFunction · 0.85
DoCastFunction · 0.85
FillReturnsFunction · 0.85
SetReturnFunction · 0.85
ThrowVMExceptionFunction · 0.85
AssertObjectFunction · 0.85
EVMAbortExceptionEnum · 0.85
g_atan2Function · 0.85
fabsFunction · 0.85
DoFLOPFunction · 0.85
g_sqrtFunction · 0.85
TopFrameMethod · 0.80

Tested by

no test coverage detected