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

Method genCode

src/hx/cppia/Cppia.cpp:1854–1900  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1852 }
1853
1854 void genCode(CppiaCompiler *compiler, const JitVal &inDest,ExprType destType) HXCPP_OVERRIDE
1855 {
1856 int framePos = compiler->getCurrentFrameSize();
1857
1858 // Push this ...
1859 if (thisExpr)
1860 thisExpr->genCode(compiler, JitFramePos(framePos), etObject);
1861 else if (isStatic)
1862 compiler->move(JitFramePos(framePos), (void *)0);
1863 else
1864 compiler->move(JitFramePos(framePos), sJitThis);
1865 compiler->addFrame(etObject);
1866
1867
1868 // Push args...
1869 const char *s = function.signature+1;
1870 for(int a=0;a<args.size();a++)
1871 {
1872 CppiaExpr *arg = args[a];
1873 ExprType argType = etNull;
1874 switch(*s++)
1875 {
1876 case sigBool:
1877 case sigInt:
1878 argType = etInt; break;
1879 case sigFloat: argType = etFloat; break;
1880 case sigString: argType = etString; break;
1881 case sigObject: argType = etObject; break;
1882 default: ;// huh?
1883 }
1884
1885 if (argType!=etNull)
1886 {
1887 args[a]->genCode( compiler, JitFramePos( compiler->getCurrentFrameSize() ).as( getJitType(argType)), argType );
1888 compiler->addFrame(argType);
1889 }
1890 }
1891
1892 compiler->restoreFrameSize(framePos);
1893 // Store new frame in context ...
1894 compiler->add( sJitCtxFrame, sJitFrame.as(jtPointer), JitVal(framePos) );
1895
1896 void *func = (void *) ( isSuper ? function.superExecute : function.execute);
1897 compiler->callNative( (void *)tryCallHaxe, JitVal(func), sJitCtx );
1898
1899 genFunctionResult(compiler, inDest, destType, returnType, isBoolInt());
1900 }
1901
1902 #endif
1903};

Callers

nothing calls this directly

Calls 13

JitFramePosClass · 0.85
getJitTypeFunction · 0.85
JitValClass · 0.85
genFunctionResultFunction · 0.85
getCurrentFrameSizeMethod · 0.80
moveMethod · 0.80
addFrameMethod · 0.80
asMethod · 0.80
restoreFrameSizeMethod · 0.80
callNativeMethod · 0.80
genCodeMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected