History

Address various performance issues discovered while profiling debugger Fix logical errors in bit shifting bytecodes Add assert for bit shifting issues that may arise on other compilers Fix bug in vm_array assert

arr committed 10 years ago

Commit d8c9a331 parent 42194725 files · +39 −25Browse files

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

Unified · Split

src/vm/array.cpp+7−7
@@ -17,11 +17,11 @@ std::shared_ptr<const type_descriptor_t> vm_array_t::type_desc() · 16 unmodified lines
17 return intrinsic_type_desc::type<vm_array_t>();17 return intrinsic_type_desc::type<vm_array_t>();
18}18}
19 19
20vm_array_t::vm_array_t(std::shared_ptr<const type_descriptor_t> td, word_t count)20vm_array_t::vm_array_t(std::shared_ptr<const type_descriptor_t> td, word_t length)
21 : vm_alloc_t(vm_array_t::type_desc())21 : vm_alloc_t(vm_array_t::type_desc())
22 , _arr{ nullptr }22 , _arr{ nullptr }
23 , _element_type{ td }23 , _element_type{ td }
24 , _length{ count }24 , _length{ length }
25 , _original{ nullptr }25 , _original{ nullptr }
26{26{
27 assert(_element_type != nullptr);27 assert(_element_type != nullptr);
@@ -43,11 +43,11 @@ vm_array_t::vm_array_t(std::shared_ptr<const type_descriptor_t> td, word_t count · 15 unmodified lines
43 debug::log_msg(debug::component_trace_t::memory, debug::log_level_t::debug, "end: init: elements: %d\n", array_len);43 debug::log_msg(debug::component_trace_t::memory, debug::log_level_t::debug, "end: init: elements: %d\n", array_len);
44}44}
45 45
46vm_array_t::vm_array_t(std::shared_ptr<const type_descriptor_t> td, word_t count, const zero_memory_t&)46vm_array_t::vm_array_t(std::shared_ptr<const type_descriptor_t> td, word_t length, const zero_memory_t&)
47 : vm_alloc_t(vm_array_t::type_desc())47 : vm_alloc_t(vm_array_t::type_desc())
48 , _arr{ nullptr }48 , _arr{ nullptr }
49 , _element_type{ td }49 , _element_type{ td }
50 , _length{ count }50 , _length{ length }
51 , _original{ nullptr }51 , _original{ nullptr }
52{52{
53 assert(_element_type != nullptr);53 assert(_element_type != nullptr);
@@ -56,16 +56,16 @@ vm_array_t::vm_array_t(std::shared_ptr<const type_descriptor_t> td, word_t count · 2 unmodified lines
56 debug::log_msg(debug::component_trace_t::memory, debug::log_level_t::debug, "initz: vm array: %d\n", _length);56 debug::log_msg(debug::component_trace_t::memory, debug::log_level_t::debug, "initz: vm array: %d\n", _length);
57}57}
58 58
59vm_array_t::vm_array_t(vm_array_t *original, word_t begin_index, word_t count)59vm_array_t::vm_array_t(vm_array_t *original, word_t begin_index, word_t length)
60 : vm_alloc_t(vm_array_t::type_desc())60 : vm_alloc_t(vm_array_t::type_desc())
61 , _arr{ nullptr }61 , _arr{ nullptr }
62 , _element_type{ original->get_element_type() }62 , _element_type{ original->get_element_type() }
63 , _length{ count }63 , _length{ length }
64 , _original{ original }64 , _original{ original }
65{65{
66 assert(_original != nullptr);66 assert(_original != nullptr);
67 assert(0 <= begin_index && begin_index < _original->get_length());67 assert(0 <= begin_index && begin_index < _original->get_length());
68 assert(_length >= 0 && (count - begin_index) < _original->get_length());68 assert(_length >= 0 && (_length + begin_index) <= _original->get_length());
69 69
70 if (debug::is_component_tracing_enabled<debug::component_trace_t::memory>())70 if (debug::is_component_tracing_enabled<debug::component_trace_t::memory>())
71 debug::log_msg(debug::component_trace_t::memory, debug::log_level_t::debug, "init: vm array: slice: %d %d\n", begin_index, _length);71 debug::log_msg(debug::component_trace_t::memory, debug::log_level_t::debug, "init: vm array: slice: %d %d\n", begin_index, _length);