diff --git a/src/alloy/alloy.h b/src/alloy/alloy.h index f35589381..2a72b6125 100644 --- a/src/alloy/alloy.h +++ b/src/alloy/alloy.h @@ -16,6 +16,5 @@ #include #include #include -#include #endif // ALLOY_ALLOY_H_ diff --git a/src/alloy/backend/assembler.cc b/src/alloy/backend/assembler.cc index 935118fc3..6d5737692 100644 --- a/src/alloy/backend/assembler.cc +++ b/src/alloy/backend/assembler.cc @@ -9,8 +9,6 @@ #include -#include - namespace alloy { namespace backend { diff --git a/src/alloy/backend/backend.cc b/src/alloy/backend/backend.cc index e28100522..3982caa1f 100644 --- a/src/alloy/backend/backend.cc +++ b/src/alloy/backend/backend.cc @@ -9,8 +9,6 @@ #include -#include - namespace alloy { namespace backend { diff --git a/src/alloy/backend/ivm/ivm_assembler.cc b/src/alloy/backend/ivm/ivm_assembler.cc index c26657d37..220d9063d 100644 --- a/src/alloy/backend/ivm/ivm_assembler.cc +++ b/src/alloy/backend/ivm/ivm_assembler.cc @@ -12,7 +12,6 @@ #include #include #include -#include #include #include #include @@ -28,9 +27,7 @@ using alloy::runtime::FunctionInfo; IVMAssembler::IVMAssembler(Backend* backend) : Assembler(backend), source_map_arena_(128 * 1024) {} -IVMAssembler::~IVMAssembler() { - alloy::tracing::WriteEvent(EventType::AssemblerDeinit({})); -} +IVMAssembler::~IVMAssembler() = default; int IVMAssembler::Initialize() { int result = Assembler::Initialize(); @@ -38,8 +35,6 @@ int IVMAssembler::Initialize() { return result; } - alloy::tracing::WriteEvent(EventType::AssemblerInit({})); - return result; } diff --git a/src/alloy/backend/ivm/ivm_backend.cc b/src/alloy/backend/ivm/ivm_backend.cc index 7f738142a..286d3b5a3 100644 --- a/src/alloy/backend/ivm/ivm_backend.cc +++ b/src/alloy/backend/ivm/ivm_backend.cc @@ -11,7 +11,6 @@ #include #include -#include namespace alloy { namespace backend { @@ -21,7 +20,7 @@ using alloy::runtime::Runtime; IVMBackend::IVMBackend(Runtime* runtime) : Backend(runtime) {} -IVMBackend::~IVMBackend() { alloy::tracing::WriteEvent(EventType::Deinit({})); } +IVMBackend::~IVMBackend() = default; int IVMBackend::Initialize() { int result = Backend::Initialize(); @@ -38,8 +37,6 @@ int IVMBackend::Initialize() { 16, }; - alloy::tracing::WriteEvent(EventType::Init({})); - return result; } diff --git a/src/alloy/backend/ivm/ivm_function.cc b/src/alloy/backend/ivm/ivm_function.cc index f0baf3b36..2dba04264 100644 --- a/src/alloy/backend/ivm/ivm_function.cc +++ b/src/alloy/backend/ivm/ivm_function.cc @@ -10,7 +10,6 @@ #include #include -#include #include #include diff --git a/src/alloy/backend/ivm/sources.gypi b/src/alloy/backend/ivm/sources.gypi index 3216510e2..c13431404 100644 --- a/src/alloy/backend/ivm/sources.gypi +++ b/src/alloy/backend/ivm/sources.gypi @@ -10,6 +10,5 @@ 'ivm_function.cc', 'ivm_stack.cc', 'ivm_stack.h', - 'tracing.h', ], } diff --git a/src/alloy/backend/ivm/tracing.h b/src/alloy/backend/ivm/tracing.h deleted file mode 100644 index bf48319ae..000000000 --- a/src/alloy/backend/ivm/tracing.h +++ /dev/null @@ -1,50 +0,0 @@ -/** - ****************************************************************************** - * Xenia : Xbox 360 Emulator Research Project * - ****************************************************************************** - * Copyright 2013 Ben Vanik. All rights reserved. * - * Released under the BSD license - see LICENSE in the root for more details. * - ****************************************************************************** - */ - -#ifndef ALLOY_BACKEND_IVM_TRACING_H_ -#define ALLOY_BACKEND_IVM_TRACING_H_ - -#include - -namespace alloy { -namespace backend { -namespace ivm { - -const uint32_t ALLOY_BACKEND_IVM = alloy::backend::EventType::ALLOY_BACKEND_IVM; - -class EventType { - public: - enum { - ALLOY_BACKEND_IVM_INIT = ALLOY_BACKEND_IVM | (1), - ALLOY_BACKEND_IVM_DEINIT = ALLOY_BACKEND_IVM | (2), - ALLOY_BACKEND_IVM_ASSEMBLER = ALLOY_BACKEND_IVM | (1 << 20), - ALLOY_BACKEND_IVM_ASSEMBLER_INIT = ALLOY_BACKEND_IVM_ASSEMBLER | (1), - ALLOY_BACKEND_IVM_ASSEMBLER_DEINIT = ALLOY_BACKEND_IVM_ASSEMBLER | (2), - }; - - typedef struct Init_s { - static const uint32_t event_type = ALLOY_BACKEND_IVM_INIT; - } Init; - typedef struct Deinit_s { - static const uint32_t event_type = ALLOY_BACKEND_IVM_DEINIT; - } Deinit; - - typedef struct AssemblerInit_s { - static const uint32_t event_type = ALLOY_BACKEND_IVM_ASSEMBLER_INIT; - } AssemblerInit; - typedef struct AssemblerDeinit_s { - static const uint32_t event_type = ALLOY_BACKEND_IVM_ASSEMBLER_DEINIT; - } AssemblerDeinit; -}; - -} // namespace ivm -} // namespace backend -} // namespace alloy - -#endif // ALLOY_BACKEND_IVM_TRACING_H_ diff --git a/src/alloy/backend/sources.gypi b/src/alloy/backend/sources.gypi index 41419ac7a..ec3be77a4 100644 --- a/src/alloy/backend/sources.gypi +++ b/src/alloy/backend/sources.gypi @@ -6,7 +6,6 @@ 'backend.cc', 'backend.h', 'machine_info.h', - 'tracing.h', ], 'includes': [ diff --git a/src/alloy/backend/tracing.h b/src/alloy/backend/tracing.h deleted file mode 100644 index a7a8c934c..000000000 --- a/src/alloy/backend/tracing.h +++ /dev/null @@ -1,32 +0,0 @@ -/** - ****************************************************************************** - * Xenia : Xbox 360 Emulator Research Project * - ****************************************************************************** - * Copyright 2013 Ben Vanik. All rights reserved. * - * Released under the BSD license - see LICENSE in the root for more details. * - ****************************************************************************** - */ - -#ifndef ALLOY_BACKEND_TRACING_H_ -#define ALLOY_BACKEND_TRACING_H_ - -#include -#include - -namespace alloy { -namespace backend { - -const uint32_t ALLOY_BACKEND = alloy::tracing::EventType::ALLOY_BACKEND; - -class EventType { - public: - enum { - ALLOY_BACKEND_IVM = ALLOY_BACKEND | (1 << 24), - ALLOY_BACKEND_X64 = ALLOY_BACKEND | (2 << 24), - }; -}; - -} // namespace backend -} // namespace alloy - -#endif // ALLOY_BACKEND_TRACING_H_ diff --git a/src/alloy/backend/x64/sources.gypi b/src/alloy/backend/x64/sources.gypi index 02d8163b1..a3ade7eeb 100644 --- a/src/alloy/backend/x64/sources.gypi +++ b/src/alloy/backend/x64/sources.gypi @@ -1,7 +1,6 @@ # Copyright 2013 Ben Vanik. All Rights Reserved. { 'sources': [ - 'tracing.h', 'x64_assembler.cc', 'x64_assembler.h', 'x64_backend.cc', diff --git a/src/alloy/backend/x64/tracing.h b/src/alloy/backend/x64/tracing.h deleted file mode 100644 index 5045f93f5..000000000 --- a/src/alloy/backend/x64/tracing.h +++ /dev/null @@ -1,50 +0,0 @@ -/** - ****************************************************************************** - * Xenia : Xbox 360 Emulator Research Project * - ****************************************************************************** - * Copyright 2013 Ben Vanik. All rights reserved. * - * Released under the BSD license - see LICENSE in the root for more details. * - ****************************************************************************** - */ - -#ifndef ALLOY_BACKEND_X64_TRACING_H_ -#define ALLOY_BACKEND_X64_TRACING_H_ - -#include - -namespace alloy { -namespace backend { -namespace x64 { - -const uint32_t ALLOY_BACKEND_X64 = alloy::backend::EventType::ALLOY_BACKEND_X64; - -class EventType { - public: - enum { - ALLOY_BACKEND_X64_INIT = ALLOY_BACKEND_X64 | (1), - ALLOY_BACKEND_X64_DEINIT = ALLOY_BACKEND_X64 | (2), - ALLOY_BACKEND_X64_ASSEMBLER = ALLOY_BACKEND_X64 | (1 << 20), - ALLOY_BACKEND_X64_ASSEMBLER_INIT = ALLOY_BACKEND_X64_ASSEMBLER | (1), - ALLOY_BACKEND_X64_ASSEMBLER_DEINIT = ALLOY_BACKEND_X64_ASSEMBLER | (2), - }; - - typedef struct Init_s { - static const uint32_t event_type = ALLOY_BACKEND_X64_INIT; - } Init; - typedef struct Deinit_s { - static const uint32_t event_type = ALLOY_BACKEND_X64_DEINIT; - } Deinit; - - typedef struct AssemblerInit_s { - static const uint32_t event_type = ALLOY_BACKEND_X64_ASSEMBLER_INIT; - } AssemblerInit; - typedef struct AssemblerDeinit_s { - static const uint32_t event_type = ALLOY_BACKEND_X64_ASSEMBLER_DEINIT; - } AssemblerDeinit; -}; - -} // namespace x64 -} // namespace backend -} // namespace alloy - -#endif // ALLOY_BACKEND_X64_TRACING_H_ diff --git a/src/alloy/backend/x64/x64_assembler.cc b/src/alloy/backend/x64/x64_assembler.cc index 3f3e6e4fb..01b179774 100644 --- a/src/alloy/backend/x64/x64_assembler.cc +++ b/src/alloy/backend/x64/x64_assembler.cc @@ -9,7 +9,6 @@ #include -#include #include #include #include @@ -37,8 +36,6 @@ X64Assembler::X64Assembler(X64Backend* backend) : Assembler(backend), x64_backend_(backend), emitter_(0), allocator_(0) {} X64Assembler::~X64Assembler() { - alloy::tracing::WriteEvent(EventType::AssemblerDeinit({})); - delete emitter_; delete allocator_; } @@ -52,8 +49,6 @@ int X64Assembler::Initialize() { allocator_ = new XbyakAllocator(); emitter_ = new X64Emitter(x64_backend_, allocator_); - alloy::tracing::WriteEvent(EventType::AssemblerInit({})); - return result; } diff --git a/src/alloy/backend/x64/x64_backend.cc b/src/alloy/backend/x64/x64_backend.cc index e1bf31cbe..cca85ca59 100644 --- a/src/alloy/backend/x64/x64_backend.cc +++ b/src/alloy/backend/x64/x64_backend.cc @@ -9,7 +9,6 @@ #include -#include #include #include #include @@ -23,10 +22,7 @@ using alloy::runtime::Runtime; X64Backend::X64Backend(Runtime* runtime) : Backend(runtime), code_cache_(0) {} -X64Backend::~X64Backend() { - alloy::tracing::WriteEvent(EventType::Deinit({})); - delete code_cache_; -} +X64Backend::~X64Backend() { delete code_cache_; } int X64Backend::Initialize() { int result = Backend::Initialize(); @@ -58,8 +54,6 @@ int X64Backend::Initialize() { delete thunk_emitter; delete allocator; - alloy::tracing::WriteEvent(EventType::Init({})); - return result; } diff --git a/src/alloy/backend/x64/x64_code_cache_win.cc b/src/alloy/backend/x64/x64_code_cache_win.cc index f204c2200..b5355cc46 100644 --- a/src/alloy/backend/x64/x64_code_cache_win.cc +++ b/src/alloy/backend/x64/x64_code_cache_win.cc @@ -9,8 +9,6 @@ #include -#include - namespace alloy { namespace backend { namespace x64 { diff --git a/src/alloy/backend/x64/x64_function.cc b/src/alloy/backend/x64/x64_function.cc index 28b16ee1e..1b3cc9117 100644 --- a/src/alloy/backend/x64/x64_function.cc +++ b/src/alloy/backend/x64/x64_function.cc @@ -9,7 +9,6 @@ #include -#include #include #include #include @@ -24,7 +23,7 @@ using alloy::runtime::FunctionInfo; using alloy::runtime::ThreadState; X64Function::X64Function(FunctionInfo* symbol_info) - : Function(symbol_info), machine_code_(NULL), code_size_(0) {} + : Function(symbol_info), machine_code_(nullptr), code_size_(0) {} X64Function::~X64Function() { // machine_code_ is freed by code cache. diff --git a/src/alloy/compiler/compiler.cc b/src/alloy/compiler/compiler.cc index 2aff744db..ac86f3212 100644 --- a/src/alloy/compiler/compiler.cc +++ b/src/alloy/compiler/compiler.cc @@ -10,7 +10,6 @@ #include #include -#include namespace alloy { namespace compiler { @@ -20,8 +19,6 @@ using alloy::runtime::Runtime; Compiler::Compiler(Runtime* runtime) : runtime_(runtime) { scratch_arena_ = new Arena(); - - alloy::tracing::WriteEvent(EventType::Init({})); } Compiler::~Compiler() { @@ -33,8 +30,6 @@ Compiler::~Compiler() { } delete scratch_arena_; - - alloy::tracing::WriteEvent(EventType::Deinit({})); } void Compiler::AddPass(CompilerPass* pass) { diff --git a/src/alloy/compiler/sources.gypi b/src/alloy/compiler/sources.gypi index d32e7dac4..d9a7df71a 100644 --- a/src/alloy/compiler/sources.gypi +++ b/src/alloy/compiler/sources.gypi @@ -6,7 +6,6 @@ 'compiler_pass.cc', 'compiler_pass.h', 'compiler_passes.h', - 'tracing.h', ], 'includes': [ diff --git a/src/alloy/compiler/tracing.h b/src/alloy/compiler/tracing.h deleted file mode 100644 index 5763d6cb0..000000000 --- a/src/alloy/compiler/tracing.h +++ /dev/null @@ -1,39 +0,0 @@ -/** - ****************************************************************************** - * Xenia : Xbox 360 Emulator Research Project * - ****************************************************************************** - * Copyright 2013 Ben Vanik. All rights reserved. * - * Released under the BSD license - see LICENSE in the root for more details. * - ****************************************************************************** - */ - -#ifndef ALLOY_COMPILER_TRACING_H_ -#define ALLOY_COMPILER_TRACING_H_ - -#include -#include - -namespace alloy { -namespace compiler { - -const uint32_t ALLOY_COMPILER = alloy::tracing::EventType::ALLOY_COMPILER; - -class EventType { - public: - enum { - ALLOY_COMPILER_INIT = ALLOY_COMPILER | (1), - ALLOY_COMPILER_DEINIT = ALLOY_COMPILER | (2), - }; - - typedef struct Init_s { - static const uint32_t event_type = ALLOY_COMPILER_INIT; - } Init; - typedef struct Deinit_s { - static const uint32_t event_type = ALLOY_COMPILER_DEINIT; - } Deinit; -}; - -} // namespace compiler -} // namespace alloy - -#endif // ALLOY_COMPILER_TRACING_H_ diff --git a/src/alloy/frontend/frontend.cc b/src/alloy/frontend/frontend.cc index bd0651465..d97236d72 100644 --- a/src/alloy/frontend/frontend.cc +++ b/src/alloy/frontend/frontend.cc @@ -9,7 +9,6 @@ #include -#include #include namespace alloy { diff --git a/src/alloy/frontend/ppc/ppc_frontend.cc b/src/alloy/frontend/ppc/ppc_frontend.cc index f6970d5f5..a537efda9 100644 --- a/src/alloy/frontend/ppc/ppc_frontend.cc +++ b/src/alloy/frontend/ppc/ppc_frontend.cc @@ -9,7 +9,6 @@ #include -#include #include #include #include @@ -56,8 +55,6 @@ PPCFrontend::PPCFrontend(Runtime* runtime) : Frontend(runtime) { PPCFrontend::~PPCFrontend() { // Force cleanup now before we deinit. translator_pool_.Reset(); - - alloy::tracing::WriteEvent(EventType::Deinit({})); } int PPCFrontend::Initialize() { @@ -66,8 +63,6 @@ int PPCFrontend::Initialize() { return result; } - alloy::tracing::WriteEvent(EventType::Init({})); - return result; } diff --git a/src/alloy/frontend/ppc/ppc_hir_builder.cc b/src/alloy/frontend/ppc/ppc_hir_builder.cc index c0fc5c54c..38f72daab 100644 --- a/src/alloy/frontend/ppc/ppc_hir_builder.cc +++ b/src/alloy/frontend/ppc/ppc_hir_builder.cc @@ -10,7 +10,6 @@ #include #include -#include #include #include #include diff --git a/src/alloy/frontend/ppc/ppc_scanner.cc b/src/alloy/frontend/ppc/ppc_scanner.cc index ef180dfcf..4244ab65c 100644 --- a/src/alloy/frontend/ppc/ppc_scanner.cc +++ b/src/alloy/frontend/ppc/ppc_scanner.cc @@ -11,7 +11,6 @@ #include -#include #include #include #include diff --git a/src/alloy/frontend/ppc/ppc_translator.cc b/src/alloy/frontend/ppc/ppc_translator.cc index cf6e22dde..4a701c729 100644 --- a/src/alloy/frontend/ppc/ppc_translator.cc +++ b/src/alloy/frontend/ppc/ppc_translator.cc @@ -11,7 +11,6 @@ #include #include -#include #include #include #include diff --git a/src/alloy/frontend/sources.gypi b/src/alloy/frontend/sources.gypi index d0d63ab49..7635a2678 100644 --- a/src/alloy/frontend/sources.gypi +++ b/src/alloy/frontend/sources.gypi @@ -5,7 +5,6 @@ 'context_info.h', 'frontend.cc', 'frontend.h', - 'tracing.h', ], 'includes': [ diff --git a/src/alloy/frontend/tracing.h b/src/alloy/frontend/tracing.h deleted file mode 100644 index 66a445a4b..000000000 --- a/src/alloy/frontend/tracing.h +++ /dev/null @@ -1,39 +0,0 @@ -/** - ****************************************************************************** - * Xenia : Xbox 360 Emulator Research Project * - ****************************************************************************** - * Copyright 2013 Ben Vanik. All rights reserved. * - * Released under the BSD license - see LICENSE in the root for more details. * - ****************************************************************************** - */ - -#ifndef ALLOY_FRONTEND_TRACING_H_ -#define ALLOY_FRONTEND_TRACING_H_ - -#include -#include - -namespace alloy { -namespace frontend { - -const uint32_t ALLOY_FRONTEND = alloy::tracing::EventType::ALLOY_FRONTEND; - -class EventType { - public: - enum { - ALLOY_FRONTEND_INIT = ALLOY_FRONTEND | (1), - ALLOY_FRONTEND_DEINIT = ALLOY_FRONTEND | (2), - }; - - typedef struct Init_s { - static const uint32_t event_type = ALLOY_FRONTEND_INIT; - } Init; - typedef struct Deinit_s { - static const uint32_t event_type = ALLOY_FRONTEND_DEINIT; - } Deinit; -}; - -} // namespace frontend -} // namespace alloy - -#endif // ALLOY_FRONTEND_TRACING_H_ diff --git a/src/alloy/hir/sources.gypi b/src/alloy/hir/sources.gypi index 1ea2d7783..a0317ce2a 100644 --- a/src/alloy/hir/sources.gypi +++ b/src/alloy/hir/sources.gypi @@ -11,7 +11,6 @@ 'opcodes.cc', 'opcodes.h', 'opcodes.inl', - 'tracing.h', 'value.cc', 'value.h', ], diff --git a/src/alloy/hir/tracing.h b/src/alloy/hir/tracing.h deleted file mode 100644 index a0ad6bd89..000000000 --- a/src/alloy/hir/tracing.h +++ /dev/null @@ -1,31 +0,0 @@ -/** - ****************************************************************************** - * Xenia : Xbox 360 Emulator Research Project * - ****************************************************************************** - * Copyright 2013 Ben Vanik. All rights reserved. * - * Released under the BSD license - see LICENSE in the root for more details. * - ****************************************************************************** - */ - -#ifndef ALLOY_HIR_TRACING_H_ -#define ALLOY_HIR_TRACING_H_ - -#include -#include - -namespace alloy { -namespace hir { - -const uint32_t ALLOY_HIR = alloy::tracing::EventType::ALLOY_HIR; - -class EventType { - public: - enum { - ALLOY_HIR_FOO = ALLOY_HIR | (0), - }; -}; - -} // namespace hir -} // namespace alloy - -#endif // ALLOY_HIR_TRACING_H_ diff --git a/src/alloy/runtime/runtime.cc b/src/alloy/runtime/runtime.cc index 86fbbc319..955cf0d85 100644 --- a/src/alloy/runtime/runtime.cc +++ b/src/alloy/runtime/runtime.cc @@ -12,7 +12,6 @@ #include #include -#include // TODO(benvanik): based on compiler support #include @@ -26,9 +25,7 @@ namespace runtime { using alloy::backend::Backend; using alloy::frontend::Frontend; -Runtime::Runtime(Memory* memory) : memory_(memory) { - tracing::Initialize(); -} +Runtime::Runtime(Memory* memory) : memory_(memory) {} Runtime::~Runtime() { { @@ -43,8 +40,6 @@ Runtime::~Runtime() { debugger_.reset(); frontend_.reset(); backend_.reset(); - - tracing::Flush(); } int Runtime::Initialize(std::unique_ptr frontend, diff --git a/src/alloy/runtime/sources.gypi b/src/alloy/runtime/sources.gypi index 399580ec0..d1d7648b5 100644 --- a/src/alloy/runtime/sources.gypi +++ b/src/alloy/runtime/sources.gypi @@ -21,7 +21,6 @@ 'symbol_info.h', 'thread_state.cc', 'thread_state.h', - 'tracing.h', ], 'includes': [ diff --git a/src/alloy/runtime/tracing.h b/src/alloy/runtime/tracing.h deleted file mode 100644 index 1356208cb..000000000 --- a/src/alloy/runtime/tracing.h +++ /dev/null @@ -1,88 +0,0 @@ -/** - ****************************************************************************** - * Xenia : Xbox 360 Emulator Research Project * - ****************************************************************************** - * Copyright 2013 Ben Vanik. All rights reserved. * - * Released under the BSD license - see LICENSE in the root for more details. * - ****************************************************************************** - */ - -#ifndef ALLOY_RUNTIME_TRACING_H_ -#define ALLOY_RUNTIME_TRACING_H_ - -#include -#include - -namespace alloy { -namespace runtime { - -const uint32_t ALLOY_RUNTIME = alloy::tracing::EventType::ALLOY_RUNTIME; - -class EventType { - public: - enum { - ALLOY_RUNTIME_INIT = ALLOY_RUNTIME | (1), - ALLOY_RUNTIME_DEINIT = ALLOY_RUNTIME | (2), - ALLOY_RUNTIME_THREAD = ALLOY_RUNTIME | (1 << 25), - ALLOY_RUNTIME_THREAD_INIT = ALLOY_RUNTIME_THREAD | (1), - ALLOY_RUNTIME_THREAD_DEINIT = ALLOY_RUNTIME_THREAD | (2), - ALLOY_RUNTIME_MEMORY = ALLOY_RUNTIME | (2 << 25), - ALLOY_RUNTIME_MEMORY_INIT = ALLOY_RUNTIME_MEMORY | (1), - ALLOY_RUNTIME_MEMORY_DEINIT = ALLOY_RUNTIME_MEMORY | (2), - ALLOY_RUNTIME_MEMORY_HEAP = ALLOY_RUNTIME_MEMORY | (1000), - ALLOY_RUNTIME_MEMORY_HEAP_INIT = ALLOY_RUNTIME_MEMORY_HEAP | (1), - ALLOY_RUNTIME_MEMORY_HEAP_DEINIT = ALLOY_RUNTIME_MEMORY | (2), - ALLOY_RUNTIME_MEMORY_HEAP_ALLOC = ALLOY_RUNTIME_MEMORY | (3), - ALLOY_RUNTIME_MEMORY_HEAP_FREE = ALLOY_RUNTIME_MEMORY | (4), - }; - - typedef struct Init_s { - static const uint32_t event_type = ALLOY_RUNTIME_INIT; - } Init; - typedef struct Deinit_s { - static const uint32_t event_type = ALLOY_RUNTIME_DEINIT; - } Deinit; - - typedef struct ThreadInit_s { - static const uint32_t event_type = ALLOY_RUNTIME_THREAD_INIT; - } ThreadInit; - typedef struct ThreadDeinit_s { - static const uint32_t event_type = ALLOY_RUNTIME_THREAD_DEINIT; - } ThreadDeinit; - - typedef struct MemoryInit_s { - static const uint32_t event_type = ALLOY_RUNTIME_MEMORY_INIT; - // map of memory, etc? - } MemoryInit; - typedef struct MemoryDeinit_s { - static const uint32_t event_type = ALLOY_RUNTIME_MEMORY_DEINIT; - } MemoryDeinit; - typedef struct MemoryHeapInit_s { - static const uint32_t event_type = ALLOY_RUNTIME_MEMORY_HEAP_INIT; - uint32_t heap_id; - uint64_t low_address; - uint64_t high_address; - uint32_t is_physical; - } MemoryHeapInit; - typedef struct MemoryHeapDeinit_s { - static const uint32_t event_type = ALLOY_RUNTIME_MEMORY_HEAP_DEINIT; - uint32_t heap_id; - } MemoryHeapDeinit; - typedef struct MemoryHeapAlloc_s { - static const uint32_t event_type = ALLOY_RUNTIME_MEMORY_HEAP_ALLOC; - uint32_t heap_id; - uint32_t flags; - uint64_t address; - size_t size; - } MemoryHeapAlloc; - typedef struct MemoryHeapFree_s { - static const uint32_t event_type = ALLOY_RUNTIME_MEMORY_HEAP_FREE; - uint32_t heap_id; - uint64_t address; - } MemoryHeapFree; -}; - -} // namespace runtime -} // namespace alloy - -#endif // ALLOY_RUNTIME_TRACING_H_ diff --git a/src/alloy/sources.gypi b/src/alloy/sources.gypi index 89bca0b1d..6e3d80e12 100644 --- a/src/alloy/sources.gypi +++ b/src/alloy/sources.gypi @@ -40,6 +40,5 @@ 'frontend/sources.gypi', 'hir/sources.gypi', 'runtime/sources.gypi', - 'tracing/sources.gypi', ], } diff --git a/src/alloy/tracing/channel.cc b/src/alloy/tracing/channel.cc deleted file mode 100644 index 46fca1f61..000000000 --- a/src/alloy/tracing/channel.cc +++ /dev/null @@ -1,20 +0,0 @@ -/** - ****************************************************************************** - * Xenia : Xbox 360 Emulator Research Project * - ****************************************************************************** - * Copyright 2013 Ben Vanik. All rights reserved. * - * Released under the BSD license - see LICENSE in the root for more details. * - ****************************************************************************** - */ - -#include - -namespace alloy { -namespace tracing { - -Channel::Channel() = default; - -Channel::~Channel() = default; - -} // namespace tracing -} // namespace alloy diff --git a/src/alloy/tracing/channel.h b/src/alloy/tracing/channel.h deleted file mode 100644 index 6d36ac00a..000000000 --- a/src/alloy/tracing/channel.h +++ /dev/null @@ -1,31 +0,0 @@ -/** - ****************************************************************************** - * Xenia : Xbox 360 Emulator Research Project * - ****************************************************************************** - * Copyright 2013 Ben Vanik. All rights reserved. * - * Released under the BSD license - see LICENSE in the root for more details. * - ****************************************************************************** - */ - -#ifndef ALLOY_TRACING_CHANNEL_H_ -#define ALLOY_TRACING_CHANNEL_H_ - -#include - -namespace alloy { -namespace tracing { - -class Channel { - public: - Channel(); - virtual ~Channel(); - - virtual void Write(size_t buffer_count, size_t buffer_lengths[], - const uint8_t* buffers[]) = 0; - virtual void Flush() = 0; -}; - -} // namespace tracing -} // namespace alloy - -#endif // ALLOY_TRACING_CHANNEL_H_ diff --git a/src/alloy/tracing/channels/file_channel.cc b/src/alloy/tracing/channels/file_channel.cc deleted file mode 100644 index 99bc8ba5e..000000000 --- a/src/alloy/tracing/channels/file_channel.cc +++ /dev/null @@ -1,47 +0,0 @@ -/** - ****************************************************************************** - * Xenia : Xbox 360 Emulator Research Project * - ****************************************************************************** - * Copyright 2013 Ben Vanik. All rights reserved. * - * Released under the BSD license - see LICENSE in the root for more details. * - ****************************************************************************** - */ - -#include - -namespace alloy { -namespace tracing { -namespace channels { - -FileChannel::FileChannel(const std::string& path) : path_(path) { - file_ = fopen(path_.c_str(), "wb"); -} - -FileChannel::~FileChannel() { - std::lock_guard guard(lock_); - if (file_) { - fclose(file_); - file_ = nullptr; - } -} - -void FileChannel::Write(size_t buffer_count, size_t buffer_lengths[], - const uint8_t* buffers[]) { - std::lock_guard guard(lock_); - if (file_) { - for (size_t n = 0; n < buffer_count; n++) { - fwrite(buffers[n], buffer_lengths[n], 1, file_); - } - } -} - -void FileChannel::Flush() { - std::lock_guard guard(lock_); - if (file_) { - fflush(file_); - } -} - -} // namespace channels -} // namespace tracing -} // namespace alloy diff --git a/src/alloy/tracing/channels/file_channel.h b/src/alloy/tracing/channels/file_channel.h deleted file mode 100644 index 0b7df668c..000000000 --- a/src/alloy/tracing/channels/file_channel.h +++ /dev/null @@ -1,43 +0,0 @@ -/** - ****************************************************************************** - * Xenia : Xbox 360 Emulator Research Project * - ****************************************************************************** - * Copyright 2013 Ben Vanik. All rights reserved. * - * Released under the BSD license - see LICENSE in the root for more details. * - ****************************************************************************** - */ - -#ifndef ALLOY_TRACING_CHANNELS_FILE_CHANNEL_H_ -#define ALLOY_TRACING_CHANNELS_FILE_CHANNEL_H_ - -#include - -#include - -#include - -namespace alloy { -namespace tracing { -namespace channels { - -class FileChannel : public Channel { - public: - FileChannel(const std::string& path); - ~FileChannel() override; - - void Write(size_t buffer_count, size_t buffer_lengths[], - const uint8_t* buffers[]) override; - - void Flush() override; - - private: - std::string path_; - FILE* file_; - std::mutex lock_; -}; - -} // namespace channels -} // namespace tracing -} // namespace alloy - -#endif // ALLOY_TRACING_CHANNELS_FILE_CHANNEL_H_ diff --git a/src/alloy/tracing/channels/sources.gypi b/src/alloy/tracing/channels/sources.gypi deleted file mode 100644 index cfba21262..000000000 --- a/src/alloy/tracing/channels/sources.gypi +++ /dev/null @@ -1,7 +0,0 @@ -# Copyright 2013 Ben Vanik. All Rights Reserved. -{ - 'sources': [ - 'file_channel.cc', - 'file_channel.h', - ], -} diff --git a/src/alloy/tracing/event_type.h b/src/alloy/tracing/event_type.h deleted file mode 100644 index 3ad6a0d9c..000000000 --- a/src/alloy/tracing/event_type.h +++ /dev/null @@ -1,43 +0,0 @@ -/** - ****************************************************************************** - * Xenia : Xbox 360 Emulator Research Project * - ****************************************************************************** - * Copyright 2013 Ben Vanik. All rights reserved. * - * Released under the BSD license - see LICENSE in the root for more details. * - ****************************************************************************** - */ - -#ifndef ALLOY_TRACING_EVENT_TYPES_H_ -#define ALLOY_TRACING_EVENT_TYPES_H_ - -#include - -namespace alloy { -namespace tracing { - -class EventType { - public: - enum { - ALLOY = (0 << 31), - ALLOY_TRACE_INIT = ALLOY | (1), - ALLOY_TRACE_EOF = ALLOY | (2), - ALLOY_BACKEND = ALLOY | (1 << 26), - ALLOY_COMPILER = ALLOY | (2 << 26), - ALLOY_HIR = ALLOY | (3 << 26), - ALLOY_FRONTEND = ALLOY | (4 << 26), - ALLOY_RUNTIME = ALLOY | (5 << 26), - USER = (1 << 31), - }; - - typedef struct TraceInit_s { - static const uint32_t event_type = ALLOY_TRACE_INIT; - } TraceInit; - typedef struct TraceEOF_s { - static const uint32_t event_type = ALLOY_TRACE_EOF; - } TraceEOF; -}; - -} // namespace tracing -} // namespace alloy - -#endif // ALLOY_TRACING_EVENT_TYPES_H_ diff --git a/src/alloy/tracing/sources.gypi b/src/alloy/tracing/sources.gypi deleted file mode 100644 index 5b6cb1623..000000000 --- a/src/alloy/tracing/sources.gypi +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright 2013 Ben Vanik. All Rights Reserved. -{ - 'sources': [ - 'channel.cc', - 'channel.h', - 'event_type.h', - 'tracer.cc', - 'tracer.h', - 'tracing.cc', - 'tracing.h', - ], - - 'includes': [ - 'channels/sources.gypi', - ], -} diff --git a/src/alloy/tracing/tracer.cc b/src/alloy/tracing/tracer.cc deleted file mode 100644 index 3c4f3a157..000000000 --- a/src/alloy/tracing/tracer.cc +++ /dev/null @@ -1,44 +0,0 @@ -/** - ****************************************************************************** - * Xenia : Xbox 360 Emulator Research Project * - ****************************************************************************** - * Copyright 2013 Ben Vanik. All rights reserved. * - * Released under the BSD license - see LICENSE in the root for more details. * - ****************************************************************************** - */ - -#include - -#include - -#include - -namespace alloy { -namespace tracing { - -std::atomic next_thread_id_(0x10000000); - -Tracer::Tracer(Channel* channel) : channel_(channel) { - thread_id_ = ++next_thread_id_; -} - -Tracer::~Tracer() = default; - -void Tracer::WriteEvent(uint32_t event_type, size_t size, const uint8_t* data) { - uint32_t header[] = { - event_type, (uint32_t)thread_id_, - 0, // time in us - (uint32_t)size, - }; - size_t buffer_count = size ? 2 : 1; - size_t buffer_lengths[] = { - sizeof(header), size, - }; - const uint8_t* buffers[] = { - (const uint8_t*)header, data, - }; - channel_->Write(buffer_count, buffer_lengths, buffers); -} - -} // namespace tracing -} // namespace alloy diff --git a/src/alloy/tracing/tracer.h b/src/alloy/tracing/tracer.h deleted file mode 100644 index ba7faeab2..000000000 --- a/src/alloy/tracing/tracer.h +++ /dev/null @@ -1,39 +0,0 @@ -/** - ****************************************************************************** - * Xenia : Xbox 360 Emulator Research Project * - ****************************************************************************** - * Copyright 2013 Ben Vanik. All rights reserved. * - * Released under the BSD license - see LICENSE in the root for more details. * - ****************************************************************************** - */ - -#ifndef ALLOY_TRACING_TRACER_H_ -#define ALLOY_TRACING_TRACER_H_ - -#include - -namespace alloy { -namespace tracing { - -class Channel; - -class Tracer { - public: - Tracer(Channel* channel); - ~Tracer(); - - int thread_id() const { return thread_id_; } - void set_thread_id(int value) { thread_id_ = value; } - - void WriteEvent(uint32_t event_type, size_t size = 0, - const uint8_t* data = nullptr); - - private: - Channel* channel_; - int thread_id_; -}; - -} // namespace tracing -} // namespace alloy - -#endif // ALLOY_TRACING_TRACER_H_ diff --git a/src/alloy/tracing/tracing.cc b/src/alloy/tracing/tracing.cc deleted file mode 100644 index 7c7ffa2bd..000000000 --- a/src/alloy/tracing/tracing.cc +++ /dev/null @@ -1,87 +0,0 @@ -/** - ****************************************************************************** - * Xenia : Xbox 360 Emulator Research Project * - ****************************************************************************** - * Copyright 2013 Ben Vanik. All rights reserved. * - * Released under the BSD license - see LICENSE in the root for more details. * - ****************************************************************************** - */ - -#include - -#include -#include - -#include -#include -#include -#include - -DEFINE_string(trace_file, "", "Traces to the given file path."); -// trace shared memory -// trace socket - -namespace alloy { -namespace tracing { - -Channel* shared_channel = nullptr; -thread_local Tracer* thread_tracer = nullptr; - -void CleanupTracing() { - if (shared_channel) { - alloy::tracing::WriteEvent(EventType::TraceEOF({})); - shared_channel->Flush(); - shared_channel = nullptr; - } -} - -bool Initialize(Channel* channel) { - if (shared_channel) { - return false; - } - if (!channel) { - // Create from flags. - if (FLAGS_trace_file.size()) { - channel = new channels::FileChannel(FLAGS_trace_file.c_str()); - } - if (!channel) { - // Tracing disabled. - return true; - } - } - shared_channel = channel; - alloy::tracing::WriteEvent(EventType::TraceInit({})); - channel->Flush(); - atexit(CleanupTracing); - return true; -} - -void Shutdown() { - // ? -} - -void Flush() { - if (shared_channel) { - shared_channel->Flush(); - } -} - -Tracer* GetThreadTracer() { - if (!shared_channel) { - return nullptr; - } - if (!thread_tracer) { - thread_tracer = new Tracer(shared_channel); - } - return thread_tracer; -} - -void WriteEvent(uint32_t event_type, size_t size, const void* data) { - Tracer* t = GetThreadTracer(); - if (t) { - t->WriteEvent(event_type, size, (const uint8_t*)data); - } -} - -} // namespace tracing -} // namespace alloy diff --git a/src/alloy/tracing/tracing.h b/src/alloy/tracing/tracing.h deleted file mode 100644 index bcfe68a9d..000000000 --- a/src/alloy/tracing/tracing.h +++ /dev/null @@ -1,44 +0,0 @@ -/** - ****************************************************************************** - * Xenia : Xbox 360 Emulator Research Project * - ****************************************************************************** - * Copyright 2013 Ben Vanik. All rights reserved. * - * Released under the BSD license - see LICENSE in the root for more details. * - ****************************************************************************** - */ - -#ifndef ALLOY_TRACING_TRACING_H_ -#define ALLOY_TRACING_TRACING_H_ - -#include - -#include - -namespace alloy { -namespace tracing { - -class Channel; -class Tracer; - -bool Initialize(Channel* channel = nullptr); -void Shutdown(); -void Flush(); - -Tracer* GetThreadTracer(); - -void WriteEvent(uint32_t event_type, size_t size = 0, - const void* data = nullptr); - -template -void WriteEvent(const T& ev) { - if (sizeof(T) > 1) { - alloy::tracing::WriteEvent(T::event_type, sizeof(T), &ev); - } else { - alloy::tracing::WriteEvent(T::event_type); - } -} - -} // namespace tracing -} // namespace alloy - -#endif // ALLOY_TRACING_TRACING_H_ diff --git a/src/xenia/cpu/xenon_memory.cc b/src/xenia/cpu/xenon_memory.cc index 2993f4850..d7ad0d751 100644 --- a/src/xenia/cpu/xenon_memory.cc +++ b/src/xenia/cpu/xenon_memory.cc @@ -11,12 +11,9 @@ #include -#include - #include using namespace alloy; -using namespace alloy::runtime; using namespace xe::cpu; // TODO(benvanik): move xbox.h out @@ -267,9 +264,6 @@ XenonMemory::~XenonMemory() { CloseHandle(mapping_); mapping_base_ = 0; mapping_ = 0; - - alloy::tracing::WriteEvent(EventType::MemoryDeinit({ - })); } } @@ -311,9 +305,6 @@ int XenonMemory::Initialize() { } membase_ = mapping_base_; - alloy::tracing::WriteEvent(EventType::MemoryInit({ - })); - // Prepare heaps. virtual_heap_->Initialize( XENON_MEMORY_VIRTUAL_HEAP_LOW, XENON_MEMORY_VIRTUAL_HEAP_HIGH); @@ -542,10 +533,6 @@ uint64_t XenonMemory::HeapAlloc( xe_zero_struct(pv, size); } - alloy::tracing::WriteEvent(EventType::MemoryHeapAlloc({ - 0, flags, base_address, size, - })); - return base_address; } } @@ -559,9 +546,6 @@ int XenonMemory::HeapFree(uint64_t address, size_t size) { return physical_heap_->Free(address, size) ? 0 : 1; } else { // A placed address. Decommit. - alloy::tracing::WriteEvent(EventType::MemoryHeapFree({ - 0, address, - })); uint8_t* p = Translate(address); return VirtualFree(p, size, MEM_DECOMMIT) ? 0 : 1; } @@ -628,10 +612,6 @@ XenonMemoryHeap::~XenonMemoryHeap() { if (ptr_) { XEIGNORE(VirtualFree(ptr_, 0, MEM_RELEASE)); - - alloy::tracing::WriteEvent(EventType::MemoryHeapDeinit({ - heap_id_, - })); } } @@ -648,10 +628,6 @@ int XenonMemoryHeap::Initialize(uint64_t low, uint64_t high) { } space_ = create_mspace_with_base(ptr_, size_, 0); - alloy::tracing::WriteEvent(EventType::MemoryHeapInit({ - heap_id_, low, high, is_physical_, - })); - return 0; } @@ -719,10 +695,6 @@ uint64_t XenonMemoryHeap::Alloc( uint64_t address = (uint64_t)((uintptr_t)p - (uintptr_t)memory_->mapping_base_); - alloy::tracing::WriteEvent(EventType::MemoryHeapAlloc({ - heap_id_, flags, address, size, - })); - return address; } @@ -775,10 +747,6 @@ uint64_t XenonMemoryHeap::Free(uint64_t address, size_t size) { MEM_DECOMMIT); } - alloy::tracing::WriteEvent(EventType::MemoryHeapFree({ - heap_id_, address, - })); - return (uint64_t)real_size; } diff --git a/src/xenia/cpu/xenon_runtime.cc b/src/xenia/cpu/xenon_runtime.cc index 9caa0841e..46fe20d5f 100644 --- a/src/xenia/cpu/xenon_runtime.cc +++ b/src/xenia/cpu/xenon_runtime.cc @@ -10,7 +10,6 @@ #include #include -#include #include @@ -27,10 +26,7 @@ XenonRuntime::XenonRuntime( export_resolver_(export_resolver) { } -XenonRuntime::~XenonRuntime() { - alloy::tracing::WriteEvent(EventType::Deinit({ - })); -} +XenonRuntime::~XenonRuntime() = default; int XenonRuntime::Initialize(std::unique_ptr backend) { std::unique_ptr frontend(new PPCFrontend(this)); @@ -41,8 +37,5 @@ int XenonRuntime::Initialize(std::unique_ptr backend) { return result; } - alloy::tracing::WriteEvent(EventType::Init({ - })); - return result; } diff --git a/src/xenia/cpu/xenon_thread_state.cc b/src/xenia/cpu/xenon_thread_state.cc index b00a75355..9b09c5608 100644 --- a/src/xenia/cpu/xenon_thread_state.cc +++ b/src/xenia/cpu/xenon_thread_state.cc @@ -9,8 +9,6 @@ #include -#include - #include using namespace alloy; @@ -19,15 +17,13 @@ using namespace alloy::frontend::ppc; using namespace alloy::runtime; using namespace xe::cpu; - -XenonThreadState::XenonThreadState( - XenonRuntime* runtime, uint32_t thread_id, - size_t stack_size, uint64_t thread_state_address) : - ThreadState(runtime, thread_id), - stack_size_(stack_size), - thread_state_address_(thread_state_address) { - stack_address_ = memory_->HeapAlloc( - 0, stack_size, MEMORY_FLAG_ZERO); +XenonThreadState::XenonThreadState(XenonRuntime* runtime, uint32_t thread_id, + size_t stack_size, + uint64_t thread_state_address) + : ThreadState(runtime, thread_id), + stack_size_(stack_size), + thread_state_address_(thread_state_address) { + stack_address_ = memory_->HeapAlloc(0, stack_size, MEMORY_FLAG_ZERO); // Allocate with 64b alignment. context_ = (PPCContext*)xe_malloc_aligned(sizeof(PPCContext)); @@ -36,12 +32,12 @@ XenonThreadState::XenonThreadState( // Stash pointers to common structures that callbacks may need. context_->reserve_address = memory_->reserve_address(); - context_->membase = memory_->membase(); - context_->runtime = runtime; - context_->thread_state = this; + context_->membase = memory_->membase(); + context_->runtime = runtime; + context_->thread_state = this; // Set initial registers. - context_->r[1] = stack_address_ + stack_size; + context_->r[1] = stack_address_ + stack_size; context_->r[13] = thread_state_address_; // Pad out stack a bit, as some games seem to overwrite the caller by about @@ -50,18 +46,12 @@ XenonThreadState::XenonThreadState( raw_context_ = context_; - alloy::tracing::WriteEvent(EventType::ThreadInit({ - })); - runtime_->debugger()->OnThreadCreated(this); } XenonThreadState::~XenonThreadState() { runtime_->debugger()->OnThreadDestroyed(this); - alloy::tracing::WriteEvent(EventType::ThreadDeinit({ - })); - xe_free_aligned(context_); memory_->HeapFree(stack_address_, stack_size_); } diff --git a/src/xenia/cpu/xex_module.cc b/src/xenia/cpu/xex_module.cc index 9c63f6292..df019e5ae 100644 --- a/src/xenia/cpu/xex_module.cc +++ b/src/xenia/cpu/xex_module.cc @@ -9,7 +9,6 @@ #include -#include #include #include #include