Removing xenia/malloc.*
Using standard memory functions now.
This commit is contained in:
@@ -73,11 +73,11 @@ void* Arena::CloneContents() {
|
||||
}
|
||||
chunk = chunk->next;
|
||||
}
|
||||
void* result = xe_malloc(total_length);
|
||||
void* result = malloc(total_length);
|
||||
uint8_t* p = (uint8_t*)result;
|
||||
chunk = head_chunk_;
|
||||
while (chunk) {
|
||||
xe_copy_struct(p, chunk->buffer, chunk->offset);
|
||||
memcpy(p, chunk->buffer, chunk->offset);
|
||||
p += chunk->offset;
|
||||
if (chunk == active_chunk_) {
|
||||
break;
|
||||
@@ -89,12 +89,12 @@ void* Arena::CloneContents() {
|
||||
|
||||
Arena::Chunk::Chunk(size_t chunk_size)
|
||||
: next(nullptr), capacity(chunk_size), buffer(0), offset(0) {
|
||||
buffer = (uint8_t*)xe_malloc(capacity);
|
||||
buffer = reinterpret_cast<uint8_t*>(malloc(capacity));
|
||||
}
|
||||
|
||||
Arena::Chunk::~Chunk() {
|
||||
if (buffer) {
|
||||
xe_free(buffer);
|
||||
free(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,13 +25,13 @@ IVMFunction::IVMFunction(FunctionInfo* symbol_info)
|
||||
: Function(symbol_info),
|
||||
register_count_(0),
|
||||
intcode_count_(0),
|
||||
intcodes_(0),
|
||||
intcodes_(nullptr),
|
||||
source_map_count_(0),
|
||||
source_map_(0) {}
|
||||
source_map_(nullptr) {}
|
||||
|
||||
IVMFunction::~IVMFunction() {
|
||||
xe_free(intcodes_);
|
||||
xe_free(source_map_);
|
||||
free(intcodes_);
|
||||
free(source_map_);
|
||||
}
|
||||
|
||||
void IVMFunction::Setup(TranslationContext& ctx) {
|
||||
|
||||
@@ -65,12 +65,12 @@ void IVMStack::Free(size_t register_count) {
|
||||
|
||||
IVMStack::Chunk::Chunk(size_t chunk_size)
|
||||
: prev(NULL), next(NULL), capacity(chunk_size), buffer(0), offset(0) {
|
||||
buffer = (uint8_t*)xe_malloc(capacity);
|
||||
buffer = reinterpret_cast<uint8_t*>(malloc(capacity));
|
||||
}
|
||||
|
||||
IVMStack::Chunk::~Chunk() {
|
||||
if (buffer) {
|
||||
xe_free(buffer);
|
||||
free(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -93,8 +93,7 @@ int X64Assembler::Assemble(FunctionInfo* symbol_info, HIRBuilder* builder,
|
||||
|
||||
void X64Assembler::DumpMachineCode(DebugInfo* debug_info, void* machine_code,
|
||||
size_t code_size, StringBuffer* str) {
|
||||
BE::DISASM disasm;
|
||||
xe_zero_struct(&disasm, sizeof(disasm));
|
||||
BE::DISASM disasm = {0};
|
||||
disasm.Archi = 64;
|
||||
disasm.Options = BE::Tabulation + BE::MasmSyntax + BE::PrefixedNumeral;
|
||||
disasm.EIP = (BE::UIntPtr)machine_code;
|
||||
|
||||
@@ -76,7 +76,7 @@ void* X64CodeCache::PlaceCode(void* machine_code, size_t code_size,
|
||||
lock_.unlock();
|
||||
|
||||
// Copy code.
|
||||
xe_copy_struct(final_address, machine_code, code_size);
|
||||
memcpy(final_address, machine_code, code_size);
|
||||
|
||||
return final_address;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ RegisterAllocationPass::RegisterAllocationPass(const MachineInfo* machine_info)
|
||||
// Initialize register sets.
|
||||
// TODO(benvanik): rewrite in a way that makes sense - this is terrible.
|
||||
auto mi_sets = machine_info->register_sets;
|
||||
xe_zero_struct(&usage_sets_, sizeof(usage_sets_));
|
||||
memset(&usage_sets_, 0, sizeof(usage_sets_));
|
||||
uint32_t n = 0;
|
||||
while (mi_sets[n].count) {
|
||||
auto& mi_set = mi_sets[n];
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
|
||||
// TODO(benvanik): move the common stuff into here?
|
||||
#include <xenia/logging.h>
|
||||
#include <xenia/malloc.h>
|
||||
#include <xenia/profiling.h>
|
||||
|
||||
#endif // ALLOY_CORE_H_
|
||||
|
||||
@@ -69,8 +69,8 @@ int PPCHIRBuilder::Emit(FunctionInfo* symbol_info, uint32_t flags) {
|
||||
size_t list_size = instr_count_ * sizeof(void*);
|
||||
instr_offset_list_ = (Instr**)arena_->Alloc(list_size);
|
||||
label_list_ = (Label**)arena_->Alloc(list_size);
|
||||
xe_zero_struct(instr_offset_list_, list_size);
|
||||
xe_zero_struct(label_list_, list_size);
|
||||
memset(instr_offset_list_, 0, list_size);
|
||||
memset(label_list_, 0, list_size);
|
||||
|
||||
// Always mark entry with label.
|
||||
label_list_[0] = NewLabel();
|
||||
@@ -171,7 +171,7 @@ void PPCHIRBuilder::AnnotateLabel(uint64_t address, Label* label) {
|
||||
snprintf(name_buffer, poly::countof(name_buffer), "loc_%.8X",
|
||||
(uint32_t)address);
|
||||
label->name = (char*)arena_->Alloc(sizeof(name_buffer));
|
||||
xe_copy_struct(label->name, name_buffer, sizeof(name_buffer));
|
||||
memcpy(label->name, name_buffer, sizeof(name_buffer));
|
||||
}
|
||||
|
||||
FunctionInfo* PPCHIRBuilder::LookupFunction(uint64_t address) {
|
||||
|
||||
@@ -95,7 +95,7 @@ namespace tables {
|
||||
static InstrType** instr_table_prep(InstrType* unprep, size_t unprep_count,
|
||||
int a, int b) {
|
||||
int prep_count = (int)pow(2.0, b - a + 1);
|
||||
InstrType** prep = (InstrType**)xe_calloc(prep_count * sizeof(void*));
|
||||
InstrType** prep = (InstrType**)calloc(prep_count, sizeof(void*));
|
||||
for (int n = 0; n < unprep_count; n++) {
|
||||
int ordinal = select_bits(unprep[n].opcode, a, b);
|
||||
prep[ordinal] = &unprep[n];
|
||||
@@ -107,7 +107,7 @@ static InstrType** instr_table_prep_63(InstrType* unprep, size_t unprep_count,
|
||||
int a, int b) {
|
||||
// Special handling for A format instructions.
|
||||
int prep_count = (int)pow(2.0, b - a + 1);
|
||||
InstrType** prep = (InstrType**)xe_calloc(prep_count * sizeof(void*));
|
||||
InstrType** prep = (InstrType**)calloc(prep_count, sizeof(void*));
|
||||
for (int n = 0; n < unprep_count; n++) {
|
||||
int ordinal = select_bits(unprep[n].opcode, a, b);
|
||||
if (unprep[n].format == kXEPPCInstrFormatA) {
|
||||
|
||||
@@ -632,7 +632,7 @@ void HIRBuilder::Comment(const char* format, ...) {
|
||||
return;
|
||||
}
|
||||
void* p = arena_->Alloc(len + 1);
|
||||
xe_copy_struct(p, buffer, len + 1);
|
||||
memcpy(p, buffer, len + 1);
|
||||
Instr* i = AppendInstr(OPCODE_COMMENT_info, 0);
|
||||
i->src1.offset = (uint64_t)p;
|
||||
i->src2.value = i->src3.value = NULL;
|
||||
|
||||
@@ -21,11 +21,11 @@ DebugInfo::DebugInfo()
|
||||
source_map_(nullptr) {}
|
||||
|
||||
DebugInfo::~DebugInfo() {
|
||||
xe_free(source_map_);
|
||||
xe_free(source_disasm_);
|
||||
xe_free(raw_hir_disasm_);
|
||||
xe_free(hir_disasm_);
|
||||
xe_free(machine_code_disasm_);
|
||||
free(source_map_);
|
||||
free(source_disasm_);
|
||||
free(raw_hir_disasm_);
|
||||
free(hir_disasm_);
|
||||
free(machine_code_disasm_);
|
||||
}
|
||||
|
||||
void DebugInfo::InitializeSourceMap(size_t source_map_count,
|
||||
|
||||
Reference in New Issue
Block a user