Permalink
Browse files

Merge remote-tracking branch 'origin/master' into 2.0.0pre

Conflicts:
	.gitignore
	Rakefile
	configure
	lib/timeout.rb
	spec/tags/18/ruby/core/argf/gets_tags.txt
	spec/tags/18/ruby/core/argf/readline_tags.txt
	spec/tags/18/ruby/library/openstruct/method_missing_tags.txt
	vm/agent_components.cpp
	vm/builtin/data.cpp
	vm/capi/include/ruby.h
	vm/configuration.hpp
	vm/gc/baker.cpp
	vm/gc/immix.cpp
	vm/gc/marksweep.cpp
	vm/gc/walker.cpp
	vm/inline_cache.cpp
	vm/objectmemory.cpp
  • Loading branch information...
2 parents 7806103 + 0764ce3 commit f79f0c920b3982eca1190efd677a7ce3748ad73d @brixen brixen committed Jun 27, 2011
Showing with 476 additions and 280 deletions.
  1. +2 −0 AUTHORS
  2. +1 −1 Rakefile
  3. +14 −8 configure
  4. +5 −3 kernel/common/argf.rb
  5. +1 −1 kernel/common/compiled_method.rb
  6. +8 −10 kernel/common/string.rb
  7. +6 −0 lib/expect.rb
  8. +1 −1 lib/ostruct.rb
  9. +6 −2 lib/socket.rb
  10. +5 −0 rakelib/install.rake
  11. +44 −0 spec/core/compiledmethod/locate_line_spec.rb
  12. +12 −0 spec/ruby/library/openstruct/element_reference_spec.rb
  13. +14 −0 spec/ruby/library/openstruct/element_set_spec.rb
  14. +0 −20 spec/ruby/library/openstruct/method_missing_spec.rb
  15. +0 −1 spec/tags/18/ruby/core/argf/gets_tags.txt
  16. +0 −1 spec/tags/18/ruby/core/argf/readline_tags.txt
  17. +0 −2 spec/tags/18/ruby/library/openstruct/method_missing_tags.txt
  18. +0 −2 spec/tags/19/ruby/core/argf/gets_tags.txt
  19. +0 −2 spec/tags/19/ruby/core/argf/readline_tags.txt
  20. +0 −2 spec/tags/20/ruby/core/argf/gets_tags.txt
  21. +0 −2 spec/tags/20/ruby/core/argf/readline_tags.txt
  22. +1 −1 vm/agent.cpp
  23. +1 −1 vm/agent_components.cpp
  24. +5 −1 vm/builtin/block_environment.cpp
  25. +1 −1 vm/builtin/compiledmethod.cpp
  26. +8 −6 vm/builtin/data.cpp
  27. +11 −4 vm/builtin/data.hpp
  28. +3 −3 vm/builtin/executable.cpp
  29. +1 −1 vm/builtin/find_object.cpp
  30. +6 −6 vm/builtin/heap_dump.cpp
  31. +11 −37 vm/builtin/nativemethod.cpp
  32. +1 −0 vm/builtin/string.cpp
  33. +1 −0 vm/builtin/tuple.cpp
  34. +10 −0 vm/capi/18/include/defines.h
  35. +8 −10 vm/capi/data.cpp
  36. +74 −0 vm/capi/handle.cpp
  37. +55 −2 vm/capi/handle.hpp
  38. +1 −24 vm/capi/tag.hpp
  39. +7 −7 vm/config_parser.cpp
  40. +4 −4 vm/config_parser.hpp
  41. +10 −3 vm/configuration.hpp
  42. +6 −6 vm/gc/baker.cpp
  43. +1 −1 vm/gc/gc.cpp
  44. +5 −5 vm/gc/immix.cpp
  45. +3 −3 vm/gc/inflated_headers.cpp
  46. +6 −6 vm/gc/marksweep.cpp
  47. +3 −3 vm/gc/walker.cpp
  48. +1 −1 vm/gc/write_barrier.cpp
  49. +6 −6 vm/inline_cache.cpp
  50. +1 −1 vm/linkedlist.cpp
  51. +1 −1 vm/linkedlist.hpp
  52. +1 −1 vm/llvm/cfg.hpp
  53. +1 −1 vm/llvm/jit_compiler.cpp
  54. +3 −3 vm/llvm/jit_runtime.cpp
  55. +1 −1 vm/llvm/jit_visit.hpp
  56. +8 −8 vm/llvm/passes.cpp
  57. +14 −12 vm/objectmemory.cpp
  58. +1 −0 vm/ontology.cpp
  59. +4 −4 vm/symboltable.cpp
  60. +0 −14 vm/test/capi/test_handles.hpp
  61. +6 −5 vm/test/test_objectmemory.hpp
  62. +14 −14 vm/util/bert.hpp
  63. +47 −10 vm/util/configuration.hpp
  64. +4 −4 vm/util/immix.hpp
  65. +1 −1 vm/vmmethod.cpp
