Skip to content

Instantly share code, notes, and snippets.

View shirosaki's full-sized avatar

Hiroshi Shirosaki shirosaki

View GitHub Profile
@shirosaki
shirosaki / vim_luajit.patch
Last active April 9, 2022 04:02
Add --with-luajit to link vim with luajit
diff --git a/src/Makefile b/src/Makefile
--- a/src/Makefile
+++ b/src/Makefile
@@ -376,18 +376,22 @@ CClink = $(CC)
# Uncomment the next line to fail if one of the requested language interfaces
# cannot be configured. Without this Vim will be build anyway, without
# the failing interfaces.
#CONF_OPT_FAIL = --enable-fail-if-missing
# LUA
@shirosaki
shirosaki / 0001-Fix-numeric-precision-for-strtod-and-dtoa.patch
Created May 17, 2013 04:33
Fix numeric precision for strtod and dtoa
diff --git a/include/ruby/util.h b/include/ruby/util.h
index 5be5f2e..a4ac1a7 100644
--- a/include/ruby/util.h
+++ b/include/ruby/util.h
@@ -85,6 +85,21 @@ void ruby_each_words(const char *, void (*)(const char*, int, void*), void *);
RUBY_SYMBOL_EXPORT_END
+#if defined(__MINGW32__) && defined(_X86_) && !defined(__SSE2_MATH__) && defined(_MCW_PC)
+/* double-precision (53-bit) rounding precision is required for strtod and dtoa. */
@shirosaki
shirosaki / fix_if_ruby_crash.patch
Last active December 17, 2015 04:08
Fix crash when GC
diff -r e85071312475 src/if_ruby.c
--- a/src/if_ruby.c Tue May 07 05:18:20 2013 +0200
+++ b/src/if_ruby.c Fri May 10 12:09:19 2013 +0900
@@ -144,6 +144,7 @@
#endif
static int ruby_initialized = 0;
+static void *ruby_stack_start;
static VALUE objtbl;
@shirosaki
shirosaki / thread_pthread.patch
Created May 7, 2013 23:06
Set stack_start of rb_thread_t in ruby_init_stack()
diff --git a/thread_pthread.c b/thread_pthread.c
index eb98024..30ca276 100644
--- a/thread_pthread.c
+++ b/thread_pthread.c
@@ -45,6 +45,7 @@ static void native_cond_wait(rb_thread_cond_t *cond, pthread_mutex_t *mutex);
static void native_cond_initialize(rb_thread_cond_t *cond, int flags);
static void native_cond_destroy(rb_thread_cond_t *cond);
static void rb_thread_wakeup_timer_thread_low(void);
+static int native_thread_init_stack(rb_thread_t *th);
static pthread_t timer_thread_id;
(gdb) disas set_optimize_info_from_tree
(snip)
0x6d2e8d67 <+1207>: pop %ebp
0x6d2e8d68 <+1208>: ret
0x6d2e8d69 <+1209>: lea 0x0(%esi,%eiz,1),%esi
0x6d2e8d70 <+1216>: movl $0xffffffff,0x2c(%ebx)
0x6d2e8d77 <+1223>: jmp 0x6d2e8afb <onig_compile+587>
0x6d2e8d7c <+1228>: mov $0xfffffffb,%eax
@shirosaki
shirosaki / 0-recipe.md
Created December 4, 2012 01:30
Build 1.9.3-p327 with falcon patch on Windows
# clone latest rubyinstaller from github
$ git clone https://github.com/oneclick/rubyinstaller.git
$ cd rubyinstaller

# download patches into resources\patches\ruby193 directory
$ mkdir resources\patches\ruby193
$ cd resources\patches\ruby193
$ curl -o 1-falcon.patch https://raw.github.com/gist/4136373/falcon.diff
$ curl -O https://raw.github.com/gist/4199712/2-fix-file-expand_path-globing.patch
@shirosaki
shirosaki / win32api.patch
Created November 5, 2012 06:57
DL x64 windows fix
diff --git a/ext/dl/win32/lib/Win32API.rb b/ext/dl/win32/lib/Win32API.rb
index f18cec5..256d596 100644
--- a/ext/dl/win32/lib/Win32API.rb
+++ b/ext/dl/win32/lib/Win32API.rb
@@ -7,6 +7,7 @@ require 'dl'
class Win32API
DLL = {}
TYPEMAP = {"0" => DL::TYPE_VOID, "S" => DL::TYPE_VOIDP, "I" => DL::TYPE_LONG}
+ POINTER_TYPE = DL::SIZEOF_VOIDP == DL::SIZEOF_LONG_LONG ? 'q*' : 'l!*'
@shirosaki
shirosaki / 0000-bench_require_empty.rb
Created October 27, 2012 13:50
Benchmark require #7158
#!/usr/bin/env ruby
require "benchmark"
in_dir = File.expand_path('input/empty_files', File.dirname(__FILE__))
200.times do |i|
$LOAD_PATH.push File.expand_path(i.to_s)
end
$LOAD_PATH.push in_dir
diff --git a/ChangeLog b/ChangeLog
index 7f90628..49391a4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,112 @@
+Thu Aug 30 07:45:12 2012 Luis Lavena <luislavena@gmail.com>
+
+ * test/ruby/test_file_exhaustive.rb: fix test introduced in r36811 for
+ posix environments where HOME is not defined. [ruby-core:47322]
+
@shirosaki
shirosaki / 0-timing_result.md
Created October 14, 2012 13:24
Mingw make patch for parallel build of ruby

30% speed up of make mingw ruby on Windows 7 with Intel Core i5 2.40GHz CPU

Build trunk without ext/tk

$ gnumake clean
$ time gnumake

real    9m14.244s
user 0m0.030s