diff --git a/include/plugin_man.h b/include/plugin_man.h index c167f0b53806b762ee48ab81c7b0ffa1057f876a..0b6cef846ac4640ac22d1467202e7903f4f04b88 100644 --- a/include/plugin_man.h +++ b/include/plugin_man.h @@ -42,7 +42,7 @@ class ZiprPluginManager_t : public ZiprPluginInterface_t virtual bool DoesPluginPlop(libIRDB::Instruction_t*,DLFunctionHandle_t&); - virtual bool DoesPluginAddress(const Dollop_t *, Range_t &, DLFunctionHandle_t &); + virtual bool DoesPluginAddress(const Dollop_t *, const RangeAddress_t &, Range_t &, DLFunctionHandle_t &); private: void open_plugins diff --git a/src/plugin_man.cpp b/src/plugin_man.cpp index 7b39dae2d56f83d81219fb196052acb58f59c25a..08b4ddbdc71864a6fbbc7eb9ee6afa99857f33d1 100644 --- a/src/plugin_man.cpp +++ b/src/plugin_man.cpp @@ -81,13 +81,13 @@ void ZiprPluginManager_t::CallbackLinkingEnd() dispatch_to(CallbackLinkingEnd); } -bool ZiprPluginManager_t::DoesPluginAddress(const Dollop_t *dollop, Range_t &place, DLFunctionHandle_t &placer) +bool ZiprPluginManager_t::DoesPluginAddress(const Dollop_t *dollop, const RangeAddress_t &source, Range_t &place, DLFunctionHandle_t &placer) { DLFunctionHandleSet_t::iterator it=m_handleList.begin(); for(m_handleList.begin();it!=m_handleList.end();++it) { ZiprPluginInterface_t* zpi=(ZiprPluginInterface_t*)*it; - if (Must == zpi->AddressDollop(dollop, place)) + if (Must == zpi->AddressDollop(dollop, source, place)) { placer = zpi; return true; diff --git a/src/zipr.cpp b/src/zipr.cpp index 5a516d9cfd0d1ac93cb1d3fe27bd7f1e256bcf37..ed9bfa831eb42b871ab9dea547f852e92404d9ce 100644 --- a/src/zipr.cpp +++ b/src/zipr.cpp @@ -1325,7 +1325,7 @@ void ZiprImpl_t::WriteDollops() void ZiprImpl_t::PlaceDollops() { - list<Dollop_t*> placement_queue; + list<pair<Dollop_t*, RangeAddress_t>> placement_queue; multimap<const UnresolvedUnpinned_t,Patch_t>::const_iterator pin_it, pin_it_end; /* @@ -1344,12 +1344,14 @@ void ZiprImpl_t::PlaceDollops() target_dollop = m_dollop_mgr.GetContainingDollop(target_insn); assert(target_dollop); - placement_queue.push_back(target_dollop); + placement_queue.push_back(pair<Dollop_t*,RangeAddress_t>(target_dollop,0)); } while (!placement_queue.empty()) { + pair<Dollop_t*, RangeAddress_t> pq_entry; Dollop_t *to_place = NULL; + RangeAddress_t from_address; size_t minimum_valid_req_size = 0; Range_t placement; DLFunctionHandle_t placer = NULL; @@ -1359,9 +1361,12 @@ void ZiprImpl_t::PlaceDollops() bool has_fallthrough = false; Dollop_t *fallthrough = NULL; - to_place = placement_queue.front(); + pq_entry = placement_queue.front(); placement_queue.pop_front(); + to_place = pq_entry.first; + from_address = pq_entry.second; + if (to_place->IsPlaced()) continue; @@ -1373,6 +1378,7 @@ void ZiprImpl_t::PlaceDollops() * that want to tell us where to place this dollop. */ if (plugman.DoesPluginAddress(to_place, + from_address, placement, placer)) { @@ -1461,7 +1467,9 @@ void ZiprImpl_t::PlaceDollops() if (m_verbose) cout << "Adding " << std::hex << dollop_entry->TargetDollop() << " to placement queue." << endl; - placement_queue.push_back(dollop_entry->TargetDollop()); + placement_queue.push_back(pair<Dollop_t*, RangeAddress_t>( + dollop_entry->TargetDollop(), + cur_addr)); } } else @@ -1514,7 +1522,9 @@ void ZiprImpl_t::PlaceDollops() << fallthrough << ")." << endl; } - placement_queue.push_back(fallthrough); + placement_queue.push_back(pair<Dollop_t*, RangeAddress_t>( + fallthrough, + cur_addr)); } /*