From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 842 invoked by alias); 3 Oct 2007 08:36:52 -0000 Received: (qmail 835 invoked by uid 22791); 3 Oct 2007 08:36:52 -0000 X-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL,BAYES_05,DK_POLICY_SIGNSOME,FORGED_RCVD_HELO,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 03 Oct 2007 08:36:48 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.13.8/8.13.1) with ESMTP id l938akaq015017 for ; Wed, 3 Oct 2007 04:36:46 -0400 Received: from pobox-2.corp.redhat.com (pobox-2.corp.redhat.com [10.11.255.15]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id l938ak3V014744 for ; Wed, 3 Oct 2007 04:36:46 -0400 Received: from localhost.localdomain (vpn-6-18.fab.redhat.com [10.33.6.18]) by pobox-2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id l938ajES032162 for ; Wed, 3 Oct 2007 04:36:45 -0400 Message-ID: <4703549C.30709@redhat.com> Date: Wed, 03 Oct 2007 08:36:00 -0000 From: Phil Muldoon User-Agent: Thunderbird 2.0.0.5 (X11/20070727) MIME-Version: 1.0 To: Frysk Hackers Subject: ISA checks for factories Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact frysk-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: frysk-owner@sourceware.org X-SW-Source: 2007-q4/txt/msg00013.txt.bz2 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