Showing the changes to src/vm/vm_memory.cpp (1 of 6 files). Show all
Unified · Split
| @@ -158,19 +158,22 @@ namespace · 157 unmodified lines | ||
| 158 | 158 | |
| 159 | 159 | void disvm::runtime::destroy_memory(const type_descriptor_t &type_desc, void *data) |
| 160 | 160 | { |
| 161 | − enum_pointer_fields(type_desc, data, dec_ref_and_free_pointer_field); | |
| 162 | − | |
| 161 | + dec_ref_count_in_memory(type_desc, data); | |
| 163 | 162 | debug::assign_debug_memory(data, type_desc.size_in_bytes); |
| 164 | 163 | } |
| 165 | 164 | |
| 166 | 165 | void disvm::runtime::inc_ref_count_in_memory(const type_descriptor_t &type_desc, void *data) |
| 167 | 166 | { |
| 168 | − if (data == nullptr) | |
| 169 | − return; | |
| 170 | − | |
| 167 | + assert(data != nullptr); | |
| 171 | 168 | enum_pointer_fields(type_desc, data, add_ref_pointer_field); |
| 172 | 169 | } |
| 173 | 170 | |
| 171 | +void disvm::runtime::dec_ref_count_in_memory(const type_descriptor_t &type_desc, void *data) | |
| 172 | +{ | |
| 173 | + assert(data != nullptr); | |
| 174 | + enum_pointer_fields(type_desc, data, dec_ref_and_free_pointer_field); | |
| 175 | +} | |
| 176 | + | |
| 174 | 177 | void disvm::runtime::dec_ref_count_and_free(vm_alloc_t *alloc) |
| 175 | 178 | { |
| 176 | 179 | if (alloc == nullptr) |
| @@ -460,7 +463,7 @@ std::shared_ptr<const type_descriptor_t> type_descriptor_t::create( · 283 unmodified lines | ||
| 460 | 463 | pointer_map_local[i] = pointer_map[i]; |
| 461 | 464 | } |
| 462 | 465 | |
| 463 | − auto new_type = ::new(new_type_memory) type_descriptor_t{ size_in_bytes, pointer_map_length, pointer_map_local, finalizer, "#" }; | |
| 466 | + auto new_type = ::new(new_type_memory) type_descriptor_t{ size_in_bytes, pointer_map_length, pointer_map_local, finalizer, "?" }; | |
| 464 | 467 | return std::shared_ptr<type_descriptor_t>{ new_type, deleter }; |
| 465 | 468 | } |
| 466 | 469 | |