void BytecodeVisitor::visitStoreNode(StoreNode *node) {
        LOG_Visitor("visitStoreNode");

        VariableInContextDescriptor variableDescriptor = context->getVariableDescriptor(node->var()->name());

        if (node->op() == tINCRSET || node->op() == tDECRSET) {
            loadVariable(variableDescriptor, node);
        }
        node->value()->visit(this);

        VarType varType = context->getVariableByID(variableDescriptor)->type();
        cast(varType, node, "storing node");

        switch (node->op()) {
            case tINCRSET:
                bc()->addInsn(varType == VT_DOUBLE ? BC_DADD : BC_IADD);
                break;
            case tDECRSET:
                bc()->addInsn(BC_SWAP);
                bc()->addInsn(varType == VT_DOUBLE ? BC_DSUB : BC_ISUB);
                break;
            case tASSIGN:
                break;
            default:
                throw TranslationError("Incorrect storing variable operation", node->position());
        }
        storeVariable(variableDescriptor, node);
    }
Beispiel #2
0
Word Story::read(OperandType operandType)
{
	switch(operandType)
	{
		case OperandType::Large:
			return readNextWord();

		case OperandType::Small:
			return readNextByte();

		case OperandType::Variable:
		{
			auto variableID = readNextByte();
			return loadVariable(variableID);
		}

		case OperandType::Omitted:
		{
			throw Exception("Omitted unexpected");
		}

		default:
		{
			throw Exception("unexpected operand type");
		}
	}
}
    void BytecodeVisitor::visitForNode(ForNode *node) {
        LOG_Visitor("visitForNode");

        VariableInContextDescriptor variableDescriptor = context->getVariableDescriptor(node->var()->name());

        BinaryOpNode *innerExpression = (BinaryOpNode *) node->inExpr();

        if (innerExpression->kind() != tRANGE) {
            throw TranslationError(string("Incorrect binary operation in for-expression. Exptected: RANGE, got: ")
                    + tokenStr(innerExpression->kind()), node->position());
        }
        if (node->var()->type() != VT_INT) {
            throw TranslationError(string("Incorrect type of for-variable. Exptected: INT, got: ")
                    + typeToName(node->var()->type()), node->position());
        }

        innerExpression->left()->visit(this);

        bc()->addInsn(BC_ILOADM1);
        bc()->addInsn(BC_IADD);
        storeVariable(variableDescriptor, innerExpression);

        Label begin(bc());
        Label end(bc());
        {
            bc()->bind(begin);
            loadVariable(variableDescriptor, innerExpression);
            bc()->addInsn(BC_ILOAD1);
            bc()->addInsn(BC_IADD);
            storeVariable(variableDescriptor, innerExpression);

            //condition
            innerExpression->right()->visit(this);
            loadVariable(variableDescriptor, innerExpression);
            bc()->addInsn(BC_SWAP);

            // goto end if greater
            bc()->addBranch(BC_IFICMPG, end);

            node->body()->visit(this);

            bc()->addBranch(BC_JA, begin);
        }
        bc()->bind(end);
    }
