Karsten Hopp ab1641
To: vim_dev@googlegroups.com
Karsten Hopp ab1641
Subject: Patch 7.3.933
Karsten Hopp ab1641
Fcc: outbox
Karsten Hopp ab1641
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp ab1641
Mime-Version: 1.0
Karsten Hopp ab1641
Content-Type: text/plain; charset=UTF-8
Karsten Hopp ab1641
Content-Transfer-Encoding: 8bit
Karsten Hopp ab1641
------------
Karsten Hopp ab1641
Karsten Hopp ab1641
Patch 7.3.933
Karsten Hopp ab1641
Problem:    Ruby on Mac crashes due to GC failure.
Karsten Hopp ab1641
Solution:   Init the stack from main(). (Hiroshi Shirosaki)
Karsten Hopp ab1641
Files:	    src/main.c, src/if_ruby.c, src/proto/if_ruby.pro
Karsten Hopp ab1641
Karsten Hopp ab1641
Karsten Hopp ab1641
*** ../vim-7.3.932/src/main.c	2013-03-19 13:33:18.000000000 +0100
Karsten Hopp ab1641
--- src/main.c	2013-05-11 13:37:23.000000000 +0200
Karsten Hopp ab1641
***************
Karsten Hopp ab1641
*** 192,197 ****
Karsten Hopp ab1641
--- 192,204 ----
Karsten Hopp ab1641
      params.window_count = -1;
Karsten Hopp ab1641
  #endif
Karsten Hopp ab1641
  
Karsten Hopp ab1641
+ #ifdef FEAT_RUBY
Karsten Hopp ab1641
+     {
Karsten Hopp ab1641
+ 	int ruby_stack_start;
Karsten Hopp ab1641
+ 	vim_ruby_init((void *)&ruby_stack_start);
Karsten Hopp ab1641
+     }
Karsten Hopp ab1641
+ #endif
Karsten Hopp ab1641
+ 
Karsten Hopp ab1641
  #ifdef FEAT_TCL
Karsten Hopp ab1641
      vim_tcl_init(params.argv[0]);
Karsten Hopp ab1641
  #endif
Karsten Hopp ab1641
*** ../vim-7.3.932/src/if_ruby.c	2013-05-06 04:21:35.000000000 +0200
Karsten Hopp ab1641
--- src/if_ruby.c	2013-05-11 13:37:23.000000000 +0200
Karsten Hopp ab1641
***************
Karsten Hopp ab1641
*** 144,149 ****
Karsten Hopp ab1641
--- 144,150 ----
Karsten Hopp ab1641
  #endif
Karsten Hopp ab1641
  
Karsten Hopp ab1641
  static int ruby_initialized = 0;
Karsten Hopp ab1641
+ static void *ruby_stack_start;
Karsten Hopp ab1641
  static VALUE objtbl;
Karsten Hopp ab1641
  
Karsten Hopp ab1641
  static VALUE mVIM;
Karsten Hopp ab1641
***************
Karsten Hopp ab1641
*** 226,231 ****
Karsten Hopp ab1641
--- 227,233 ----
Karsten Hopp ab1641
  # define rb_float_new			dll_rb_float_new
Karsten Hopp ab1641
  # define rb_ary_new			dll_rb_ary_new
Karsten Hopp ab1641
  # define rb_ary_push			dll_rb_ary_push
Karsten Hopp ab1641
+ # define ruby_init_stack		dll_ruby_init_stack
Karsten Hopp ab1641
  #else
Karsten Hopp ab1641
  # define rb_str2cstr			dll_rb_str2cstr
Karsten Hopp ab1641
  #endif
Karsten Hopp ab1641
***************
Karsten Hopp ab1641
*** 250,256 ****
Karsten Hopp ab1641
  # define rb_enc_str_new			dll_rb_enc_str_new
Karsten Hopp ab1641
  # define rb_sprintf			dll_rb_sprintf
Karsten Hopp ab1641
  # define rb_require			dll_rb_require
Karsten Hopp ab1641
- # define ruby_init_stack		dll_ruby_init_stack
Karsten Hopp ab1641
  # define ruby_process_options		dll_ruby_process_options
Karsten Hopp ab1641
  #endif
Karsten Hopp ab1641
  
Karsten Hopp ab1641
--- 252,257 ----
Karsten Hopp ab1641
***************
Karsten Hopp ab1641
*** 335,340 ****
Karsten Hopp ab1641
--- 336,342 ----
Karsten Hopp ab1641
  static VALUE (*dll_rb_float_new) (double);
Karsten Hopp ab1641
  static VALUE (*dll_rb_ary_new) (void);
Karsten Hopp ab1641
  static VALUE (*dll_rb_ary_push) (VALUE, VALUE);
Karsten Hopp ab1641
+ static void (*ruby_init_stack)(VALUE*);
Karsten Hopp ab1641
  #endif
Karsten Hopp ab1641
  #ifdef RUBY19_OR_LATER
Karsten Hopp ab1641
  static VALUE (*dll_rb_int2big)(SIGNED_VALUE);
Karsten Hopp ab1641
***************
Karsten Hopp ab1641
*** 347,353 ****
Karsten Hopp ab1641
  static VALUE (*dll_rb_enc_str_new) (const char*, long, rb_encoding*);
Karsten Hopp ab1641
  static VALUE (*dll_rb_sprintf) (const char*, ...);
Karsten Hopp ab1641
  static VALUE (*dll_rb_require) (const char*);