View
@@ -141,10 +141,12 @@
- Patrick Hurley:
- Paul Meserve:
- Paul Thornthwaite:
+- Pavel Argentov: { irc: argent-smith, github: argent-smith }
- Pedro Del Gallego:
- Phil Hagelberg: { irc: technomancy }
- Philipp Bruschweiler:
- Pierre Yager:
+- Przemek Owczarek: { github: nazgob, twitter: powczarek }
- Ragnar Dahlen:
- Richard Heycock:
- Ruben Nine:
View
@@ -33,7 +33,7 @@ end
require config_rb
BUILD_CONFIG = Rubinius::BUILD_CONFIG
-unless BUILD_CONFIG[:config_version] == 134
+unless BUILD_CONFIG[:config_version] == 135
STDERR.puts "Your configuration is outdated, please run ./configure first"
exit 1
end
View
@@ -91,6 +91,7 @@ class Configure
@include20dir = root + "/vm/capi/19/include"
@libdir = root
@runtime = @libdir + "/runtime"
+ @kernel_path = @libdir + "/kernel"
@lib_path = @libdir + "/lib"
@ext_path = @libdir + "/lib/ext"
@mandir = root + "/man"
@@ -110,7 +111,7 @@ class Configure
@libversion = "2.0"
@version = "#{@libversion}.0dev"
@release_date = "yyyy-mm-dd"
- @config_version = 134
+ @config_version = 135
# TODO: add conditionals for platforms
if RbConfig::CONFIG["build_os"] =~ /darwin/
@@ -252,6 +253,7 @@ class Configure
@include20dir = dir + "/19/include"
@libdir = dir
@runtime = @libdir + "/runtime"
+ @kernel_path = @libdir + "/kernel"
@lib_path = @libdir + "/lib"
@ext_path = @libdir + "/lib/ext"
@mandir = dir + "/man"
@@ -275,14 +277,15 @@ class Configure
end
o.on "-L", "--libdir", "PATH", "Install Ruby library in PATH" do |dir|
- @install = true
- @libdir = expand(dir) + "/rubinius/#{@libversion}"
- @runtime = @libdir + "/runtime"
- @lib_path = @libdir + "/lib"
- @ext_path = @libdir + "/lib/ext"
+ @install = true
+ @libdir = expand(dir) + "/rubinius/#{@libversion}"
+ @runtime = @libdir + "/runtime"
+ @kernel_path = @libdir + "/kernel"
+ @lib_path = @libdir + "/lib"
+ @ext_path = @libdir + "/lib/ext"
- @sitedir = @libdir + "/site"
- @vendordir = @libdir + "/vendor"
+ @sitedir = @libdir + "/site"
+ @vendordir = @libdir + "/vendor"
end
o.on "-M", "--mandir", "PATH", "Install man pages in PATH" do |dir|
@@ -948,6 +951,7 @@ module Rubinius
:bindir => "#{@bindir}",
:libdir => "#{@libdir}",
:runtime => "#{@runtime}",
+ :kernel_path => "#{@kernel_path}",
:lib_path => "#{@lib_path}",
:ext_path => "#{@ext_path}",
:include18dir => "#{@include18dir}",
@@ -988,6 +992,7 @@ end
#define RBX_BIN_PATH "#{@bindir}"
#define RBX_GEMS_PATH "#{@gemsdir}"
#define RBX_RUNTIME "#{@runtime}"
+#define RBX_KERNEL_PATH "#{@kernel_path}"
#define RBX_LIB_PATH "#{@lib_path}"
#define RBX_EXT_PATH "#{@ext_path}"
#define RBX_HDR18_PATH "#{@include18dir}"
@@ -1042,6 +1047,7 @@ end
#define RBX_BIN_PATH "#{@bindir}"
#define RBX_GEMS_PATH "#{@gemsdir}"
#define RBX_RUNTIME "#{@runtime}"
+#define RBX_KERNEL_PATH "#{@kernel_path}"
#define RBX_LIB_PATH "#{@lib_path}"
#define RBX_EXT_PATH "#{@ext_path}"
#define RBX_HDR18_PATH "#{@include18dir}"
View
@@ -489,6 +489,8 @@ def advance!
@init = true
end
+ File.unlink(@backup_filename) if @backup_filename && $-i == ""
+
return false if @use_stdin_only || ARGV.empty?
@advance = false
@@ -498,11 +500,11 @@ def advance!
@filename = file
if $-i && @stream != STDIN
- @original_stdout = $stdout
- @backup_filename = "#{@filename}#{$-i}"
+ backup_extension = $-i == "" ? ".bak" : $-i
+ @backup_filename = "#{@filename}#{backup_extension}"
File.rename(@filename, @backup_filename)
@stream = File.open(@backup_filename, "r")
- $stdout = @current_output = File.open(@filename, "w")
+ $stdout = File.open(@filename, "w")
end
return true
@@ -363,7 +363,7 @@ def change_name(name)
# nil if nothing is found, else an array of size 2 containing the method
# the line was found in and the IP pointing there.
def locate_line(line)
- ip = 1
+ i = 1
total = @lines.size
while i < total
cur_line = @lines.at(i)
View
@@ -1183,25 +1183,23 @@ def insert(index, other)
osize = other.size
size = @num_bytes + osize
- str = self.class.new("\0") * size
+ str = self.class.pattern size, "\0"
index = @num_bytes + 1 + index if index < 0
if index > @num_bytes or index < 0 then
raise IndexError, "index #{index} out of string"
end
- modify!
+ Ruby.check_frozen
+ hash_value = nil
- if index == 0
- str.copy_from other, 0, osize, 0
- str.copy_from self, 0, @num_bytes, osize
- elsif index < @num_bytes
- str.copy_from self, 0, index, 0
- str.copy_from other, 0, osize, index
- str.copy_from self, index, @num_bytes - index, index + osize
- else
+ if index == @num_bytes
str.copy_from self, 0, @num_bytes, 0
str.copy_from other, 0, osize, @num_bytes
+ else
+ str.copy_from self, 0, index, 0 if index > 0
+ str.copy_from other, 0, osize, index
+ str.copy_from self, index, @num_bytes - index, index + osize
end
@num_bytes = size
View
@@ -4,6 +4,12 @@
$expect_verbose = false
class IO
+ # Reads ios until pattern matches or the timeout is over. It returns
+ # an array with the read buffer, followed by the matches. If a block is given,
+ # the result is yielded to the block and returns nil. The optional timeout parameter defines,
+ # in seconds, the total time to wait for pattern. If it is over of eof is found, it
+ # returns/yields nil. However, the buffer in a timeout session is kept for the next expect call.
+ # The default timeout is 9999999 seconds.
def expect(pat,timeout=9999999)
case pat
when String
View
@@ -89,7 +89,7 @@ class << self; self; end.class_eval do
def method_missing(mid, *args) # :nodoc:
mname = mid.id2name
len = args.length
- if mname.chomp!('=')
+ if mname.chomp!('=') && mname != "[]"
if len != 1
raise ArgumentError, "wrong number of arguments (#{len} for 1)", caller(1)
end
View
@@ -1068,8 +1068,12 @@ def tcp_setup(remote_host, remote_service, local_host = nil,
i[1] == family && i[2] == socket_type
end
- status = Socket::Foreign.bind sock, li[4]
- syscall = 'bind(2)'
+ if li
+ status = Socket::Foreign.bind sock, li[4]
+ syscall = 'bind(2)'
+ else
+ status = 1
+ end
else
status = 1
end
View
@@ -107,6 +107,11 @@ namespace :install do
install_file name, /^runtime/, BUILD_CONFIG[:runtime]
end
+ # Install the .rb files for the core library (kernel).
+ FileList['kernel/**/*.rb'].each do |name|
+ install_file name, /^kernel/, BUILD_CONFIG[:kernel_path]
+ end
+
# Install the .rb files for the standard library. This is a
# separate block from the .rbc files so that the .rb files
# have an older timestamp and do not trigger recompiling.
@@ -0,0 +1,44 @@
+module CompiledMethodSpec
+ LineTest = def line_test
+ 1 + 1
+ 2 + 2
+ end
+
+ BlockLineTest = def block_line_test
+ 1 + 1
+ 1.times do
+ 2 + 2
+ end
+ end
+end
+
+# Line numbers are important! Thats why the above module is in
+# this file and not a fixture.
+
+describe "Rubinius::CompiledMethod#locate_line" do
+ it "finds the ip for a line" do
+ cm, ip = CompiledMethodSpec::LineTest.locate_line(4)
+ ip.should == 5
+ end
+
+ it "returns the CompiledMethod the ip is in" do
+ cm, ip = CompiledMethodSpec::LineTest.locate_line(3)
+ cm.should == CompiledMethodSpec::LineTest
+ end
+
+ it "returns nil if the line can't be found" do
+ CompiledMethodSpec::LineTest.locate_line(50).should be_nil
+ end
+
+ it "returns nil if the line is the definition line" do
+ CompiledMethodSpec::LineTest.locate_line(2).should be_nil
+ end
+
+ it "searches blocks for the line" do
+ cm, ip = CompiledMethodSpec::BlockLineTest.locate_line(10)
+ blk = CompiledMethodSpec::BlockLineTest.literals.to_a.grep(Rubinius::CompiledMethod).first
+
+ cm.should == blk
+ ip.should == 0
+ end
+end
@@ -0,0 +1,12 @@
+require File.expand_path('../../../spec_helper', __FILE__)
+require "ostruct"
+
+describe "OpenStruct#[]" do
+ before :each do
+ @os = OpenStruct.new
+ end
+
+ it "raises a NoMethodError" do
+ lambda { @os[1] }.should raise_error(NoMethodError)
+ end
+end
@@ -0,0 +1,14 @@
+require File.expand_path('../../../spec_helper', __FILE__)
+require "ostruct"
+
+describe "OpenStruct#[]=" do
+ before :each do
+ @os = OpenStruct.new
+ end
+
+ ruby_bug "redmine:4179", "1.9.2" do
+ it "raises a NoMethodError" do
+ lambda { @os[1] = 2 }.should raise_error(NoMethodError)
+ end
+ end
+end
@@ -45,23 +45,3 @@
os.method_missing(:name).should be_nil
end
end
-
-ruby_bug "redmine:4179", "1.9.2" do
- describe "OpenStruct#method_missing when called with method name '[]'" do
- it "raises a NoMethodError" do
- os = OpenStruct.new
- lambda { os.method_missing(:[]) }.should raise_error(NoMethodError)
- lambda { os.method_missing(:[], 1) }.should raise_error(NoMethodError)
- lambda { os.method_missing(:[], 1, 2) }.should raise_error(NoMethodError)
- end
- end
-
- describe "OpenStruct#method_missing when called with method name '[]='" do
- it "raises a NoMethodError" do
- os = OpenStruct.new
- lambda { os.method_missing(:[]=, 1) }.should raise_error(NoMethodError)
- lambda { os.method_missing(:[]=, 1, 2) }.should raise_error(NoMethodError)
- lambda { os.method_missing(:[]=, 1, 2, 3) }.should raise_error(NoMethodError)
- end
- end
-end
@@ -1 +0,0 @@
-fails:ARGF.gets modifies the files when in place edit mode is on
@@ -1 +0,0 @@
-fails:ARGF.readline modifies the files when in place edit mode is on
@@ -1,2 +0,0 @@
-fails:OpenStruct#method_missing when called with method name '[]' raises a NoMethodError
-fails:OpenStruct#method_missing when called with method name '[]=' raises a NoMethodError
@@ -1,2 +0,0 @@
-fails:ARGF.gets modifies the files when in place edit mode is on
-fails:ARGF.gets modifies and backups two files when in place edit mode is on
@@ -1,2 +0,0 @@
-fails:ARGF.readline modifies the files when in place edit mode is on
-fails:ARGF.readline modifies and backups two files when in place edit mode is on
@@ -1,2 +0,0 @@
-fails:ARGF.gets modifies the files when in place edit mode is on
-fails:ARGF.gets modifies and backups two files when in place edit mode is on
@@ -1,2 +0,0 @@
-fails:ARGF.readline modifies the files when in place edit mode is on
-fails:ARGF.readline modifies and backups two files when in place edit mode is on
View
@@ -388,7 +388,7 @@ namespace rubinius {
continue;
}
}
- i++;
+ ++i;
}
if(!found) {
View
@@ -297,7 +297,7 @@ namespace agent {
for(std::list<ManagedThread*>::iterator i = threads->begin();
i != threads->end();
- i++) {
+ ++i) {
if(VM* vm = (*i)->as_vm()) {
std::ostringstream ss;
vm->saved_call_frame()->print_backtrace(state_, ss);
@@ -389,9 +389,13 @@ namespace rubinius {
// over again (ie Proc.new) so we mark the method as not
// inlinable so that this works even with the JIT on.
+ if(!target) {
+ return Qnil;
+ }
+
target->cm->backend_method()->set_no_inline();
- if(target && target->scope) {
+ if(target->scope) {
return target->scope->block();
}
@@ -302,7 +302,7 @@ namespace rubinius {
for(IndirectLiterals::iterator i = vmm->indirect_literals().begin();
i != vmm->indirect_literals().end();
- i++) {
+ ++i) {
Object** ptr = (*i);
if((tmp = mark.call(*ptr)) != NULL) {
*ptr = tmp;
Oops, something went wrong.

0 comments on commit f79f0c9

Please sign in to comment.