richter 00/10/25 01:08:22
Modified: . Tag: Embperl2c epcomp.c epdat.h epmain.c
Log:
- Embperl 2 - Cacheing
Revision Changes Path
No revision
No revision
1.4.2.9 +18 -13 embperl/Attic/epcomp.c
Index: epcomp.c
===================================================================
RCS file: /home/cvs/embperl/Attic/epcomp.c,v
retrieving revision 1.4.2.8
retrieving revision 1.4.2.9
diff -u -r1.4.2.8 -r1.4.2.9
--- epcomp.c 2000/10/18 13:28:52 1.4.2.8
+++ epcomp.c 2000/10/25 08:08:17 1.4.2.9
@@ -1245,7 +1245,7 @@
r -> nPhase = phCompile ;
- if (ppLastResult && SvTYPE (*ppLastResult) == SVt_PVCV)
+ if (ppLastResult && *ppLastResult && SvTYPE (*ppLastResult) == SVt_PVCV)
{ /* Get already parsed Dom Tree */
if (ppCompResult != ppLastResult)
AssignSVPtr (ppCompResult,*ppLastResult) ;
@@ -1349,7 +1349,7 @@
r -> nPhase = phParse ;
- if (ppLastResult && SvIOKp (*ppLastResult))
+ if (ppLastResult && *ppLastResult && SvIOKp (*ppLastResult))
{ /* Get already parsed Dom Tree */
pDomTree = DomTree_selfSV(*ppLastResult) ;
if (ppCompResult != ppLastResult)
@@ -1408,8 +1408,12 @@
clock_t cl2 ;
SV * pSV ;
- if (ppExecResult && SvIOKp (*ppExecResult))
+ if (ppExecResult && *ppExecResult && SvIOKp (*ppExecResult))
+ {
+ if (r -> bDebug & dbgCache)
+ lprintf (r, "[%d]CACHE: Result for file %s, processor %s taken form cache,
not executed (DomTree #%d)\n", r -> nPid, r -> Buf.pFile -> sSourcefile, pProcessor ->
sName, DomTree_SV (*ppExecResult)) ;
return ok ;
+ }
if (!r -> bError)
{
@@ -1497,8 +1501,8 @@
/* */
/* in pProcessor Processor to check for */
/* cType Type with should checked */
-/* nExpiresIn -1 imideately */
-/* 0 never (only is preceeding steps are expires) */
+/* nExpiresIn 0 imideately */
+/* -1 never (only is preceeding steps are expires) */
/* <n> second */
/* pExiresCV Exipres when CV return true */
/* bForceExpire When set to true entry is unconditional expired */
@@ -1510,6 +1514,7 @@
int embperl_GetFromCache (/*in*/ tReq * r,
/*in*/ tProcessor * pProcessor,
/*in*/ char cType,
+ /*in*/ const char * sStepName,
/*in*/ double nExpiresIn,
/*in*/ CV * pExpiresCV,
/*in*/ int * bForceExpire,
@@ -1524,18 +1529,18 @@
STRLEN l ;
- if (nExpiresIn == -1)
+ if (nExpiresIn == 0)
{
*pppSV = (SV**)_malloc (r, sizeof (SV *)) ;
**pppSV = NULL ;
if (r -> bDebug & dbgCache)
- lprintf (r, "[%d]CACHE: Type '%c' not cached\n", r -> nPid, cType) ;
+ lprintf (r, "[%d]CACHE: File: '%s' Processor: '%s' Step: '%s' Type:
'%c' not cached\n", r -> nPid, r -> Buf.pFile -> sSourcefile, pProcessor -> sName,
sStepName, cType) ;
return ok ;
}
nKey = sprintf (sKey, "%c-%d-%0.200s", cType, pProcessor -> nProcessorNo,
pProcessor -> sCacheKey) ;
if (r -> bDebug & dbgCache)
- lprintf (r, "[%d]CACHE: Key is '%s'\n", r -> nPid, sKey) ;
+ lprintf (r, "[%d]CACHE: File: '%s' Processor: '%s' Step: '%s' gives Key:
'%s'\n", r -> nPid, r -> Buf.pFile -> sSourcefile, pProcessor -> sName, sStepName,
sKey) ;
*pppSV = ppSV = hv_fetch(r -> Buf.pFile -> pCacheHash, sKey, nKey, 1) ;
if (ppSV == NULL || *ppSV == NULL)
return rcHashError ;
@@ -1655,7 +1660,7 @@
{
if (pProcessor -> pPreCompiler)
{
- if ((rc = embperl_GetFromCache (r, pProcessor, 'P', 0, NULL,
&bForceExpirePre, &ppSV)) != ok)
+ if ((rc = embperl_GetFromCache (r, pProcessor, 'P', "Precompiler", -1,
NULL, &bForceExpirePre, &ppSV)) != ok)
return rc ;
if ((rc = (*pProcessor -> pPreCompiler)(r, pProcessor, &pDomTree, NULL,
ppSV)) != ok)
@@ -1691,13 +1696,13 @@
if (pProcessor -> pPreCompiler)
{
- if ((rc = embperl_GetFromCache (r, pProcessor, 'P', 0, NULL,
&bForceExpirePre, &ppPreCompResult)) != ok)
+ if ((rc = embperl_GetFromCache (r, pProcessor, 'P', "Precompiler", -1,
NULL, &bForceExpirePre, &ppPreCompResult)) != ok)
return rc ;
}
if (pProcessor -> pCompiler)
{
- if ((rc = embperl_GetFromCache (r, pProcessor, 'C', 0, NULL,
&bForceExpire, &ppCompResult)) != ok)
+ if ((rc = embperl_GetFromCache (r, pProcessor, 'C', "Compiler", -1,
NULL, &bForceExpire, &ppCompResult)) != ok)
return rc ;
if ((rc = (*pProcessor -> pCompiler)(r, pProcessor, &pDomTree,
ppPreCompResult, ppCompResult)) != ok)
@@ -1706,12 +1711,12 @@
if (!r -> bError && pProcessor -> pExecuter)
{
- if ((rc = embperl_GetFromCache (r, pProcessor, 'E', pProcessor ->
nOutputExpiresIn, pProcessor -> pOutputExpiresCV, &bForceExpire, &ppExecResult)) != ok)
+ if ((rc = embperl_GetFromCache (r, pProcessor, 'E', "Executer",
pProcessor -> nOutputExpiresIn, pProcessor -> pOutputExpiresCV, &bForceExpire,
&ppExecResult)) != ok)
return rc ;
if ((rc = (*pProcessor -> pExecuter)(r, pProcessor, &pDomTree,
ppPreCompResult, ppCompResult, ppExecResult)) != ok)
return rc ;
- if (ppExecResult)
+ if (ppExecResult && *ppExecResult)
r -> xCurrDomTree = DomTree_SV (*ppExecResult) ;
}
pProcessor = pProcessor -> pNext ;
1.20.4.6 +1 -0 embperl/epdat.h
Index: epdat.h
===================================================================
RCS file: /home/cvs/embperl/epdat.h,v
retrieving revision 1.20.4.5
retrieving revision 1.20.4.6
diff -u -r1.20.4.5 -r1.20.4.6
--- epdat.h 2000/10/18 13:28:53 1.20.4.5
+++ epdat.h 2000/10/25 08:08:18 1.20.4.6
@@ -25,6 +25,7 @@
typedef struct tProcessor
{
int nProcessorNo ;
+ const char * sName ;
int (* pPreCompiler) (/*in*/ tReq * r,
/*in*/ struct tProcessor * pProcessor,
/*in*/ tDomTree ** ppDomTree,
1.75.4.7 +2 -2 embperl/epmain.c
Index: epmain.c
===================================================================
RCS file: /home/cvs/embperl/epmain.c,v
retrieving revision 1.75.4.6
retrieving revision 1.75.4.7
diff -u -r1.75.4.6 -r1.75.4.7
--- epmain.c 2000/10/18 13:28:53 1.75.4.6
+++ epmain.c 2000/10/25 08:08:18 1.75.4.7
@@ -2879,8 +2879,8 @@
#ifdef EP2
if (!r -> bEP1Compat)
{
- tProcessor p2 = {2, embperl_CompileProcessor, NULL, embperl_ExecuteProcessor,
"", 0, NULL, NULL } ;
- tProcessor p1 = {1, embperl_ParseProcessor, NULL, NULL,
"", 0, NULL, &p2 } ;
+ tProcessor p2 = {2, "Embperl", embperl_CompileProcessor, NULL,
embperl_ExecuteProcessor, "", 0, NULL, NULL } ;
+ tProcessor p1 = {1, "Parser", embperl_ParseProcessor, NULL, NULL,
"", 0, NULL, &p2 } ;
rc = embperl_CompileDocument (r, &p1) ;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]