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

Method genCode

src/hx/cppia/Cppia.cpp:3971–4071  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3969
3970 #ifdef CPPIA_JIT
3971 void genCode(CppiaCompiler *compiler, const JitVal &inDest,ExprType destType) HXCPP_OVERRIDE
3972 {
3973 JitType targetType = sizeof(T)==1 ? jtByte : sizeof(T)==2 ? jtShort : getJitType(getType());
3974 bool useTemp = targetType == jtByte || targetType==jtShort;
3975
3976 switch(REFMODE)
3977 {
3978 case locObj:
3979 {
3980 JitTemp tmpObject(compiler,jtPointer);
3981 object->genCode(compiler, tmpObject, etObject);
3982 genNullReferenceExceptionCheck(compiler, tmpObject);
3983 JitTemp tmpVal(compiler,getType());
3984
3985 if (op==aoSet)
3986 {
3987 value->genCode(compiler, tmpVal, getType());
3988 }
3989 else
3990 {
3991 compiler->move( sJitTemp2, tmpObject );
3992 compiler->move( tmpVal, sJitTemp2.star(targetType) + offset );
3993 genSetter(compiler, tmpVal, getType(), op, value);
3994 }
3995 compiler->move( sJitTemp2, tmpObject );
3996
3997 compiler->move( sJitTemp2.star(targetType) + offset, tmpVal );
3998
3999 #ifdef HXCPP_GC_GENERATIONAL
4000 if (isPointerObject((T*)0))
4001 genWriteBarrier(compiler, sJitTemp2, (tmpVal + ((targetType==jtString ? StringOffset::Ptr : 0))).as(jtPointer) );
4002 #endif
4003
4004 compiler->convert( tmpVal, getType(), inDest, destType );
4005 }
4006 break;
4007
4008 case locThis:
4009 case locStack:
4010 {
4011 JitVal target = REFMODE==locThis ? (JitVal)JitThisPos(offset, targetType ) :
4012 (JitVal)JitFramePos(offset,targetType );
4013
4014 if (op==aoSet)
4015 {
4016 if (useTemp)
4017 {
4018 JitTemp tmp(compiler, getType());
4019 value->genCode(compiler, tmp, getType());
4020 compiler->move(target,tmp);
4021 compiler->convert( tmp,getType(),inDest, destType );
4022 }
4023 else
4024 {
4025 value->genCode(compiler, target, getType());
4026
4027 #ifdef HXCPP_GC_GENERATIONAL
4028 if (REFMODE==locThis && isPointerObject((T*)0))

Callers

nothing calls this directly

Calls 13

getJitTypeFunction · 0.85
genSetterFunction · 0.85
isPointerObjectFunction · 0.85
genWriteBarrierFunction · 0.85
JitThisPosClass · 0.85
JitFramePosClass · 0.85
JitValClass · 0.85
moveMethod · 0.80
asMethod · 0.80
convertMethod · 0.80
genCodeMethod · 0.45

Tested by

no test coverage detected