diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | Makefile.in | 3 | ||||
-rw-r--r-- | class.c | 3 | ||||
-rw-r--r-- | configure.in | 2 | ||||
-rw-r--r-- | defines.h | 2 | ||||
-rw-r--r-- | dln.c | 16 | ||||
-rw-r--r-- | eval.c | 40 | ||||
-rw-r--r-- | gc.c | 20 | ||||
-rw-r--r-- | hash.c | 5 | ||||
-rw-r--r-- | io.c | 4 | ||||
-rw-r--r-- | lib/delegate.rb | 2 | ||||
-rw-r--r-- | lib/weakref.rb | 8 | ||||
-rw-r--r-- | missing/strdup.c | 25 | ||||
-rw-r--r-- | pack.c | 8 | ||||
-rw-r--r-- | parse.y | 8 | ||||
-rw-r--r-- | regex.h | 4 | ||||
-rw-r--r-- | ruby.c | 3 | ||||
-rw-r--r-- | util.c | 16 | ||||
-rw-r--r-- | util.h | 6 | ||||
-rw-r--r-- | variable.c | 4 | ||||
-rw-r--r-- | version.h | 4 |
21 files changed, 89 insertions, 101 deletions
@@ -5,6 +5,13 @@ Wed Jul 26 10:09:01 2000 WATANABE Hirofumi <eban@os.rim.or.jp> * configure.in: LIBRUBY_SO='$(RUBY_INSTALL_NAME)'.$target_os.dll on cygwin and mingw32. ruby-cygwin.dll is bad. why? +Wed Jul 26 10:04:03 2000 Yukihiro Matsumoto <matz@netlab.co.jp> + + * gc.c (gc_sweep): avoid full scan during compilation. + + * gc.c (rb_gc): add heap during no gc period (including + compilation). + Tue Jul 25 19:03:04 2000 WATANABE Hirofumi <eban@os.rim.or.jp> * cygwin/GNUmakefile: use puts instead of print, because diff --git a/Makefile.in b/Makefile.in index 3c1b14825e..6cac2a47f7 100644 --- a/Makefile.in +++ b/Makefile.in @@ -201,9 +201,6 @@ strncasecmp.@OBJEXT@: @srcdir@/missing/strncasecmp.c strchr.@OBJEXT@: @srcdir@/missing/strchr.c $(CC) $(CFLAGS) $(CPPFLAGS) -c @srcdir@/missing/strchr.c -strdup.@OBJEXT@: @srcdir@/missing/strdup.c - $(CC) $(CFLAGS) $(CPPFLAGS) -c @srcdir@/missing/strdup.c - strerror.@OBJEXT@: @srcdir@/missing/strerror.c $(CC) $(CFLAGS) $(CPPFLAGS) -c @srcdir@/missing/strerror.c @@ -11,6 +11,7 @@ **********************************************************************/ #include "ruby.h" +#include "rubysig.h" #include "node.h" #include "st.h" #include <ctype.h> @@ -526,6 +527,7 @@ rb_singleton_class(obj) rb_bug("unknown immediate %d", obj); } + DEFER_INTS; if (FL_TEST(RBASIC(obj)->klass, FL_SINGLETON)) { klass = RBASIC(obj)->klass; } @@ -541,6 +543,7 @@ rb_singleton_class(obj) FL_UNSET(klass, FL_TAINT); } if (OBJ_FROZEN(obj)) OBJ_FREEZE(klass); + ALLOW_INTS; return klass; } diff --git a/configure.in b/configure.in index bccbdbac36..445e8322d8 100644 --- a/configure.in +++ b/configure.in @@ -217,7 +217,7 @@ AC_FUNC_ALLOCA AC_FUNC_VFORK AC_FUNC_MEMCMP AC_REPLACE_FUNCS(dup2 memmove mkdir strcasecmp strncasecmp strerror strftime\ - strchr strstr strtoul strdup crypt flock vsnprintf\ + strchr strstr strtoul crypt flock vsnprintf\ isinf isnan finite) AC_CHECK_FUNCS(fmod killpg drand48 random wait4 waitpid syscall getcwd\ truncate chsize times utimes fcntl lockf setitimer pause\ @@ -28,6 +28,8 @@ #endif #define S_IXGRP 0000010 /* execute/search permission, group */ #define S_IXOTH 0000001 /* execute/search permission, other */ + +#define HAVE_SYS_WAIT_H /* configure fails to find this */ #endif /* NeXT */ #ifdef NT @@ -122,16 +122,15 @@ init_funcname(buf, file) static int dln_errno; #define DLN_ENOEXEC ENOEXEC /* Exec format error */ -#define DLN_ECONFL 201 /* Symbol name conflict */ -#define DLN_ENOINIT 202 /* No inititalizer given */ -#define DLN_EUNDEF 203 /* Undefine symbol remains */ -#define DLN_ENOTLIB 204 /* Not a library file */ -#define DLN_EBADLIB 205 /* Malformed library file */ -#define DLN_EINIT 206 /* Not initialized */ +#define DLN_ECONFL 1201 /* Symbol name conflict */ +#define DLN_ENOINIT 1202 /* No inititalizer given */ +#define DLN_EUNDEF 1203 /* Undefine symbol remains */ +#define DLN_ENOTLIB 1204 /* Not a library file */ +#define DLN_EBADLIB 1205 /* Malformed library file */ +#define DLN_EINIT 1206 /* Not initialized */ static int dln_init_p = 0; -#include "st.h" #include <ar.h> #include <a.out.h> #ifndef N_COMM @@ -143,6 +142,9 @@ static int dln_init_p = 0; #define INVALID_OBJECT(h) (N_MAGIC(h) != OMAGIC) +#include "util.h" +#include "st.h" + static st_table *sym_tbl; static st_table *undef_tbl; @@ -1003,22 +1003,19 @@ ruby_init() } static VALUE -eval_node(self) +eval_node(self, node) VALUE self; + NODE *node; { - NODE *beg_tree, *tree; + NODE *beg_tree = ruby_eval_tree_begin; - beg_tree = ruby_eval_tree_begin; - tree = ruby_eval_tree; + ruby_eval_tree_begin = 0; if (beg_tree) { - ruby_eval_tree_begin = 0; rb_eval(self, beg_tree); } - if (!tree) return Qnil; - ruby_eval_tree = 0; - - return rb_eval(self, tree); + if (!node) return Qnil; + return rb_eval(self, node); } int ruby_in_eval; @@ -1111,7 +1108,7 @@ ruby_run() PUSH_TAG(PROT_NONE); PUSH_ITER(ITER_NOT); if ((state = EXEC_TAG()) == 0) { - eval_node(ruby_top_self); + eval_node(ruby_top_self, ruby_eval_tree); } POP_ITER(); POP_TAG(); @@ -4496,6 +4493,7 @@ compile(src, file, line) { NODE *node; + ruby_nerrs = 0; Check_Type(src, T_STRING); node = rb_compile_string(file, src, line); @@ -4563,11 +4561,11 @@ eval(self, src, scope, file, line) } PUSH_TAG(PROT_NONE); if ((state = EXEC_TAG()) == 0) { - compile(src, file, line); + NODE *node = compile(src, file, line); if (ruby_nerrs > 0) { compile_error(0); } - result = eval_node(self); + result = eval_node(self, node); } POP_TAG(); POP_CLASS(); @@ -4889,11 +4887,16 @@ rb_load(fname, wrap) state = EXEC_TAG(); last_func = ruby_frame->last_func; if (state == 0) { + NODE *node; + + DEFER_INTS; ruby_in_eval++; rb_load_file(file); ruby_in_eval--; + node = ruby_eval_tree; + ALLOW_INTS; if (ruby_nerrs == 0) { - eval_node(self); + eval_node(self, node); } } ruby_frame->last_func = last_func; @@ -6312,7 +6315,10 @@ method_inspect(method) rb_str_cat2(str, ": "); s = rb_class2name(data->oklass); rb_str_cat2(str, s); - rb_str_cat2(str, "#"); + rb_str_cat2(str, "("); + s = rb_class2name(data->klass); + rb_str_cat2(str, s); + rb_str_cat2(str, ")#"); s = rb_id2name(data->oid); rb_str_cat2(str, s); rb_str_cat2(str, ">"); @@ -6884,6 +6890,7 @@ find_bad_fds(dst, src, max) void rb_thread_schedule() { + extern int ruby_in_compile; rb_thread_t next; /* OK */ rb_thread_t th; rb_thread_t curr; @@ -6897,6 +6904,11 @@ rb_thread_schedule() int n, max; int need_select = 0; + if (ruby_in_compile) { + printf("switch during compilation.\n"); + abort(); + } + rb_thread_pending = 0; if (curr_thread == curr_thread->next && curr_thread->status == THREAD_RUNNABLE) @@ -284,8 +284,7 @@ rb_newobj() freelist = freelist->as.free.next; return obj; } - if (dont_gc || during_gc || rb_prohibit_interrupt) add_heap(); - else rb_gc(); + rb_gc(); goto retry; } @@ -661,18 +660,6 @@ gc_sweep() int freed = 0; int i, used = heaps_used; - if (ruby_in_compile) { - /* sould not reclaim nodes during compilation */ - for (i = 0; i < used; i++) { - p = heaps[i]; pend = p + HEAP_SLOTS; - while (p < pend) { - if (!(p->as.basic.flags&FL_MARK) && BUILTIN_TYPE(p) == T_NODE) - rb_gc_mark(p); - p++; - } - } - } - freelist = 0; final_list = 0; for (i = 0; i < used; i++) { @@ -913,6 +900,11 @@ rb_gc() # define STACK_END (stack_end) #endif + if (dont_gc || during_gc || rb_prohibit_interrupt || ruby_in_compile) { + add_heap(); + return; + } + malloc_memories = 0; if (during_gc) return; @@ -17,11 +17,6 @@ #include "util.h" #include "rubysig.h" -#ifndef HAVE_STRING_H -char *strchr _((char*,char)); -char *strdup _((const char*)); -#endif - #define HASH_DELETED FL_USER1 static void @@ -56,10 +56,6 @@ struct timeval { #include <unistd.h> #endif -#ifndef strdup -char *strdup(); -#endif - extern void Init_File _((void)); #ifdef __BEOS__ diff --git a/lib/delegate.rb b/lib/delegate.rb index 29f2a5ded2..480e1ef6b8 100644 --- a/lib/delegate.rb +++ b/lib/delegate.rb @@ -39,7 +39,7 @@ class Delegator raise end end - EOS + EOS end end diff --git a/lib/weakref.rb b/lib/weakref.rb index 9e510d6f1c..459f69f924 100644 --- a/lib/weakref.rb +++ b/lib/weakref.rb @@ -45,7 +45,13 @@ class WeakRef<Delegator @__id = orig.__id__ ObjectSpace.define_finalizer orig, @@final ObjectSpace.define_finalizer self, @@final - ID_MAP[@__id] = [] unless ID_MAP[@__id] + __old_status = Thread.critical + begin + Thread.critical = true + ID_MAP[@__id] = [] unless ID_MAP[@__id] + ensure + Thread.critical = __old_status + end ID_MAP[@__id].push self.__id__ ID_REV_MAP[self.id] = @__id end diff --git a/missing/strdup.c b/missing/strdup.c deleted file mode 100644 index 2e1fe90bbd..0000000000 --- a/missing/strdup.c +++ /dev/null @@ -1,25 +0,0 @@ -/************************************************ - - strdup.c - - - $Author$ - $Date$ - created at: Wed Dec 7 15:34:01 JST 1994 - -************************************************/ -#include <stdio.h> - -char * -strdup(str) - char *str; -{ - extern char *xmalloc(); - char *tmp; - int len = strlen(str) + 1; - - tmp = xmalloc(len); - if (tmp == NULL) return NULL; - memcpy(tmp, str, len); - - return tmp; -} @@ -333,7 +333,7 @@ pack_pack(ary, fmt) #endif if (ISSPACE(type)) continue; - if (*p == '_') { + if (*p == '_' || *p == '!') { char *natstr = "sSiIlL"; if (strchr(natstr, type)) { @@ -343,7 +343,7 @@ pack_pack(ary, fmt) p++; } else { - rb_raise(rb_eArgError, "'_' allowed only after types %s", natstr); + rb_raise(rb_eArgError, "'%c' allowed only after types %s", *p, natstr); } } if (*p == '*') { /* set data length */ @@ -1077,7 +1077,7 @@ pack_unpack(str, fmt) #endif star = 0; type = *p++; - if (*p == '_') { + if (*p == '_' || *p == '!') { char *natstr = "sSiIlL"; if (strchr(natstr, type)) { @@ -1087,7 +1087,7 @@ pack_unpack(str, fmt) p++; } else { - rb_raise(rb_eArgError, "'_' allowed only after types %s", natstr); + rb_raise(rb_eArgError, "'%c' allowed only after types %s", *p, natstr); } } if (p >= pend) @@ -1786,9 +1786,6 @@ none : /* none */ #include <sys/types.h> #include "regex.h" #include "util.h" -#ifndef strdup -char *strdup(); -#endif #define is_identchar(c) (((int)(c))!=-1&&(ISALNUM(c) || (c) == '_' || ismbchar(c))) @@ -1862,6 +1859,7 @@ yycompile(f, line) int line; { int n; + NODE *node = 0; if (!compile_for_eval && rb_safe_level() == 0 && rb_const_defined(rb_cObject, rb_intern("SCRIPT_LINES__"))) { @@ -1898,9 +1896,9 @@ yycompile(f, line) class_nest = 0; in_single = 0; cur_mid = 0; - if (n == 0) return ruby_eval_tree; - return 0; + if (n == 0) node = ruby_eval_tree; + return node; } static int lex_gets_ptr; @@ -189,10 +189,6 @@ typedef struct } regmatch_t; -#ifdef NeXT -#define re_match rre_match -#endif - #ifdef __STDC__ extern char *re_compile_pattern (const char *, int, struct re_pattern_buffer *); @@ -49,9 +49,6 @@ static int xflag = 0; extern int yydebug; char *ruby_inplace_mode = Qfalse; -# ifndef strdup -char *strdup(); -# endif static void load_stdin _((void)); static void load_file _((char *, int)); @@ -300,7 +300,6 @@ valid_filename(char *s) #endif #ifdef DJGPP -/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ #include <libc/stubs.h> #include <stdio.h> /* For FILENAME_MAX */ #include <errno.h> /* For errno */ @@ -379,7 +378,7 @@ is_sjis1(int c) 7. Converting all slashes to '/' */ void -_fixpath(const char *in, char *out) +fixpath(const char *in, char *out) { int drive_number; const char *ip = in; @@ -758,3 +757,16 @@ void ruby_qsort (base, nel, size, cmp) void* base; int nel; int size; int (*cmp) } } +char * +ruby_strdup(str) + const char *str; +{ + char *tmp; + int len = strlen(str) + 1; + + tmp = xmalloc(len); + if (tmp == NULL) return NULL; + memcpy(tmp, str, len); + + return tmp; +} @@ -36,8 +36,6 @@ void ruby_add_suffix(); #define add_suffix ruby_add_suffix #endif -char *ruby_mktemp _((void)); - void ruby_qsort _((void*, int, int, int (*)())); #define qsort(b,n,s,c) ruby_qsort(b,n,s,c) @@ -48,4 +46,8 @@ void ruby_unsetenv _((const char*)); #define setenv(name,val) ruby_setenv((name),(val)) #define unsetenv(name,val) ruby_unsetenv((name)); +char *ruby_strdup _((const char*)); +#undef strdup +#define strdup(s) ruby_strdup((s)) + #endif /* UTIL_H */ diff --git a/variable.c b/variable.c index bbf23f1a20..36882a3063 100644 --- a/variable.c +++ b/variable.c @@ -17,10 +17,6 @@ #include "node.h" #include "st.h" -#ifndef strdup -char *strdup(); -#endif - static st_table *rb_global_tbl; st_table *rb_class_tbl; @@ -1,4 +1,4 @@ #define RUBY_VERSION "1.5.5" -#define RUBY_RELEASE_DATE "2000-07-25" +#define RUBY_RELEASE_DATE "2000-07-27" #define RUBY_VERSION_CODE 155 -#define RUBY_RELEASE_CODE 20000725 +#define RUBY_RELEASE_CODE 20000727 |