-
Notifications
You must be signed in to change notification settings - Fork 2.3k
DRAFT: Removing emu_options reference from machine_config
#14639
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
DRAFT: Removing emu_options reference from machine_config
#14639
Conversation
This change is intended to be a (as the circumstances allow) minimal change required to decouple `emu_options` from `machine_config`, and doesn't address the broader Sisyphean issues of how software list handling is coupled with device loading. For this reason, there is some grossness done in the name of "doing no harm", but this does succeed in decoupling `machine_config` and `emu_options` * Because `software_list_device` no longer has access to an `emu_options`, it can no longer parse software lists on demand, and the various call sites that can exercise this code path now have to ensure that software lists are parsed. * `software_get_default_slot()` now needs the image name from options to be passed. This was a somewhat intrusive name because some additional grossness needed to be added to `get_default_card_software_hook` A proximate benefit is now that when `-listxml` is invoked, we don't have to feed `machine_config` an `emu_options`, and the resulting configuration is created without any slots specified. This removes some of the extraneous `-listxml` items associated with the default configuration. This change has a known issue that should block merging. A number of communications devices (e.g. - `m3comm_device`) were grabbing `emu_options` in their constructors to build hostnames. While it would be straight forward to change these to be lazy loaded, we probably should identify a better way for this pattern to be implemented.
|
Some first impressions here: Passing I think a less bad solution for the The comms devices (whose rewrites by @SailorSat are stuck in PR limbo) probably shouldn't need to build the socket filenames until |
Yeah I don't like that either. I think the bigger problem is that
This occurred to me as well. This felt like the sort of thing that could easily be done once there was alignment on how to address the "
Yeah that's "less bad" than the status quo, but I suppose I was hoping (perhaps naively) we could do better.
I have not seen these? Do they make the current problem (trying to access Then again, it is probably very easy to move the current code from the constructor to |
#13421 covers mb89374, m1comm, m2comm and s32comm, but not m3comm. |
… `-listxml` can complete
|
I don't think this is well-thought-out. Changing behaviour so that "creating a machine configuration with no options is not the same as with default options" violates the principle of least surprise. This is bad engineering. Even if you want to move the options from the machine configuration to the machine, doing something different with no options versus all defaults is just making it harder to understand. We don't need more pitfalls. We already have a whole lot of "you can't do X before Y" situations that trip people up, e.g. people regularly run into "you can't read inputs during the start phase" when it comes to configuration switches. Gratuitously adding another one (can't access options before machine is set) just makes development more difficult. It's also a part of session setup that most people aren't even thinking about – most developers are at least aware of the basic config/start/reset lifecycle phases due to the device member function calls. It means anything that needs to be done differently depending on an option has to be deferred until after building the device tree entirely. I can see this being a problem for CPUs that want to do things differently if recompiling is disabled, for example. Software lists needing another step to be told to parse themselves is just more complication for the front-end/UI code. |
|
On top of that, I think your goal of emptying all slots for First of all, it’s going to be a problem for “dumb” front-ends that don’t walk slot options. If slots are empty, then systems that get their display, audio output and storage (floppy drives, etc.) from cards, like the original IBM PC for example, will appear to have no video, audio or media options in the Secondly, the If slots were all empty, a simple lookup wouldn’t give much at all for something like a floppy drive device that’s always instantiated as a “slot card” on a “floppy connector” slot. You’d need to recursively check whether each device is a default slot card option anywhere, look up devices/systems that reference it, etc. while guarding against getting into an infinite loop. It would greatly complicate the logic, as well as requiring far more queries, and requiring O(n) storage. (And all that aside, if skipping things in slots for |
…ptions` Vas (with good reason) identified it as an oddity, but this forces there to be a weird `complete()` method. Expect conversation on the PR.
I'll buy this, and this touches on something that @ajrhacker said ("Attaching slot devices to I tried rectifying this by getting rid of the I'm not sure what we should really be doing here - maybe we should make the constructor private and instead have static methods? I'm open for ideas on better ways to solve this (@ajrhacker)?
Agreed. I'm going to see what needs to be happen to extract functionality related to live software list management out of the current device classes. Perhaps this should be called
I can be persuaded by this, but at the very least I think that it is clear the lack of a simple way to identify
I find this statement very surprising, as it seems that the existence of an All that said, if you feel very strongly that it would be better to have some checks to see whether something is from a slot config and emit |
|
@cuavas makes a good point about XML listings needing to reflect the default options to accurately demonstrate the system's capabilities for frontends that don't recurse on
The solution I thought of was having the with-options constructor call
I have no confidence in the viability of separating software list management from device classes. The device hierarchy provides modularity, and trying to bypass it will create even more problems.
I believe that the validity checker doesn't even really need to install the default slot options, since it tries to validate every slot option available (within reason). |
Just adding tags to them would allow separating the ones that come from slot “cards” on the consuming side, in the same way that you can for the The |
|
@cuavas 's idea of adding My question for this audience - the impetus for this PR is addressed by the addition of |
This change is intended to be a (as the circumstances allow) minimal change required to decouple
emu_optionsfrommachine_config, and doesn't address the broader Sisyphean issues of how software list handling is coupled with device loading. For this reason, there is some grossness done in the name of "doing no harm", but this does succeed in decouplingmachine_configandemu_optionssoftware_list_deviceno longer has access to anemu_options, it can no longer parse software lists on demand, and the various call sites that can exercise this code path now have to ensure that software lists are parsed.software_get_default_slot()now needs the image name from options to be passed. This was a somewhat intrusive name because some additional grossness needed to be added toget_default_card_software_hookA proximate benefit is now that when
-listxmlis invoked, we don't have to feedmachine_configanemu_options, and the resulting configuration is created without any slots specified. This removes some of the extraneous-listxmlitems associated with the default configuration.This change has a known issue that should block merging. A number of communications devices (e.g. -
m3comm_device) were grabbingemu_optionsin their constructors to build hostnames. While it would be straight forward to change these to be lazy loaded, we probably should identify a better way for this pattern to be implemented.