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
1717 return intrinsic_type_desc::type<vm_array_t>();
1818 }
1919
20−vm_array_t::vm_array_t(std::shared_ptr<const type_descriptor_t> td, word_t count)
20+vm_array_t::vm_array_t(std::shared_ptr<const type_descriptor_t> td, word_t length)
2121 : vm_alloc_t(vm_array_t::type_desc())
2222 , _arr{ nullptr }
2323 , _element_type{ td }
24− , _length{ count }
24+ , _length{ length }
2525 , _original{ nullptr }
2626 {
2727 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
4343 debug::log_msg(debug::component_trace_t::memory, debug::log_level_t::debug, "end: init: elements: %d\n", array_len);
4444 }
4545
46−vm_array_t::vm_array_t(std::shared_ptr<const type_descriptor_t> td, word_t count, const zero_memory_t&)
46+vm_array_t::vm_array_t(std::shared_ptr<const type_descriptor_t> td, word_t length, const zero_memory_t&)
4747 : vm_alloc_t(vm_array_t::type_desc())
4848 , _arr{ nullptr }
4949 , _element_type{ td }
50− , _length{ count }
50+ , _length{ length }
5151 , _original{ nullptr }
5252 {
5353 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
5656 debug::log_msg(debug::component_trace_t::memory, debug::log_level_t::debug, "initz: vm array: %d\n", _length);
5757 }
5858
59−vm_array_t::vm_array_t(vm_array_t *original, word_t begin_index, word_t count)
59+vm_array_t::vm_array_t(vm_array_t *original, word_t begin_index, word_t length)
6060 : vm_alloc_t(vm_array_t::type_desc())
6161 , _arr{ nullptr }
6262 , _element_type{ original->get_element_type() }
63− , _length{ count }
63+ , _length{ length }
6464 , _original{ original }
6565 {
6666 assert(_original != nullptr);
6767 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());
6969
7070 if (debug::is_component_tracing_enabled<debug::component_trace_t::memory>())
7171 debug::log_msg(debug::component_trace_t::memory, debug::log_level_t::debug, "init: vm array: slice: %d %d\n", begin_index, _length);