Пример #1
0
void FunctionDeclaration::codeGen(CodeGenContext& context)
{
    BasicBlock *bblock = new BasicBlock();

    Function *f = new Function();

    context.push_block(bblock);
    VariableList::const_iterator it;
    for (it = m_arguments->begin(); it != m_arguments->end(); it++) {
        if (debug)
            cout << "Argument : " << (**it).m_type->m_name ;
        Value *v = (*it)->value();
        (**it).codeGen(context);
        if (debug)
            cout << " at: " << v->addr << endl;
        f->arguments.push_back(v->addr);
    }
    m_block->codeGen(context, true);
    f->pm_addr = context.getCurrent();
    m_block->codeGen(context, false);
    context.vret();
    context.pop_block();

    context.functions().insert(std::make_pair(m_id->m_name, f));

    if (debug)
        std::cout << "Creating function: " << m_id->m_name << endl;
}
Пример #2
0
int main(int argc, char *argv[])
{
	auto compileOnly = false;
	auto logLevel = 4;
	for(auto i = 0; i < argc; ++i) {
		if(std::string(argv[i]).compare("-c") == 0 || std::string(argv[i]).compare("--compile") == 0) {
			compileOnly = true;
		}
		if(std::string(argv[i]).find("--log") == 0) {
			if(argv[i][5] < '0' || argv[i][5] > '4') {
				std::cerr << "Bad level" << std::endl;
				exit(2);
			}
			logLevel = argv[i][5] - '0';
		}
	}
	yyparse();
	InitializeNativeTarget();
	InitializeNativeTargetAsmPrinter();
	InitializeNativeTargetAsmParser();
	CodeGenContext context;
	context.dclog.max_level = debug_stream::level(logLevel);
	createCoreFunctions(context);
	context.generateCode(*programBlock);
	if (!compileOnly) {
		auto val = context.runCode();
		(context.llclog << val.IntVal.getSExtValue() << "\n").flush();
	}
	return 0;
}
Пример #3
0
void Double::codeGen(CodeGenContext& context)
{
    if (debug)
        std::cout << "Creating double: " << m_value << endl;
    int ref_id = context.add_constant(m_value);
    context.vpush_constant(ref_id);
}
Пример #4
0
void WhileStatement::codeGen(CodeGenContext &context)
{
    int start = context.getCurrent();
    m_block->codeGen(context, false);
    m_expr->codeGen(context);

    context.encode(CodeGenContext::JE, start);

}
Пример #5
0
int main(int argc, char **argv)
{
    yyparse();
    std::cout << programBlock << std::endl;
    
    CodeGenContext context;
    context.generateCode(*programBlock);
    context.runCode();

    return 0;
}
Пример #6
0
void Identifier::codeGen(CodeGenContext& context)
{
    if (debug)
        std::cout << "Creating identifier reference: " << m_name << endl;

    Value *v = context.find_variable(m_name);
    if (!v) {
        std::cout << "Reference to unknown variable " << m_name << std::endl;
        exit(0);
    }
    context.vpushm(v->addr);
}
Пример #7
0
void Assignment::codeGen(CodeGenContext& context)
{
    if (debug)
        std::cout << "Creating assignment for " << lhs->m_name << endl;
    if (context.locals().find(lhs->m_name) == context.locals().end()) {
        std::cerr << "undeclared variable " << lhs->m_name << endl;
        return;
    }

    rhs->codeGen(context);
    context.vpop(context.locals()[lhs->m_name]->addr);
}
Пример #8
0
int main(int argc, char **argv)
{
	yyparse();
	std::cout << programBlock << endl;
    // see http://comments.gmane.org/gmane.comp.compilers.llvm.devel/33877
	InitializeNativeTarget();
	CodeGenContext context;
	createCoreFunctions(context);
	context.generateCode(*programBlock);
	context.runCode();
	
	return 0;
}
Пример #9
0
void CVariableDeclaration::CreateWriteAccessor(CodeGenContext& context, BitVariable& var, const std::string& moduleName, const std::string& name, bool impedance)
{
	std::vector<llvm::Type*> argTypes;
	argTypes.push_back(context.getIntType(var.size));
	llvm::FunctionType *ftype = llvm::FunctionType::get(context.getVoidType(), argTypes, false);
	llvm::Function* function;
	if (context.isRoot)
	{
		function = context.makeFunction(ftype, llvm::GlobalValue::ExternalLinkage, context.moduleName + context.getSymbolPrefix() + "PinSet" + id.name);
	}
	else
	{
		function = context.makeFunction(ftype, llvm::GlobalValue::PrivateLinkage, context.moduleName + context.getSymbolPrefix() + "PinSet" + id.name);
	}
	function->onlyReadsMemory();	// Mark input read only

	context.StartFunctionDebugInfo(function, declarationLoc);

	llvm::BasicBlock *bblock = context.makeBasicBlock("entry", function);

	context.pushBlock(bblock, declarationLoc);

	llvm::Function::arg_iterator args = function->arg_begin();
	llvm::Value* setVal = &*args;
	setVal->setName("InputVal");

	llvm::LoadInst* load = new llvm::LoadInst(var.value, "", false, bblock);

	if (impedance)
	{
		llvm::LoadInst* loadImp = new llvm::LoadInst(var.impedance, "", false, bblock);
		llvm::CmpInst* check = llvm::CmpInst::Create(llvm::Instruction::ICmp, llvm::ICmpInst::ICMP_NE, loadImp, context.getConstantZero(var.size.getLimitedValue()), "impedance", bblock);

		setVal = llvm::SelectInst::Create(check, setVal, load, "impOrReal", bblock);
	}

	llvm::Value* stor = CAssignment::generateAssignmentActual(var, id/*moduleName, name*/, setVal, context, false);		// we shouldn't clear impedance on write via pin (instead should ignore write if impedance is set)

	var.priorValue = load;
	var.writeInput = setVal;
	var.writeAccessor = &writeAccessor;
	writeAccessor = context.makeReturn(bblock);

	context.popBlock(declarationLoc);

	context.EndFunctionDebugInfo();
}
Пример #10
0
void BinaryOperator::codeGen(CodeGenContext& context)
{
    if (debug)
        std::cout << "Creating binary operation " << endl;

    lhs->codeGen(context);
    rhs->codeGen(context);

    switch (op) {
    case TPLUS:
        context.vadd(type());
        break;
    case TMINUS:
        context.encode(ToyVm::SUB, type());
        break;
    case TAND:
        context.encode(ToyVm::AND, type());
        break;
    case TMUL:
        context.vmul(type());
        break;
    case TDIV:
        context.encode(ToyVm::DIV, type());
        break;
    case TCEQ:
        context.encode(ToyVm::CMP, lhs->type());
        break;
    case TCLT:
        context.encode(ToyVm::CLT, lhs->type());
        break;
        /* TODO comparison */
    }

}
Пример #11
0
void createEchoFunction(CodeGenContext& context, llvm::Function* printfFn)
{
    std::vector<llvm::Type*> echo_arg_types;
    echo_arg_types.push_back(llvm::Type::getInt64Ty(getGlobalContext()));

    llvm::FunctionType* echo_type =
        llvm::FunctionType::get(
            llvm::Type::getVoidTy(getGlobalContext()), echo_arg_types, false);

    llvm::Function *func = llvm::Function::Create(
                echo_type, llvm::Function::InternalLinkage,
                llvm::Twine("echo"),
                context.module
           );
    llvm::BasicBlock *bblock = llvm::BasicBlock::Create(getGlobalContext(), "entry", func, 0);
	context.pushBlock(bblock);
    
    const char *constValue = "%d\n";
    llvm::Constant *format_const = llvm::ConstantDataArray::getString(getGlobalContext(), constValue);
    llvm::GlobalVariable *var =
        new llvm::GlobalVariable(
            *context.module, llvm::ArrayType::get(llvm::IntegerType::get(getGlobalContext(), 8), strlen(constValue)+1),
            true, llvm::GlobalValue::PrivateLinkage, format_const, ".str");
    llvm::Constant *zero =
        llvm::Constant::getNullValue(llvm::IntegerType::getInt32Ty(getGlobalContext()));

    std::vector<llvm::Constant*> indices;
    indices.push_back(zero);
    indices.push_back(zero);
    llvm::Constant *var_ref = llvm::ConstantExpr::getGetElementPtr(
	llvm::ArrayType::get(llvm::IntegerType::get(getGlobalContext(), 8), strlen(constValue+1)),
        var, indices);

    std::vector<Value*> args;
    args.push_back(var_ref);

    Function::arg_iterator argsValues = func->arg_begin();
    Value* toPrint = argsValues++;
    toPrint->setName("toPrint");
    args.push_back(toPrint);
    
	CallInst *call = CallInst::Create(printfFn, makeArrayRef(args), "", bblock);
	ReturnInst::Create(getGlobalContext(), bblock);
	context.popBlock();
}
Пример #12
0
void ListLiteral::codeGen(CodeGenContext& context)
{
    int count = 0;
    for(auto it : m_elements) {
        it->codeGen(context);
        count++;
    }
    context.vmake_list(count);
}
Пример #13
0
bool NBinaryOperator::autoUpgradeType(CodeGenContext& context,
                                      Value *lhs, Value *rhs)
{
    bool isConverted = false;
    // conversion if it exists a float type
    if (lhs->getType()->isDoubleTy() || rhs->getType()->isDoubleTy()) {
        if (!lhs->getType()->isDoubleTy()) {
            lhs = new SIToFPInst(lhs, Type::getFloatTy(context.module->getContext()),
                                 "conv", context.currentBlock());
            isConverted = true;
        }
        if (!rhs->getType()->isDoubleTy()) {
            rhs = new SIToFPInst(rhs, Type::getFloatTy(context.module->getContext()),
                                 "conv", context.currentBlock());
            isConverted = true;
        }
    }
    return isConverted;
}
Пример #14
0
int main(int argc, char **argv)
{
	if (argc > 1) {
		extern FILE* yyin;
		if(!(yyin = fopen(argv[1], "r"))) {
			perror(argv[1]);
			return (1);
		}
	}
	
	yyparse();
	std::cout << programBlock << std::endl;
	
	CodeGenContext context;
	context.generateCode(*programBlock);
	context.runCode();
	
	
	return 0;
}
Пример #15
0
void MethodCall::codeGen(CodeGenContext& context)
{
    if (debug)
        std::cout << "Calling function " << m_id->m_name << std::endl;

    Function *f = context.find_function(m_id->m_name);
    if (!f) {
        std::cout << "Error, no matching call to function " << m_id->m_name << std::endl;
        exit(0);
    }

    ExpressionList::const_iterator it;
    int i = 0;
    for (it = m_arguments->begin(); it != m_arguments->end(); it++) {
        (**it).codeGen(context);
        context.vpop(f->arguments[i++]);
    }
    int idx = f->pm_addr;
    context.vcall(idx);
}
Пример #16
0
void VariableDeclaration::codeGen(CodeGenContext& context)
{
    if (debug)
        std::cout << "Creating variable declaration " << m_type->m_name << " " << m_name->m_name << endl;

    context.locals()[m_name->m_name] = value();
    if (m_assignment_expr != NULL) {
        Assignment assn(m_name, m_assignment_expr);
        assn.codeGen(context);
    }
}
Пример #17
0
void CInstance::prePass(CodeGenContext& context)
{
	// On the prepass, we need to generate the code for this module
	std::string includeName = filename.quoted.substr(1, filename.quoted.length() - 2);

	if (resetFileInput(includeName.c_str()) != 0)
	{
		context.gContext.ReportError(nullptr, EC_ErrorAtLocation, filename.quotedLoc, "Unable to instance module %s", includeName.c_str());
		return;
	}
	yyparse();
	if (g_ProgramBlock == 0)
	{
		context.gContext.ReportError(nullptr, EC_ErrorAtLocation, filename.quotedLoc, "Unable to parse module %s", includeName.c_str());
		return;
	}

	CodeGenContext* includefile;

	includefile = new CodeGenContext(context.gContext, &context);
	includefile->moduleName = ident.name + ".";

	if (context.gContext.opts.generateDebug)
	{
		context.gContext.scopingStack.push(context.gContext.CreateNewDbgFile(includeName.c_str()));
	}

	includefile->generateCode(*g_ProgramBlock);

	if (context.gContext.opts.generateDebug)
	{
		context.gContext.scopingStack.pop();
	}
	if (includefile->isErrorFlagged())
	{
		context.gContext.ReportError(nullptr , EC_ErrorAtLocation, filename.quotedLoc, "Unable to parse module %s", includeName.c_str());
		return;
	}
	context.m_includes[ident.name + "."] = includefile;
}
Пример #18
0
int main(int argc, char **argv)
{
    FILE *inpFile = fopen(argv[1], "r");
    if (!inpFile)
    {
        cout << "Error opening File" << endl;
        return -1;
    }

    yyin = inpFile;

    yyparse();
    std::cout << programBlock << endl;
    // see http://comments.gmane.org/gmane.comp.compilers.llvm.devel/33877
    llvm::InitializeNativeTarget();
    CodeGenContext context;
    context.generateCode(*programBlock);
    context.runCode();
    
    system("pause");
    return 0;
}
Пример #19
0
void ForeachStatement::codeGen(CodeGenContext &context)
{
    m_var_decl->codeGen(context);
    m_expr->codeGen(context);
    context.vmake_iter();
    int pos = context.getCurrent();
    context.viter_value();
    context.vpop(context.locals()[m_var_decl->m_name->m_name]->addr);
    m_block->codeGen(context, false);
    context.vloop_iter(pos);
    context.vpop(444);
    context.vpop(444);
}
Пример #20
0
int main(void)
{

  /* object to interface with llvm API (defined in codegen.cpp) */
  CodeGenContext context;

  /*
   *       Lexing and Parsing
   *       ------------------
   *   lexer feeds tokens to parser
   *   parser builds an AST stored in programBlock
   */

  yyparse();

  /* prints out root address of AST root */
  std::cout << "=================================" << std::endl
            << "Address of root AST node: "        << programBlock
            << std::endl << std::endl;

  /*
   *      Code Generation
   *      ---------------
   */

  /* establish host target & link target libraries JIT uses */
  llvm::InitializeNativeTarget();

  coreFuncs(context);

  context.generateCode(*programBlock);

  context.runCode();

  return EXIT_SUCCESS;
}
Пример #21
0
void CVariableDeclaration::CreateReadAccessor(CodeGenContext& context, BitVariable& var, bool impedance)
{
	std::vector<llvm::Type*> argTypes;
	llvm::FunctionType *ftype = llvm::FunctionType::get(context.getIntType(var.size), argTypes, false);
	llvm::Function* function;
	if (context.isRoot)
	{
		function = context.makeFunction(ftype, llvm::GlobalValue::ExternalLinkage, context.moduleName + context.getSymbolPrefix() + "PinGet" + id.name);
	}
	else
	{
		function = context.makeFunction(ftype, llvm::GlobalValue::PrivateLinkage, context.moduleName + context.getSymbolPrefix() + "PinGet" + id.name);
	}
	function->setOnlyReadsMemory();

	context.StartFunctionDebugInfo(function, declarationLoc);

	llvm::BasicBlock *bblock = context.makeBasicBlock("entry", function);

	context.pushBlock(bblock, declarationLoc);

	llvm::Value* load = new llvm::LoadInst(var.value, "", false, bblock);
	if (impedance)
	{
		llvm::LoadInst* loadImp = new llvm::LoadInst(var.impedance, "", false, bblock);
		llvm::CmpInst* check = llvm::CmpInst::Create(llvm::Instruction::ICmp, llvm::ICmpInst::ICMP_EQ, loadImp, context.getConstantZero(var.size.getLimitedValue()), "impedance", bblock);

		load = llvm::SelectInst::Create(check, load, loadImp, "impOrReal", bblock);
	}

	context.makeReturnValue(load, bblock);

	context.popBlock(declarationLoc);

	context.EndFunctionDebugInfo();
}
Пример #22
0
void IfStatement::codeGen(CodeGenContext& context)
{
    int then_end;
    m_eval_expr->codeGen(context);
    int then_start = context.reserve();
    m_then_block->codeGen(context, false);

    if (m_else_block) {
        then_end = context.reserve();
        m_else_block->codeGen(context ,false);
    }

    int block_end = context.getCurrent();

    if (m_else_block) {
        context.encode_at(then_end, CodeGenContext::JMP, block_end);
        context.encode_at(then_start, CodeGenContext::JNE, then_end);
    } else {
        context.encode_at(then_start, CodeGenContext::JNE, block_end);
    }
}
Пример #23
0
void JSTypeTree::Init(CodeGenContext& context)
{
    llvm::IntegerType *int32Type = llvm::Type::getInt32Ty(llvm::getGlobalContext());
    TBNode<JSTypeInfo> *jsObject_01Info;
    TBNode<JSTypeInfo> *jsFunctionObject_02Info;

    // store EJSObject as root
    jsTypeTree = new TBTree<JSTypeInfo>(JSTypeInfoCmp, JSTypeInfoCpy, JSTypeInfoInit, JSTypeInfoFree, JSTypeInfoPrint);
    //add all struct of Object types
    jsObject_01Info = Add(context.getTypeRef("struct.JSObject_01"), NULL, NULL, "__proto__", sizeof(struct JSObject_01));
    jsObjectInfo = Add(context.getTypeRef("struct.JSObject"), jsObject_01Info, NULL, "length", sizeof(struct EJSObject) - sizeof(struct JSObject_01));
    jsBooleanObjectInfo = jsObjectInfo;
    jsNumberObjectInfo = jsObjectInfo;
    jsStringObjectInfo = Add(context.getTypeRef("struct.JSString"), jsObjectInfo, NULL, NULL, sizeof(struct JSString) - sizeof(struct EJSObject));
    jsArrayObjectInfo = Add(context.getTypeRef("struct.JSArrayObject"), jsObjectInfo, NULL, NULL, sizeof(struct EJSArray) - sizeof(struct EJSObject));
    jsFunctionObjectInfo = Add(context.getTypeRef("struct.EJSFunctionObject_01"), jsObjectInfo, jsArrayObjectInfo, "arguments", sizeof(struct EJSFunctionObject_01) - sizeof(struct EJSObject));
    jsFunctionObject_02Info = Add(context.getTypeRef("struct.EJSFunctionObject_02"), jsFunctionObjectInfo, NULL, "caller", sizeof(struct EJSFunctionObject_02) - sizeof(struct EJSFunctionObject_01));
    jsFunctionObjectInfo = Add(context.getTypeRef("struct.EJSFunctionObject_03"), jsFunctionObject_02Info, jsStringObjectInfo, "displayName", sizeof(struct EJSFunctionObject_03) - sizeof(struct EJSFunctionObject_02));
    jsFunctionObjectInfo = Add(context.getTypeRef("struct.EJSFunction"), jsFunctionObjectInfo, jsStringObjectInfo, "name", sizeof(struct EJSFunction) - sizeof(struct EJSFunctionObject_03));
    
    //add all struct of Type types
    jsFunctionTypeInfo = Add(context.getTypeRef("struct.EJSFunctionType"), jsFunctionObjectInfo, NULL, "prototype", sizeof(struct EJSFunctionType) - sizeof(struct EJSFunction));
    jsObjectTypeInfo = Add(context.getTypeRef("struct.JSObjectType_01"), jsFunctionTypeInfo, NULL, "create", sizeof(struct JSObjectType_01) - sizeof(struct EJSFunctionType));
    jsObjectTypeInfo = Add(context.getTypeRef("struct.JSObjectType_02"), jsObjectTypeInfo, NULL, "defineProperty", sizeof(struct JSObjectType_02) - sizeof(struct JSObjectType_01));
    jsObjectTypeInfo = Add(context.getTypeRef("struct.JSObjectType_03"), jsObjectTypeInfo, NULL, "defineProperties", sizeof(struct JSObjectType_03) - sizeof(struct JSObjectType_02));
    jsObjectTypeInfo = Add(context.getTypeRef("struct.JSObjectType_04"), jsObjectTypeInfo, NULL, "freeze", sizeof(struct JSObjectType_04) - sizeof(struct JSObjectType_03));
    jsObjectTypeInfo = Add(context.getTypeRef("struct.JSObjectType_05"), jsObjectTypeInfo, NULL, "getOwnPropertyDescriptor", sizeof(struct JSObjectType_05) - sizeof(struct JSObjectType_04));
    jsObjectTypeInfo = Add(context.getTypeRef("struct.JSObjectType_06"), jsObjectTypeInfo, NULL, "getOwnPropertyNames", sizeof(struct JSObjectType_06) - sizeof(struct JSObjectType_05));
    jsObjectTypeInfo = Add(context.getTypeRef("struct.JSObjectType_07"), jsObjectTypeInfo, NULL, "getOwnPropertySymbols", sizeof(struct JSObjectType_07) - sizeof(struct JSObjectType_06));
    jsObjectTypeInfo = Add(context.getTypeRef("struct.JSObjectType_08"), jsObjectTypeInfo, NULL, "getPrototypeOf", sizeof(struct JSObjectType_08) - sizeof(struct JSObjectType_07));
    jsObjectTypeInfo = Add(context.getTypeRef("struct.JSObjectType_09"), jsObjectTypeInfo, NULL, "is", sizeof(struct JSObjectType_09) - sizeof(struct JSObjectType_08));
    jsObjectTypeInfo = Add(context.getTypeRef("struct.JSObjectType_10"), jsObjectTypeInfo, NULL, "isExtensible", sizeof(struct JSObjectType_10) - sizeof(struct JSObjectType_09));
    jsObjectTypeInfo = Add(context.getTypeRef("struct.JSObjectType_11"), jsObjectTypeInfo, NULL, "isFrozen", sizeof(struct JSObjectType_11) - sizeof(struct JSObjectType_10));
    jsObjectTypeInfo = Add(context.getTypeRef("struct.JSObjectType_12"), jsObjectTypeInfo, NULL, "isSealed", sizeof(struct JSObjectType_12) - sizeof(struct JSObjectType_11));
    jsObjectTypeInfo = Add(context.getTypeRef("struct.JSObjectType_13"), jsObjectTypeInfo, NULL, "keys", sizeof(struct JSObjectType_13) - sizeof(struct JSObjectType_12));
    jsObjectTypeInfo = Add(context.getTypeRef("struct.JSObjectType_14"), jsObjectTypeInfo, NULL, "preventExtensions", sizeof(struct JSObjectType_14) - sizeof(struct JSObjectType_13));
    jsObjectTypeInfo = Add(context.getTypeRef("struct.JSObjectType_15"), jsObjectTypeInfo, NULL, "seal", sizeof(struct JSObjectType_15) - sizeof(struct JSObjectType_14));
    jsObjectTypeInfo = Add(context.getTypeRef("struct.JSObjectType"), jsObjectTypeInfo, NULL, "setPrototypeOf", sizeof(struct JSObjectType) - sizeof(struct JSObjectType_15));
    jsBooleanTypeInfo = jsFunctionTypeInfo;
    jsNumberTypeInfo = Add(context.getTypeRef("struct.JSNumberType_01"), jsFunctionTypeInfo, NULL, "EPSILON", sizeof(struct JSNumberType_01) - sizeof(struct EJSFunctionType));
    jsNumberTypeInfo = Add(context.getTypeRef("struct.JSNumberType_02"), jsNumberTypeInfo, NULL, "MAX_SAFE_INTEGER", sizeof(struct JSNumberType_02) - sizeof(struct JSNumberType_01));
    jsNumberTypeInfo = Add(context.getTypeRef("struct.JSNumberType_03"), jsNumberTypeInfo, NULL, "MIN_SAFE_INTEGER", sizeof(struct JSNumberType_03) - sizeof(struct JSNumberType_02));
    jsNumberTypeInfo = Add(context.getTypeRef("struct.JSNumberType_04"), jsNumberTypeInfo, NULL, "MAX_VALUE", sizeof(struct JSNumberType_04) - sizeof(struct JSNumberType_03));
    jsNumberTypeInfo = Add(context.getTypeRef("struct.JSNumberType_05"), jsNumberTypeInfo, NULL, "MIN_VALUE", sizeof(struct JSNumberType_05) - sizeof(struct JSNumberType_04));
    jsNumberTypeInfo = Add(context.getTypeRef("struct.JSNumberType_06"), jsNumberTypeInfo, NULL, "NaN", sizeof(struct JSNumberType_06) - sizeof(struct JSNumberType_05));
    jsNumberTypeInfo = Add(context.getTypeRef("struct.JSNumberType_07"), jsNumberTypeInfo, NULL, "NEGATIVE_INFINITY", sizeof(struct JSNumberType_07) - sizeof(struct JSNumberType_06));
    jsNumberTypeInfo = Add(context.getTypeRef("struct.JSNumberType_08"), jsNumberTypeInfo, NULL, "POSITIVE_INFINITY", sizeof(struct JSNumberType_08) - sizeof(struct JSNumberType_07));
    jsNumberTypeInfo = Add(context.getTypeRef("struct.JSNumberType_09"), jsNumberTypeInfo, NULL, "isFinite", sizeof(struct JSNumberType_09) - sizeof(struct JSNumberType_08));
    jsNumberTypeInfo = Add(context.getTypeRef("struct.JSNumberType_10"), jsNumberTypeInfo, NULL, "isInteger", sizeof(struct JSNumberType_10) - sizeof(struct JSNumberType_09));
    jsNumberTypeInfo = Add(context.getTypeRef("struct.JSNumberType_11"), jsNumberTypeInfo, NULL, "isNaN", sizeof(struct JSNumberType_11) - sizeof(struct JSNumberType_10));
    jsNumberTypeInfo = Add(context.getTypeRef("struct.JSNumberType_12"), jsNumberTypeInfo, NULL, "isSafeInteger", sizeof(struct JSNumberType_12) - sizeof(struct JSNumberType_11));
    jsNumberTypeInfo = Add(context.getTypeRef("struct.JSNumberType_13"), jsNumberTypeInfo, NULL, "parseFloat", sizeof(struct JSNumberType_13) - sizeof(struct JSNumberType_12));
    jsNumberTypeInfo = Add(context.getTypeRef("struct.JSNumberType"), jsNumberTypeInfo, NULL, "parseInt", sizeof(struct JSNumberType) - sizeof(struct JSNumberType_13));
    jsStringTypeInfo = Add(context.getTypeRef("struct.JSStringType_01"), jsFunctionTypeInfo, NULL, "fromCharCode", sizeof(struct JSStringType_01) - sizeof(struct EJSFunctionType));
    jsStringTypeInfo = Add(context.getTypeRef("struct.JSStringType"), jsStringTypeInfo, NULL, "fromCodePoint", sizeof(struct JSStringType) - sizeof(struct JSStringType_01));
    jsArrayTypeInfo = Add(context.getTypeRef("struct.JSArrayType_01"), jsFunctionTypeInfo, NULL, "from", sizeof(struct JSArrayType_01) - sizeof(struct EJSFunctionType));
    jsArrayTypeInfo = Add(context.getTypeRef("struct.JSArrayType_02"), jsArrayTypeInfo, NULL, "isArray", sizeof(struct JSArrayType_02) - sizeof(struct JSArrayType_01));
    jsArrayTypeInfo = Add(context.getTypeRef("struct.JSArrayType"), jsArrayTypeInfo, NULL, "of", sizeof(struct JSArrayType) - sizeof(struct JSArrayType_02));

    //add all struct of Prototype types
    jsObjectProtoTypeInfo = Add(context.getTypeRef("struct.JSPrototype_01"), jsObjectInfo, NULL, "__defineGetter__", sizeof(struct JSPrototype_01) - sizeof(struct EJSObject));
    jsObjectProtoTypeInfo = Add(context.getTypeRef("struct.JSPrototype_02"), jsObjectProtoTypeInfo, NULL, "__defineSetter__", sizeof(struct JSPrototype_02) - sizeof(struct JSPrototype_01));
    jsObjectProtoTypeInfo = Add(context.getTypeRef("struct.JSPrototype_03"), jsObjectProtoTypeInfo, NULL, "__lookupGetter__", sizeof(struct JSPrototype_03) - sizeof(struct JSPrototype_02));
    jsObjectProtoTypeInfo = Add(context.getTypeRef("struct.JSPrototype_04"), jsObjectProtoTypeInfo, NULL, "__lookupSetter__", sizeof(struct JSPrototype_04) - sizeof(struct JSPrototype_03));
    jsObjectProtoTypeInfo = Add(context.getTypeRef("struct.JSPrototype_05"), jsObjectProtoTypeInfo, NULL, "hasOwnProperty", sizeof(struct JSPrototype_05) - sizeof(struct JSPrototype_04));
    jsObjectProtoTypeInfo = Add(context.getTypeRef("struct.JSPrototype_06"), jsObjectProtoTypeInfo, NULL, "isPrototypeOf", sizeof(struct JSPrototype_06) - sizeof(struct JSPrototype_05));
    jsObjectProtoTypeInfo = Add(context.getTypeRef("struct.JSPrototype_07"), jsObjectProtoTypeInfo, NULL, "propertyIsEnumerable", sizeof(struct JSPrototype_07) - sizeof(struct JSPrototype_06));
    jsObjectProtoTypeInfo = Add(context.getTypeRef("struct.JSPrototype_08"), jsObjectProtoTypeInfo, NULL, "toLocaleString", sizeof(struct JSPrototype_08) - sizeof(struct JSPrototype_07));
    jsObjectProtoTypeInfo = Add(context.getTypeRef("struct.JSPrototype_09"), jsObjectProtoTypeInfo, NULL, "toSource", sizeof(struct JSPrototype_09) - sizeof(struct JSPrototype_08));
    jsObjectProtoTypeInfo = Add(context.getTypeRef("struct.JSPrototype_10"), jsObjectProtoTypeInfo, NULL, "toString", sizeof(struct JSPrototype_10) - sizeof(struct JSPrototype_09));
    jsObjectProtoTypeInfo = Add(context.getTypeRef("struct.JSPrototype_11"), jsObjectProtoTypeInfo, NULL, "unwatch", sizeof(struct JSPrototype_11) - sizeof(struct JSPrototype_10));
    jsObjectProtoTypeInfo = Add(context.getTypeRef("struct.JSPrototype_12"), jsObjectProtoTypeInfo, NULL, "valueOf", sizeof(struct JSPrototype_12) - sizeof(struct JSPrototype_11));
    jsObjectProtoTypeInfo = Add(context.getTypeRef("struct.JSPrototype_13"), jsObjectProtoTypeInfo, NULL, "watch", sizeof(struct JSPrototype_13) - sizeof(struct JSPrototype_12));
    jsObjectProtoTypeInfo = Add(context.getTypeRef("struct.JSPrototype_14"), jsObjectProtoTypeInfo, NULL, "constructor", sizeof(struct JSPrototype_14) - sizeof(struct JSPrototype_13));
    jsObjectProtoTypeInfo = Add(context.getTypeRef("struct.JSPrototype"), jsObjectProtoTypeInfo, NULL, "__noSuchMethod__", sizeof(struct JSPrototype) - sizeof(struct JSPrototype_14));
    jsBooleanProtoTypeInfo = Add(context.getTypeRef("struct.JSBooleanPrototype_01"), jsObjectInfo, NULL, "toSource", sizeof(struct JSBooleanPrototype_01) - sizeof(struct EJSObject));
    jsBooleanProtoTypeInfo = Add(context.getTypeRef("struct.JSBooleanPrototype_02"), jsBooleanProtoTypeInfo, NULL, "toString", sizeof(struct JSBooleanPrototype_02) - sizeof(struct JSBooleanPrototype_01));
    jsBooleanProtoTypeInfo = Add(context.getTypeRef("struct.JSBooleanPrototype"), jsBooleanProtoTypeInfo, NULL, "valueOf", sizeof(struct JSBooleanPrototype) - sizeof(struct JSBooleanPrototype_02));
    jsNumberProtoTypeInfo = Add(context.getTypeRef("struct.JSNumberPrototype_01"), jsObjectInfo, NULL, "toExponential", sizeof(struct JSNumberPrototype_01) - sizeof(struct EJSObject));
    jsNumberProtoTypeInfo = Add(context.getTypeRef("struct.JSNumberPrototype_02"), jsNumberProtoTypeInfo, NULL, "toFixed", sizeof(struct JSNumberPrototype_02) - sizeof(struct JSNumberPrototype_01));
    jsNumberProtoTypeInfo = Add(context.getTypeRef("struct.JSNumberPrototype_03"), jsNumberProtoTypeInfo, NULL, "toLocaleString", sizeof(struct JSNumberPrototype_03) - sizeof(struct JSNumberPrototype_02));
    jsNumberProtoTypeInfo = Add(context.getTypeRef("struct.JSNumberPrototype_04"), jsNumberProtoTypeInfo, NULL, "toPrecision", sizeof(struct JSNumberPrototype_04) - sizeof(struct JSNumberPrototype_03));
    jsNumberProtoTypeInfo = Add(context.getTypeRef("struct.JSNumberPrototype_05"), jsNumberProtoTypeInfo, NULL, "toSource", sizeof(struct JSNumberPrototype_05) - sizeof(struct JSNumberPrototype_04));
    jsNumberProtoTypeInfo = Add(context.getTypeRef("struct.JSNumberPrototype_06"), jsNumberProtoTypeInfo, NULL, "toString", sizeof(struct JSNumberPrototype_06) - sizeof(struct JSNumberPrototype_05));
    jsNumberProtoTypeInfo = Add(context.getTypeRef("struct.JSNumberPrototype"), jsNumberProtoTypeInfo, NULL, "valueOf", sizeof(struct JSNumberPrototype) - sizeof(struct JSNumberPrototype_06));
    jsStringProtoTypeInfo = Add(context.getTypeRef("struct.JSStringPrototype_01"), jsObjectInfo, NULL, "anchor", sizeof(struct JSStringPrototype_01) - sizeof(struct EJSObject));
    jsStringProtoTypeInfo = Add(context.getTypeRef("struct.JSStringPrototype_02"), jsStringProtoTypeInfo, NULL, "big", sizeof(struct JSStringPrototype_02) - sizeof(struct JSStringPrototype_01));
    jsStringProtoTypeInfo = Add(context.getTypeRef("struct.JSStringPrototype_03"), jsStringProtoTypeInfo, NULL, "blink", sizeof(struct JSStringPrototype_03) - sizeof(struct JSStringPrototype_02));
    jsStringProtoTypeInfo = Add(context.getTypeRef("struct.JSStringPrototype_04"), jsStringProtoTypeInfo, NULL, "bold", sizeof(struct JSStringPrototype_04) - sizeof(struct JSStringPrototype_03));
    jsStringProtoTypeInfo = Add(context.getTypeRef("struct.JSStringPrototype_05"), jsStringProtoTypeInfo, NULL, "charAt", sizeof(struct JSStringPrototype_05) - sizeof(struct JSStringPrototype_04));
    jsStringProtoTypeInfo = Add(context.getTypeRef("struct.JSStringPrototype_06"), jsStringProtoTypeInfo, NULL, "charCodeAt", sizeof(struct JSStringPrototype_06) - sizeof(struct JSStringPrototype_05));
    jsStringProtoTypeInfo = Add(context.getTypeRef("struct.JSStringPrototype_07"), jsStringProtoTypeInfo, NULL, "codePointAt", sizeof(struct JSStringPrototype_07) - sizeof(struct JSStringPrototype_06));
    jsStringProtoTypeInfo = Add(context.getTypeRef("struct.JSStringPrototype_08"), jsStringProtoTypeInfo, NULL, "concat", sizeof(struct JSStringPrototype_08) - sizeof(struct JSStringPrototype_07));
    jsStringProtoTypeInfo = Add(context.getTypeRef("struct.JSStringPrototype_09"), jsStringProtoTypeInfo, NULL, "contains", sizeof(struct JSStringPrototype_09) - sizeof(struct JSStringPrototype_08));
    jsStringProtoTypeInfo = Add(context.getTypeRef("struct.JSStringPrototype_10"), jsStringProtoTypeInfo, NULL, "endsWith", sizeof(struct JSStringPrototype_10) - sizeof(struct JSStringPrototype_09));
    jsStringProtoTypeInfo = Add(context.getTypeRef("struct.JSStringPrototype_11"), jsStringProtoTypeInfo, NULL, "fixed", sizeof(struct JSStringPrototype_11) - sizeof(struct JSStringPrototype_10));
    jsStringProtoTypeInfo = Add(context.getTypeRef("struct.JSStringPrototype_12"), jsStringProtoTypeInfo, NULL, "fontcolor", sizeof(struct JSStringPrototype_12) - sizeof(struct JSStringPrototype_11));
    jsStringProtoTypeInfo = Add(context.getTypeRef("struct.JSStringPrototype_13"), jsStringProtoTypeInfo, NULL, "fontsize", sizeof(struct JSStringPrototype_13) - sizeof(struct JSStringPrototype_12));
    jsStringProtoTypeInfo = Add(context.getTypeRef("struct.JSStringPrototype_14"), jsStringProtoTypeInfo, NULL, "indexOf", sizeof(struct JSStringPrototype_14) - sizeof(struct JSStringPrototype_13));
    jsStringProtoTypeInfo = Add(context.getTypeRef("struct.JSStringPrototype_15"), jsStringProtoTypeInfo, NULL, "italics", sizeof(struct JSStringPrototype_15) - sizeof(struct JSStringPrototype_14));
    jsStringProtoTypeInfo = Add(context.getTypeRef("struct.JSStringPrototype_16"), jsStringProtoTypeInfo, NULL, "lastIndexOf", sizeof(struct JSStringPrototype_16) - sizeof(struct JSStringPrototype_15));
    jsStringProtoTypeInfo = Add(context.getTypeRef("struct.JSStringPrototype_17"), jsStringProtoTypeInfo, NULL, "link", sizeof(struct JSStringPrototype_17) - sizeof(struct JSStringPrototype_16));
    jsStringProtoTypeInfo = Add(context.getTypeRef("struct.JSStringPrototype_18"), jsStringProtoTypeInfo, NULL, "localeCompare", sizeof(struct JSStringPrototype_18) - sizeof(struct JSStringPrototype_17));
    jsStringProtoTypeInfo = Add(context.getTypeRef("struct.JSStringPrototype_19"), jsStringProtoTypeInfo, NULL, "match", sizeof(struct JSStringPrototype_19) - sizeof(struct JSStringPrototype_18));
    jsStringProtoTypeInfo = Add(context.getTypeRef("struct.JSStringPrototype_20"), jsStringProtoTypeInfo, NULL, "normalize", sizeof(struct JSStringPrototype_20) - sizeof(struct JSStringPrototype_19));
    jsStringProtoTypeInfo = Add(context.getTypeRef("struct.JSStringPrototype_21"), jsStringProtoTypeInfo, NULL, "quote", sizeof(struct JSStringPrototype_21) - sizeof(struct JSStringPrototype_20));
    jsStringProtoTypeInfo = Add(context.getTypeRef("struct.JSStringPrototype_22"), jsStringProtoTypeInfo, NULL, "repeat", sizeof(struct JSStringPrototype_22) - sizeof(struct JSStringPrototype_21));
    jsStringProtoTypeInfo = Add(context.getTypeRef("struct.JSStringPrototype_23"), jsStringProtoTypeInfo, NULL, "replace", sizeof(struct JSStringPrototype_23) - sizeof(struct JSStringPrototype_22));
    jsStringProtoTypeInfo = Add(context.getTypeRef("struct.JSStringPrototype_24"), jsStringProtoTypeInfo, NULL, "search", sizeof(struct JSStringPrototype_24) - sizeof(struct JSStringPrototype_23));
    jsStringProtoTypeInfo = Add(context.getTypeRef("struct.JSStringPrototype_25"), jsStringProtoTypeInfo, NULL, "slice", sizeof(struct JSStringPrototype_25) - sizeof(struct JSStringPrototype_24));
    jsStringProtoTypeInfo = Add(context.getTypeRef("struct.JSStringPrototype_26"), jsStringProtoTypeInfo, NULL, "small", sizeof(struct JSStringPrototype_26) - sizeof(struct JSStringPrototype_25));
    jsStringProtoTypeInfo = Add(context.getTypeRef("struct.JSStringPrototype_27"), jsStringProtoTypeInfo, NULL, "split", sizeof(struct JSStringPrototype_27) - sizeof(struct JSStringPrototype_26));
    jsStringProtoTypeInfo = Add(context.getTypeRef("struct.JSStringPrototype_28"), jsStringProtoTypeInfo, NULL, "startsWith", sizeof(struct JSStringPrototype_28) - sizeof(struct JSStringPrototype_27));
    jsStringProtoTypeInfo = Add(context.getTypeRef("struct.JSStringPrototype_29"), jsStringProtoTypeInfo, NULL, "strike", sizeof(struct JSStringPrototype_29) - sizeof(struct JSStringPrototype_28));
    jsStringProtoTypeInfo = Add(context.getTypeRef("struct.JSStringPrototype_30"), jsStringProtoTypeInfo, NULL, "sub", sizeof(struct JSStringPrototype_30) - sizeof(struct JSStringPrototype_29));
    jsStringProtoTypeInfo = Add(context.getTypeRef("struct.JSStringPrototype_31"), jsStringProtoTypeInfo, NULL, "substr", sizeof(struct JSStringPrototype_31) - sizeof(struct JSStringPrototype_30));
    jsStringProtoTypeInfo = Add(context.getTypeRef("struct.JSStringPrototype_32"), jsStringProtoTypeInfo, NULL, "substring", sizeof(struct JSStringPrototype_32) - sizeof(struct JSStringPrototype_31));
    jsStringProtoTypeInfo = Add(context.getTypeRef("struct.JSStringPrototype_33"), jsStringProtoTypeInfo, NULL, "sup", sizeof(struct JSStringPrototype_33) - sizeof(struct JSStringPrototype_32));
    jsStringProtoTypeInfo = Add(context.getTypeRef("struct.JSStringPrototype_34"), jsStringProtoTypeInfo, NULL, "toLocaleLowerCase", sizeof(struct JSStringPrototype_34) - sizeof(struct JSStringPrototype_33));
    jsStringProtoTypeInfo = Add(context.getTypeRef("struct.JSStringPrototype_35"), jsStringProtoTypeInfo, NULL, "toLocaleUpperCase", sizeof(struct JSStringPrototype_35) - sizeof(struct JSStringPrototype_34));
    jsStringProtoTypeInfo = Add(context.getTypeRef("struct.JSStringPrototype_36"), jsStringProtoTypeInfo, NULL, "toLowerCase", sizeof(struct JSStringPrototype_36) - sizeof(struct JSStringPrototype_35));
    jsStringProtoTypeInfo = Add(context.getTypeRef("struct.JSStringPrototype_37"), jsStringProtoTypeInfo, NULL, "toSource", sizeof(struct JSStringPrototype_37) - sizeof(struct JSStringPrototype_36));
    jsStringProtoTypeInfo = Add(context.getTypeRef("struct.JSStringPrototype_38"), jsStringProtoTypeInfo, NULL, "toString", sizeof(struct JSStringPrototype_38) - sizeof(struct JSStringPrototype_37));
    jsStringProtoTypeInfo = Add(context.getTypeRef("struct.JSStringPrototype_39"), jsStringProtoTypeInfo, NULL, "toUpperCase", sizeof(struct JSStringPrototype_39) - sizeof(struct JSStringPrototype_38));
    jsStringProtoTypeInfo = Add(context.getTypeRef("struct.JSStringPrototype_40"), jsStringProtoTypeInfo, NULL, "trim", sizeof(struct JSStringPrototype_40) - sizeof(struct JSStringPrototype_39));
    jsStringProtoTypeInfo = Add(context.getTypeRef("struct.JSStringPrototype_41"), jsStringProtoTypeInfo, NULL, "trimLeft", sizeof(struct JSStringPrototype_41) - sizeof(struct JSStringPrototype_40));
    jsStringProtoTypeInfo = Add(context.getTypeRef("struct.JSStringPrototype_42"), jsStringProtoTypeInfo, NULL, "trimRight", sizeof(struct JSStringPrototype_42) - sizeof(struct JSStringPrototype_41));
    jsStringProtoTypeInfo = Add(context.getTypeRef("struct.JSStringPrototype"), jsStringProtoTypeInfo, NULL, "valueOf", sizeof(struct JSStringPrototype) - sizeof(struct JSStringPrototype_42));
    jsArrayProtoTypeInfo = Add(context.getTypeRef("struct.JSArrayPrototype_01"), jsObjectInfo, NULL, "concat", sizeof(struct JSArrayPrototype_01) - sizeof(struct EJSObject));
    jsArrayProtoTypeInfo = Add(context.getTypeRef("struct.JSArrayPrototype_02"), jsArrayProtoTypeInfo, NULL, "copyWithin", sizeof(struct JSArrayPrototype_02) - sizeof(struct JSArrayPrototype_01));
    jsArrayProtoTypeInfo = Add(context.getTypeRef("struct.JSArrayPrototype_03"), jsArrayProtoTypeInfo, NULL, "entries", sizeof(struct JSArrayPrototype_03) - sizeof(struct JSArrayPrototype_02));
    jsArrayProtoTypeInfo = Add(context.getTypeRef("struct.JSArrayPrototype_04"), jsArrayProtoTypeInfo, NULL, "every", sizeof(struct JSArrayPrototype_04) - sizeof(struct JSArrayPrototype_03));
    jsArrayProtoTypeInfo = Add(context.getTypeRef("struct.JSArrayPrototype_05"), jsArrayProtoTypeInfo, NULL, "fill", sizeof(struct JSArrayPrototype_05) - sizeof(struct JSArrayPrototype_04));
    jsArrayProtoTypeInfo = Add(context.getTypeRef("struct.JSArrayPrototype_06"), jsArrayProtoTypeInfo, NULL, "filter", sizeof(struct JSArrayPrototype_06) - sizeof(struct JSArrayPrototype_05));
    jsArrayProtoTypeInfo = Add(context.getTypeRef("struct.JSArrayPrototype_07"), jsArrayProtoTypeInfo, NULL, "find", sizeof(struct JSArrayPrototype_07) - sizeof(struct JSArrayPrototype_06));
    jsArrayProtoTypeInfo = Add(context.getTypeRef("struct.JSArrayPrototype_08"), jsArrayProtoTypeInfo, NULL, "findIndex", sizeof(struct JSArrayPrototype_08) - sizeof(struct JSArrayPrototype_07));
    jsArrayProtoTypeInfo = Add(context.getTypeRef("struct.JSArrayPrototype_09"), jsArrayProtoTypeInfo, NULL, "forEach", sizeof(struct JSArrayPrototype_09) - sizeof(struct JSArrayPrototype_08));
    jsArrayProtoTypeInfo = Add(context.getTypeRef("struct.JSArrayPrototype_10"), jsArrayProtoTypeInfo, NULL, "indexOf", sizeof(struct JSArrayPrototype_10) - sizeof(struct JSArrayPrototype_09));
    jsArrayProtoTypeInfo = Add(context.getTypeRef("struct.JSArrayPrototype_11"), jsArrayProtoTypeInfo, NULL, "join", sizeof(struct JSArrayPrototype_11) - sizeof(struct JSArrayPrototype_10));
    jsArrayProtoTypeInfo = Add(context.getTypeRef("struct.JSArrayPrototype_12"), jsArrayProtoTypeInfo, NULL, "keys", sizeof(struct JSArrayPrototype_12) - sizeof(struct JSArrayPrototype_11));
    jsArrayProtoTypeInfo = Add(context.getTypeRef("struct.JSArrayPrototype_13"), jsArrayProtoTypeInfo, NULL, "lastIndexOf", sizeof(struct JSArrayPrototype_13) - sizeof(struct JSArrayPrototype_12));
    jsArrayProtoTypeInfo = Add(context.getTypeRef("struct.JSArrayPrototype_14"), jsArrayProtoTypeInfo, NULL, "map", sizeof(struct JSArrayPrototype_14) - sizeof(struct JSArrayPrototype_13));
    jsArrayProtoTypeInfo = Add(context.getTypeRef("struct.JSArrayPrototype_15"), jsArrayProtoTypeInfo, NULL, "pop", sizeof(struct JSArrayPrototype_15) - sizeof(struct JSArrayPrototype_14));
    jsArrayProtoTypeInfo = Add(context.getTypeRef("struct.JSArrayPrototype_16"), jsArrayProtoTypeInfo, NULL, "push", sizeof(struct JSArrayPrototype_16) - sizeof(struct JSArrayPrototype_15));
    jsArrayProtoTypeInfo = Add(context.getTypeRef("struct.JSArrayPrototype_17"), jsArrayProtoTypeInfo, NULL, "reduce", sizeof(struct JSArrayPrototype_17) - sizeof(struct JSArrayPrototype_16));
    jsArrayProtoTypeInfo = Add(context.getTypeRef("struct.JSArrayPrototype_18"), jsArrayProtoTypeInfo, NULL, "reduceRight", sizeof(struct JSArrayPrototype_18) - sizeof(struct JSArrayPrototype_17));
    jsArrayProtoTypeInfo = Add(context.getTypeRef("struct.JSArrayPrototype_19"), jsArrayProtoTypeInfo, NULL, "reverse", sizeof(struct JSArrayPrototype_19) - sizeof(struct JSArrayPrototype_18));
    jsArrayProtoTypeInfo = Add(context.getTypeRef("struct.JSArrayPrototype_20"), jsArrayProtoTypeInfo, NULL, "shift", sizeof(struct JSArrayPrototype_20) - sizeof(struct JSArrayPrototype_19));
    jsArrayProtoTypeInfo = Add(context.getTypeRef("struct.JSArrayPrototype_21"), jsArrayProtoTypeInfo, NULL, "slice", sizeof(struct JSArrayPrototype_21) - sizeof(struct JSArrayPrototype_20));
    jsArrayProtoTypeInfo = Add(context.getTypeRef("struct.JSArrayPrototype_22"), jsArrayProtoTypeInfo, NULL, "some", sizeof(struct JSArrayPrototype_22) - sizeof(struct JSArrayPrototype_21));
    jsArrayProtoTypeInfo = Add(context.getTypeRef("struct.JSArrayPrototype_23"), jsArrayProtoTypeInfo, NULL, "sort", sizeof(struct JSArrayPrototype_23) - sizeof(struct JSArrayPrototype_22));
    jsArrayProtoTypeInfo = Add(context.getTypeRef("struct.JSArrayPrototype_24"), jsArrayProtoTypeInfo, NULL, "splice", sizeof(struct JSArrayPrototype_24) - sizeof(struct JSArrayPrototype_23));
    jsArrayProtoTypeInfo = Add(context.getTypeRef("struct.JSArrayPrototype_25"), jsArrayProtoTypeInfo, NULL, "toLocaleString", sizeof(struct JSArrayPrototype_25) - sizeof(struct JSArrayPrototype_24));
    jsArrayProtoTypeInfo = Add(context.getTypeRef("struct.JSArrayPrototype_26"), jsArrayProtoTypeInfo, NULL, "toSource", sizeof(struct JSArrayPrototype_26) - sizeof(struct JSArrayPrototype_25));
    jsArrayProtoTypeInfo = Add(context.getTypeRef("struct.JSArrayPrototype_27"), jsArrayProtoTypeInfo, NULL, "toString", sizeof(struct JSArrayPrototype_27) - sizeof(struct JSArrayPrototype_26));
    jsArrayProtoTypeInfo = Add(context.getTypeRef("struct.JSArrayPrototype"), jsArrayProtoTypeInfo, NULL, "unshift", sizeof(struct JSArrayPrototype) - sizeof(struct JSArrayPrototype_27));
    jsFunctionProtoTypeInfo = Add(context.getTypeRef("struct.EJSFunctionPrototype_01"), jsObjectInfo, NULL, "apply", sizeof(struct EJSFunctionPrototype_01) - sizeof(struct EJSObject));
    jsFunctionProtoTypeInfo = Add(context.getTypeRef("struct.EJSFunctionPrototype_02"), jsFunctionProtoTypeInfo, NULL, "bind", sizeof(struct EJSFunctionPrototype_02) - sizeof(struct EJSFunctionPrototype_01));
    jsFunctionProtoTypeInfo = Add(context.getTypeRef("struct.EJSFunctionPrototype_03"), jsFunctionProtoTypeInfo, NULL, "call", sizeof(struct EJSFunctionPrototype_03) - sizeof(struct EJSFunctionPrototype_02));
    jsFunctionProtoTypeInfo = Add(context.getTypeRef("struct.EJSFunctionPrototype_04"), jsFunctionProtoTypeInfo, NULL, "isGenerator", sizeof(struct EJSFunctionPrototype_04) - sizeof(struct EJSFunctionPrototype_03));
    jsFunctionProtoTypeInfo = Add(context.getTypeRef("struct.EJSFunctionPrototype_05"), jsFunctionProtoTypeInfo, NULL, "toSource", sizeof(struct EJSFunctionPrototype_05) - sizeof(struct EJSFunctionPrototype_04));
    jsFunctionProtoTypeInfo = Add(context.getTypeRef("struct.EJSFunctionPrototype"), jsFunctionProtoTypeInfo, NULL, "toString", sizeof(struct EJSFunctionPrototype) - sizeof(struct EJSFunctionPrototype_05));

    //update type info if needed
    ((JSTypeInfo *)(&jsFunctionObject_02Info->data))->memberTypeInfo = jsFunctionObjectInfo;
    ((JSTypeInfo *)(&jsObject_01Info->data))->memberTypeInfo = jsObjectProtoTypeInfo;
    ((JSTypeInfo *)(&jsFunctionTypeInfo->data))->memberTypeInfo = jsObjectProtoTypeInfo;

    jsTypeTree->print();
}
Пример #24
0
void AssertStatement::codeGen(CodeGenContext &context)
{
    m_expr->codeGen(context);
    context.vassert();
}
Пример #25
0
void PrintStatement::codeGen(CodeGenContext &context)
{
    m_expr->codeGen(context);

    context.vprint(m_expr->type());
}
Пример #26
0
void Integer::codeGen(CodeGenContext& context)
{
    if (debug)
        std::cout << "Creating integer: " << m_value << endl;
    context.vpush(m_value);
}
Пример #27
0
void String::codeGen(CodeGenContext &context)
{
    int ref_id = context.add_constant(&m_value);
    context.vpush_constant(ref_id);
}