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: 4bd8d716f6af
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 3fb769474681
Choose a head ref
  • 8 commits
  • 27 files changed
  • 3 contributors

Commits on May 17, 2015

  1. Copy the full SHA
    9889853 View commit details
  2. Copy the full SHA
    096b8a0 View commit details
  3. Copy the full SHA
    34dd04d View commit details
  4. [Truffle] Add argf to core

    bjfish committed May 17, 2015
    3
    Copy the full SHA
    af179e5 View commit details
  5. Copy the full SHA
    5c87624 View commit details
  6. 5
    Copy the full SHA
    23b320e View commit details
  7. Copy the full SHA
    29efc12 View commit details

Commits on May 18, 2015

  1. Copy the full SHA
    3fb7694 View commit details
Showing with 612 additions and 82 deletions.
  1. +1 −1 spec/ruby/core/module/remove_method_spec.rb
  2. +0 −1 spec/truffle/tags/core/argf/argf_tags.txt
  3. +0 −2 spec/truffle/tags/core/argf/binmode_tags.txt
  4. +0 −3 spec/truffle/tags/core/argf/codepoints_tags.txt
  5. +0 −3 spec/truffle/tags/core/argf/each_codepoint_tags.txt
  6. +0 −3 spec/truffle/tags/core/argf/each_line_tags.txt
  7. +0 −3 spec/truffle/tags/core/argf/each_tags.txt
  8. +0 −1 spec/truffle/tags/core/argf/gets_tags.txt
  9. +0 −3 spec/truffle/tags/core/argf/lines_tags.txt
  10. +0 −3 spec/truffle/tags/core/argf/read_tags.txt
  11. +0 −1 spec/truffle/tags/core/argf/readline_tags.txt
  12. +0 −1 spec/truffle/tags/core/argf/seek_tags.txt
  13. +0 −1 spec/truffle/tags/core/argf/skip_tags.txt
  14. +0 −1 spec/truffle/tags/core/argf/to_s_tags.txt
  15. +0 −2 spec/truffle/tags/core/module/remove_method_tags.txt
  16. +2 −0 spec/truffle/tags/library/ipaddr/hton_tags.txt
  17. +3 −0 spec/truffle/tags/library/ipaddr/new_tags.txt
  18. +4 −1 spec/truffle/truffle.mspec
  19. +0 −2 test/check_versions.sh
  20. +12 −12 truffle/src/main/java/org/jruby/truffle/nodes/core/ModuleNodes.java
  21. +0 −2 truffle/src/main/java/org/jruby/truffle/pack/parser/PackParser.java
  22. +5 −0 truffle/src/main/java/org/jruby/truffle/runtime/core/CoreLibrary.java
  23. +1 −3 truffle/src/main/java/org/jruby/truffle/runtime/core/RubyModule.java
  24. +1 −1 truffle/src/main/ruby/core.rb
  25. +558 −0 truffle/src/main/ruby/core/rubinius/common/argf.rb
  26. +0 −2 truffle/src/main/ruby/core/shims.rb
  27. +25 −30 truffle/src/main/ruby/core/truffle/cext/require.rb
2 changes: 1 addition & 1 deletion spec/ruby/core/module/remove_method_spec.rb
Original file line number Diff line number Diff line change
@@ -47,7 +47,7 @@ def method_to_remove; 2; end
x.method_to_remove.should == 1
end

it "requires multiple arguments" do
it "accepts multiple arguments" do
Module.instance_method(:remove_method).arity.should < 0
end

1 change: 0 additions & 1 deletion spec/truffle/tags/core/argf/argf_tags.txt

This file was deleted.