Beispiel #4
0
Word Story::loadVariableInPlace(Byte variableID)
{
	if(variableID == 0)
	{
		// We return the peek of the stack
		return peek();
	}
	else
	{
		return loadVariable(variableID);
	}
}
Beispiel #5
0
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    BypassMonitor w;

    /** VARAPI */
    loadVariable();
    if4Init();

    w.show();

    return a.exec();
}
Beispiel #6
0
LoadedFunction *loadFunction(Common::SeekableReadStream *stream) {
	int a;

	// Reserve memory...

	LoadedFunction *buildFunc = new LoadedFunction;
	if (!checkNew(buildFunc))
		return NULL;

	// See what it was called by and load if we need to...

	buildFunc->originalNumber = stream->readUint16BE();
	buildFunc->calledBy = NULL;
	if (stream->readByte()) {
		buildFunc->calledBy = loadFunction(stream);
		if (!buildFunc->calledBy)
			return NULL;
	}

	buildFunc->timeLeft = stream->readUint32LE();
	buildFunc->runThisLine = stream->readUint16BE();
	buildFunc->freezerLevel = 0;
	buildFunc->cancelMe = stream->readByte();
	buildFunc->returnSomething = stream->readByte();
	buildFunc->isSpeech = stream->readByte();
	loadVariable(&(buildFunc->reg), stream);
	loadFunctionCode(buildFunc);

	buildFunc->stack = loadStack(stream, NULL);

	for (a = 0; a < buildFunc->numLocals; a++) {
		loadVariable(&(buildFunc->localVars[a]), stream);
	}

	return buildFunc;
}
Beispiel #7
0
bool DataLoader::loadAllVariableLists(FILE *fp) {

    // lendo as variáveis globais
    int count_n_variables;
    fread(&count_n_variables, 1, sizeof(int), fp);


    for(int i = 0; i < count_n_variables; i++) {
        gameData->variableList->push_back(loadVariable(fp));
    }

    // lendos as variáveis dos objetos
    for(std::vector<GameObject*>::iterator it1 = gameData->objectList->begin(); it1 != gameData->objectList->end(); ++it1) {
        GameObject *gameObject = *it1;

        fread(&count_n_variables, 1, sizeof(int), fp);

        for(int i = 0; i < count_n_variables; i++) {
            gameObject->variableList->push_back(loadVariable(fp));
        }

    }
    return true;
}
Beispiel #8
0
VariableStack *loadStack(Common::SeekableReadStream *stream, VariableStack **last) {
	int elements = stream->readUint16BE();
	int a;
	VariableStack *first = NULL;
	VariableStack **changeMe = &first;

	for (a = 0; a < elements; a++) {
		VariableStack *nS = new VariableStack;
		if (!checkNew(nS))
			return NULL;
		loadVariable(&(nS->thisVar), stream);
		if (last && a == elements - 1) {
			*last = nS;
		}
		nS->next = NULL;
		(*changeMe) = nS;
		changeMe = &(nS->next);
	}

	return first;
}
VariablesListViewItem::VariablesListViewItem(KListViewItem *parent, Variable* variable)
  : KListViewItem(parent), m_variable(variable),m_isRenameable(false)
{
  //setMultiLinesEnabled(true);
  loadVariable();
}
void AffectEngine::run() {

	// if it's procedure and variable combination
	ASTParameter *astParam1 = parameterList.at(0);
	ASTParameter *astParam2 = parameterList.at(1);	

	FastSearchInteger second;
	FastSearchInteger first;

	// there is no need to check if both is underscore
	if (astParam1->getParameterType() == VT_UNDERSCORE && astParam2->getParameterType() == VT_UNDERSCORE) {
		/*if (pkbManager->getFollows()->IsThereFollow) 
		failed = false;
		else
		failed true;*/
		failed = !pkbManager->getAffects()->exists();

		return;
	}



	if (astParam1->getParameterType() == VT_UNDERSCORE) 
		CommonUtility::convertToMap(myQM->getAllStatementList(), first);
	else
		loadVariable(0, first);



	if (astParam2->getParameterType() == VT_UNDERSCORE) 
		CommonUtility::convertToMap(myQM->getAllStatementList(), second);
	else 
		loadVariable(1, second);



	FastSearchString finalListOne;
	FastSearchString finalListTwo; 

	FastSearchInteger::iterator iter;
	vector<int>::const_iterator iterParentList;
	FastSearchInteger::iterator iterSecond;

	bool exist;
	bool keepRelationship = astParam1->updateAble() && astParam2->updateAble() ;

	vector<pair<string, string>> resultList;

	if (first.size() < second.size()) {
		for (iter = first.begin();  iter != first.end(); iter++) { // for every statement find the modified value

			vector<int> &childList = pkbManager->getAffects()->getAffects(iter->first);
			exist = false;

			for (iterParentList = childList.begin(); iterParentList  != childList.end(); iterParentList++) { // for each variable returned check against the variable list
				iterSecond = second.find(*iterParentList);

				if (iterSecond != second.end()) {
					exist = true;

					if (keepRelationship)
						resultList.push_back(pair<string, string>(CommonUtility::NumberToString(iter->first), CommonUtility::NumberToString(iterSecond->first)));					
					else if (astParam2->updateAble()) 
						finalListTwo[CommonUtility::NumberToString(iterSecond->first)] = true;
					else if (!astParam1->updateAble()) {
						return; // both are not updatable. 
					}								
				}
			}
			if (exist && !keepRelationship && astParam1->updateAble()) 
				finalListOne[CommonUtility::NumberToString(iter->first)] = true;


		}
	} else {
			for (iterSecond = second.begin();  iterSecond != second.end(); iterSecond++) { // for every statement find the modified value

				vector<int> &childList = pkbManager->getAffects()->getAffected(iterSecond->first);
			exist = false;

			for (iterParentList = childList.begin(); iterParentList  != childList.end(); iterParentList++) { // for each variable returned check against the variable list
				iter = first.find(*iterParentList);

				if (iter != first.end()) {
					exist = true;

					if (keepRelationship)
						resultList.push_back(pair<string, string>(CommonUtility::NumberToString(iter->first), CommonUtility::NumberToString(iterSecond->first)));					
					else if (astParam1->updateAble()) 
						finalListOne[CommonUtility::NumberToString(iter->first)] = true;
					else if (!astParam2->updateAble()) {
						return; // both are not updatable. 
					}								
				}
			}
			if (exist && !keepRelationship && astParam2->updateAble()) 
				finalListTwo[CommonUtility::NumberToString(iterSecond->first)] = true;


		}
	}


	updateVariable(resultList, finalListOne, finalListTwo, keepRelationship);

	failed = (finalListOne.size() == 0 && finalListTwo.size() == 0 && resultList.size() == 0);

}
 void BytecodeVisitor::visitLoadNode(LoadNode *node) {
     LOG_Visitor("visitLoadNode");
     VariableInContextDescriptor variableDescriptor = context->getVariableDescriptor(node->var()->name());
     topOfStackType = loadVariable(variableDescriptor, node);
 }
