single-threaded on-demand loading

svn: r9022
This commit is contained in:
Matthew Flatt 2008-03-18 22:35:51 +00:00
parent d1fac38565
commit cc551fd2d0

View File

@ -5433,6 +5433,13 @@ Scheme_Object *scheme_load_delayed_code(int _which, Scheme_Load_Delay *_delay_in
port = delay_info->cached_port; port = delay_info->cached_port;
} }
/* Allow only one thread at a time. This is a little questionable,
because unmarshalling could take arbitrarily long, and an
untrusted program might construct an adversarial bytecode. That
would be relatively difficult, though. In practice, unmarshalling
will be fast. */
scheme_start_atomic();
old_rp = delay_info->current_rp; old_rp = delay_info->current_rp;
/* Create a port for reading: */ /* Create a port for reading: */
@ -5483,6 +5490,8 @@ Scheme_Object *scheme_load_delayed_code(int _which, Scheme_Load_Delay *_delay_in
clear_bytes_chain = delay_info; clear_bytes_chain = delay_info;
} }
scheme_end_atomic_no_swap();
if (v) { if (v) {
delay_info->symtab[which] = v; delay_info->symtab[which] = v;