matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@973 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
ba2b829a0f
commit
9448424dba
@ -1,5 +1,14 @@
|
|||||||
|
Tue Sep 26 02:44:54 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* gc.c (GC_MALLOC_LIMIT): size extended.
|
||||||
|
|
||||||
|
* regex.c (DOUBLE_STACK): use machine's stack region for regex
|
||||||
|
stack if its size is small enough.
|
||||||
|
|
||||||
Mon Sep 25 18:13:07 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
|
Mon Sep 25 18:13:07 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* regex.c: include <defines.h>.
|
||||||
|
|
||||||
* eval.c (rb_add_method): cache mismatch by method
|
* eval.c (rb_add_method): cache mismatch by method
|
||||||
definition. need to clear_cache_by_id every time.
|
definition. need to clear_cache_by_id every time.
|
||||||
|
|
||||||
|
17
eval.c
17
eval.c
@ -238,7 +238,6 @@ rb_add_method(klass, mid, node, noex)
|
|||||||
if (OBJ_FROZEN(klass)) rb_error_frozen("class/module");
|
if (OBJ_FROZEN(klass)) rb_error_frozen("class/module");
|
||||||
body = NEW_METHOD(node, noex);
|
body = NEW_METHOD(node, noex);
|
||||||
st_insert(RCLASS(klass)->m_tbl, mid, body);
|
st_insert(RCLASS(klass)->m_tbl, mid, body);
|
||||||
rb_clear_cache_by_id(mid);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static NODE*
|
static NODE*
|
||||||
@ -360,6 +359,7 @@ rb_disable_super(klass, name)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
rb_add_method(klass, mid, 0, NOEX_UNDEF);
|
rb_add_method(klass, mid, 0, NOEX_UNDEF);
|
||||||
|
rb_clear_cache_by_id(mid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -409,6 +409,7 @@ rb_export_method(klass, name, noex)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
rb_add_method(klass, name, NEW_ZSUPER(), noex);
|
rb_add_method(klass, name, NEW_ZSUPER(), noex);
|
||||||
|
rb_clear_cache_by_id(name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -477,12 +478,14 @@ rb_attr(klass, id, read, write, ex)
|
|||||||
if (read) {
|
if (read) {
|
||||||
rb_add_method(klass, id, NEW_IVAR(attriv), noex);
|
rb_add_method(klass, id, NEW_IVAR(attriv), noex);
|
||||||
rb_funcall(klass, added, 1, ID2SYM(id));
|
rb_funcall(klass, added, 1, ID2SYM(id));
|
||||||
|
rb_clear_cache_by_id(id);
|
||||||
}
|
}
|
||||||
sprintf(buf, "%s=", name);
|
sprintf(buf, "%s=", name);
|
||||||
id = rb_intern(buf);
|
id = rb_intern(buf);
|
||||||
if (write) {
|
if (write) {
|
||||||
rb_add_method(klass, id, NEW_ATTRSET(attriv), noex);
|
rb_add_method(klass, id, NEW_ATTRSET(attriv), noex);
|
||||||
rb_funcall(klass, added, 1, ID2SYM(id));
|
rb_funcall(klass, added, 1, ID2SYM(id));
|
||||||
|
rb_clear_cache_by_id(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1494,6 +1497,7 @@ rb_undef(klass, id)
|
|||||||
rb_id2name(id),s0,rb_class2name(c));
|
rb_id2name(id),s0,rb_class2name(c));
|
||||||
}
|
}
|
||||||
rb_add_method(klass, id, 0, NOEX_PUBLIC);
|
rb_add_method(klass, id, 0, NOEX_PUBLIC);
|
||||||
|
rb_clear_cache_by_id(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
@ -2851,6 +2855,7 @@ rb_eval(self, n)
|
|||||||
node->nd_mid, node->nd_defn, NOEX_PUBLIC);
|
node->nd_mid, node->nd_defn, NOEX_PUBLIC);
|
||||||
rb_funcall(ruby_class, singleton_added, 1, ID2SYM(node->nd_mid));
|
rb_funcall(ruby_class, singleton_added, 1, ID2SYM(node->nd_mid));
|
||||||
}
|
}
|
||||||
|
rb_clear_cache_by_id(node->nd_mid);
|
||||||
if (FL_TEST(ruby_class, FL_SINGLETON)) {
|
if (FL_TEST(ruby_class, FL_SINGLETON)) {
|
||||||
rb_funcall(rb_iv_get(ruby_class, "__attached__"),
|
rb_funcall(rb_iv_get(ruby_class, "__attached__"),
|
||||||
singleton_added, 1, ID2SYM(node->nd_mid));
|
singleton_added, 1, ID2SYM(node->nd_mid));
|
||||||
@ -2891,6 +2896,7 @@ rb_eval(self, n)
|
|||||||
rb_add_method(klass, node->nd_mid, node->nd_defn,
|
rb_add_method(klass, node->nd_mid, node->nd_defn,
|
||||||
NOEX_PUBLIC|(body?body->nd_noex&NOEX_UNDEF:0));
|
NOEX_PUBLIC|(body?body->nd_noex&NOEX_UNDEF:0));
|
||||||
rb_funcall(recv, singleton_added, 1, ID2SYM(node->nd_mid));
|
rb_funcall(recv, singleton_added, 1, ID2SYM(node->nd_mid));
|
||||||
|
rb_clear_cache_by_id(node->nd_mid);
|
||||||
result = Qnil;
|
result = Qnil;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -5035,12 +5041,12 @@ rb_feature_p(feature, wait)
|
|||||||
if (strcmp(f, feature) == 0) {
|
if (strcmp(f, feature) == 0) {
|
||||||
goto load_wait;
|
goto load_wait;
|
||||||
}
|
}
|
||||||
if (strncmp(f, feature, strlen(feature)) == 0) {
|
len = strlen(feature);
|
||||||
char *ext = strrchr(f, '.');
|
if (strncmp(f, feature, len) == 0) {
|
||||||
if (strcmp(ext, ".so") == 0) {
|
if (strcmp(f+len, ".so") == 0) {
|
||||||
return Qtrue;
|
return Qtrue;
|
||||||
}
|
}
|
||||||
if (strcmp(ext, ".rb") == 0) {
|
if (strcmp(f+len, ".rb") == 0) {
|
||||||
if (wait) goto load_wait;
|
if (wait) goto load_wait;
|
||||||
return Qtrue;
|
return Qtrue;
|
||||||
}
|
}
|
||||||
@ -5345,6 +5351,7 @@ rb_mod_modfunc(argc, argv, module)
|
|||||||
}
|
}
|
||||||
rb_add_method(rb_singleton_class(module), id, body->nd_body, NOEX_PUBLIC);
|
rb_add_method(rb_singleton_class(module), id, body->nd_body, NOEX_PUBLIC);
|
||||||
rb_funcall(module, singleton_added, 1, ID2SYM(id));
|
rb_funcall(module, singleton_added, 1, ID2SYM(id));
|
||||||
|
rb_clear_cache_by_id(id);
|
||||||
}
|
}
|
||||||
return module;
|
return module;
|
||||||
}
|
}
|
||||||
|
7
gc.c
7
gc.c
@ -41,9 +41,9 @@ static void run_final();
|
|||||||
|
|
||||||
#ifndef GC_MALLOC_LIMIT
|
#ifndef GC_MALLOC_LIMIT
|
||||||
#if defined(MSDOS) || defined(__human68k__)
|
#if defined(MSDOS) || defined(__human68k__)
|
||||||
#define GC_MALLOC_LIMIT 100000
|
#define GC_MALLOC_LIMIT 200000
|
||||||
#else
|
#else
|
||||||
#define GC_MALLOC_LIMIT 4000000
|
#define GC_MALLOC_LIMIT 8000000
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -70,6 +70,7 @@ ruby_xmalloc(size)
|
|||||||
}
|
}
|
||||||
if (size == 0) size = 1;
|
if (size == 0) size = 1;
|
||||||
malloc_memories += size;
|
malloc_memories += size;
|
||||||
|
|
||||||
if (malloc_memories > GC_MALLOC_LIMIT) {
|
if (malloc_memories > GC_MALLOC_LIMIT) {
|
||||||
rb_gc();
|
rb_gc();
|
||||||
}
|
}
|
||||||
@ -118,7 +119,7 @@ ruby_xrealloc(ptr, size)
|
|||||||
rb_gc();
|
rb_gc();
|
||||||
mem = realloc(ptr, size);
|
mem = realloc(ptr, size);
|
||||||
if (!mem)
|
if (!mem)
|
||||||
if (size >= 10 * 1024 * 1024) {
|
if (size >= 50 * 1024 * 1024) {
|
||||||
rb_raise(rb_eNoMemError, "tryed to re-allocate too big memory");
|
rb_raise(rb_eNoMemError, "tryed to re-allocate too big memory");
|
||||||
}
|
}
|
||||||
mem_error("failed to allocate memory(realloc)");
|
mem_error("failed to allocate memory(realloc)");
|
||||||
|
@ -5,7 +5,9 @@ class String
|
|||||||
printf STDERR, "feel free for some warnings:\n" if $VERBOSE
|
printf STDERR, "feel free for some warnings:\n" if $VERBOSE
|
||||||
|
|
||||||
def _regex_quote(str)
|
def _regex_quote(str)
|
||||||
a = str.gsub(/\W/){|s| if s == "-" then s else "\\\\#{s}" end}
|
str.gsub(/\W/){|s|
|
||||||
|
if s == "-" then s elsif s == "\\" then "\\\\" else "\\\\#{s}" end
|
||||||
|
}
|
||||||
end
|
end
|
||||||
private :_regex_quote
|
private :_regex_quote
|
||||||
|
|
||||||
|
33
regex.c
33
regex.c
@ -62,6 +62,8 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef RUBY_PLATFORM
|
#ifdef RUBY_PLATFORM
|
||||||
|
#include "defines.h"
|
||||||
|
|
||||||
# define RUBY
|
# define RUBY
|
||||||
extern int rb_prohibit_interrupt;
|
extern int rb_prohibit_interrupt;
|
||||||
extern int rb_trap_pending;
|
extern int rb_trap_pending;
|
||||||
@ -128,11 +130,25 @@ char *alloca();
|
|||||||
|
|
||||||
#define FREE_VARIABLES()
|
#define FREE_VARIABLES()
|
||||||
|
|
||||||
#define FREE_AND_RETURN_VOID(stackb) do { xfree(stackb); return; } while(0)
|
#define FREE_AND_RETURN_VOID(stackb) do { \
|
||||||
#define FREE_AND_RETURN(stackb,val) do { xfree(stackb); return(val); } while(0)
|
if (stackb != stacka) xfree(stackb); \
|
||||||
|
return; \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
#define FREE_AND_RETURN(stackb,val) do { \
|
||||||
|
if (stackb != stacka) xfree(stackb); \
|
||||||
|
return(val); \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
#define DOUBLE_STACK(stackx,stackb,len,type) do { \
|
#define DOUBLE_STACK(stackx,stackb,len,type) do { \
|
||||||
stackx = (type*)xrealloc(stackb, 2 * len * sizeof(type)); \
|
if (stackb == stacka) { \
|
||||||
|
stackx = (type*)xmalloc(2*len*sizeof(type)); \
|
||||||
|
} \
|
||||||
|
else { \
|
||||||
|
stackx = (type*)xrealloc(stackb, 2 * len * sizeof(type)); \
|
||||||
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#endif /* NO_ALLOCA */
|
#endif /* NO_ALLOCA */
|
||||||
|
|
||||||
#define RE_TALLOC(n,t) ((t*)RE_ALLOCATE((n)*sizeof(t)))
|
#define RE_TALLOC(n,t) ((t*)RE_ALLOCATE((n)*sizeof(t)))
|
||||||
@ -1245,7 +1261,8 @@ re_compile_pattern(pattern, size, bufp)
|
|||||||
Fourth, the value of regnum.
|
Fourth, the value of regnum.
|
||||||
Fifth, the type of the paren. */
|
Fifth, the type of the paren. */
|
||||||
|
|
||||||
int *stackb = RE_TALLOC(40, int);
|
int stacka[40];
|
||||||
|
int *stackb = stacka;
|
||||||
int *stackp = stackb;
|
int *stackp = stackb;
|
||||||
int *stacke = stackb + 40;
|
int *stacke = stackb + 40;
|
||||||
int *stackt;
|
int *stackt;
|
||||||
@ -2752,7 +2769,9 @@ re_compile_fastmap(bufp)
|
|||||||
register int j, k;
|
register int j, k;
|
||||||
unsigned is_a_succeed_n;
|
unsigned is_a_succeed_n;
|
||||||
|
|
||||||
unsigned char **stackb = RE_TALLOC(NFAILURES, unsigned char*);
|
|
||||||
|
unsigned char *stacka[NFAILURES];
|
||||||
|
unsigned char **stackb = stacka;
|
||||||
unsigned char **stackp = stackb;
|
unsigned char **stackp = stackb;
|
||||||
unsigned char **stacke = stackb + NFAILURES;
|
unsigned char **stacke = stackb + NFAILURES;
|
||||||
int options = bufp->options;
|
int options = bufp->options;
|
||||||
@ -3545,11 +3564,11 @@ re_match(bufp, string_arg, size, pos, regs)
|
|||||||
``dummy''; if a failure happens and the failure point is a dummy, it
|
``dummy''; if a failure happens and the failure point is a dummy, it
|
||||||
gets discarded and the next next one is tried. */
|
gets discarded and the next next one is tried. */
|
||||||
|
|
||||||
|
unsigned char *stacka[MAX_NUM_FAILURE_ITEMS * NFAILURES];
|
||||||
unsigned char **stackb;
|
unsigned char **stackb;
|
||||||
unsigned char **stackp;
|
unsigned char **stackp;
|
||||||
unsigned char **stacke;
|
unsigned char **stacke;
|
||||||
|
|
||||||
|
|
||||||
/* Information on the contents of registers. These are pointers into
|
/* Information on the contents of registers. These are pointers into
|
||||||
the input strings; they record just what was matched (on this
|
the input strings; they record just what was matched (on this
|
||||||
attempt) by a subexpression part of the pattern, that is, the
|
attempt) by a subexpression part of the pattern, that is, the
|
||||||
@ -3594,7 +3613,7 @@ re_match(bufp, string_arg, size, pos, regs)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize the stack. */
|
/* Initialize the stack. */
|
||||||
stackb = RE_TALLOC(MAX_NUM_FAILURE_ITEMS * NFAILURES, unsigned char*);
|
stackb = stacka;
|
||||||
stackp = stackb;
|
stackp = stackb;
|
||||||
stacke = &stackb[MAX_NUM_FAILURE_ITEMS * NFAILURES];
|
stacke = &stackb[MAX_NUM_FAILURE_ITEMS * NFAILURES];
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user