public inbox for frysk@sourceware.org
 help / color / mirror / Atom feed
From: Phil Muldoon <pmuldoon@redhat.com>
To: Frysk Hackers <frysk@sourceware.org>
Subject: ISA checks for factories
Date: Wed, 03 Oct 2007 08:36:00 -0000	[thread overview]
Message-ID: <4703549C.30709@redhat.com> (raw)

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

             reply	other threads:[~2007-10-03  8:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-03  8:36 Phil Muldoon [this message]
2007-10-03 19:43 ` Andrew Cagney
2007-10-09  7:53   ` Phil Muldoon
2007-10-09  9:16     ` Phil Muldoon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4703549C.30709@redhat.com \
    --to=pmuldoon@redhat.com \
    --cc=frysk@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).