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

Function CodeHolder_resetInternal

libraries/asmjit/asmjit/base/codeholder.cpp:43–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41}
42
43static void CodeHolder_resetInternal(CodeHolder* self, bool releaseMemory) noexcept {
44 // Detach all `CodeEmitter`s.
45 while (self->_emitters)
46 self->detach(self->_emitters);
47
48 // Reset everything into its construction state.
49 self->_codeInfo.reset();
50 self->_globalHints = 0;
51 self->_globalOptions = 0;
52 self->_logger = nullptr;
53 self->_errorHandler = nullptr;
54
55 self->_unresolvedLabelsCount = 0;
56 self->_trampolinesSize = 0;
57
58 // Reset all sections.
59 size_t numSections = self->_sections.getLength();
60 for (size_t i = 0; i < numSections; i++) {
61 SectionEntry* section = self->_sections[i];
62 if (section->_buffer.hasData() && !section->_buffer.isExternal())
63 Internal::releaseMemory(section->_buffer._data);
64 section->_buffer._data = nullptr;
65 section->_buffer._capacity = 0;
66 }
67
68 // Reset zone allocator and all containers using it.
69 ZoneHeap* heap = &self->_baseHeap;
70
71 self->_namedLabels.reset(heap);
72 self->_relocations.reset();
73 self->_labels.reset();
74 self->_sections.reset();
75
76 heap->reset(&self->_baseZone);
77 self->_baseZone.reset(releaseMemory);
78}
79
80// ============================================================================
81// [asmjit::CodeHolder - Construction / Destruction]

Callers 2

~CodeHolderMethod · 0.85
resetMethod · 0.85

Calls 6

releaseMemoryFunction · 0.85
hasDataMethod · 0.80
detachMethod · 0.45
resetMethod · 0.45
getLengthMethod · 0.45
isExternalMethod · 0.45

Tested by

no test coverage detected