History

Move some basic offset functions to header files for inlining ease Replace enum_pointer_field functions with custom implementations - GC now has custom implementation - other implementations use template<> version Fix misuse of shared_ptr<type_descriptor_t> in various built-in types Observed 5 - 8 % improvement in GC for compiler scenario.

arr committed 9 years ago

Commit cd2748b1 parent 3dd1c8210 files · +115 −160Browse files

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

Unified · Split

src/vm/execution_table.cpp+12−12
@@ -509,16 +509,14 @@ namespace · 508 unmodified lines
509 {509 {
510 auto alloc_prev = at_val<vm_alloc_t>(dest);510 auto alloc_prev = at_val<vm_alloc_t>(dest);
511 auto alloc = at_val<vm_alloc_t>(src);511 auto alloc = at_val<vm_alloc_t>(src);
512 pointer_t to_move = nullptr;
512 if (alloc != nullptr)513 if (alloc != nullptr)
513 {514 {
514 alloc->add_ref();515 alloc->add_ref();
515 pt_ref(dest) = alloc->get_allocation();516 to_move = alloc->get_allocation();
516 }
517 else
518 {
519 pt_ref(dest) = nullptr;
520 }517 }
521 518
519 pt_ref(dest) = to_move;
522 dec_ref_count_and_free(alloc_prev);520 dec_ref_count_and_free(alloc_prev);
523 }521 }
524 522
@@ -531,7 +529,6 @@ namespace · 6 unmodified lines
531 EXEC_DECL(movm)529 EXEC_DECL(movm)
532 {530 {
533 assert(r.src != nullptr && r.dest != nullptr);531 assert(r.src != nullptr && r.dest != nullptr);
534
535 std::memmove(r.dest, r.src, vt_ref<word_t>(r.mid));532 std::memmove(r.dest, r.src, vt_ref<word_t>(r.mid));
536 }533 }
537 534
@@ -1087,9 +1084,11 @@ namespace · 549 unmodified lines
1087 }1084 }
1088 1085
1089 dec_ref_count_and_free(at_val<vm_alloc_t>(r.dest));1086 dec_ref_count_and_free(at_val<vm_alloc_t>(r.dest));
1090 auto new_channel = new vm_channel_t{ type_desc, transfer, buffer_len };
1091 1087
1092 if (type_desc->map_in_bytes > 0)1088 const auto track_object = type_desc->map_in_bytes > 0;
1089 auto new_channel = new vm_channel_t{ std::move(type_desc), transfer, buffer_len };
1090
1091 if (track_object)
1093 vm.get_garbage_collector().track_allocation(new_channel);1092 vm.get_garbage_collector().track_allocation(new_channel);
1094 1093
1095 pt_ref(r.dest) = new_channel->get_allocation();1094 pt_ref(r.dest) = new_channel->get_allocation();
@@ -1107,7 +1106,7 @@ namespace · 11 unmodified lines
1107 auto memory_size = vt_ref<word_t>(r.src); 1106 auto memory_size = vt_ref<word_t>(r.src);
1108 auto channel_data_type = type_descriptor_t::create(memory_size); 1107 auto channel_data_type = type_descriptor_t::create(memory_size);
1109 1108
1110 _newc_(r, vm, channel_data_type, _channel_movm);1109 _newc_(r, vm, std::move(channel_data_type), _channel_movm);
1111 }1110 }
1112 1111
1113 EXEC_DECL(newcmp)1112 EXEC_DECL(newcmp)
@@ -1117,7 +1116,7 @@ namespace · 3 unmodified lines
1117 assert(0 <= type_id && type_id < static_cast<word_t>(types.size()));1116 assert(0 <= type_id && type_id < static_cast<word_t>(types.size()));
1118 auto type = types[type_id];1117 auto type = types[type_id];
1119 1118
1120 _newc_(r, vm, type, _channel_movmp);1119 _newc_(r, vm, std::move(type), _channel_movmp);
1121 }1120 }
1122 1121
1123 EXEC_DECL(send)1122 EXEC_DECL(send)
@@ -1440,7 +1439,7 @@ namespace · 316 unmodified lines
1440 assert(0 <= frame_type_id && frame_type_id < static_cast<word_t>(types.size()));1439 assert(0 <= frame_type_id && frame_type_id < static_cast<word_t>(types.size()));
1441 const auto frame_type = types[frame_type_id];1440 const auto frame_type = types[frame_type_id];
1442 1441
1443 pt_ref(r.dest) = r.stack.alloc_frame(frame_type)->base();1442 pt_ref(r.dest) = r.stack.alloc_frame(std::move(frame_type))->base();
1444 }1443 }
1445 1444
1446 EXEC_DECL(mframe)1445 EXEC_DECL(mframe)
@@ -1500,7 +1499,8 @@ namespace · 53 unmodified lines
1500 1499
1501 r.next_pc = vt_ref<vm_pc_t>(r.dest);1500 r.next_pc = vt_ref<vm_pc_t>(r.dest);
1502 1501
1503 disvm::debug::log_msg(debug::component_trace_t::stack, debug::log_level_t::debug, "enter: function");1502 if (disvm::debug::is_component_tracing_enabled<debug::component_trace_t::stack>())
1503 disvm::debug::log_msg(debug::component_trace_t::stack, debug::log_level_t::debug, "enter: function");
1504 }1504 }
1505 1505
1506 EXEC_DECL(mcall)1506 EXEC_DECL(mcall)