pro64-support
[Top] [All Lists]

Re: Latent bug in cg?

To: pro64-support@xxxxxxxxxxx, Antony Bowers <Antony.Bowers@xxxxxx>
Subject: Re: Latent bug in cg?
From: mpm@xxxxxxxxxxxxxxxxx (Michael Murphy)
Date: Mon, 25 Jun 2001 14:58:54 -0700 (PDT)
Sender: owner-pro64-support@xxxxxxxxxxx
        Date: Thu, 21 Jun 2001 16:25:48 +0100 (BST)
        From: Antony Bowers <Antony.Bowers@xxxxxx>
        To: pro64-support@xxxxxxxxxxx
        Subject: Latent bug in cg?
        
        I've been exploring the source of the Pro64 code generator. File 
        be/cg/whirl2ops.cxx has the following code:
        
        Convert_WHIRL_To_OPs(WN * tree)
        {
          ...
          CGRIN *cgrin;
          ...
        
          switch ( WN_opcode( tree ) ) {
            ...
            case OPC_REGION:
            Compiling_Proper_REGION = TRUE;
            if ( RID_level( rid ) < RL_CG ) {      /* it is WHIRL */
               ...
            }
            else { /* it is OPs */
              ...
              CGRIN_entry( cgrin ) = REGION_First_BB;
              stmt = NULL;
            }
            break;
        
            ...
          }
        
          ...
        } 
        
        It looks as though the variable cgrin is being used uninitialised in the
        line
         
             CGRIN_entry( cgrin ) = REGION_First_BB;
        
        and if so, there are more uninitialised uses further down. Presumably
        this case of revisiting a region already translated to OPS never arises 
in
        practice.
        
You are right on both counts.  This is a source bug, but one that never
gets triggered.  Regions were an idea we worked on to balance the problems 
of compile speed and optimization.  The idea was that when you have 
large routines, break it into regions and optimize it a region at a time.  
There were some promising results from this, but the work was never 
completed, and has since been dropped due to a lack of resources.  
So some of the region usage that you see is never actually executed 
(however, there are some actual uses of regions still generated, 
for exception handling and mp code, but those are special cases 
that do not affect the flow of code generation).  Also, the way regions 
usually worked, you would be passing in whirl to Convert_WHIRL_To_OPS, 
and then inside that whirl there might be some region code that was 
already processed to ops, but that wouldn't be at the top-level.  

Nonetheless, thanks for the careful reading of the code and pointing
this out.  I will fix this and/or add a comment about it being obsolete.

-- Mike Murphy
-- mpm@xxxxxxx
-- quote of the day:
--  Be patient with the faults of others;
--  they have to be patient with yours.

<Prev in Thread] Current Thread [Next in Thread>