void UsesEngine::handleProcedureVariable() {
	// special case 1:
	// Modifies(procedure p , _);

	// declare necessary variable 
	bool keepRelationship = QueryClass::keepRelationship();
	vector<pair<string, string>> relationship;

	ASTParameter *astParam1 = parameterList.at(0);
	ASTParameter *astParam2 = parameterList.at(1);	

	FastSearchString procedureList;
	FastSearchString second;

	if (astParam2->getParameterType() == VT_UNDERSCORE) 
		CommonUtility::convertToMap(myQM->getAllVariable(), second);
	else 
		loadVariable(1, second);

	if (astParam1->getParameterType() == VT_UNDERSCORE) 
		procedureList = myQM->getAllProcedureList();
	else {
		loadVariable(0, procedureList);
	}


	FastSearchString finalProcedureList;
	FastSearchString finalVariableList; 

	FastSearchString::const_iterator iter;

	bool exist = false;


	if (second.size() < procedureList.size()) {

		vector<string>::const_iterator iterProcedureResult;

		for (iter = second.begin();  iter != second.end(); iter++) {
			vector<string> &procedureListResult = pkbManager->getUses()->getUsesProc(iter->first);

			exist = false;
			for (iterProcedureResult = procedureListResult.begin(); iterProcedureResult  != procedureListResult.end(); iterProcedureResult++) {
				if (procedureList.find(*iterProcedureResult) != procedureList.end()) {  // found
					exist = true;

					if (keepRelationship)
						relationship.push_back(pair<string, string>(*iterProcedureResult, iter->first));
					else if (astParam1->updateAble()) {
						finalProcedureList[*iterProcedureResult] = true;
					} else { // if the first one is not updateable, just need to care for second one 
						if (!astParam2->updateAble()) 
							return; // we have got what we come for. 

						break;	

					}

				}			
			}
			if (exist && !keepRelationship && astParam2->updateAble()) 
				finalVariableList[iter->first] = true;

		}
	} else {
		vector<string>::iterator iterVarResult;

		for (iter = procedureList.begin();  iter != procedureList.end(); iter++) {
			vector<string> &varListResult = pkbManager->getUses()->getUsedVar(iter->first);

			exist = false;
			for (iterVarResult = varListResult.begin(); iterVarResult  != varListResult.end(); iterVarResult++) {
				if (second.find(*iterVarResult) != second.end()) {  // found
					exist = true;

					if (keepRelationship)
						relationship.push_back(pair<string, string>(iter->first, *iterVarResult));
					else if (astParam2->updateAble()) {
						finalVariableList[*iterVarResult] = true;

					} else { // if the first one is not updateable, just need to care for second one 
						if (!astParam1->updateAble()) 
							return; // we have got what we come for. 

						// if param2 is not updatable, super unlikely after the optimization
						break;	

					}

				}			
			}
			if (exist && !keepRelationship && astParam1->updateAble()) 
				finalProcedureList[iter->first] = true;

		}
	}


	updateVariable(relationship, finalProcedureList, finalVariableList, keepRelationship);

	// both constant already handled above
	failed = (finalProcedureList.size() == 0 && finalVariableList.size() == 0&& relationship.size() == 0);



}
Beispiel #13
0
bool loadGame(const Common::String &fname) {
	Common::InSaveFile *fp = g_system->getSavefileManager()->openForLoading(fname);
	FILETIME savedGameTime;

	while (allRunningFunctions)
		finishFunction(allRunningFunctions);

	if (fp == NULL)
		return false;

	bool headerBad = false;
	if (fp->readByte() != 'S')
		headerBad = true;
	if (fp->readByte() != 'L')
		headerBad = true;
	if (fp->readByte() != 'U')
		headerBad = true;
	if (fp->readByte() != 'D')
		headerBad = true;
	if (fp->readByte() != 'S')
		headerBad = true;
	if (fp->readByte() != 'A')
		headerBad = true;
	if (headerBad) {
		fatal(ERROR_GAME_LOAD_NO, fname);
		return NULL;
	}
	char c;
	c = fp->readByte();
	while ((c = fp->readByte()))
		;

	int majVersion = fp->readByte();
	int minVersion = fp->readByte();
	ssgVersion = VERSION(majVersion, minVersion);

	if (ssgVersion >= VERSION(1, 4)) {
		if (!g_sludge->_gfxMan->skipThumbnail(fp))
			return fatal(ERROR_GAME_LOAD_CORRUPT, fname);
	}

	uint32 bytes_read = fp->read(&savedGameTime, sizeof(FILETIME));
	if (bytes_read != sizeof(FILETIME) && fp->err()) {
		warning("Reading error in loadGame.");
	}

	if (savedGameTime.dwLowDateTime != fileTime.dwLowDateTime || savedGameTime.dwHighDateTime != fileTime.dwHighDateTime) {
		return fatal(ERROR_GAME_LOAD_WRONG, fname);
	}

	// DON'T ADD ANYTHING NEW BEFORE THIS POINT!

	if (ssgVersion >= VERSION(1, 4)) {
		allowAnyFilename = fp->readByte();
	}
	captureAllKeys = fp->readByte();
	fp->readByte();  // updateDisplay (part of movie playing)

	g_sludge->_txtMan->loadFont(ssgVersion, fp);

	killAllPeople();
	killAllRegions();

	int camerX = fp->readUint16BE();
	int camerY = fp->readUint16BE();
	float camerZ;
	if (ssgVersion >= VERSION(2, 0)) {
		camerZ = fp->readFloatLE();
	} else {
		camerZ = 1.0;
	}

	brightnessLevel = fp->readByte();

	g_sludge->_gfxMan->loadHSI(fp, 0, 0, true);
	g_sludge->_evtMan->loadHandlers(fp);
	loadRegions(fp);

	if (!g_sludge->_cursorMan->loadCursor(fp)) {
		return false;
	}

	LoadedFunction *rFunc;
	LoadedFunction **buildList = &allRunningFunctions;

	int countFunctions = fp->readUint16BE();
	while (countFunctions--) {
		rFunc = loadFunction(fp);
		rFunc->next = NULL;
		(*buildList) = rFunc;
		buildList = &(rFunc->next);
	}

	for (int a = 0; a < numGlobals; a++) {
		unlinkVar(globalVars[a]);
		loadVariable(&globalVars[a], fp);
	}

	loadPeople(fp);

	if (fp->readByte()) {
		if (!setFloor(fp->readUint16BE()))
			return false;
	} else
		setFloorNull();

	if (!g_sludge->_gfxMan->loadZBuffer(fp))
		return false;

	if (!g_sludge->_gfxMan->loadLightMap(ssgVersion, fp)) {
		return false;
	}

	fadeMode = fp->readByte();
	g_sludge->_speechMan->load(fp);
	loadStatusBars(fp);
	g_sludge->_soundMan->loadSounds(fp);

	saveEncoding = fp->readUint16BE();

	if (ssgVersion >= VERSION(1, 6)) {
		if (ssgVersion < VERSION(2, 0)) {
			// aaLoad
			fp->readByte();
			fp->readFloatLE();
			fp->readFloatLE();
		}

		blur_loadSettings(fp);
	}

	if (ssgVersion >= VERSION(1, 3)) {
		g_sludge->_gfxMan->loadColors(fp);

		// Read parallax layers
		while (fp->readByte()) {
			int im = fp->readUint16BE();
			int fx = fp->readUint16BE();
			int fy = fp->readUint16BE();

			if (!g_sludge->_gfxMan->loadParallax(im, fx, fy))
				return false;
		}

		g_sludge->_languageMan->loadLanguageSetting(fp);
	}

	g_sludge->_gfxMan->nosnapshot();
	if (ssgVersion >= VERSION(1, 4)) {
		if (fp->readByte()) {
			if (!g_sludge->_gfxMan->restoreSnapshot(fp))
				return false;
		}
	}

	delete fp;

	g_sludge->_gfxMan->setCamera(camerX, camerY, camerZ);

	clearStackLib();
	return true;
}
    void SimpleInterpreter::run(ostream &out) {
        stack.resize(50);
        bytecodes.clear();
        indices.clear();
        vars.clear();
        bytecodes.push_back(bytecode);
        indices.push_back(0);
        contextID.push_back(0);
        callsCounter.push_back(0);
        SP = 0;

        while (!bytecodes.empty()) {
            indexType &currentIndex = indices.back();
            Bytecode &bytecode = *bytecodes.back();
            Instruction instruction = bytecode.getInsn(currentIndex);
            size_t instructionLength = bytecodeLength(instruction);
#ifdef LOG_INTERPRETER
            const char* bcName = bytecodeName(instruction, 0);
            cout << "index: " << currentIndex << ", instruction: " << bcName << endl;
#endif
            switch (instruction) {
                case BC_DLOAD: pushVariable(bytecode.getDouble(currentIndex + 1));
                    break;
                case BC_ILOAD: pushVariable(bytecode.getInt64(currentIndex + 1));
                    break;
                case BC_SLOAD: pushVariable(constantById(bytecode.getUInt16(currentIndex + 1)).c_str());
                    break;
                case BC_DLOAD0: pushVariable(0.0);
                    break;
                case BC_ILOAD0: pushVariable((signedIntType) 0);
                    break;
                case BC_SLOAD0: pushVariable("");
                    break;
                case BC_DLOAD1: pushVariable(1.0);
                    break;
                case BC_ILOAD1: pushVariable((signedIntType) 1);
                    break;
                case BC_DLOADM1: pushVariable(-1.0);
                    break;
                case BC_ILOADM1: pushVariable((signedIntType) - 1);
                    break;
                case BC_DADD: binary_operation(VT_DOUBLE, add<double>);
                    break;
                case BC_IADD: binary_operation(VT_INT, add < signedIntType > );
                    break;
                case BC_DSUB: binary_operation(VT_DOUBLE, sub<double>);
                    break;
                case BC_ISUB: binary_operation(VT_INT, sub < signedIntType > );
                    break;
                case BC_DMUL: binary_operation(VT_DOUBLE, mul<double>);
                    break;
                case BC_IMUL: binary_operation(VT_INT, mul < signedIntType > );
                    break;
                case BC_DDIV: binary_operation(VT_DOUBLE, _div<double>);
                    break;
                case BC_IDIV: binary_operation(VT_INT, _div < signedIntType > );
                    break;
                case BC_IMOD: binary_operation(VT_INT, mod < signedIntType > );
                    break;
                case BC_DNEG: unary_operation(VT_DOUBLE, neg<double>);
                    break;
                case BC_INEG: unary_operation(VT_INT, neg < signedIntType > );
                    break;
                case BC_IAOR: binary_operation(VT_INT, _or < signedIntType > );
                    break;
                case BC_IAAND: binary_operation(VT_INT, _and < signedIntType > );
                    break;
                case BC_IAXOR: binary_operation(VT_INT, _xor < signedIntType > );
                    break;
                case BC_IPRINT: out << popVariable().getIntValue();
                    out.flush();
                    break;
                case BC_DPRINT: out << popVariable().getDoubleValue();
                    out.flush();
                    break;
                case BC_SPRINT: out << popVariable().getStringValue();
                    out.flush();
                    break;
                case BC_SWAP: {
                    auto v1 = popVariable();
                    auto v2 = popVariable();
                    pushVariable(v1);
                    pushVariable(v2);
                    break;
                }
                case BC_STOREDVAR0:
                case BC_STOREIVAR0:
                case BC_STORESVAR0: storeVariable(0);
                    break;
                case BC_STOREDVAR1:
                case BC_STOREIVAR1:
                case BC_STORESVAR1: storeVariable(1);
                    break;
                case BC_STOREDVAR2:
                case BC_STOREIVAR2:
                case BC_STORESVAR2: storeVariable(2);
                    break;
                case BC_STOREDVAR3:
                case BC_STOREIVAR3:
                case BC_STORESVAR3: storeVariable(3);
                    break;
                case BC_LOADDVAR:
                case BC_LOADIVAR:
                case BC_LOADSVAR: pushVariable(loadVariable(bytecode.getUInt16(currentIndex + 1)));
                    break;
                case BC_LOADDVAR0:
                case BC_LOADIVAR0:
                case BC_LOADSVAR0: pushVariable(loadVariable(0));
                    break;
                case BC_LOADDVAR1:
                case BC_LOADIVAR1:
                case BC_LOADSVAR1: pushVariable(loadVariable(1));
                    break;
                case BC_LOADIVAR2:
                case BC_LOADSVAR2:
                case BC_LOADDVAR2: pushVariable(loadVariable(2));
                    break;
                case BC_LOADDVAR3:
                case BC_LOADIVAR3:
                case BC_LOADSVAR3: pushVariable(loadVariable(3));
                    break;
                case BC_STOREDVAR:
                case BC_STOREIVAR:
                case BC_STORESVAR: storeVariable(bytecode.getUInt16(currentIndex + 1));
                    break;
                case BC_LOADCTXDVAR:
                case BC_LOADCTXIVAR:
                case BC_LOADCTXSVAR: pushVariable(loadVariable(bytecode.getUInt16(currentIndex + 1), bytecode.getUInt16(currentIndex + 3)));
                    break;
                case BC_STORECTXDVAR:
                case BC_STORECTXIVAR:
                case BC_STORECTXSVAR: storeVariable(bytecode.getUInt16(currentIndex + 1), bytecode.getUInt16(currentIndex + 3));
                    break;
                case BC_DCMP: binary_operation<double, signedIntType>(VT_DOUBLE, _cmp<double>);
                    break;
                case BC_ICMP: binary_operation(VT_INT, _cmp < signedIntType > );
                    break;
                case BC_JA: {
                    currentIndex += bytecode.getInt16(currentIndex + 1) + 1;
                    continue;
                }
                case BC_IFICMPNE: {
                    if (!check_condition(_neq<signedIntType>))
                        break;
                    currentIndex += bytecode.getInt16(currentIndex + 1) + 1;
                    continue;
                }
                case BC_IFICMPE: {
                    if (!check_condition(_eq<signedIntType>))
                        break;
                    currentIndex += bytecode.getInt16(currentIndex + 1) + 1;
                    continue;
                }
                case BC_IFICMPG: {
                    if (!check_condition(_g<signedIntType>))
                        break;
                    currentIndex += bytecode.getInt16(currentIndex + 1) + 1;
                    continue;
                }
                case BC_IFICMPGE: {
                    if (!check_condition(_ge<signedIntType>))
                        break;
                    currentIndex += bytecode.getInt16(currentIndex + 1) + 1;
                    continue;
                }
                case BC_IFICMPL: {
                    if (!check_condition(_l<signedIntType>))
                        break;
                    currentIndex += bytecode.getInt16(currentIndex + 1) + 1;
                    continue;
                }
                case BC_IFICMPLE: {
                    if (!check_condition(_le<signedIntType>))
                        break;
                    currentIndex += bytecode.getInt16(currentIndex + 1) + 1;
                    continue;
                }
                case BC_STOP: {
                    indices.clear();
                    bytecodes.clear();
                    continue;
                }
                case BC_CALLNATIVE: {
                    callNative(bytecode.getUInt16(currentIndex + 1));
                    break;
                }
                case BC_CALL: {
                    TranslatedFunction *f = functionById(bytecode.getUInt16(currentIndex + 1));
                    bytecodes.push_back(static_cast<BytecodeFunction *>(f)->bytecode());
                    indices.push_back(0);
                    contextID.push_back(f->id());
                    detectCallWithFunctionID(contextID.back());
                    continue;
                }
                case BC_RETURN: {
                    indices.pop_back();
                    bytecodes.pop_back();
                    if (!indices.empty()) {
                        indices.back() += bytecodeLength(BC_CALL);
                    }
                    if (callsCounter[contextID.back()] > 0) {
                        callsCounter[contextID.back()]--;
                    }
                    contextID.pop_back();
                    continue;
                }
                case BC_I2D: pushVariable((double) popVariable().getIntValue());
                    break;
                case BC_D2I: pushVariable((signedIntType) popVariable().getDoubleValue());
                    break;
                case BC_S2I: pushVariable((signedIntType) popVariable().getStringValue());
                    break;
                case BC_BREAK: break;
                case BC_INVALID: throw InterpretationError("BC_Invalid instruction");
                default: throw InterpretationError(string("Unknown interpreting instruction: ") + bytecodeName(instruction, 0));
            }
            currentIndex += instructionLength;
        }
    }
 TypedVariable const& loadVariable(uint16_t id) {
     return loadVariable(contextID.back(), id);
 }