History

Altered API getting the allocation from a vm_alloc_t. Added preliminary internal file descriptor type. Test groups now print out their name.

arr committed 10 years ago

Commit 5a417ba1 parent 9881f459 files · +230 −104Browse files

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

Unified · Split

src/vm/vm_memory.cpp+5−5
@@ -230,7 +230,7 @@ vm_alloc_t *vm_alloc_t::allocate(std::shared_ptr<const type_descriptor_t> td) · 229 unmodified lines
230 auto alloc = ::new(mem)vm_alloc_t{ td };230 auto alloc = ::new(mem)vm_alloc_t{ td };
231 231
232 // Initialize pointer types232 // Initialize pointer types
233 init_memory(*td, alloc->allocation());233 init_memory(*td, alloc->get_allocation());
234 234
235 debug::log_msg(debug::component_trace_t::memory, debug::log_level_t::debug, "init: vm alloc: %d\n", td->size_in_bytes);235 debug::log_msg(debug::component_trace_t::memory, debug::log_level_t::debug, "init: vm alloc: %d\n", td->size_in_bytes);
236 return alloc;236 return alloc;
@@ -255,10 +255,10 @@ vm_alloc_t *vm_alloc_t::copy(const vm_alloc_t &other) · 18 unmodified lines
255 auto alloc_copy = vm_alloc_t::allocate(other.alloc_type);255 auto alloc_copy = vm_alloc_t::allocate(other.alloc_type);
256 256
257 // Copy the current memory contents of the allocation257 // Copy the current memory contents of the allocation
258 std::memcpy(alloc_copy->allocation(), other.allocation(), alloc_copy->alloc_type->size_in_bytes);258 std::memcpy(alloc_copy->get_allocation(), other.get_allocation(), alloc_copy->alloc_type->size_in_bytes);
259 259
260 // Ref count all dynamic allocations260 // Ref count all dynamic allocations
261 inc_ref_count_in_memory(*alloc_copy->alloc_type, alloc_copy->allocation());261 inc_ref_count_in_memory(*alloc_copy->alloc_type, alloc_copy->get_allocation());
262 262
263 debug::log_msg(debug::component_trace_t::memory, debug::log_level_t::debug, "copy: vm alloc: %#" PRIxPTR " %#" PRIxPTR "\n", &other, alloc_copy);263 debug::log_msg(debug::component_trace_t::memory, debug::log_level_t::debug, "copy: vm alloc: %#" PRIxPTR " %#" PRIxPTR "\n", &other, alloc_copy);
264 return alloc_copy;264 return alloc_copy;
@@ -289,7 +289,7 @@ vm_alloc_t::~vm_alloc_t() · 24 unmodified lines
289 finalizer(this);289 finalizer(this);
290 290
291 // Free pointer types291 // Free pointer types
292 destroy_memory(*alloc_type, allocation());292 destroy_memory(*alloc_type, get_allocation());
293 debug::log_msg(debug::component_trace_t::memory, debug::log_level_t::debug, "destroy: vm alloc\n");293 debug::log_msg(debug::component_trace_t::memory, debug::log_level_t::debug, "destroy: vm alloc\n");
294}294}
295 295
@@ -314,7 +314,7 @@ std::size_t vm_alloc_t::get_ref_count() const · 18 unmodified lines
314 return _ref_count;314 return _ref_count;
315}315}
316 316
317pointer_t vm_alloc_t::allocation() const317pointer_t vm_alloc_t::get_allocation() const
318{318{
319 // Remove const on the this pointer so the offset can be computed.319 // Remove const on the this pointer so the offset can be computed.
320 auto non_const_this = const_cast<vm_alloc_t *>(this);320 auto non_const_this = const_cast<vm_alloc_t *>(this);