Skip to content

Commit

Permalink
Merge branch 'master' into javax-script-clean-prints
Browse files Browse the repository at this point in the history
* master: (235 commits)
  Arity-split Array#sample
  Handle arity errors better in sample
  Arity split and handle bad kwargs in shuffle
  Spec appears to be intermittently failing
  Adjust specs for unpack/pack 'j and 'J' support
  Implement unpack/pack 'j' aand 'J'
  Restore getrlimit and frozen string tags
  Restore two pack tags mistakenly removed
  Sweep passing library tags
  Sweep passing UnboundMethod tags
  Sweep tags for TracePoint
  Sweep passing Time tags
  Sweep passing Process tags
  Sweep passing ObjectSpace tags
  Sweep passing tags for Thread and friends
  Sweep passing tags for Hash, Marshal
  Sweep passing Kernel tags
  Sweep passing tags for Env, Exception, File, IO
  Sweep passing tags for core numerics
  Sweep passing Comparable tags
  ...
  • Loading branch information
kares committed Dec 17, 2020
2 parents 097186f + 9605d68 commit be4658a
Show file tree
Hide file tree
Showing 728 changed files with 9,606 additions and 35,123 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: checkout
uses: actions/checkout@v2
- name: set up java ${{ matrix.java-version }}
uses: actions/setup-java@v1
uses: actions/setup-java@v1.4.3
with:
java-version: ${{ matrix.java-version }}
- name: cache dependencies
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: checkout
uses: actions/checkout@v2
- name: set up java ${{ matrix.java-version }}
uses: actions/setup-java@v1
uses: actions/setup-java@v1.4.3
with:
java-version: ${{ matrix.java-version }}
- name: cache dependencies
Expand Down Expand Up @@ -67,7 +67,7 @@ jobs:
- name: checkout
uses: actions/checkout@v2
- name: set up java 8
uses: actions/setup-java@v1
uses: actions/setup-java@v1.4.3
with:
java-version: 8
- name: cache dependencies
Expand All @@ -94,7 +94,7 @@ jobs:
- name: checkout
uses: actions/checkout@v2
- name: set up java 8
uses: actions/setup-java@v1
uses: actions/setup-java@v1.4.3
with:
java-version: 8
- name: cache dependencies
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ lib/ruby/gems
lib/ruby/stdlib/**/maven-metadata-local.xml
lib/ruby/stdlib/*.jar
lib/ruby/stdlib/ant*
lib/ruby/stdlib/bundler*
lib/ruby/stdlib/cmath.rb
lib/ruby/stdlib/csv*
lib/ruby/stdlib/did_you_mean*
Expand Down
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
source 'https://rubygems.org'

gem 'rspec', '3.9.0'
gem 'rspec-expectations', '3.9.2' # pinned to work around jruby/jruby#6452
20 changes: 14 additions & 6 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.svg?branch=master)](https://travis-ci.org/jruby/jruby)
9.1 branch: [![Build Status](https://travis-ci.org/jruby/jruby.svg?branch=jruby-9.1)](https://travis-ci.org/jruby/jruby/branches)
Master: [![Build Status](https://travis-ci.com/jruby/jruby.svg?branch=master)](https://travis-ci.org/jruby/jruby)
9.2 branch: [![Build Status](https://travis-ci.com/jruby/jruby.svg?branch=jruby-9.2)](https://travis-ci.org/jruby/jruby/branches)

## About

Expand Down Expand Up @@ -36,7 +36,7 @@ version is very old.
An alternative is to use one of the [Ruby version managers](https://www.ruby-lang.org/en/documentation/installation/#managers).

For [`rbenv`](https://github.com/sstephenson/rbenv) you will need the
[`ruby-build`](https://github.com/sstephenson/ruby-build) plugin. You may find that your system
[`ruby-build`](https://githubcom/sstephenson/ruby-build) plugin. You may find that your system
package manager can provide these. To see which versions of JRuby are available you should run:

```
Expand All @@ -46,11 +46,11 @@ $ rbenv install jruby
Note: if you do not regularly git update rbenv this list of versions may be out of date.

We recommend always selecting the latest version of JRuby from the list.
You can install that particular version (9.1.17.0 is just for illustration):
You can install that particular version (9.2.13.0 is just for illustration):


```
$ rbenv install jruby-9.1.17.0
$ rbenv install jruby-9.2.13.0
```

For [`rvm`](https://rvm.io) you can simply do:
Expand Down Expand Up @@ -92,6 +92,14 @@ Project Contact: Thomas E Enebo <[email protected]>

## License

JRuby is licensed to you under three licenses - the EPL 2.0, GPL 2 and LGPL 2.1.
JRuby is licensed under a tri EPL/GPL/LGPL license. You can use it,
redistribute it and/or modify it under the terms of the:

Eclipse Public License version 2.0
OR
GNU General Public License version 2
OR
GNU Lesser General Public License version 2.1

Some components have other licenses and copyright. See the [COPYING](COPYING)
file for more specifics.
10 changes: 5 additions & 5 deletions core/pom.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@

# exclude jnr-ffi to avoid problems with shading and relocation of the asm packages
jar 'com.github.jnr:jnr-netdb:1.2.0', :exclusions => ['com.github.jnr:jnr-ffi']
jar 'com.github.jnr:jnr-enxio:0.32.1', :exclusions => ['com.github.jnr:jnr-ffi']
jar 'com.github.jnr:jnr-unixsocket:0.38.3', :exclusions => ['com.github.jnr:jnr-ffi']
jar 'com.github.jnr:jnr-posix:3.1.2', :exclusions => ['com.github.jnr:jnr-ffi']
jar 'com.github.jnr:jnr-constants:0.10.0', :exclusions => ['com.github.jnr:jnr-ffi']
jar 'com.github.jnr:jnr-ffi:2.2.0'
jar 'com.github.jnr:jnr-enxio:0.32.3', :exclusions => ['com.github.jnr:jnr-ffi']
jar 'com.github.jnr:jnr-unixsocket:0.38.5', :exclusions => ['com.github.jnr:jnr-ffi']
jar 'com.github.jnr:jnr-posix:3.1.4', :exclusions => ['com.github.jnr:jnr-ffi']
jar 'com.github.jnr:jnr-constants:0.10.1', :exclusions => ['com.github.jnr:jnr-ffi']
jar 'com.github.jnr:jnr-ffi:2.2.1'
jar 'com.github.jnr:jffi:${jffi.version}'
jar 'com.github.jnr:jffi:${jffi.version}:native'

Expand Down
10 changes: 5 additions & 5 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ DO NOT MODIFIY - GENERATED CODE
<dependency>
<groupId>com.github.jnr</groupId>
<artifactId>jnr-enxio</artifactId>
<version>0.32.1</version>
<version>0.32.3</version>
<exclusions>
<exclusion>
<artifactId>jnr-ffi</artifactId>
Expand All @@ -101,7 +101,7 @@ DO NOT MODIFIY - GENERATED CODE
<dependency>
<groupId>com.github.jnr</groupId>
<artifactId>jnr-unixsocket</artifactId>
<version>0.38.3</version>
<version>0.38.5</version>
<exclusions>
<exclusion>
<artifactId>jnr-ffi</artifactId>
Expand All @@ -112,7 +112,7 @@ DO NOT MODIFIY - GENERATED CODE
<dependency>
<groupId>com.github.jnr</groupId>
<artifactId>jnr-posix</artifactId>
<version>3.1.2</version>
<version>3.1.4</version>
<exclusions>
<exclusion>
<artifactId>jnr-ffi</artifactId>
Expand All @@ -123,7 +123,7 @@ DO NOT MODIFIY - GENERATED CODE
<dependency>
<groupId>com.github.jnr</groupId>
<artifactId>jnr-constants</artifactId>
<version>0.10.0</version>
<version>0.10.1</version>
<exclusions>
<exclusion>
<artifactId>jnr-ffi</artifactId>
Expand All @@ -134,7 +134,7 @@ DO NOT MODIFIY - GENERATED CODE
<dependency>
<groupId>com.github.jnr</groupId>
<artifactId>jnr-ffi</artifactId>
<version>2.2.0</version>
<version>2.2.1</version>
</dependency>
<dependency>
<groupId>com.github.jnr</groupId>
Expand Down
10 changes: 10 additions & 0 deletions core/src/main/java/org/jruby/IncludedModuleWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,16 @@ protected IRubyObject getAutoloadConstant(String name, boolean forceLoad) {
return origin.getAutoloadConstant(name, forceLoad);
}

@Override
protected Map<String, Autoload> getAutoloadMap() {
return origin.getAutoloadMap();
}

@Override
protected Map<String, Autoload> getAutoloadMapForWrite() {
return origin.getAutoloadMapForWrite();
}

@Override
protected DynamicMethod searchMethodCommon(String id) {
// IncludedModuleWrapper needs to search prepended modules too, so search until we find methodLocation
Expand Down
39 changes: 21 additions & 18 deletions core/src/main/java/org/jruby/Ruby.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@
import org.jruby.javasupport.JavaPackage;
import org.jruby.javasupport.JavaSupport;
import org.jruby.javasupport.JavaSupportImpl;
import org.jruby.lexer.yacc.ISourcePosition;
import org.jruby.management.Caches;
import org.jruby.management.InlineStats;
import org.jruby.parser.StaticScope;
Expand Down Expand Up @@ -563,10 +562,10 @@ private void initBootLibraries() {
}

// Provide some legacy libraries
loadService.provide("enumerator", "enumerator.rb");
loadService.provide("rational", "rational.rb");
loadService.provide("complex", "complex.rb");
loadService.provide("thread", "thread.rb");
loadService.provide("enumerator.rb");
loadService.provide("rational.rb");
loadService.provide("complex.rb");
loadService.provide("thread.rb");

// Load preludes
initRubyPreludes();
Expand Down Expand Up @@ -1116,30 +1115,30 @@ public IRubyObject runWithGetsLoop(RootNode scriptNode, boolean printing, boolea

// Modifies incoming source for -n, -p, and -F
private RootNode addGetsLoop(RootNode oldRoot, boolean printing, boolean processLineEndings, boolean split) {
ISourcePosition pos = oldRoot.getPosition();
BlockNode newBody = new BlockNode(pos);
int line = oldRoot.getLine();
BlockNode newBody = new BlockNode(line);
RubySymbol dollarSlash = newSymbol(CommonByteLists.DOLLAR_SLASH);
newBody.add(new GlobalAsgnNode(pos, dollarSlash, new StrNode(pos, ((RubyString) globalVariables.get("$/")).getByteList())));
newBody.add(new GlobalAsgnNode(line, dollarSlash, new StrNode(line, ((RubyString) globalVariables.get("$/")).getByteList())));

if (processLineEndings) newBody.add(new GlobalAsgnNode(pos, newSymbol(CommonByteLists.DOLLAR_BACKSLASH), new GlobalVarNode(pos, dollarSlash)));
if (processLineEndings) newBody.add(new GlobalAsgnNode(line, newSymbol(CommonByteLists.DOLLAR_BACKSLASH), new GlobalVarNode(line, dollarSlash)));

GlobalVarNode dollarUnderscore = new GlobalVarNode(pos, newSymbol("$_"));
GlobalVarNode dollarUnderscore = new GlobalVarNode(line, newSymbol("$_"));

BlockNode whileBody = new BlockNode(pos);
newBody.add(new WhileNode(pos, new VCallNode(pos, newSymbol("gets")), whileBody));
BlockNode whileBody = new BlockNode(line);
newBody.add(new WhileNode(line, new VCallNode(line, newSymbol("gets")), whileBody));

if (processLineEndings) whileBody.add(new CallNode(pos, dollarUnderscore, newSymbol("chomp!"), null, null, false));
if (split) whileBody.add(new GlobalAsgnNode(pos, newSymbol("$F"), new CallNode(pos, dollarUnderscore, newSymbol("split"), null, null, false)));
if (processLineEndings) whileBody.add(new CallNode(line, dollarUnderscore, newSymbol("chomp!"), null, null, false));
if (split) whileBody.add(new GlobalAsgnNode(line, newSymbol("$F"), new CallNode(line, dollarUnderscore, newSymbol("split"), null, null, false)));

if (oldRoot.getBodyNode() instanceof BlockNode) { // common case n stmts
whileBody.addAll(((BlockNode) oldRoot.getBodyNode()));
} else { // single expr script
whileBody.add(oldRoot.getBodyNode());
}

if (printing) whileBody.add(new FCallNode(pos, newSymbol("puts"), new ArrayNode(pos, dollarUnderscore), null));
if (printing) whileBody.add(new FCallNode(line, newSymbol("puts"), new ArrayNode(line, dollarUnderscore), null));

return new RootNode(pos, oldRoot.getScope(), newBody, oldRoot.getFile());
return new RootNode(line, oldRoot.getScope(), newBody, oldRoot.getFile());
}

/**
Expand Down Expand Up @@ -1775,8 +1774,8 @@ private void initJavaSupport() {
new Java().load(this, false);
new JRubyUtilLibrary().load(this, false);

loadService.provide("java", "java.rb");
loadService.provide("jruby/util", "jruby/util.rb");
loadService.provide("java.rb");
loadService.provide("jruby/util.rb");
}
}

Expand Down Expand Up @@ -3538,6 +3537,10 @@ public RubyString newString(String string) {
return RubyString.newString(this, string);
}

public RubyString newDeduplicatedString(String string) {
return freezeAndDedupString(RubyString.newString(this, string));
}

public RubyString newString(ByteList byteList) {
return RubyString.newString(this, byteList);
}
Expand Down
Loading

0 comments on commit be4658a

Please sign in to comment.