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/include (2 of 18 files). Show all

Unified · Split

2 files
  1. src/include/builtin_module.h +36 −0
  2. src/include/runtime.h +1 −1
src/include/builtin_module.h+36−0
@@ -60,6 +60,42 @@ namespace disvm · 59 unmodified lines
60 static_assert(60 static_assert(
61 sizeof(vm_frame_base_alloc_t) == runtime_constants::default_register_count * runtime_constants::default_register_size_bytes,61 sizeof(vm_frame_base_alloc_t) == runtime_constants::default_register_count * runtime_constants::default_register_size_bytes,
62 "Default register allocation should match base allocation type");62 "Default register allocation should match base allocation type");
63
64 //
65 // Helpers for accessing VM types
66 //
67
68 // Get value-type reference
69 template<typename ValueType>
70 ValueType& vt_ref(pointer_t vt)
71 {
72 assert(vt != nullptr);
73 return *reinterpret_cast<ValueType *>(vt);
74 }
75
76 // Get allocation type value
77 template<typename AllocType>
78 typename std::enable_if<std::is_base_of<vm_alloc_t, AllocType>::value, AllocType *>::type
79 at_val(pointer_t at)
80 {
81 assert(at != nullptr);
82 return vm_alloc_t::from_allocation<AllocType>(*reinterpret_cast<pointer_t *>(at));
83 }
84
85 // Get allocation type value - base alloc type
86 template<>
87 inline vm_alloc_t *at_val<vm_alloc_t>(pointer_t at)
88 {
89 assert(at != nullptr);
90 return vm_alloc_t::from_allocation(*reinterpret_cast<pointer_t *>(at));
91 }
92
93 // Get pointer type reference
94 inline pointer_t &pt_ref(pointer_t pt)
95 {
96 assert(pt != nullptr);
97 return *reinterpret_cast<pointer_t *>(pt);
98 }
63 }99 }
64}100}
65 101
src/include/runtime.h+1−1
@@ -249,7 +249,7 @@ namespace disvm · 248 unmodified lines
249 249
250 vm_list_t* get_tail() const;250 vm_list_t* get_tail() const;
251 251
252 vm_list_t* drop_tail();252 void set_tail(vm_list_t *new_tail);
253 253
254 // Returns a pointer to the value254 // Returns a pointer to the value
255 pointer_t value() const;255 pointer_t value() const;