Remove global memory lock mechanism - Wasn't being used but showed up on profile report :( Move enum_pointer_fields and is_offset_pointer impls into cpp file Create enum_pointer_fields_with_offset function since the VM never needs the offset values and the generated code was about 5% bigger. Now the VM can use the callback without the offset. Removed pointless init_memory() usage since alloc_memory() now is required to return zeroed out memory. Fixed bugs in GC Added support - Ranged absolute disassembly in debugger - New duration log component
Showing the changes to src/vm/execution_table.cpp (1 of 12 files). Show all
Unified · Split
| @@ -206,8 +206,7 @@ namespace · 205 unmodified lines | |||
| 206 | assert(len <= buffer.size()); | 206 | assert(len <= buffer.size()); |
| 207 | 207 | ||
| 208 | auto new_string = new vm_string_t{ len, reinterpret_cast<uint8_t *>(buffer.data()) }; | 208 | auto new_string = new vm_string_t{ len, reinterpret_cast<uint8_t *>(buffer.data()) }; |
| 209 | auto prev = at_val<vm_alloc_t>(r.dest); | 209 | dec_ref_count_and_free(at_val<vm_alloc_t>(r.dest)); |
| 210 | dec_ref_count_and_free(prev); | ||
| 211 | 210 | ||
| 212 | pt_ref(r.dest) = new_string->get_allocation(); | 211 | pt_ref(r.dest) = new_string->get_allocation(); |
| 213 | } | 212 | } |
| @@ -232,9 +231,7 @@ namespace · 18 unmodified lines | |||
| 232 | assert(len <= buffer.size()); | 231 | assert(len <= buffer.size()); |
| 233 | 232 | ||
| 234 | auto new_string = new vm_string_t{ len, reinterpret_cast<uint8_t *>(buffer.data()) }; | 233 | auto new_string = new vm_string_t{ len, reinterpret_cast<uint8_t *>(buffer.data()) }; |
| 235 | 234 | dec_ref_count_and_free(at_val<vm_alloc_t>(r.dest)); | |
| 236 | auto prev = at_val<vm_alloc_t>(r.dest); | ||
| 237 | dec_ref_count_and_free(prev); | ||
| 238 | 235 | ||
| 239 | pt_ref(r.dest) = new_string->get_allocation(); | 236 | pt_ref(r.dest) = new_string->get_allocation(); |
| 240 | } | 237 | } |
| @@ -259,9 +256,7 @@ namespace · 18 unmodified lines | |||
| 259 | assert(len <= buffer.size()); | 256 | assert(len <= buffer.size()); |
| 260 | 257 | ||
| 261 | auto new_string = new vm_string_t{ len, reinterpret_cast<uint8_t *>(buffer.data()) }; | 258 | auto new_string = new vm_string_t{ len, reinterpret_cast<uint8_t *>(buffer.data()) }; |
| 262 | 259 | dec_ref_count_and_free(at_val<vm_alloc_t>(r.dest)); | |
| 263 | auto prev = at_val<vm_alloc_t>(r.dest); | ||
| 264 | dec_ref_count_and_free(prev); | ||
| 265 | 260 | ||
| 266 | pt_ref(r.dest) = new_string->get_allocation(); | 261 | pt_ref(r.dest) = new_string->get_allocation(); |
| 267 | } | 262 | } |
| @@ -513,8 +508,6 @@ namespace · 245 unmodified lines | |||
| 513 | void _mov_<vm_alloc_t>(pointer_t dest, pointer_t src, const type_descriptor_t *) | 508 | void _mov_<vm_alloc_t>(pointer_t dest, pointer_t src, const type_descriptor_t *) |
| 514 | { | 509 | { |
| 515 | auto alloc_prev = at_val<vm_alloc_t>(dest); | 510 | auto alloc_prev = at_val<vm_alloc_t>(dest); |
| 516 | dec_ref_count_and_free(alloc_prev); | ||
| 517 | |||
| 518 | auto alloc = at_val<vm_alloc_t>(src); | 511 | auto alloc = at_val<vm_alloc_t>(src); |
| 519 | if (alloc != nullptr) | 512 | if (alloc != nullptr) |
| 520 | { | 513 | { |
| @@ -525,6 +518,8 @@ namespace · 4 unmodified lines | |||
| 525 | { | 518 | { |
| 526 | pt_ref(dest) = nullptr; | 519 | pt_ref(dest) = nullptr; |
| 527 | } | 520 | } |
| 521 | |||
| 522 | dec_ref_count_and_free(alloc_prev); | ||
| 528 | } | 523 | } |
| 529 | 524 | ||
| 530 | EXEC_DECL(movb) { _mov_<byte_t>(r.dest, r.src, nullptr); } | 525 | EXEC_DECL(movb) { _mov_<byte_t>(r.dest, r.src, nullptr); } |
| @@ -1729,8 +1724,7 @@ namespace · 1198 unmodified lines | |||
| 1729 | auto exception_destination = reinterpret_cast<pointer_t>(frame_pointer + handler->exception_offset); | 1724 | auto exception_destination = reinterpret_cast<pointer_t>(frame_pointer + handler->exception_offset); |
| 1730 | 1725 | ||
| 1731 | // Destroy any data at this location. | 1726 | // Destroy any data at this location. |
| 1732 | auto current_value = at_val<vm_alloc_t>(exception_destination); | 1727 | dec_ref_count_and_free(at_val<vm_alloc_t>(exception_destination)); |
| 1733 | dec_ref_count_and_free(current_value); | ||
| 1734 | 1728 | ||
| 1735 | // Set the exception destination. | 1729 | // Set the exception destination. |
| 1736 | pt_ref(exception_destination) = e->get_allocation(); | 1730 | pt_ref(exception_destination) = e->get_allocation(); |