aboutsummaryrefslogtreecommitdiff
path: root/i386-asm.c
diff options
context:
space:
mode:
authorVlad Vissoultchev <wqweto@gmail.com>2016-04-17 16:37:23 +0300
committerVlad Vissoultchev <wqweto@gmail.com>2016-04-17 17:25:55 +0300
commit224236f57c7d645c9b23d717de354df5d12b98b6 (patch)
tree27299b0ac2b9ec69d519c87bd5d8f5842346e0df /i386-asm.c
parentacc8f602e57d69e6e36c417b7b360b6dd685b64e (diff)
downloadtinycc-224236f57c7d645c9b23d717de354df5d12b98b6.tar.gz
tinycc-224236f57c7d645c9b23d717de354df5d12b98b6.tar.bz2
Improve hash performance
- better `TOK_HASH_FUNC` - increases `hash_ident` initial size to 16k (from 8k) - `cstr_cat` uses single `realloc` + `memcpy` - `cstr_cat` can append terminating zero - `tok_str_realloc` initial size to 16 (from 8) - `parse_define` uses static `tokstr_buf` - `next` uses static `tokstr_buf` - fixes two latent bugs (wrong deallocations in libtcc.c:482 and tccpp.c:2987)
Diffstat (limited to 'i386-asm.c')
-rw-r--r--i386-asm.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/i386-asm.c b/i386-asm.c
index 68a7861..772b74a 100644
--- a/i386-asm.c
+++ b/i386-asm.c
@@ -1300,7 +1300,7 @@ ST_FUNC void subst_asm_operand(CString *add_str,
if (!(r & VT_LVAL) && modifier != 'c' && modifier != 'n')
cstr_ccat(add_str, '$');
if (r & VT_SYM) {
- cstr_cat(add_str, get_tok_str(sv->sym->v, NULL));
+ cstr_cat(add_str, get_tok_str(sv->sym->v, NULL), -1);
if ((uint32_t)sv->c.i != 0) {
cstr_ccat(add_str, '+');
} else {
@@ -1311,17 +1311,17 @@ ST_FUNC void subst_asm_operand(CString *add_str,
if (modifier == 'n')
val = -val;
snprintf(buf, sizeof(buf), "%d", (int)sv->c.i);
- cstr_cat(add_str, buf);
+ cstr_cat(add_str, buf, -1);
} else if ((r & VT_VALMASK) == VT_LOCAL) {
snprintf(buf, sizeof(buf), "%d(%%ebp)", (int)sv->c.i);
- cstr_cat(add_str, buf);
+ cstr_cat(add_str, buf, -1);
} else if (r & VT_LVAL) {
reg = r & VT_VALMASK;
if (reg >= VT_CONST)
tcc_error("internal compiler error");
snprintf(buf, sizeof(buf), "(%%%s)",
get_tok_str(TOK_ASM_eax + reg, NULL));
- cstr_cat(add_str, buf);
+ cstr_cat(add_str, buf, -1);
} else {
/* register case */
reg = r & VT_VALMASK;
@@ -1378,7 +1378,7 @@ ST_FUNC void subst_asm_operand(CString *add_str,
#endif
}
snprintf(buf, sizeof(buf), "%%%s", get_tok_str(reg, NULL));
- cstr_cat(add_str, buf);
+ cstr_cat(add_str, buf, -1);
}
}