Bug 517366 - NJ Merge: A Container assertion and more VMPI insulation, r=dvander.

This commit is contained in:
Graydon Hoare 2009-09-17 18:13:05 -07:00
parent b152e9656d
commit 16f6673674
5 changed files with 20 additions and 18 deletions

View File

@ -83,7 +83,7 @@ namespace nanojit
LInsp i = in->read();
const char* str = _names->formatIns(i);
char* cpy = new (_alloc) char[strlen(str)+1];
strcpy(cpy, str);
VMPI_strcpy(cpy, str);
_strs.insert(cpy);
return i;
}
@ -1478,15 +1478,15 @@ namespace nanojit
verbose_only(
if (_logc->lcbits & LC_Assembly) {
char* s = &outline[0];
memset(s, ' ', 51); s[51] = '\0';
s += strlen(s);
VMPI_memset(s, ' ', 51); s[51] = '\0';
s += VMPI_strlen(s);
sprintf(s, " SP ");
s += strlen(s);
s += VMPI_strlen(s);
for(uint32_t i=_activation.lowwatermark; i<_activation.tos;i++) {
LInsp ins = _activation.entry[i];
if (ins && ins !=_activation.entry[i+1]) {
sprintf(s, "%d(%s) ", 4*i, _thisfrag->lirbuf->names->formatRef(ins));
s += strlen(s);
s += VMPI_strlen(s);
}
}
output(&outline[0]);
@ -1496,16 +1496,16 @@ namespace nanojit
verbose_only(
char* s = &outline[0];
if (_logc->lcbits & LC_Assembly) {
memset(s, ' ', 51); s[51] = '\0';
s += strlen(s);
VMPI_memset(s, ' ', 51); s[51] = '\0';
s += VMPI_strlen(s);
sprintf(s, " ebp ");
s += strlen(s);
s += VMPI_strlen(s);
for(uint32_t i=_activation.lowwatermark; i<_activation.tos;i++) {
LInsp ins = _activation.entry[i];
if (ins) {
sprintf(s, "%d(%s) ", -4*i,_thisfrag->lirbuf->names->formatRef(ins));
s += strlen(s);
s += VMPI_strlen(s);
}
}
output(&outline[0]);
@ -1827,7 +1827,7 @@ namespace nanojit
// Add the EOL string to the output, ensuring that we leave enough
// space for the terminating NULL character, then reset it so it
// doesn't repeat on the next outputf.
strncat(outline, outlineEOL, sizeof(outline)-(outline_len+1));
VMPI_strncat(outline, outlineEOL, sizeof(outline)-(outline_len+1));
outlineEOL[0] = '\0';
output(outline);
@ -1838,7 +1838,7 @@ namespace nanojit
if (_outputCache)
{
char* str = new (alloc) char[VMPI_strlen(s)+1];
strcpy(str, s);
VMPI_strcpy(str, s);
_outputCache->insert(str);
}
else
@ -1855,7 +1855,7 @@ namespace nanojit
// Add the EOL string to the output, ensuring that we leave enough
// space for the terminating NULL character, then reset it so it
// doesn't repeat on the next outputf.
strncat(outline, outlineEOL, sizeof(outline)-(strlen(outline)+1));
VMPI_strncat(outline, outlineEOL, sizeof(outline)-(strlen(outline)+1));
outlineEOL[0] = '\0';
output(s);
@ -1863,9 +1863,9 @@ namespace nanojit
char* Assembler::outputAlign(char *s, int col)
{
int len = strlen(s);
int len = VMPI_strlen(s);
int add = ((col-len)>0) ? col-len : 1;
memset(&s[len], ' ', add);
VMPI_memset(&s[len], ' ', add);
s[col] = '\0';
return &s[col];
}

View File

@ -279,6 +279,7 @@ namespace nanojit
, nbuckets(nbuckets)
, buckets(new (a) Seq<Node>*[nbuckets])
{
NanoAssert(nbuckets > 0);
clear();
}

View File

@ -121,9 +121,9 @@ namespace nanojit {
if (_logc->lcbits & LC_Assembly) { \
outline[0]='\0'; \
if (outputAddr) \
sprintf(outline, "%010lx ", (unsigned long)_nIns); \
VMPI_sprintf(outline, "%010lx ", (unsigned long)_nIns); \
else \
memset(outline, (int)' ', 10+3); \
VMPI_memset(outline, (int)' ', 10+3); \
sprintf(&outline[13], ##__VA_ARGS__); \
Assembler::outputAlign(outline, 35); \
_allocator.formatRegisters(outline, _thisfrag); \

View File

@ -56,9 +56,9 @@ namespace nanojit
continue;
NanoAssertMsg(!isFree(r), "Coding error; register is both free and active! " );
s += strlen(s);
s += VMPI_strlen(s);
const char* rname = ins->isQuad() ? fpn(r) : gpn(r);
sprintf(s, " %s(%s)", rname, names->formatRef(ins));
VMPI_sprintf(s, " %s(%s)", rname, names->formatRef(ins));
}
}
#endif /* NJ_VERBOSE */

View File

@ -161,6 +161,7 @@ struct JSContext;
#define VMPI_strlen strlen
#define VMPI_strcat strcat
#define VMPI_strncat strncat
#define VMPI_strcpy strcpy
#define VMPI_sprintf sprintf
#define VMPI_memset memset