Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin' into mcjit
Browse files Browse the repository at this point in the history
  • Loading branch information
brixen committed Apr 1, 2016
2 parents d348367 + 0deebd9 commit 1a7ff85
Show file tree
Hide file tree
Showing 204 changed files with 965 additions and 482 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ if [ $TRAVIS_OS_NAME == linux ]; then travis_retry ./configure --llvm-config=llv
if [ $TRAVIS_OS_NAME == osx ]; then travis_retry ./configure; fi
script: rake ci
after_success:
- if [ $TRAVIS_BRANCH == $TRAVIS_TAG ]; then ./scripts/deploy.sh release github website triggers docker; fi
- if [ $TRAVIS_BRANCH == $TRAVIS_TAG ]; then ./scripts/deploy.sh release github website triggers; fi
branches:
only:
- master
Expand Down
4 changes: 0 additions & 4 deletions core/compiled_code.rb
Original file line number Diff line number Diff line change
Expand Up @@ -698,8 +698,4 @@ def to_s
end
end
end

# NOTE: Temporary alias for backwards compatibility. CompiledMethod is
# deprecated. Client code should use CompiledCode.
CompiledMethod = CompiledCode
end
5 changes: 0 additions & 5 deletions core/constant_scope.rb
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,4 @@ def const_set(name, value)
@module.const_set name, value
end
end

# NOTE: Temporary alias for backwards compatibility. StaticScope will
# eventually be deprecated in favor of ConstantScope.
StaticScope = ConstantScope
end

4 changes: 2 additions & 2 deletions core/deprecations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ module Rubinius
# "Description" => "Alternative"
"Ruby 2.1 features that are incompatible with Ruby 2.2 are deprecated." =>
"Use Ruby 2.2 features if they are available.",
"Rubinius::CompiledMethod is deprecated." => "Use Rubinius::CompiledCode instead.",
"Rubinius::StaticScope is deprecated." => "Use Rubinius::ConstantScope instead.",
"Rubinius::KERNEL_PATH is deprecated." => "Use Rubinius::CORE_PATH instead.",
"CallCustom is deprecated." =>
"The replacement will be new executable resolution, cache, and invoke machine instructions.",
}
end
26 changes: 19 additions & 7 deletions core/gc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,27 @@ def garbage_collect
end

def self.count
data = stat
data[:"gc.young.count"] + data[:"gc.immix.count"]
if data = stat
data[:"gc.young.count"] + data[:"gc.immix.count"]
else
0
end
end

def self.time
data = stat
data[:"gc.young.ms"] +
data[:"gc.immix.stop.ms"] +
data[:"gc.large.sweep.us"] * 1_000
if data = stat
data[:"gc.young.ms"] +
data[:"gc.immix.stop.ms"] +
data[:"gc.large.sweep.us"] * 1_000
else
0
end
end

def self.stat
Rubinius::Metrics.data.to_hash
if Rubinius::Metrics.enabled?
return Rubinius::Metrics.data.to_hash
end
end

module Profiler
Expand Down Expand Up @@ -90,6 +98,10 @@ def self.report(out = $stdout)
end

def self.result
unless Rubinius::Metrics.enabled?
return "Rubinius::Metrics is disabled. GC::Profiler results are unavailable"
end

stats = GC.stat

out = <<-OUT
Expand Down
43 changes: 33 additions & 10 deletions core/io.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1169,7 +1169,7 @@ def initialize(fd, mode=undefined, options=undefined)
(@external || Encoding.default_external) == Encoding::ASCII_8BIT
@internal = nil
end
elsif @mode != RDONLY
elsif !mode_read_only?
if Encoding.default_external != Encoding.default_internal
@internal = Encoding.default_internal
end
Expand Down Expand Up @@ -1278,7 +1278,7 @@ def <<(obj)
def close_read
return if closed?

if @mode == WRONLY || @mode == RDWR
if mode_write_only? || mode_read_write?
raise IOError, 'closing non-duplex IO for reading'
end
close
Expand All @@ -1300,7 +1300,7 @@ def close_read
def close_write
return if closed?

if @mode == RDONLY || @mode == RDWR
if mode_read_only? || mode_read_write?
raise IOError, 'closing non-duplex IO for writing'
end
close
Expand Down Expand Up @@ -1636,19 +1636,17 @@ def eof?

def ensure_open_and_readable
ensure_open
write_only = @mode & ACCMODE == WRONLY
raise IOError, "not opened for reading" if write_only
raise IOError, "not opened for reading" if mode_write_only?
end

