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

Function genNullReferenceExceptionCheck

src/hx/cppia/Cppia.cpp:1983–1994  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1981#ifdef CPPIA_JIT
1982static hx::Object *nullException = 0;
1983void genNullReferenceExceptionCheck(CppiaCompiler *compiler, const JitVal &reg)
1984{
1985 #ifdef HXCPP_CHECK_POINTER
1986 if (!nullException)
1987 nullException = (HX_CSTRING("Null Object Reference")).makePermanentObject();
1988
1989 JumpId nonNull = compiler->compare(cmpP_NOT_EQUAL, reg.as(jtPointer), (void *)0);
1990 compiler->move( sJitCtx.star(jtPointer, offsetof(hx::StackContext,exception)), (void *)nullException );
1991 compiler->addThrow();
1992 compiler->comeFrom(nonNull);
1993 #endif
1994}
1995#endif
1996
1997

Callers 6

genCodeMethod · 0.85
genCodeMethod · 0.85
genCodeMethod · 0.85
genCodeMethod · 0.85
genCodeMethod · 0.85
genCodeMethod · 0.85

Calls 6

makePermanentObjectMethod · 0.80
asMethod · 0.80
moveMethod · 0.80
comeFromMethod · 0.80
compareMethod · 0.45
starMethod · 0.45

Tested by

no test coverage detected