# Re: Optimization Question

## Gunnar Braun <gunnar@moria.net.dhis.org>30 Jul 2000 08:44:12 -0400

From comp.compilers

Related articles
Optimization Question braung@ert.rwth-aachen.de (Gunnar Braun) (2000-07-27)
Re: Optimization Question gunnar@moria.net.dhis.org (Gunnar Braun) (2000-07-30)
Re: Optimization Question rkrayhawk@aol.com (2000-07-31)
Re: Optimization Question chase@naturalbridge.com (David Chase) (2000-08-04)
| List of all articles for this month |

 From: Gunnar Braun Newsgroups: comp.compilers Date: 30 Jul 2000 08:44:12 -0400 Organization: Aachen University of Technology (RWTH) References: Keywords: architecture, optimize

Hi Peter,

pStage is a two dimensional array, with the integer indicies StageNr
(from 0 to 5) and i (from 0 to maximum 8). Each array element is a
struct consisting of a pointer to another table (pInsnTableLine) and a
function pointer to member function of the class the function
with the loop belongs to, too.

On Sun, 30 Jul 2000 Peter-Lawrence.Montgomery@cwi.nl wrote:

> You seem to be referring to the loop:
>
> > for (StageNr = 5; StageNr >= 0; StageNr--)
> > {
> > i = 0;
> > while (m_pStaticTable[m_TableNr][m_CurrentLine].pStage[StageNr][i].OpFuncPtr)
> > {
> > itab = m_pStaticTable[m_TableNr][m_CurrentLine].pStage[StageNr][i].pInsnTableLine;
> > (this->*m_pStaticTable[m_TableNr][m_CurrentLine].pStage[StageNr][i++].OpFuncPtr)(itab);
> > }
> > }
>
> (whereas StageNr is local). Set up a pointer to
> m_pStaticTable[m_TableNr][m_CurrentLine] before the StageNr loop.
> If pStage is an array of pointers (rather than a two-dimensional array),
> set up another pointer to (first pointer)->pStage[StageNr]
> at the spot where you initialize i = 0.

The problem is, that the compiler does not allow to call the function
that belongs to OpFuncPtr, if I set up a pointer
m_pStaticTable[m_TableNr][m_CurrentLine] or
(firstpointer)->pStage[StageNr]
The compiler detects that the pointer refers to a member function of the
class and tells me, that I have to call the function via the this
pointer. It might be possible if I define the help variable for the
pointers as member variables, too. I'll try that in a minute.

> If each pStage[StageNr] is a pointer to a variably-sized
> region (length possibly dependent on how high i should go), try to
> organize memory so the regions for different StageNr values are nearby,

pStage[StageNr] is a fixed sized region to always 8 entries. Therefore
I guess the entries are lying one by another in memory.

Thanks for the help,

Gunnar
--
** EMail: Gunnar Braun <gunnar.braun@post.rwth-aachen.de> **
** Homepage: http://www-users.rwth-aachen.de/gunnar.braun/index.html **
** PGP encrypted messages welcome - key via homepage or pgp-net **
** Fingerprint: 19 43 D7 FF 3A 42 D7 E9 D9 4C 49 30 DC CD 75 EE **

Post a followup to this message