Skip to content

Commit

Permalink
catch up
Browse files Browse the repository at this point in the history
  • Loading branch information
WalterBright committed Feb 11, 2013
1 parent ecd818e commit 736acba
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 20 deletions.
5 changes: 5 additions & 0 deletions src/backend/cgcv.c
Expand Up @@ -374,6 +374,11 @@ idx_t cv_debtyp(debtyp_t *d)
return debtyptop++ + cgcv.deb_offset;
}

idx_t cv_numdebtypes()
{
return debtyptop;
}

/****************************
* Store a null record at DEB_NULL.
*/
Expand Down
1 change: 1 addition & 0 deletions src/backend/cgcv.h
Expand Up @@ -64,6 +64,7 @@ int cv_namestring ( unsigned char *p , const char *name );
unsigned cv4_typidx(type *t);
idx_t cv4_arglist(type *t,unsigned *pnparam);
unsigned char cv4_callconv(type *t);
idx_t cv_numdebtypes();

#define TOIDX(a,b) ((cgcv.sz_idx == 4) ? TOLONG(a,b) : TOWORD(a,b))

Expand Down
31 changes: 18 additions & 13 deletions src/backend/cv8.c
Expand Up @@ -763,25 +763,25 @@ idx_t cv8_darray(type *t, idx_t etypidx)
idx_t ptridx = cv4_typidx(tp);
type_free(tp);

static const unsigned char fl[0x26] =
static const unsigned char fl[] =
{
0x03, 0x12, // LF_FIELDLIST_V2
0x0d, 0x15, // LF_MEMBER_V3
0x03, 0x00, // attribute
0x23, 0x00, 0x00, 0x00, // size_t
0x00, 0x00, // offset
0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x00,
0xf3, 0xf2, 0xf1,
'l', 'e', 'n', 'g', 't', 'h', 0x00,
0xf3, 0xf2, 0xf1, // align to 4-byte including length word before data
0x0d, 0x15,
0x03, 0x00,
0x00, 0x00, 0x00, 0x00, // etypidx
0x08, 0x00,
0x70, 0x74, 0x72, 0x00,
'p', 't', 'r', 0x00,
0xf2, 0xf1,
};

debtyp_t *f = debtyp_alloc(0x26);
memcpy(f->data,fl,0x26);
debtyp_t *f = debtyp_alloc(sizeof(fl));
memcpy(f->data,fl,sizeof(fl));
TOLONG(f->data + 26, ptridx);
idx_t fieldlist = cv_debtyp(f);

Expand All @@ -801,7 +801,7 @@ idx_t cv8_darray(type *t, idx_t etypidx)
break;

default:
id = "dArray";
id = t->Tident ? t->Tident : "dArray";
break;
}

Expand All @@ -815,7 +815,12 @@ idx_t cv8_darray(type *t, idx_t etypidx)
TOWORD(d->data + 18, 16); // size
cv_namestring(d->data + 20, id);

return cv_debtyp(d);
idx_t top = cv_numdebtypes();
idx_t debidx = cv_debtyp(d);
if(top != cv_numdebtypes())
cv8_udt(id, debidx);

return debidx;
}

