| 38 | #endif |
| 39 | |
| 40 | static 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); |
no test coverage detected