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: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: e5034396002a
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 8d68c0dc43d4
Choose a head ref
  • 2 commits
  • 4 files changed
  • 1 contributor

Commits on Jun 29, 2015

  1. Copy the full SHA
    ede82ac View commit details
  2. Copy the full SHA
    8d68c0d View commit details
Original file line number Diff line number Diff line change
@@ -29,7 +29,6 @@ public class DefineOrGetClassNode extends DefineOrGetModuleNode {

@Child private RubyNode superClass;
@Child private CallDispatchHeadNode inheritedNode;
@Child private KernelNodes.RequireNode requireNode;

public DefineOrGetClassNode(RubyContext context, SourceSection sourceSection, String name, RubyNode lexicalParent, RubyNode superClass) {
super(context, sourceSection, name, lexicalParent);
1 change: 1 addition & 0 deletions truffle/src/main/ruby/core.rb
Original file line number Diff line number Diff line change
@@ -172,6 +172,7 @@ def self.omit(reason)
require_relative 'core/rubinius/common/false'
#require_relative 'core/rubinius/common/fiber'
require_relative 'core/rubinius/common/io'
require_relative 'core/rubinius/api/shims/io'
require_relative 'core/rubinius/common/file'
require_relative 'core/rubinius/common/dir'
require_relative 'core/rubinius/common/dir_glob'
72 changes: 72 additions & 0 deletions truffle/src/main/ruby/core/rubinius/api/shims/io.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Copyright (c) 2007-2015, Evan Phoenix and contributors
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# * Neither the name of Rubinius nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

class IO

#
# Internally associate +io+ with the given descriptor.
#
# The +mode+ will be checked and set as the current mode if
# the underlying descriptor allows it.
#
# The +sync+ attribute will also be set.
#
def self.setup(io, fd, mode=nil, sync=false)
cur_mode = FFI::Platform::POSIX.fcntl(fd, F_GETFL, 0)
Errno.handle if cur_mode < 0

cur_mode &= ACCMODE

if mode
mode = parse_mode(mode)
mode &= ACCMODE

if (cur_mode == RDONLY or cur_mode == WRONLY) and mode != cur_mode
raise Errno::EINVAL, "Invalid new mode for existing descriptor #{fd}"
end
end

# Truffle: close old descriptor if there was already one associated
io.close if io.descriptor

io.descriptor = fd
io.mode = mode || cur_mode
io.sync = !!sync

# Truffle: STDOUT isn't defined by the time this call is made during bootstrap, so we need to guard it.
# if STDOUT.respond_to?(:fileno) and not STDOUT.closed?
if defined? STDOUT and STDOUT.respond_to?(:fileno) and not STDOUT.closed?
io.sync ||= STDOUT.fileno == fd
end

# Truffle: STDERR isn't defined by the time this call is made during bootstrap, so we need to guard it.
# if STDERR.respond_to?(:fileno) and not STDERR.closed?
if defined? STDERR and STDERR.respond_to?(:fileno) and not STDERR.closed?
io.sync ||= STDERR.fileno == fd
end
end

end
48 changes: 20 additions & 28 deletions truffle/src/main/ruby/core/rubinius/common/io.rb
Original file line number Diff line number Diff line change
@@ -24,9 +24,6 @@
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

# IO#setup modified to not refer to STDOUT and STDERR if they aren't defined,
# as we create those as files using normal File.new.

class IO
FFI = Rubinius::FFI

@@ -979,38 +976,33 @@ def self.sysopen(path, mode = nil, perm = nil)
#
# The +sync+ attribute will also be set.
#
def self.setup(io, fd, mode=nil, sync=false)
cur_mode = FFI::Platform::POSIX.fcntl(fd, F_GETFL, 0)
Errno.handle if cur_mode < 0
Truffle.omit("This method is completely redefined in api/shims/io.rb. A simple override doesn't work due to bootstrapping issues, so the method must be omitted here.") do
def self.setup(io, fd, mode=nil, sync=false)
cur_mode = FFI::Platform::POSIX.fcntl(fd, F_GETFL, 0)
Errno.handle if cur_mode < 0

cur_mode &= ACCMODE
cur_mode &= ACCMODE

if mode
mode = parse_mode(mode)
mode &= ACCMODE
if mode
mode = parse_mode(mode)
mode &= ACCMODE

if (cur_mode == RDONLY or cur_mode == WRONLY) and mode != cur_mode
raise Errno::EINVAL, "Invalid new mode for existing descriptor #{fd}"
if (cur_mode == RDONLY or cur_mode == WRONLY) and mode != cur_mode
raise Errno::EINVAL, "Invalid new mode for existing descriptor #{fd}"
end
end
end

# Truffle: close old descriptor if there was already one associated
io.close if io.descriptor
io.descriptor = fd
io.mode = mode || cur_mode
io.sync = !!sync

io.descriptor = fd
io.mode = mode || cur_mode
io.sync = !!sync

# Truffle: STDOUT isn't defined by the time this call is made during bootstrap, so we need to guard it.
# if STDOUT.respond_to?(:fileno) and not STDOUT.closed?
if defined? STDOUT and STDOUT.respond_to?(:fileno) and not STDOUT.closed?
io.sync ||= STDOUT.fileno == fd
end
if STDOUT.respond_to?(:fileno) and not STDOUT.closed?
io.sync ||= STDOUT.fileno == fd
end

# Truffle: STDERR isn't defined by the time this call is made during bootstrap, so we need to guard it.
# if STDERR.respond_to?(:fileno) and not STDERR.closed?
if defined? STDERR and STDERR.respond_to?(:fileno) and not STDERR.closed?
io.sync ||= STDERR.fileno == fd
if STDERR.respond_to?(:fileno) and not STDERR.closed?
io.sync ||= STDERR.fileno == fd
end
end
end