Skip to content

Commit

Permalink
Showing 145 changed files with 1,514 additions and 900 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# JRuby - an implementation of the Ruby language on the JVM

Master: [![Build Status](https://travis-ci.org/jruby/jruby.png?branch=master)](https://travis-ci.org/jruby/jruby)
1.7 branch: [![Build Status](https://travis-ci.org/jruby/jruby.png?branch=jruby-1_7)](https://travis-ci.org/jruby/jruby/branches)
Master: [![Build Status](https://travis-ci.org/jruby/jruby.svg?branch=master)](https://travis-ci.org/jruby/jruby)
1.7 branch: [![Build Status](https://travis-ci.org/jruby/jruby.svg?branch=jruby-1_7)](https://travis-ci.org/jruby/jruby/branches)

## About

8 changes: 6 additions & 2 deletions core/src/main/java/org/jruby/Ruby.java
Original file line number Diff line number Diff line change
@@ -3701,6 +3701,10 @@ public RaiseException newErrnoENOENTError(String message) {
return newRaiseException(getErrno().getClass("ENOENT"), message);
}

public RaiseException newErrnoEOPNOTSUPPError(String message) {
return newRaiseException(getErrno().getClass("EOPNOTSUPP"), message);
}

public RaiseException newErrnoESPIPEError(String message) {
return newRaiseException(getErrno().getClass("ESPIPE"), message);
}
@@ -4736,8 +4740,8 @@ public RubyString getThreadStatus(RubyThread.Status status) {
* @return the freeze-duped version of the string
*/
public RubyString freezeAndDedupString(RubyString string) {
if (string.getMetaClass().isSingleton()) {
// never cache a singleton
if (string.getMetaClass() == stringClass) {
// never cache a non-natural String
RubyString duped = string.strDup(this);
duped.setFrozen(true);
return duped;
14 changes: 3 additions & 11 deletions core/src/main/java/org/jruby/RubyHash.java
Original file line number Diff line number Diff line change
@@ -1015,13 +1015,8 @@ protected void op_asetForString(Ruby runtime, RubyString key, IRubyObject value)
} else {
checkIterating();
if (!key.isFrozen()) {
if (isComparedByIdentity()) {
// when comparing by identity, we don't want to be too eager about deduping
key = key.strDup(runtime, key.getMetaClass().getRealClass());
key.setFrozen(true);
} else {
key = runtime.freezeAndDedupString(key);
}
key = key.strDup(runtime, key.getMetaClass().getRealClass());
key.setFrozen(true);
}
internalPut(key, value, false);
}
@@ -1033,12 +1028,9 @@ protected void op_asetSmallForString(Ruby runtime, RubyString key, IRubyObject v
entry.value = value;
} else {
checkIterating();
if (isComparedByIdentity()) {
// when comparing by identity, we don't want to be too eager about deduping
if (!key.isFrozen()) {
key = key.strDup(runtime, key.getMetaClass().getRealClass());
key.setFrozen(true);
} else {
key = runtime.freezeAndDedupString(key);
}
internalPutSmall(key, value, false);
}
29 changes: 29 additions & 0 deletions core/src/main/java/org/jruby/ext/socket/RubySocket.java
Original file line number Diff line number Diff line change
@@ -46,6 +46,7 @@
import org.jruby.anno.JRubyClass;
import org.jruby.anno.JRubyMethod;
import org.jruby.exceptions.RaiseException;
import org.jruby.runtime.Helpers;
import org.jruby.runtime.ObjectAllocator;
import org.jruby.runtime.ThreadContext;
import org.jruby.runtime.Visibility;
@@ -77,6 +78,8 @@
import java.util.regex.Pattern;
import org.jruby.RubyArray;

import static org.jruby.runtime.Helpers.arrayOf;

/**
* @author <a href="mailto:ola.bini@ki.se">Ola Bini</a>
*/
@@ -328,6 +331,32 @@ public static IRubyObject ip_address_list(ThreadContext context, IRubyObject sel
return SocketUtils.ip_address_list(context);
}

@JRubyMethod(name = {"socketpair", "pair"}, meta = true)
public static IRubyObject socketpair(ThreadContext context, IRubyObject recv, IRubyObject domain, IRubyObject type, IRubyObject protocol) {
ProtocolFamily pf = SocketUtils.protocolFamilyFromArg(protocol);
if (pf == null ) pf = ProtocolFamily.PF_UNIX;

if (pf != ProtocolFamily.PF_UNIX && pf.ordinal() != 0) {
throw context.runtime.newErrnoEOPNOTSUPPError("Socket.socketpair only supports streaming UNIX sockets");
}

return socketpair(context, recv, domain, type);
}

@JRubyMethod(name = {"socketpair", "pair"}, meta = true)
public static IRubyObject socketpair(ThreadContext context, IRubyObject recv, IRubyObject domain, IRubyObject type) {
AddressFamily af = SocketUtils.addressFamilyFromArg(domain);
if (af == null) af = AddressFamily.AF_UNIX;
Sock s = SocketUtils.sockFromArg(type);
if (s == null) s = Sock.SOCK_STREAM;

if (af != AddressFamily.AF_UNIX || s != Sock.SOCK_STREAM) {
throw context.runtime.newErrnoEOPNOTSUPPError("Socket.socketpair only supports streaming UNIX sockets");
}

return RubyUNIXSocket.socketpair(context, recv, arrayOf(domain, type));
}

@Override
protected Sock getDefaultSocketType() {
return soType;
12 changes: 10 additions & 2 deletions core/src/main/java/org/jruby/ir/runtime/IRRuntimeHelpers.java
Original file line number Diff line number Diff line change
@@ -1031,9 +1031,17 @@ public static Encoding retrieveJCodingsEncoding(ThreadContext context, String na

@JIT
public static RubyHash constructHashFromArray(Ruby runtime, IRubyObject[] pairs) {
RubyHash hash = RubyHash.newHash(runtime);
int length = pairs.length / 2;
boolean useSmallHash = length <= 10;

RubyHash hash = useSmallHash ? RubyHash.newHash(runtime) : RubyHash.newSmallHash(runtime);
for (int i = 0; i < pairs.length;) {
hash.fastASet(runtime, pairs[i++], pairs[i++], true);
if (useSmallHash) {
hash.fastASetSmall(runtime, pairs[i++], pairs[i++], true);
} else {
hash.fastASet(runtime, pairs[i++], pairs[i++], true);
}

}
return hash;
}
6 changes: 6 additions & 0 deletions core/src/main/java/org/jruby/runtime/MethodBlockBody.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.jruby.runtime;

import org.jruby.EvalType;
import org.jruby.RubyModule;
import org.jruby.internal.runtime.methods.DynamicMethod;
import org.jruby.parser.StaticScope;
@@ -85,4 +86,9 @@ public int getLine() {
public ArgumentDescriptor[] getArgumentDescriptors() {
return argsDesc;
}

@Override
public void setEvalType(EvalType evalType) {
// nop
}
}
2 changes: 2 additions & 0 deletions core/src/main/java/org/jruby/util/cli/Options.java
Original file line number Diff line number Diff line change
@@ -155,6 +155,8 @@ public class Options {
public static final Option<Boolean> TRUFFLE_RANDOMIZE_STORAGE_ARRAY = bool(TRUFFLE, "truffle.randomize_storage.array", false, "Randomize Array storage strategy.");
public static final Option<Integer> TRUFFLE_RANDOMIZE_SEED = integer(TRUFFLE, "truffle.randomize.seed", 0, "Seed for any randomization.");

public static final Option<Boolean> TRUFFLE_REQUIRE_SHOW_RESOLUTION = bool(TRUFFLE, "truffle.require.show_resolution", false, "So what files require statements resolve to.");

public static final Option<TruffleContextInterface.BacktraceFormatter> TRUFFLE_BACKTRACE_DISPLAY_FORMAT = enumeration(TRUFFLE, "truffle.backtrace.display_format", TruffleContextInterface.BacktraceFormatter.class, TruffleContextInterface.BacktraceFormatter.MRI, "How to format backtraces displayed to the user.");
public static final Option<TruffleContextInterface.BacktraceFormatter> TRUFFLE_BACKTRACE_DEBUG_FORMAT = enumeration(TRUFFLE, "truffle.backtrace.debug_format", TruffleContextInterface.BacktraceFormatter.class, TruffleContextInterface.BacktraceFormatter.DEBUG, "How to format backtraces displayed using TruffleDebug.dump_call_stack.");
public static final Option<TruffleContextInterface.BacktraceFormatter> TRUFFLE_BACKTRACE_EXCEPTION_FORMAT = enumeration(TRUFFLE, "truffle.backtrace.exception_format", TruffleContextInterface.BacktraceFormatter.class, TruffleContextInterface.BacktraceFormatter.MRI, "How to format backtraces in Exception objects.");
5 changes: 3 additions & 2 deletions lib/pom.rb
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@ def version
ImportedGem.new( 'power_assert', 'power_assert.version', true ),
ImportedGem.new( 'psych', '2.0.14.pre1', true ),
ImportedGem.new( 'json', 'json.version', true ),
ImportedGem.new( 'jar-dependencies', '0.1.13', true )
ImportedGem.new( 'jar-dependencies', '0.1.14', true )
]

project 'JRuby Lib Setup' do
@@ -86,7 +86,8 @@ def to_pathname
end
end

gem 'ruby-maven', '3.1.1.0.11', :scope => :provided
gem 'ruby-maven', '3.3.0', :scope => :provided
gem 'ruby-maven-libs', '3.3.3', :scope => :provided

default_gemnames = default_gems.collect { |g| g.name }

11 changes: 9 additions & 2 deletions lib/pom.xml
Original file line number Diff line number Diff line change
@@ -144,7 +144,7 @@
<dependency>
<groupId>rubygems</groupId>
<artifactId>jar-dependencies</artifactId>
<version>0.1.13</version>
<version>0.1.14</version>
<type>gem</type>
<scope>provided</scope>
<exclusions>
@@ -157,7 +157,14 @@
<dependency>
<groupId>rubygems</groupId>
<artifactId>ruby-maven</artifactId>
<version>3.1.1.0.11</version>
<version>3.3.0</version>
<type>gem</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>rubygems</groupId>
<artifactId>ruby-maven-libs</artifactId>
<version>3.3.3</version>
<type>gem</type>
<scope>provided</scope>
</dependency>
2 changes: 1 addition & 1 deletion lib/ruby/stdlib/ffi/platform/x86_64-windows/platform.conf
Original file line number Diff line number Diff line change
@@ -479,7 +479,7 @@ rbx.platform.typedef.uint_fast16_t = uint
rbx.platform.typedef.uint_fast32_t = uint
rbx.platform.typedef.uint_fast64_t = ulong_long
rbx.platform.typedef.intptr_t = int
rbx.platform.typedef.uintptr_t = uint
rbx.platform.typedef.uintptr_t = ulong_long
rbx.platform.typedef.intmax_t = long_long
rbx.platform.typedef.uintmax_t = ulong_long
rbx.platform.typedef.off_t = long_long
1 change: 1 addition & 0 deletions lib/ruby/truffle/mri/minitest.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require_relative '../../stdlib/minitest'
1 change: 1 addition & 0 deletions lib/ruby/truffle/mri/minitest/assertions.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require_relative '../../../stdlib/minitest/' + File.basename(__FILE__)
1 change: 1 addition & 0 deletions lib/ruby/truffle/mri/minitest/autorun.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require_relative '../../../stdlib/minitest/' + File.basename(__FILE__)
1 change: 1 addition & 0 deletions lib/ruby/truffle/mri/minitest/benchmark.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require_relative '../../../stdlib/minitest/' + File.basename(__FILE__)
1 change: 1 addition & 0 deletions lib/ruby/truffle/mri/minitest/expectations.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require_relative '../../../stdlib/minitest/' + File.basename(__FILE__)
1 change: 1 addition & 0 deletions lib/ruby/truffle/mri/minitest/hell.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require_relative '../../../stdlib/minitest/' + File.basename(__FILE__)
1 change: 1 addition & 0 deletions lib/ruby/truffle/mri/minitest/mock.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require_relative '../../../stdlib/minitest/' + File.basename(__FILE__)
1 change: 1 addition & 0 deletions lib/ruby/truffle/mri/minitest/parallel.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require_relative '../../../stdlib/minitest/' + File.basename(__FILE__)
1 change: 1 addition & 0 deletions lib/ruby/truffle/mri/minitest/pride.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require_relative '../../../stdlib/minitest/' + File.basename(__FILE__)
1 change: 1 addition & 0 deletions lib/ruby/truffle/mri/minitest/pride_plugin.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require_relative '../../../stdlib/minitest/' + File.basename(__FILE__)
1 change: 1 addition & 0 deletions lib/ruby/truffle/mri/minitest/spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require_relative '../../../stdlib/minitest/' + File.basename(__FILE__)
1 change: 1 addition & 0 deletions lib/ruby/truffle/mri/minitest/test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require_relative '../../../stdlib/minitest/' + File.basename(__FILE__)
1 change: 1 addition & 0 deletions lib/ruby/truffle/mri/minitest/unit.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require_relative '../../../stdlib/minitest/' + File.basename(__FILE__)
2 changes: 1 addition & 1 deletion maven/jruby-dist/pom.rb
Original file line number Diff line number Diff line change
@@ -109,7 +109,7 @@
execute :pack_sources do |ctx|
require 'fileutils'

revision = `git show`.gsub( /\n.*|commit /, '' )
revision = `git log -1 --format="%H"`.chomp

basefile = "#{ctx.project.build.directory}/#{ctx.project.artifactId}-#{ctx.project.version}-src"

8 changes: 4 additions & 4 deletions pom.rb
Original file line number Diff line number Diff line change
@@ -30,12 +30,12 @@
license 'LGPL 3', 'http://www.gnu.org/licenses/lgpl-3.0-standalone.html'
license 'EPL', 'http://www.eclipse.org/legal/epl-v10.html'

plugin_repository( 'https://oss.sonatype.org/content/repositories/snapshots/',
plugin_repository( :url => 'https://oss.sonatype.org/content/repositories/snapshots/',
:id => 'sonatype' ) do
releases 'false'
snapshots 'true'
end
repository( 'https://oss.sonatype.org/content/repositories/snapshots/',
repository( :url => 'https://oss.sonatype.org/content/repositories/snapshots/',
:id => 'sonatype' ) do
releases 'false'
snapshots 'true'
@@ -274,8 +274,8 @@
end

distribution_management do
repository( "file:#{snapshots_dir}/maven", :id => 'local releases' )
snapshot_repository( "file:#{snapshots_dir}/maven",
repository( :url => "file:#{snapshots_dir}/maven", :id => 'local releases' )
snapshot_repository( :url => "file:#{snapshots_dir}/maven",
:id => 'local snapshots' )
end
build do
3 changes: 1 addition & 2 deletions spec/mspec/lib/mspec/matchers/output_to_fd.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
require 'mspec/helpers/tmp'
require 'fileutils'

# Lower-level output speccing mechanism for a single
# output stream. Unlike OutputMatcher which provides
@@ -48,7 +47,7 @@ def matches?(block)
# Clean up
ensure
out.close unless out.closed?
FileUtils.rm out.path
File.delete out.path
end

return true
18 changes: 13 additions & 5 deletions spec/mspec/lib/mspec/runner/mspec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
require 'mspec/runner/context'
require 'mspec/runner/exception'
require 'mspec/runner/tag'
require 'fileutils'

module MSpec

@@ -301,12 +300,22 @@ def self.read_tags(keys)
tags
end

def self.make_tag_dir(path)
parent = File.dirname(path)
return if File.exist? parent
begin
Dir.mkdir(parent)
rescue SystemCallError
make_tag_dir(parent)
Dir.mkdir(parent)
end
end

# Writes each tag in +tags+ to the tag file. Overwrites the
# tag file if it exists.
def self.write_tags(tags)
file = tags_file
path = File.dirname file
FileUtils.mkdir_p path unless File.exist? path
make_tag_dir(file)
File.open(file, "wb") do |f|
tags.each { |t| f.puts t }
end
@@ -323,8 +332,7 @@ def self.write_tag(tag)
end

file = tags_file
path = File.dirname file
FileUtils.mkdir_p path unless File.exist? path
make_tag_dir(file)
File.open(file, "ab") { |f| f.puts tag.to_s }
return true
end
Loading

0 comments on commit e13ed00

Please sign in to comment.