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/execution_table.cpp (1 of 9 files). Show all

Unified · Split

src/vm/execution_table.cpp+23−23
@@ -152,7 +152,7 @@ namespace · 151 unmodified lines
152 152
153 auto str = at_val<vm_string_t>(r.src);153 auto str = at_val<vm_string_t>(r.src);
154 auto new_array = new vm_array_t(str);154 auto new_array = new vm_array_t(str);
155 pt_ref(r.dest) = new_array->allocation();155 pt_ref(r.dest) = new_array->get_allocation();
156 }156 }
157 157
158 EXEC_DECL(cvtac)158 EXEC_DECL(cvtac)
@@ -167,7 +167,7 @@ namespace · 8 unmodified lines
167 throw vm_user_exception{ "Invalid array element type for string conversion" };167 throw vm_user_exception{ "Invalid array element type for string conversion" };
168 168
169 auto new_string = new vm_string_t(arr->get_length(), reinterpret_cast<uint8_t *>(arr->at(0)));169 auto new_string = new vm_string_t(arr->get_length(), reinterpret_cast<uint8_t *>(arr->at(0)));
170 str = new_string->allocation();170 str = new_string->get_allocation();
171 }171 }
172 172
173 pt_ref(r.dest) = str;173 pt_ref(r.dest) = str;
@@ -196,7 +196,7 @@ namespace · 22 unmodified lines
196 auto str = at_val<vm_string_t>(r.dest);196 auto str = at_val<vm_string_t>(r.dest);
197 dec_ref_count_and_free(str);197 dec_ref_count_and_free(str);
198 198
199 pt_ref(r.dest) = new_string->allocation();199 pt_ref(r.dest) = new_string->get_allocation();
200 }200 }
201 201
202 EXEC_DECL(cvtcf)202 EXEC_DECL(cvtcf)
@@ -221,7 +221,7 @@ namespace · 18 unmodified lines
221 auto new_string = new vm_string_t(len, reinterpret_cast<uint8_t *>(buffer.data()));221 auto new_string = new vm_string_t(len, reinterpret_cast<uint8_t *>(buffer.data()));
222 222
223 auto str = at_val<vm_string_t>(r.dest);223 auto str = at_val<vm_string_t>(r.dest);
224 pt_ref(r.dest) = new_string->allocation();224 pt_ref(r.dest) = new_string->get_allocation();
225 dec_ref_count_and_free(str);225 dec_ref_count_and_free(str);
226 }226 }
227 227
@@ -247,7 +247,7 @@ namespace · 19 unmodified lines
247 auto new_string = new vm_string_t(len, reinterpret_cast<uint8_t *>(buffer.data()));247 auto new_string = new vm_string_t(len, reinterpret_cast<uint8_t *>(buffer.data()));
248 248
249 auto str = at_val<vm_string_t>(r.dest);249 auto str = at_val<vm_string_t>(r.dest);
250 pt_ref(r.dest) = new_string->allocation();250 pt_ref(r.dest) = new_string->get_allocation();
251 dec_ref_count_and_free(str);251 dec_ref_count_and_free(str);
252 }252 }
253 253
@@ -399,7 +399,7 @@ namespace · 145 unmodified lines
399 if (alloc != nullptr)399 if (alloc != nullptr)
400 {400 {
401 alloc->add_ref();401 alloc->add_ref();
402 pt_ref(dest) = alloc->allocation();402 pt_ref(dest) = alloc->get_allocation();
403 }403 }
404 else404 else
405 {405 {
@@ -626,7 +626,7 @@ namespace · 220 unmodified lines
626 auto old_str = at_val<vm_string_t>(r.dest);626 auto old_str = at_val<vm_string_t>(r.dest);
627 if (str != old_str)627 if (str != old_str)
628 {628 {
629 pt_ref(r.dest) = str->allocation();629 pt_ref(r.dest) = str->get_allocation();
630 dec_ref_count_and_free(old_str);630 dec_ref_count_and_free(old_str);
631 }631 }
632 }632 }
@@ -678,7 +678,7 @@ namespace · 45 unmodified lines
678 678
679 if (!append_to_source)679 if (!append_to_source)
680 {680 {
681 pt_ref(r.dest) = str->allocation();681 pt_ref(r.dest) = str->get_allocation();
682 dec_ref_count_and_free(dest_maybe);682 dec_ref_count_and_free(dest_maybe);
683 }683 }
684 }684 }
@@ -692,7 +692,7 @@ namespace · 7 unmodified lines
692 if (str != nullptr)692 if (str != nullptr)
693 {693 {
694 auto new_string = new vm_string_t(*str, start, end);694 auto new_string = new vm_string_t(*str, start, end);
695 pt_ref(r.dest) = new_string->allocation();695 pt_ref(r.dest) = new_string->get_allocation();
696 }696 }
697 else if (start == 0 && end == 0)697 else if (start == 0 && end == 0)
698 {698 {
@@ -744,7 +744,7 @@ namespace · 45 unmodified lines
744 if (arr->alloc_type->map_in_bytes > 0)744 if (arr->alloc_type->map_in_bytes > 0)
745 vm.get_garbage_collector().track_allocation(new_array);745 vm.get_garbage_collector().track_allocation(new_array);
746 746
747 pt_ref(r.dest) = new_array->allocation();747 pt_ref(r.dest) = new_array->get_allocation();
748 }748 }
749 749
750 EXEC_DECL(slicela)750 EXEC_DECL(slicela)
@@ -810,7 +810,7 @@ namespace · 59 unmodified lines
810 auto value = vt_ref<PrimitiveType>(r.src);810 auto value = vt_ref<PrimitiveType>(r.src);
811 vt_ref<PrimitiveType>(new_list->value()) = value;811 vt_ref<PrimitiveType>(new_list->value()) = value;
812 812
813 pt_ref(r.dest) = new_list->allocation();813 pt_ref(r.dest) = new_list->get_allocation();
814 }814 }
815 815
816 EXEC_DECL(consb) { _cons<byte_t>(r); }816 EXEC_DECL(consb) { _cons<byte_t>(r); }
@@ -830,7 +830,7 @@ namespace · 13 unmodified lines
830 if (alloc != nullptr)830 if (alloc != nullptr)
831 {831 {
832 alloc->add_ref(); 832 alloc->add_ref();
833 pt_ref(new_list->value()) = alloc->allocation();833 pt_ref(new_list->value()) = alloc->get_allocation();
834 834
835 vm.get_garbage_collector().track_allocation(new_list);835 vm.get_garbage_collector().track_allocation(new_list);
836 }836 }
@@ -840,7 +840,7 @@ namespace · 3 unmodified lines
840 }840 }
841 841
842 // Return the list842 // Return the list
843 pt_ref(r.dest) = new_list->allocation();843 pt_ref(r.dest) = new_list->get_allocation();
844 }844 }
845 845
846 EXEC_DECL(consmp)846 EXEC_DECL(consmp)
@@ -866,7 +866,7 @@ namespace · 19 unmodified lines
866 vm.get_garbage_collector().track_allocation(new_list);866 vm.get_garbage_collector().track_allocation(new_list);
867 867
868 // Return the list868 // Return the list
869 pt_ref(r.dest) = new_list->allocation();869 pt_ref(r.dest) = new_list->get_allocation();
870 }870 }
871 871
872 template<typename PrimitiveType>872 template<typename PrimitiveType>
@@ -917,7 +917,7 @@ namespace · 44 unmodified lines
917 917
918 auto tail_maybe = list->get_tail();918 auto tail_maybe = list->get_tail();
919 if (tail_maybe != nullptr)919 if (tail_maybe != nullptr)
920 tail = tail_maybe->allocation();920 tail = tail_maybe->get_allocation();
921 921
922 // Use the address of the local variable.922 // Use the address of the local variable.
923 r.src = reinterpret_cast<pointer_t>(&tail);923 r.src = reinterpret_cast<pointer_t>(&tail);
@@ -973,7 +973,7 @@ namespace · 49 unmodified lines
973 if (type_desc->map_in_bytes > 0)973 if (type_desc->map_in_bytes > 0)
974 vm.get_garbage_collector().track_allocation(new_channel);974 vm.get_garbage_collector().track_allocation(new_channel);
975 975
976 pt_ref(r.dest) = new_channel->allocation();976 pt_ref(r.dest) = new_channel->get_allocation();
977 }977 }
978 }978 }
979 979
@@ -1061,7 +1061,7 @@ namespace · 81 unmodified lines
1061 1061
1062 word_t cancel_outstanding_channel_requests(uint32_t request_thread_id, vm_alt_stack_layout_t *alt, const vm_channel_t &handled_channel)1062 word_t cancel_outstanding_channel_requests(uint32_t request_thread_id, vm_alt_stack_layout_t *alt, const vm_channel_t &handled_channel)
1063 {1063 {
1064 auto alloc = handled_channel.allocation();1064 auto alloc = handled_channel.get_allocation();
1065 1065
1066 auto handled_index = word_t{ -1 };1066 auto handled_index = word_t{ -1 };
1067 const auto channel_count = (alt->send_count + alt->receive_count);1067 const auto channel_count = (alt->send_count + alt->receive_count);
@@ -1216,7 +1216,7 @@ namespace · 148 unmodified lines
1216 if (type_desc->map_in_bytes > 0)1216 if (type_desc->map_in_bytes > 0)
1217 vm.get_garbage_collector().track_allocation(new_alloc);1217 vm.get_garbage_collector().track_allocation(new_alloc);
1218 1218
1219 pt_ref(r.dest) = new_alloc->allocation();1219 pt_ref(r.dest) = new_alloc->get_allocation();
1220 }1220 }
1221 }1221 }
1222 1222
@@ -1248,7 +1248,7 @@ namespace · 25 unmodified lines
1248 if (type_desc->map_in_bytes > 0)1248 if (type_desc->map_in_bytes > 0)
1249 vm.get_garbage_collector().track_allocation(new_alloc);1249 vm.get_garbage_collector().track_allocation(new_alloc);
1250 1250
1251 pt_ref(r.dest) = new_alloc->allocation();1251 pt_ref(r.dest) = new_alloc->get_allocation();
1252 }1252 }
1253 1253
1254 namespace1254 namespace
@@ -1270,7 +1270,7 @@ namespace · 15 unmodified lines
1270 if (type_desc->map_in_bytes > 0)1270 if (type_desc->map_in_bytes > 0)
1271 vm.get_garbage_collector().track_allocation(new_array);1271 vm.get_garbage_collector().track_allocation(new_array);
1272 1272
1273 pt_ref(r.dest) = new_array->allocation();1273 pt_ref(r.dest) = new_array->get_allocation();
1274 }1274 }
1275 }1275 }
1276 1276
@@ -1535,7 +1535,7 @@ namespace · 258 unmodified lines
1535 // The first pointer in the exception is a string type1535 // The first pointer in the exception is a string type
1536 // that is used to uniquely identify the exception type.1536 // that is used to uniquely identify the exception type.
1537 // The remainder of the type is user-defined.1537 // The remainder of the type is user-defined.
1538 auto content = e->allocation();1538 auto content = e->get_allocation();
1539 exception_id = at_val<vm_string_t>(content);1539 exception_id = at_val<vm_string_t>(content);
1540 1540
1541 if (debug::is_component_tracing_enabled<debug::component_trace_t::exception>())1541 if (debug::is_component_tracing_enabled<debug::component_trace_t::exception>())
@@ -1580,7 +1580,7 @@ namespace · 38 unmodified lines
1580 dec_ref_count_and_free(current_value);1580 dec_ref_count_and_free(current_value);
1581 1581
1582 // Set the exception destination.1582 // Set the exception destination.
1583 pt_ref(exception_destination) = e->allocation();1583 pt_ref(exception_destination) = e->get_allocation();
1584 1584
1585 r.pc = handler_pc;1585 r.pc = handler_pc;
1586 }1586 }
@@ -1630,7 +1630,7 @@ namespace · 43 unmodified lines
1630 const auto &function_imports = imports[module_import_index];1630 const auto &function_imports = imports[module_import_index];
1631 1631
1632 auto entry_module_ref = new vm_module_ref_t{ imported_module, function_imports };1632 auto entry_module_ref = new vm_module_ref_t{ imported_module, function_imports };
1633 pt_ref(r.dest) = entry_module_ref->allocation();1633 pt_ref(r.dest) = entry_module_ref->get_allocation();
1634 }1634 }
1635}1635}
1636 1636