merged revision(s) 37075,37076,37082,37083,37088: [Backport #7123]

* gc.c: Use the non-recursive marking instead of recursion. The
  recursion marking of CRuby needs checking stack overflow and the
  fail-safe system, but these systems not good at partial points,
  for example, marking deep tree structures. [ruby-dev:46184]
  [Feature #7095]

* configure.in (GC_MARK_STACKFRAME_WORD): removed. It's used by
  checking stack overflow of marking.

* win32/Makefile.sub (GC_MARK_STACKFRAME_WORD): ditto.

* gc.c (free_stack_chunks): it is used only when per-VM object space
  is enabled.

* gc.c (rb_objspace_call_finalizer): mark self-referencing finalizers
  before run finalizers, to fix SEGV from btest on 32bit.

* gc.c (gc_mark_stacked_objects): extract from gc_marks().

* gc.c (rb_objspace_call_finalizer): call gc_mark_stacked_objects
  at suitable point.

* gc.c (init_heap): call init_mark_stack before to allocate
  altstack. This change avoid the stack overflow at the signal
  handler on 32bit, but I don't understand reason... [Feature #7095]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@37648 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
merge revision(s) 37593: [Backport #7347]

	* random.c (BYTE_ORDER): define using configured WORDS_BIGENDIAN.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@37653 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
merge revision(s) 37604:

	* ruby_atomic.h: renamed from atomic.h to avoid header file name
	  conflict on Solaris 10. [ruby-dev:46414] [Bug #7287]

	* gc.c, signal.c, vm_core.h, common.mk: reflect the rename from
	  atomic.h to ruby_atomic.h.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@37654 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
merge revision(s) 36491,36877: [Backport #7320]

	Use 0 for webrick's port and get the actual port. [Bug #6766]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@37659 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
merge revision(s) 35080: [Backport #7353]

	* gc.c (free_method_entry_i): method entry may be in
	  unlinked_method_entry_list.  [ruby-core:43383][Bug #6171]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@37660 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
merge revision(s) 38285: [Backport #4281]

	* lib/irb/magic-file.rb: set a encoding, which is detected from
	  the file to read, to the internal encoding.
	  [Bug #4281][ruby-dev:43036]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@38313 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
[Backport #5634]

* vm.c (rb_vm_make_env_object): make Proc object if Env is possible
  to point block. [ruby-core:41038] [ruby-trunk - Bug #5634]

* vm.c (rb_vm_make_proc): No need to make Proc object here.

* bootstraptest/test_proc.rb: add tests.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@38314 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
merge revision(s) 36138: [Backport #6607]

	* include/ruby/backward/rubysig.h: fix visibility.  [Bug #6607]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@38315 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
merge revision(s) 38292: [Backport #6899]

	* compile.c (iseq_compile_each): count flip-flop state in local iseq
	  not in each iseqs, so that the keys can be other than hidden
	  strings.  [ruby-core:47253] [Bug #6899]

	* vm_insnhelper.c (lep_svar_get, lep_svar_set, vm_getspecial): store
	  flip-flop states in an array instead of a hash.

	* iseq.c (set_relation): main iseq also can has local scope.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@38317 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
merge revision(s) 37594: [Backport #7046]

	* lib/erb.rb (ERB#run, ERB#result): eval under isolated bindings for
	  safe concurrent use.  [ruby-core:47638] [Bug #7046]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@38318 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
merge revision(s) 38235: [Backport #7255]

	* parse.y (parser_here_document): flush string content between new
	  line and :string_embexpr.  [ruby-core:48703] [Bug #7255]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@38319 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
merge revision(s) 37625: [Backport #7333]

	* win32/mkexports.rb (each_export): skip garbages generated by VS2012's
	  nmake.
	  reported and patched by Yoshida Masato at [Bug #7333] [ruby-dev:46484]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@38320 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
merge revision(s) 37692,37700,37706: [Backport #7381]

	* win32/file.c (replace_to_long_name): skip automatic path expansion
	  when wildcard character is used.  [ruby-core:49451] [Bug #7374]

	* test/ruby/test_file_exhaustive.rb: add a test for above.

	* win32/file.c (replace_to_long_name): skip expansion for all wildcard
	  characters.
	  [ruby-core:49451] [Bug #7374]

	* test/ruby/test_file_exhaustive.rb: add more assertions to test.

	* win32/file.c (replace_to_long_name): correct logic around wildcard
	  characters detection and ensure wide-chars are used as pattern.
	  [ruby-core:49451] [Bug #7374]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@38321 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
reverted r38318.
rubyspec reports that there is incompatibility.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@38359 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
merge revision(s) 38357,38363: [Backport #7325]

	* marshal.c (r_entry0): don't taint classes and modules because
	  Marshal.load just return the dumped classes and modules.
	  [Bug #7325] [ruby-core:49198]

	* test/ruby/test_marshal.rb: related test.
	  Marshal.load just returns the dumped classes and modules.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@38468 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
merge revision(s) 36593: [Backport #7407]

	* gc.c: return true or false. Patch by Dirkjan Bussink. [Bug #6821]

	* test/ruby/test_gc.rb: add test-case for this bug.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@38469 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
merge revision(s) 38039: [Backport #7408]

	* parse.y (parser_yylex): fix false usage of local variable, it cannot
	  appear in fname state [ruby-core:49659] [Bug #7408]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@38470 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
merge revision(s) 34871: [Backport #7415]

	* file.c (file_expand_path): use wcscasecmp().


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@38471 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
merge revision(s) 37851: [Backport #7438]

	* io.c (argf_each_codepoint): add missing ARGF#codepoints [Bug #7438]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@38472 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
merge revision(s) 38095: [Backport #7456]

	* compile.c (ADD_CATCH_ENTRY): add a cast to fix SEGV with x64 mingw
	  on Windows 8. Without cast, 0 might be non zero value at higher bits
	  in rb_ary_new3().
	  [ruby-core:50258] [Bug #7456]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@38500 b2dd03c8-39d4-4d8f-98ff-823fe69b080e