mirror of
https://github.com/TomHarte/CLK.git
synced 2024-10-04 17:56:29 +00:00
Reintroduces use of locations_by_bus_step_ to decrease 68000 construction time.
This commit is contained in:
parent
624b0b6372
commit
79d8d27b4c
@ -365,22 +365,21 @@ struct ProcessorStorageConstructor {
|
|||||||
|
|
||||||
// If the new steps already exist, just return the existing index to them;
|
// If the new steps already exist, just return the existing index to them;
|
||||||
// otherwise insert them.
|
// otherwise insert them.
|
||||||
const auto position = std::search(storage_.all_bus_steps_.begin(), storage_.all_bus_steps_.end(), steps.begin(), steps.end());
|
/*const auto position = std::search(storage_.all_bus_steps_.begin(), storage_.all_bus_steps_.end(), steps.begin(), steps.end());
|
||||||
if(position != storage_.all_bus_steps_.end()) {
|
if(position != storage_.all_bus_steps_.end()) {
|
||||||
return size_t(position - storage_.all_bus_steps_.begin());
|
return size_t(position - storage_.all_bus_steps_.begin());
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto start = storage_.all_bus_steps_.size();
|
const auto start = storage_.all_bus_steps_.size();
|
||||||
std::copy(steps.begin(), steps.end(), std::back_inserter(storage_.all_bus_steps_));
|
std::copy(steps.begin(), steps.end(), std::back_inserter(storage_.all_bus_steps_));
|
||||||
return start;
|
return start;*/
|
||||||
|
|
||||||
/*
|
|
||||||
// If the new steps already exist, just return the existing index to them;
|
// If the new steps already exist, just return the existing index to them;
|
||||||
// otherwise insert them. A lookup table of steps to start positions within
|
// otherwise insert them. A lookup table of steps to start positions within
|
||||||
// all_bus_steps_ is maintained to shorten setup time here
|
// all_bus_steps_ is maintained to shorten setup time here
|
||||||
auto potential_locations = locations_by_bus_step_[steps.front()];
|
auto potential_locations = locations_by_bus_step_[steps.front()];
|
||||||
for(auto index: potential_locations) {
|
for(auto index: potential_locations) {
|
||||||
if(index + steps.size() >= storage_.all_bus_steps_.size()) continue;
|
if(index + steps.size() > storage_.all_bus_steps_.size()) continue;
|
||||||
|
|
||||||
if(std::equal(
|
if(std::equal(
|
||||||
storage_.all_bus_steps_.begin() + ssize_t(index),
|
storage_.all_bus_steps_.begin() + ssize_t(index),
|
||||||
@ -399,7 +398,7 @@ struct ProcessorStorageConstructor {
|
|||||||
++index;
|
++index;
|
||||||
}
|
}
|
||||||
|
|
||||||
return start;*/
|
return start;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -3066,7 +3065,7 @@ struct ProcessorStorageConstructor {
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* struct BusStepOrderer {
|
struct BusStepOrderer {
|
||||||
bool operator()( BusStep const& lhs, BusStep const& rhs ) const {
|
bool operator()( BusStep const& lhs, BusStep const& rhs ) const {
|
||||||
int action_diff = int(lhs.action) - int(rhs.action);
|
int action_diff = int(lhs.action) - int(rhs.action);
|
||||||
if(action_diff < 0) {
|
if(action_diff < 0) {
|
||||||
@ -3081,7 +3080,7 @@ struct ProcessorStorageConstructor {
|
|||||||
std::make_tuple(rhs.microcycle.value, rhs.microcycle.address, rhs.microcycle.length, rhs.microcycle.operation);
|
std::make_tuple(rhs.microcycle.value, rhs.microcycle.address, rhs.microcycle.length, rhs.microcycle.operation);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
std::map<BusStep, std::vector<size_t>, BusStepOrderer> locations_by_bus_step_;*/
|
std::map<BusStep, std::vector<size_t>, BusStepOrderer> locations_by_bus_step_;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -3143,13 +3142,13 @@ CPU::MC68000::ProcessorStorage::ProcessorStorage() {
|
|||||||
all_micro_ops_.emplace_back();
|
all_micro_ops_.emplace_back();
|
||||||
|
|
||||||
// Install operations.
|
// Install operations.
|
||||||
#ifndef NDEBUG
|
//#ifndef NDEBUG
|
||||||
const std::clock_t start = std::clock();
|
const std::clock_t start = std::clock();
|
||||||
#endif
|
//#endif
|
||||||
constructor.install_instructions();
|
constructor.install_instructions();
|
||||||
#ifndef NDEBUG
|
//#ifndef NDEBUG
|
||||||
std::cout << "Construction took " << double(std::clock() - start) / double(CLOCKS_PER_SEC / 1000) << "ms" << std::endl;
|
std::cout << "Construction took " << double(std::clock() - start) / double(CLOCKS_PER_SEC / 1000) << "ms" << std::endl;
|
||||||
#endif
|
//#endif
|
||||||
|
|
||||||
// Realise the special programs as direct pointers.
|
// Realise the special programs as direct pointers.
|
||||||
reset_bus_steps_ = &all_bus_steps_[reset_offset];
|
reset_bus_steps_ = &all_bus_steps_[reset_offset];
|
||||||
|
Loading…
Reference in New Issue
Block a user