MCPcopy Create free account
hub / github.com/ZDoom/Raze / _newConst

Method _newConst

libraries/asmjit/asmjit/base/codecompiler.cpp:458–485  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

456}
457
458Error CodeCompiler::_newConst(Mem& out, uint32_t scope, const void* data, size_t size) {
459 CBConstPool** pPool;
460 if (scope == kConstScopeLocal)
461 pPool = &_localConstPool;
462 else if (scope == kConstScopeGlobal)
463 pPool = &_globalConstPool;
464 else
465 return setLastError(DebugUtils::errored(kErrorInvalidArgument));
466
467 if (!*pPool && !(*pPool = newConstPool()))
468 return setLastError(DebugUtils::errored(kErrorNoHeapMemory));
469
470 CBConstPool* pool = *pPool;
471 size_t off;
472
473 Error err = pool->add(data, size, off);
474 if (ASMJIT_UNLIKELY(err)) return setLastError(err);
475
476 out = Mem(Init,
477 Label::kLabelTag, // Base type.
478 pool->getId(), // Base id.
479 0, // Index type.
480 kInvalidValue, // Index id.
481 static_cast<int32_t>(off), // Offset.
482 static_cast<uint32_t>(size), // Size.
483 0); // Flags.
484 return kErrorOk;
485}
486
487Error CodeCompiler::alloc(Reg& reg) {
488 if (!reg.isVirtReg()) return kErrorOk;

Callers

nothing calls this directly

Calls 4

erroredFunction · 0.85
MemClass · 0.85
addMethod · 0.45
getIdMethod · 0.45

Tested by

no test coverage detected