Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rubinius/rubinius
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: cc10d862bac9
Choose a base ref
...
head repository: rubinius/rubinius
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 3c99cd941da1
Choose a head ref
Loading
Showing with 1,050 additions and 624 deletions.
  1. +1 −1 .bundle/config
  2. +16 −8 .travis.yml
  3. +23 −6 CONTRIBUTING
  4. +3 −1 Gemfile.installed
  5. +3 −1 README
  6. +4 −4 configure
  7. +5 −0 kernel/bootstrap/compiled_code.rb
  8. +20 −0 kernel/bootstrap/jit.rb
  9. +7 −2 kernel/bootstrap/thread.rb
  10. +43 −52 kernel/common/exception.rb
  11. +0 −4 kernel/common/io.rb
  12. +13 −10 kernel/common/process.rb
  13. +10 −0 kernel/loader.rb
  14. +7 −0 kernel/platform/pointer.rb
  15. +3 −3 library/rubinius/configuration.rb
  16. +1 −1 mspec/README
  17. +23 −0 mspec/lib/mspec/helpers/datetime.rb
  18. +1 −0 rakelib/package.rake
  19. +28 −2 spec/core/ffi/memorypointer/autorelease_spec.rb
  20. +99 −0 spec/jit/method_spec.rb
  21. +9 −0 spec/jit/spec_helper.rb
  22. +8 −4 spec/rbx.1.8.mspec
  23. +1 −1 spec/ruby/core/array/transpose_spec.rb
  24. +9 −0 spec/ruby/core/enumerable/shared/collect_concat.rb
  25. +31 −0 spec/ruby/core/exception/errno_spec.rb
  26. +15 −6 spec/ruby/core/exception/system_call_error_spec.rb
  27. +15 −0 spec/ruby/core/io/reopen_spec.rb
  28. +7 −0 spec/ruby/core/process/exitstatus_spec.rb
  29. +31 −0 spec/ruby/core/process/initialize_spec.rb
  30. +0 −75 spec/ruby/core/string/ascii_only_spec.rb
  31. +10 −0 spec/ruby/core/thread/join_spec.rb
  32. +1 −0 spec/ruby/language/block_spec.rb
  33. +39 −0 spec/ruby/language/optional_assignments_spec.rb
  34. +13 −8 spec/ruby/language/send_spec.rb
  35. +0 −15 spec/ruby/nbproject/project.properties
  36. +0 −18 spec/ruby/nbproject/project.xml
  37. +10 −0 spec/ruby/optional/capi/ext/array_spec.c
  38. +0 −1 spec/ruby/optional/capi/ext/io_spec.c
  39. +2 −0 spec/ruby/optional/capi/ext/rubyspec.h
  40. +6 −0 spec/ruby/optional/capi/object_spec.rb
  41. +69 −23 spec/ruby/shared/process/spawn.rb
  42. +2 −0 spec/tags/jit/method_tags.txt
  43. +1 −0 spec/tags/ruby/language/optional_assignments_tags.txt
  44. +0 −21 vendor/.gitignore
  45. +1 −1 vm/builtin/block_environment.cpp
  46. +2 −7 vm/builtin/call_site.cpp
  47. +11 −3 vm/builtin/class.cpp
  48. +8 −2 vm/builtin/class.hpp
  49. +40 −17 vm/builtin/compiled_code.cpp
  50. +4 −1 vm/builtin/compiled_code.hpp
  51. +12 −7 vm/builtin/exception.cpp
  52. +2 −2 vm/builtin/exception.hpp
  53. +15 −4 vm/builtin/ffi_pointer.cpp
  54. +3 −0 vm/builtin/ffi_pointer.hpp
  55. +23 −14 vm/builtin/io.cpp
  56. +7 −0 vm/builtin/io.hpp
  57. +32 −0 vm/builtin/jit.cpp
  58. +12 −0 vm/builtin/jit.hpp
  59. +1 −1 vm/builtin/location.cpp
  60. +3 −3 vm/builtin/module.cpp
  61. +0 −4 vm/builtin/mono_inline_cache.cpp
  62. +7 −12 vm/builtin/object.cpp
  63. +2 −7 vm/builtin/poly_inline_cache.cpp
  64. +20 −17 vm/builtin/system.cpp
  65. +2 −2 vm/builtin/thread.cpp
  66. +1 −1 vm/call_frame.cpp
  67. +4 −0 vm/capi/array.cpp
  68. +5 −0 vm/capi/io.cpp
  69. +10 −9 vm/console.cpp
  70. +9 −7 vm/dtrace/dtrace.h
  71. +2 −2 vm/environment.cpp
  72. +4 −4 vm/gc/finalize.cpp
  73. +3 −3 vm/gc/immix_marker.cpp
  74. +1 −0 vm/globals.hpp
  75. +3 −0 vm/include/capi/ruby.h
  76. +1 −1 vm/instruments/rbxti.cpp
  77. +0 −11 vm/llvm/control_flow.hpp
  78. +5 −9 vm/llvm/inline.cpp
  79. +25 −15 vm/llvm/inline_policy.hpp
  80. +4 −23 vm/llvm/inline_primitive.cpp
  81. +2 −17 vm/llvm/jit_builder.cpp
  82. +24 −25 vm/llvm/jit_compiler.cpp
  83. +0 −1 vm/llvm/jit_context.cpp
  84. +0 −9 vm/llvm/jit_context.hpp
  85. +1 −1 vm/llvm/jit_operations.hpp
  86. +4 −8 vm/llvm/jit_visit.hpp
  87. +1 −8 vm/llvm/opcode_iter.hpp
  88. +94 −50 vm/llvm/state.cpp
  89. +21 −3 vm/llvm/state.hpp
  90. +0 −2 vm/machine_code.cpp
  91. +1 −1 vm/machine_code.hpp
  92. +10 −6 vm/metrics.cpp
  93. +3 −0 vm/metrics.hpp
  94. +0 −26 vm/shared_state.cpp
  95. +0 −1 vm/shared_state.hpp
  96. +4 −4 vm/signal.cpp
  97. +5 −0 vm/util/configuration.hpp
  98. +6 −6 vm/util/logger.cpp
  99. +1 −0 vm/util/logger.hpp
