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
16#include "execution_table.h"16#include "execution_table.h"
17#include "tool_dispatch.h"17#include "tool_dispatch.h"
18 18
19using namespace disvm;19using disvm::vm_t;
20using namespace disvm::runtime;20using disvm::opcode_t;
21
22using disvm::debug::component_trace_t;
23using disvm::debug::log_level_t;
24
25using disvm::runtime::type_descriptor_t;
26using disvm::runtime::word_t;
27using disvm::runtime::pointer_t;
28using disvm::runtime::vm_pc_t;
29using disvm::runtime::vm_exec_op_t;
30using disvm::runtime::vm_thread_t;
31using disvm::runtime::vm_frame_t;
32using disvm::runtime::vm_module_t;
33using disvm::runtime::vm_module_ref_t;
34using disvm::runtime::vm_registers_t;
35using disvm::runtime::address_mode_t;
36using disvm::runtime::address_mode_middle_t;
37using disvm::runtime::vm_trap_flags_t;
38using disvm::runtime::vm_thread_state_t;
39using disvm::runtime::vm_tool_dispatch_t;
40using disvm::runtime::vm_system_exception;
21 41
22namespace42namespace
23{43{
@@ -30,11 +50,11 @@ namespace · 6 unmodified lines
30 50
31#ifndef NDEBUG51#ifndef NDEBUG
32 // This is a perf critical function so logging is only available in debug builds52 // 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>())
34 {54 {
35 debug::log_msg(55 disvm::debug::log_msg(
36 debug::component_trace_t::addressing,56 component_trace_t::addressing,
37 debug::log_level_t::debug,57 log_level_t::debug,
38 "decode: registers: %d (%#" PRIxPTR " %#" PRIxPTR " %#" PRIxPTR ")",58 "decode: registers: %d (%#" PRIxPTR " %#" PRIxPTR " %#" PRIxPTR ")",
39 inst.opcode,59 inst.opcode,
40 reg.src,60 reg.src,
@@ -130,7 +150,7 @@ vm_thread_t::vm_thread_t( · 89 unmodified lines
130 // Pushing the initial frame sets the FP register150 // Pushing the initial frame sets the FP register
131 _registers.stack.push_frame();151 _registers.stack.push_frame();
132 152
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);
134}154}
135 155
136vm_thread_t::vm_thread_t(156vm_thread_t::vm_thread_t(
@@ -159,14 +179,14 @@ vm_thread_t::vm_thread_t( · 22 unmodified lines
159 // Copy over the frame into this thread - pass arguments to the thread179 // Copy over the frame into this thread - pass arguments to the thread
160 current_frame->copy_frame_contents(initial_frame);180 current_frame->copy_frame_contents(initial_frame);
161 181
162 if (debug::is_component_tracing_enabled<debug::component_trace_t::thread>())182 if (disvm::debug::is_component_tracing_enabled<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);183 disvm::debug::log_msg(component_trace_t::thread, log_level_t::debug, "init: vm thread: %d %d", _thread_id, _parent_thread_id);
164}184}
165 185
166vm_thread_t::~vm_thread_t()186vm_thread_t::~vm_thread_t()
167{187{
168 if (debug::is_component_tracing_enabled<debug::component_trace_t::thread>())188 if (disvm::debug::is_component_tracing_enabled<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);189 disvm::debug::log_msg(component_trace_t::thread, log_level_t::debug, "destroy: vm thread: %d %d", _thread_id, _parent_thread_id);
170 190
171 free_memory(_error_message);191 free_memory(_error_message);
172 debug::assign_debug_pointer(&_error_message);192 debug::assign_debug_pointer(&_error_message);
@@ -187,7 +207,7 @@ namespace · 14 unmodified lines
187 static void after_exec(vm_registers_t &r, vm_t &)207 static void after_exec(vm_registers_t &r, vm_t &)
188 {208 {
189 if (r.trap_flags == vm_trap_flags_t::none209 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))
191 return;211 return;
192 212
193 auto tool_dispatch = r.tool_dispatch.load();213 auto tool_dispatch = r.tool_dispatch.load();
@@ -217,13 +237,12 @@ namespace · 23 unmodified lines
217 assert(!r.module_ref->is_builtin_module() && "Interpreter thread is unable to execute native instructions");237 assert(!r.module_ref->is_builtin_module() && "Interpreter thread is unable to execute native instructions");
218 const auto &inst = code_section[r.pc].op;238 const auto &inst = code_section[r.pc].op;
219 const auto opcode = static_cast<std::size_t>(inst.opcode);239 const auto opcode = static_cast<std::size_t>(inst.opcode);
220 if (static_cast<std::size_t>(opcode_t::last_opcode) < opcode)240 assert(opcode <= static_cast<std::size_t>(opcode_t::last_opcode));
221 throw vm_system_exception{ "Unknown op-code" };
222 241
223 // Instruction is valid, decode and update registers for operation242 // Instruction is valid, decode and update registers for operation
224 decode_address(inst, r);243 decode_address(inst, r);
225 r.next_pc = (r.pc + 1);244 r.next_pc = (r.pc + 1);
226 vm_exec_table[opcode](r, vm);245 disvm::runtime::vm_exec_table[opcode](r, vm);
227 r.pc = r.next_pc;246 r.pc = r.next_pc;
228 247
229 EXEC_DETOUR::after_exec(r, vm);248 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
280 }299 }
281 300
282 // Log the execution result301 // 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>())
284 {303 {
285 debug::log_msg(304 disvm::debug::log_msg(
286 debug::component_trace_t::thread,305 component_trace_t::thread,
287 debug::log_level_t::debug,306 log_level_t::debug,
288 "status: vm thread: execute: %d %d %d %d",307 "status: vm thread: execute: %d %d %d %d",
289 _thread_id,308 _thread_id,
290 (quanta - _registers.current_thread_quanta),309 (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