Logging comments like IVM.
This commit is contained in:
parent
51ae8299d9
commit
495edda8d8
|
@ -35,6 +35,13 @@ void Dummy() {
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PrintString(void* raw_context, uint8_t* membase, const char* str) {
|
||||||
|
// TODO(benvanik): generate this thunk at runtime? or a shim?
|
||||||
|
auto thread_state = *((ThreadState**)raw_context);
|
||||||
|
fprintf(stdout, "XE[t] :%d: %s\n", thread_state->GetThreadID(), str);
|
||||||
|
fflush(stdout);
|
||||||
|
}
|
||||||
|
|
||||||
// TODO(benvanik): fancy stuff.
|
// TODO(benvanik): fancy stuff.
|
||||||
void CallThunk(void* raw_context, uint8_t* membase,
|
void CallThunk(void* raw_context, uint8_t* membase,
|
||||||
FunctionInfo* symbol_info) {
|
FunctionInfo* symbol_info) {
|
||||||
|
@ -503,8 +510,10 @@ void alloy::backend::x64::lowering::RegisterSequences(LoweringTable* table) {
|
||||||
table->AddSequence(OPCODE_COMMENT, [](X64Emitter& e, Instr*& i) {
|
table->AddSequence(OPCODE_COMMENT, [](X64Emitter& e, Instr*& i) {
|
||||||
// TODO(benvanik): pass through.
|
// TODO(benvanik): pass through.
|
||||||
auto str = (const char*)i->src1.offset;
|
auto str = (const char*)i->src1.offset;
|
||||||
//lb.Comment(str);
|
auto str_copy = xestrdupa(str);
|
||||||
//UNIMPLEMENTED_SEQ();
|
e.mov(e.r8, (uint64_t)str_copy);
|
||||||
|
e.mov(e.rax, (uint64_t)PrintString);
|
||||||
|
e.call(e.rax);
|
||||||
i = e.Advance(i);
|
i = e.Advance(i);
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue