2010-07-07 18:13 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* src/compiler/ppcomp.c
* src/compiler/hbmain.c
* src/compiler/hbpcode.c
* src/compiler/hbdead.c
* src/compiler/gencc.c
* src/compiler/hblbl.c
* include/hbcompdf.h
* lPCodeSize -> nPCodeSize
* pulLabels -> pnLabels
(objects verified)
This commit is contained in:
@@ -16,6 +16,18 @@
|
||||
The license applies to all entries newer than 2009-04-28.
|
||||
*/
|
||||
|
||||
2010-07-07 18:13 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
|
||||
* src/compiler/ppcomp.c
|
||||
* src/compiler/hbmain.c
|
||||
* src/compiler/hbpcode.c
|
||||
* src/compiler/hbdead.c
|
||||
* src/compiler/gencc.c
|
||||
* src/compiler/hblbl.c
|
||||
* include/hbcompdf.h
|
||||
* lPCodeSize -> nPCodeSize
|
||||
* pulLabels -> pnLabels
|
||||
(objects verified)
|
||||
|
||||
2010-07-07 18:08 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
|
||||
* src/compiler/hbmain.c
|
||||
* src/compiler/hbfix.c
|
||||
|
||||
@@ -506,7 +506,7 @@ typedef struct __FUNC
|
||||
PVAR pDetached; /* pointer to detached local variables list */
|
||||
PVAR pPrivates; /* pointer to private variables list */
|
||||
HB_BYTE * pCode; /* pointer to a memory block where pcode is stored */
|
||||
HB_SIZE lPCodeSize; /* total memory size for pcode */
|
||||
HB_SIZE nPCodeSize; /* total memory size for pcode */
|
||||
HB_SIZE nPCodePos; /* actual pcode offset */
|
||||
int iStaticsBase; /* base for this function statics */
|
||||
int iFuncSuffix; /* function suffix for multiple static functions with the same name */
|
||||
@@ -540,7 +540,7 @@ typedef struct __INLINE
|
||||
{
|
||||
const char * szName; /* name of a inline function */
|
||||
HB_BYTE * pCode; /* pointer to a memory block where pcode is stored */
|
||||
HB_SIZE lPCodeSize; /* total memory size for pcode */
|
||||
HB_SIZE nPCodeSize; /* total memory size for pcode */
|
||||
const char * szFileName; /* Source file name */
|
||||
int iLine; /* Source line number */
|
||||
struct __INLINE * pNext; /* pointer to the next defined inline */
|
||||
@@ -621,7 +621,7 @@ typedef struct _HB_LABEL_INFO
|
||||
HB_BOOL fCondJump;
|
||||
HB_BOOL fEndRequest;
|
||||
int iNestedBlock;
|
||||
HB_SIZE * pulLabels;
|
||||
HB_SIZE * pnLabels;
|
||||
} HB_LABEL_INFO, * PHB_LABEL_INFO;
|
||||
|
||||
#define HB_MODE_COMPILER 1
|
||||
@@ -651,7 +651,7 @@ HB_COMMON, * HB_COMMON_PTR;
|
||||
typedef struct HB_PCODE_INFO_ /* compiled pcode container for macro compiler */
|
||||
{
|
||||
HB_BYTE * pCode; /* pointer to a memory block where pcode is stored */
|
||||
HB_SIZE lPCodeSize; /* total memory size for pcode */
|
||||
HB_SIZE nPCodeSize; /* total memory size for pcode */
|
||||
HB_SIZE nPCodePos; /* actual pcode offset */
|
||||
HB_BOOL fVParams; /* function/codeblock with variable parameters */
|
||||
HB_CBVAR_PTR pLocals;
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
typedef HB_GENC_FUNC( HB_GENC_FUNC_ );
|
||||
typedef HB_GENC_FUNC_ * HB_GENC_FUNC_PTR;
|
||||
|
||||
#define HB_GENC_GETLABEL(l) ( (l) < pFunc->nPCodePos ? cargo->pulLabels[ (l) ] : 0 )
|
||||
#define HB_GENC_GETLABEL(l) ( (l) < pFunc->nPCodePos ? cargo->pnLabels[ (l) ] : 0 )
|
||||
|
||||
#define HB_GENC_LABEL() do { \
|
||||
HB_SIZE nLab = HB_GENC_GETLABEL( nPCodePos ); \
|
||||
@@ -2354,11 +2354,11 @@ void hb_compGenCRealCode( HB_COMP_DECL, PFUNCTION pFunc, FILE * yyc )
|
||||
label_info.fEndRequest = HB_FALSE;
|
||||
label_info.iNestedBlock = 0;
|
||||
if( pFunc->nPCodePos == 0 )
|
||||
label_info.pulLabels = NULL;
|
||||
label_info.pnLabels = NULL;
|
||||
else
|
||||
{
|
||||
label_info.pulLabels = ( HB_SIZE * ) hb_xgrab( pFunc->nPCodePos * sizeof( HB_SIZE ) );
|
||||
memset( label_info.pulLabels, 0, pFunc->nPCodePos * sizeof( HB_SIZE ) );
|
||||
label_info.pnLabels = ( HB_SIZE * ) hb_xgrab( pFunc->nPCodePos * sizeof( HB_SIZE ) );
|
||||
memset( label_info.pnLabels, 0, pFunc->nPCodePos * sizeof( HB_SIZE ) );
|
||||
hb_compGenLabelTable( pFunc, &label_info );
|
||||
}
|
||||
|
||||
@@ -2374,6 +2374,6 @@ void hb_compGenCRealCode( HB_COMP_DECL, PFUNCTION pFunc, FILE * yyc )
|
||||
fprintf( yyc, " hb_xvmExitProc();\n" );
|
||||
fprintf( yyc, "}\n" );
|
||||
|
||||
if( label_info.pulLabels )
|
||||
hb_xfree( label_info.pulLabels );
|
||||
if( label_info.pnLabels )
|
||||
hb_xfree( label_info.pnLabels );
|
||||
}
|
||||
|
||||
@@ -605,7 +605,7 @@ void hb_compCodeTraceMarkDead( HB_COMP_DECL, PFUNCTION pFunc )
|
||||
*/
|
||||
/*
|
||||
pFunc->pCode[ nPos - nCount ] = pFunc->pCode[ nPos - 1 ];
|
||||
pFunc->nPCodePos = pFunc->lPCodeSize = nPos - nCount + 1;
|
||||
pFunc->nPCodePos = pFunc->nPCodeSize = nPos - nCount + 1;
|
||||
*/
|
||||
hb_compNOOPfill( pFunc, nPos - nCount, nCount, HB_FALSE, HB_TRUE );
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ static HB_LABEL_FUNC( hb_p_jumpnear )
|
||||
{
|
||||
HB_SIZE nNewPos = nPCodePos + ( signed char ) pFunc->pCode[ nPCodePos + 1 ];
|
||||
|
||||
cargo->pulLabels[ nNewPos ]++;
|
||||
cargo->pnLabels[ nNewPos ]++;
|
||||
return 2;
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ static HB_LABEL_FUNC( hb_p_jump )
|
||||
HB_BYTE * pAddr = &pFunc->pCode[ nPCodePos + 1 ];
|
||||
HB_SIZE nNewPos = nPCodePos + HB_PCODE_MKSHORT( pAddr );
|
||||
|
||||
cargo->pulLabels[ nNewPos ]++;
|
||||
cargo->pnLabels[ nNewPos ]++;
|
||||
return 3;
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ static HB_LABEL_FUNC( hb_p_jumpfar )
|
||||
HB_BYTE * pAddr = &pFunc->pCode[ nPCodePos + 1 ];
|
||||
HB_SIZE nNewPos = nPCodePos + HB_PCODE_MKINT24( pAddr );
|
||||
|
||||
cargo->pulLabels[ nNewPos ]++;
|
||||
cargo->pnLabels[ nNewPos ]++;
|
||||
return 4;
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ static HB_LABEL_FUNC( hb_p_jumpfalsenear )
|
||||
HB_SIZE nNewPos = nPCodePos + ( signed char ) pFunc->pCode[ nPCodePos + 1 ];
|
||||
|
||||
cargo->fCondJump = HB_TRUE;
|
||||
cargo->pulLabels[ nNewPos ]++;
|
||||
cargo->pnLabels[ nNewPos ]++;
|
||||
return 2;
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ static HB_LABEL_FUNC( hb_p_jumpfalse )
|
||||
HB_SIZE nNewPos = nPCodePos + HB_PCODE_MKSHORT( pAddr );
|
||||
|
||||
cargo->fCondJump = HB_TRUE;
|
||||
cargo->pulLabels[ nNewPos ]++;
|
||||
cargo->pnLabels[ nNewPos ]++;
|
||||
return 3;
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ static HB_LABEL_FUNC( hb_p_jumpfalsefar )
|
||||
HB_SIZE nNewPos = nPCodePos + HB_PCODE_MKINT24( pAddr );
|
||||
|
||||
cargo->fCondJump = HB_TRUE;
|
||||
cargo->pulLabels[ nNewPos ]++;
|
||||
cargo->pnLabels[ nNewPos ]++;
|
||||
return 4;
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ static HB_LABEL_FUNC( hb_p_jumptruenear )
|
||||
HB_SIZE nNewPos = nPCodePos + ( signed char ) pFunc->pCode[ nPCodePos + 1 ];
|
||||
|
||||
cargo->fCondJump = HB_TRUE;
|
||||
cargo->pulLabels[ nNewPos ]++;
|
||||
cargo->pnLabels[ nNewPos ]++;
|
||||
return 2;
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ static HB_LABEL_FUNC( hb_p_jumptrue )
|
||||
HB_SIZE nNewPos = nPCodePos + HB_PCODE_MKSHORT( pAddr );
|
||||
|
||||
cargo->fCondJump = HB_TRUE;
|
||||
cargo->pulLabels[ nNewPos ]++;
|
||||
cargo->pnLabels[ nNewPos ]++;
|
||||
return 3;
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ static HB_LABEL_FUNC( hb_p_jumptruefar )
|
||||
HB_SIZE nNewPos = nPCodePos + HB_PCODE_MKINT24( pAddr );
|
||||
|
||||
cargo->fCondJump = HB_TRUE;
|
||||
cargo->pulLabels[ nNewPos ]++;
|
||||
cargo->pnLabels[ nNewPos ]++;
|
||||
return 4;
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ static HB_LABEL_FUNC( hb_p_seqalways )
|
||||
HB_SIZE nAlwaysPos = nPCodePos + HB_PCODE_MKINT24( pAddr );
|
||||
|
||||
if( cargo->fSetSeqBegin )
|
||||
cargo->pulLabels[ nAlwaysPos ]++;
|
||||
cargo->pnLabels[ nAlwaysPos ]++;
|
||||
return 4;
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ static HB_LABEL_FUNC( hb_p_alwaysbegin )
|
||||
HB_SIZE nAlwaysEndPos = nPCodePos + HB_PCODE_MKINT24( pAddr );
|
||||
|
||||
if( cargo->fSetSeqBegin )
|
||||
cargo->pulLabels[ nAlwaysEndPos ]++;
|
||||
cargo->pnLabels[ nAlwaysEndPos ]++;
|
||||
return 4;
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ static HB_LABEL_FUNC( hb_p_seqbegin )
|
||||
HB_SIZE nRecoverPos = nPCodePos + HB_PCODE_MKINT24( pAddr );
|
||||
|
||||
if( cargo->fSetSeqBegin )
|
||||
cargo->pulLabels[ nRecoverPos ]++;
|
||||
cargo->pnLabels[ nRecoverPos ]++;
|
||||
return 4;
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@ static HB_LABEL_FUNC( hb_p_seqend )
|
||||
HB_SIZE nNewPos = nPCodePos + nOffset;
|
||||
|
||||
if( cargo->fSetSeqBegin || nOffset != 4 )
|
||||
cargo->pulLabels[ nNewPos ]++;
|
||||
cargo->pnLabels[ nNewPos ]++;
|
||||
return 4;
|
||||
}
|
||||
|
||||
@@ -387,9 +387,9 @@ void hb_compGenLabelTable( PFUNCTION pFunc, PHB_LABEL_INFO label_info )
|
||||
|
||||
for( n = 0; n < pFunc->nPCodePos; ++n )
|
||||
{
|
||||
if( label_info->pulLabels[ n ] )
|
||||
if( label_info->pnLabels[ n ] )
|
||||
{
|
||||
label_info->pulLabels[ n ] = ++nLabel;
|
||||
label_info->pnLabels[ n ] = ++nLabel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1550,7 +1550,7 @@ static void hb_compOptimizeJumps( HB_COMP_DECL )
|
||||
nOptimized += nBytes2Copy;
|
||||
|
||||
HB_COMP_PARAM->functions.pLast->nPCodePos = nOptimized;
|
||||
HB_COMP_PARAM->functions.pLast->lPCodeSize = nOptimized;
|
||||
HB_COMP_PARAM->functions.pLast->nPCodeSize = nOptimized;
|
||||
|
||||
hb_xfree( HB_COMP_PARAM->functions.pLast->pNOOPs );
|
||||
HB_COMP_PARAM->functions.pLast->pNOOPs = NULL;
|
||||
@@ -1816,7 +1816,7 @@ static PINLINE hb_compInlineNew( HB_COMP_DECL, const char * szName, int iLine )
|
||||
|
||||
pInline->szName = szName;
|
||||
pInline->pCode = NULL;
|
||||
pInline->lPCodeSize = 0;
|
||||
pInline->nPCodeSize = 0;
|
||||
pInline->pNext = NULL;
|
||||
pInline->szFileName = hb_compIdentifierNew( HB_COMP_PARAM,
|
||||
hb_pp_fileName( HB_COMP_PARAM->pLex->pPP ), HB_IDENT_COPY );
|
||||
|
||||
@@ -610,11 +610,11 @@ void hb_compGenPCode1( HB_BYTE byte, HB_COMP_DECL )
|
||||
if( ! pFunc->pCode ) /* has been created the memory block to hold the pcode ? */
|
||||
{
|
||||
pFunc->pCode = ( HB_BYTE * ) hb_xgrab( HB_PCODE_CHUNK );
|
||||
pFunc->lPCodeSize = HB_PCODE_CHUNK;
|
||||
pFunc->nPCodeSize = HB_PCODE_CHUNK;
|
||||
pFunc->nPCodePos = 0;
|
||||
}
|
||||
else if( ( pFunc->lPCodeSize - pFunc->nPCodePos ) < 1 )
|
||||
pFunc->pCode = ( HB_BYTE * ) hb_xrealloc( pFunc->pCode, pFunc->lPCodeSize += HB_PCODE_CHUNK );
|
||||
else if( ( pFunc->nPCodeSize - pFunc->nPCodePos ) < 1 )
|
||||
pFunc->pCode = ( HB_BYTE * ) hb_xrealloc( pFunc->pCode, pFunc->nPCodeSize += HB_PCODE_CHUNK );
|
||||
|
||||
pFunc->pCode[ pFunc->nPCodePos++ ] = byte;
|
||||
}
|
||||
@@ -626,11 +626,11 @@ void hb_compGenPCode2( HB_BYTE byte1, HB_BYTE byte2, HB_COMP_DECL )
|
||||
if( ! pFunc->pCode ) /* has been created the memory block to hold the pcode ? */
|
||||
{
|
||||
pFunc->pCode = ( HB_BYTE * ) hb_xgrab( HB_PCODE_CHUNK );
|
||||
pFunc->lPCodeSize = HB_PCODE_CHUNK;
|
||||
pFunc->nPCodeSize = HB_PCODE_CHUNK;
|
||||
pFunc->nPCodePos = 0;
|
||||
}
|
||||
else if( ( pFunc->lPCodeSize - pFunc->nPCodePos ) < 2 )
|
||||
pFunc->pCode = ( HB_BYTE * ) hb_xrealloc( pFunc->pCode, pFunc->lPCodeSize += HB_PCODE_CHUNK );
|
||||
else if( ( pFunc->nPCodeSize - pFunc->nPCodePos ) < 2 )
|
||||
pFunc->pCode = ( HB_BYTE * ) hb_xrealloc( pFunc->pCode, pFunc->nPCodeSize += HB_PCODE_CHUNK );
|
||||
|
||||
pFunc->pCode[ pFunc->nPCodePos++ ] = byte1;
|
||||
pFunc->pCode[ pFunc->nPCodePos++ ] = byte2;
|
||||
@@ -643,11 +643,11 @@ void hb_compGenPCode3( HB_BYTE byte1, HB_BYTE byte2, HB_BYTE byte3, HB_COMP_DECL
|
||||
if( ! pFunc->pCode ) /* has been created the memory block to hold the pcode ? */
|
||||
{
|
||||
pFunc->pCode = ( HB_BYTE * ) hb_xgrab( HB_PCODE_CHUNK );
|
||||
pFunc->lPCodeSize = HB_PCODE_CHUNK;
|
||||
pFunc->nPCodeSize = HB_PCODE_CHUNK;
|
||||
pFunc->nPCodePos = 0;
|
||||
}
|
||||
else if( ( pFunc->lPCodeSize - pFunc->nPCodePos ) < 3 )
|
||||
pFunc->pCode = ( HB_BYTE * ) hb_xrealloc( pFunc->pCode, pFunc->lPCodeSize += HB_PCODE_CHUNK );
|
||||
else if( ( pFunc->nPCodeSize - pFunc->nPCodePos ) < 3 )
|
||||
pFunc->pCode = ( HB_BYTE * ) hb_xrealloc( pFunc->pCode, pFunc->nPCodeSize += HB_PCODE_CHUNK );
|
||||
|
||||
pFunc->pCode[ pFunc->nPCodePos++ ] = byte1;
|
||||
pFunc->pCode[ pFunc->nPCodePos++ ] = byte2;
|
||||
@@ -661,11 +661,11 @@ void hb_compGenPCode4( HB_BYTE byte1, HB_BYTE byte2, HB_BYTE byte3, HB_BYTE byte
|
||||
if( ! pFunc->pCode ) /* has been created the memory block to hold the pcode ? */
|
||||
{
|
||||
pFunc->pCode = ( HB_BYTE * ) hb_xgrab( HB_PCODE_CHUNK );
|
||||
pFunc->lPCodeSize = HB_PCODE_CHUNK;
|
||||
pFunc->nPCodeSize = HB_PCODE_CHUNK;
|
||||
pFunc->nPCodePos = 0;
|
||||
}
|
||||
else if( ( pFunc->lPCodeSize - pFunc->nPCodePos ) < 4 )
|
||||
pFunc->pCode = ( HB_BYTE * ) hb_xrealloc( pFunc->pCode, pFunc->lPCodeSize += HB_PCODE_CHUNK );
|
||||
else if( ( pFunc->nPCodeSize - pFunc->nPCodePos ) < 4 )
|
||||
pFunc->pCode = ( HB_BYTE * ) hb_xrealloc( pFunc->pCode, pFunc->nPCodeSize += HB_PCODE_CHUNK );
|
||||
|
||||
pFunc->pCode[ pFunc->nPCodePos++ ] = byte1;
|
||||
pFunc->pCode[ pFunc->nPCodePos++ ] = byte2;
|
||||
@@ -679,15 +679,15 @@ void hb_compGenPCodeN( const HB_BYTE * pBuffer, HB_SIZE nSize, HB_COMP_DECL )
|
||||
|
||||
if( ! pFunc->pCode ) /* has been created the memory block to hold the pcode ? */
|
||||
{
|
||||
pFunc->lPCodeSize = ( ( nSize / HB_PCODE_CHUNK ) + 1 ) * HB_PCODE_CHUNK;
|
||||
pFunc->pCode = ( HB_BYTE * ) hb_xgrab( pFunc->lPCodeSize );
|
||||
pFunc->nPCodeSize = ( ( nSize / HB_PCODE_CHUNK ) + 1 ) * HB_PCODE_CHUNK;
|
||||
pFunc->pCode = ( HB_BYTE * ) hb_xgrab( pFunc->nPCodeSize );
|
||||
pFunc->nPCodePos = 0;
|
||||
}
|
||||
else if( pFunc->nPCodePos + nSize > pFunc->lPCodeSize )
|
||||
else if( pFunc->nPCodePos + nSize > pFunc->nPCodeSize )
|
||||
{
|
||||
/* not enough free space in pcode buffer - increase it */
|
||||
pFunc->lPCodeSize += ( ( ( nSize / HB_PCODE_CHUNK ) + 1 ) * HB_PCODE_CHUNK );
|
||||
pFunc->pCode = ( HB_BYTE * ) hb_xrealloc( pFunc->pCode, pFunc->lPCodeSize );
|
||||
pFunc->nPCodeSize += ( ( ( nSize / HB_PCODE_CHUNK ) + 1 ) * HB_PCODE_CHUNK );
|
||||
pFunc->pCode = ( HB_BYTE * ) hb_xrealloc( pFunc->pCode, pFunc->nPCodeSize );
|
||||
}
|
||||
|
||||
memcpy( pFunc->pCode + pFunc->nPCodePos, pBuffer, nSize );
|
||||
|
||||
@@ -88,7 +88,7 @@ static void hb_pp_PragmaDump( void * cargo, char * pBuffer, HB_SIZE nSize,
|
||||
pInline->pCode = ( HB_BYTE * ) hb_xgrab( nSize + 1 );
|
||||
memcpy( pInline->pCode, pBuffer, nSize );
|
||||
pInline->pCode[ nSize ] = '\0';
|
||||
pInline->lPCodeSize = nSize;
|
||||
pInline->nPCodeSize = nSize;
|
||||
}
|
||||
|
||||
static void hb_pp_hb_inLine( void * cargo, char * szFunc,
|
||||
@@ -111,7 +111,7 @@ static void hb_pp_hb_inLine( void * cargo, char * szFunc,
|
||||
pInline->pCode = ( HB_BYTE * ) hb_xgrab( nSize + 1 );
|
||||
memcpy( pInline->pCode, pBuffer, nSize );
|
||||
pInline->pCode[ nSize ] = '\0';
|
||||
pInline->lPCodeSize = nSize;
|
||||
pInline->nPCodeSize = nSize;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user