Integrate duplicate detection fix.

This commit is contained in:
C. Guy Yarvin 2017-06-09 17:29:55 -07:00
parent 73f3be1e91
commit 14890c4bd1

View File

@ -611,48 +611,54 @@ _sung_one(u3_noun* a, u3_noun* b)
if ( _(asr_o) && _(bsr_o) ) { if ( _(asr_o) && _(bsr_o) ) {
// //
// we can't unify on a higher road, because we can't // when unifying on a higher road, we can't free nouns,
// track junior nouns that point into that road. this // because we can't track junior nouns that point into
// is just an implementation issue -- we could set use // that road.
// counts to 0 without actually freeing. but the system //
// this is just an implementation issue -- we could set use
// counts to 0 without actually freeing. but the allocator
// would have to be actually designed for this. // would have to be actually designed for this.
// //
// the commented-out code was installed for quite some // not freeing may generate spurious leaks, so we disable
// time in a released system... // senior unification when debugging memory. this will
// cause a very slow boot process as the compiler compiles
// itself, constantly running into duplicates.
// //
// u3R = u3to(u3_road, u3R->par_p); #ifdef U3_MEMORY_DEBUG
// continue;
//
return; return;
#else
u3R = u3to(u3_road, u3R->par_p);
continue;
#endif
} }
if ( _(asr_o) && !_(bsr_o) ){ if ( _(asr_o) && !_(bsr_o) ){
u3z(*b); if ( u3R == rod_u ) { u3z(*b); }
*b = *a; *b = *a;
} }
if ( _(bsr_o) && !_(asr_o) ) { if ( _(bsr_o) && !_(asr_o) ) {
u3z(*a); if ( u3R == rod_u ) { u3z(*a); }
*a = *b; *a = *b;
} }
if ( u3a_is_north(u3R) ) { if ( u3a_is_north(u3R) ) {
if ( *a <= *b ) { if ( *a <= *b ) {
u3k(*a); u3k(*a);
u3z(*b); if ( u3R == rod_u ) { u3z(*b); }
*b = *a; *b = *a;
} else { } else {
u3k(*b); u3k(*b);
u3z(*a); if ( u3R == rod_u ) { u3z(*a); }
*a = *b; *a = *b;
} }
} }
else { else {
if ( *a >= *b ) { if ( *a >= *b ) {
u3k(*a); u3k(*a);
u3z(*b); if ( u3R == rod_u ) { u3z(*b); }
*b = *a; *b = *a;
} else { } else {
u3k(*b); u3k(*b);
u3z(*a); if ( u3R == rod_u ) { u3z(*a); }
*a = *b; *a = *b;
} }
} }