History

Address more bugs found during limbo compiler testing

arr committed 9 years ago

Commit 84ac3311 parent 220aaf26 files · +52 −63Browse files

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

Unified · Split

src/vm/vm_memory.cpp+9−6
@@ -158,19 +158,22 @@ namespace · 157 unmodified lines
158158
159159 void disvm::runtime::destroy_memory(const type_descriptor_t &type_desc, void *data)
160160 {
161− enum_pointer_fields(type_desc, data, dec_ref_and_free_pointer_field);
162−
161+ dec_ref_count_in_memory(type_desc, data);
163162 debug::assign_debug_memory(data, type_desc.size_in_bytes);
164163 }
165164
166165 void disvm::runtime::inc_ref_count_in_memory(const type_descriptor_t &type_desc, void *data)
167166 {
168− if (data == nullptr)
169− return;
170−
167+ assert(data != nullptr);
171168 enum_pointer_fields(type_desc, data, add_ref_pointer_field);
172169 }
173170
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+
174177 void disvm::runtime::dec_ref_count_and_free(vm_alloc_t *alloc)
175178 {
176179 if (alloc == nullptr)
@@ -460,7 +463,7 @@ std::shared_ptr<const type_descriptor_t> type_descriptor_t::create( · 283 unmodified lines
460463 pointer_map_local[i] = pointer_map[i];
461464 }
462465
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, "?" };
464467 return std::shared_ptr<type_descriptor_t>{ new_type, deleter };
465468 }
466469