def ensure_open_and_writable
ensure_open
read_only = @mode & ACCMODE == RDONLY
raise IOError, "not opened for writing" if read_only
raise IOError, "not opened for writing" if mode_read_only?
end

def external_encoding
return @external if @external
return Encoding.default_external if @mode == RDONLY
return Encoding.default_external if mode_read_only?
end

##
Expand Down Expand Up @@ -1747,6 +1745,16 @@ def flush
self
end

def force_read_only
@mode = (@mode & ~ACCMODE ) | RDONLY
end
private :force_read_only

def force_write_only
@mode = (@mode & ~ACCMODE) | WRONLY
end
private :force_write_only

##
# Immediately writes all buffered data in ios to disk. Returns
# nil if the underlying operating system does not support fsync(2).
Expand Down Expand Up @@ -1831,6 +1839,21 @@ def lineno=(line_number)
@lineno = Integer(line_number)
end

def mode_read_only?
(@mode & ACCMODE) == RDONLY
end
private :mode_read_only?

def mode_read_write?
(@mode & ACCMODE) == RDWR
end
private :mode_read_write?

def mode_write_only?
(@mode & ACCMODE) == WRONLY
end
private :mode_write_only?

##
# FIXME
# Returns the process ID of a child process
Expand Down Expand Up @@ -2234,7 +2257,7 @@ def reopen(other, mode=undefined)
mode = @mode
# If this IO was already opened for writing, we should
# create the target file if it doesn't already exist.
if (mode & RDWR == RDWR) || (mode & WRONLY == WRONLY)
if mode_read_write? || mode_write_only?
mode |= CREAT
end
else
Expand Down Expand Up @@ -2301,7 +2324,7 @@ def set_encoding(external, internal=nil, options=undefined)
when String
@external = nil
when nil
if @mode == RDONLY || @external
if mode_read_only? || @external
@external = nil
else
@external = Encoding.default_external
Expand Down
6 changes: 6 additions & 0 deletions core/metrics.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
module Rubinius
module Metrics
@enabled = false

def self.enabled?
!!@enabled
end

def self.data
@data ||= Data.new
end
Expand Down
2 changes: 1 addition & 1 deletion gems_list.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ rubinius-bridge-1.1.0.gem
rubinius-code-3.0.gem
rubinius-compiler-3.1.gem
rubinius-coverage-2.0.3.gem
rubinius-debugger-2.2.1.gem
rubinius-debugger-2.4.gem
rubinius-developer_tools-2.0.0.gem
rubinius-instructions-3.0.gem
rubinius-melbourne-3.4.gem
Expand Down
1 change: 1 addition & 0 deletions library/gauntlet_rubygems.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rubygems'
require 'gauntlet'

Expand Down
85 changes: 74 additions & 11 deletions library/rubygems.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
# -*- ruby -*-
#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
Expand All @@ -9,7 +10,7 @@
require 'thread'

module Gem
VERSION = '2.5.1'
VERSION = '2.6.2'
end

# Must be first since it unloads the prelude from 1.9.2
Expand Down Expand Up @@ -191,8 +192,13 @@ def self.try_activate path

begin
spec.activate
rescue Gem::LoadError # this could fail due to gem dep collisions, go lax
Gem::Specification.find_by_name(spec.name).activate
rescue Gem::LoadError => e # this could fail due to gem dep collisions, go lax
spec_by_name = Gem::Specification.find_by_name(spec.name)
if spec_by_name.nil?
raise e
else
spec_by_name.activate
end
end

return true
Expand Down Expand Up @@ -229,16 +235,20 @@ def self.bin_path(name, exec_name = nil, *requirements)
requirements = Gem::Requirement.default if
requirements.empty?

find_spec_for_exe(name, exec_name, requirements).bin_file exec_name
end

def self.find_spec_for_exe name, exec_name, requirements
dep = Gem::Dependency.new name, requirements

loaded = Gem.loaded_specs[name]

return loaded.bin_file exec_name if loaded && dep.matches_spec?(loaded)
return loaded if loaded && dep.matches_spec?(loaded)

specs = dep.matching_specs(true)

raise Gem::GemNotFoundException,
"can't find gem #{name} (#{requirements})" if specs.empty?
"can't find gem #{dep}" if specs.empty?

specs = specs.find_all { |spec|
spec.executables.include? exec_name