MCPcopy Create free account
hub / github.com/aardappel/treesheets / EvalProgramInner

Method EvalProgramInner

lobster/src/vm.cpp:742–795  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

740}
741
742void VM::EvalProgramInner() {
743 for (;;) {
744 #ifdef VM_COMPILED_CODE_MODE
745 #if VM_DISPATCH_METHOD == VM_DISPATCH_TRAMPOLINE
746 compiled_code_ip = ((block_t)compiled_code_ip)(*this);
747 #elif VM_DISPATCH_METHOD == VM_DISPATCH_SWITCH_GOTO
748 ((block_base_t)compiled_code_ip)(*this);
749 assert(false); // Should not return here.
750 #endif
751 #else
752 #ifndef NDEBUG
753 if (trace != TraceMode::OFF) {
754 auto &ss = TraceStream();
755 DisAsmIns(nfr, ss, ip, codestart, typetable, bcf);
756 ss << " [" << (sp + 1) << "] -";
757 #if RTT_ENABLED
758 #if DELETE_DELAY
759 ss << ' ' << (size_t)VM_TOP().any();
760 #endif
761 for (int i = 0; i < 3 && sp - i >= 0; i++) {
762 auto x = VM_TOPM(i);
763 ss << ' ';
764 x.ToStringBase(*this, ss, x.type, debugpp);
765 }
766 #endif
767 if (trace == TraceMode::TAIL) ss << '\n'; else LOG_PROGRAM(ss.str());
768 }
769 //currentline = LookupLine(ip).line;
770 #endif
771 #ifdef VM_PROFILER
772 auto code_idx = size_t(ip - codestart);
773 assert(code_idx < codelen);
774 byteprofilecounts[code_idx]++;
775 vm_count_ins++;
776 #endif
777 auto op = *ip++;
778 #if MEASURE_INSTRUCTION_COMBINATIONS
779 instruction_combinations[{ last_instruction_opc, op }]++;
780 last_instruction_opc = op;
781 #endif
782 #ifndef NDEBUG
783 if (op < 0 || op >= IL_MAX_OPS)
784 Error(cat("bytecode format problem: ", op));
785 #endif
786 #ifdef VM_ERROR_RET_EXPERIMENT
787 bool terminate =
788 #endif
789 ((*this).*(f_ins_pointers[op]))();
790 #ifdef VM_ERROR_RET_EXPERIMENT
791 if (terminate) return;
792 #endif
793 #endif
794 }
795}
796
797VM_INS_RET VM::U_PUSHINT(int x) { VM_PUSH(Value(x)); VM_RET; }
798VM_INS_RET VM::U_PUSHFLT(int x) { int2float i2f; i2f.i = x; VM_PUSH(Value(i2f.f)); VM_RET; }

Callers

nothing calls this directly

Calls 5

DisAsmInsFunction · 0.85
catFunction · 0.85
anyMethod · 0.80
ToStringBaseMethod · 0.80
strMethod · 0.45

Tested by

no test coverage detected