mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-07 02:42:48 +03:00
Adjust the lemon implementation so that it always computes the same PDA
regardless of qsort() implementation on the host platform. In other words, make all sorts in lemon stable. FossilOrigin-Name: d66a0f31ebcc56e6f0f462b3db6aab54f7fab816
This commit is contained in:
18
manifest
18
manifest
@@ -1,8 +1,8 @@
|
|||||||
-----BEGIN PGP SIGNED MESSAGE-----
|
-----BEGIN PGP SIGNED MESSAGE-----
|
||||||
Hash: SHA1
|
Hash: SHA1
|
||||||
|
|
||||||
C All\sSQLITE_MAX_VARIABLE_NUMBER\sto\sexceed\s32767.\s\sThe\ssizes\sof\ssome\sstructures\nincrease\swhen\sthe\scompile-time\sparameter\sis\sconfigured\sthis\sway.
|
C Adjust\sthe\slemon\simplementation\sso\sthat\sit\salways\scomputes\sthe\ssame\sPDA\nregardless\sof\sqsort()\simplementation\son\sthe\shost\splatform.\s\sIn\sother\swords,\nmake\sall\ssorts\sin\slemon\sstable.
|
||||||
D 2009-11-03T01:22:08
|
D 2009-11-03T13:02:26
|
||||||
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
|
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
|
||||||
F Makefile.in a77dfde96ad86aafd3f71651a4333a104debe86a
|
F Makefile.in a77dfde96ad86aafd3f71651a4333a104debe86a
|
||||||
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
|
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
|
||||||
@@ -743,7 +743,7 @@ F tool/diffdb.c 7524b1b5df217c20cd0431f6789851a4e0cb191b
|
|||||||
F tool/fragck.tcl 5265a95126abcf6ab357f7efa544787e5963f439
|
F tool/fragck.tcl 5265a95126abcf6ab357f7efa544787e5963f439
|
||||||
F tool/genfkey.README cf68fddd4643bbe3ff8e31b8b6d8b0a1b85e20f4
|
F tool/genfkey.README cf68fddd4643bbe3ff8e31b8b6d8b0a1b85e20f4
|
||||||
F tool/genfkey.test 4196a8928b78f51d54ef58e99e99401ab2f0a7e5
|
F tool/genfkey.test 4196a8928b78f51d54ef58e99e99401ab2f0a7e5
|
||||||
F tool/lemon.c 0eb9829c494dfcea449de36ad677efe7f0742801
|
F tool/lemon.c ee5e39ce2b344ce7c81306b27a59da7698114a2d
|
||||||
F tool/lempar.c 2ed70b3fc896a47e07fedfe543324f008f53d223
|
F tool/lempar.c 2ed70b3fc896a47e07fedfe543324f008f53d223
|
||||||
F tool/mkkeywordhash.c 8c9f8e3253555101aaa4bf7a0459cbfc8ddc41cc
|
F tool/mkkeywordhash.c 8c9f8e3253555101aaa4bf7a0459cbfc8ddc41cc
|
||||||
F tool/mkopts.tcl 66ac10d240cc6e86abd37dc908d50382f84ff46e
|
F tool/mkopts.tcl 66ac10d240cc6e86abd37dc908d50382f84ff46e
|
||||||
@@ -764,14 +764,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
|
|||||||
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
|
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
|
||||||
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
|
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
|
||||||
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
|
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
|
||||||
P 6610cac435428434bc978d5e4df92aa1e431240b
|
P 16a24b4485420bdf30d3c8e22cfbaf008e07df02
|
||||||
R ccaf6a810237127b03d8c2dda40d5c18
|
R e72225eb55d8736569f8031586282767
|
||||||
U drh
|
U drh
|
||||||
Z 75578a720b6342c3a297305a01e4e12a
|
Z 9ed57d7b7fd138a4562a0f8b4ab054bf
|
||||||
-----BEGIN PGP SIGNATURE-----
|
-----BEGIN PGP SIGNATURE-----
|
||||||
Version: GnuPG v1.4.6 (GNU/Linux)
|
Version: GnuPG v1.4.6 (GNU/Linux)
|
||||||
|
|
||||||
iD8DBQFK74XEoxKgR168RlERAoE0AJ0ReiaY3L/Gf3rz2iTVUhp4M+MNCACePwqQ
|
iD8DBQFK8CnloxKgR168RlERAvvEAJ4zARLPnrRgcFCLL+urqSma1EJWFACghoK5
|
||||||
9jr/776w6kq808+th2eWh+E=
|
rpncZKK3rz8eBtrxBY7ZVmw=
|
||||||
=478y
|
=tZsO
|
||||||
-----END PGP SIGNATURE-----
|
-----END PGP SIGNATURE-----
|
||||||
|
@@ -1 +1 @@
|
|||||||
16a24b4485420bdf30d3c8e22cfbaf008e07df02
|
d66a0f31ebcc56e6f0f462b3db6aab54f7fab816
|
24
tool/lemon.c
24
tool/lemon.c
@@ -369,6 +369,9 @@ static int actioncmp(
|
|||||||
if( rc==0 && ap1->type==REDUCE ){
|
if( rc==0 && ap1->type==REDUCE ){
|
||||||
rc = ap1->x.rp->index - ap2->x.rp->index;
|
rc = ap1->x.rp->index - ap2->x.rp->index;
|
||||||
}
|
}
|
||||||
|
if( rc==0 ){
|
||||||
|
rc = ap2 - ap1;
|
||||||
|
}
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1578,7 +1581,7 @@ static char *merge(
|
|||||||
}else if( b==0 ){
|
}else if( b==0 ){
|
||||||
head = a;
|
head = a;
|
||||||
}else{
|
}else{
|
||||||
if( (*cmp)(a,b)<0 ){
|
if( (*cmp)(a,b)<=0 ){
|
||||||
ptr = a;
|
ptr = a;
|
||||||
a = NEXT(a);
|
a = NEXT(a);
|
||||||
}else{
|
}else{
|
||||||
@@ -1587,7 +1590,7 @@ static char *merge(
|
|||||||
}
|
}
|
||||||
head = ptr;
|
head = ptr;
|
||||||
while( a && b ){
|
while( a && b ){
|
||||||
if( (*cmp)(a,b)<0 ){
|
if( (*cmp)(a,b)<=0 ){
|
||||||
NEXT(ptr) = a;
|
NEXT(ptr) = a;
|
||||||
ptr = a;
|
ptr = a;
|
||||||
a = NEXT(a);
|
a = NEXT(a);
|
||||||
@@ -1639,7 +1642,7 @@ static char *msort(
|
|||||||
set[i] = ep;
|
set[i] = ep;
|
||||||
}
|
}
|
||||||
ep = 0;
|
ep = 0;
|
||||||
for(i=0; i<LISTSIZE; i++) if( set[i] ) ep = merge(ep,set[i],cmp,offset);
|
for(i=0; i<LISTSIZE; i++) if( set[i] ) ep = merge(set[i],ep,cmp,offset);
|
||||||
return ep;
|
return ep;
|
||||||
}
|
}
|
||||||
/************************ From the file "option.c" **************************/
|
/************************ From the file "option.c" **************************/
|
||||||
@@ -3516,6 +3519,7 @@ struct axset {
|
|||||||
struct state *stp; /* A pointer to a state */
|
struct state *stp; /* A pointer to a state */
|
||||||
int isTkn; /* True to use tokens. False for non-terminals */
|
int isTkn; /* True to use tokens. False for non-terminals */
|
||||||
int nAction; /* Number of actions */
|
int nAction; /* Number of actions */
|
||||||
|
int iOrder; /* Original order of action sets */
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -3524,7 +3528,13 @@ struct axset {
|
|||||||
static int axset_compare(const void *a, const void *b){
|
static int axset_compare(const void *a, const void *b){
|
||||||
struct axset *p1 = (struct axset*)a;
|
struct axset *p1 = (struct axset*)a;
|
||||||
struct axset *p2 = (struct axset*)b;
|
struct axset *p2 = (struct axset*)b;
|
||||||
return p2->nAction - p1->nAction;
|
int c;
|
||||||
|
c = p2->nAction - p1->nAction;
|
||||||
|
if( c==0 ){
|
||||||
|
c = p2->iOrder - p1->iOrder;
|
||||||
|
}
|
||||||
|
assert( c!=0 || p1==p2 );
|
||||||
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -3684,6 +3694,7 @@ int mhflag; /* Output in makeheaders format if true */
|
|||||||
** action table to a minimum, the heuristic of placing the largest action
|
** action table to a minimum, the heuristic of placing the largest action
|
||||||
** sets first is used.
|
** sets first is used.
|
||||||
*/
|
*/
|
||||||
|
for(i=0; i<lemp->nstate*2; i++) ax[i].iOrder = i;
|
||||||
qsort(ax, lemp->nstate*2, sizeof(ax[0]), axset_compare);
|
qsort(ax, lemp->nstate*2, sizeof(ax[0]), axset_compare);
|
||||||
pActtab = acttab_alloc();
|
pActtab = acttab_alloc();
|
||||||
for(i=0; i<lemp->nstate*2 && ax[i].nAction>0; i++){
|
for(i=0; i<lemp->nstate*2 && ax[i].nAction>0; i++){
|
||||||
@@ -4097,7 +4108,11 @@ static int stateResortCompare(const void *a, const void *b){
|
|||||||
n = pB->nNtAct - pA->nNtAct;
|
n = pB->nNtAct - pA->nNtAct;
|
||||||
if( n==0 ){
|
if( n==0 ){
|
||||||
n = pB->nTknAct - pA->nTknAct;
|
n = pB->nTknAct - pA->nTknAct;
|
||||||
|
if( n==0 ){
|
||||||
|
n = pB->statenum - pA->statenum;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
assert( n!=0 );
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4401,6 +4416,7 @@ char *x;
|
|||||||
int Symbolcmpp(struct symbol **a, struct symbol **b){
|
int Symbolcmpp(struct symbol **a, struct symbol **b){
|
||||||
int i1 = (**a).index + 10000000*((**a).name[0]>'Z');
|
int i1 = (**a).index + 10000000*((**a).name[0]>'Z');
|
||||||
int i2 = (**b).index + 10000000*((**b).name[0]>'Z');
|
int i2 = (**b).index + 10000000*((**b).name[0]>'Z');
|
||||||
|
assert( i1!=i2 || strcmp((**a).name,(**b).name)==0 );
|
||||||
return i1-i2;
|
return i1-i2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user