Karsten Hopp ab1641
- static void (*ruby_init_stack)(VALUE*);
Karsten Hopp ab1641
  static void* (*ruby_process_options)(int, char**);
Karsten Hopp ab1641
  #endif
Karsten Hopp ab1641
  
Karsten Hopp ab1641
--- 349,354 ----
Karsten Hopp ab1641
***************
Karsten Hopp ab1641
*** 475,480 ****
Karsten Hopp ab1641
--- 476,482 ----
Karsten Hopp ab1641
  #endif
Karsten Hopp ab1641
  #if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
Karsten Hopp ab1641
      {"rb_string_value_ptr", (RUBY_PROC*)&dll_rb_string_value_ptr},
Karsten Hopp ab1641
+     {"ruby_init_stack", (RUBY_PROC*)&dll_ruby_init_stack},
Karsten Hopp ab1641
  # if DYNAMIC_RUBY_VER <= 19
Karsten Hopp ab1641
      {"rb_float_new", (RUBY_PROC*)&dll_rb_float_new},
Karsten Hopp ab1641
  # else
Karsten Hopp ab1641
***************
Karsten Hopp ab1641
*** 491,497 ****
Karsten Hopp ab1641
      {"rb_enc_str_new", (RUBY_PROC*)&dll_rb_enc_str_new},
Karsten Hopp ab1641
      {"rb_sprintf", (RUBY_PROC*)&dll_rb_sprintf},
Karsten Hopp ab1641
      {"rb_require", (RUBY_PROC*)&dll_rb_require},
Karsten Hopp ab1641
-     {"ruby_init_stack", (RUBY_PROC*)&dll_ruby_init_stack},
Karsten Hopp ab1641
      {"ruby_process_options", (RUBY_PROC*)&dll_ruby_process_options},
Karsten Hopp ab1641
  #endif
Karsten Hopp ab1641
      {"", NULL},
Karsten Hopp ab1641
--- 493,498 ----
Karsten Hopp ab1641
***************
Karsten Hopp ab1641
*** 716,723 ****
Karsten Hopp ab1641
  	    NtInitialize(&argc, &argv);
Karsten Hopp ab1641
  #endif
Karsten Hopp ab1641
  	    {
Karsten Hopp ab1641
! #ifdef RUBY19_OR_LATER
Karsten Hopp ab1641
! 		RUBY_INIT_STACK;
Karsten Hopp ab1641
  #endif
Karsten Hopp ab1641
  		ruby_init();
Karsten Hopp ab1641
  	    }
Karsten Hopp ab1641
--- 717,724 ----
Karsten Hopp ab1641
  	    NtInitialize(&argc, &argv);
Karsten Hopp ab1641
  #endif
Karsten Hopp ab1641
  	    {
Karsten Hopp ab1641
! #if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
Karsten Hopp ab1641
! 		ruby_init_stack(ruby_stack_start);
Karsten Hopp ab1641
  #endif
Karsten Hopp ab1641
  		ruby_init();
Karsten Hopp ab1641
  	    }
Karsten Hopp ab1641
***************
Karsten Hopp ab1641
*** 1389,1391 ****
Karsten Hopp ab1641
--- 1390,1398 ----
Karsten Hopp ab1641
      rb_define_virtual_variable("$curbuf", buffer_s_current, 0);
Karsten Hopp ab1641
      rb_define_virtual_variable("$curwin", window_s_current, 0);
Karsten Hopp ab1641
  }
Karsten Hopp ab1641
+ 
Karsten Hopp ab1641
+ void vim_ruby_init(void *stack_start)
Karsten Hopp ab1641
+ {
Karsten Hopp ab1641
+     /* should get machine stack start address early in main function */
Karsten Hopp ab1641
+     ruby_stack_start = stack_start;
Karsten Hopp ab1641
+ }
Karsten Hopp ab1641
*** ../vim-7.3.932/src/proto/if_ruby.pro	2010-08-15 21:57:28.000000000 +0200
Karsten Hopp ab1641
--- src/proto/if_ruby.pro	2013-05-11 13:37:28.000000000 +0200
Karsten Hopp ab1641
***************
Karsten Hopp ab1641
*** 6,9 ****
Karsten Hopp ab1641
--- 6,10 ----
Karsten Hopp ab1641
  void ex_rubyfile __ARGS((exarg_T *eap));
Karsten Hopp ab1641
  void ruby_buffer_free __ARGS((buf_T *buf));
Karsten Hopp ab1641
  void ruby_window_free __ARGS((win_T *win));
Karsten Hopp ab1641
+ void vim_ruby_init __ARGS((void *stack_start));
Karsten Hopp ab1641
  /* vim: set ft=c : */
Karsten Hopp ab1641
*** ../vim-7.3.932/src/version.c	2013-05-11 13:45:00.000000000 +0200
Karsten Hopp ab1641
--- src/version.c	2013-05-11 13:52:55.000000000 +0200
Karsten Hopp ab1641
***************
Karsten Hopp ab1641
*** 730,731 ****
Karsten Hopp ab1641
--- 730,733 ----
Karsten Hopp ab1641
  {   /* Add new patch number below this line */
Karsten Hopp ab1641
+ /**/
Karsten Hopp ab1641
+     933,
Karsten Hopp ab1641
  /**/
Karsten Hopp ab1641
Karsten Hopp ab1641
-- 
Karsten Hopp ab1641
Veni, Vidi, Video -- I came, I saw, I taped what I saw.
Karsten Hopp ab1641
Karsten Hopp ab1641
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp ab1641
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp ab1641
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp ab1641
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///