More mac fixups.

This commit is contained in:
Ben Vanik
2014-07-29 20:29:50 -07:00
parent 0c5110ac3e
commit d56ae60460
18 changed files with 165 additions and 70 deletions

View File

@@ -19,7 +19,7 @@
namespace BE {
#include <beaengine/BeaEngine.h>
}
} // namespace BE
namespace alloy {
namespace backend {

View File

@@ -9,9 +9,9 @@
#include <alloy/backend/x64/x64_code_cache.h>
#include <sys/mman.h>
#include <poly/assert.h>
#include <alloy/backend/x64/tracing.h>
#include <sys/mman.h>
namespace alloy {
namespace backend {

View File

@@ -370,7 +370,7 @@ void X64Emitter::CallIndirect(const hir::Instr* instr, const Reg64& reg) {
uint64_t UndefinedCallExtern(void* raw_context, uint64_t symbol_info_ptr) {
auto symbol_info = reinterpret_cast<FunctionInfo*>(symbol_info_ptr);
XELOGW("undefined extern call to %.8llX %s", symbol_info->address(),
symbol_info->name());
symbol_info->name().c_str());
return 0;
}
void X64Emitter::CallExtern(const hir::Instr* instr,

View File

@@ -55,9 +55,9 @@ int PPCHIRBuilder::Emit(FunctionInfo* symbol_info, bool with_debug_info) {
with_debug_info_ = with_debug_info;
if (with_debug_info_) {
Comment("%s fn %.8X-%.8X %s", symbol_info->module()->name(),
Comment("%s fn %.8X-%.8X %s", symbol_info->module()->name().c_str(),
symbol_info->address(), symbol_info->end_address(),
symbol_info->name());
symbol_info->name().c_str());
}
// Allocate offset list.

View File

@@ -161,9 +161,10 @@ void PPCTranslator::DumpSource(runtime::FunctionInfo* symbol_info,
Memory* memory = frontend_->memory();
const uint8_t* p = memory->membase();
string_buffer->Append("%s fn %.8X-%.8X %s\n", symbol_info->module()->name(),
string_buffer->Append("%s fn %.8X-%.8X %s\n",
symbol_info->module()->name().c_str(),
symbol_info->address(), symbol_info->end_address(),
symbol_info->name());
symbol_info->name().c_str());
auto blocks = scanner_->FindBlocks(symbol_info);

View File

@@ -18,9 +18,8 @@ EntryTable::EntryTable() = default;
EntryTable::~EntryTable() {
std::lock_guard<std::mutex> guard(lock_);
auto& it = map_.begin();
for (; it != map_.end(); ++it) {
Entry* entry = it->second;
for (auto it : map_) {
Entry* entry = it.second;
delete entry;
}
}

View File

@@ -12,6 +12,7 @@
#include <mutex>
#include <unordered_map>
#include <vector>
#include <alloy/core.h>

View File

@@ -17,8 +17,7 @@ namespace alloy {
namespace runtime {
Function::Function(FunctionInfo* symbol_info)
: address_(symbol_info->address()),
symbol_info_(symbol_info) {}
: address_(symbol_info->address()), symbol_info_(symbol_info) {}
Function::~Function() = default;
@@ -81,7 +80,7 @@ int Function::Call(ThreadState* thread_state, uint64_t return_address) {
symbol_info_->extern_arg1());
} else {
XELOGW("undefined extern call to %.8llX %s", symbol_info_->address(),
symbol_info_->name());
symbol_info_->name().c_str());
result = 1;
}
} else {

View File

@@ -10,6 +10,8 @@
#ifndef ALLOY_RUNTIME_THREAD_STATE_H_
#define ALLOY_RUNTIME_THREAD_STATE_H_
#include <string>
#include <alloy/core.h>
#include <alloy/memory.h>
@@ -32,7 +34,8 @@ class ThreadState {
void* backend_data() const { return backend_data_; }
void* raw_context() const { return raw_context_; }
virtual int Suspend(uint32_t timeout_ms = UINT_MAX) { return 1; }
int Suspend() { return Suspend(~0); }
virtual int Suspend(uint32_t timeout_ms) { return 1; }
virtual int Resume(bool force = false) { return 1; }
static void Bind(ThreadState* thread_state);

View File

@@ -23,7 +23,7 @@ void StringBuffer::Reset() {
}
void StringBuffer::Append(const std::string& value) {
Append(value.c_str());
AppendBytes(reinterpret_cast<const uint8_t*>(value.data()), value.size());
}
void StringBuffer::Append(const char* format, ...) {

View File

@@ -10,6 +10,7 @@
#ifndef ALLOY_STRING_BUFFER_H_
#define ALLOY_STRING_BUFFER_H_
#include <string>
#include <vector>
#include <alloy/core.h>