2 changes: 1 addition & 1 deletion .bundle/config
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
---
BUNDLE_NO_PRUNE: true
24 changes: 16 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -3,6 +3,10 @@ compiler:
- gcc
- clang
before_install:
- echo $LANG
- echo $LC_ALL
- if [ $TRAVIS_OS_NAME == linux ]; then sudo apt-get update && sudo apt-get install -y llvm-3.4 llvm-3.4-dev; fi
- if [ $TRAVIS_OS_NAME == osx ]; then brew update && brew install llvm && brew link --force llvm; fi
- rvm use $RVM --install --binary --fuzzy
- gem update --system
- gem --version
@@ -15,16 +19,20 @@ branches:
- master
- 1.8.7
notifications:
recipients:
- brixen@gmail.com
- d.bussink@gmail.com
email:
on_success: change
on_failure: always
irc:
channels:
- "chat.freenode.net#rubinius"
template:
- "%{repository}/%{branch} (%{commit} - %{author}): %{message}"
- "%{repository}/%{branch} (%{commit} - %{author}): %{build_url}: %{message}"
webhooks:
urls:
- https://webhooks.gitter.im/e/9502afd22ca6c8e85fb3
on_success: change
on_failure: always
on_start: false
env:
- RVM=2.0.0
- RVM=2.0.0 LANG="en_US.UTF-8"
os:
- linux
- osx
osx_image: xcode61
29 changes: 23 additions & 6 deletions CONTRIBUTING
Original file line number Diff line number Diff line change
@@ -11,16 +11,19 @@ Please include the following:
* The Rubinius version (rbx -v)
* Your OS (uname -a) RVM/rbenv/chruby/etc version or the commit hash from git
if you're building off of a clone
* Stack trace (preferably as a gist, since they're easier to read) If you can
* Stack trace (preferably as a Gist, since they're easier to read) If you can
add a failing spec, that's great!
* Please include the simplest possible reproduction you can. This last point is
vital to fixing issues.
If you are unable to build from source, please also include

If available, please also include the contents of the following files as a Gist:

* configure.log
* config.rb

These two files contain the output of the compilation process and the various
configuration options used (e.g. compiler options).

Regarding the formatting of the README:

The Rubinius team will not merge pull requests that change the formatting of
@@ -59,16 +62,30 @@ or the shortened version core/array above.
* Please follow the Coding Style Guide at
http://rubini.us/doc/en/contributing/style-guide
* ALWAYS RUN THE FULL SPEC SUITE! 'rake' will run the VM specs plus RubySpec.
* Please add a * detailed commit message. Here is a fantastic example by
@ryoqun https://github.com/rubinius/rubinius/commit/1f9ddd1
* Please add a detailed commit message. Here is a fantastic example by
@ryoqun https://github.com/rubinius/rubinius/commit/1f9ddd1.
The preference is for a (max) 50 character summary as line one, a blank line,
then any number of lines, no longer than 80 characters.
* Send in that pull request!
* Follow up with us on the ticket if we haven't merged or commented in a few
days. We strive to address issues in a reasonable time. If we miss yours,
please remind us.
* When unsure about the changes, associated specs or other topics, please ask!
We're more than eager to help.

4. Writing Specs

A lot of this is already covered at http://rubini.us/doc/en/how-to/write-a-spec/
but the basic gist of it is as following:

* Spec descriptions (for both "describe" and "it" blocks) should be written in
natural English.
* Specs should include only the bare minimum that is required to test something.
* Setup code that is re-used between examples should be placed in a before()
block
* When unsure, please ask!

4. Performance patches
5. Performance patches

We love these!

4 changes: 3 additions & 1 deletion Gemfile.installed
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
source 'https://rubygems.org'

gem "bundler", "~> 1.7"

gem "rubinius-build_tools", "~> 1.0"
gem "rubinius-developer_tools", "~> 2.0"
gem "rubinius-toolset", "~> 2.2.0"

gem "rubysl", "~> 1.0"
@@ -11,3 +12,4 @@ gem "racc", "~> 1.4"
gem "rake", "~> 10.1"
gem "json", "~> 1.8"
gem "rdoc", "~> 4.0"
gem "rb-readline", "~> 0.5"
4 changes: 3 additions & 1 deletion README
Original file line number Diff line number Diff line change
@@ -41,7 +41,9 @@ To install Rubinius, use the following steps:
6. rake

When the install process finishes, follow the directions printed to the
terminal to add the Rubinius executable (bin) directory to your PATH.
terminal to add the Rubinius executable (bin) directory to your PATH. For more
information see http://rubini.us/doc/en/getting-started/requirements/
and http://rubini.us/doc/en/getting-started/building/.

If you are unable to build melbourne during the rake step you may be using an
incompatible version of bison. Rubinius 2.x/melbourne 2.x can be built with
8 changes: 4 additions & 4 deletions configure
Original file line number Diff line number Diff line change
@@ -596,6 +596,9 @@ Unsupported language version requested: #{version}. Options are #{@supported_ver
end
if which
config = File.join(which, "llvm-config")
elsif @darwin
out = `brew list llvm | grep '/llvm-config$'`
config = out.chomp if $?.success?
end
end

@@ -745,9 +748,6 @@ int main() { LLVMContext &Context = getGlobalContext(); }
@ldsharedxx = "#{@cxx} -shared"
@ldshared = "#{@cc} -shared"

@system_cflags << " -Wno-unused-result "
@system_cxxflags << " -Wno-unused-result "

@include_dirs.each do |d|
@system_cflags << "-I#{d} "
end
@@ -1449,7 +1449,7 @@ int main() { return tgetnum(""); }
@libc = "libc.dylib"
else
begin
exe = ENV["SHELL"] || "/usr/sh"
exe = ENV["SHELL"] || "/bin/sh"
ldd_output = `ldd #{exe}`

@libc = ldd_output[/libc\.so\.[0-9]+/]
5 changes: 5 additions & 0 deletions kernel/bootstrap/compiled_code.rb
Original file line number Diff line number Diff line change
@@ -43,6 +43,11 @@ def self.of_sender
raise PrimitiveFailure, "CompiledCode.of_sender primitive failed"
end

def jitted?
Rubinius.primitive :compiledcode_jitted_p
raise PrimitiveFailure, "CompiledCode.jitted? primitive failed"
end

# Returns the CompiledCode object for the currently executing Ruby
# method. For example:
#
20 changes: 20 additions & 0 deletions kernel/bootstrap/jit.rb
Original file line number Diff line number Diff line change
@@ -7,6 +7,26 @@ class << self

alias_method :available?, :available
alias_method :enabled?, :enabled

def compile(object, compiled_code, block_environment=nil)
Rubinius.invoke_primitive :jit_compile, self, object, compiled_code, block_environment
end

# TODO: Fix configuration
def compile_threshold
Rubinius.primitive :jit_compile_threshold
raise PrimitiveFailure, "Rubinius::JIT.compile_threshold primitive failed"
end

def sync=(flag)
Rubinius.primitive :jit_sync_set
raise PrimitiveFailure, "Rubinius::JIT.sync primitive failed"
end

def sync
Rubinius.primitive :jit_sync_get
raise PrimitiveFailure, "Rubinius::JIT.sync primitive failed"
end
end
end
end
9 changes: 7 additions & 2 deletions kernel/bootstrap/thread.rb
Original file line number Diff line number Diff line change
@@ -313,6 +313,11 @@ def add_to_group(group)
end

def join_inner(timeout = undefined)
if undefined.equal?(timeout) || nil.equal?(timeout)
timeout = nil
else
timeout = Rubinius::Type.coerce_to_float(timeout)
end
result = nil
Rubinius.lock(self)
begin
@@ -321,14 +326,14 @@ def join_inner(timeout = undefined)
@joins << jc
Rubinius.unlock(self)
begin
if undefined.equal? timeout
if !timeout
while true
res = jc.receive
# receive returns false if it was a spurious wakeup
break if res != false
end
else
duration = timeout.to_f
duration = timeout
while true
start = Time.now.to_f
res = jc.receive_timeout duration
95 changes: 43 additions & 52 deletions kernel/common/exception.rb
Original file line number Diff line number Diff line change
@@ -288,10 +288,6 @@ class EOFError < IOError
class LocalJumpError < StandardError
end

# For libraries that Rubinius does not support
class UnsupportedLibraryError < StandardError
end

class SyntaxError < ScriptError
attr_accessor :column
attr_accessor :line
@@ -353,7 +349,7 @@ class SystemCallError < StandardError

attr_reader :errno

def self.errno_error(message, errno)
def self.errno_error(message, errno, location)
Rubinius.primitive :exception_errno_error
raise PrimitiveFailure, "SystemCallError.errno_error failed"
end
@@ -362,71 +358,64 @@ def self.errno_error(message, errno)
# lookup and return a subclass of SystemCallError, specificly,
# one of the Errno subclasses.
def self.new(*args)
case args.size
when 0
message = errno = undefined
when 1
message = args.first
errno = undefined
else
message, errno = args
end

# This method is used 2 completely different ways. One is when it's called
# on SystemCallError, in which case it tries to construct a Errno subclass
# or makes a generic instead of itself.
#
# Otherwise it's called on a Errno subclass and just helps setup
# a instance of the subclass
if self.equal? SystemCallError
if undefined.equal? message
raise ArgumentError, "must supply at least a message/errno"
end

if undefined.equal? errno
if message.kind_of?(Fixnum)
if inst = SystemCallError.errno_error(nil, message)
return inst
else # It's some random errno
errno = message
message = nil
end
case args.size
when 1
if args.first.kind_of?(Fixnum)
errno = args.first
message = nil
else
errno = nil
message = StringValue(args.first)
end
location = nil
when 2
message, errno = args
location = nil
when 3
message, errno, location = args
else
message = StringValue(message) if message

if errno.kind_of? Fixnum
if error = SystemCallError.errno_error(message, errno)
return error
end
end
raise ArgumentError, "wrong number of arguments (#{args.size} for 1..3)"
end

return super(message, errno)
else
unless undefined.equal? errno
raise ArgumentError, "message is the only argument"
end

if message and !undefined.equal?(message)
message = StringValue(message)
# If it corresponds to a known Errno class, create and return it now
if errno && error = SystemCallError.errno_error(message, errno, location)
return error
else
return super(message, errno, location)
end

if self::Errno.kind_of? Fixnum
error = SystemCallError.errno_error(message, self::Errno)
else
case args.size
when 0
message = nil
location = nil
when 1
message = StringValue(args.first)
location = nil
when 2
message, location = args
else
error = allocate
raise ArgumentError, "wrong number of arguments (#{args.size} for 0..2)"
end

if error
Rubinius::Unsafe.set_class error, self
Rubinius.privately { error.initialize(*args) }
return error
if defined?(self::Errno) && self::Errno.kind_of?(Fixnum)
errno = self::Errno
error = SystemCallError.errno_error(message, self::Errno, location)
if error && error.class.equal?(self)
return error
end
end

raise TypeError, "invalid Errno subclass"
error = allocate
Rubinius::Unsafe.set_class error, self
Rubinius.privately { error.initialize(*args) }
return error
end
end

@@ -438,10 +427,12 @@ class << self

# Use splat args here so that arity returns -1 to match MRI.
def initialize(*args)
message, errno = args
kls = self.class
message, errno, location = args
@errno = errno

msg = "unknown error"
msg << " @ #{StringValue(location)}" if location
msg << " - #{StringValue(message)}" if message
super(msg)
end
4 changes: 0 additions & 4 deletions kernel/common/io.rb
Original file line number Diff line number Diff line change
@@ -509,10 +509,6 @@ def self.setup(io, fd, mode=nil, sync=false)
end
end

def self.max_open_fd
@max_open_fd.get
end

def self.pipe
lhs = allocate
rhs = allocate
Loading