More C++11ification.
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
|
||||
#include <alloy/backend/ivm/ivm_assembler.h>
|
||||
|
||||
#include <alloy/reset_scope.h>
|
||||
#include <alloy/backend/backend.h>
|
||||
#include <alloy/backend/ivm/ivm_intcode.h>
|
||||
#include <alloy/backend/ivm/ivm_function.h>
|
||||
@@ -21,6 +22,7 @@ namespace backend {
|
||||
namespace ivm {
|
||||
|
||||
using alloy::hir::HIRBuilder;
|
||||
using alloy::runtime::DebugInfo;
|
||||
using alloy::runtime::Function;
|
||||
using alloy::runtime::FunctionInfo;
|
||||
|
||||
@@ -47,10 +49,15 @@ void IVMAssembler::Reset() {
|
||||
|
||||
int IVMAssembler::Assemble(FunctionInfo* symbol_info, HIRBuilder* builder,
|
||||
uint32_t debug_info_flags,
|
||||
runtime::DebugInfo* debug_info,
|
||||
std::unique_ptr<DebugInfo> debug_info,
|
||||
Function** out_function) {
|
||||
SCOPE_profile_cpu_f("alloy");
|
||||
|
||||
// Reset when we leave.
|
||||
make_reset_scope(this);
|
||||
|
||||
IVMFunction* fn = new IVMFunction(symbol_info);
|
||||
fn->set_debug_info(debug_info);
|
||||
fn->set_debug_info(std::move(debug_info));
|
||||
|
||||
TranslationContext ctx;
|
||||
ctx.register_count = 0;
|
||||
|
||||
@@ -21,16 +21,16 @@ namespace ivm {
|
||||
class IVMAssembler : public Assembler {
|
||||
public:
|
||||
IVMAssembler(Backend* backend);
|
||||
virtual ~IVMAssembler();
|
||||
~IVMAssembler() override;
|
||||
|
||||
virtual int Initialize();
|
||||
int Initialize() override;
|
||||
|
||||
virtual void Reset();
|
||||
void Reset() override;
|
||||
|
||||
virtual int Assemble(runtime::FunctionInfo* symbol_info,
|
||||
hir::HIRBuilder* builder, uint32_t debug_info_flags,
|
||||
runtime::DebugInfo* debug_info,
|
||||
runtime::Function** out_function);
|
||||
int Assemble(runtime::FunctionInfo* symbol_info, hir::HIRBuilder* builder,
|
||||
uint32_t debug_info_flags,
|
||||
std::unique_ptr<runtime::DebugInfo> debug_info,
|
||||
runtime::Function** out_function) override;
|
||||
|
||||
private:
|
||||
Arena intcode_arena_;
|
||||
|
||||
@@ -47,7 +47,9 @@ void IVMBackend::FreeThreadData(void* thread_data) {
|
||||
delete stack;
|
||||
}
|
||||
|
||||
Assembler* IVMBackend::CreateAssembler() { return new IVMAssembler(this); }
|
||||
std::unique_ptr<Assembler> IVMBackend::CreateAssembler() {
|
||||
return std::make_unique<IVMAssembler>(this);
|
||||
}
|
||||
|
||||
} // namespace ivm
|
||||
} // namespace backend
|
||||
|
||||
@@ -23,14 +23,14 @@ namespace ivm {
|
||||
class IVMBackend : public Backend {
|
||||
public:
|
||||
IVMBackend(runtime::Runtime* runtime);
|
||||
virtual ~IVMBackend();
|
||||
~IVMBackend() override;
|
||||
|
||||
virtual int Initialize();
|
||||
int Initialize() override;
|
||||
|
||||
virtual void* AllocThreadData();
|
||||
virtual void FreeThreadData(void* thread_data);
|
||||
void* AllocThreadData() override;
|
||||
void FreeThreadData(void* thread_data) override;
|
||||
|
||||
virtual Assembler* CreateAssembler();
|
||||
std::unique_ptr<Assembler> CreateAssembler() override;
|
||||
};
|
||||
|
||||
} // namespace ivm
|
||||
|
||||
@@ -216,7 +216,7 @@ int Translate_COMMENT(TranslationContext& ctx, Instr* i) {
|
||||
ic->flags = i->flags;
|
||||
ic->debug_flags = 0;
|
||||
// HACK HACK HACK
|
||||
char* src = xestrdupa((char*)i->src1.offset);
|
||||
char* src = strdup(reinterpret_cast<char*>(i->src1.offset));
|
||||
uint64_t src_p = (uint64_t)src;
|
||||
ic->src1_reg = (uint32_t)src_p;
|
||||
ic->src2_reg = (uint32_t)(src_p >> 32);
|
||||
|
||||
Reference in New Issue
Block a user