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
509509 {
510510 auto alloc_prev = at_val<vm_alloc_t>(dest);
511511 auto alloc = at_val<vm_alloc_t>(src);
512+ pointer_t to_move = nullptr;
512513 if (alloc != nullptr)
513514 {
514515 alloc->add_ref();
515− pt_ref(dest) = alloc->get_allocation();
516− }
517− else
518− {
519− pt_ref(dest) = nullptr;
516+ to_move = alloc->get_allocation();
520517 }
521518
519+ pt_ref(dest) = to_move;
522520 dec_ref_count_and_free(alloc_prev);
523521 }
524522
@@ -531,7 +529,6 @@ namespace · 6 unmodified lines
531529 EXEC_DECL(movm)
532530 {
533531 assert(r.src != nullptr && r.dest != nullptr);
534−
535532 std::memmove(r.dest, r.src, vt_ref<word_t>(r.mid));
536533 }
537534
@@ -1087,9 +1084,11 @@ namespace · 549 unmodified lines
10871084 }
10881085
10891086 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 };
10911087
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)
10931092 vm.get_garbage_collector().track_allocation(new_channel);
10941093
10951094 pt_ref(r.dest) = new_channel->get_allocation();
@@ -1107,7 +1106,7 @@ namespace · 11 unmodified lines
11071106 auto memory_size = vt_ref<word_t>(r.src);
11081107 auto channel_data_type = type_descriptor_t::create(memory_size);
11091108
1110− _newc_(r, vm, channel_data_type, _channel_movm);
1109+ _newc_(r, vm, std::move(channel_data_type), _channel_movm);
11111110 }
11121111
11131112 EXEC_DECL(newcmp)
@@ -1117,7 +1116,7 @@ namespace · 3 unmodified lines
11171116 assert(0 <= type_id && type_id < static_cast<word_t>(types.size()));
11181117 auto type = types[type_id];
11191118
1120− _newc_(r, vm, type, _channel_movmp);
1119+ _newc_(r, vm, std::move(type), _channel_movmp);
11211120 }
11221121
11231122 EXEC_DECL(send)
@@ -1440,7 +1439,7 @@ namespace · 316 unmodified lines
14401439 assert(0 <= frame_type_id && frame_type_id < static_cast<word_t>(types.size()));
14411440 const auto frame_type = types[frame_type_id];
14421441
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();
14441443 }
14451444
14461445 EXEC_DECL(mframe)
@@ -1500,7 +1499,8 @@ namespace · 53 unmodified lines
15001499
15011500 r.next_pc = vt_ref<vm_pc_t>(r.dest);
15021501
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");
15041504 }
15051505
15061506 EXEC_DECL(mcall)