Skip to content

Commit

Permalink
Merge branch 'master' into truffle-head
Browse files Browse the repository at this point in the history
Conflicts:
	tool/jt.rb
	truffle/src/main/java/org/jruby/truffle/nodes/core/ArrayNodes.java
	truffle/src/main/java/org/jruby/truffle/nodes/core/StringNodes.java
	truffle/src/main/java/org/jruby/truffle/translator/Translator.java
chrisseaton committed Mar 19, 2015
2 parents dd2285d + a536f0f commit c00ff32
Showing 94 changed files with 770 additions and 1,907 deletions.
5 changes: 5 additions & 0 deletions bin/jruby200.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
find . -name '*.pack.gz' | sed 's/\(.*\).pack.gz/\1.pack.gz \1.jar/' | xargs -L1 unpack200 --remove-pack-file
cp bin/jruby.bash bin/jruby
bin/jruby.bash $@
exit
38 changes: 10 additions & 28 deletions core/pom.rb
Original file line number Diff line number Diff line change
@@ -52,7 +52,7 @@

jar 'org.jruby.joni:joni:2.1.5'
jar 'org.jruby.extras:bytelist:1.0.12'
jar 'org.jruby.jcodings:jcodings:1.0.12'
jar 'org.jruby.jcodings:jcodings:1.0.13-SNAPSHOT'
jar 'org.jruby:dirgra:0.2'

jar 'com.headius:invokebinder:1.5'
@@ -253,33 +253,15 @@
'outputFile' => '${jruby.basedir}/lib/jruby.jar',
'transformers' => [ { '@implementation' => 'org.apache.maven.plugins.shade.resource.ManifestResourceTransformer',
'mainClass' => 'org.jruby.Main' } ] )
end

[ :osgi, :dist, :'jruby-jars', :main, :all, :complete, :release, :jruby_complete_jar_extended ].each do |name|
profile name do
plugin :shade do
execute_goals( 'shade',
:id => 'pack jruby-core-noasm.jar',
:phase => 'package',
'shadedArtifactAttached' => 'true',
'shadedClassifierName' => 'noasm',
'artifactSet' => {
'includes' => [ 'com.github.jnr:jnr-ffi',
'org.ow2.asm:*' ]
},
'relocations' => [ { 'pattern' => 'org.objectweb',
'shadedPattern' => 'org.jruby.org.objectweb' } ] )
execute_goals( 'shade',
:id => 'pack jruby-core-complete.jar',
:phase => 'package',
'shadedArtifactAttached' => 'true',
'shadedClassifierName' => 'complete',
'relocations' => [ { 'pattern' => 'org.objectweb',
'shadedPattern' => 'org.jruby.org.objectweb' } ],
'transformers' => [ { '@implementation' => 'org.apache.maven.plugins.shade.resource.ManifestResourceTransformer',
'mainClass' => 'org.jruby.Main' } ] )
end
end
execute_goals( 'shade',
:id => 'shade the asm classes',
:phase => 'verify',
'artifactSet' => {
'includes' => [ 'com.github.jnr:jnr-ffi',
'org.ow2.asm:*' ]
},
'relocations' => [ { 'pattern' => 'org.objectweb',
'shadedPattern' => 'org.jruby.org.objectweb' } ] )
end

