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

Method genCode

src/hx/cppia/Cppia.cpp:3016–3067  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3014
3015 #ifdef CPPIA_JIT
3016 void genCode(CppiaCompiler *compiler, const JitVal &inDest,ExprType destType) HXCPP_OVERRIDE
3017 {
3018 // TODO - interfaces
3019 if (object)
3020 {
3021 object->genCode(compiler, sJitTemp0.as(jtPointer), etObject);
3022 genNullReferenceExceptionCheck(compiler, sJitTemp0);
3023 }
3024 else if (isStatic)
3025 {
3026 compiler->move(sJitTemp0, (void *)&staticClass.mPtr);
3027 compiler->move(sJitTemp0, sJitTemp0.star() );
3028 }
3029 else
3030 {
3031 // this...
3032 compiler->move(sJitTemp0, sJitThis );
3033 }
3034
3035 switch(destType)
3036 {
3037 case etInt:
3038 compiler->callNative( (void *)getFieldInt, sJitTemp0.as(jtPointer), (void *)&name);
3039 compiler->checkException();
3040 compiler->move(inDest.as(jtInt), sJitReturnReg.as(jtInt));
3041 break;
3042 case etFloat:
3043 if (isMemoryVal(inDest))
3044 {
3045 compiler->callNative( (void *)getFieldFloat, sJitTemp0.as(jtPointer), (void *)&name, inDest.as(jtFloat) );
3046 compiler->checkException();
3047 }
3048 else
3049 {
3050 JitTemp floatResult(compiler, jtFloat);
3051 compiler->callNative( (void *)getFieldFloat, sJitTemp0.as(jtPointer), &name, floatResult );
3052 compiler->checkException();
3053 compiler->move(inDest.as(jtFloat), floatResult);
3054 }
3055 break;
3056 case etString:
3057 compiler->callNative( (void *)getFieldString, sJitTemp0.as(jtPointer), (void *)&name, inDest.as(jtString) );
3058 compiler->checkException();
3059 break;
3060 case etObject:
3061 compiler->callNative( (void *)getFieldObject, sJitTemp0.as(jtPointer), (void *)&name);
3062 compiler->checkException();
3063 compiler->move(inDest.as(jtPointer), sJitReturnReg.as(jtPointer));
3064 break;
3065 default: ;
3066 }
3067 }
3068 #endif
3069
3070 CppiaExpr *makeSetter(AssignOp inOp,CppiaExpr *inValue) HXCPP_OVERRIDE

Callers

nothing calls this directly

Calls 8

isMemoryValFunction · 0.85
asMethod · 0.80
moveMethod · 0.80
callNativeMethod · 0.80
checkExceptionMethod · 0.80
genCodeMethod · 0.45
starMethod · 0.45

Tested by

no test coverage detected