History

Remove 'using namespace' statements from all but the execution table file.

arr committed 9 years ago

Commit 2519a931 parent 68d4d6931 files · +725 −426Browse files

Showing the changes to src/vm/thread.cpp (1 of 31 files). Show all

Unified · Split

src/vm/thread.cpp+38−19
@@ -16,8 +16,28 @@ · 15 unmodified lines
1616 #include "execution_table.h"
1717 #include "tool_dispatch.h"
1818
19−using namespace disvm;
20−using namespace disvm::runtime;
19+using disvm::vm_t;
20+using disvm::opcode_t;
21+
22+using disvm::debug::component_trace_t;
23+using disvm::debug::log_level_t;
24+
25+using disvm::runtime::type_descriptor_t;
26+using disvm::runtime::word_t;
27+using disvm::runtime::pointer_t;
28+using disvm::runtime::vm_pc_t;
29+using disvm::runtime::vm_exec_op_t;
30+using disvm::runtime::vm_thread_t;
31+using disvm::runtime::vm_frame_t;
32+using disvm::runtime::vm_module_t;
33+using disvm::runtime::vm_module_ref_t;
34+using disvm::runtime::vm_registers_t;
35+using disvm::runtime::address_mode_t;
36+using disvm::runtime::address_mode_middle_t;
37+using disvm::runtime::vm_trap_flags_t;
38+using disvm::runtime::vm_thread_state_t;
39+using disvm::runtime::vm_tool_dispatch_t;
40+using disvm::runtime::vm_system_exception;
2141
2242 namespace
2343 {
@@ -30,11 +50,11 @@ namespace · 6 unmodified lines
3050
3151 #ifndef NDEBUG
3252 // This is a perf critical function so logging is only available in debug builds
33− if (debug::is_component_tracing_enabled<debug::component_trace_t::addressing>())
53+ if (disvm::debug::is_component_tracing_enabled<component_trace_t::addressing>())
3454 {
35− debug::log_msg(
36− debug::component_trace_t::addressing,
37− debug::log_level_t::debug,
55+ disvm::debug::log_msg(
56+ component_trace_t::addressing,
57+ log_level_t::debug,
3858 "decode: registers: %d (%#" PRIxPTR " %#" PRIxPTR " %#" PRIxPTR ")",
3959 inst.opcode,
4060 reg.src,
@@ -130,7 +150,7 @@ vm_thread_t::vm_thread_t( · 89 unmodified lines
130150 // Pushing the initial frame sets the FP register
131151 _registers.stack.push_frame();
132152
133− debug::log_msg(debug::component_trace_t::thread, debug::log_level_t::debug, "init: vm thread: %d %d", _thread_id, _parent_thread_id);
153+ disvm::debug::log_msg(component_trace_t::thread, log_level_t::debug, "init: vm thread: %d %d", _thread_id, _parent_thread_id);
134154 }
135155
136156 vm_thread_t::vm_thread_t(
@@ -159,14 +179,14 @@ vm_thread_t::vm_thread_t( · 22 unmodified lines
159179 // Copy over the frame into this thread - pass arguments to the thread
160180 current_frame->copy_frame_contents(initial_frame);
161181
162− if (debug::is_component_tracing_enabled<debug::component_trace_t::thread>())
163− debug::log_msg(debug::component_trace_t::thread, debug::log_level_t::debug, "init: vm thread: %d %d", _thread_id, _parent_thread_id);
182+ if (disvm::debug::is_component_tracing_enabled<component_trace_t::thread>())
183+ disvm::debug::log_msg(component_trace_t::thread, log_level_t::debug, "init: vm thread: %d %d", _thread_id, _parent_thread_id);
164184 }
165185
166186 vm_thread_t::~vm_thread_t()
167187 {
168− if (debug::is_component_tracing_enabled<debug::component_trace_t::thread>())
169− debug::log_msg(debug::component_trace_t::thread, debug::log_level_t::debug, "destroy: vm thread: %d %d", _thread_id, _parent_thread_id);
188+ if (disvm::debug::is_component_tracing_enabled<component_trace_t::thread>())
189+ disvm::debug::log_msg(component_trace_t::thread, log_level_t::debug, "destroy: vm thread: %d %d", _thread_id, _parent_thread_id);
170190
171191 free_memory(_error_message);
172192 debug::assign_debug_pointer(&_error_message);
@@ -187,7 +207,7 @@ namespace · 14 unmodified lines
187207 static void after_exec(vm_registers_t &r, vm_t &)
188208 {
189209 if (r.trap_flags == vm_trap_flags_t::none
190− || !util::has_flag(r.trap_flags, vm_trap_flags_t::instruction))
210+ || !disvm::util::has_flag(r.trap_flags, vm_trap_flags_t::instruction))
191211 return;
192212
193213 auto tool_dispatch = r.tool_dispatch.load();
@@ -217,13 +237,12 @@ namespace · 23 unmodified lines
217237 assert(!r.module_ref->is_builtin_module() && "Interpreter thread is unable to execute native instructions");
218238 const auto &inst = code_section[r.pc].op;
219239 const auto opcode = static_cast<std::size_t>(inst.opcode);
220− if (static_cast<std::size_t>(opcode_t::last_opcode) < opcode)
221− throw vm_system_exception{ "Unknown op-code" };
240+ assert(opcode <= static_cast<std::size_t>(opcode_t::last_opcode));
222241
223242 // Instruction is valid, decode and update registers for operation
224243 decode_address(inst, r);
225244 r.next_pc = (r.pc + 1);
226− vm_exec_table[opcode](r, vm);
245+ disvm::runtime::vm_exec_table[opcode](r, vm);
227246 r.pc = r.next_pc;
228247
229248 EXEC_DETOUR::after_exec(r, vm);
@@ -280,11 +299,11 @@ vm_thread_state_t vm_thread_t::execute(vm_t &vm, const uint32_t quanta) · 50 unmodified lines
280299 }
281300
282301 // Log the execution result
283− if (debug::is_component_tracing_enabled<debug::component_trace_t::thread>())
302+ if (disvm::debug::is_component_tracing_enabled<component_trace_t::thread>())
284303 {
285− debug::log_msg(
286− debug::component_trace_t::thread,
287− debug::log_level_t::debug,
304+ disvm::debug::log_msg(
305+ component_trace_t::thread,
306+ log_level_t::debug,
288307 "status: vm thread: execute: %d %d %d %d",
289308 _thread_id,
290309 (quanta - _registers.current_thread_quanta),

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t