profile 'jruby.bash' do
480 changes: 22 additions & 458 deletions core/pom.xml

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions core/src/main/java/org/jruby/RubyString.java
Original file line number Diff line number Diff line change
@@ -5618,9 +5618,9 @@ public IRubyObject ascii_only_p(ThreadContext context) {
@JRubyMethod
public IRubyObject b(ThreadContext context) {
Encoding encoding = ASCIIEncoding.INSTANCE;
RubyString dup = (RubyString)dup();
dup.associateEncoding(encoding);
dup.clearCodeRange();
RubyString dup = strDup(context.runtime);
dup.modify19();
dup.setEncoding(encoding);
return dup;
}

11 changes: 9 additions & 2 deletions core/src/main/java/org/jruby/ir/runtime/IRRuntimeHelpers.java
Original file line number Diff line number Diff line change
@@ -1351,8 +1351,15 @@ public static VariableAccessor getVariableAccessorForWrite(IRubyObject object, S
}

@JIT
public static IRubyObject getVariableWithAccessor(IRubyObject self, VariableAccessor accessor, ThreadContext context) {
return Helpers.nullToNil((IRubyObject)accessor.get(self), context);
public static IRubyObject getVariableWithAccessor(IRubyObject self, VariableAccessor accessor, ThreadContext context, String name) {
IRubyObject result = (IRubyObject)accessor.get(self);
if (result == null) {
if (context.runtime.isVerbose()) {
context.runtime.getWarnings().warning(IRubyWarnings.ID.IVAR_NOT_INITIALIZED, "instance variable " + name + " not initialized");
}
result = context.nil;
}
return result;
}

@JIT
Original file line number Diff line number Diff line change
@@ -500,6 +500,6 @@ public void pushBlockBody(Handle handle, org.jruby.runtime.Signature signature,
private int variableCount = 0;
private Map<Integer, Type> variableTypes = new HashMap<Integer, Type>();
private Map<Integer, String> variableNames = new HashMap<Integer, String>();
private final Signature signature;
protected final Signature signature;
private final ClassData classData;
}
74 changes: 54 additions & 20 deletions core/src/main/java/org/jruby/ir/targets/IRBytecodeAdapter6.java
Original file line number Diff line number Diff line change
@@ -6,6 +6,8 @@

import com.headius.invokebinder.Signature;
import java.math.BigInteger;
import java.util.HashMap;
import java.util.Map;

import org.jcodings.Encoding;
import org.jruby.Ruby;
@@ -58,7 +60,7 @@ public IRBytecodeAdapter6(SkinnyMethodAdapter adapter, Signature signature, Clas
}

public void pushFixnum(final long l) {
cacheValuePermanently(newFieldName("fixnum"), RubyFixnum.class, new Runnable() {
cacheValuePermanently("fixnum", RubyFixnum.class, keyFor("fixnum", l), new Runnable() {
@Override
public void run() {
loadRuntime();
@@ -69,7 +71,7 @@ public void run() {
}

public void pushFloat(final double d) {
cacheValuePermanently(newFieldName("float"), RubyFloat.class, new Runnable() {
cacheValuePermanently("float", RubyFloat.class, keyFor("float", Double.doubleToLongBits(d)), new Runnable() {
@Override
public void run() {
loadRuntime();
@@ -95,7 +97,7 @@ private String newFieldName(String baseName) {
* @param bl ByteList for the String to push
*/
public void pushFrozenString(final ByteList bl) {
cacheValuePermanently(newFieldName("frozenString"), RubyString.class, new Runnable() {
cacheValuePermanently("fstring", RubyString.class, keyFor("fstring", bl), new Runnable() {
@Override
public void run() {
loadRuntime();
@@ -107,7 +109,7 @@ public void run() {
}

public void pushByteList(final ByteList bl) {
cacheValuePermanently(newFieldName("byteList"), ByteList.class, new Runnable() {
cacheValuePermanently("bytelist", ByteList.class, keyFor("bytelist", bl), new Runnable() {
@Override
public void run() {
loadRuntime();
@@ -118,22 +120,41 @@ public void run() {
});
}

public void cacheValuePermanently(String cacheField, Class type, Runnable construction) {
// FIXME: too much bytecode...make it a separate method?
Label done = new Label();
adapter.getClassVisitor().visitField(Opcodes.ACC_PRIVATE | Opcodes.ACC_STATIC, cacheField, ci(type), null, null).visitEnd();
adapter.getstatic(getClassData().clsName, cacheField, ci(type));
adapter.dup();
adapter.ifnonnull(done);
adapter.pop();
construction.run();
adapter.dup();
adapter.putstatic(getClassData().clsName, cacheField, ci(type));
adapter.label(done);
public void cacheValuePermanently(String what, Class type, Object key, Runnable construction) {
String cacheField = key == null ? null : cacheFieldNames.get(key);
if (cacheField == null) {
cacheField = newFieldName(what);
cacheFieldNames.put(key, cacheField);

SkinnyMethodAdapter tmp = adapter;
adapter = new SkinnyMethodAdapter(
adapter.getClassVisitor(),
Opcodes.ACC_PRIVATE | Opcodes.ACC_STATIC | Opcodes.ACC_SYNTHETIC,
cacheField,
sig(type, ThreadContext.class),
null,
null);
Label done = new Label();
adapter.getClassVisitor().visitField(Opcodes.ACC_PRIVATE | Opcodes.ACC_STATIC, cacheField, ci(type), null, null).visitEnd();
adapter.getstatic(getClassData().clsName, cacheField, ci(type));
adapter.dup();
adapter.ifnonnull(done);
adapter.pop();
construction.run();
adapter.dup();
adapter.putstatic(getClassData().clsName, cacheField, ci(type));
adapter.label(done);
adapter.areturn();
adapter.end();
adapter = tmp;
}

loadContext();
adapter.invokestatic(getClassData().clsName, cacheField, sig(type, ThreadContext.class));
}

public void pushRegexp(final ByteList source, final int options) {
cacheValuePermanently(newFieldName("regexp"), RubyRegexp.class, new Runnable() {
cacheValuePermanently("regexp", RubyRegexp.class, keyFor("regexp", source, options), new Runnable() {
@Override
public void run() {
loadContext();
@@ -144,6 +165,16 @@ public void run() {
});
}

private static String keyFor(Object... objs) {
StringBuilder sb = new StringBuilder();
for (Object obj : objs) {
sb.append(obj.toString());
if (obj instanceof ByteList) sb.append('_').append(((ByteList) obj).getEncoding());
sb.append("_");
}
return sb.toString();
}

public void pushDRegexp(Runnable callback, RegexpOptions options, int arity) {
if (arity > MAX_ARGUMENTS) throw new NotCompilableException("dynamic regexp has more than " + MAX_ARGUMENTS + " elements");

@@ -197,7 +228,7 @@ public void pushDRegexp(Runnable callback, RegexpOptions options, int arity) {
}

public void pushSymbol(final String sym, final Encoding encoding) {
cacheValuePermanently(newFieldName("symbol"), RubySymbol.class, new Runnable() {
cacheValuePermanently("symbol", RubySymbol.class, keyFor("symbol", sym, encoding), new Runnable() {
@Override
public void run() {
loadRuntime();
@@ -217,7 +248,7 @@ public void loadRuntime() {
}

public void pushEncoding(final Encoding encoding) {
cacheValuePermanently(newFieldName("symbol"), RubySymbol.class, new Runnable() {
cacheValuePermanently("encoding", RubySymbol.class, keyFor("encoding", encoding), new Runnable() {
@Override
public void run() {
loadContext();
@@ -599,7 +630,8 @@ public void getField(String name) {
adapter.dup(); // self, self
cacheVariableAccessor(name, false); // self, accessor
loadContext(); // self, accessor, context
invokeIRHelper("getVariableWithAccessor", sig(IRubyObject.class, IRubyObject.class, VariableAccessor.class, ThreadContext.class));
adapter.ldc(name);
invokeIRHelper("getVariableWithAccessor", sig(IRubyObject.class, IRubyObject.class, VariableAccessor.class, ThreadContext.class, String.class));
}

/**
@@ -749,4 +781,6 @@ public void checkpoint() {
"callThreadPoll",
sig(void.class));
}

private final Map<Object, String> cacheFieldNames = new HashMap<>();
}
139 changes: 97 additions & 42 deletions core/src/main/java/org/jruby/util/Pack.java
Original file line number Diff line number Diff line change
@@ -1135,61 +1135,116 @@ else if (encode.hasRemaining()) {
int index = 0;
int s = -1;

while (encode.hasRemaining()) {
a = b = c = d = -1;

// obtain a
s = safeGet(encode);
while (((a = b64_xtable[s]) == -1) && encode.hasRemaining()) {
s = safeGet(encode);
if (occurrences == 0){
if (encode.remaining()%4 != 0) {
throw runtime.newArgumentError("invalid base64");
}
if (a == -1) break;

// obtain b
s = safeGet(encode);
while (((b = b64_xtable[s]) == -1) && encode.hasRemaining()) {
while (encode.hasRemaining() && s != '=') {
a = b = c = -1;
d = -2;

// obtain a
s = safeGet(encode);
}
if (b == -1) break;

// obtain c
s = safeGet(encode);
while (((c = b64_xtable[s]) == -1) && encode.hasRemaining()) {
if (s == '=') break;
a = b64_xtable[s];
if (a == -1) throw runtime.newArgumentError("invalid base64");

// obtain b
s = safeGet(encode);
}
if ((s == '=') || c == -1) {
b = b64_xtable[s];
if (b == -1) throw runtime.newArgumentError("invalid base64");

// obtain c
s = safeGet(encode);
c = b64_xtable[s];
if (s == '=') {
encode.position(encode.position() - 1);
if (safeGet(encode) != '=') throw runtime.newArgumentError("invalid base64");
break;
}
break;
}

// obtain d
s = safeGet(encode);
while (((d = b64_xtable[s]) == -1) && encode.hasRemaining()) {
if (s == '=') break;
if (c == -1) throw runtime.newArgumentError("invalid base64");

// obtain d
s = safeGet(encode);
d = b64_xtable[s];
if (s == '=') break;
if (d == -1) throw runtime.newArgumentError("invalid base64");

// calculate based on a, b, c and d
lElem[index++] = (byte)((a << 2 | b >> 4) & 255);
lElem[index++] = (byte)((b << 4 | c >> 2) & 255);
lElem[index++] = (byte)((c << 6 | d) & 255);
}
if ((s == '=') || d == -1) {
if (s == '=') {
encode.position(encode.position() - 1);

if (encode.hasRemaining()) throw runtime.newArgumentError("invalid base64");

if (a != -1 && b != -1) {
if (c == -1 && s == '=') {
if ((b & 15) > 0) throw runtime.newArgumentError("invalid base64");
lElem[index++] = (byte)((a << 2 | b >> 4) & 255);
} else if(c != -1 && s == '=') {
if ((c & 3) > 0) throw runtime.newArgumentError("invalid base64");
lElem[index++] = (byte)((a << 2 | b >> 4) & 255);
lElem[index++] = (byte)((b << 4 | c >> 2) & 255);
}
break;
}

// calculate based on a, b, c and d
lElem[index++] = (byte)((a << 2 | b >> 4) & 255);
lElem[index++] = (byte)((b << 4 | c >> 2) & 255);
lElem[index++] = (byte)((c << 6 | d) & 255);
}
else {

if (a != -1 && b != -1) {
if (c == -1 && s == '=') {
lElem[index++] = (byte)((a << 2 | b >> 4) & 255);
} else if(c != -1 && s == '=') {
while (encode.hasRemaining()) {
a = b = c = d = -1;

// obtain a
s = safeGet(encode);
while (((a = b64_xtable[s]) == -1) && encode.hasRemaining()) {
s = safeGet(encode);
}
if (a == -1) break;

// obtain b
s = safeGet(encode);
while (((b = b64_xtable[s]) == -1) && encode.hasRemaining()) {
s = safeGet(encode);
}
if (b == -1) break;

// obtain c
s = safeGet(encode);
while (((c = b64_xtable[s]) == -1) && encode.hasRemaining()) {
if (s == '=') break;
s = safeGet(encode);
}
if ((s == '=') || c == -1) {
if (s == '=') {
encode.position(encode.position() - 1);
}
break;
}

// obtain d
s = safeGet(encode);
while (((d = b64_xtable[s]) == -1) && encode.hasRemaining()) {
if (s == '=') break;
s = safeGet(encode);
}
if ((s == '=') || d == -1) {
if (s == '=') {
encode.position(encode.position() - 1);
}
break;
}

// calculate based on a, b, c and d
lElem[index++] = (byte)((a << 2 | b >> 4) & 255);
lElem[index++] = (byte)((b << 4 | c >> 2) & 255);
lElem[index++] = (byte)((c << 6 | d) & 255);
}

if (a != -1 && b != -1) {
if (c == -1 && s == '=') {
lElem[index++] = (byte)((a << 2 | b >> 4) & 255);
} else if(c != -1 && s == '=') {
lElem[index++] = (byte)((a << 2 | b >> 4) & 255);
lElem[index++] = (byte)((b << 4 | c >> 2) & 255);
}
}
}
result.append(RubyString.newString(runtime, new ByteList(lElem, 0, index,
6 changes: 0 additions & 6 deletions jruby.bnd.template

This file was deleted.

104 changes: 88 additions & 16 deletions lib/pom.rb
Original file line number Diff line number Diff line change
@@ -54,21 +54,25 @@ def to_pathname
version = File.read( File.join( basedir, '..', 'VERSION' ) ).strip

model_version '4.0.0'
id 'jruby-lib'
id 'jruby-stdlib'
inherit "org.jruby:jruby-parent", version
packaging 'pom'

properties( 'tesla.dump.pom' => 'pom.xml',
'tesla.dump.readonly' => true,
'tesla.version' => '0.1.1',
'jruby.plugins.version' => '1.0.5' )
'jruby.plugins.version' => '1.0.5',
'gem.home' => '${basedir}/ruby/gems/shared',
# we copy everything into the target/classes/META-INF
# so the jar plugin just packs it - see build/resources below
'jruby.complete.home' => '${project.build.outputDirectory}/META-INF/jruby.home',
'jruby.complete.gems' => '${jruby.complete.home}/lib/ruby/gems/shared' )

unless version =~ /-SNAPSHOT/
properties 'jruby.home' => '${basedir}/..'
end

# just depends on jruby-core so we are sure the jruby.jar is in place
jar "org.jruby:jruby-core:#{version}", :scope => 'provided'
jar "org.jruby:jruby-core:#{version}", :scope => 'test'

repository( :url => 'http://rubygems-proxy.torquebox.org/releases',
:id => 'rubygems-releases' )
@@ -81,23 +85,22 @@ def to_pathname

# tell maven to download the respective gem artifacts
default_gems.each do |g|
dependency 'rubygems', g.name, g.version, :type => 'gem' do
# use provided scope so it is not a real dependency for runtime
dependency 'rubygems', g.name, g.version, :type => 'gem', :scope => :provided do
exclusion 'rubygems:jar-dependencies'
end
end

# this is not an artifact for maven central
plugin :deploy, :skip => true

plugin :invoker, :skipInstallation => true

gem 'ruby-maven', '3.1.1.0.8', :scope => :provided

plugin :dependency, :useRepositoryLayout => true, :outputDirectory => 'ruby/stdlib', :excludeGroupIds => 'rubygems', :includeScope => :runtime do
default_gemnames = default_gems.collect { |g| g.name }

# TODO no hardcoded group-ids
plugin :dependency, :useRepositoryLayout => true, :outputDirectory => 'ruby/stdlib', :excludeGroupIds => 'rubygems', :includeScope => :provided do
execute_goal 'copy-dependencies', :phase => 'package'
end

execute :install_gems, :'package' do |ctx|
execute :install_gems, :'initialize' do |ctx|
require 'fileutils'

puts "using jruby #{JRUBY_VERSION}"
@@ -115,7 +118,7 @@ def to_pathname
ruby_dir = File.join( ctx.project.basedir.to_pathname, 'ruby' )
FileUtils.mkdir_p( default_specs )

# have an empty openssl.rb so we do not run in trob=uble with not having
# have an empty openssl.rb so we do not run in trouble with not having
# jopenssl which is part of the default gems
lib_dir = File.join( target, 'lib' )
openssl = File.join( lib_dir, 'openssl.rb' )
@@ -139,7 +142,7 @@ def to_pathname
ctx.project.artifacts.select do |a|
a.group_id == 'rubygems' || a.group_id == 'org.jruby.gems'
end.each do |a|
ghome = a.scope == 'compile' ? gem_home : jruby_gems
ghome = default_gemnames.member?( a.artifact_id ) ? gem_home : jruby_gems
if Dir[ File.join( ghome, 'cache', File.basename( a.file.to_pathname ).sub( /.gem/, '*.gem' ) ) ].empty?
puts a.file.to_pathname
# do not set bin_dir since its create absolute symbolic links
@@ -206,7 +209,7 @@ def to_pathname
specfile = Dir[ File.join( specs, specfile_wildcard ) ].first

unless specfile
raise Errno::ENOENT, "gemspec #{specfile_wildcard} not found; dependency unspecified in lib/pom.xml?"
raise Errno::ENOENT, "gemspec #{specfile_wildcard} not found in #{specs}; dependency unspecified in lib/pom.xml?"
end

specname = File.basename( specfile )
@@ -233,5 +236,74 @@ def to_pathname
( Dir[ File.join( jruby_gems, '**/*' ) ] + Dir[ File.join( jruby_gems, '**/.*' ) ] ).each do |f|
File.chmod( 0644, f ) rescue nil if File.file?( f )
end
end
end

execute( 'fix shebang on gem bin files and add *.bat files',
'prepare-resources' ) do |ctx|

puts 'fix the gem stub files'
jruby_home = ctx.project.basedir.to_pathname + '/../'
bindir = File.join( jruby_home, 'lib', 'ruby', 'gems', 'shared', 'bin' )
Dir[ File.join( bindir, '*' ) ].each do |f|
content = File.read( f )
new_content = content.sub( /#!.*/, "#!/usr/bin/env jruby
" )
File.open( f, "w" ) { |file| file.print( new_content ) }
end

puts 'generate the missing bat files'
Dir[File.join( jruby_home, 'bin', '*' )].each do |fn|
next unless File.file?(fn)
next if fn =~ /.bat$/
next if File.exist?("#{fn}.bat")
next unless File.open(fn, 'r', :internal_encoding => 'ASCII-8BIT') do |io|
line = io.readline rescue ""
line =~ /^#!.*ruby/
end
puts "Generating #{File.basename(fn)}.bat"
File.open("#{fn}.bat", "wb") do |f|
f.print "@ECHO OFF\r\n"
f.print "@\"%~dp0jruby.exe\" -S #{File.basename(fn)} %*\r\n"
end
end
end

execute( 'copy bin/jruby.bash to bin/jruby',
'process-resources' ) do |ctx|
require 'fileutils'
jruby_complete = ctx.project.properties.get_property( 'jruby.complete.home' )
FileUtils.cp( File.join( jruby_complete, 'bin', 'jruby.bash' ),
File.join( jruby_complete, 'bin', 'jruby' ) )
end

execute 'jrubydir', 'prepare-package' do |ctx|
require( ctx.project.basedir.to_pathname + '/../core/src/main/ruby/jruby/commands.rb' )
JRuby::Commands.generate_dir_info( ctx.project.build.output_directory.to_pathname + '/META-INF/jruby.home' )
end

# we have no sources and attach an empty jar later in the build to
# satisfy oss.sonatype.org upload

plugin( :source, 'skipSource' => 'true' )

# this plugin is configured to attach empty jars for sources and javadocs
plugin( 'org.codehaus.mojo:build-helper-maven-plugin' )

build do

# both resources are includes for the $jruby_home/lib directory

resource do
directory '${gem.home}'
includes 'gems/rake-${rake.version}/bin/r*', 'gems/rdoc-${rdoc.version}/bin/r*', 'specifications/default/*.gemspec'
target_path '${jruby.complete.gems}'
end

resource do
directory '${basedir}/..'
includes 'bin/ast*', 'bin/gem*', 'bin/irb*', 'bin/jgem*', 'bin/jirb*', 'bin/jruby*', 'bin/rake*', 'bin/ri*', 'bin/rdoc*', 'bin/testrb*', 'lib/ruby/stdlib/**', 'lib/ruby/truffle/**'
excludes 'bin/jruby', 'bin/jruby*_*', 'bin/jruby*-*', '**/.*', 'lib/ruby/stdlib/rubygems/defaults/jruby_native.rb'
target_path '${jruby.complete.home}'
end
end
end
113 changes: 96 additions & 17 deletions lib/pom.xml
Original file line number Diff line number Diff line change
@@ -7,27 +7,30 @@
<artifactId>jruby-parent</artifactId>
<version>9.0.0.0-SNAPSHOT</version>
</parent>
<artifactId>jruby-lib</artifactId>
<packaging>pom</packaging>
<artifactId>jruby-stdlib</artifactId>
<name>JRuby Lib Setup</name>
<properties>
<tesla.dump.readonly>true</tesla.dump.readonly>
<jruby.complete.gems>${jruby.complete.home}/lib/ruby/gems/shared</jruby.complete.gems>
<gem.home>${basedir}/ruby/gems/shared</gem.home>
<jruby.plugins.version>1.0.5</jruby.plugins.version>
<tesla.dump.pom>pom.xml</tesla.dump.pom>
<jruby.complete.home>${project.build.outputDirectory}/META-INF/jruby.home</jruby.complete.home>
<tesla.version>0.1.1</tesla.version>
</properties>
<dependencies>
<dependency>
<groupId>org.jruby</groupId>
<artifactId>jruby-core</artifactId>
<version>9.0.0.0-SNAPSHOT</version>
<scope>provided</scope>
<scope>test</scope>
</dependency>
<dependency>
<groupId>rubygems</groupId>
<artifactId>jruby-openssl</artifactId>
<version>0.9.6</version>
<type>gem</type>
<scope>provided</scope>
<exclusions>
<exclusion>
<artifactId>jar-dependencies</artifactId>
@@ -40,6 +43,7 @@
<artifactId>jruby-readline</artifactId>
<version>1.0</version>
<type>gem</type>
<scope>provided</scope>
<exclusions>
<exclusion>
<artifactId>jar-dependencies</artifactId>
@@ -52,6 +56,7 @@
<artifactId>rake</artifactId>
<version>${rake.version}</version>
<type>gem</type>
<scope>provided</scope>
<exclusions>
<exclusion>
<artifactId>jar-dependencies</artifactId>
@@ -64,6 +69,7 @@
<artifactId>rdoc</artifactId>
<version>${rdoc.version}</version>
<type>gem</type>
<scope>provided</scope>
<exclusions>
<exclusion>
<artifactId>jar-dependencies</artifactId>
@@ -76,6 +82,7 @@
<artifactId>json</artifactId>
<version>${json.version}</version>
<type>gem</type>
<scope>provided</scope>
<exclusions>
<exclusion>
<artifactId>jar-dependencies</artifactId>
@@ -88,6 +95,7 @@
<artifactId>jar-dependencies</artifactId>
<version>0.1.8</version>
<type>gem</type>
<scope>provided</scope>
<exclusions>
<exclusion>
<artifactId>jar-dependencies</artifactId>
@@ -100,6 +108,7 @@
<artifactId>minitest</artifactId>
<version>${minitest.version}</version>
<type>gem</type>
<scope>provided</scope>
<exclusions>
<exclusion>
<artifactId>jar-dependencies</artifactId>
@@ -112,6 +121,7 @@
<artifactId>test-unit</artifactId>
<version>${test-unit.version}</version>
<type>gem</type>
<scope>provided</scope>
<exclusions>
<exclusion>
<artifactId>jar-dependencies</artifactId>
@@ -124,6 +134,7 @@
<artifactId>power_assert</artifactId>
<version>${power_assert.version}</version>
<type>gem</type>
<scope>provided</scope>
<exclusions>
<exclusion>
<artifactId>jar-dependencies</artifactId>
@@ -136,6 +147,7 @@
<artifactId>psych</artifactId>
<version>2.0.9-SNAPSHOT</version>
<type>gem</type>
<scope>provided</scope>
<exclusions>
<exclusion>
<artifactId>jar-dependencies</artifactId>
@@ -158,6 +170,42 @@
</repository>
</repositories>
<build>
<resources>
<resource>
<targetPath>${jruby.complete.gems}</targetPath>
<directory>${gem.home}</directory>
<includes>
<include>gems/rake-${rake.version}/bin/r*</include>
<include>gems/rdoc-${rdoc.version}/bin/r*</include>
<include>specifications/default/*.gemspec</include>
</includes>
</resource>
<resource>
<targetPath>${jruby.complete.home}</targetPath>
<directory>${basedir}/..</directory>
<includes>
<include>bin/ast*</include>
<include>bin/gem*</include>
<include>bin/irb*</include>
<include>bin/jgem*</include>
<include>bin/jirb*</include>
<include>bin/jruby*</include>
<include>bin/rake*</include>
<include>bin/ri*</include>
<include>bin/rdoc*</include>
<include>bin/testrb*</include>
<include>lib/ruby/stdlib/**</include>
<include>lib/ruby/truffle/**</include>
</includes>
<excludes>
<exclude>bin/jruby</exclude>
<exclude>bin/jruby*_*</exclude>
<exclude>bin/jruby*-*</exclude>
<exclude>**/.*</exclude>
<exclude>lib/ruby/stdlib/rubygems/defaults/jruby_native.rb</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
@@ -178,18 +226,6 @@
</filesets>
</configuration>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<artifactId>maven-invoker-plugin</artifactId>
<configuration>
<skipInstallation>true</skipInstallation>
</configuration>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
@@ -204,17 +240,27 @@
<useRepositoryLayout>true</useRepositoryLayout>
<outputDirectory>ruby/stdlib</outputDirectory>
<excludeGroupIds>rubygems</excludeGroupIds>
<includeScope>runtime</includeScope>
<includeScope>provided</includeScope>
</configuration>
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<configuration>
<skipSource>true</skipSource>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>io.tesla.polyglot</groupId>
<artifactId>tesla-polyglot-maven-plugin</artifactId>
<version>${tesla.version}</version>
<executions>
<execution>
<id>install_gems</id>
<phase>package</phase>
<phase>initialize</phase>
<goals>
<goal>execute</goal>
</goals>
@@ -223,6 +269,39 @@
<nativePom>pom.rb</nativePom>
</configuration>
</execution>
<execution>
<id>fix shebang on gem bin files and add *.bat files</id>
<phase>prepare-resources</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<taskId>fix shebang on gem bin files and add *.bat files</taskId>
<nativePom>pom.rb</nativePom>
</configuration>
</execution>
<execution>
<id>copy bin/jruby.bash to bin/jruby</id>
<phase>process-resources</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<taskId>copy bin/jruby.bash to bin/jruby</taskId>
<nativePom>pom.rb</nativePom>
</configuration>
</execution>
<execution>
<id>jrubydir</id>
<phase>prepare-package</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<taskId>jrubydir</taskId>
<nativePom>pom.rb</nativePom>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
File renamed without changes.
17 changes: 0 additions & 17 deletions maven/.project

This file was deleted.

2 changes: 0 additions & 2 deletions maven/.settings/org.eclipse.core.resources.prefs

This file was deleted.

4 changes: 0 additions & 4 deletions maven/.settings/org.eclipse.m2e.core.prefs

This file was deleted.

23 changes: 0 additions & 23 deletions maven/jruby-complete/.project

This file was deleted.

This file was deleted.

4 changes: 0 additions & 4 deletions maven/jruby-complete/.settings/org.eclipse.m2e.core.prefs

This file was deleted.

8 changes: 1 addition & 7 deletions maven/jruby-complete/pom.rb
Original file line number Diff line number Diff line change
@@ -19,13 +19,7 @@
end

scope :provided do
jar( 'org.jruby:jruby-core:${project.version}:noasm',
:exclusions => [ 'com.github.jnr:jnr-ffi',
'org.ow2.asm:asm',
'org.ow2.asm:asm-commons',
'org.ow2.asm:asm-analysis',
'org.ow2.asm:asm-util' ] )
jar 'org.jruby:jruby-truffle:${project.version}'
jar 'org.jruby:jruby-core:${project.version}'
jar 'org.jruby:jruby-stdlib:${project.version}'
end

29 changes: 0 additions & 29 deletions maven/jruby-complete/pom.xml
Original file line number Diff line number Diff line change
@@ -22,35 +22,6 @@
<groupId>org.jruby</groupId>
<artifactId>jruby-core</artifactId>
<version>${project.version}</version>
<classifier>noasm</classifier>
<scope>provided</scope>
<exclusions>
<exclusion>
<artifactId>jnr-ffi</artifactId>
<groupId>com.github.jnr</groupId>
</exclusion>
<exclusion>
<artifactId>asm</artifactId>
<groupId>org.ow2.asm</groupId>
</exclusion>
<exclusion>
<artifactId>asm-commons</artifactId>
<groupId>org.ow2.asm</groupId>
</exclusion>
<exclusion>
<artifactId>asm-analysis</artifactId>
<groupId>org.ow2.asm</groupId>
</exclusion>
<exclusion>
<artifactId>asm-util</artifactId>
<groupId>org.ow2.asm</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.jruby</groupId>
<artifactId>jruby-truffle</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
17 changes: 0 additions & 17 deletions maven/jruby-dist/.project

This file was deleted.

2 changes: 0 additions & 2 deletions maven/jruby-dist/.settings/org.eclipse.core.resources.prefs

This file was deleted.

4 changes: 0 additions & 4 deletions maven/jruby-dist/.settings/org.eclipse.m2e.core.prefs

This file was deleted.

77 changes: 30 additions & 47 deletions maven/jruby-dist/pom.rb
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@
# pre-installed gems - not default gems !
gem 'ruby-maven', '3.1.1.0.8', :scope => 'provided'

# add torquebox repo only when building from filesystem
# HACK: add torquebox repo only when building from filesystem
# not when using the pom as "dependency" in some other projects
profile 'gem proxy' do

@@ -48,12 +48,26 @@
'outputDirectory' => '${project.build.directory}' } ] )
end

execute :pack200 do |ctx|
jruby_home = Dir[ File.join( ctx.project.build.directory.to_pathname,
'META-INF/jruby.home/**/*.jar' ) ]
gem_home = Dir[ File.join( ctx.project.build.directory.to_pathname,
'rubygems-provided/**/*.jar' ) ]
lib_dir = Dir[ File.join( ctx.basedir.to_pathname,
'../../lib/*.jar' ) ]

(jruby_home + gem_home + lib_dir).each do |f|
file = f.sub /.jar$/, ''
unless File.exists?( file + '.pack.gz' )
puts "pack200 #{f.sub(/.*jruby.home./, '').sub(/.*rubygems-provided./, '')}"
`pack200 #{file}.pack.gz #{file}.jar`
end
end
end

execute :fix_executable_bits do |ctx|
Dir[ File.join( ctx.project.build.directory.to_pathname,
'META-INF',
'jruby.home',
'bin',
'*' ) ].each do |f|
'META-INF/jruby.home/bin/*' ) ].each do |f|
unless f.match /.(bat|exe|dll)$/
puts f
File.chmod( 0755, f ) rescue nil
@@ -71,50 +85,18 @@

phase :package do
plugin( :assembly, '2.4',
'tarLongFileMode' => 'gnu',
'descriptors' => [ 'src/main/assembly/jruby.xml' ] ) do
execute_goals( 'single' )
:recompressZippedFiles => true,
:tarLongFileMode => 'gnu' ) do
execute_goals( :single, :id => 'bin.tar.gz and bin.zip',
:descriptors => [ 'src/main/assembly/bin.xml' ] )
execute_goals( :single, :id => 'bin200.tar.gz',
:attach => false,
:descriptors => [ 'src/main/assembly/bin200.xml' ] )
end
end

plugin( :invoker )

# for the release we do some extra IT by unzipping a source dist file
# and run the $ mvn -Pall from there and check a few things to be in place.
# add check for SNAPSHOT version in any of the modules !!!!

profile 'not-working-currently---release' do

plugin( :invoker, :pomIncludes => [ '*' ] )

phase 'pre-integration-test' do
plugin :dependency do
execute_goals( 'unpack',
:id => 'unpack jruby-dist',
'stripVersion' => 'true',
'artifactItems' => [ { 'groupId' => 'org.jruby',
'artifactId' => 'jruby-dist',
'version' => '${project.version}',
'type' => 'zip',
'classifier' => 'src',
'overWrite' => 'false',
'outputDirectory' => '${project.build.directory}' } ] )
end
end

execute :prepare_sources_for_it, 'pre-integration-test' do |ctx|
require 'fileutils'
dir = File.join( "#{ctx.project.build.directory}", 'it' )
FileUtils.mkdir_p dir
dir = File.join( dir, 'sources')
FileUtils.mv( "#{ctx.project.build.directory}/jruby-#{ctx.project.version}", "#{dir}" ) unless File.exists? "#{dir}"
File.open( "#{dir}/test.properties", 'w' ) do |f|
f.puts File.join( "outputFile=#{File.expand_path( dir )}", 'tree.txt' )
f.puts 'appendOutput=true'
end
end
end

# since the source packages are done from the git repository we need
# to be inside a git controlled directory. for example the source packages
# itself does not contain the git repository and can not pack
@@ -135,13 +117,14 @@
basefile = "#{ctx.project.build.directory}/#{ctx.project.artifactId}-#{ctx.project.version}-src"

FileUtils.cd( File.join( ctx.project.basedir.to_s, '..', '..' ) ) do
[ 'tar', 'zip' ].each do |format|
#[ 'tar', 'zip' ].each do |format|
[ 'zip' ].each do |format|
puts "create #{basefile}.#{format}"
system( "git archive --prefix 'jruby-#{ctx.project.version}/' --format #{format} #{revision} . -o #{basefile}.#{format}" ) || raise( "error creating #{format}-file" )
end
end
puts "zipping #{basefile}.tar"
system( "gzip #{basefile}.tar -f" ) || raise( "error zipping #{basefile}.tar" )
#puts "zipping #{basefile}.tar"
#system( "gzip #{basefile}.tar -f" ) || raise( "error zipping #{basefile}.tar" )
end
plugin 'org.codehaus.mojo:build-helper-maven-plugin' do
execute_goal( 'attach-artifact',
102 changes: 32 additions & 70 deletions maven/jruby-dist/pom.xml
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@
<name>JRuby Dist</name>
<properties>
<tesla.dump.readonly>true</tesla.dump.readonly>
<jruby.plugins.version>1.0.3</jruby.plugins.version>
<jruby.plugins.version>1.0.8</jruby.plugins.version>
<main.basedir>${project.parent.parent.basedir}</main.basedir>
<tesla.dump.pom>pom.xml</tesla.dump.pom>
<tesla.version>0.1.1</tesla.version>
@@ -70,17 +70,34 @@
<version>2.4</version>
<executions>
<execution>
<id>bin.tar.gz and bin.zip</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/main/assembly/bin.xml</descriptor>
</descriptors>
</configuration>
</execution>
<execution>
<id>bin200.tar.gz</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<attach>false</attach>
<descriptors>
<descriptor>src/main/assembly/bin200.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
<configuration>
<recompressZippedFiles>true</recompressZippedFiles>
<tarLongFileMode>gnu</tarLongFileMode>
<descriptors>
<descriptor>src/main/assembly/jruby.xml</descriptor>
</descriptors>
</configuration>
</plugin>
<plugin>
@@ -91,6 +108,17 @@
<artifactId>tesla-polyglot-maven-plugin</artifactId>
<version>${tesla.version}</version>
<executions>
<execution>
<id>pack200</id>
<phase>prepare-package</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<taskId>pack200</taskId>
<nativePom>pom.rb</nativePom>
</configuration>
</execution>
<execution>
<id>fix_executable_bits</id>
<phase>prepare-package</phase>
@@ -139,72 +167,6 @@
</repository>
</repositories>
</profile>
<profile>
<id>not-working-currently---release</id>
<build>
<plugins>
<plugin>
<artifactId>maven-invoker-plugin</artifactId>
<configuration>
<pomIncludes>
<pomInclude>*</pomInclude>
</pomIncludes>
</configuration>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack jruby-dist</id>
<phase>pre-integration-test</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<stripVersion>true</stripVersion>
<artifactItems>
<artifactItem>
<groupId>org.jruby</groupId>
<artifactId>jruby-dist</artifactId>
<version>${project.version}</version>
<type>zip</type>
<classifier>src</classifier>
<overWrite>false</overWrite>
<outputDirectory>${project.build.directory}</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>io.tesla.polyglot</groupId>
<artifactId>tesla-polyglot-maven-plugin</artifactId>
<version>${tesla.version}</version>
<executions>
<execution>
<id>prepare_sources_for_it</id>
<phase>pre-integration-test</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<taskId>prepare_sources_for_it</taskId>
<nativePom>pom.rb</nativePom>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>io.tesla.polyglot</groupId>
<artifactId>tesla-polyglot-ruby</artifactId>
<version>${tesla.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>source dist</id>
<activation>
39 changes: 39 additions & 0 deletions maven/jruby-dist/src/main/assembly/bin.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>bin</id>
<baseDirectory>jruby-${project.version}</baseDirectory>

<formats>
<format>tar.gz</format>
<format>zip</format>
</formats>

<componentDescriptors>
<componentDescriptor>src/main/assembly/common.xml</componentDescriptor>
</componentDescriptors>

<fileSets>
<fileSet>
<directory>${project.build.directory}/META-INF/jruby.home</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>**/*.jar</include>
</includes>
</fileSet>
<fileSet>
<directory>${project.build.directory}/rubygems-provided</directory>
<outputDirectory>/lib/ruby/gems/shared</outputDirectory>
<includes>
<include>**/*.jar</include>
</includes>
</fileSet>
<fileSet>
<directory>${project.parent.parent.basedir}</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>lib/*.jar</include>
</includes>
</fileSet>
</fileSets>
</assembly>
45 changes: 45 additions & 0 deletions maven/jruby-dist/src/main/assembly/bin200.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>bin200</id>
<baseDirectory>jruby-${project.version}</baseDirectory>

<formats>
<format>tar.gz</format>
</formats>

<componentDescriptors>
<componentDescriptor>src/main/assembly/common.xml</componentDescriptor>
</componentDescriptors>

<fileSets>
<fileSet>
<directory>${project.build.directory}/META-INF/jruby.home</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>**/*.pack.gz</include>
</includes>
</fileSet>
<fileSet>
<directory>${project.build.directory}/rubygems-provided</directory>
<outputDirectory>/lib/ruby/gems/shared</outputDirectory>
<includes>
<include>**/*.pack.gz</include>
</includes>
</fileSet>
<fileSet>
<directory>${project.parent.parent.basedir}</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>lib/*.pack.gz</include>
</includes>
</fileSet>
</fileSets>
<files>
<file>
<source>${project.build.directory}/META-INF/jruby.home/bin/jruby200.sh</source>
<outputDirectory>bin</outputDirectory>
<destName>jruby</destName>
</file>
</files>
</assembly>
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>bin</id>
<baseDirectory>jruby-${project.version}</baseDirectory>
<formats>
<format>tar.gz</format>
<format>zip</format>
</formats>
<component>
<fileSets>
<fileSet>
<directory>${project.build.directory}/META-INF/jruby.home</directory>
<outputDirectory>/</outputDirectory>
<excludes>
<exclude>**/.jrubydir</exclude>
<exclude>**/*.pack.gz</exclude>
<exclude>**/*.jar</exclude>
</excludes>
</fileSet>
<fileSet>
@@ -23,15 +17,18 @@
<include>specifications/*</include>
<include>gems/**/*</include>
</includes>
<excludes>
<exclude>**/.jrubydir</exclude>
<exclude>**/*.pack.gz</exclude>
<exclude>**/*.jar</exclude>
</excludes>
</fileSet>
<fileSet>
<directory>${project.parent.parent.basedir}</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>LICENSE*</include>
<include>COPYING*</include>
<include>lib/jruby.jar</include>
<include>lib/jruby-truffle.jar</include>
<include>lib/jni/**/*</include>
<include>samples/**/*</include>
<include>docs/**/*</include>
@@ -48,4 +45,4 @@
</excludes>
</fileSet>
</fileSets>
</assembly>
</component>
8 changes: 4 additions & 4 deletions maven/jruby-jars/Mavenfile
Original file line number Diff line number Diff line change
@@ -28,9 +28,9 @@ properties( 'tesla.dump.pom' => 'pom.xml',
'tesla.dump.readonly' => true,
'jruby.plugins.version' => '1.0.7',
# we share the already installed gems
'gem.home' => '${jruby.home}/lib/ruby/gems/shared',
'gem.home' => '${jruby_home}/lib/ruby/gems/shared',
# need jruby_home but not jruby.home as name otherwise
# tesla-plugin will pick the jruby from jruby.home
# polyglot-plugin will pick the jruby from jruby.home
'jruby_home' => '${basedir}/../../' )

unless version =~ /-SNAPSHOT/
@@ -40,11 +40,11 @@ properties( 'tesla.dump.pom' => 'pom.xml',
execute 'copy jruby.jar', 'prepare-package' do |ctx|
source = File.expand_path( ctx.project.properties[ 'jruby_home' ].to_pathname )
# TODO somehow the lib/jruby.jar gets moved away to avoid conflicts
FileUtils.cp( Dir[ File.join( source, "core/target/jruby-core-#{version}-complete.jar" ) ].first,
FileUtils.cp( Dir[ File.join( source, "lib/jruby.jar" ) ].first,
File.join( ctx.project.basedir.to_pathname,
'lib',
"jruby-core-#{ctx.project.version}-complete.jar" ) )
FileUtils.cp( Dir[ File.join( source, "truffle/target/jruby-truffle-#{version}-complete.jar" ) ].first,
FileUtils.cp( Dir[ File.join( source, "lib/jruby-truffle.jar" ) ].first,
File.join( ctx.project.basedir.to_pathname,
'lib',
"jruby-truffle-#{ctx.project.version}-complete.jar" ) )
9 changes: 7 additions & 2 deletions maven/jruby-jars/pom.xml
Original file line number Diff line number Diff line change
@@ -18,12 +18,18 @@ freezing to) a specific jruby-complete jar version.</description>
<licenses>
<license>
<name>EPL-1.0</name>
<url>http://opensource.org/licenses/EPL-1.0</url>
<comments>Eclipse Public License 1.0</comments>
</license>
<license>
<name>GPL-2.0</name>
<url>http://opensource.org/licenses/GPL-2.0</url>
<comments>GNU General Public License version 2.0</comments>
</license>
<license>
<name>LGPL-2.1</name>
<url>http://opensource.org/licenses/LGPL-2.1</url>
<comments>GNU Library or "Lesser" General Public License version 2.1</comments>
</license>
</licenses>
<developers>
@@ -38,10 +44,9 @@ freezing to) a specific jruby-complete jar version.</description>
</scm>
<properties>
<tesla.dump.readonly>true</tesla.dump.readonly>
<gem.home>${jruby.home}/lib/ruby/gems/shared</gem.home>
<gem.home>${jruby_home}/lib/ruby/gems/shared</gem.home>
<jruby.plugins.version>1.0.7</jruby.plugins.version>
<tesla.dump.pom>pom.xml</tesla.dump.pom>
<project.build.sourceEncoding>utf-8</project.build.sourceEncoding>
<jruby_home>${basedir}/../../</jruby_home>
<tesla.version>0.1.1</tesla.version>
</properties>
26 changes: 0 additions & 26 deletions maven/jruby-noasm/.classpath

This file was deleted.

23 changes: 0 additions & 23 deletions maven/jruby-noasm/.project

This file was deleted.

2 changes: 0 additions & 2 deletions maven/jruby-noasm/.settings/org.eclipse.core.resources.prefs

This file was deleted.

5 changes: 0 additions & 5 deletions maven/jruby-noasm/.settings/org.eclipse.jdt.core.prefs

This file was deleted.

4 changes: 0 additions & 4 deletions maven/jruby-noasm/.settings/org.eclipse.m2e.core.prefs

This file was deleted.

39 changes: 0 additions & 39 deletions maven/jruby-noasm/pom.rb

This file was deleted.

69 changes: 0 additions & 69 deletions maven/jruby-noasm/pom.xml

This file was deleted.

3 changes: 0 additions & 3 deletions maven/jruby-noasm/src/it/integrity/invoker.properties

This file was deleted.

164 changes: 0 additions & 164 deletions maven/jruby-noasm/src/it/integrity/pom.xml

This file was deleted.

45 changes: 0 additions & 45 deletions maven/jruby-noasm/src/it/integrity/verify.bsh

This file was deleted.

35 changes: 0 additions & 35 deletions maven/jruby-noasm/src/it/settings.xml

This file was deleted.

26 changes: 0 additions & 26 deletions maven/jruby-stdlib/.classpath

This file was deleted.

23 changes: 0 additions & 23 deletions maven/jruby-stdlib/.project

This file was deleted.

2 changes: 0 additions & 2 deletions maven/jruby-stdlib/.settings/org.eclipse.core.resources.prefs

This file was deleted.

5 changes: 0 additions & 5 deletions maven/jruby-stdlib/.settings/org.eclipse.jdt.core.prefs

This file was deleted.

4 changes: 0 additions & 4 deletions maven/jruby-stdlib/.settings/org.eclipse.m2e.core.prefs

This file was deleted.

101 changes: 0 additions & 101 deletions maven/jruby-stdlib/pom.rb

This file was deleted.

126 changes: 0 additions & 126 deletions maven/jruby-stdlib/pom.xml

This file was deleted.

Binary file removed maven/jruby-stdlib/src/empty.jar
Binary file not shown.
12 changes: 0 additions & 12 deletions maven/jruby-stdlib/src/main/resources/META-INF/MANIFEST.MF

This file was deleted.

8 changes: 4 additions & 4 deletions maven/jruby/src/it/integrity/pom.xml
Original file line number Diff line number Diff line change
@@ -131,7 +131,7 @@
</configuration>
</execution>
<execution>
<id>there is org.objectweb.asm.ClassWriter</id>
<id>ensure there is no org.objectweb.asm.ClassWriter</id>
<phase>test</phase>
<goals>
<goal>exec</goal>
@@ -148,10 +148,10 @@
<!-- make sure openssl loads -->
<argument>
begin
java_import "org.objectweb.asm.ClassWriter"
puts "there is org.objectweb.asm.ClassWriter on the classpath"
import_java "org.objectweb.asm.ClassWriter"
raise "error there is org.objectweb.asm.ClassWriter on the classpath"
rescue NameError => e
raise "error there is NO org.objectweb.asm.ClassWriter on the classpath"
puts "there is NO org.objectweb.asm.ClassWriter on the classpath"
end
</argument>
</arguments>
2 changes: 1 addition & 1 deletion maven/jruby/src/it/integrity/verify.bsh
Original file line number Diff line number Diff line change
@@ -38,7 +38,7 @@ if ( !log.contains( expected ) )
{
throw new RuntimeException( "log file does not contain '" + expected + "'" );
}
expected = "there is org.objectweb.asm.ClassWriter on the classpath";
expected = "there is NO org.objectweb.asm.ClassWriter on the classpath";
if ( !log.contains( expected ) )
{
throw new RuntimeException( "log file does not contain '" + expected + "'" );
2 changes: 0 additions & 2 deletions maven/pom.rb
Original file line number Diff line number Diff line change
@@ -24,8 +24,6 @@

# module to profile map
map = { 'jruby' => [ :release, :main, :osgi, :j2ee ],
'jruby-noasm' => [ :release, :main, :osgi ],
'jruby-stdlib' => [ :release, :main, :complete, :dist, 'jruby-jars', :osgi, :j2ee, :'jruby_complete_jar_extended' ],
'jruby-complete' => [ :release, :complete, :osgi, :'jruby_complete_jar_extended'],
'jruby-jars' => [ :release, 'jruby-jars' ],
'jruby-dist' => [ :release, :dist ]
21 changes: 4 additions & 17 deletions maven/pom.xml
Original file line number Diff line number Diff line change
@@ -50,8 +50,6 @@
<id>all</id>
<modules>
<module>jruby</module>
<module>jruby-noasm</module>
<module>jruby-stdlib</module>
<module>jruby-complete</module>
<module>jruby-jars</module>
<module>jruby-dist</module>
@@ -61,8 +59,6 @@
<id>release</id>
<modules>
<module>jruby</module>
<module>jruby-noasm</module>
<module>jruby-stdlib</module>
<module>jruby-complete</module>
<module>jruby-jars</module>
<module>jruby-dist</module>
@@ -72,52 +68,43 @@
<id>main</id>
<modules>
<module>jruby</module>
<module>jruby-noasm</module>
<module>jruby-stdlib</module>
</modules>
</profile>
<profile>
<id>osgi</id>
<modules>
<module>jruby</module>
<module>jruby-noasm</module>
<module>jruby-stdlib</module>
<module>jruby-complete</module>
</modules>
</profile>
<profile>
<id>j2ee</id>
<modules>
<module>jruby</module>
<module>jruby-stdlib</module>
</modules>
</profile>
<profile>
<id>complete</id>
<modules>
<module>jruby-stdlib</module>
<module>jruby-complete</module>
</modules>
</profile>
<profile>
<id>dist</id>
<id>jruby_complete_jar_extended</id>
<modules>
<module>jruby-stdlib</module>
<module>jruby-dist</module>
<module>jruby-complete</module>
</modules>
</profile>
<profile>
<id>jruby-jars</id>
<modules>
<module>jruby-stdlib</module>
<module>jruby-jars</module>
</modules>
</profile>
<profile>
<id>jruby_complete_jar_extended</id>
<id>dist</id>
<modules>
<module>jruby-stdlib</module>
<module>jruby-complete</module>
<module>jruby-dist</module>
</modules>
</profile>
</profiles>
4 changes: 2 additions & 2 deletions rakelib/test.rake
Original file line number Diff line number Diff line change
@@ -83,11 +83,11 @@ namespace :test do
end

task :jit do
ruby "-Xjit.threshold=0 -Xjit.background=false -r ./test/mri_test_env.rb test/mri/runner.rb #{ADDITIONAL_TEST_OPTIONS} -q -- #{mri_test_files}"
ruby "-J-XX:MaxPermSize=512M -Xjit.threshold=0 -Xjit.background=false -r ./test/mri_test_env.rb test/mri/runner.rb #{ADDITIONAL_TEST_OPTIONS} -q -- #{mri_test_files}"
end

task :aot do
ruby "-X+C -Xjit.background=false -r ./test/mri_test_env.rb test/mri/runner.rb #{ADDITIONAL_TEST_OPTIONS} -q -- #{mri_test_files}"
ruby "-J-XX:MaxPermSize=512M -X+C -Xjit.background=false -r ./test/mri_test_env.rb test/mri/runner.rb #{ADDITIONAL_TEST_OPTIONS} -q -- #{mri_test_files}"
end

task all: %s[int jit aot]
5 changes: 0 additions & 5 deletions spec/truffle/tags/core/array/collect_tags.txt

This file was deleted.

6 changes: 0 additions & 6 deletions spec/truffle/tags/core/array/concat_tags.txt

This file was deleted.

2 changes: 0 additions & 2 deletions spec/truffle/tags/core/array/delete_if_tags.txt

This file was deleted.

4 changes: 0 additions & 4 deletions spec/truffle/tags/core/array/map_tags.txt

This file was deleted.

3 changes: 0 additions & 3 deletions spec/truffle/tags/core/array/reject_tags.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
fails:Array#reject returns an Enumerator if no block given
fails:Array#reject! removes elements for which block is true
fails:Array#reject! properly handles recursive arrays
fails:Array#reject! returns nil when called on an Array emptied with #shift
fails:Array#reject! returns nil if no changes are made
fails:Array#reject! returns an Enumerator if no block given, and the array is frozen
fails:Array#reject! returns an Enumerator if no block given
1 change: 0 additions & 1 deletion spec/truffle/tags/core/array/select_tags.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
fails:Array#select returns an Enumerator if no block given
fails:Array#select! returns nil if no changes were made in the array
fails:Array#select! deletes elements for which the block returns a false value
fails:Array#select! returns an enumerator if no block is given
1 change: 0 additions & 1 deletion spec/truffle/tags/core/integer/downto_tags.txt

This file was deleted.

1 change: 0 additions & 1 deletion spec/truffle/tags/core/integer/upto_tags.txt

This file was deleted.

1 change: 0 additions & 1 deletion spec/truffle/tags/core/kernel/loop_tags.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
fails:Kernel.loop returns an enumerator if no block given
fails:Kernel.loop rescues StopIteration
fails:Kernel.loop rescues StopIteration's subclasses
1 change: 0 additions & 1 deletion spec/truffle/tags/core/objectspace/each_object_tags.txt

This file was deleted.

1 change: 0 additions & 1 deletion spec/truffle/tags/core/range/each_tags.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
fails:Range#each passes each element to the given block by using #succ
fails:Range#each returns an enumerator when no block given
fails:Range#each passes each Symbol element by using #succ
1 change: 0 additions & 1 deletion spec/truffle/tags/core/range/step_tags.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
fails:Range#step returns an enumerator when no block is given
fails:Range#step returns self
fails:Range#step calls #to_int to coerce step to an Integer
fails:Range#step raises a TypeError if #to_int does not return an Integer
1 change: 0 additions & 1 deletion spec/truffle/tags/core/string/downcase_tags.txt

This file was deleted.

2 changes: 0 additions & 2 deletions spec/truffle/tags/core/string/upcase_tags.txt

This file was deleted.

45 changes: 25 additions & 20 deletions test/check_versions.sh
Original file line number Diff line number Diff line change
@@ -20,14 +20,22 @@ failed[0]=0

function check {
archive=$1
unpackaged=$2

max=$2*1024*1024
unpackaged=$3
length=`cat $archive | wc -c`

if [ ! -f $archive ]
then
echo $archive was not found - check your version numbers
failed[0]=1
fi

if [[ $length -gt $max ]]
then
echo size of $archive expected smaller then $max but got $length
failed[0]=1
fi

if [[ $archive == *.tar.gz ]]
then
rm -rf $unpackaged
@@ -51,25 +59,22 @@ function check {
failed[0]=1
fi
fi

}

check test/target/jruby-tests-$jar_version.jar
check maven/jruby-stdlib/target/jruby-stdlib-$jar_version.jar
check maven/jruby-jars/pkg/jruby-jars-$gem_version.gem
check maven/jruby-jars/lib/jruby-core-$jar_version-complete.jar
check maven/jruby-jars/lib/jruby-truffle-$jar_version-complete.jar
check maven/jruby-jars/lib/jruby-stdlib-$jar_version.jar
check maven/jruby-complete/target/jruby-complete-$jar_version.jar
check maven/jruby/target/jruby-$jar_version.jar
check maven/jruby-noasm/target/jruby-noasm-$jar_version.jar
check maven/jruby-dist/target/jruby-dist-$jar_version-bin.tar.gz jruby-$jar_version
check maven/jruby-dist/target/jruby-dist-$jar_version-src.tar.gz jruby-$jar_version
check maven/jruby-dist/target/jruby-dist-$jar_version-src.zip jruby-$jar_version
check maven/jruby-dist/target/jruby-dist-$jar_version-bin.zip jruby-$jar_version
check core/target/jruby-core-$jar_version-noasm.jar
check core/target/jruby-core-$jar_version.jar
check core/target/jruby-core-$jar_version-complete.jar
check truffle/target/jruby-truffle-$jar_version.jar
check truffle/target/jruby-truffle-$jar_version-complete.jar
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 25
check maven/jruby-jars/lib/jruby-core-$jar_version-complete.jar 13
check maven/jruby-jars/lib/jruby-truffle-$jar_version-complete.jar 9
check maven/jruby-jars/lib/jruby-stdlib-$jar_version.jar 8
check maven/jruby-complete/target/jruby-complete-$jar_version.jar 27
check maven/jruby/target/jruby-$jar_version.jar 9
check maven/jruby-dist/target/jruby-dist-$jar_version-bin.tar.gz 38 jruby-$jar_version
check maven/jruby-dist/target/jruby-dist-$jar_version-bin200.tar.gz 17 jruby-$jar_version
check maven/jruby-dist/target/jruby-dist-$jar_version-src.zip 13 jruby-$jar_version
check maven/jruby-dist/target/jruby-dist-$jar_version-bin.zip 38 jruby-$jar_version
check core/target/jruby-core-$jar_version.jar 9
check truffle/target/jruby-truffle-$jar_version.jar 9

exit "${failed[0]}"
8 changes: 8 additions & 0 deletions test/jruby/test_base64_strangeness.rb
Original file line number Diff line number Diff line change
@@ -9,3 +9,11 @@ def test_base64_strangeness
assert !Class.private_instance_methods.include?('encode64')
end
end

# be strict GH-2551
class TestBase64Strangeness < Test::Unit::TestCase
def test_base64_stictness
require 'base64'
assert_raise(ArgumentError) { Base64.strict_decode64("AA==AAAA") }
end
end if RUBY_VERSION >= '1.9'
1 change: 0 additions & 1 deletion test/mri/excludes/TestBase64.rb

This file was deleted.

4 changes: 2 additions & 2 deletions tool/jt.rb
Original file line number Diff line number Diff line change
@@ -36,8 +36,8 @@ def self.mangle_for_env(name)
end

def self.find_graal_mx
mx = File.expand_path('../../../../mx.sh', '../../graal/basic-graal/jdk1.8.0_31/product/bin/java')
raise "couldn't find mx.sh - set GRAAL_BIN, and are need to use a checkout of Graal, not a build" unless File.executable?(mx)
mx = File.expand_path('../../../../mx.sh', find_graal)
raise "couldn't find mx.sh - set GRAAL_BIN, and you need to use a checkout of Graal, not a build" unless File.executable?(mx)
mx
end

13 changes: 0 additions & 13 deletions truffle/pom.rb
Original file line number Diff line number Diff line change
@@ -49,17 +49,4 @@
includes '**/*rb'
end
end

[ :dist, :'jruby-jars', :all, :release ].each do |name|
profile name do
plugin :shade do
execute_goals( 'shade',
:id => 'pack jruby-truffle-complete.jar',
:phase => 'verify',
:artifactSet => { :includes => [ 'com.oracle:truffle' ] },
:shadedArtifactAttached => 'true',
:shadedClassifierName => 'complete' )
end
end
end
end
114 changes: 0 additions & 114 deletions truffle/pom.xml
Original file line number Diff line number Diff line change
@@ -96,118 +96,4 @@
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>dist</id>
<build>
<plugins>
<plugin>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<id>pack jruby-truffle-complete.jar</id>
<phase>verify</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<artifactSet>
<includes>
<include>com.oracle:truffle</include>
</includes>
</artifactSet>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>complete</shadedClassifierName>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>jruby-jars</id>
<build>
<plugins>
<plugin>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<id>pack jruby-truffle-complete.jar</id>
<phase>verify</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<artifactSet>
<includes>
<include>com.oracle:truffle</include>
</includes>
</artifactSet>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>complete</shadedClassifierName>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>all</id>
<build>
<plugins>
<plugin>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<id>pack jruby-truffle-complete.jar</id>
<phase>verify</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<artifactSet>
<includes>
<include>com.oracle:truffle</include>
</includes>
</artifactSet>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>complete</shadedClassifierName>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>release</id>
<build>
<plugins>
<plugin>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<id>pack jruby-truffle-complete.jar</id>
<phase>verify</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<artifactSet>
<includes>
<include>com.oracle:truffle</include>
</includes>
</artifactSet>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>complete</shadedClassifierName>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
Original file line number Diff line number Diff line change
@@ -25,12 +25,4 @@ public CoreSourceSection(String className, String methodName) {
this.methodName = methodName;
}

public String getClassName() {
return className;
}

public String getMethodName() {
return methodName;
}

}
100 changes: 53 additions & 47 deletions truffle/src/main/java/org/jruby/truffle/nodes/core/ArrayNodes.java
Original file line number Diff line number Diff line change
@@ -45,6 +45,7 @@
import org.jruby.truffle.runtime.control.RedoException;
import org.jruby.truffle.runtime.core.*;
import org.jruby.truffle.runtime.methods.Arity;
import org.jruby.truffle.runtime.methods.InternalMethod;
import org.jruby.truffle.runtime.methods.SharedMethodInfo;
import org.jruby.truffle.runtime.util.ArrayUtils;
import org.jruby.util.ByteList;
@@ -331,8 +332,9 @@ public Object fallback(VirtualFrame frame, RubyArray array, RubyArray args) {
fallbackNode = insert(DispatchHeadNodeFactory.createMethodCall(getContext()));
}

InternalMethod method = RubyArguments.getMethod(frame.getArguments());
return fallbackNode.call(frame, array, "element_reference_fallback", null,
getContext().makeString(getName()), args);
getContext().makeString(method.getName()), args);
}

}
@@ -701,38 +703,56 @@ public RubyArray concatNull(RubyArray array, RubyArray other) {
public RubyArray concatIntegerFixnum(RubyArray array, RubyArray other) {
notDesignedForCompilation();

// TODO(CS): is there already space in array?
System.arraycopy(other.getStore(), 0, array.getStore(), array.getSize(), other.getSize());
array.setStore(Arrays.copyOf((int[]) array.getStore(), array.getSize() + other.getSize()), array.getSize() + other.getSize());
final int newSize = array.getSize() + other.getSize();
int[] store = (int[]) array.getStore();

if ( store.length < newSize) {
store = Arrays.copyOf((int[]) array.getStore(), ArrayUtils.capacity(store.length, newSize));
}

System.arraycopy(other.getStore(), 0, store, array.getSize(), other.getSize());
array.setStore(store, newSize);
return array;
}

@Specialization(guards = "areBothLongFixnum(array, other)")
public RubyArray concatLongFixnum(RubyArray array, RubyArray other) {
notDesignedForCompilation();

// TODO(CS): is there already space in array?
System.arraycopy(other.getStore(), 0, array.getStore(), array.getSize(), other.getSize());
array.setStore(Arrays.copyOf((long[]) array.getStore(), array.getSize() + other.getSize()), array.getSize() + other.getSize());
final int newSize = array.getSize() + other.getSize();
long[] store = (long[]) array.getStore();

if ( store.length < newSize) {
store = Arrays.copyOf((long[]) array.getStore(), ArrayUtils.capacity(store.length, newSize));
}

System.arraycopy(other.getStore(), 0, store, array.getSize(), other.getSize());
array.setStore(store, newSize);
return array;
}

@Specialization(guards = "areBothFloat(array, other)")
public RubyArray concatDouble(RubyArray array, RubyArray other) {
notDesignedForCompilation();

// TODO(CS): is there already space in array?
System.arraycopy(other.getStore(), 0, array.getStore(), array.getSize(), other.getSize());
array.setStore(Arrays.copyOf((double[]) array.getStore(), array.getSize() + other.getSize()), array.getSize() + other.getSize());
final int newSize = array.getSize() + other.getSize();
double[] store = (double[]) array.getStore();

if ( store.length < newSize) {
store = Arrays.copyOf((double[]) array.getStore(), ArrayUtils.capacity(store.length, newSize));
}

System.arraycopy(other.getStore(), 0, store, array.getSize(), other.getSize());
array.setStore(store, newSize);
return array;
}

@Specialization(guards = "areBothObject(array, other)")
public RubyArray concatObject(RubyArray array, RubyArray other) {
notDesignedForCompilation();

int size = array.getSize();
int newSize = size + other.getSize();
final int size = array.getSize();
final int newSize = size + other.getSize();
Object[] store = (Object[]) array.getStore();

if (newSize > store.length) {
@@ -748,12 +768,22 @@ public RubyArray concatObject(RubyArray array, RubyArray other) {
public RubyArray concat(RubyArray array, RubyArray other) {
notDesignedForCompilation();

// TODO(CS): is there already space in array?
// TODO(CS): if array is Object[], use Arrays.copyOf
final Object[] newStore = new Object[array.getSize() + other.getSize()];
ArrayUtils.copy(array.getStore(), newStore, 0, array.getSize());
ArrayUtils.copy(other.getStore(), newStore, array.getSize(), other.getSize());
array.setStore(newStore, array.getSize() + other.getSize());
final int newSize = array.getSize() + other.getSize();

Object[] store;
if (array.getStore() instanceof Object[]) {
store = (Object[]) array.getStore();
if (store.length < newSize) {
store = Arrays.copyOf(store, ArrayUtils.capacity(store.length, newSize));
}
ArrayUtils.copy(other.getStore(), store, array.getSize(), other.getSize());
} else {
store = new Object[newSize];
ArrayUtils.copy(array.getStore(), store, 0, array.getSize());
ArrayUtils.copy(other.getStore(), store, array.getSize(), other.getSize());
}

array.setStore(store, newSize);
return array;
}

@@ -1744,12 +1774,11 @@ public RubyString join(RubyArray array, RubyString separator) {

}

@CoreMethod(names = {"map", "collect"}, needsBlock = true)
@CoreMethod(names = {"map", "collect"}, needsBlock = true, returnsEnumeratorIfNoBlock = true)
@ImportStatic(ArrayGuards.class)
public abstract static class MapNode extends YieldingCoreMethodNode {

@Child private ArrayBuilderNode arrayBuilder;
@Child private CallDispatchHeadNode toEnumNode;

private final BranchProfile breakProfile = BranchProfile.create();
private final BranchProfile nextProfile = BranchProfile.create();
@@ -1763,17 +1792,6 @@ public MapNode(RubyContext context, SourceSection sourceSection) {
public MapNode(MapNode prev) {
super(prev);
arrayBuilder = prev.arrayBuilder;
toEnumNode = prev.toEnumNode;
}

@Specialization
public Object eachEnumerator(VirtualFrame frame, RubyArray array, UndefinedPlaceholder block) {
if (toEnumNode == null) {
CompilerDirectives.transferToInterpreter();
toEnumNode = insert(DispatchHeadNodeFactory.createMethodCall(getContext()));
}

return toEnumNode.call(frame, array, "to_enum", null, getContext().getCoreLibrary().getMapSymbol());
}

@Specialization(guards = "isNull(array)")
@@ -1934,11 +1952,10 @@ public Object mapObject(VirtualFrame frame, RubyArray array, RubyProc block) {
}
}

@CoreMethod(names = {"map!", "collect!"}, needsBlock = true)
@CoreMethod(names = {"map!", "collect!"}, needsBlock = true, returnsEnumeratorIfNoBlock = true, raiseIfFrozenSelf = true)
@ImportStatic(ArrayGuards.class)
public abstract static class MapInPlaceNode extends YieldingCoreMethodNode {

@Child private CallDispatchHeadNode toEnumNode;
@Child private ArrayWriteDenormalizedNode writeNode;

private final BranchProfile breakProfile = BranchProfile.create();
@@ -1951,20 +1968,9 @@ public MapInPlaceNode(RubyContext context, SourceSection sourceSection) {

public MapInPlaceNode(MapInPlaceNode prev) {
super(prev);
toEnumNode = prev.toEnumNode;
writeNode = prev.writeNode;
}

@Specialization
public Object eachEnumerator(VirtualFrame frame, RubyArray array, UndefinedPlaceholder block) {
if (toEnumNode == null) {
CompilerDirectives.transferToInterpreter();
toEnumNode = insert(DispatchHeadNodeFactory.createMethodCall(getContext()));
}

return toEnumNode.call(frame, array, "to_enum", null, getContext().getCoreLibrary().getMapBangSymbol());
}

@Specialization(guards = "isNull(array)")
public RubyArray mapInPlaceNull(RubyArray array, RubyProc block) {
return array;
@@ -2818,7 +2824,7 @@ public RubyArray pushObjectObject(RubyArray array, Object value) {

}

@CoreMethod(names = "reject", needsBlock = true)
@CoreMethod(names = "reject", needsBlock = true, returnsEnumeratorIfNoBlock = true)
@ImportStatic(ArrayGuards.class)
public abstract static class RejectNode extends YieldingCoreMethodNode {

@@ -2907,7 +2913,7 @@ public Object selectFixnumInteger(VirtualFrame frame, RubyArray array, RubyProc

}

@CoreMethod(names = { "reject!", "delete_if" }, needsBlock = true, raiseIfFrozenSelf = true)
@CoreMethod(names = { "reject!", "delete_if" }, needsBlock = true, returnsEnumeratorIfNoBlock = true, raiseIfFrozenSelf = true)
@ImportStatic(ArrayGuards.class)
public abstract static class RejectInPlaceNode extends YieldingCoreMethodNode {

@@ -3010,7 +3016,7 @@ public RubyArray replaceObject(RubyArray array, RubyArray other) {

}

@CoreMethod(names = "select", needsBlock = true)
@CoreMethod(names = "select", needsBlock = true, returnsEnumeratorIfNoBlock = true)
@ImportStatic(ArrayGuards.class)
public abstract static class SelectNode extends YieldingCoreMethodNode {

Original file line number Diff line number Diff line change
@@ -68,4 +68,6 @@

UnsupportedOperationBehavior unsupportedOperationBehavior() default UnsupportedOperationBehavior.TYPE_ERROR;

boolean returnsEnumeratorIfNoBlock() default false;

}
Loading

0 comments on commit c00ff32

Please sign in to comment.