2 changes: 0 additions & 2 deletions spec/truffle/tags/core/argf/binmode_tags.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
fails:ARGF.binmode returns self
fails:ARGF.binmode does not raise an error
fails:ARGF.binmode sets the file's encoding to ASCII-8BIT
fails:ARGF.binmode puts reading into binmode
fails:ARGF.binmode puts alls subsequent stream reading through ARGF into binmode
3 changes: 0 additions & 3 deletions spec/truffle/tags/core/argf/codepoints_tags.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
fails:ARGF.codepoints is a public method
fails:ARGF.codepoints does not require arguments
fails:ARGF.codepoints returns self when passed a block
fails:ARGF.codepoints returns an Enumerator when passed no block
fails:ARGF.codepoints yields each codepoint of all streams
3 changes: 0 additions & 3 deletions spec/truffle/tags/core/argf/each_codepoint_tags.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
fails:ARGF.each_codepoint is a public method
fails:ARGF.each_codepoint does not require arguments
fails:ARGF.each_codepoint returns self when passed a block
fails:ARGF.each_codepoint returns an Enumerator when passed no block
fails:ARGF.each_codepoint yields each codepoint of all streams
3 changes: 0 additions & 3 deletions spec/truffle/tags/core/argf/each_line_tags.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
fails:ARGF.each_line is a public method
fails:ARGF.each_line requires multiple arguments
fails:ARGF.each_line reads each line of files
fails:ARGF.each_line returns self when passed a block
fails:ARGF.each_line returns an Enumerator when passed no block
fails:ARGF.each_line with a separator yields each separated section of all streams
3 changes: 0 additions & 3 deletions spec/truffle/tags/core/argf/each_tags.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
fails:ARGF.each is a public method
fails:ARGF.each requires multiple arguments
fails:ARGF.each reads each line of files
fails:ARGF.each returns self when passed a block
fails:ARGF.each returns an Enumerator when passed no block
fails:ARGF.each with a separator yields each separated section of all streams
1 change: 0 additions & 1 deletion spec/truffle/tags/core/argf/gets_tags.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
fails:ARGF.gets reads one line of a file
fails:ARGF.gets reads all lines of a file
fails:ARGF.gets reads all lines of stdin
fails:ARGF.gets reads all lines of two files
fails:ARGF.gets sets $_ global variable with each line read
fails:ARGF.gets modifies the files when in place edit mode is on
3 changes: 0 additions & 3 deletions spec/truffle/tags/core/argf/lines_tags.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
fails:ARGF.lines is a public method
fails:ARGF.lines requires multiple arguments
fails:ARGF.lines reads each line of files
fails:ARGF.lines returns self when passed a block
fails:ARGF.lines returns an Enumerator when passed no block
fails:ARGF.lines with a separator yields each separated section of all streams
3 changes: 0 additions & 3 deletions spec/truffle/tags/core/argf/read_tags.txt
Original file line number Diff line number Diff line change
@@ -7,9 +7,6 @@ fails:ARGF.read reads from a single file consecutively
fails:ARGF.read reads the contents of two files
fails:ARGF.read reads the contents of one file and some characters from the second
fails:ARGF.read reads across two files consecutively
fails:ARGF.read reads the contents of stdin
fails:ARGF.read reads a number of bytes from stdin
fails:ARGF.read reads the contents of one file and stdin
fails:ARGF.read reads the contents of the same file twice
fails:ARGF.read reads the contents of a special device file
fails:ARGF.read reads the contents of the file with default encoding
1 change: 0 additions & 1 deletion spec/truffle/tags/core/argf/readline_tags.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
fails:ARGF.readline reads one line of a file
fails:ARGF.readline reads all lines of a file
fails:ARGF.readline reads all lines of stdin
fails:ARGF.readline reads all lines of two files
fails:ARGF.readline sets $_ global variable with each line read
fails:ARGF.readline modifies the files when in place edit mode is on
1 change: 0 additions & 1 deletion spec/truffle/tags/core/argf/seek_tags.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
fails:ARGF.seek sets the absolute position relative to beginning of file
fails:ARGF.seek sets the position relative to current position in file
fails:ARGF.seek sets the absolute position relative to end of file
fails:ARGF.seek takes at least one argument (offset)
1 change: 0 additions & 1 deletion spec/truffle/tags/core/argf/skip_tags.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
fails:ARGF.skip skips the current file
fails:ARGF.skip has no effect when called twice in a row
fails:ARGF.skip has no effect at end of stream
fails:ARGF.skip has no effect when the current file is the last
1 change: 0 additions & 1 deletion spec/truffle/tags/core/argf/to_s_tags.txt

This file was deleted.

2 changes: 0 additions & 2 deletions spec/truffle/tags/core/module/remove_method_tags.txt

This file was deleted.

