Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1352)

Side by Side Diff: runtime/vm/flow_graph_allocator.cc

Issue 2987323003: [VM DBC compiler and simulator] Support reified generic functions. (Closed)
Patch Set: Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/flow_graph_allocator.h" 5 #include "vm/flow_graph_allocator.h"
6 6
7 #include "vm/bit_vector.h" 7 #include "vm/bit_vector.h"
8 #include "vm/flow_graph.h" 8 #include "vm/flow_graph.h"
9 #include "vm/flow_graph_compiler.h" 9 #include "vm/flow_graph_compiler.h"
10 #include "vm/il_printer.h" 10 #include "vm/il_printer.h"
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 intptr_t pos) { 627 intptr_t pos) {
628 if (range->End() > pos) { 628 if (range->End() > pos) {
629 LiveRange* tail = range->SplitAt(pos); 629 LiveRange* tail = range->SplitAt(pos);
630 CompleteRange(tail, Location::kRegister); 630 CompleteRange(tail, Location::kRegister);
631 } 631 }
632 } 632 }
633 633
634 void FlowGraphAllocator::ProcessInitialDefinition(Definition* defn, 634 void FlowGraphAllocator::ProcessInitialDefinition(Definition* defn,
635 LiveRange* range, 635 LiveRange* range,
636 BlockEntryInstr* block) { 636 BlockEntryInstr* block) {
637 #if defined(TARGET_ARCH_DBC) 637 #if defined(TARGET_ARCH_DBC)
zra 2017/08/08 17:47:17 A pretty big portion of this function is now under
regis 2017/08/08 22:58:28 Done. It is now easier to read, but harder to main
638 if (block->IsCatchBlockEntry()) { 638 if (block->IsCatchBlockEntry()) {
639 if (defn->IsParameter()) { 639 if (defn->IsParameter()) {
640 // This must be in sync with FlowGraphCompiler::CatchEntryRegForVariable. 640 // This must be in sync with FlowGraphCompiler::CatchEntryRegForVariable.
641 ParameterInstr* param = defn->AsParameter(); 641 ParameterInstr* param = defn->AsParameter();
642 intptr_t slot_index = param->index(); 642 intptr_t slot_index = param->index();
643 AssignSafepoints(defn, range); 643 AssignSafepoints(defn, range);
644 range->finger()->Initialize(range); 644 range->finger()->Initialize(range);
645 slot_index = kNumberOfCpuRegisters - 1 - slot_index; 645 slot_index = kNumberOfCpuRegisters - 1 - slot_index;
646 range->set_assigned_location(Location::RegisterLocation(slot_index)); 646 range->set_assigned_location(Location::RegisterLocation(slot_index));
647 SplitInitialDefinitionAt(range, block->lifetime_position() + 2); 647 SplitInitialDefinitionAt(range, block->lifetime_position() + 2);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 return; 696 return;
697 } 697 }
698 #endif // defined(TARGET_ARCH_DBC) 698 #endif // defined(TARGET_ARCH_DBC)
699 range->set_assigned_location( 699 range->set_assigned_location(
700 Location::StackSlot(slot_index, param->base_reg())); 700 Location::StackSlot(slot_index, param->base_reg()));
701 range->set_spill_slot(Location::StackSlot(slot_index, param->base_reg())); 701 range->set_spill_slot(Location::StackSlot(slot_index, param->base_reg()));
702 702
703 } else if (defn->IsSpecialParameter()) { 703 } else if (defn->IsSpecialParameter()) {
704 SpecialParameterInstr* param = defn->AsSpecialParameter(); 704 SpecialParameterInstr* param = defn->AsSpecialParameter();
705 if (param->kind() == SpecialParameterInstr::kContext) { 705 if (param->kind() == SpecialParameterInstr::kContext) {
706 #if !defined(TARGET_ARCH_DBC) 706 #if defined(TARGET_ARCH_DBC)
707 intptr_t context_reg = flow_graph_.num_copied_params();
708 ASSERT(-flow_graph_.parsed_function().first_stack_local_index() - 1 ==
709 context_reg);
710 if (flow_graph_.parsed_function().function_type_arguments() != NULL) {
711 // The first slot is used for function type arguments, either as their
712 // permanent location or as their temporary location when captured.
713 // So use the next one for the context.
714 context_reg++;
715 }
716 #else
707 const Register context_reg = CTX; 717 const Register context_reg = CTX;
708 #else 718 #endif // defined(TARGET_ARCH_DBC)
709 const intptr_t context_reg = flow_graph_.num_copied_params();
710 #endif
711 719
712 AssignSafepoints(defn, range); 720 AssignSafepoints(defn, range);
713 range->finger()->Initialize(range); 721 range->finger()->Initialize(range);
714 range->set_assigned_location(Location::RegisterLocation(context_reg)); 722 range->set_assigned_location(Location::RegisterLocation(context_reg));
715 if (range->End() > kNormalEntryPos) { 723 if (range->End() > kNormalEntryPos) {
Vyacheslav Egorov (Google) 2017/08/08 17:44:42 I think you need this code (lines 723 - line 728)
regis 2017/08/08 22:58:28 Done. Awesome! That did it! Thanks.
716 LiveRange* tail = range->SplitAt(kNormalEntryPos); 724 LiveRange* tail = range->SplitAt(kNormalEntryPos);
717 CompleteRange(tail, Location::kRegister); 725 CompleteRange(tail, Location::kRegister);
718 } 726 }
719 ConvertAllUses(range); 727 ConvertAllUses(range);
720 return; 728 return;
721 } 729 }
722 ASSERT(param->kind() == SpecialParameterInstr::kTypeArgs); 730 ASSERT(param->kind() == SpecialParameterInstr::kTypeArgs);
723 #if defined(TARGET_ARCH_DBC) 731 #if defined(TARGET_ARCH_DBC)
724 UNIMPLEMENTED(); 732 const intptr_t slot_index = flow_graph_.num_copied_params();
725 #endif 733 ASSERT(-flow_graph_.parsed_function().first_stack_local_index() - 1 ==
734 slot_index);
735 range->set_assigned_location(Location::RegisterLocation(slot_index));
736 #else
726 const intptr_t slot_index = flow_graph_.num_copied_params(); 737 const intptr_t slot_index = flow_graph_.num_copied_params();
727 range->set_assigned_location(Location::StackSlot(slot_index, FPREG)); 738 range->set_assigned_location(Location::StackSlot(slot_index, FPREG));
728 range->set_spill_slot(Location::StackSlot(slot_index, FPREG)); 739 range->set_spill_slot(Location::StackSlot(slot_index, FPREG));
740 #endif // defined(TARGET_ARCH_DBC)
729 } else { 741 } else {
730 ConstantInstr* constant = defn->AsConstant(); 742 ConstantInstr* constant = defn->AsConstant();
731 ASSERT(constant != NULL); 743 ASSERT(constant != NULL);
732 range->set_assigned_location(Location::Constant(constant)); 744 range->set_assigned_location(Location::Constant(constant));
733 range->set_spill_slot(Location::Constant(constant)); 745 range->set_spill_slot(Location::Constant(constant));
734 } 746 }
735 AssignSafepoints(defn, range); 747 AssignSafepoints(defn, range);
736 range->finger()->Initialize(range); 748 range->finger()->Initialize(range);
737 UsePosition* use = 749 UsePosition* use =
738 range->finger()->FirstRegisterBeneficialUse(block->start_pos()); 750 range->finger()->FirstRegisterBeneficialUse(block->start_pos());
(...skipping 2270 matching lines...) Expand 10 before | Expand all | Expand 10 after
3009 #ifndef PRODUCT 3021 #ifndef PRODUCT
3010 FlowGraphPrinter printer(flow_graph_, true); 3022 FlowGraphPrinter printer(flow_graph_, true);
3011 printer.PrintBlocks(); 3023 printer.PrintBlocks();
3012 #endif 3024 #endif
3013 } 3025 }
3014 THR_Print("----------------------------------------------\n"); 3026 THR_Print("----------------------------------------------\n");
3015 } 3027 }
3016 } 3028 }
3017 3029
3018 } // namespace dart 3030 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698