History

Add type_descriptor::is_equal() function. - Replace pointer and use function throughout VM Complete implementation of vm_array_t::copy_from() which supports the slicela instruction.

arr committed 9 years ago

Commit 7838bae1 parent 5ef656f5 files · +30 −12Browse files

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

Unified · Split

src/vm/vm_memory.cpp+16−0
@@ -530,3 +530,19 @@ type_descriptor_t::type_descriptor_t( · 529 unmodified lines
530530 if (debug::is_component_tracing_enabled<debug::component_trace_t::memory>())
531531 debug::log_msg(debug::component_trace_t::memory, debug::log_level_t::debug, "init: type descriptor");
532532 }
533+
534+bool type_descriptor_t::is_equal(const type_descriptor_t *other) const
535+{
536+ if (other == nullptr)
537+ return false;
538+
539+ if (this == other)
540+ return true;
541+
542+ bool equal = size_in_bytes == other->size_in_bytes;
543+ equal = equal && map_in_bytes == other->map_in_bytes;
544+ equal = equal && 0 == std::memcmp(pointer_map, other->pointer_map, map_in_bytes);
545+ equal = equal && finalizer == other->finalizer;
546+
547+ return equal;
548+}