summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2007-09-14 18:03:29 -0700
committerH. Peter Anvin <hpa@zytor.com>2007-09-14 18:03:29 -0700
commit6244f4b5b920211f451ce739eea673ee653f32dc (patch)
treed1c101ea9951fa8c101eccacf2eb171801af85b2
parentcde08292d65072c6a3fec5ee0f0a304d5bdf301c (diff)
downloadnasm-6244f4b5b920211f451ce739eea673ee653f32dc.tar.gz
nasm-6244f4b5b920211f451ce739eea673ee653f32dc.tar.bz2
nasm-6244f4b5b920211f451ce739eea673ee653f32dc.zip
Use the new hash table function library to store labels
Use the new hash table function library to store labels. When compiling on my 64-bit system, it reduces the assembly time for the output of test/perf/label.pl from 73 to 7 seconds.
-rw-r--r--Makefile.in9
-rw-r--r--Mkfiles/Makefile.b326
-rw-r--r--Mkfiles/Makefile.bc36
-rw-r--r--Mkfiles/Makefile.bor6
-rw-r--r--Mkfiles/Makefile.dcp6
-rw-r--r--Mkfiles/Makefile.dj6
-rw-r--r--Mkfiles/Makefile.djo6
-rw-r--r--Mkfiles/Makefile.dl6
-rw-r--r--Mkfiles/Makefile.dos6
-rw-r--r--Mkfiles/Makefile.emx6
-rw-r--r--Mkfiles/Makefile.lcc6
-rw-r--r--Mkfiles/Makefile.ms76
-rw-r--r--Mkfiles/Makefile.os26
-rw-r--r--Mkfiles/Makefile.sc6
-rw-r--r--Mkfiles/Makefile.scw6
-rw-r--r--Mkfiles/Makefile.unx6
-rw-r--r--Mkfiles/Makefile.vc6
-rw-r--r--Mkfiles/Makefile.wc6
-rw-r--r--Mkfiles/Makefile.wcd6
-rw-r--r--Mkfiles/Makefile.wcw6
-rw-r--r--labels.c130
21 files changed, 164 insertions, 89 deletions
diff --git a/Makefile.in b/Makefile.in
index 476b7d8..130de2b 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -51,7 +51,8 @@ X = @EXEEXT@
$(NROFF) -man $< > $@
NASM = nasm.$(O) nasmlib.$(O) float.$(O) insnsa.$(O) assemble.$(O) \
- labels.$(O) parser.$(O) outform.$(O) output/outbin.$(O) \
+ labels.$(O) hashtbl.$(O) crc64.$(O) parser.$(O) \
+ outform.$(O) output/outbin.$(O) \
output/outaout.$(O) output/outcoff.$(O) \
output/outelf32.$(O) output/outelf64.$(O) \
output/outobj.$(O) output/outas86.$(O) output/outrdf2.$(O) \
@@ -208,15 +209,19 @@ alldeps: perlreq
#-- Everything below is generated by mkdep.pl - do not edit --#
assemble.$(O): assemble.c preproc.h insns.h pptok.h regs.h regflags.c \
config.h version.h nasmlib.h nasm.h regvals.c insnsi.h assemble.h
+crc64.$(O): crc64.c
disasm.$(O): disasm.c insns.h sync.h regdis.c regs.h config.h regs.c \
version.h nasm.h insnsn.c names.c insnsi.h disasm.h
eval.$(O): eval.c labels.h eval.h regs.h config.h version.h nasmlib.h nasm.h \
insnsi.h
float.$(O): float.c regs.h config.h version.h nasm.h insnsi.h
+hashtbl.$(O): hashtbl.c regs.h config.h version.h nasmlib.h hashtbl.h nasm.h \
+ insnsi.h
insnsa.$(O): insnsa.c insns.h regs.h config.h version.h nasm.h insnsi.h
insnsd.$(O): insnsd.c insns.h regs.h config.h version.h nasm.h insnsi.h
insnsn.$(O): insnsn.c
-labels.$(O): labels.c regs.h config.h version.h nasmlib.h nasm.h insnsi.h
+labels.$(O): labels.c regs.h config.h version.h hashtbl.h nasmlib.h nasm.h \
+ insnsi.h
listing.$(O): listing.c regs.h config.h version.h nasmlib.h nasm.h insnsi.h \
listing.h
macros.$(O): macros.c
diff --git a/Mkfiles/Makefile.b32 b/Mkfiles/Makefile.b32
index 8226f45..3d7f884 100644
--- a/Mkfiles/Makefile.b32
+++ b/Mkfiles/Makefile.b32
@@ -175,15 +175,19 @@ clean:
#-- Everything below is generated by mkdep.pl - do not edit --#
assemble.$(OBJ): assemble.c preproc.h insns.h pptok.h regs.h regflags.c \
config.h version.h nasmlib.h nasm.h regvals.c assemble.h insnsi.h
+crc64.$(OBJ): crc64.c
disasm.$(OBJ): disasm.c insns.h sync.h regdis.c regs.h config.h regs.c \
version.h nasm.h insnsn.c names.c insnsi.h disasm.h
eval.$(OBJ): eval.c labels.h eval.h regs.h config.h version.h nasmlib.h \
nasm.h insnsi.h
float.$(OBJ): float.c regs.h config.h version.h nasm.h insnsi.h
+hashtbl.$(OBJ): hashtbl.c regs.h config.h version.h nasmlib.h hashtbl.h \
+ nasm.h insnsi.h
insnsa.$(OBJ): insnsa.c insns.h regs.h config.h version.h nasm.h insnsi.h
insnsd.$(OBJ): insnsd.c insns.h regs.h config.h version.h nasm.h insnsi.h
insnsn.$(OBJ): insnsn.c
-labels.$(OBJ): labels.c regs.h config.h version.h nasmlib.h nasm.h insnsi.h
+labels.$(OBJ): labels.c regs.h config.h version.h hashtbl.h nasmlib.h nasm.h \
+ insnsi.h
listing.$(OBJ): listing.c regs.h config.h version.h nasmlib.h nasm.h \
insnsi.h listing.h
macros.$(OBJ): macros.c
diff --git a/Mkfiles/Makefile.bc3 b/Mkfiles/Makefile.bc3
index 5464e72..5ab7090 100644
--- a/Mkfiles/Makefile.bc3
+++ b/Mkfiles/Makefile.bc3
@@ -135,15 +135,19 @@ clean :
#-- Everything below is generated by mkdep.pl - do not edit --#
assemble.$(OBJ): assemble.c preproc.h insns.h pptok.h regs.h regflags.c \
config.h version.h nasmlib.h nasm.h regvals.c assemble.h insnsi.h
+crc64.$(OBJ): crc64.c
disasm.$(OBJ): disasm.c insns.h sync.h regdis.c regs.h config.h regs.c \
version.h nasm.h insnsn.c names.c insnsi.h disasm.h
eval.$(OBJ): eval.c labels.h eval.h regs.h config.h version.h nasmlib.h \
nasm.h insnsi.h
float.$(OBJ): float.c regs.h config.h version.h nasm.h insnsi.h
+hashtbl.$(OBJ): hashtbl.c regs.h config.h version.h nasmlib.h hashtbl.h \
+ nasm.h insnsi.h
insnsa.$(OBJ): insnsa.c insns.h regs.h config.h version.h nasm.h insnsi.h
insnsd.$(OBJ): insnsd.c insns.h regs.h config.h version.h nasm.h insnsi.h
insnsn.$(OBJ): insnsn.c
-labels.$(OBJ): labels.c regs.h config.h version.h nasmlib.h nasm.h insnsi.h
+labels.$(OBJ): labels.c regs.h config.h version.h hashtbl.h nasmlib.h nasm.h \
+ insnsi.h
listing.$(OBJ): listing.c regs.h config.h version.h nasmlib.h nasm.h \
insnsi.h listing.h
macros.$(OBJ): macros.c
diff --git a/Mkfiles/Makefile.bor b/Mkfiles/Makefile.bor
index 4d717a8..3288cbb 100644
--- a/Mkfiles/Makefile.bor
+++ b/Mkfiles/Makefile.bor
@@ -64,15 +64,19 @@ clean :
#-- Everything below is generated by mkdep.pl - do not edit --#
assemble.$(OBJ): assemble.c preproc.h insns.h pptok.h regs.h regflags.c \
config.h version.h nasmlib.h nasm.h regvals.c assemble.h insnsi.h
+crc64.$(OBJ): crc64.c
disasm.$(OBJ): disasm.c insns.h sync.h regdis.c regs.h config.h regs.c \
version.h nasm.h insnsn.c names.c insnsi.h disasm.h
eval.$(OBJ): eval.c labels.h eval.h regs.h config.h version.h nasmlib.h \
nasm.h insnsi.h
float.$(OBJ): float.c regs.h config.h version.h nasm.h insnsi.h
+hashtbl.$(OBJ): hashtbl.c regs.h config.h version.h nasmlib.h hashtbl.h \
+ nasm.h insnsi.h
insnsa.$(OBJ): insnsa.c insns.h regs.h config.h version.h nasm.h insnsi.h
insnsd.$(OBJ): insnsd.c insns.h regs.h config.h version.h nasm.h insnsi.h
insnsn.$(OBJ): insnsn.c
-labels.$(OBJ): labels.c regs.h config.h version.h nasmlib.h nasm.h insnsi.h
+labels.$(OBJ): labels.c regs.h config.h version.h hashtbl.h nasmlib.h nasm.h \
+ insnsi.h
listing.$(OBJ): listing.c regs.h config.h version.h nasmlib.h nasm.h \
insnsi.h listing.h
macros.$(OBJ): macros.c
diff --git a/Mkfiles/Makefile.dcp b/Mkfiles/Makefile.dcp
index 9c7d829..9810b4f 100644
--- a/Mkfiles/Makefile.dcp
+++ b/Mkfiles/Makefile.dcp
@@ -159,15 +159,19 @@ sync.o: sync.c sync.h
#-- Everything below is generated by mkdep.pl - do not edit --#
assemble.o: assemble.c preproc.h insns.h pptok.h regs.h regflags.c config.h \
version.h nasmlib.h nasm.h regvals.c assemble.h insnsi.h
+crc64.o: crc64.c
disasm.o: disasm.c insns.h sync.h regdis.c regs.h config.h regs.c version.h \
nasm.h insnsn.c names.c insnsi.h disasm.h
eval.o: eval.c labels.h eval.h regs.h config.h version.h nasmlib.h nasm.h \
insnsi.h
float.o: float.c regs.h config.h version.h nasm.h insnsi.h
+hashtbl.o: hashtbl.c regs.h config.h version.h nasmlib.h hashtbl.h nasm.h \
+ insnsi.h
insnsa.o: insnsa.c insns.h regs.h config.h version.h nasm.h insnsi.h
insnsd.o: insnsd.c insns.h regs.h config.h version.h nasm.h insnsi.h
insnsn.o: insnsn.c
-labels.o: labels.c regs.h config.h version.h nasmlib.h nasm.h insnsi.h
+labels.o: labels.c regs.h config.h version.h hashtbl.h nasmlib.h nasm.h \
+ insnsi.h
listing.o: listing.c regs.h config.h version.h nasmlib.h nasm.h insnsi.h \
listing.h
macros.o: macros.c
diff --git a/Mkfiles/Makefile.dj b/Mkfiles/Makefile.dj
index cc785c1..4b639f3 100644
--- a/Mkfiles/Makefile.dj
+++ b/Mkfiles/Makefile.dj
@@ -88,15 +88,19 @@ clean:
#-- Everything below is generated by mkdep.pl - do not edit --#
assemble.o: assemble.c preproc.h insns.h pptok.h regs.h regflags.c config.h \
version.h nasmlib.h nasm.h regvals.c assemble.h insnsi.h
+crc64.o: crc64.c
disasm.o: disasm.c insns.h sync.h regdis.c regs.h config.h regs.c version.h \
nasm.h insnsn.c names.c insnsi.h disasm.h
eval.o: eval.c labels.h eval.h regs.h config.h version.h nasmlib.h nasm.h \
insnsi.h
float.o: float.c regs.h config.h version.h nasm.h insnsi.h
+hashtbl.o: hashtbl.c regs.h config.h version.h nasmlib.h hashtbl.h nasm.h \
+ insnsi.h
insnsa.o: insnsa.c insns.h regs.h config.h version.h nasm.h insnsi.h
insnsd.o: insnsd.c insns.h regs.h config.h version.h nasm.h insnsi.h
insnsn.o: insnsn.c
-labels.o: labels.c regs.h config.h version.h nasmlib.h nasm.h insnsi.h
+labels.o: labels.c regs.h config.h version.h hashtbl.h nasmlib.h nasm.h \
+ insnsi.h
listing.o: listing.c regs.h config.h version.h nasmlib.h nasm.h insnsi.h \
listing.h
macros.o: macros.c
diff --git a/Mkfiles/Makefile.djo b/Mkfiles/Makefile.djo
index 7c5a3a3..821ce74 100644
--- a/Mkfiles/Makefile.djo
+++ b/Mkfiles/Makefile.djo
@@ -95,15 +95,19 @@ clean:
#-- Everything below is generated by mkdep.pl - do not edit --#
assemble.o: assemble.c preproc.h insns.h pptok.h regs.h regflags.c config.h \
version.h nasmlib.h nasm.h regvals.c assemble.h insnsi.h
+crc64.o: crc64.c
disasm.o: disasm.c insns.h sync.h regdis.c regs.h config.h regs.c version.h \
nasm.h insnsn.c names.c insnsi.h disasm.h
eval.o: eval.c labels.h eval.h regs.h config.h version.h nasmlib.h nasm.h \
insnsi.h
float.o: float.c regs.h config.h version.h nasm.h insnsi.h
+hashtbl.o: hashtbl.c regs.h config.h version.h nasmlib.h hashtbl.h nasm.h \
+ insnsi.h
insnsa.o: insnsa.c insns.h regs.h config.h version.h nasm.h insnsi.h
insnsd.o: insnsd.c insns.h regs.h config.h version.h nasm.h insnsi.h
insnsn.o: insnsn.c
-labels.o: labels.c regs.h config.h version.h nasmlib.h nasm.h insnsi.h
+labels.o: labels.c regs.h config.h version.h hashtbl.h nasmlib.h nasm.h \
+ insnsi.h
listing.o: listing.c regs.h config.h version.h nasmlib.h nasm.h insnsi.h \
listing.h
macros.o: macros.c
diff --git a/Mkfiles/Makefile.dl b/Mkfiles/Makefile.dl
index 99910c2..1d223b0 100644
--- a/Mkfiles/Makefile.dl
+++ b/Mkfiles/Makefile.dl
@@ -49,15 +49,19 @@ clean :
#-- Everything below is generated by mkdep.pl - do not edit --#
assemble.$(OBJ): assemble.c preproc.h insns.h pptok.h regs.h regflags.c \
config.h version.h nasmlib.h nasm.h regvals.c assemble.h insnsi.h
+crc64.$(OBJ): crc64.c
disasm.$(OBJ): disasm.c insns.h sync.h regdis.c regs.h config.h regs.c \
version.h nasm.h insnsn.c names.c insnsi.h disasm.h
eval.$(OBJ): eval.c labels.h eval.h regs.h config.h version.h nasmlib.h \
nasm.h insnsi.h
float.$(OBJ): float.c regs.h config.h version.h nasm.h insnsi.h
+hashtbl.$(OBJ): hashtbl.c regs.h config.h version.h nasmlib.h hashtbl.h \
+ nasm.h insnsi.h
insnsa.$(OBJ): insnsa.c insns.h regs.h config.h version.h nasm.h insnsi.h
insnsd.$(OBJ): insnsd.c insns.h regs.h config.h version.h nasm.h insnsi.h
insnsn.$(OBJ): insnsn.c
-labels.$(OBJ): labels.c regs.h config.h version.h nasmlib.h nasm.h insnsi.h
+labels.$(OBJ): labels.c regs.h config.h version.h hashtbl.h nasmlib.h nasm.h \
+ insnsi.h
listing.$(OBJ): listing.c regs.h config.h version.h nasmlib.h nasm.h \
insnsi.h listing.h
macros.$(OBJ): macros.c
diff --git a/Mkfiles/Makefile.dos b/Mkfiles/Makefile.dos
index e8e97e4..4d9abdb 100644
--- a/Mkfiles/Makefile.dos
+++ b/Mkfiles/Makefile.dos
@@ -62,15 +62,19 @@ clean :
#-- Everything below is generated by mkdep.pl - do not edit --#
assemble.$(OBJ): assemble.c preproc.h insns.h pptok.h regs.h regflags.c \
config.h version.h nasmlib.h nasm.h regvals.c assemble.h insnsi.h
+crc64.$(OBJ): crc64.c
disasm.$(OBJ): disasm.c insns.h sync.h regdis.c regs.h config.h regs.c \
version.h nasm.h insnsn.c names.c insnsi.h disasm.h
eval.$(OBJ): eval.c labels.h eval.h regs.h config.h version.h nasmlib.h \
nasm.h insnsi.h
float.$(OBJ): float.c regs.h config.h version.h nasm.h insnsi.h
+hashtbl.$(OBJ): hashtbl.c regs.h config.h version.h nasmlib.h hashtbl.h \
+ nasm.h insnsi.h
insnsa.$(OBJ): insnsa.c insns.h regs.h config.h version.h nasm.h insnsi.h
insnsd.$(OBJ): insnsd.c insns.h regs.h config.h version.h nasm.h insnsi.h
insnsn.$(OBJ): insnsn.c
-labels.$(OBJ): labels.c regs.h config.h version.h nasmlib.h nasm.h insnsi.h
+labels.$(OBJ): labels.c regs.h config.h version.h hashtbl.h nasmlib.h nasm.h \
+ insnsi.h
listing.$(OBJ): listing.c regs.h config.h version.h nasmlib.h nasm.h \
insnsi.h listing.h
macros.$(OBJ): macros.c
diff --git a/Mkfiles/Makefile.emx b/Mkfiles/Makefile.emx
index 473f9e4..94be77c 100644
--- a/Mkfiles/Makefile.emx
+++ b/Mkfiles/Makefile.emx
@@ -144,15 +144,19 @@ install_everything: everything install install_doc install_rdf
#-- Everything below is generated by mkdep.pl - do not edit --#
assemble.o: assemble.c preproc.h insns.h pptok.h regs.h regflags.c config.h \
version.h nasmlib.h nasm.h regvals.c assemble.h insnsi.h
+crc64.o: crc64.c
disasm.o: disasm.c insns.h sync.h regdis.c regs.h config.h regs.c version.h \
nasm.h insnsn.c names.c insnsi.h disasm.h
eval.o: eval.c labels.h eval.h regs.h config.h version.h nasmlib.h nasm.h \
insnsi.h
float.o: float.c regs.h config.h version.h nasm.h insnsi.h
+hashtbl.o: hashtbl.c regs.h config.h version.h nasmlib.h hashtbl.h nasm.h \
+ insnsi.h
insnsa.o: insnsa.c insns.h regs.h config.h version.h nasm.h insnsi.h
insnsd.o: insnsd.c insns.h regs.h config.h version.h nasm.h insnsi.h
insnsn.o: insnsn.c
-labels.o: labels.c regs.h config.h version.h nasmlib.h nasm.h insnsi.h
+labels.o: labels.c regs.h config.h version.h hashtbl.h nasmlib.h nasm.h \
+ insnsi.h
listing.o: listing.c regs.h config.h version.h nasmlib.h nasm.h insnsi.h \
listing.h
macros.o: macros.c
diff --git a/Mkfiles/Makefile.lcc b/Mkfiles/Makefile.lcc
index a3609ee..8809ade 100644
--- a/Mkfiles/Makefile.lcc
+++ b/Mkfiles/Makefile.lcc
@@ -115,15 +115,19 @@ clean:
#-- Everything below is generated by mkdep.pl - do not edit --#
assemble.${OBJ}: assemble.c preproc.h insns.h pptok.h regs.h regflags.c \
config.h version.h nasmlib.h nasm.h regvals.c assemble.h insnsi.h
+crc64.${OBJ}: crc64.c
disasm.${OBJ}: disasm.c insns.h sync.h regdis.c regs.h config.h regs.c \
version.h nasm.h insnsn.c names.c insnsi.h disasm.h
eval.${OBJ}: eval.c labels.h eval.h regs.h config.h version.h nasmlib.h \
nasm.h insnsi.h
float.${OBJ}: float.c regs.h config.h version.h nasm.h insnsi.h
+hashtbl.${OBJ}: hashtbl.c regs.h config.h version.h nasmlib.h hashtbl.h \
+ nasm.h insnsi.h
insnsa.${OBJ}: insnsa.c insns.h regs.h config.h version.h nasm.h insnsi.h
insnsd.${OBJ}: insnsd.c insns.h regs.h config.h version.h nasm.h insnsi.h
insnsn.${OBJ}: insnsn.c
-labels.${OBJ}: labels.c regs.h config.h version.h nasmlib.h nasm.h insnsi.h
+labels.${OBJ}: labels.c regs.h config.h version.h hashtbl.h nasmlib.h nasm.h \
+ insnsi.h
listing.${OBJ}: listing.c regs.h config.h version.h nasmlib.h nasm.h \
insnsi.h listing.h
macros.${OBJ}: macros.c
diff --git a/Mkfiles/Makefile.ms7 b/Mkfiles/Makefile.ms7
index 1b23a21..04a219e 100644
--- a/Mkfiles/Makefile.ms7
+++ b/Mkfiles/Makefile.ms7
@@ -158,15 +158,19 @@ spotless: clean
#-- Everything below is generated by mkdep.pl - do not edit --#
assemble.$(OBJ): assemble.c preproc.h insns.h pptok.h regs.h regflags.c \
config.h version.h nasmlib.h nasm.h regvals.c assemble.h insnsi.h
+crc64.$(OBJ): crc64.c
disasm.$(OBJ): disasm.c insns.h sync.h regdis.c regs.h config.h regs.c \
version.h nasm.h insnsn.c names.c insnsi.h disasm.h
eval.$(OBJ): eval.c labels.h eval.h regs.h config.h version.h nasmlib.h \
nasm.h insnsi.h
float.$(OBJ): float.c regs.h config.h version.h nasm.h insnsi.h
+hashtbl.$(OBJ): hashtbl.c regs.h config.h version.h nasmlib.h hashtbl.h \
+ nasm.h insnsi.h
insnsa.$(OBJ): insnsa.c insns.h regs.h config.h version.h nasm.h insnsi.h
insnsd.$(OBJ): insnsd.c insns.h regs.h config.h version.h nasm.h insnsi.h
insnsn.$(OBJ): insnsn.c
-labels.$(OBJ): labels.c regs.h config.h version.h nasmlib.h nasm.h insnsi.h
+labels.$(OBJ): labels.c regs.h config.h version.h hashtbl.h nasmlib.h nasm.h \
+ insnsi.h
listing.$(OBJ): listing.c regs.h config.h version.h nasmlib.h nasm.h \
insnsi.h listing.h
macros.$(OBJ): macros.c
diff --git a/Mkfiles/Makefile.os2 b/Mkfiles/Makefile.os2
index 7e0cb97..c29aef2 100644
--- a/Mkfiles/Makefile.os2
+++ b/Mkfiles/Makefile.os2
@@ -109,15 +109,19 @@ clean :
#-- Everything below is generated by mkdep.pl - do not edit --#
assemble.$(OBJ): assemble.c preproc.h insns.h pptok.h regs.h regflags.c \
config.h version.h nasmlib.h nasm.h regvals.c assemble.h insnsi.h
+crc64.$(OBJ): crc64.c
disasm.$(OBJ): disasm.c insns.h sync.h regdis.c regs.h config.h regs.c \
version.h nasm.h insnsn.c names.c insnsi.h disasm.h
eval.$(OBJ): eval.c labels.h eval.h regs.h config.h version.h nasmlib.h \
nasm.h insnsi.h
float.$(OBJ): float.c regs.h config.h version.h nasm.h insnsi.h
+hashtbl.$(OBJ): hashtbl.c regs.h config.h version.h nasmlib.h hashtbl.h \
+ nasm.h insnsi.h
insnsa.$(OBJ): insnsa.c insns.h regs.h config.h version.h nasm.h insnsi.h
insnsd.$(OBJ): insnsd.c insns.h regs.h config.h version.h nasm.h insnsi.h
insnsn.$(OBJ): insnsn.c
-labels.$(OBJ): labels.c regs.h config.h version.h nasmlib.h nasm.h insnsi.h
+labels.$(OBJ): labels.c regs.h config.h version.h hashtbl.h nasmlib.h nasm.h \
+ insnsi.h
listing.$(OBJ): listing.c regs.h config.h version.h nasmlib.h nasm.h \
insnsi.h listing.h
macros.$(OBJ): macros.c
diff --git a/Mkfiles/Makefile.sc b/Mkfiles/Makefile.sc
index a34e58d..c94233f 100644
--- a/Mkfiles/Makefile.sc
+++ b/Mkfiles/Makefile.sc
@@ -91,15 +91,19 @@ clean :
#-- Everything below is generated by mkdep.pl - do not edit --#
assemble.$(OBJ): assemble.c preproc.h insns.h pptok.h regs.h regflags.c \
config.h version.h nasmlib.h nasm.h regvals.c assemble.h insnsi.h
+crc64.$(OBJ): crc64.c
disasm.$(OBJ): disasm.c insns.h sync.h regdis.c regs.h config.h regs.c \
version.h nasm.h insnsn.c names.c insnsi.h disasm.h
eval.$(OBJ): eval.c labels.h eval.h regs.h config.h version.h nasmlib.h \
nasm.h insnsi.h
float.$(OBJ): float.c regs.h config.h version.h nasm.h insnsi.h
+hashtbl.$(OBJ): hashtbl.c regs.h config.h version.h nasmlib.h hashtbl.h \
+ nasm.h insnsi.h
insnsa.$(OBJ): insnsa.c insns.h regs.h config.h version.h nasm.h insnsi.h
insnsd.$(OBJ): insnsd.c insns.h regs.h config.h version.h nasm.h insnsi.h
insnsn.$(OBJ): insnsn.c
-labels.$(OBJ): labels.c regs.h config.h version.h nasmlib.h nasm.h insnsi.h
+labels.$(OBJ): labels.c regs.h config.h version.h hashtbl.h nasmlib.h nasm.h \
+ insnsi.h
listing.$(OBJ): listing.c regs.h config.h version.h nasmlib.h nasm.h \
insnsi.h listing.h
macros.$(OBJ): macros.c
diff --git a/Mkfiles/Makefile.scw b/Mkfiles/Makefile.scw
index cf28741..fb76378 100644
--- a/Mkfiles/Makefile.scw
+++ b/Mkfiles/Makefile.scw
@@ -88,15 +88,19 @@ clean :
#-- Everything below is generated by mkdep.pl - do not edit --#
assemble.$(OBJ): assemble.c preproc.h insns.h pptok.h regs.h regflags.c \
config.h version.h nasmlib.h nasm.h regvals.c assemble.h insnsi.h
+crc64.$(OBJ): crc64.c
disasm.$(OBJ): disasm.c insns.h sync.h regdis.c regs.h config.h regs.c \
version.h nasm.h insnsn.c names.c insnsi.h disasm.h
eval.$(OBJ): eval.c labels.h eval.h regs.h config.h version.h nasmlib.h \
nasm.h insnsi.h
float.$(OBJ): float.c regs.h config.h version.h nasm.h insnsi.h
+hashtbl.$(OBJ): hashtbl.c regs.h config.h version.h nasmlib.h hashtbl.h \
+ nasm.h insnsi.h
insnsa.$(OBJ): insnsa.c insns.h regs.h config.h version.h nasm.h insnsi.h
insnsd.$(OBJ): insnsd.c insns.h regs.h config.h version.h nasm.h insnsi.h
insnsn.$(OBJ): insnsn.c
-labels.$(OBJ): labels.c regs.h config.h version.h nasmlib.h nasm.h insnsi.h
+labels.$(OBJ): labels.c regs.h config.h version.h hashtbl.h nasmlib.h nasm.h \
+ insnsi.h
listing.$(OBJ): listing.c regs.h config.h version.h nasmlib.h nasm.h \
insnsi.h listing.h
macros.$(OBJ): macros.c
diff --git a/Mkfiles/Makefile.unx b/Mkfiles/Makefile.unx
index b3d01b5..32796d8 100644
--- a/Mkfiles/Makefile.unx
+++ b/Mkfiles/Makefile.unx
@@ -115,15 +115,19 @@ rdf_install install_rdf:
#-- Everything below is generated by mkdep.pl - do not edit --#
assemble.o: assemble.c preproc.h insns.h pptok.h regs.h regflags.c config.h \
version.h nasmlib.h nasm.h regvals.c assemble.h insnsi.h
+crc64.o: crc64.c
disasm.o: disasm.c insns.h sync.h regdis.c regs.h config.h regs.c version.h \
nasm.h insnsn.c names.c insnsi.h disasm.h
eval.o: eval.c labels.h eval.h regs.h config.h version.h nasmlib.h nasm.h \
insnsi.h
float.o: float.c regs.h config.h version.h nasm.h insnsi.h
+hashtbl.o: hashtbl.c regs.h config.h version.h nasmlib.h hashtbl.h nasm.h \
+ insnsi.h
insnsa.o: insnsa.c insns.h regs.h config.h version.h nasm.h insnsi.h
insnsd.o: insnsd.c insns.h regs.h config.h version.h nasm.h insnsi.h
insnsn.o: insnsn.c
-labels.o: labels.c regs.h config.h version.h nasmlib.h nasm.h insnsi.h
+labels.o: labels.c regs.h config.h version.h hashtbl.h nasmlib.h nasm.h \
+ insnsi.h
listing.o: listing.c regs.h config.h version.h nasmlib.h nasm.h insnsi.h \
listing.h
macros.o: macros.c
diff --git a/Mkfiles/Makefile.vc b/Mkfiles/Makefile.vc
index a3724a1..4713061 100644
--- a/Mkfiles/Makefile.vc
+++ b/Mkfiles/Makefile.vc
@@ -103,15 +103,19 @@ clean :
#-- Everything below is generated by mkdep.pl - do not edit --#
assemble.$(OBJ): assemble.c preproc.h insns.h pptok.h regs.h regflags.c \
config.h version.h nasmlib.h nasm.h regvals.c assemble.h insnsi.h
+crc64.$(OBJ): crc64.c
disasm.$(OBJ): disasm.c insns.h sync.h regdis.c regs.h config.h regs.c \
version.h nasm.h insnsn.c names.c insnsi.h disasm.h
eval.$(OBJ): eval.c labels.h eval.h regs.h config.h version.h nasmlib.h \
nasm.h insnsi.h
float.$(OBJ): float.c regs.h config.h version.h nasm.h insnsi.h
+hashtbl.$(OBJ): hashtbl.c regs.h config.h version.h nasmlib.h hashtbl.h \
+ nasm.h insnsi.h
insnsa.$(OBJ): insnsa.c insns.h regs.h config.h version.h nasm.h insnsi.h
insnsd.$(OBJ): insnsd.c insns.h regs.h config.h version.h nasm.h insnsi.h
insnsn.$(OBJ): insnsn.c
-labels.$(OBJ): labels.c regs.h config.h version.h nasmlib.h nasm.h insnsi.h
+labels.$(OBJ): labels.c regs.h config.h version.h hashtbl.h nasmlib.h nasm.h \
+ insnsi.h
listing.$(OBJ): listing.c regs.h config.h version.h nasmlib.h nasm.h \
insnsi.h listing.h
macros.$(OBJ): macros.c
diff --git a/Mkfiles/Makefile.wc b/Mkfiles/Makefile.wc
index 9683fd0..bcd79be 100644
--- a/Mkfiles/Makefile.wc
+++ b/Mkfiles/Makefile.wc
@@ -105,15 +105,19 @@ clean :
#-- Everything below is generated by mkdep.pl - do not edit --#
assemble.$(OBJ): assemble.c preproc.h insns.h pptok.h regs.h regflags.c \
config.h version.h nasmlib.h nasm.h regvals.c assemble.h insnsi.h
+crc64.$(OBJ): crc64.c
disasm.$(OBJ): disasm.c insns.h sync.h regdis.c regs.h config.h regs.c \
version.h nasm.h insnsn.c names.c insnsi.h disasm.h
eval.$(OBJ): eval.c labels.h eval.h regs.h config.h version.h nasmlib.h \
nasm.h insnsi.h
float.$(OBJ): float.c regs.h config.h version.h nasm.h insnsi.h
+hashtbl.$(OBJ): hashtbl.c regs.h config.h version.h nasmlib.h hashtbl.h \
+ nasm.h insnsi.h
insnsa.$(OBJ): insnsa.c insns.h regs.h config.h version.h nasm.h insnsi.h
insnsd.$(OBJ): insnsd.c insns.h regs.h config.h version.h nasm.h insnsi.h
insnsn.$(OBJ): insnsn.c
-labels.$(OBJ): labels.c regs.h config.h version.h nasmlib.h nasm.h insnsi.h
+labels.$(OBJ): labels.c regs.h config.h version.h hashtbl.h nasmlib.h nasm.h \
+ insnsi.h
listing.$(OBJ): listing.c regs.h config.h version.h nasmlib.h nasm.h \
insnsi.h listing.h
macros.$(OBJ): macros.c
diff --git a/Mkfiles/Makefile.wcd b/Mkfiles/Makefile.wcd
index a3d3f6f..716c137 100644
--- a/Mkfiles/Makefile.wcd
+++ b/Mkfiles/Makefile.wcd
@@ -90,15 +90,19 @@ clean : .SYMBOLIC
#-- Everything below is generated by mkdep.pl - do not edit --#
assemble.$(OBJ): assemble.c preproc.h insns.h pptok.h regs.h regflags.c \
config.h version.h nasmlib.h nasm.h regvals.c assemble.h insnsi.h
+crc64.$(OBJ): crc64.c
disasm.$(OBJ): disasm.c insns.h sync.h regdis.c regs.h config.h regs.c \
version.h nasm.h insnsn.c names.c insnsi.h disasm.h
eval.$(OBJ): eval.c labels.h eval.h regs.h config.h version.h nasmlib.h \
nasm.h insnsi.h
float.$(OBJ): float.c regs.h config.h version.h nasm.h insnsi.h
+hashtbl.$(OBJ): hashtbl.c regs.h config.h version.h nasmlib.h hashtbl.h \
+ nasm.h insnsi.h
insnsa.$(OBJ): insnsa.c insns.h regs.h config.h version.h nasm.h insnsi.h
insnsd.$(OBJ): insnsd.c insns.h regs.h config.h version.h nasm.h insnsi.h
insnsn.$(OBJ): insnsn.c
-labels.$(OBJ): labels.c regs.h config.h version.h nasmlib.h nasm.h insnsi.h
+labels.$(OBJ): labels.c regs.h config.h version.h hashtbl.h nasmlib.h nasm.h \
+ insnsi.h
listing.$(OBJ): listing.c regs.h config.h version.h nasmlib.h nasm.h \
insnsi.h listing.h
macros.$(OBJ): macros.c
diff --git a/Mkfiles/Makefile.wcw b/Mkfiles/Makefile.wcw
index 2800364..f7d2c3d 100644
--- a/Mkfiles/Makefile.wcw
+++ b/Mkfiles/Makefile.wcw
@@ -105,15 +105,19 @@ clean :
#-- Everything below is generated by mkdep.pl - do not edit --#
assemble.$(OBJ): assemble.c preproc.h insns.h pptok.h regs.h regflags.c \
config.h version.h nasmlib.h nasm.h regvals.c assemble.h insnsi.h
+crc64.$(OBJ): crc64.c
disasm.$(OBJ): disasm.c insns.h sync.h regdis.c regs.h config.h regs.c \
version.h nasm.h insnsn.c names.c insnsi.h disasm.h
eval.$(OBJ): eval.c labels.h eval.h regs.h config.h version.h nasmlib.h \
nasm.h insnsi.h
float.$(OBJ): float.c regs.h config.h version.h nasm.h insnsi.h
+hashtbl.$(OBJ): hashtbl.c regs.h config.h version.h nasmlib.h hashtbl.h \
+ nasm.h insnsi.h
insnsa.$(OBJ): insnsa.c insns.h regs.h config.h version.h nasm.h insnsi.h
insnsd.$(OBJ): insnsd.c insns.h regs.h config.h version.h nasm.h insnsi.h
insnsn.$(OBJ): insnsn.c
-labels.$(OBJ): labels.c regs.h config.h version.h nasmlib.h nasm.h insnsi.h
+labels.$(OBJ): labels.c regs.h config.h version.h hashtbl.h nasmlib.h nasm.h \
+ insnsi.h
listing.$(OBJ): listing.c regs.h config.h version.h nasmlib.h nasm.h \
insnsi.h listing.h
macros.$(OBJ): macros.c
diff --git a/labels.c b/labels.c
index 6aae981..00b443b 100644
--- a/labels.c
+++ b/labels.c
@@ -13,6 +13,7 @@
#include "nasm.h"
#include "nasmlib.h"
+#include "hashtbl.h"
/*
* A local label is one that begins with exactly one period. Things
@@ -31,9 +32,8 @@
((c) == '.' || (c) == '@') : \
((c) == '.'))
-#define LABEL_BLOCK 32 /* no. of labels/block */
+#define LABEL_BLOCK 128 /* no. of labels/block */
#define LBLK_SIZE (LABEL_BLOCK*sizeof(union label))
-#define LABEL_HASHES 37 /* no. of hash table entries */
#define END_LIST -3 /* don't clash with NO_SEG! */
#define END_BLOCK -2
@@ -75,8 +75,9 @@ struct permts { /* permanent text storage */
extern int global_offset_changed; /* defined in nasm.c */
-static union label *ltab[LABEL_HASHES]; /* using a hash table */
-static union label *lfree[LABEL_HASHES]; /* pointer into the above */
+static struct hash_table *ltab; /* labels hash table */
+static union label *ldata; /* all label data blocks */
+static union label *lfree; /* labels free block */
static struct permts *perm_head; /* start of perm. text storage */
static struct permts *perm_tail; /* end of perm. text storage */
@@ -97,53 +98,50 @@ char lpostfix[PREFIX_MAX] = { 0 };
*/
static union label *find_label(char *label, int create)
{
- int hash = 0;
- char *p, *prev;
- int prevlen;
+ char *prev;
+ int prevlen, len;
union label *lptr;
+ char label_str[IDLEN_MAX];
+ struct hash_insert ip;
- if (islocal(label))
+ if (islocal(label)) {
prev = prevlabel;
- else
+ prevlen = strlen(prev);
+ len = strlen(label);
+ if (prevlen+len >= IDLEN_MAX)
+ return NULL; /* Error... */
+ memcpy(label_str, prev, prevlen);
+ memcpy(label_str+prevlen, label, len);
+ label_str[len += prevlen] = '\0';
+ label = label_str;
+ } else {
prev = "";
- prevlen = strlen(prev);
- p = prev;
- while (*p)
- hash += *p++;
- p = label;
- while (*p)
- hash += *p++;
- hash %= LABEL_HASHES;
- lptr = ltab[hash];
- while (lptr->admin.movingon != END_LIST) {
- if (lptr->admin.movingon == END_BLOCK) {
- lptr = lptr->admin.next;
- if (!lptr)
- break;
- }
- if (!strncmp(lptr->defn.label, prev, prevlen) &&
- !strcmp(lptr->defn.label + prevlen, label))
- return lptr;
- lptr++;
+ prevlen = 0;
}
- if (create) {
- if (lfree[hash]->admin.movingon == END_BLOCK) {
- /*
- * must allocate a new block
- */
- lfree[hash]->admin.next =
- (union label *)nasm_malloc(LBLK_SIZE);
- lfree[hash] = lfree[hash]->admin.next;
- init_block(lfree[hash]);
- }
- lfree[hash]->admin.movingon = BOGUS_VALUE;
- lfree[hash]->defn.label = perm_copy(prev, label);
- lfree[hash]->defn.special = NULL;
- lfree[hash]->defn.is_global = NOT_DEFINED_YET;
- return lfree[hash]++;
- } else
- return NULL;
+ lptr = hash_find(ltab, label, &ip);
+
+ if (lptr || !create)
+ return lptr;
+
+ /* Create a new label... */
+ if (lfree->admin.movingon == END_BLOCK) {
+ /*
+ * must allocate a new block
+ */
+ lfree->admin.next =
+ (union label *)nasm_malloc(LBLK_SIZE);
+ lfree = lfree->admin.next;
+ init_block(lfree);
+ }
+
+ lfree->admin.movingon = BOGUS_VALUE;
+ lfree->defn.label = perm_copy(prev, label);
+ lfree->defn.special = NULL;
+ lfree->defn.is_global = NOT_DEFINED_YET;
+
+ hash_add(&ip, lfree->defn.label, lfree);
+ return lfree++;
}
int lookup_label(char *label, int32_t *segment, int32_t *offset)
@@ -372,22 +370,14 @@ void declare_as_global(char *label, char *special, efunc error)
int init_labels(void)
{
- int i;
-
- for (i = 0; i < LABEL_HASHES; i++) {
- ltab[i] = (union label *)nasm_malloc(LBLK_SIZE);
- if (!ltab[i])
- return -1; /* can't initialise, panic */
- init_block(ltab[i]);
- lfree[i] = ltab[i];
- }
+ ltab = hash_init();
+
+ ldata = lfree = (union label *)nasm_malloc(LBLK_SIZE);
+ init_block(lfree);
perm_head =
perm_tail = (struct permts *)nasm_malloc(sizeof(struct permts));
- if (!perm_head)
- return -1;
-
perm_head->next = NULL;
perm_head->size = PERMTS_SIZE;
perm_head->usage = 0;
@@ -399,24 +389,28 @@ int init_labels(void)
return 0;
}
+static void cleanup_hashed_label(char *key, void *data)
+{
+ /* The key is part of the permanent string storage */
+ /* The data is part of the ldata chain */
+ (void)key; (void)data;
+}
+
void cleanup_labels(void)
{
- int i;
+ union label *lptr, *lhold;
initialized = FALSE;
- for (i = 0; i < LABEL_HASHES; i++) {
- union label *lptr, *lhold;
+ hash_free(ltab, cleanup_hashed_label);
- lptr = lhold = ltab[i];
- while (lptr) {
- while (lptr->admin.movingon != END_BLOCK)
- lptr++;
- lptr = lptr->admin.next;
- nasm_free(lhold);
- lhold = lptr;
- }
+ lptr = lhold = ldata;
+ while (lptr) {
+ lptr = &lptr[LABEL_BLOCK-1];
+ lptr = lptr->admin.next;
+ nasm_free(lhold);
+ lhold = lptr;
}
while (perm_head) {