Skip to content

Commit

Permalink
fix bit rot
Browse files Browse the repository at this point in the history
  • Loading branch information
WalterBright committed Nov 6, 2012
1 parent 7da3ac4 commit a8395d4
Showing 1 changed file with 33 additions and 16 deletions.
49 changes: 33 additions & 16 deletions src/backend/cgcv.c
Expand Up @@ -319,6 +319,7 @@ idx_t cv_debtyp(debtyp_t *d)
}
hashi = hash % DEBTYPHASHDIM;
hash %= DEBTYPVECDIM;
//printf(" hashi = %d", hashi);

if (vec_testbit(hash,debtypvec))
{
Expand Down Expand Up @@ -1873,16 +1874,26 @@ unsigned cv4_typidx(type *t)
Ldarray:
switch (config.fulltypes)
{
#if MARS
case CV8:
{ // Make next a pointer to next
type *tp = type_allocn(TYnptr, t->Tnext);
idx_t pnext = cv4_typidx(tp);
type_free(tp);
typidx = cv8_darray(t->Tnext, pnext);
return typidx;
#if 0
d = debtyp_alloc(18);
TOWORD(d->data, 0x100F);
TOWORD(d->data + 2, OEM);
TOLONG(d->data + 4, 1); // 1 = dynamic array
TOWORD(d->data + 8, 2); // count of type indices to follow
TOWORD(d->data + 4, 1); // 1 = dynamic array
TOLONG(d->data + 6, 2); // count of type indices to follow
TOLONG(d->data + 10, 0x23); // index type, T_UQUAD
TOLONG(d->data + 14, next); // element type
#endif
break;

}
#endif
case CV4:
#if 1
d = debtyp_alloc(12);
Expand Down Expand Up @@ -1916,8 +1927,8 @@ unsigned cv4_typidx(type *t)
d = debtyp_alloc(18);
TOWORD(d->data, 0x100F);
TOWORD(d->data + 2, OEM);
TOLONG(d->data + 4, 2); // 2 = associative array
TOWORD(d->data + 8, 2); // count of type indices to follow
TOWORD(d->data + 4, 2); // 2 = associative array
TOLONG(d->data + 6, 2); // count of type indices to follow
TOLONG(d->data + 10, key); // key type
TOLONG(d->data + 14, next); // element type
break;
Expand Down Expand Up @@ -1946,7 +1957,6 @@ unsigned cv4_typidx(type *t)
break;

Ldelegate:
assert(config.fulltypes == CV4);
tv = type_fake(TYnptr);
tv->Tcount++;
key = cv4_typidx(tv);
Expand All @@ -1957,8 +1967,8 @@ unsigned cv4_typidx(type *t)
d = debtyp_alloc(18);
TOWORD(d->data, 0x100F);
TOWORD(d->data + 2, OEM);
TOLONG(d->data + 4, 3); // 3 = delegate
TOWORD(d->data + 8, 2); // count of type indices to follow
TOWORD(d->data + 4, 3); // 3 = delegate
TOLONG(d->data + 6, 2); // count of type indices to follow
TOLONG(d->data + 10, key); // key type
TOLONG(d->data + 14, next); // element type
break;
Expand All @@ -1985,14 +1995,19 @@ unsigned cv4_typidx(type *t)
typidx = cv_debtyp(d);
break;

case TYcent: // treat as long[2]
next = dttab4[TYllong];
goto Lcent;
case TYucent: // treat as ulong[2]
next = dttab4[TYullong];
Lcent:
size = 16;
goto Larray;
case TYcent:
if (t->Tnext)
goto Ldelegate;
assert(dt);
typidx = dt;
break;

case TYucent:
if (t->Tnext)
goto Ldarray;
assert(dt);
typidx = dt;
break;

case TYarray:
if (t->Tflags & TFsizeunknown)
Expand Down Expand Up @@ -2856,9 +2871,11 @@ void cv_outsym(symbol *s)
case CVTDB:
cv4_outsym(s);
break;
#if MARS
case CV8:
cv8_outsym(s);
break;
#endif
default:
assert(0);
}
Expand Down

0 comments on commit a8395d4

Please sign in to comment.