/****************************************
Expand Down Expand Up @@ -852,15 +857,15 @@ idx_t cv8_ddelegate(type *t, idx_t functypidx)
TOLONG(d->data + 10, key); // void* type
TOLONG(d->data + 14, functypidx); // function type
#else
static const unsigned char fl[0x27] =
static const unsigned char fl[] =
{
0x03, 0x12, // LF_FIELDLIST_V2
0x0d, 0x15, // LF_MEMBER_V3
0x03, 0x00, // attribute
0x00, 0x00, 0x00, 0x00, // void*
0x00, 0x00, // offset
'p','t','r',0, // "ptr"
0xf3, 0xf2, 0xf1,
0xf2, 0xf1, // align to 4-byte including length word before data
0x0d, 0x15,
0x03, 0x00,
0x00, 0x00, 0x00, 0x00, // ptrtypidx
Expand All @@ -872,7 +877,7 @@ idx_t cv8_ddelegate(type *t, idx_t functypidx)
debtyp_t *f = debtyp_alloc(sizeof(fl));
memcpy(f->data,fl,sizeof(fl));
TOLONG(f->data + 6, pvidx);
TOLONG(f->data + 23, ptridx);
TOLONG(f->data + 22, ptridx);
idx_t fieldlist = cv_debtyp(f);

const char *id = "dDelegate";
Expand Down Expand Up @@ -928,7 +933,7 @@ idx_t cv8_daarray(type *t, idx_t keyidx, idx_t validx)
0x00, 0x00, 0x00, 0x00, // void*
0x00, 0x00, // offset
'p','t','r',0, // "ptr"
0xf3, 0xf2, 0xf1,
0xf2, 0xf1, // align to 4-byte including length word before data
};

debtyp_t *f = debtyp_alloc(sizeof(fl));
Expand All @@ -945,7 +950,7 @@ idx_t cv8_daarray(type *t, idx_t keyidx, idx_t validx)
TOLONG(d->data + 6, fieldlist);
TOLONG(d->data + 10, 0); // dList
TOLONG(d->data + 14, 0); // vtshape
TOWORD(d->data + 18, 16); // size
TOWORD(d->data + 18, NPTRSIZE); // size
cv_namestring(d->data + 20, id);

#endif
Expand Down
19 changes: 19 additions & 0 deletions src/backend/dt.c
Expand Up @@ -282,6 +282,24 @@ dt_t ** dtxoff(dt_t **pdtend,symbol *s,unsigned offset,tym_t ty)
return pdtend;
}

/*************************************
* Create a reference to another dt.
*/
dt_t **dtdtoff(dt_t **pdtend, dt_t *dt, unsigned offset)
{
type *t = type_alloc(TYint);
t->Tcount++;
Symbol *s = symbol_calloc("internal");
s->Sclass = SCstatic;
s->Sfl = FLextern;
s->Sflags |= SFLnodebug;
s->Stype = t;
s->Sdt = dt;
slist_add(s);
outdata(s);
return dtxoff(pdtend, s, offset);
}

/**************************
* 'Optimize' a list of dt_t's.
* (Try to collapse it into one DT_azeros object.)
Expand Down Expand Up @@ -382,4 +400,5 @@ void dt2common(dt_t **pdt)
(*pdt)->dt = DT_common;
}


#endif /* !SPP */
1 change: 1 addition & 0 deletions src/backend/dt.h
Expand Up @@ -18,6 +18,7 @@ dt_t **dtsize_t(dt_t **, unsigned long long value);
dt_t **dtnzeros(dt_t **pdtend,unsigned size);
dt_t **dtxoff(dt_t **pdtend,Symbol *s,unsigned offset,tym_t ty);
dt_t **dtxoff(dt_t **pdtend,Symbol *s,unsigned offset);
dt_t **dtdtoff(dt_t **pdtend, dt_t *dt, unsigned offset);
dt_t **dtcoff(dt_t **pdtend,unsigned offset);
dt_t ** dtcat(dt_t **pdtend,dt_t *dt);
void dt_optimize(dt_t *dt);
Expand Down
3 changes: 0 additions & 3 deletions src/constfold.c
Expand Up @@ -30,9 +30,6 @@

#ifdef IN_GCC
#include "d-gcc-real.h"

/* %% fix? */
extern "C" bool real_isnan (const real_t *);
#endif

static real_t zero; // work around DMC bug for now
Expand Down
3 changes: 0 additions & 3 deletions src/optimize.c
Expand Up @@ -27,9 +27,6 @@

#ifdef IN_GCC
#include "d-gcc-real.h"

/* %% fix? */
extern "C" bool real_isnan (const real_t *);
#endif

static real_t zero; // work around DMC bug for now
Expand Down
2 changes: 1 addition & 1 deletion src/root/port.c
Expand Up @@ -345,7 +345,7 @@ int Port::memicmp(const char *s1, const char *s2, int n)

int Port::stricmp(const char *s1, const char *s2)
{
return ::stricmp(s1, s2, n);
return ::stricmp(s1, s2);
}

#endif
Expand Down
3 changes: 3 additions & 0 deletions src/toctype.c
Expand Up @@ -84,7 +84,10 @@ type *TypeSArray::toCtype()
type *TypeDArray::toCtype()
{
if (!ctype)
{
ctype = type_dyn_array(next->toCtype());
ctype->Tident = toChars(); // needed to generate sensible debug info for cv8
}
return ctype;
}

Expand Down

0 comments on commit 736acba

Please sign in to comment.