History

Add support for traps in VM Add instruction trap to enable single step scenario in debugger Remote get_state() function from thread

arr committed 9 years ago

Commit cb408a11 parent eb570d98 files · +120 −40Browse files

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

Unified · Split

src/vm/scheduler.cpp+3−3
@@ -130,7 +130,7 @@ vm_scheduler_control_t &default_scheduler_t::get_controller() const · 129 unmodified lines
130const vm_thread_t& default_scheduler_t::schedule_thread(std::unique_ptr<runtime::vm_thread_t> thread)130const vm_thread_t& default_scheduler_t::schedule_thread(std::unique_ptr<runtime::vm_thread_t> thread)
131{131{
132 assert(thread != nullptr);132 assert(thread != nullptr);
133 if (thread->get_state() != vm_thread_state_t::ready)133 if (thread->get_registers().current_thread_state != vm_thread_state_t::ready)
134 throw vm_system_exception{ "Scheduled thread in invalid state" };134 throw vm_system_exception{ "Scheduled thread in invalid state" };
135 135
136 if (debug::is_component_tracing_enabled<debug::component_trace_t::scheduler>())136 if (debug::is_component_tracing_enabled<debug::component_trace_t::scheduler>())
@@ -284,7 +284,7 @@ std::shared_ptr<default_scheduler_t::thread_instance_t> default_scheduler_t::nex · 147 unmodified lines
284 // Check if the passed in thread should be enqueued284 // Check if the passed in thread should be enqueued
285 if (prev_thread != nullptr)285 if (prev_thread != nullptr)
286 {286 {
287 const auto current_state = prev_thread->vm_thread->get_state();287 const auto current_state = prev_thread->vm_thread->get_registers().current_thread_state;
288 288
289 // This system thread releases ownership of the vm thread after it has been enqueued289 // This system thread releases ownership of the vm thread after it has been enqueued
290 std::lock_guard<std::mutex> vm_thread_ownership{ prev_thread->system_thread_ownership, std::adopt_lock };290 std::lock_guard<std::mutex> vm_thread_ownership{ prev_thread->system_thread_ownership, std::adopt_lock };
@@ -367,7 +367,7 @@ void default_scheduler_t::perform_gc(bool is_gc_thread, std::unique_lock<std::mu · 76 unmodified lines
367 for (auto &p : _all_vm_threads)367 for (auto &p : _all_vm_threads)
368 {368 {
369 auto &vm_thread = p.second->vm_thread;369 auto &vm_thread = p.second->vm_thread;
370 if (vm_thread->get_state() != vm_thread_state_t::broken)370 if (vm_thread->get_registers().current_thread_state != vm_thread_state_t::broken)
371 result.push_back(vm_thread);371 result.push_back(vm_thread);
372 }372 }
373 373