diff --git a/src/QuestScript.cc b/src/QuestScript.cc index 28664207..095d4d46 100644 --- a/src/QuestScript.cc +++ b/src/QuestScript.cc @@ -1871,18 +1871,14 @@ struct RegisterAssigner { void assign_all() { // TODO: Technically, we should assign the biggest blocks first to minimize // fragmentation. I am lazy and haven't implemented this yet. - unordered_set> unassigned; + vector> unassigned; for (auto it : this->named_regs) { if (it.second->number < 0) { - unassigned.emplace(it.second); + unassigned.emplace_back(it.second); } } - while (!unassigned.empty()) { - auto reg_it = unassigned.begin(); - auto reg = *reg_it; - unassigned.erase(reg_it); - + for (auto reg : unassigned) { // If this register is already assigned, skip it if (reg->number >= 0) { continue; @@ -1951,7 +1947,7 @@ struct RegisterAssigner { throw runtime_error("not enough space to assign registers"); } - unordered_map> named_regs; + map> named_regs; array, 0x100> numbered_regs; }; @@ -2030,7 +2026,7 @@ std::string assemble_quest_script(const std::string& text) { ssize_t index = -1; ssize_t offset = -1; }; - unordered_map> labels_by_name; + map> labels_by_name; map> labels_by_index; for (size_t line_num = 1; line_num <= lines.size(); line_num++) { const auto& line = lines[line_num - 1]; diff --git a/tests/q058-gc-e.bin b/tests/q058-gc-e.bin index a9a2bb96..6b8b3480 100755 Binary files a/tests/q058-gc-e.bin and b/tests/q058-gc-e.bin differ