Permalink
Browse files

MBARI 7- -- speed tweaks and configuration options

  • Loading branch information...
1 parent 8bb455a commit c00ced61be9646e07ed68a2a0b29f6fc82f92176 @brentr committed Feb 14, 2009
Showing with 597 additions and 259 deletions.
  1. +123 −0 ChangeLog
  2. +1 −1 common.mk
  3. +39 −7 eval.c
  4. +232 −216 gc.c
  5. +2 −6 missing/alloca.c
  6. +189 −23 rubysig.h
  7. +11 −6 version.h
View
123 ChangeLog
@@ -1,3 +1,126 @@
+Mon Feb 09 00:01:19 2009 Brent Roman <brent@mbari.org>
+
+ * rubysig.h: default values for STACK_WIPE_SITES if x86_64
+ cast builtin_alloca result to (VALUE *)
+
+ * gc.c: don't use builtin-frame-address at all
+
+ * version.h: bumped date
+
+Sun Feb 08 00:01:19 2009 Brent Roman <brent@mbari.org>
+
+ * rubysig.h: changed default values for STACK_WIPE_SITES
+
+ * gc.c: don't trust config's USE_BUILTIN_FRAME_ADDRESS
+
+ * version.h: bumped date
+
+
+Thu Jan 23 00:01:19 2009 Brent Roman <brent@mbari.org>
+
+ * rubysig.h: remapped wipe methods to avoid values > 9
+ added cases for __ppc64__ and __x86_64__
+
+ * missing/alloca.c: made 64-bit clean
+
+ * version.h: bumped date
+
+
+Sun Jan 18 20:15:36 2009 Brent Roman <brent@mbari.org>
+
+ * rubysig.h: added support for STACK_WIPE_METHOD==5 (x86 asm)
+
+ * gc.c: allow another STACK_WIPE_METHOD
+
+ * version.h: bumped date
+
+
+Sat Jan 17 20:15:36 2009 Brent Roman <brent@mbari.org>
+
+ * gc.c: use separate gc stack so it never need be wiped
+
+ * version.h: bumped date
+
+
+Fri Jan 16 20:15:36 2009 Brent Roman <brent@mbari.org>
+
+ * gc.c: added GC_STACK_PAD, renamed stack_gc_limit->gc_stack_limit
+ optionally wipe the entire GC stack after each gc pass
+
+ * rubysig.h: default STACK_WIPE_SITES changed to 0x4770
+
+ * version.h: bumped date
+
+
+Wed Jan 14 20:15:36 2009 Brent Roman <brent@mbari.org>
+
+ * eval.c: declare wipe_after with gnu always_inline attribute
+
+ * rubysig.h: use alloca(0) to get sp for all CPU except PowerPC
+ (less likely to trash stack when clearing it)
+
+ * version.h: bumped date
+
+
+Sun Jan 13 20:15:36 2009 Brent Roman <brent@mbari.org>
+
+ * rubysig.h: moved #defs to configure alloca here from gc.c
+ added missing # to #else
+
+ * gc.c: removed #defs to configurure alloca
+ set_stack_size must handle signed rlim_t for Darwin & BSD Unix
+
+ * version.h: bumped date
+
+
+Sun Jan 11 20:15:36 2009 Brent Roman <brent@mbari.org>
+
+ * rubysig.h: added support for multiple STACK_WIPE_METHODs
+ added __stack_depth()
+ added 2nd param to stack_past()
+ __sp() returns stack pointer in an efficent, portable way
+
+ * gc.c: STACK_END uses __sp()
+ STACK_UPPER now takes only two parameters
+ added rb_gc_wipe_stack()
+ rb_mark_tbl() and mark_hash() implemented as #define macros
+ added STACK_END parameters to __stack_past() invocations
+ exploited missed opportunities for tail recursion in markchilren
+
+ * version.h: bumped date
+
+
+Mon Jan 5 20:15:36 2009 Brent Roman <brent@mbari.org>
+
+ * common.mk: added dependency on rubysig.h to version.h
+
+ * eval.c: added wipeAfter and STACK_WIPE_SITES cofiguration options
+
+ * gc.c: added STACK_WIPE_SITES cofiguration options
+ added GC.exorcise method
+
+ * rubysig.h: added STACK_WIPE_SITES cofiguration options
+ when available, use gcc asm to optimize wipe_stack
+
+ * version.h: include STACK_WIPE_SITES options in MBARI release string
+
+
+Sun Jan 4 20:15:36 2009 Brent Roman <brent@mbari.org>
+
+ * eval.c: eliminated up_stk_extent(), wipe_stack in rb_thread_switch
+
+ * gc.c: removed lev counter args, check stack pointer instead
+ streamlined SET_STACK_END and STACK_END, stack_length(), etc.
+ added TOP_FRAME to use gcc's builtin frame_address
+ optimized is_heap_pointer()
+ gc_mark_rest() does not need to copy entire mark_stack!
+ added set_stack_size() to properly hande RLIM_INFINITY
+
+ * rubysig.h: repaired broken pseudo preemptive thread switching
+ removed rb_gc_malloc_increase & limit
+ replaced buggy __stack_grown* with __stack_past* macros
+
+
Tue Dec 19 20:15:36 2008 Brent Roman <brent@mbari.org>
* eval.c: added (Method|Proc)#(__line__|__file__) methods
View
@@ -462,7 +462,7 @@ variable.$(OBJEXT): {$(VPATH)}variable.c {$(VPATH)}ruby.h config.h \
{$(VPATH)}env.h {$(VPATH)}node.h {$(VPATH)}st.h {$(VPATH)}util.h
version.$(OBJEXT): {$(VPATH)}version.c {$(VPATH)}ruby.h config.h \
{$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
- {$(VPATH)}version.h
+ {$(VPATH)}rubysig.h {$(VPATH)}version.h
dist: $(PROGRAM)
$(RUNRUBY) $(srcdir)/distruby.rb
View
46 eval.c
@@ -1028,14 +1028,26 @@ static struct tag *prot_tag;
#define PROT_LAMBDA INT2FIX(2) /* 5 */
#define PROT_YIELD INT2FIX(3) /* 7 */
-#define EXEC_TAG() ruby_setjmp(((void)0), prot_tag->buf)
-
-static inline
-int up_stk_extent(int status)
+#if STACK_WIPE_SITES & 0x42
+#ifdef __GNUC__
+static inline int wipeAfter(int) __attribute__((always_inline));
+#endif
+static inline int wipeAfter(int status)
{
- rb_gc_update_stack_extent();
+ rb_gc_wipe_stack();
return status;
}
+#else
+#define wipeAfter(status) status
+#endif
+#if STACK_WIPE_SITES & 2
+#define wipeAfterTag(status) wipeAfter(status)
+#else
+#define wipeAfterTag(status) status
+#endif
+
+#define EXEC_TAG_0() ruby_setjmp(((void)0), prot_tag->buf)
+#define EXEC_TAG() wipeAfterTag(EXEC_TAG_0())
#define JUMP_TAG(st) do { \
ruby_frame = prot_tag->frame; \
@@ -1116,6 +1128,12 @@ static NODE *compile _((VALUE, const char*, int));
static VALUE rb_yield_0 _((VALUE, VALUE, VALUE, int, int));
+#if STACK_WIPE_SITES & 0x20
+#define wipeBeforeYield() rb_gc_wipe_stack()
+#else
+#define wipeBeforeYield() (void)0
+#endif
+
#define YIELD_LAMBDA_CALL 1
#define YIELD_PROC_CALL 2
#define YIELD_PUBLIC_DEF 4
@@ -3079,6 +3097,9 @@ eval_while(self, node))
goto while_out;
do {
while_redo:
+#if STACK_WIPE_SITES & 0x10
+ rb_gc_wipe_stack();
+#endif
rb_eval(self, node->nd_body);
while_next:
;
@@ -3121,6 +3142,9 @@ eval_until(self, node))
goto until_out;
do {
until_redo:
+#if STACK_WIPE_SITES & 0x10
+ rb_gc_wipe_stack();
+#endif
rb_eval(self, node->nd_body);
until_next:
;
@@ -5347,6 +5371,7 @@ VALUE
rb_yield(val)
VALUE val;
{
+ wipeBeforeYield();
return rb_yield_0(val, 0, 0, 0, Qfalse);
}
@@ -5395,6 +5420,7 @@ static VALUE
loop_i()
{
for (;;) {
+ wipeBeforeYield();
rb_yield_0(Qundef, 0, 0, 0, Qfalse);
CHECK_INTS;
}
@@ -10949,6 +10975,9 @@ static int
rb_thread_switch(n)
int n;
{
+#if STACK_WIPE_SITES & 1
+ rb_gc_wipe_stack();
+#endif
rb_trap_immediate = (curr_thread->flags&0x100)?1:0;
switch (n) {
case 0:
@@ -10985,7 +11014,7 @@ rb_thread_switch(n)
return 1;
}
-#define THREAD_SAVE_CONTEXT(th) (rb_thread_switch(up_stk_extent( \
+#define THREAD_SAVE_CONTEXT(th) (rb_thread_switch( wipeAfter(\
ruby_setjmp(rb_thread_save_context(th), (th)->context))))
NORETURN(static void rb_thread_restore_context _((rb_thread_t,int)));
@@ -13911,7 +13940,7 @@ rb_f_catch(dmy, tag)
tag = ID2SYM(rb_to_id(tag));
PUSH_TAG(tag);
- if ((state = EXEC_TAG()) == 0) {
+ if ((state = wipeAfter(EXEC_TAG_0())) == 0) {
val = rb_yield_0(tag, 0, 0, 0, Qfalse);
}
else if (state == TAG_THROW && tag == prot_tag->dst) {
@@ -13979,6 +14008,9 @@ rb_f_throw(argc, argv)
if (!tt) {
rb_name_error(SYM2ID(tag), "uncaught throw `%s'", rb_id2name(SYM2ID(tag)));
}
+#if STACK_WIPE_SITES & 0x800
+ rb_gc_update_stack_extent();
+#endif
rb_trap_restore_mask();
JUMP_TAG(TAG_THROW);
#ifndef __GNUC__
Oops, something went wrong.

0 comments on commit c00ced6

Please sign in to comment.