mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-03 16:53:36 +03:00
Another attempt to get reuse of excess opcode array space working correctly
on all architectures and platforms. FossilOrigin-Name: 2f8583748abab1e15029d3a8693ba9a66c978c2b
This commit is contained in:
@@ -1851,19 +1851,24 @@ void sqlite3VdbeMakeReady(
|
||||
/* zCsr will initially point to nFree bytes of unused space at the
|
||||
** end of the opcode array, p->aOp. The computation of nFree is
|
||||
** conservative - it might be smaller than the true number of free
|
||||
** bytes, but never larger. nFree might be negative. But the allocation
|
||||
** loop will still function correctly.
|
||||
** bytes, but never larger. nFree must be a multiple of 8 - it is
|
||||
** rounded down if is not.
|
||||
*/
|
||||
zCsr = ((u8*)p->aOp) + ROUND8(sizeof(Op)*p->nOp); /* Available space */
|
||||
nFree = pParse->szOpAlloc - ROUND8(sizeof(Op)*p->nOp); /* Size of zCsr */
|
||||
if( nFree>0 ) memset(zCsr, 0, nFree);
|
||||
n = ROUND8(sizeof(Op)*p->nOp); /* Bytes of opcode space used */
|
||||
zCsr = &((u8*)p->aOp)[n]; /* Unused opcode space */
|
||||
assert( EIGHT_BYTE_ALIGNMENT(zCsr) );
|
||||
nFree = ROUNDDOWN8(pParse->szOpAlloc - n); /* Bytes of unused space */
|
||||
assert( nFree>=0 );
|
||||
if( nFree>0 ){
|
||||
memset(zCsr, 0, nFree);
|
||||
assert( EIGHT_BYTE_ALIGNMENT(&zCsr[nFree]) );
|
||||
}
|
||||
|
||||
resolveP2Values(p, &nArg);
|
||||
p->usesStmtJournal = (u8)(pParse->isMultiWrite && pParse->mayAbort);
|
||||
if( pParse->explain && nMem<10 ){
|
||||
nMem = 10;
|
||||
}
|
||||
assert( EIGHT_BYTE_ALIGNMENT(&zCsr[nFree]) );
|
||||
p->expired = 0;
|
||||
|
||||
/* Memory for registers, parameters, cursor, etc, is allocated in two
|
||||
|
||||
Reference in New Issue
Block a user