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

Method init

libraries/asmjit/asmjit/base/codeholder.cpp:107–138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

105// ============================================================================
106
107Error CodeHolder::init(const CodeInfo& info) noexcept {
108 // Cannot reinitialize if it's locked or there is one or more CodeEmitter
109 // attached.
110 if (isInitialized())
111 return DebugUtils::errored(kErrorAlreadyInitialized);
112
113 // If we are just initializing there should be no emitters attached).
114 ASMJIT_ASSERT(_emitters == nullptr);
115
116 // Create the default section and insert it to the `_sections` array.
117 Error err = _sections.willGrow(&_baseHeap);
118 if (err == kErrorOk) {
119 SectionEntry* se = _baseZone.allocZeroedT<SectionEntry>();
120 if (ASMJIT_LIKELY(se)) {
121 se->_flags = SectionEntry::kFlagExec | SectionEntry::kFlagConst;
122 se->_setDefaultName('.', 't', 'e', 'x', 't');
123 _sections.appendUnsafe(se);
124 }
125 else {
126 err = DebugUtils::errored(kErrorNoHeapMemory);
127 }
128 }
129
130 if (ASMJIT_UNLIKELY(err)) {
131 _baseZone.reset(false);
132 return err;
133 }
134 else {
135 _codeInfo = info;
136 return kErrorOk;
137 }
138}
139
140void CodeHolder::reset(bool releaseMemory) noexcept {
141 CodeHolder_resetInternal(this, releaseMemory);

Callers

nothing calls this directly

Calls 6

isInitializedFunction · 0.85
erroredFunction · 0.85
willGrowMethod · 0.80
_setDefaultNameMethod · 0.80
appendUnsafeMethod · 0.80
resetMethod · 0.45

Tested by

no test coverage detected