2 changes: 2 additions & 0 deletions spec/truffle/tags/library/ipaddr/hton_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fails:IPAddr#hton converts IPAddr to network byte order
fails:IPAddr#new_ntoh creates a new IPAddr using hton notation
3 changes: 3 additions & 0 deletions spec/truffle/tags/library/ipaddr/new_tags.txt
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
fails:IPAddr#new initializes IPAddr ipv4 mapped address with subnet mask
fails:IPAddr#new initializes IPAddr ipv4 address
fails:IPAddr#new initializes IPAddr ipv4 address with / subnet notation
fails:IPAddr#new initializes IPAddr ipv4 address with subnet mask
5 changes: 4 additions & 1 deletion spec/truffle/truffle.mspec
Original file line number Diff line number Diff line change
@@ -51,7 +51,10 @@ class MSpecScript
# "^spec/ruby/core/string/gsub_spec.rb",

# require etc, linux only spec
"^spec/ruby/core/io/advise_spec.rb"
"^spec/ruby/core/io/advise_spec.rb",

# Pollutes other tests
"^spec/ruby/core/argf/binmode_spec.rb"
]

core += [
2 changes: 0 additions & 2 deletions test/check_versions.sh
Original file line number Diff line number Diff line change
@@ -12,7 +12,6 @@ rm -rf maven/*/target/*
./mvnw -Pcomplete
./mvnw -Pdist
./mvnw -Pjruby-jars
./mvnw -Pjruby-tests
./mvnw -Pmain

declare -a failed
@@ -62,7 +61,6 @@ function check {

}

check test/target/jruby-tests-$jar_version.jar 1
check lib/target/jruby-stdlib-$jar_version.jar 8
check maven/jruby-jars/pkg/jruby-jars-$gem_version.gem 30
check maven/jruby-jars/lib/jruby-core-$jar_version-complete.jar 13
24 changes: 12 additions & 12 deletions truffle/src/main/java/org/jruby/truffle/nodes/core/ModuleNodes.java
Original file line number Diff line number Diff line change
@@ -44,6 +44,7 @@
import org.jruby.truffle.nodes.dispatch.DispatchAction;
import org.jruby.truffle.nodes.dispatch.DispatchHeadNode;
import org.jruby.truffle.nodes.dispatch.MissingBehavior;
import org.jruby.truffle.nodes.literal.ObjectLiteralNode;
import org.jruby.truffle.nodes.methods.SetMethodDeclarationContext;
import org.jruby.truffle.nodes.objects.*;
import org.jruby.truffle.nodes.yield.YieldDispatchHeadNode;
@@ -1681,29 +1682,28 @@ Object removeConstant(RubyModule module, String name) {
@CoreMethod(names = "remove_method", argumentsAsArray = true, visibility = Visibility.PRIVATE)
public abstract static class RemoveMethodNode extends CoreMethodArrayArgumentsNode {

@Child SymbolOrToStrNode symbolOrToStrNode;
@Child RaiseIfFrozenNode raiseIfFrozenNode;

public RemoveMethodNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
this.symbolOrToStrNode = SymbolOrToStrNodeGen.create(context, sourceSection, null);
this.raiseIfFrozenNode = new RaiseIfFrozenNode(new SelfNode(context, sourceSection));
}

@CompilerDirectives.TruffleBoundary
@Specialization
public RubyModule removeMethod(RubyModule module, Object[] args) {
public RubyModule removeMethod(VirtualFrame frame, RubyModule module, Object[] args) {
for (Object arg : args) {
final String name;
final String name = symbolOrToStrNode.executeToJavaString(frame, arg);
raiseIfFrozenNode.execute(frame);

if (arg instanceof RubySymbol) {
name = ((RubySymbol) arg).toString();
} else if (arg instanceof RubyString) {
name = ((RubyString) arg).toString();
if (module.getMethods().containsKey(name)) {
module.removeMethod(name);
} else {
// TODO BF 9-APR-2015 the MRI message calls inspect for error message i think
CompilerDirectives.transferToInterpreter();
throw new RaiseException(getContext().getCoreLibrary().typeError(" is not a symbol", this));
throw new RaiseException(getContext().getCoreLibrary().nameErrorMethodNotDefinedIn(module, name, this));
}
module.removeMethod(this, name);

}

return module;
}

Original file line number Diff line number Diff line change
@@ -76,8 +76,6 @@ public PackNode parse(PackTokenizer tokenizer, boolean inParens) {
throw new UnsupportedOperationException("unbalanced parens");
}
case 'C':
node = writeInteger(8, nativeEndianness());
break;
case 'c':
node = writeInteger(8, nativeEndianness());
break;
Original file line number Diff line number Diff line change
@@ -939,6 +939,11 @@ public RubyException nameErrorUndefinedMethod(String name, RubyModule module, No
return nameError(String.format("undefined method `%s' for %s", name, module.getName()), name, currentNode);
}

public RubyException nameErrorMethodNotDefinedIn(RubyModule module, String name, Node currentNode) {
CompilerAsserts.neverPartOfCompilation();
return nameError(String.format("method `%s' not defined in %s", name, module.getName()), name, currentNode);
}

public RubyException nameErrorPrivateMethod(String name, RubyModule module, Node currentNode) {
CompilerAsserts.neverPartOfCompilation();
return nameError(String.format("method `%s' for %s is private", name, module.getName()), name, currentNode);
Original file line number Diff line number Diff line change
@@ -278,9 +278,7 @@ public void addMethod(Node currentNode, InternalMethod method) {
}

@TruffleBoundary
public void removeMethod(Node currentNode, String methodName) {
checkFrozen(currentNode);

public void removeMethod(String methodName) {
methods.remove(methodName);
newVersion();
}
2 changes: 1 addition & 1 deletion truffle/src/main/ruby/core.rb
Original file line number Diff line number Diff line change
@@ -109,7 +109,7 @@
require_relative 'core/rubinius/common/proc'
require_relative 'core/rubinius/common/enumerable'
require_relative 'core/rubinius/common/enumerator'
#require_relative 'core/rubinius/common/argf'
require_relative 'core/rubinius/common/argf'
#require_relative 'core/rubinius/common/tuple'
require_relative 'core/rubinius/common/exception'
require_relative 'core/rubinius/common/undefined'
558 changes: 558 additions & 0 deletions truffle/src/main/ruby/core/rubinius/common/argf.rb

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions truffle/src/main/ruby/core/shims.rb
Original file line number Diff line number Diff line change
@@ -50,8 +50,6 @@ def external_encoding
end
end

ARGF = Object.new

class Regexp
def self.last_match(n = nil)
if n
55 changes: 25 additions & 30 deletions truffle/src/main/ruby/core/truffle/cext/require.rb
Original file line number Diff line number Diff line change
@@ -6,47 +6,42 @@
# GNU General Public License version 2
# GNU Lesser General Public License version 2.1

module Kernel
if Truffle::CExt.supported?

if Truffle::CExt.supported?
# Monkey patch #require, similar to how RubyGems does, in order to load
# C extensions.

# Monkey patch #require, similar to how RubyGems does, in order to load
# C extensions.
def require(name)
puts "here!"

alias_method :truffle_cext_original_require, :require
# We're getting quite hacky here. A lot of C extensions are required
# using the format foo/foo, so we need to guess that the real name is
# foo from that.

def require(name)
# We're getting quite hacky here. A lot of C extensions are required
# using the format foo/foo, so we need to guess that the real name is
# foo from that.

if name =~ /(.+?)\/\1/
cext_name = $1
else
cext_name = name
end
if name =~ /(.+?)\/\1/
cext_name = $1
else
cext_name = name
end

# Look in each $JRUBY_TRUFFLE_CEXT_PATH directory for
# cext_name/ext/cext_name/extconf.rb
# Look in each $JRUBY_TRUFFLE_CEXT_PATH directory for
# cext_name/ext/cext_name/extconf.rb

if ENV.include? 'JRUBY_TRUFFLE_CEXT_PATH'
cext_path = ENV['JRUBY_TRUFFLE_CEXT_PATH'].split(':')
else
cext_path = [Dir.pwd]
end
if ENV.include? 'JRUBY_TRUFFLE_CEXT_PATH'
cext_path = ENV['JRUBY_TRUFFLE_CEXT_PATH'].split(':')
else
cext_path = [Dir.pwd]
end

cext_path.each do |dir|
extconf = File.join(dir, cext_name, 'ext', cext_name, 'extconf.rb')
cext_path.each do |dir|
extconf = File.join(dir, cext_name, 'ext', cext_name, 'extconf.rb')

if File.exist? extconf
return Truffle::CExt::load_extconf(extconf)
end
if File.exist? extconf
return Truffle::CExt::load_extconf(extconf)
end

truffle_cext_original_require name
end
module_function :require

Kernel.require name
end

end