diff options
-rw-r--r-- | ChangeLog | 93 | ||||
-rw-r--r-- | Makefile.in | 41 | ||||
-rw-r--r-- | NEWS | 14 | ||||
-rw-r--r-- | common.mk | 17 | ||||
-rw-r--r-- | compile.c | 1 | ||||
-rw-r--r-- | configure.in | 95 | ||||
-rw-r--r-- | defs/dtrace.d | 41 | ||||
-rw-r--r-- | eval.c | 9 | ||||
-rw-r--r-- | ext/probe/extconf.rb | 3 | ||||
-rw-r--r-- | ext/probe/probe.c | 47 | ||||
-rw-r--r-- | gc.c | 8 | ||||
-rw-r--r-- | include/ruby/ruby.h | 21 | ||||
-rw-r--r-- | include/ruby/trace.h | 105 | ||||
-rw-r--r-- | insns.def | 24 | ||||
-rw-r--r-- | iseq.c | 21 | ||||
-rw-r--r-- | lib/mkmf.rb | 21 | ||||
-rw-r--r-- | thread.c | 12 | ||||
-rw-r--r-- | thread_pthread.c | 2 | ||||
-rwxr-xr-x | tool/rbinstall.rb | 2 | ||||
-rw-r--r-- | variable.c | 21 | ||||
-rw-r--r-- | vm.c | 1 | ||||
-rw-r--r-- | vm_core.h | 9 | ||||
-rw-r--r-- | vm_exec.h | 35 |
23 files changed, 612 insertions, 31 deletions
@@ -1,3 +1,96 @@ Sun Jan 3 15:34:19 2010 Yuki Sonoda (Yugui) <[email protected]> * lib/rexml/text.rb: String no longer has #each. @@ -52,6 +52,7 @@ debugflags = @debugflags@ warnflags = @warnflags@ XCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir) -I$(srcdir) @XCFLAGS@ CPPFLAGS = @CPPFLAGS@ LDFLAGS = @STATIC@ $(CFLAGS) @LDFLAGS@ EXTLDFLAGS = XLDFLAGS = @XLDFLAGS@ $(EXTLDFLAGS) @@ -66,6 +67,10 @@ ARCHMINIOBJS = @MINIOBJS@ BUILTIN_ENCOBJS = @BUILTIN_ENCOBJS@ BUILTIN_TRANSSRCS = @BUILTIN_TRANSSRCS@ BUILTIN_TRANSOBJS = @BUILTIN_TRANSOBJS@ RUBY_BASE_NAME=@RUBY_BASE_NAME@ RUBY_INSTALL_NAME=@RUBY_INSTALL_NAME@ @@ -92,6 +97,7 @@ LIBRUBYARG_STATIC = @LIBRUBYARG_STATIC@ LIBRUBYARG_SHARED = @LIBRUBYARG_SHARED@ THREAD_MODEL = @THREAD_MODEL@ PREP = @PREP@ ARCHFILE = @ARCHFILE@ @@ -115,8 +121,10 @@ IFCHANGE = $(srcdir)/tool/ifchange SET_LC_MESSAGES = env LC_MESSAGES=C OBJDUMP = @OBJDUMP@ OBJCOPY = @OBJCOPY@ VCS = @VCS@ VCSUP = @VCSUP@ OBJEXT = @OBJEXT@ ASMEXT = S @@ -139,28 +147,37 @@ all: miniruby$(EXEEXT): @-if test -f $@; then $(MV) -f $@ [email protected]; $(RM) [email protected]; fi - $(PURIFY) $(CC) $(LDFLAGS) $(XLDFLAGS) $(MAINLIBS) $(MAINOBJ) $(MINIOBJS) $(COMMONOBJS) $(DMYEXT) $(LIBS) $(OUTFLAG)$@ $(PROGRAM): @$(RM) $@ - $(PURIFY) $(CC) $(LDFLAGS) $(XLDFLAGS) $(MAINLIBS) $(MAINOBJ) $(EXTOBJS) $(LIBRUBYARG) $(LIBS) $(OUTFLAG)$@ # We must `rm' the library each time this rule is invoked because "updating" a # MAB library on Apple/NeXT (see --enable-fat-binary in configure) is not # supported. $(LIBRUBY_A): @$(RM) $@ - $(AR) $(ARFLAGS) $@ $(OBJS) $(DMYEXT) @-$(RANLIB) $@ 2> /dev/null || true $(LIBRUBY_SO): @-$(PRE_LIBRUBY_UPDATE) - $(LDSHARED) $(DLDFLAGS) $(OBJS) $(DLDOBJS) $(SOLIBS) $(OUTFLAG)$@ -$(OBJCOPY) -w -L '@EXPORT_PREFIX@Init_*' -L '@EXPORT_PREFIX@*_threadptr_*' $@ @-$(MINIRUBY) -e 'ARGV.each{|link| File.delete link if File.exist? link; \ File.symlink "$(LIBRUBY_SO)", link}' \ $(LIBRUBY_ALIASES) || true fake: $(arch)-fake.rb $(arch)-fake.rb: config.status @./config.status --file=$@:$(srcdir)/template/fake.rb.in @@ -188,6 +205,22 @@ $(srcdir)/configure: $(srcdir)/configure.in incs: id.h # Things which should be considered: # * with gperf v.s. without gperf # * committers may have various versions of gperf @@ -217,6 +217,10 @@ with all sufficient information, see the ChangeLog file. * Pathname#realdirpath * Pathname#each_child * Readline * new methods: * Readline.set_screen_size @@ -261,6 +265,14 @@ with all sufficient information, see the ChangeLog file. Unicode semantics * $: no longer includes the current directory, use require_relative === Compilation options * --program-prefix and --program-suffix no longer act on the shared object @@ -272,6 +284,8 @@ with all sufficient information, see the ChangeLog file. * --with-arch is added for universal binary, instead of --enable-fat-binary option. === Compatibility issues (excluding feature bug fixes) * Enumerator#rewind @@ -142,11 +142,11 @@ loadpath: $(PREP) PHONY $(PREP): $(MKFILES) -miniruby$(EXEEXT): config.status $(NORMALMAINOBJ) $(MINIOBJS) $(COMMONOBJS) $(DMYEXT) $(ARCHFILE) GORUBY = go$(RUBY_INSTALL_NAME) -golf: $(LIBRUBY) $(GOLFOBJS) PHONY - $(MAKE) $(MFLAGS) MAINOBJ="$(GOLFOBJS)" PROGRAM=$(GORUBY)$(EXEEXT) program capi: Doxyfile PHONY $(PREP) @$(MAKEDIRS) doc/capi @$(DOXYGEN) @@ -157,9 +157,9 @@ Doxyfile: $(srcdir)/template/Doxyfile.tmpl $(PREP) $(srcdir)/tool/generic_erb.rb program: $(PROGRAM) -$(PROGRAM): $(LIBRUBY) $(MAINOBJ) $(OBJS) $(EXTOBJS) $(SETUP) $(PREP) -$(LIBRUBY_A): $(OBJS) $(DMYEXT) $(ARCHFILE) $(LIBRUBY_SO): $(OBJS) $(DLDOBJS) $(LIBRUBY_A) $(PREP) $(LIBRUBY_SO_UPDATE) $(BUILTIN_ENCOBJS) @@ -385,6 +385,7 @@ distclean: distclean-ext distclean-local distclean-enc distclean-golf distclean- distclean-local:: clean-local @$(RM) $(MKFILES) rbconfig.rb yasmdata.rb encdb.h @$(RM) config.cache config.log config.status config.status.lineno $(PRELUDES) @$(RM) *~ *.bak *.stackdump core *.core gmon.out $(PREP) distclean-ext:: PHONY distclean-golf: clean-golf @@ -511,7 +512,8 @@ win32.$(OBJEXT): {$(VPATH)}win32.c $(RUBY_H_INCLUDES) ### RUBY_H_INCLUDES = {$(VPATH)}ruby.h {$(VPATH)}config.h {$(VPATH)}defines.h \ - {$(VPATH)}intern.h {$(VPATH)}missing.h {$(VPATH)}st.h ENCODING_H_INCLUDES= {$(VPATH)}encoding.h {$(VPATH)}oniguruma.h ID_H_INCLUDES = {$(VPATH)}id.h VM_CORE_H_INCLUDES = {$(VPATH)}vm_core.h {$(VPATH)}vm_opts.h \ @@ -678,6 +680,9 @@ newline.$(OBJEXT): {$(VPATH)}newline.c {$(VPATH)}defines.h \ {$(VPATH)}intern.h {$(VPATH)}missing.h {$(VPATH)}st.h \ {$(VPATH)}transcode_data.h {$(VPATH)}ruby.h {$(VPATH)}config.h INSNS2VMOPT = --srcdir="$(srcdir)" {$(VPATH)}minsns.inc: $(srcdir)/template/minsns.inc.tmpl @@ -3569,6 +3569,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped) } ADD_INSNL(ret, nd_line(node), jump, label_miss); ADD_LABEL(ret, label_hit); COMPILE(ret, "resbody body", resq->nd_body); if (iseq->compile_data->option->tailcall_optimization) { ADD_INSN(ret, nd_line(node), nop); @@ -357,6 +357,51 @@ fi MAKEDIRS="$MKDIR_P" AC_SUBST(MAKEDIRS) AC_CHECK_TOOL(DOT, dot) AC_CHECK_TOOL(DOXYGEN, doxygen) if test x"$DOXYGEN" = x; then @@ -1023,6 +1068,7 @@ AC_CHECK_HEADERS(limits.h sys/file.h sys/ioctl.h sys/syscall.h\ ucontext.h intrinsics.h langinfo.h locale.h sys/sendfile.h time.h \ net/socket.h sys/socket.h) dnl Check additional types. RUBY_CHECK_SIZEOF(rlim_t, [int long "long long"], [], [ #ifdef HAVE_SYS_TYPES_H @@ -2065,6 +2111,54 @@ case "$target_os" in ;; esac AC_ARG_WITH(soname, AS_HELP_STRING([--with-soname=SONAME], [base name of shared library]), [RUBY_SO_NAME=$withval], [RUBY_SO_NAME='$(RUBY_BASE_NAME)']) @@ -2712,4 +2806,5 @@ AC_CONFIG_FILES(Makefile, [{ [EXEEXT=$EXEEXT gnumake=$gnumake]) AC_OUTPUT dnl } dnl } @@ -0,0 +1,41 @@ @@ -424,9 +424,13 @@ rb_longjmp(int tag, volatile VALUE mesg) rb_trap_restore_mask(); - if (tag != TAG_FATAL) { EXEC_EVENT_HOOK(th, RUBY_EVENT_RAISE, th->cfp->self, 0 /* TODO: id */, 0 /* TODO: klass */); } rb_thread_raised_clear(th); @@ -633,6 +637,9 @@ rb_rescue2(VALUE (* b_proc) (ANYARGS), VALUE data1, va_end(args); if (handle) { if (r_proc) { PUSH_TAG(); if ((state = EXEC_TAG()) == 0) { @@ -0,0 +1,3 @@ @@ -0,0 +1,47 @@ @@ -460,6 +460,7 @@ ruby_memerror(void) else { /* no ruby thread */ fprintf(stderr, "[FATAL] failed to allocate memory\n"); exit(EXIT_FAILURE); } } @@ -472,6 +473,7 @@ rb_memerror(void) if (!nomem_error || (rb_thread_raised_p(th, RAISED_NOMEMORY) && rb_safe_level() < 4)) { fprintf(stderr, "[FATAL] failed to allocate memory\n"); exit(EXIT_FAILURE); } if (rb_thread_raised_p(th, RAISED_NOMEMORY)) { @@ -604,6 +606,7 @@ negative_size_allocation_error(const char *msg) } else { fprintf(stderr, "[FATAL] %s\n", msg); exit(EXIT_FAILURE); } } @@ -629,6 +632,7 @@ garbage_collect_with_gvl(rb_objspace_t *objspace) else { /* no ruby thread */ fprintf(stderr, "[FATAL] failed to allocate memory\n"); exit(EXIT_FAILURE); } } @@ -1973,6 +1977,8 @@ obj_free(rb_objspace_t *objspace, VALUE obj) break; } if (FL_TEST(obj, FL_EXIVAR)) { rb_free_generic_ivar((VALUE)obj); FL_UNSET(obj, FL_EXIVAR); @@ -2153,6 +2159,7 @@ garbage_collect(rb_objspace_t *objspace) during_gc++; objspace->count++; GC_PROF_TIMER_START; GC_PROF_MARK_TIMER_START; SET_STACK_END; @@ -2201,6 +2208,7 @@ garbage_collect(rb_objspace_t *objspace) GC_PROF_SWEEP_TIMER_STOP; GC_PROF_TIMER_STOP; if (GC_NOTIFY) printf("end garbage_collect()\n"); return TRUE; } @@ -40,10 +40,19 @@ extern "C" { #endif #ifdef __GNUC__ -#define PRINTF_ARGS(decl, string_index, first_to_check) \ - decl __attribute__((format(printf, string_index, first_to_check))) #else -#define PRINTF_ARGS(decl, string_index, first_to_check) decl #endif #ifdef HAVE_STDLIB_H @@ -516,12 +525,17 @@ double rb_num2dbl(VALUE); VALUE rb_uint2big(VALUE); VALUE rb_int2big(SIGNED_VALUE); VALUE rb_newobj(void); #define NEWOBJ(obj,type) type *obj = (type*)rb_newobj() #define OBJSETUP(obj,c,t) do {\ RBASIC(obj)->flags = (t);\ RBASIC(obj)->klass = (c);\ if (rb_safe_level() >= 3) FL_SET(obj, FL_TAINT | FL_UNTRUSTED);\ } while (0) #define CLONESETUP(clone,obj) do {\ OBJSETUP(clone,rb_singleton_class_clone((VALUE)obj),RBASIC(obj)->flags);\ @@ -1325,6 +1339,7 @@ int ruby_native_thread_p(void); #define RUBY_EVENT_C_CALL 0x0020 #define RUBY_EVENT_C_RETURN 0x0040 #define RUBY_EVENT_RAISE 0x0080 #define RUBY_EVENT_ALL 0xffff #define RUBY_EVENT_VM 0x10000 #define RUBY_EVENT_SWITCH 0x20000 @@ -0,0 +1,105 @@ @@ -859,6 +859,30 @@ trace rb_event_flag_t flag = (rb_event_flag_t)nf; EXEC_EVENT_HOOK(th, flag, GET_SELF(), 0, 0 /* TODO: id, klass */); } /**********************************************************/ @@ -1473,6 +1473,27 @@ rb_iseq_build_for_ruby2cext( return iseqval; } void Init_ISeq(void) { @@ -69,6 +69,8 @@ $solaris = /solaris/ =~ RUBY_PLATFORM $universal = /universal/ =~ RUBY_PLATFORM $dest_prefix_pattern = (File::PATH_SEPARATOR == ';' ? /\A([[:alpha:]]:)?/ : /\A/) # :stopdoc: def config_string(key, config = CONFIG) @@ -1450,6 +1452,7 @@ VPATH = #{vpath.join(CONFIG['PATH_SEPARATOR'])} mk << %{ CC = #{CONFIG['CC']} CXX = #{CONFIG['CXX']} LIBRUBY = #{CONFIG['LIBRUBY']} LIBRUBY_A = #{CONFIG['LIBRUBY_A']} LIBRUBYARG_SHARED = #$LIBRUBYARG_SHARED @@ -1719,6 +1722,7 @@ LOCAL_LIBS = #{$LOCAL_LIBS} LIBS = #{$LIBRUBYARG} #{$libs} #{$LIBS} SRCS = #{srcs.collect(&File.method(:basename)).join(' ')} OBJS = #{$objs.join(" ")} TARGET = #{target} DLLIB = #{dllib} EXTSTATIC = #{$static || ""} @@ -1739,6 +1743,12 @@ static: $(STATIC_LIB)#{$extout ? " install-rb" : ""} .PHONY: clean clean-so clean-rb " mfile.print CLEANINGS fsep = config_string('BUILD_FILE_SEPARATOR') {|s| s unless s == "/"} if fsep sep = ":/=#{fsep}" @@ -1841,7 +1851,7 @@ site-install-rb: install-rb mfile.print "$(RUBYARCHDIR)/" if $extout mfile.print "$(DLLIB): " mfile.print "$(DEFFILE) " if makedef - mfile.print "$(OBJS) Makefile\n" mfile.print "\t@-$(RM) $(@#{sep})\n" mfile.print "\t@-$(MAKEDIRS) $(@D)\n" if $extout link_so = LINK_SO.gsub(/^/, "\t") @@ -1850,8 +1860,8 @@ site-install-rb: install-rb end mfile.print link_so, "\n\n" unless $static.nil? - mfile.print "$(STATIC_LIB): $(OBJS)\n\t@-$(RM) $(@#{sep})\n\t" - mfile.print "$(AR) #{config_string('ARFLAGS') || 'cru '}$@ $(OBJS)" config_string('RANLIB') do |ranlib| mfile.print "\n\t@-#{ranlib} $(DLLIB) 2> /dev/null || true" end @@ -1872,6 +1882,7 @@ site-install-rb: install-rb end headers << $config_h headers << '$(RUBY_EXTCONF_H)' if $extconf_h mfile.print "$(OBJS): ", headers.join(' '), "\n" end @@ -2004,9 +2015,9 @@ TRY_LINK = config_string('TRY_LINK') || "$(CFLAGS) $(src) $(LIBPATH) $(LDFLAGS) $(ARCH_FLAG) $(LOCAL_LIBS) $(LIBS)" LINK_SO = config_string('LINK_SO') || if CONFIG["DLEXT"] == $OBJEXT - "ld $(DLDFLAGS) -r -o $@ $(OBJS)\n" else - "$(LDSHARED) #{OUTFLAG}$@ $(OBJS) " \ "$(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)" end LIBPATHFLAG = config_string('LIBPATHFLAG') || ' -L"%s"' @@ -376,6 +376,8 @@ thread_cleanup_func(void *th_ptr) { rb_thread_t *th = th_ptr; /* unlock all locking mutexes */ if (th->keeping_mutexes) { rb_mutex_unlock_all(th->keeping_mutexes, th); @@ -427,10 +429,16 @@ thread_start_func_2(rb_thread_t *th, VALUE *stack_start, VALUE *register_stack_s th->errinfo = Qnil; th->local_lfp = proc->block.lfp; th->local_svar = Qnil; th->value = rb_vm_invoke_proc(th, proc, proc->block.self, (int)RARRAY_LEN(args), RARRAY_PTR(args), 0); } else { th->value = (*th->first_func)((void *)args); } }); @@ -461,6 +469,7 @@ thread_start_func_2(rb_thread_t *th, VALUE *stack_start, VALUE *register_stack_s th->status = THREAD_KILLED; thread_debug("thread end: %p\n", (void *)th); main_th = th->vm->main_thread; if (th != main_th) { @@ -533,6 +542,7 @@ thread_create_core(VALUE thval, VALUE args, VALUE (*fn)(ANYARGS)) native_mutex_initialize(&th->interrupt_lock); /* kick thread */ st_insert(th->vm->living_threads, thval, (st_data_t) th->thread_id); err = native_thread_create(th); if (err) { st_delete_wrap(th->vm->living_threads, th->self); @@ -982,6 +992,7 @@ rb_thread_schedule_rec(int sched_depth) rb_thread_t *th = GET_THREAD(); thread_debug("rb_thread_schedule/switch start\n"); RB_GC_SAVE_MACHINE_CONTEXT(th); native_mutex_unlock(&th->vm->global_vm_lock); @@ -992,6 +1003,7 @@ rb_thread_schedule_rec(int sched_depth) rb_thread_set_current(th); thread_debug("rb_thread_schedule/switch done\n"); if (!sched_depth && UNLIKELY(GET_THREAD()->interrupt_flag)) { rb_threadptr_execute_interrupts_rec(GET_THREAD(), sched_depth+1); @@ -694,6 +694,7 @@ add_signal_thread_list(rb_thread_t *th) if (list == 0) { fprintf(stderr, "[FATAL] failed to allocate memory\n"); exit(1); } @@ -805,6 +806,7 @@ rb_thread_create_timer_thread(void) if (err != 0) { native_mutex_unlock(&timer_thread_lock); fprintf(stderr, "[FATAL] Failed to create timer thread (errno: %d)\n", err); exit(EXIT_FAILURE); } native_cond_wait(&timer_thread_cond, &timer_thread_lock); @@ -346,7 +346,7 @@ install?(:ext, :arch, :'ext-arch') do end install?(:ext, :arch, :'ext-arch') do prepare "extension headers", archhdrdir - install_recursive("#{$extout}/include/#{CONFIG['arch']}", archhdrdir, :glob => "*.h", :mode => $data_mode) end install?(:ext, :comm, :'ext-comm') do prepare "extension scripts", rubylibdir @@ -313,6 +313,27 @@ rb_class2name(VALUE klass) return RSTRING_PTR(rb_class_name(klass)); } const char * rb_obj_classname(VALUE obj) { @@ -2072,6 +2072,7 @@ Init_BareVM(void) rb_thread_t * th = malloc(sizeof(*th)); if (!vm || !th) { fprintf(stderr, "[FATAL] failed to allocate memory\n"); exit(EXIT_FAILURE); } MEMZERO(th, rb_thread_t, 1); @@ -97,15 +97,6 @@ #endif /* OPT_STACK_CACHING */ #endif /* OPT_CALL_THREADED_CODE */ -/* likely */ -#if __GNUC__ >= 3 -#define LIKELY(x) (__builtin_expect((x), 1)) -#define UNLIKELY(x) (__builtin_expect((x), 0)) -#else /* __GNUC__ >= 3 */ -#define LIKELY(x) (x) -#define UNLIKELY(x) (x) -#endif /* __GNUC__ >= 3 */ - typedef unsigned long rb_num_t; /* iseq data type */ @@ -52,8 +52,39 @@ typedef rb_iseq_t *ISEQ; #else #define debugs -#define DEBUG_ENTER_INSN(insn) -#define DEBUG_END_INSN() #endif #define throwdebug if(0)printf |