aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornop <nop>1998-02-19 07:36:16 +0000
committernop <nop>1998-02-19 07:36:16 +0000
commitfa306b4cdc64de192c8b034fe8167711799a07a2 (patch)
tree65bab613eb810fd4fe95458d08d20bc0315a65c2
parenta436cce6d579cd02570b7bca4ea400c9471028f1 (diff)
downloadmoo-cvs-fa306b4cdc64de192c8b034fe8167711799a07a2.tar.gz
moo-cvs-fa306b4cdc64de192c8b034fe8167711799a07a2.tar.xz
moo-cvs-fa306b4cdc64de192c8b034fe8167711799a07a2.zip
Initial string interning during db load.ROGUE.INTERN
-rw-r--r--Makefile.in357
-rw-r--r--code_gen.c19
-rw-r--r--db_file.c18
-rw-r--r--db_io.c24
-rw-r--r--db_io.h13
-rw-r--r--execute.c13
-rw-r--r--storage.h8
-rw-r--r--str_intern.c257
-rw-r--r--str_intern.h25
9 files changed, 550 insertions, 184 deletions
diff --git a/Makefile.in b/Makefile.in
index b693a29..d1d07ed 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -29,7 +29,7 @@ CSRCS = ast.c code_gen.c db_file.c db_io.c db_objects.c db_properties.c \
exceptions.c execute.c extensions.c functions.c keywords.c list.c \
log.c malloc.c match.c md5.c name_lookup.c network.c net_mplex.c \
net_proto.c numbers.c objects.c parse_cmd.c pattern.c program.c \
- property.c quota.c ref_count.c regexpr.c server.c storage.c streams.c \
+ property.c quota.c ref_count.c regexpr.c server.c storage.c streams.c str_intern.c \
sym_table.c tasks.c timers.c unparse.c utils.c verbs.c version.c
OPT_NET_SRCS = net_single.c net_multi.c \
@@ -47,7 +47,7 @@ HDRS = ast.h bf_register.h code_gen.h db.h db_io.h db_private.h decompile.h \
getpagesize.h keywords.h list.h log.h match.h md5.h name_lookup.h \
network.h net_mplex.h net_multi.h net_proto.h numbers.h opcode.h \
options.h parse_cmd.h parser.h pattern.h program.h quota.h random.h \
- ref_count.h regexpr.h server.h storage.h streams.h structures.h \
+ ref_count.h regexpr.h server.h storage.h streams.h structures.h str_intern.h \
sym_table.h tasks.h timers.h tokens.h unparse.h utils.h verbs.h \
version.h
@@ -149,6 +149,9 @@ depend: ${ALL_CSRCS}
###############################################################################
# $Log$
+# Revision 1.5 1998/02/19 07:36:16 nop
+# Initial string interning during db load.
+#
# Revision 1.4 1997/03/03 06:36:23 nop
# clean target doesn't force reconfiguration; distclean now does.
#
@@ -292,165 +295,191 @@ $(OPT_NET_OBJS):
touch $@
# DO NOT DELETE THIS LINE -- 'make depend' replaces everything below it.
-ast.o : ast.c my-string.h config.h ast.h parser.h program.h structures.h my-stdio.h \
- my-types.h my-stdarg.h version.h sym_table.h list.h log.h storage.h utils.h \
- execute.h db.h opcode.h parse_cmd.h
-code_gen.o : code_gen.c ast.h config.h parser.h program.h structures.h my-stdio.h \
- my-types.h my-stdarg.h version.h sym_table.h exceptions.h opcode.h storage.h \
- utils.h execute.h db.h parse_cmd.h
-db_file.o : db_file.c my-stat.h config.h my-stdio.h my-types.h my-stdarg.h my-stdlib.h \
- db.h program.h structures.h version.h db_io.h db_private.h exceptions.h list.h \
- log.h options.h server.h network.h storage.h streams.h tasks.h execute.h opcode.h \
- parse_cmd.h timers.h my-time.h
-db_io.o : db_io.c my-ctype.h config.h my-stdarg.h my-stdio.h my-types.h my-stdlib.h \
- db_io.h program.h structures.h version.h db_private.h exceptions.h list.h log.h \
- numbers.h parser.h storage.h streams.h unparse.h
-db_objects.o : db_objects.c config.h db.h program.h structures.h my-stdio.h \
- my-types.h my-stdarg.h version.h db_private.h exceptions.h list.h storage.h \
- utils.h execute.h opcode.h parse_cmd.h
-db_properties.o : db_properties.c config.h db.h program.h structures.h my-stdio.h \
- my-types.h my-stdarg.h version.h db_private.h exceptions.h list.h storage.h \
- utils.h execute.h opcode.h parse_cmd.h
-db_verbs.o : db_verbs.c my-stdlib.h config.h my-string.h db.h program.h structures.h \
- my-stdio.h my-types.h my-stdarg.h version.h db_private.h exceptions.h parse_cmd.h \
- storage.h utils.h execute.h opcode.h
-decompile.o : decompile.c ast.h config.h parser.h program.h structures.h my-stdio.h \
- my-types.h my-stdarg.h version.h sym_table.h decompile.h exceptions.h opcode.h \
- storage.h utils.h execute.h db.h parse_cmd.h
-disassemble.o : disassemble.c my-stdio.h config.h my-types.h my-stdarg.h bf_register.h \
- db.h program.h structures.h version.h functions.h execute.h opcode.h parse_cmd.h \
- list.h storage.h streams.h unparse.h utils.h verbs.h
-eval_env.o : eval_env.c config.h eval_env.h structures.h my-stdio.h my-types.h \
- my-stdarg.h version.h storage.h sym_table.h utils.h execute.h db.h program.h \
- opcode.h parse_cmd.h
-eval_vm.o : eval_vm.c config.h db_io.h program.h structures.h my-stdio.h my-types.h \
- my-stdarg.h version.h decompile.h ast.h parser.h sym_table.h eval_vm.h execute.h \
- db.h opcode.h parse_cmd.h log.h options.h storage.h tasks.h
-exceptions.o : exceptions.c exceptions.h config.h
-execute.o : execute.c my-string.h config.h db.h program.h structures.h my-stdio.h \
- my-types.h my-stdarg.h version.h db_io.h decompile.h ast.h parser.h sym_table.h \
- eval_env.h eval_vm.h execute.h opcode.h parse_cmd.h exceptions.h functions.h \
- list.h log.h numbers.h options.h server.h network.h storage.h streams.h tasks.h \
- timers.h my-time.h utils.h
-extensions.o : extensions.c bf_register.h functions.h my-stdio.h config.h my-types.h \
- my-stdarg.h execute.h db.h program.h structures.h version.h opcode.h parse_cmd.h
-functions.o : functions.c my-stdarg.h config.h bf_register.h db_io.h program.h \
- structures.h my-stdio.h my-types.h version.h functions.h execute.h db.h opcode.h \
- parse_cmd.h list.h log.h server.h network.h options.h storage.h streams.h unparse.h \
- utils.h
-keywords.o : keywords.c my-ctype.h config.h my-string.h keywords.h structures.h \
- my-stdio.h my-types.h my-stdarg.h version.h tokens.h ast.h parser.h program.h \
- sym_table.h y.tab.h utils.h execute.h db.h opcode.h parse_cmd.h
-list.o : list.c my-ctype.h config.h my-string.h bf_register.h exceptions.h functions.h \
- my-stdio.h my-types.h my-stdarg.h execute.h db.h program.h structures.h version.h \
- opcode.h parse_cmd.h list.h log.h md5.h options.h pattern.h random.h ref_count.h \
- streams.h storage.h unparse.h utils.h
-log.o : log.c my-stdarg.h config.h my-stdio.h my-types.h my-string.h my-time.h \
- bf_register.h functions.h execute.h db.h program.h structures.h version.h opcode.h \
- parse_cmd.h log.h options.h storage.h streams.h utils.h
-malloc.o : malloc.c options.h config.h
-match.o : match.c my-stdlib.h config.h my-string.h db.h program.h structures.h \
- my-stdio.h my-types.h my-stdarg.h version.h exceptions.h match.h parse_cmd.h \
- storage.h unparse.h utils.h execute.h opcode.h
-md5.o : md5.c my-string.h config.h md5.h
-name_lookup.o : name_lookup.c options.h config.h my-signal.h my-stdlib.h my-unistd.h \
- my-inet.h my-in.h my-types.h my-socket.h my-wait.h my-string.h log.h my-stdio.h \
- my-stdarg.h structures.h server.h network.h storage.h timers.h my-time.h
-network.o : network.c options.h config.h net_multi.c my-ctype.h my-fcntl.h my-ioctl.h \
- my-signal.h my-stdio.h my-types.h my-stdarg.h my-stdlib.h my-string.h my-unistd.h \
- exceptions.h list.h structures.h log.h net_mplex.h net_multi.h net_proto.h network.h \
- server.h streams.h storage.h timers.h my-time.h utils.h execute.h db.h program.h \
- version.h opcode.h parse_cmd.h
-net_mplex.o : net_mplex.c options.h config.h net_mp_selct.c my-string.h my-sys-time.h \
- my-types.h log.h my-stdio.h my-stdarg.h structures.h net_mplex.h
-net_proto.o : net_proto.c options.h config.h net_bsd_tcp.c my-inet.h my-in.h \
- my-types.h my-socket.h my-stdlib.h my-string.h my-unistd.h list.h structures.h \
- my-stdio.h my-stdarg.h log.h name_lookup.h net_proto.h server.h network.h streams.h \
- timers.h my-time.h utils.h execute.h db.h program.h version.h opcode.h parse_cmd.h
-numbers.o : numbers.c my-math.h my-stdlib.h config.h my-string.h my-time.h my-types.h \
- functions.h my-stdio.h my-stdarg.h execute.h db.h program.h structures.h version.h \
- opcode.h parse_cmd.h log.h random.h storage.h utils.h
-objects.o : objects.c db.h config.h program.h structures.h my-stdio.h my-types.h \
- my-stdarg.h version.h db_io.h exceptions.h execute.h opcode.h parse_cmd.h functions.h \
- list.h numbers.h quota.h server.h network.h options.h storage.h utils.h
-parse_cmd.o : parse_cmd.c my-ctype.h config.h my-stdio.h my-types.h my-stdarg.h \
- my-stdlib.h my-string.h my-time.h db.h program.h structures.h version.h list.h \
- match.h parse_cmd.h storage.h utils.h execute.h opcode.h
-pattern.o : pattern.c my-ctype.h config.h my-stdlib.h my-string.h pattern.h \
- regexpr.h storage.h structures.h my-stdio.h my-types.h my-stdarg.h streams.h
-program.o : program.c ast.h config.h parser.h program.h structures.h my-stdio.h \
- my-types.h my-stdarg.h version.h sym_table.h exceptions.h list.h storage.h utils.h \
- execute.h db.h opcode.h parse_cmd.h
-property.o : property.c db.h config.h program.h structures.h my-stdio.h my-types.h \
- my-stdarg.h version.h functions.h execute.h opcode.h parse_cmd.h list.h storage.h \
- utils.h
-quota.o : quota.c config.h db.h program.h structures.h my-stdio.h my-types.h \
- my-stdarg.h version.h quota.h
-ref_count.o : ref_count.c config.h exceptions.h ref_count.h storage.h structures.h \
- my-stdio.h my-types.h my-stdarg.h
-regexpr.o : regexpr.c my-stdio.h config.h my-types.h my-stdarg.h regexpr.h my-stdlib.h \
- my-string.h
-server.o : server.c my-types.h config.h my-signal.h my-stdarg.h my-stdio.h my-stdlib.h \
- my-string.h my-unistd.h my-wait.h db.h program.h structures.h version.h db_io.h \
- disassemble.h execute.h opcode.h parse_cmd.h functions.h list.h log.h network.h \
- options.h server.h parser.h random.h storage.h streams.h tasks.h timers.h my-time.h \
- unparse.h utils.h
-storage.o : storage.c my-stdlib.h config.h exceptions.h list.h structures.h \
- my-stdio.h my-types.h my-stdarg.h options.h ref_count.h storage.h
-streams.o : streams.c my-stdarg.h config.h my-string.h my-stdio.h my-types.h \
- log.h structures.h storage.h streams.h
-sym_table.o : sym_table.c my-stdio.h config.h my-types.h my-stdarg.h ast.h parser.h \
- program.h structures.h version.h sym_table.h exceptions.h log.h storage.h utils.h \
- execute.h db.h opcode.h parse_cmd.h
-tasks.o : tasks.c my-string.h config.h my-time.h my-types.h db.h program.h structures.h \
- my-stdio.h my-stdarg.h version.h db_io.h decompile.h ast.h parser.h sym_table.h \
- eval_env.h eval_vm.h execute.h opcode.h parse_cmd.h exceptions.h functions.h \
- list.h log.h match.h options.h random.h server.h network.h storage.h streams.h \
- tasks.h utils.h verbs.h
-timers.o : timers.c my-signal.h config.h my-stdlib.h my-sys-time.h options.h \
- my-types.h my-time.h my-unistd.h timers.h
-unparse.o : unparse.c my-ctype.h config.h my-stdio.h my-types.h my-stdarg.h \
- ast.h parser.h program.h structures.h version.h sym_table.h decompile.h exceptions.h \
- functions.h execute.h db.h opcode.h parse_cmd.h keywords.h list.h log.h unparse.h \
- storage.h streams.h utils.h
-utils.o : utils.c my-ctype.h config.h my-stdio.h my-types.h my-stdarg.h my-string.h \
- db.h program.h structures.h version.h db_io.h exceptions.h list.h log.h match.h \
- numbers.h ref_count.h server.h network.h options.h storage.h streams.h utils.h \
- execute.h opcode.h parse_cmd.h
-verbs.o : verbs.c my-string.h config.h db.h program.h structures.h my-stdio.h \
- my-types.h my-stdarg.h version.h exceptions.h execute.h opcode.h parse_cmd.h \
- functions.h list.h log.h match.h parser.h server.h network.h options.h storage.h \
- unparse.h utils.h verbs.h
-version.o : version.c config.h version.h
-gnu-malloc.o : gnu-malloc.c getpagesize.h
-net_single.o : net_single.c my-ctype.h config.h my-fcntl.h my-stdio.h my-types.h \
- my-stdarg.h my-unistd.h log.h structures.h network.h options.h server.h streams.h \
- utils.h execute.h db.h program.h version.h opcode.h parse_cmd.h
-net_multi.o : net_multi.c my-ctype.h config.h my-fcntl.h my-ioctl.h my-signal.h \
- my-stdio.h my-types.h my-stdarg.h my-stdlib.h my-string.h my-unistd.h exceptions.h \
- list.h structures.h log.h net_mplex.h net_multi.h net_proto.h options.h network.h \
- server.h streams.h storage.h timers.h my-time.h utils.h execute.h db.h program.h \
- version.h opcode.h parse_cmd.h
-net_mp_selct.o : net_mp_selct.c my-string.h config.h my-sys-time.h options.h \
- my-types.h log.h my-stdio.h my-stdarg.h structures.h net_mplex.h
-net_mp_poll.o : net_mp_poll.c my-poll.h config.h log.h my-stdio.h my-types.h \
- my-stdarg.h structures.h net_mplex.h storage.h
-net_bsd_tcp.o : net_bsd_tcp.c my-inet.h config.h my-in.h my-types.h my-socket.h \
- my-stdlib.h my-string.h my-unistd.h list.h structures.h my-stdio.h my-stdarg.h \
- log.h name_lookup.h net_proto.h options.h server.h network.h streams.h timers.h \
- my-time.h utils.h execute.h db.h program.h version.h opcode.h parse_cmd.h
-net_bsd_lcl.o : net_bsd_lcl.c my-socket.h config.h my-types.h my-stdio.h my-stdarg.h \
- my-string.h my-unistd.h log.h structures.h net_proto.h options.h storage.h utils.h \
- execute.h db.h program.h version.h opcode.h parse_cmd.h
-net_sysv_tcp.o : net_sysv_tcp.c my-inet.h config.h my-in.h my-types.h my-fcntl.h \
- my-ioctl.h my-socket.h my-stdlib.h my-string.h my-stropts.h my-tiuser.h my-unistd.h \
- log.h my-stdio.h my-stdarg.h structures.h name_lookup.h net_proto.h options.h \
- server.h network.h streams.h timers.h my-time.h
-net_sysv_lcl.o : net_sysv_lcl.c my-fcntl.h config.h my-stat.h my-stdio.h my-types.h \
- my-stdarg.h my-stdlib.h my-unistd.h exceptions.h list.h structures.h log.h net_multi.h \
- net_proto.h options.h storage.h streams.h utils.h execute.h db.h program.h version.h \
- opcode.h parse_cmd.h
-client_bsd.o : client_bsd.c my-socket.h config.h my-types.h my-stdio.h my-stdarg.h \
- my-stdlib.h my-string.h my-sys-time.h options.h my-unistd.h
-client_sysv.o : client_sysv.c my-fcntl.h config.h my-signal.h my-stdio.h my-types.h \
- my-stdarg.h my-stdlib.h my-string.h my-stat.h my-unistd.h options.h
+ast.o: ast.c my-string.h config.h ast.h parser.h program.h \
+ structures.h my-stdio.h version.h sym_table.h list.h log.h storage.h \
+ ref_count.h utils.h execute.h db.h opcode.h parse_cmd.h
+code_gen.o: code_gen.c ast.h config.h parser.h program.h structures.h \
+ my-stdio.h version.h sym_table.h exceptions.h opcode.h storage.h \
+ ref_count.h str_intern.h utils.h execute.h db.h parse_cmd.h
+db_file.o: db_file.c my-stat.h config.h my-stdio.h my-stdlib.h db.h \
+ program.h structures.h version.h db_io.h db_private.h exceptions.h \
+ list.h log.h options.h server.h network.h storage.h ref_count.h \
+ streams.h tasks.h execute.h opcode.h parse_cmd.h timers.h my-time.h
+db_io.o: db_io.c my-ctype.h config.h my-stdarg.h my-stdio.h \
+ my-stdlib.h db_io.h program.h structures.h version.h db_private.h \
+ exceptions.h list.h log.h numbers.h parser.h storage.h ref_count.h \
+ streams.h str_intern.h unparse.h
+db_objects.o: db_objects.c config.h db.h program.h structures.h \
+ my-stdio.h version.h db_private.h exceptions.h list.h storage.h \
+ ref_count.h utils.h execute.h opcode.h parse_cmd.h
+db_properties.o: db_properties.c config.h db.h program.h structures.h \
+ my-stdio.h version.h db_private.h exceptions.h list.h storage.h \
+ ref_count.h utils.h execute.h opcode.h parse_cmd.h
+db_verbs.o: db_verbs.c my-stdlib.h config.h my-string.h db.h program.h \
+ structures.h my-stdio.h version.h db_private.h exceptions.h db_tune.h \
+ list.h log.h parse_cmd.h storage.h ref_count.h utils.h execute.h \
+ opcode.h
+decompile.o: decompile.c ast.h config.h parser.h program.h \
+ structures.h my-stdio.h version.h sym_table.h decompile.h \
+ exceptions.h opcode.h storage.h ref_count.h utils.h execute.h db.h \
+ parse_cmd.h
+disassemble.o: disassemble.c my-stdio.h config.h bf_register.h db.h \
+ program.h structures.h version.h functions.h execute.h opcode.h \
+ parse_cmd.h list.h storage.h ref_count.h streams.h unparse.h utils.h \
+ verbs.h
+eval_env.o: eval_env.c config.h eval_env.h structures.h my-stdio.h \
+ version.h storage.h ref_count.h sym_table.h utils.h execute.h db.h \
+ program.h opcode.h parse_cmd.h
+eval_vm.o: eval_vm.c config.h db_io.h program.h structures.h \
+ my-stdio.h version.h decompile.h ast.h parser.h sym_table.h eval_vm.h \
+ execute.h db.h opcode.h parse_cmd.h log.h options.h storage.h \
+ ref_count.h tasks.h
+exceptions.o: exceptions.c exceptions.h config.h
+execute.o: execute.c my-string.h config.h db.h program.h structures.h \
+ my-stdio.h version.h db_io.h decompile.h ast.h parser.h sym_table.h \
+ eval_env.h eval_vm.h execute.h opcode.h parse_cmd.h exceptions.h \
+ functions.h list.h log.h numbers.h options.h server.h network.h \
+ storage.h ref_count.h streams.h tasks.h timers.h my-time.h utils.h
+extensions.o: extensions.c bf_register.h functions.h my-stdio.h \
+ config.h execute.h db.h program.h structures.h version.h opcode.h \
+ parse_cmd.h db_tune.h utils.h
+functions.o: functions.c my-stdarg.h config.h bf_register.h db_io.h \
+ program.h structures.h my-stdio.h version.h functions.h execute.h \
+ db.h opcode.h parse_cmd.h list.h log.h server.h network.h options.h \
+ storage.h ref_count.h streams.h unparse.h utils.h
+keywords.o: keywords.c my-ctype.h config.h my-string.h keywords.h \
+ structures.h my-stdio.h version.h tokens.h ast.h parser.h program.h \
+ sym_table.h y.tab.h utils.h execute.h db.h opcode.h parse_cmd.h
+list.o: list.c my-ctype.h config.h my-string.h bf_register.h \
+ exceptions.h functions.h my-stdio.h execute.h db.h program.h \
+ structures.h version.h opcode.h parse_cmd.h list.h log.h md5.h \
+ options.h pattern.h random.h ref_count.h streams.h storage.h \
+ unparse.h utils.h
+log.o: log.c my-stdarg.h config.h my-stdio.h my-string.h my-time.h \
+ bf_register.h functions.h execute.h db.h program.h structures.h \
+ version.h opcode.h parse_cmd.h log.h options.h storage.h ref_count.h \
+ streams.h utils.h
+malloc.o: malloc.c options.h config.h
+match.o: match.c my-stdlib.h config.h my-string.h db.h program.h \
+ structures.h my-stdio.h version.h exceptions.h match.h parse_cmd.h \
+ storage.h ref_count.h unparse.h utils.h execute.h opcode.h
+md5.o: md5.c my-string.h config.h md5.h
+name_lookup.o: name_lookup.c options.h config.h my-signal.h \
+ my-stdlib.h my-unistd.h my-inet.h my-in.h my-types.h my-socket.h \
+ my-wait.h my-string.h log.h my-stdio.h structures.h server.h \
+ network.h storage.h ref_count.h timers.h my-time.h
+network.o: network.c options.h config.h net_multi.c my-ctype.h \
+ my-fcntl.h my-ioctl.h my-signal.h my-stdio.h my-stdlib.h my-string.h \
+ my-unistd.h exceptions.h list.h structures.h log.h net_mplex.h \
+ net_multi.h net_proto.h network.h server.h streams.h storage.h \
+ ref_count.h timers.h my-time.h utils.h execute.h db.h program.h \
+ version.h opcode.h parse_cmd.h
+net_mplex.o: net_mplex.c options.h config.h net_mp_selct.c my-string.h \
+ my-sys-time.h my-types.h log.h my-stdio.h structures.h net_mplex.h
+net_proto.o: net_proto.c options.h config.h net_bsd_tcp.c my-inet.h \
+ my-in.h my-types.h my-socket.h my-stdlib.h my-string.h my-unistd.h \
+ list.h structures.h my-stdio.h log.h name_lookup.h net_proto.h \
+ server.h network.h streams.h timers.h my-time.h utils.h execute.h \
+ db.h program.h version.h opcode.h parse_cmd.h
+numbers.o: numbers.c my-math.h my-stdlib.h config.h my-string.h \
+ my-time.h functions.h my-stdio.h execute.h db.h program.h \
+ structures.h version.h opcode.h parse_cmd.h log.h random.h storage.h \
+ ref_count.h utils.h
+objects.o: objects.c db.h config.h program.h structures.h my-stdio.h \
+ version.h db_io.h exceptions.h execute.h opcode.h parse_cmd.h \
+ functions.h list.h numbers.h quota.h server.h network.h options.h \
+ storage.h ref_count.h utils.h
+parse_cmd.o: parse_cmd.c my-ctype.h config.h my-stdio.h my-stdlib.h \
+ my-string.h my-time.h db.h program.h structures.h version.h list.h \
+ match.h parse_cmd.h storage.h ref_count.h utils.h execute.h opcode.h
+pattern.o: pattern.c my-ctype.h config.h my-stdlib.h my-string.h \
+ pattern.h regexpr.h storage.h structures.h my-stdio.h ref_count.h \
+ streams.h
+program.o: program.c ast.h config.h parser.h program.h structures.h \
+ my-stdio.h version.h sym_table.h exceptions.h list.h storage.h \
+ ref_count.h utils.h execute.h db.h opcode.h parse_cmd.h
+property.o: property.c db.h config.h program.h structures.h my-stdio.h \
+ version.h functions.h execute.h opcode.h parse_cmd.h list.h storage.h \
+ ref_count.h utils.h
+quota.o: quota.c config.h db.h program.h structures.h my-stdio.h \
+ version.h quota.h
+ref_count.o: ref_count.c config.h exceptions.h ref_count.h storage.h \
+ structures.h my-stdio.h
+regexpr.o: regexpr.c my-stdio.h config.h regexpr.h my-stdlib.h \
+ my-string.h
+server.o: server.c my-types.h config.h my-signal.h my-stdarg.h \
+ my-stdio.h my-stdlib.h my-string.h my-unistd.h my-wait.h db.h \
+ program.h structures.h version.h db_io.h disassemble.h execute.h \
+ opcode.h parse_cmd.h functions.h list.h log.h network.h options.h \
+ server.h parser.h random.h storage.h ref_count.h streams.h tasks.h \
+ timers.h my-time.h unparse.h utils.h
+storage.o: storage.c my-stdlib.h config.h exceptions.h list.h \
+ structures.h my-stdio.h options.h ref_count.h storage.h utils.h \
+ execute.h db.h program.h version.h opcode.h parse_cmd.h
+streams.o: streams.c my-stdarg.h config.h my-string.h my-stdio.h log.h \
+ structures.h storage.h ref_count.h streams.h
+str_intern.o: str_intern.c my-stdlib.h config.h log.h my-stdio.h \
+ structures.h storage.h ref_count.h str_intern.h utils.h execute.h \
+ db.h program.h version.h opcode.h parse_cmd.h
+sym_table.o: sym_table.c my-stdio.h config.h ast.h parser.h program.h \
+ structures.h version.h sym_table.h exceptions.h log.h storage.h \
+ ref_count.h utils.h execute.h db.h opcode.h parse_cmd.h
+tasks.o: tasks.c my-string.h config.h my-time.h db.h program.h \
+ structures.h my-stdio.h version.h db_io.h decompile.h ast.h parser.h \
+ sym_table.h eval_env.h eval_vm.h execute.h opcode.h parse_cmd.h \
+ exceptions.h functions.h list.h log.h match.h options.h random.h \
+ server.h network.h storage.h ref_count.h streams.h tasks.h utils.h \
+ verbs.h
+timers.o: timers.c my-signal.h config.h my-stdlib.h my-sys-time.h \
+ options.h my-time.h my-unistd.h timers.h
+unparse.o: unparse.c my-ctype.h config.h my-stdio.h ast.h parser.h \
+ program.h structures.h version.h sym_table.h decompile.h exceptions.h \
+ functions.h execute.h db.h opcode.h parse_cmd.h keywords.h list.h \
+ log.h unparse.h storage.h ref_count.h streams.h utils.h
+utils.o: utils.c my-ctype.h config.h my-stdio.h my-string.h db.h \
+ program.h structures.h version.h db_io.h exceptions.h list.h log.h \
+ match.h numbers.h ref_count.h server.h network.h options.h storage.h \
+ streams.h utils.h execute.h opcode.h parse_cmd.h
+verbs.o: verbs.c my-string.h config.h db.h program.h structures.h \
+ my-stdio.h version.h exceptions.h execute.h opcode.h parse_cmd.h \
+ functions.h list.h log.h match.h parser.h server.h network.h \
+ options.h storage.h ref_count.h unparse.h utils.h verbs.h
+version.o: version.c config.h version.h
+gnu-malloc.o: gnu-malloc.c getpagesize.h
+net_single.o: net_single.c my-ctype.h config.h my-fcntl.h my-stdio.h \
+ my-unistd.h log.h structures.h network.h options.h server.h streams.h \
+ utils.h execute.h db.h program.h version.h opcode.h parse_cmd.h
+net_multi.o: net_multi.c my-ctype.h config.h my-fcntl.h my-ioctl.h \
+ my-signal.h my-stdio.h my-stdlib.h my-string.h my-unistd.h \
+ exceptions.h list.h structures.h log.h net_mplex.h net_multi.h \
+ net_proto.h options.h network.h server.h streams.h storage.h \
+ ref_count.h timers.h my-time.h utils.h execute.h db.h program.h \
+ version.h opcode.h parse_cmd.h
+net_mp_selct.o: net_mp_selct.c my-string.h config.h my-sys-time.h \
+ options.h my-types.h log.h my-stdio.h structures.h net_mplex.h
+net_mp_poll.o: net_mp_poll.c my-poll.h config.h log.h my-stdio.h \
+ structures.h net_mplex.h storage.h ref_count.h
+net_bsd_tcp.o: net_bsd_tcp.c my-inet.h config.h my-in.h my-types.h \
+ my-socket.h my-stdlib.h my-string.h my-unistd.h list.h structures.h \
+ my-stdio.h log.h name_lookup.h net_proto.h options.h server.h \
+ network.h streams.h timers.h my-time.h utils.h execute.h db.h \
+ program.h version.h opcode.h parse_cmd.h
+net_bsd_lcl.o: net_bsd_lcl.c my-socket.h config.h my-stdio.h \
+ my-string.h my-unistd.h log.h structures.h net_proto.h options.h \
+ storage.h ref_count.h utils.h execute.h db.h program.h version.h \
+ opcode.h parse_cmd.h
+net_sysv_tcp.o: net_sysv_tcp.c my-inet.h config.h my-fcntl.h my-in.h \
+ my-types.h my-ioctl.h my-socket.h my-stdlib.h my-string.h \
+ my-stropts.h my-tiuser.h my-unistd.h log.h my-stdio.h structures.h \
+ name_lookup.h net_proto.h options.h server.h network.h streams.h \
+ timers.h my-time.h
+net_sysv_lcl.o: net_sysv_lcl.c my-fcntl.h config.h my-stat.h \
+ my-stdio.h my-stdlib.h my-unistd.h exceptions.h list.h structures.h \
+ log.h net_multi.h net_proto.h options.h storage.h ref_count.h \
+ streams.h utils.h execute.h db.h program.h version.h opcode.h \
+ parse_cmd.h
+client_bsd.o: client_bsd.c my-socket.h config.h my-stdio.h my-stdlib.h \
+ my-string.h my-sys-time.h options.h my-types.h my-unistd.h
+client_sysv.o: client_sysv.c my-fcntl.h config.h my-signal.h \
+ my-stdio.h my-stdlib.h my-string.h my-types.h my-stat.h my-unistd.h \
+ options.h
diff --git a/code_gen.c b/code_gen.c
index 5d9a388..54d1a94 100644
--- a/code_gen.c
+++ b/code_gen.c
@@ -23,6 +23,7 @@
#include "program.h"
#include "storage.h"
#include "structures.h"
+#include "str_intern.h"
#include "utils.h"
#include "version.h"
@@ -235,7 +236,16 @@ add_literal(Var v, State * state)
gstate->literals = new_literals;
gstate->max_literals = new_max;
}
- gstate->literals[i = gstate->num_literals++] = var_ref(v);
+ if (v.type == TYPE_STR) {
+ /* intern string if we can */
+ Var nv;
+
+ nv.type = TYPE_STR;
+ nv.v.str = str_intern(v.v.str);
+ gstate->literals[i = gstate->num_literals++] = nv;
+ } else {
+ gstate->literals[i = gstate->num_literals++] = var_ref(v);
+ }
}
add_fixup(FIXUP_LITERAL, i, state);
state->num_literals++;
@@ -1203,9 +1213,12 @@ generate_code(Stmt * stmt, DB_Version version)
char rcsid_code_gen[] = "$Id$";
/* $Log$
-/* Revision 1.3 1997/07/07 03:24:53 nop
-/* Merge UNSAFE_OPTS (r5) after extensive testing.
+/* Revision 1.4 1998/02/19 07:36:16 nop
+/* Initial string interning during db load.
/*
+ * Revision 1.3 1997/07/07 03:24:53 nop
+ * Merge UNSAFE_OPTS (r5) after extensive testing.
+ *
* Revision 1.2.2.1 1997/05/29 15:50:01 nop
* Make sure to clear prev_stacks to avoid referring to uninitialized memory
* later. (Usually multiplied by zero, so only a problem in weird circumstances.)
diff --git a/db_file.c b/db_file.c
index 55ebe54..cf85047 100644
--- a/db_file.c
+++ b/db_file.c
@@ -34,6 +34,7 @@
#include "server.h"
#include "storage.h"
#include "streams.h"
+#include "str_intern.h"
#include "tasks.h"
#include "timers.h"
#include "version.h"
@@ -51,7 +52,7 @@ DB_Version dbio_input_version;
static void
read_verbdef(Verbdef * v)
{
- v->name = str_dup(dbio_read_string());
+ v->name = dbio_read_string_intern();
v->owner = dbio_read_objid();
v->perms = dbio_read_num();
v->prep = dbio_read_num();
@@ -71,7 +72,7 @@ write_verbdef(Verbdef * v)
static Propdef
read_propdef()
{
- char *name = str_dup(dbio_read_string());
+ const char *name = dbio_read_string_intern();
return dbpriv_new_propdef(name);
}
@@ -121,7 +122,7 @@ read_object(void)
return 0;
o = dbpriv_new_object();
- o->name = str_dup(dbio_read_string());
+ o->name = dbio_read_string_intern();
(void) dbio_read_string(); /* discard old handles string */
o->flags = dbio_read_num();
@@ -660,6 +661,8 @@ db_load(void)
{
dbpriv_set_dbio_input(input_db);
+ str_intern_open(0);
+
oklog("LOADING: %s\n", input_db_name);
if (!read_db_file()) {
errlog("DB_LOAD: Cannot load database!\n");
@@ -668,6 +671,8 @@ db_load(void)
oklog("LOADING: %s done, will dump new database on %s\n",
input_db_name, dump_db_name);
+ str_intern_close();
+
fclose(input_db);
return 1;
}
@@ -716,9 +721,12 @@ db_shutdown()
char rcsid_db_file[] = "$Id$";
/* $Log$
-/* Revision 1.2 1997/03/03 04:18:27 nop
-/* GNU Indent normalization
+/* Revision 1.3 1998/02/19 07:36:16 nop
+/* Initial string interning during db load.
/*
+ * Revision 1.2 1997/03/03 04:18:27 nop
+ * GNU Indent normalization
+ *
* Revision 1.1.1.1 1997/03/03 03:44:59 nop
* LambdaMOO 1.8.0p5
*
diff --git a/db_io.c b/db_io.c
index a29603e..7c8c70e 100644
--- a/db_io.c
+++ b/db_io.c
@@ -35,6 +35,7 @@
#include "storage.h"
#include "streams.h"
#include "structures.h"
+#include "str_intern.h"
#include "unparse.h"
#include "version.h"
@@ -190,6 +191,20 @@ dbio_read_string(void)
return buffer;
}
+const char *
+dbio_read_string_intern(void)
+{
+ const char *s, *r;
+
+ s = dbio_read_string();
+ r = str_intern(s);
+
+ /* puts(r); */
+
+ return r;
+}
+
+
Var
dbio_read_var(void)
{
@@ -206,7 +221,7 @@ dbio_read_var(void)
case TYPE_NONE:
break;
case _TYPE_STR:
- r.v.str = str_dup(dbio_read_string());
+ r.v.str = dbio_read_string_intern();
r.type |= TYPE_COMPLEX_FLAG;
break;
case TYPE_OBJ:
@@ -404,9 +419,12 @@ dbio_write_forked_program(Program * program, int f_index)
char rcsid_db_io[] = "$Id$";
/* $Log$
-/* Revision 1.3 1997/07/07 03:24:53 nop
-/* Merge UNSAFE_OPTS (r5) after extensive testing.
+/* Revision 1.4 1998/02/19 07:36:16 nop
+/* Initial string interning during db load.
/*
+ * Revision 1.3 1997/07/07 03:24:53 nop
+ * Merge UNSAFE_OPTS (r5) after extensive testing.
+ *
* Revision 1.2.2.1 1997/03/20 18:07:51 bjj
* Add a flag to the in-memory type identifier so that inlines can cheaply
* identify Vars that need actual work done to ref/free/dup them. Add the
diff --git a/db_io.h b/db_io.h
index ead973a..0058338 100644
--- a/db_io.h
+++ b/db_io.h
@@ -46,6 +46,12 @@ extern const char *dbio_read_string(void);
* str_dup() it if it is to persist.
*/
+extern const char *dbio_read_string_intern(void);
+ /* The returned string is duplicated
+ * and possibly interned in a db-load
+ * string intern table.
+ */
+
extern Var dbio_read_var(void);
/* The DBIO module retains no references to
* the returned value, so freeing it is
@@ -91,9 +97,12 @@ extern void dbio_write_program(Program *);
extern void dbio_write_forked_program(Program * prog, int f_index);
/* $Log$
-/* Revision 1.2 1997/03/03 04:18:28 nop
-/* GNU Indent normalization
+/* Revision 1.3 1998/02/19 07:36:16 nop
+/* Initial string interning during db load.
/*
+ * Revision 1.2 1997/03/03 04:18:28 nop
+ * GNU Indent normalization
+ *
* Revision 1.1.1.1 1997/03/03 03:45:02 nop
* LambdaMOO 1.8.0p5
*
diff --git a/execute.c b/execute.c
index 2e41b6c..7e7020e 100644
--- a/execute.c
+++ b/execute.c
@@ -2620,8 +2620,8 @@ read_activ_as_pi(activation * a)
dbio_read_string(); /* was dobjstr */
dbio_read_string(); /* was iobjstr */
dbio_read_string(); /* was prepstr */
- a->verb = str_dup(dbio_read_string());
- a->verbname = str_dup(dbio_read_string());
+ a->verb = dbio_read_string_intern();
+ a->verbname = dbio_read_string_intern();
return 1;
}
@@ -2651,7 +2651,7 @@ read_rt_env(const char ***old_names, Var ** rt_env, int *old_size)
*rt_env = new_rt_env(*old_size);
for (i = 0; i < *old_size; i++) {
- (*old_names)[i] = str_dup(dbio_read_string());
+ (*old_names)[i] = dbio_read_string_intern();
(*rt_env)[i] = dbio_read_var();
}
return 1;
@@ -2819,9 +2819,12 @@ read_activ(activation * a, int which_vector)
char rcsid_execute[] = "$Id$";
/* $Log$
-/* Revision 1.8 1997/07/07 03:24:54 nop
-/* Merge UNSAFE_OPTS (r5) after extensive testing.
+/* Revision 1.9 1998/02/19 07:36:17 nop
+/* Initial string interning during db load.
/*
+ * Revision 1.8 1997/07/07 03:24:54 nop
+ * Merge UNSAFE_OPTS (r5) after extensive testing.
+ *
* Revision 1.7 1997/03/21 13:23:23 bjj
* Reorganize the top of run() slightly to make it slightly more efficient
* (we do execute it billions of times, after all). Later we'll want to
diff --git a/storage.h b/storage.h
index 44ee986..ecc7e5b 100644
--- a/storage.h
+++ b/storage.h
@@ -33,6 +33,7 @@ typedef enum Memory_Type {
M_RT_STACK, M_RT_ENV, M_BI_FUNC_DATA, M_VM,
M_REF_ENTRY, M_REF_TABLE, M_VC_ENTRY, M_VC_TABLE, M_STRING_PTRS,
+ M_INTERN_POINTER, M_INTERN_ENTRY, M_INTERN_HUNK,
Sizeof_Memory_Type
@@ -56,9 +57,12 @@ free_str(const char *s)
#endif /* Storage_h */
/* $Log$
-/* Revision 1.3 1997/07/07 03:24:55 nop
-/* Merge UNSAFE_OPTS (r5) after extensive testing.
+/* Revision 1.4 1998/02/19 07:36:17 nop
+/* Initial string interning during db load.
/*
+ * Revision 1.3 1997/07/07 03:24:55 nop
+ * Merge UNSAFE_OPTS (r5) after extensive testing.
+ *
* Revision 1.2.2.4 1997/05/29 20:47:33 nop
* Stupid hack to allow non-gcc compilers to use -Dinline= to make the server
* compile.
diff --git a/str_intern.c b/str_intern.c
new file mode 100644
index 0000000..c051a1a
--- /dev/null
+++ b/str_intern.c
@@ -0,0 +1,257 @@
+#include "my-stdlib.h"
+
+#include "log.h"
+#include "storage.h"
+#include "str_intern.h"
+#include "utils.h"
+
+
+struct intern_entry {
+ const char *s;
+ unsigned hash;
+ struct intern_entry *next;
+};
+
+/* If we're using the intern table during db load, we have a stunning
+ * opportunity to fragment memory with little intern_entry
+ * structures. So, the inevitable suballocator.
+ *
+ * On Linux (at least) malloc() calls past a certain size are
+ * converted to mmap() allocations. That's really nice since we
+ * don't bloat sbrk() with memory we'll never use past db load.
+ * That makes us look better in /usr/bin/top.
+ */
+
+struct intern_entry_hunk {
+ int size;
+ int handout;
+ struct intern_entry *contents;
+ struct intern_entry_hunk *next;
+};
+
+static struct intern_entry_hunk *intern_alloc = NULL;
+
+static struct intern_entry_hunk *
+new_intern_entry_hunk(int size)
+{
+ struct intern_entry_hunk *new;
+
+ new = mymalloc(sizeof(struct intern_entry_hunk), M_INTERN_HUNK);
+ new->size = size;
+ new->handout = 0;
+ new->contents = mymalloc(sizeof(struct intern_entry) * size, M_INTERN_ENTRY);
+ new->next = NULL;
+
+ return new;
+}
+
+/* Chosen large enough to trigger the mmap() semantics of linux
+ malloc. */
+#define INTERN_ENTRY_HUNK_SIZE 100000
+
+static struct intern_entry *
+allocate_intern_entry(void)
+{
+ if (intern_alloc == NULL) {
+ intern_alloc = new_intern_entry_hunk(INTERN_ENTRY_HUNK_SIZE);
+ }
+
+ if (intern_alloc->handout < intern_alloc->size) {
+ struct intern_entry *e;
+
+ e = &(intern_alloc->contents[intern_alloc->handout]);
+ intern_alloc->handout++;
+
+ return e;
+ } else {
+ struct intern_entry_hunk *new_hunk = new_intern_entry_hunk(INTERN_ENTRY_HUNK_SIZE);
+
+ new_hunk->next = intern_alloc;
+ intern_alloc = new_hunk;
+ return allocate_intern_entry();
+ }
+}
+
+static void
+free_intern_entry_hunks(void)
+{
+ struct intern_entry_hunk *h, *next;
+
+ for (h = intern_alloc; h; h = next) {
+ next = h->next;
+ free(h->contents);
+ free(h);
+ }
+
+ intern_alloc = NULL;
+}
+
+/**********************/
+
+static struct intern_entry **intern_table;
+static int intern_table_size = 0;
+static int intern_table_count = 0;
+
+static int intern_bytes_saved = 0;
+static int intern_allocations_saved = 0;
+
+#define INTERN_TABLE_SIZE_INITIAL 10007
+
+static struct intern_entry **
+make_intern_table(int size) {
+ struct intern_entry **table;
+ int i;
+
+ table = mymalloc(sizeof(struct intern_entry *) * size, M_INTERN_POINTER);
+ for (i = 0; i < size; i++) {
+ table[i] = NULL;
+ }
+
+ return table;
+}
+
+
+void
+str_intern_open(int table_size)
+{
+ if (table_size == 0) {
+ table_size = INTERN_TABLE_SIZE_INITIAL;
+ }
+ intern_table = make_intern_table(table_size);
+ intern_table_size = table_size;
+
+ intern_bytes_saved = 0;
+ intern_allocations_saved = 0;
+}
+
+extern void str_intern_close(void)
+{
+ int i;
+ struct intern_entry *e, *next;
+
+ for (i = 0; i < intern_table_size; i++) {
+ for (e = intern_table[i]; e; e = next) {
+ next = e->next;
+
+ free_str(e->s);
+
+ /* myfree(e, M_INTERN_ENTRY); */
+ }
+ }
+
+ myfree(intern_table, M_INTERN_POINTER);
+ intern_table = NULL;
+
+ free_intern_entry_hunks();
+
+ oklog("INTERN: %d allocations saved, %d bytes\n", intern_allocations_saved, intern_bytes_saved);
+ oklog("INTERN: at end, %d entries in a %d bucket hash table.\n", intern_table_count, intern_table_size);
+}
+
+static struct intern_entry *
+find_interned_string(const char *s, unsigned hash)
+{
+ int bucket = hash % intern_table_size;
+ struct intern_entry *p;
+
+ for (p = intern_table[bucket]; p; p = p->next) {
+ if (hash == p->hash) {
+ if (!strcmp(s, p->s)) {
+ return p;
+ }
+ }
+ }
+
+ return NULL;
+}
+
+/* Caller must addref s */
+
+static void
+add_interned_string(const char *s, unsigned hash)
+{
+ int bucket = hash % intern_table_size;
+ struct intern_entry *p;
+
+ /* p = mymalloc(sizeof(struct intern_entry), M_INTERN_ENTRY); */
+ p = allocate_intern_entry();
+ p->s = s;
+ p->hash = hash;
+ p->next = intern_table[bucket];
+
+ intern_table[bucket] = p;
+
+ intern_table_count++;
+}
+
+static void
+intern_rehash(int new_size) {
+ struct intern_entry **new_table;
+ int i, count;
+ struct intern_entry *e, *next;
+
+ count = 0;
+ new_table = make_intern_table(new_size);
+
+ for (i = 0; i < intern_table_size; i++) {
+ for (e = intern_table[i]; e; e = next) {
+ int new_bucket = e->hash % new_size;
+ /* Keep the next pointer, since we're gonna nuke it. */
+ next = e->next;
+
+ e->next = new_table[new_bucket];
+ new_table[new_bucket] = e;
+
+ count++;
+ }
+ }
+
+ if (count != intern_table_count) {
+ errlog("counted %d entries in intern hash table, but intern_table_count says %d!\n", count, intern_table_count);
+ }
+
+ intern_table_size = new_size;
+
+ myfree(intern_table, M_INTERN_POINTER);
+ intern_table = new_table;
+}
+
+
+/* Make an immutable copy of s. If there's an intern table open,
+ possibly share storage. */
+extern const char *
+str_intern(const char *s)
+{
+ struct intern_entry *e;
+ unsigned hash;
+ const char *r;
+
+ if (s == NULL || *s == '\0') {
+ /* str_dup already has a canonical empty string */
+ return str_dup(s);
+ }
+
+ if (intern_table == NULL) {
+ return str_dup(s);
+ }
+
+ hash = str_hash(s);
+
+ e = find_interned_string(s, hash);
+
+ if (e != NULL) {
+ intern_allocations_saved++;
+ intern_bytes_saved += strlen(s);
+ return str_ref(e->s);
+ }
+
+ if (intern_table_count > intern_table_size) {
+ intern_rehash(intern_table_size * 2);
+ }
+
+ r = str_dup(s);
+ r = str_ref(r);
+ add_interned_string(r, hash);
+
+ return r;
+}
diff --git a/str_intern.h b/str_intern.h
new file mode 100644
index 0000000..79e772b
--- /dev/null
+++ b/str_intern.h
@@ -0,0 +1,25 @@
+
+/* A string intern table.
+ *
+ * The intern table holds a list of strings. Given a new string, we
+ * either str_dup it and add it to the table or return a ref to the
+ * existing copy of the string from the table if present.
+ *
+ * This implementation has one big intern table that's designed to be
+ * used during db load then freed all at once. It might be
+ * interesting to intern all strings even during runtime. Somebody
+ * else can do this.
+ * */
+
+#ifndef Str_Intern_h
+#define Str_Intern_h
+
+/* 0 for a default size */
+extern void str_intern_open(int table_size);
+extern void str_intern_close(void);
+
+/* Make an immutable copy of s. If there's an intern table open,
+ possibly share storage. */
+extern const char *str_intern(const char *s);
+
+#endif