示例#1
0
void BytecodeGenerator::visitCallNode(CallNode * node) {
  size_t n = node->parametersNumber();
  TranslatedFunction * fun = code->functionByName(node->name());
  for (size_t i = 0; i < n; ++i) {
    node->parameterAt(n - i - 1)->visit(this);
    convert(TOSType, fun->parameterType(n - i - 1));
  }
  fBC->addInsn(BC_CALL);
  fBC->addInt16(fun->id());
  TOSType = fun->returnType();
}
示例#2
0
void Code::disassemble(ostream& out, FunctionFilter* filter) {
    for (uint32_t i = 0; i < _functions.size(); i++) {
        TranslatedFunction* function = _functions[i];
        bool match = filter ? filter->matches(function) : true;
        if (match) {
            out << "function [" << function->id() << "] "
                << typeToName(function->returnType())
                << " " << function->name() << "(";
            for (uint32_t i = 0; i < function->parametersNumber(); i++) {
                out << typeToName(function->parameterType(i));
                if (i + 1 < function->parametersNumber()) {
                    out << ", ";
                }
            }
            out << ")" << endl;
            function->disassemble(out);
        }
    }
}