History

Basic implementation of Sys module functions - Sys.create, Sys.open, Sys.read, Sys.write - Sys.tokenize

Code analysis violations Bug in scheduler - race during with worker thread shutdown.

arr committed 10 years ago

Commit 992a33f1 parent 6d77c2d18 files · +695 −243Browse files

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

Unified · Split

src/vm/execution_table.cpp+6−33
@@ -17,6 +17,7 @@ · 16 unmodified lines
1717 #include <utils.h>
1818 #include <exceptions.h>
1919 #include <debug.h>
20+#include <builtin_module.h>
2021 #include "execution_table.h"
2122
2223 using namespace disvm;
@@ -31,36 +32,6 @@ namespace · 8 unmodified lines
3132 using uword_t = uint32_t; // unsigned word_t
3233 using ubig_t = uint64_t; // unsigned big_t
3334
34− template<typename ValueType>
35− ValueType& vt_ref(pointer_t vt)
36− {
37− assert(vt != nullptr);
38− return *reinterpret_cast<ValueType *>(vt);
39− }
40−
41− template<typename AllocType>
42− typename std::enable_if<std::is_base_of<vm_alloc_t, AllocType>::value, AllocType *>::type
43− at_val(pointer_t at)
44− {
45− assert(at != nullptr);
46−
47− return vm_alloc_t::from_allocation<AllocType>(*reinterpret_cast<pointer_t *>(at));
48− }
49−
50− template<>
51− vm_alloc_t *at_val<vm_alloc_t>(pointer_t at)
52− {
53− assert(at != nullptr);
54−
55− return vm_alloc_t::from_allocation(*reinterpret_cast<pointer_t *>(at));
56− }
57−
58− pointer_t &pt_ref(pointer_t pt)
59− {
60− assert(pt != nullptr);
61− return *reinterpret_cast<pointer_t *>(pt);
62− }
63−
6435 #define EXEC_DECL(inst_name) void inst_name(vm_registers_t &r, vm_t& vm)
6536
6637 EXEC_DECL(notimpl) { assert(false && "Instruction not implemented"); throw vm_system_exception{ "Instruction not implemented" }; }
@@ -805,7 +776,7 @@ namespace · 738 unmodified lines
805776 if (tail_maybe != nullptr)
806777 tail_maybe->release();
807778
808− auto new_list = new vm_list_t(intrinsic_type_desc::type<PrimitiveType>(), tail_maybe);
779+ auto new_list = new vm_list_t{ intrinsic_type_desc::type<PrimitiveType>(), tail_maybe };
809780
810781 auto value = vt_ref<PrimitiveType>(r.src);
811782 vt_ref<PrimitiveType>(new_list->value()) = value;
@@ -825,7 +796,8 @@ namespace · 13 unmodified lines
825796 tail_maybe->release();
826797
827798 // Create a new list
828− auto new_list = new vm_list_t(intrinsic_type_desc::type<pointer_t>(), tail_maybe);
799+ auto new_list = new vm_list_t{ intrinsic_type_desc::type<pointer_t>(), tail_maybe };
800+
829801 auto alloc = at_val<vm_alloc_t>(r.src);
830802 if (alloc != nullptr)
831803 {
@@ -858,7 +830,8 @@ namespace · 26 unmodified lines
858830 tail_maybe->release();
859831
860832 // Create a new list
861− auto new_list = new vm_list_t(type, tail_maybe);
833+ auto new_list = new vm_list_t{ type, tail_maybe };
834+
862835 auto destination = new_list->value();
863836 std::memmove(destination, r.src, type->size_in_bytes);
864837