MCPcopy Create free account
hub / github.com/HaxeFoundation/hxcpp / genCode

Method genCode

src/hx/cppia/CppiaClasses.cpp:90–123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

88 }
89
90 void genCode(CppiaCompiler *compiler, Expressions &inArgs, const JitVal &inDest, ExprType destType)
91 {
92 bool ok = args.size() && args.size()==inArgs.size();
93 if (!ok)
94 printf("Bad enum arg count\n");
95
96 compiler->callNative( (void *)createEnumBase, (void *)this );
97 JitTemp result(compiler,jtPointer);
98 compiler->move(result, sJitReturnReg);
99
100 int offset = sizeof(EnumBase_obj);
101 for(int i=0;i<args.size();i++)
102 {
103 ExprType type = inArgs[i]->getType();
104 JitTemp val(compiler,getJitType(type));
105 inArgs[i]->genCode(compiler, val, inArgs[i]->getType());
106 compiler->move( sJitReturnReg.as(jtPointer), result );
107 if (type==etString)
108 {
109 compiler->move( sJitReturnReg.star(jtInt,offset + offsetof(cpp::Variant,valStringLen)), val.as(jtInt) );
110 compiler->move( sJitReturnReg.star(jtPointer,offset), val.as(jtPointer) + StringOffset::Ptr);
111 }
112 else
113 {
114 compiler->move( sJitReturnReg.star(type,offset), val );
115 }
116 compiler->move( sJitReturnReg.star(jtInt,offset + offsetof(cpp::Variant,type)), (int)getVariantType(type) );
117
118 offset += sizeof(cpp::Variant);
119 }
120
121 if (destType==etObject)
122 compiler->move(inDest, sJitReturnReg.as(jtPointer));
123 }
124 #endif
125
126};

Callers

nothing calls this directly

Calls 8

getJitTypeFunction · 0.85
callNativeMethod · 0.80
moveMethod · 0.80
asMethod · 0.80
sizeMethod · 0.45
getTypeMethod · 0.45
genCodeMethod · 0.45
starMethod · 0.45

Tested by

no test coverage detected