2011-06-02 21:05 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/src/vm/thread.c
    * set sleep timeout in *nix version of hb_threadReleaseCPU() to 10 ms

  * harbour/src/compiler/hbpcode.c
    ! fixed typo which could cause compile time crash when debugger code
      is generated (-b) and file name with extenssion has only one or
      two characters

  * harbour/include/hbcompdf.h
  * harbour/src/compiler/hbmain.c
  * harbour/src/compiler/hbstripl.c
  * harbour/src/compiler/harbour.y
  * harbour/src/compiler/harbour.yyc
    ! removed old code designed to optimize line numbers generated in PCODE.
      It cannot work correctly and in some cases it was generating HB_P_LINE
      pcodes in wrong places.
    % enabled new code for HB_P_LINE PCODEs optimization also in debugger (-b)
      compilation so it can be used to replaced the old one.
This commit is contained in:
Przemyslaw Czerpak
2011-06-02 19:05:56 +00:00
parent f6945d7bf7
commit c72ee124b3
8 changed files with 29 additions and 29 deletions

View File

@@ -16,6 +16,26 @@
The license applies to all entries newer than 2009-04-28.
*/
2011-06-02 21:05 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/src/vm/thread.c
* set sleep timeout in *nix version of hb_threadReleaseCPU() to 10 ms
* harbour/src/compiler/hbpcode.c
! fixed typo which could cause compile time crash when debugger code
is generated (-b) and file name with extenssion has only one or
two characters
* harbour/include/hbcompdf.h
* harbour/src/compiler/hbmain.c
* harbour/src/compiler/hbstripl.c
* harbour/src/compiler/harbour.y
* harbour/src/compiler/harbour.yyc
! removed old code designed to optimize line numbers generated in PCODE.
It cannot work correctly and in some cases it was generating HB_P_LINE
pcodes in wrong places.
% enabled new code for HB_P_LINE PCODEs optimization also in debugger (-b)
compilation so it can be used to replaced the old one.
2011-06-02 14:51 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbwin/wapi_winbase.c
! fixed to pull proper default getlasterror value

View File

@@ -780,7 +780,6 @@ typedef struct _HB_COMP
HB_SIZE nOutBufSize; /* memory output buffer size */
HB_BYTE * pOutBuf; /* memory output buffer address */
HB_SIZE lastLinePos; /* position of last opcode with line number */
int lastLine; /* last generated in PCODE line number */
int currLine; /* currently compiled line number */
const char * lastModule; /* last generated in PCODE module name */

View File

@@ -1065,7 +1065,6 @@ CodeBlock : BlockHead
HB_COMP_PARAM->functions.pLast->pCode + $<sNumber>3,
HB_COMP_PARAM->functions.pLast->nPCodePos - $<sNumber>3 );
HB_COMP_PARAM->functions.pLast->nPCodePos = $<sNumber>3;
HB_COMP_PARAM->lastLinePos = 0;
}
;

View File

@@ -5719,7 +5719,6 @@ yyreduce:
HB_COMP_PARAM->functions.pLast->pCode + (yyvsp[(3) - (5)].sNumber),
HB_COMP_PARAM->functions.pLast->nPCodePos - (yyvsp[(3) - (5)].sNumber) );
HB_COMP_PARAM->functions.pLast->nPCodePos = (yyvsp[(3) - (5)].sNumber);
HB_COMP_PARAM->lastLinePos = 0;
;}
break;

View File

