MCPcopy Create free account
hub / github.com/WheretIB/nullc / nullcRunFunction

Function nullcRunFunction

NULLC/nullc.cpp:497–577  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

495#endif
496
497nullres nullcRunFunction(const char* funcName, ...)
498{
499 using namespace NULLC;
500 NULLC_CHECK_INITIALIZED(false);
501
502 nullres good = true;
503
504#ifndef NULLC_NO_EXECUTOR
505 static char errorBuf[512];
506 const char* argBuf = NULL;
507
508 unsigned int functionID = ~0u;
509 // If function is called, find it's index
510 if(funcName)
511 {
512 unsigned int fnameHash = GetStringHash(funcName);
513 for(int i = (int)linker->exFunctions.size()-1; i >= 0; i--)
514 {
515 if(linker->exFunctions[i].nameHash == fnameHash)
516 {
517 functionID = i;
518 break;
519 }
520 }
521 if(functionID == ~0u)
522 {
523 SafeSprintf(errorBuf, 512, "ERROR: function %s not found", funcName);
524 nullcLastError = errorBuf;
525 return 0;
526 }
527 // Copy arguments in argument buffer
528 va_list args;
529 va_start(args, funcName);
530 argBuf = nullcGetArgumentVector(functionID, 0, args);
531 va_end(args);
532 if(!argBuf)
533 return false;
534 }
535#else
536 (void)funcName;
537#endif
538 if(currExec == NULLC_VM)
539 {
540#ifndef NULLC_NO_EXECUTOR
541 executor->Run(functionID, argBuf);
542 const char* error = executor->GetExecError();
543 if(error[0] != '\0')
544 {
545 good = false;
546 nullcLastError = error;
547 }
548#endif
549 }else if(currExec == NULLC_X86){
550#ifdef NULLC_BUILD_X86_JIT
551 executorX86->Run(functionID, argBuf);
552 const char* error = executorX86->GetExecError();
553 if(error[0] != '\0')
554 {

Callers 13

CalcThreadFunction · 0.85
nullcRunFunction · 0.85
CollectMemoryMethod · 0.85
FinalizeMemoryMethod · 0.85
RecallerTransitionFunction · 0.85
RunInterfaceTestsFunction · 0.85
RecallerFunction · 0.85
Recaller2Function · 0.85
Recaller3Function · 0.85
RecallerCSFunction · 0.85
RecallerGC1Function · 0.85
RecallerGC2Function · 0.85

Calls 6

nullcGetArgumentVectorFunction · 0.85
GetStringHashFunction · 0.70
SafeSprintfFunction · 0.70
sizeMethod · 0.45
RunMethod · 0.45
GetExecErrorMethod · 0.45

Tested by 9

RecallerTransitionFunction · 0.68
RunInterfaceTestsFunction · 0.68
RecallerFunction · 0.68
Recaller2Function · 0.68
Recaller3Function · 0.68
RecallerCSFunction · 0.68
RecallerGC1Function · 0.68
RecallerGC2Function · 0.68
RecallerGC3Function · 0.68