This is the mail archive of the
frysk@sourceware.org
mailing list for the frysk project.
ISA checks for factories
- From: Phil Muldoon <pmuldoon at redhat dot com>
- To: Frysk Hackers <frysk at sourceware dot org>
- Date: Wed, 03 Oct 2007 09:36:44 +0100
- Subject: ISA checks for factories
I've written several factories to decide what class to instantiate
depending on the ISA. These usually end up as hacks, probably because I
do not understand something quite right, or there is no real decent
"What ISA does this task/proc belong" discovery.
I can instance check an ISA with:
Isa isa = proc.getIsa();
if (isa instanceof IsaIA32) ....
and so on, but that will not work for 32 on 64 ISAs. For example, on a
32 bit process on a 64 bit system, the instance returned would be
LinuxIa32On64
And those cannot be instance checked as they are package private, while
the "native" ISAs are public.
So what is the solution here? Open the scope of the xxOnxx ISAs? I get
the feeling that instanceof checks tell me that we need to work on a
better solution anyway. Reverting to reflection screams hack to me.
Regards
Phil