@@ -1284,7 +1284,7 @@ static void hb_compOptimizeJumps( HB_COMP_DECL )
HB_BYTE * pCode = HB_COMP_PARAM->functions.pLast->pCode;
HB_SIZE * pNOOPs, * pJumps;
HB_SIZE nOptimized, nNextByte, nBytes2Copy, nJumpAddr, nNOOP, nJump;
HB_BOOL fLineStrip = !HB_COMP_PARAM->fDebugInfo && HB_COMP_PARAM->fLineNumbers;
HB_BOOL fLineStrip = HB_COMP_PARAM->fLineNumbers;
int iPass;
if( ! HB_COMP_ISSUPPORTED(HB_COMPFLAG_OPTJUMP) )
@@ -2141,7 +2141,6 @@ void hb_compFunctionAdd( HB_COMP_DECL, const char * szFunName, HB_SYMBOLSCOPE cS
hb_compAddFunc( HB_COMP_PARAM, pFunc );
HB_COMP_PARAM->lastLinePos = 0; /* optimization of line numbers opcode generation */
HB_COMP_PARAM->ilastLineErr = 0; /* position of last syntax error (line number) */
hb_compGenPCode3( HB_P_FRAME, 0, 0, HB_COMP_PARAM ); /* frame for locals and parameters */
@@ -2351,27 +2350,12 @@ void hb_compLinePush( HB_COMP_DECL ) /* generates the pcode with the currently c
if( HB_COMP_PARAM->fLineNumbers )
{
if( HB_COMP_PARAM->fDebugInfo && HB_COMP_PARAM->lastModule != HB_COMP_PARAM->currModule )
{
if( HB_COMP_PARAM->functions.pLast->pCode[ HB_COMP_PARAM->lastLinePos ] == HB_P_LINE &&
HB_COMP_PARAM->functions.pLast->nPCodePos - HB_COMP_PARAM->lastLinePos == 3 )
HB_COMP_PARAM->functions.pLast->nPCodePos -= 3;
hb_compGenModuleName( HB_COMP_PARAM, NULL );
}
if( HB_COMP_PARAM->currLine != HB_COMP_PARAM->lastLine )
{
if( HB_COMP_PARAM->functions.pLast->nPCodePos - HB_COMP_PARAM->lastLinePos == 3 &&
HB_COMP_PARAM->functions.pLast->pCode[ HB_COMP_PARAM->lastLinePos ] == HB_P_LINE )
{
HB_COMP_PARAM->functions.pLast->pCode[ HB_COMP_PARAM->lastLinePos + 1 ] = HB_LOBYTE( HB_COMP_PARAM->currLine );
HB_COMP_PARAM->functions.pLast->pCode[ HB_COMP_PARAM->lastLinePos + 2 ] = HB_HIBYTE( HB_COMP_PARAM->currLine );
}
else
{
HB_COMP_PARAM->lastLinePos = HB_COMP_PARAM->functions.pLast->nPCodePos;
hb_compGenPCode3( HB_P_LINE, HB_LOBYTE( HB_COMP_PARAM->currLine ),
HB_HIBYTE( HB_COMP_PARAM->currLine ), HB_COMP_PARAM );
}
hb_compGenPCode3( HB_P_LINE, HB_LOBYTE( HB_COMP_PARAM->currLine ),
HB_HIBYTE( HB_COMP_PARAM->currLine ), HB_COMP_PARAM );
HB_COMP_PARAM->lastLine = HB_COMP_PARAM->currLine;
}
}
@@ -3263,7 +3247,6 @@ void hb_compSequenceFinish( HB_COMP_DECL, HB_SIZE nStartPos, HB_SIZE nEndPos,
HB_COMP_PARAM->functions.pLast->nPCodePos -
nStartPos, fCanMove );
}
HB_COMP_PARAM->lastLinePos = nStartPos - 3;
}
else if( !nAlways )
{
@@ -3484,7 +3467,6 @@ void hb_compCodeBlockStart( HB_COMP_DECL, HB_BOOL bLateEval )
pBlock->bLateEval = bLateEval;
HB_COMP_PARAM->functions.pLast = pBlock;
HB_COMP_PARAM->lastLinePos = 0;
}
void hb_compCodeBlockEnd( HB_COMP_DECL )
@@ -3736,7 +3718,6 @@ static void hb_compInitVars( HB_COMP_DECL )
HB_COMP_PARAM->pLineFunc = NULL;
HB_COMP_PARAM->pDeclFunc = NULL;
HB_COMP_PARAM->lastLinePos = 0;
HB_COMP_PARAM->iStaticCnt = 0;
HB_COMP_PARAM->iVarScope = VS_LOCAL;

View File

@@ -93,7 +93,7 @@ static HB_PSIZE_FUNC( hb_p_modulename )
HB_SIZE nStart = nPCodePos;
HB_SYMBOL_UNUSED( cargo );
nPCodePos += 3;
nPCodePos++;
while( pFunc->pCode[ nPCodePos++ ]) {};
return ( nPCodePos - nStart );

View File

@@ -67,9 +67,11 @@ HB_EXTERN_END
static HB_STRIP_FUNC( hb_p_line )
{
HB_SYMBOL_UNUSED( cargo );
if( pFunc->pCode[ nPCodePos + 3 ] == HB_P_LINE )
switch( pFunc->pCode[ nPCodePos + 3 ] )
{
hb_compNOOPfill( pFunc, nPCodePos, 3, HB_FALSE, HB_FALSE );
case HB_P_LINE:
case HB_P_MODULENAME:
hb_compNOOPfill( pFunc, nPCodePos, 3, HB_FALSE, HB_FALSE );
}
return 3;

View File

@@ -299,7 +299,7 @@ void hb_threadReleaseCPU( void )
{
struct timeval tv;
tv.tv_sec = 0;
tv.tv_usec = 1000;
tv.tv_usec = 10000;
select( 0, NULL, NULL, NULL, &tv );
}