Showing the changes to src/vm/array.cpp (1 of 31 files). Show all
Unified · Split
| @@ -9,8 +9,16 @@ · 8 unmodified lines | ||
| 9 | 9 | #include <debug.h> |
| 10 | 10 | #include <exceptions.h> |
| 11 | 11 | |
| 12 | −using namespace disvm; | |
| 13 | −using namespace disvm::runtime; | |
| 12 | +using disvm::debug::component_trace_t; | |
| 13 | +using disvm::debug::log_level_t; | |
| 14 | + | |
| 15 | +using disvm::runtime::intrinsic_type_desc; | |
| 16 | +using disvm::runtime::pointer_t; | |
| 17 | +using disvm::runtime::type_descriptor_t; | |
| 18 | +using disvm::runtime::vm_alloc_t; | |
| 19 | +using disvm::runtime::vm_array_t; | |
| 20 | +using disvm::runtime::vm_string_t; | |
| 21 | +using disvm::runtime::word_t; | |
| 14 | 22 | |
| 15 | 23 | std::shared_ptr<const type_descriptor_t> vm_array_t::type_desc() |
| 16 | 24 | { |
| @@ -27,7 +35,7 @@ vm_array_t::vm_array_t(std::shared_ptr<const type_descriptor_t> td, word_t lengt · 10 unmodified lines | ||
| 27 | 35 | assert(_element_type != nullptr); |
| 28 | 36 | assert(_length >= 0); |
| 29 | 37 | _arr = alloc_memory<byte_t>(_length * _element_type->size_in_bytes); |
| 30 | − debug::log_msg(debug::component_trace_t::memory, debug::log_level_t::debug, "init: vm array: %d", _length); | |
| 38 | + disvm::debug::log_msg(component_trace_t::memory, log_level_t::debug, "init: vm array: %d", _length); | |
| 31 | 39 | |
| 32 | 40 | // [SPEC] Element memory is already initialized to zero based on the alloc_memory contract |
| 33 | 41 | } |
| @@ -41,8 +49,8 @@ vm_array_t::vm_array_t(vm_array_t &original, word_t begin_index, word_t length) · 7 unmodified lines | ||
| 41 | 49 | { |
| 42 | 50 | assert(0 <= begin_index && (begin_index < _original->get_length() || (begin_index == _original->get_length() && length == 0))); |
| 43 | 51 | |
| 44 | − if (debug::is_component_tracing_enabled<debug::component_trace_t::memory>()) | |
| 45 | − debug::log_msg(debug::component_trace_t::memory, debug::log_level_t::debug, "init: vm array: slice: %d %d", begin_index, _length); | |
| 52 | + if (disvm::debug::is_component_tracing_enabled<component_trace_t::memory>()) | |
| 53 | + disvm::debug::log_msg(component_trace_t::memory, log_level_t::debug, "init: vm array: slice: %d %d", begin_index, _length); | |
| 46 | 54 | |
| 47 | 55 | // Set the data to reference the original array |
| 48 | 56 | _arr = _original->_arr + (begin_index * _element_type->size_in_bytes); |
| @@ -77,8 +85,8 @@ vm_array_t::vm_array_t(const vm_string_t *s) · 28 unmodified lines | ||
| 77 | 85 | std::memcpy(_arr, str, _length); |
| 78 | 86 | } |
| 79 | 87 | |
| 80 | − if (debug::is_component_tracing_enabled<debug::component_trace_t::memory>()) | |
| 81 | − debug::log_msg(debug::component_trace_t::memory, debug::log_level_t::debug, "init: vm array: vm string: %d", _length); | |
| 88 | + if (disvm::debug::is_component_tracing_enabled<component_trace_t::memory>()) | |
| 89 | + disvm::debug::log_msg(component_trace_t::memory, log_level_t::debug, "init: vm array: vm string: %d", _length); | |
| 82 | 90 | } |
| 83 | 91 | |
| 84 | 92 | vm_array_t::~vm_array_t() |
| @@ -92,7 +100,7 @@ vm_array_t::~vm_array_t() · 7 unmodified lines | ||
| 92 | 100 | dec_ref_count_and_free(_original); |
| 93 | 101 | debug::assign_debug_pointer(&_original); |
| 94 | 102 | |
| 95 | − debug::log_msg(debug::component_trace_t::memory, debug::log_level_t::debug, "destroy: vm array: slice"); | |
| 103 | + disvm::debug::log_msg(component_trace_t::memory, log_level_t::debug, "destroy: vm array: slice"); | |
| 96 | 104 | } |
| 97 | 105 | else |
| 98 | 106 | { |
| @@ -100,19 +108,19 @@ vm_array_t::~vm_array_t() · 1 unmodified line | ||
| 100 | 108 | auto arr_local = _arr; |
| 101 | 109 | const auto array_len = _length; |
| 102 | 110 | const auto &element_type = *_element_type; |
| 103 | − debug::log_msg(debug::component_trace_t::memory, debug::log_level_t::debug, "begin: destroy: elements: %d", array_len); | |
| 111 | + disvm::debug::log_msg(component_trace_t::memory, log_level_t::debug, "begin: destroy: elements: %d", array_len); | |
| 104 | 112 | for (word_t i = 0; i < array_len; ++i) |
| 105 | 113 | { |
| 106 | 114 | destroy_memory(element_type, arr_local); |
| 107 | 115 | arr_local += element_type.size_in_bytes; |
| 108 | 116 | } |
| 109 | − debug::log_msg(debug::component_trace_t::memory, debug::log_level_t::debug, "end: destroy: elements: %d", array_len); | |
| 117 | + disvm::debug::log_msg(component_trace_t::memory, log_level_t::debug, "end: destroy: elements: %d", array_len); | |
| 110 | 118 | |
| 111 | 119 | // Free array memory |
| 112 | 120 | free_memory(_arr); |
| 113 | 121 | |
| 114 | 122 | debug::assign_debug_pointer(&_arr); |
| 115 | − debug::log_msg(debug::component_trace_t::memory, debug::log_level_t::debug, "destroy: vm array"); | |
| 123 | + disvm::debug::log_msg(component_trace_t::memory, log_level_t::debug, "destroy: vm array"); | |
| 116 | 124 | } |
| 117 | 125 | |
| 118 | 126 | } |