Skip to content

Commit

Permalink
Showing 605 changed files with 7,977 additions and 6,961 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ before_script:

jdk:
- openjdk7
- oraclejdk8
# - oraclejdk8

os:
- linux
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -9,8 +9,8 @@ Authors: Stefan Matthias Aust, Anders Bengtsson, Geert Bevin, Ola Bini,
Robert Feldt, Chad Fowler, Russ Freeman, Joey Gibson, Kiel Hodges,
Xandy Johnson, Kelvin Liu, Kevin Menard, Alan Moore, Akinori Musha,
Charles Nutter, Takashi Okamoto, Jan Arne Petersen, Tobias Reif, David Saff,
Chris Seaton, Nick Sieger, Ed Sinjiashvili, Vladimir Sizikov, Daiki Ueno,
Matthias Veit, Jason Voegele, Sergey Yevtushenko, Robert Yokota,
Subramanya Sastry, Chris Seaton, Nick Sieger, Ed Sinjiashvili, Vladimir Sizikov,
Daiki Ueno, Matthias Veit, Jason Voegele, Sergey Yevtushenko, Robert Yokota,
and many gracious contributors from the community.

Project Contact: Thomas E Enebo <enebo@acm.org>
6 changes: 3 additions & 3 deletions core/src/main/java/org/jruby/Ruby.java
Original file line number Diff line number Diff line change
@@ -1371,7 +1371,7 @@ public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule claz
}

// Object is ready, create top self
topSelf = TopSelfFactory.createTopSelf(this);
topSelf = TopSelfFactory.createTopSelf(this, false);

// Pre-create all the core classes potentially referenced during startup
RubyNil.createNilClass(this);
@@ -2850,7 +2850,7 @@ public void printError(RubyException excp) {
}

public void loadFile(String scriptName, InputStream in, boolean wrap) {
IRubyObject self = wrap ? TopSelfFactory.createTopSelf(this) : getTopSelf();
IRubyObject self = wrap ? TopSelfFactory.createTopSelf(this, true) : getTopSelf();
ThreadContext context = getCurrentContext();
String file = context.getFile();

@@ -2962,7 +2962,7 @@ public void loadScript(Script script, boolean wrap) {
* @param wrap Whether to use a new "self" for toplevel
*/
public void loadExtension(String extName, BasicLibraryService extension, boolean wrap) {
IRubyObject self = wrap ? TopSelfFactory.createTopSelf(this) : getTopSelf();
IRubyObject self = wrap ? TopSelfFactory.createTopSelf(this, true) : getTopSelf();
ThreadContext context = getCurrentContext();

try {
2 changes: 2 additions & 0 deletions core/src/main/java/org/jruby/RubyArray.java
Original file line number Diff line number Diff line change
@@ -58,8 +58,10 @@
import org.jruby.runtime.marshal.UnmarshalStream;
import org.jruby.util.ByteList;
import org.jruby.util.Pack;
import org.jruby.util.PerlHash;
import org.jruby.util.Qsort;
import org.jruby.util.RecursiveComparator;
import org.jruby.util.SipHashInline;
import org.jruby.util.TypeConverter;

import java.io.IOException;
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/RubyEncoding.java
Original file line number Diff line number Diff line change
@@ -166,7 +166,7 @@ public static Encoding areCompatible(IRubyObject obj1, IRubyObject obj2) {
}

// last block in rb_enc_compatible
static Encoding areCompatible(Encoding enc1, int cr1, Encoding enc2, int cr2) {
public static Encoding areCompatible(Encoding enc1, int cr1, Encoding enc2, int cr2) {
if (cr1 != cr2) {
/* may need to handle ENC_CODERANGE_BROKEN */
if (cr1 == StringSupport.CR_7BIT) return enc2;
51 changes: 21 additions & 30 deletions core/src/main/java/org/jruby/RubyIO.java
Original file line number Diff line number Diff line change
@@ -1351,12 +1351,9 @@ private IRubyObject ioWriteNonblock(ThreadContext context, Ruby runtime, IRubyOb
throw runtime.newErrnoFromErrno(fptr.errno(), fptr.getPath());

fptr.setNonblock(runtime);
try {
ByteList strByteList = ((RubyString) str).getByteList();
n = fptr.posix.write(fptr.fd(), strByteList.unsafeBytes(), strByteList.begin(), strByteList.getRealSize(), true);
} finally {
fptr.setBlock(runtime);
}

ByteList strByteList = ((RubyString) str).getByteList();
n = fptr.posix.write(fptr.fd(), strByteList.unsafeBytes(), strByteList.begin(), strByteList.getRealSize(), true);

if (n == -1) {
if (fptr.posix.errno == Errno.EWOULDBLOCK || fptr.posix.errno == Errno.EAGAIN) {
@@ -2740,7 +2737,7 @@ public IRubyObject ungetc(ThreadContext context, IRubyObject c) {
return context.nil;
}

@JRubyMethod(name = "read_nonblock", required = 1, optional = 1)
@JRubyMethod(name = "read_nonblock", required = 1, optional = 2)
public IRubyObject read_nonblock(ThreadContext context, IRubyObject[] args) {
return doReadNonblock(context, args, true);
}
@@ -2832,30 +2829,24 @@ private IRubyObject getPartial(ThreadContext context, IRubyObject[] args, boolea
if (nonblock) {
fptr.setNonblock(runtime);
}
try {
str = EncodingUtils.setStrBuf(runtime, str, len);
strByteList = ((RubyString) str).getByteList();
// arg.fd = fptr->fd;
// arg.str_ptr = RSTRING_PTR(str);
// arg.len = len;
// rb_str_locktmp_ensure(str, read_internal_call, (VALUE)&arg);
// n = arg.len;
n = OpenFile.readInternal(context, fptr, fptr.fd(), strByteList.unsafeBytes(), strByteList.begin(), len);
if (n < 0) {
if (!nonblock && fptr.waitReadable(context))
continue again;
if (nonblock && (fptr.errno() == Errno.EWOULDBLOCK || fptr.errno() == Errno.EAGAIN)) {
if (noException)
return runtime.newSymbol("wait_readable");
else
throw runtime.newErrnoEAGAINReadableError("read would block");
}
throw runtime.newEOFError(fptr.getPath());
}
} finally {
if (nonblock) {
fptr.setBlock(runtime);
str = EncodingUtils.setStrBuf(runtime, str, len);
strByteList = ((RubyString) str).getByteList();
// arg.fd = fptr->fd;
// arg.str_ptr = RSTRING_PTR(str);
// arg.len = len;
// rb_str_locktmp_ensure(str, read_internal_call, (VALUE)&arg);
// n = arg.len;
n = OpenFile.readInternal(context, fptr, fptr.fd(), strByteList.unsafeBytes(), strByteList.begin(), len);
if (n < 0) {
if (!nonblock && fptr.waitReadable(context))
continue again;
if (nonblock && (fptr.errno() == Errno.EWOULDBLOCK || fptr.errno() == Errno.EAGAIN)) {
if (noException)
return runtime.newSymbol("wait_readable");
else
throw runtime.newErrnoEAGAINReadableError("read would block");
}
throw runtime.newEOFError(fptr.getPath());
}
break;
}
41 changes: 18 additions & 23 deletions core/src/main/java/org/jruby/RubyMatchData.java
Original file line number Diff line number Diff line change
@@ -49,7 +49,6 @@
import org.jruby.runtime.ThreadContext;
import org.jruby.runtime.Visibility;
import org.jruby.runtime.builtin.IRubyObject;
import org.jruby.runtime.Visibility;
import org.jruby.util.ByteList;
import org.jruby.util.StringSupport;

@@ -458,53 +457,49 @@ public IRubyObject size(ThreadContext context) {
/** match_begin
*
*/
@JRubyMethod
public IRubyObject begin(ThreadContext context, IRubyObject index) {
return begin19(context, index);
}
check();

@JRubyMethod(name = "begin")
public IRubyObject begin19(ThreadContext context, IRubyObject index) {
int i = backrefNumber(index);
Ruby runtime = context.runtime;
int b = beginCommon(runtime, i);

if (i < 0 || (regs == null ? 1 : regs.numRegs) <= i) throw runtime.newIndexError("index " + i + " out of matches");

int b = regs == null ? begin : regs.beg[i];

if (b < 0) return runtime.getNil();

if (!str.singleByteOptimizable()) {
updateCharOffset();
b = charOffsets.beg[i];
}
return RubyFixnum.newFixnum(runtime, b);
}

private int beginCommon(Ruby runtime, int i) {
check();
if (i < 0 || (regs == null ? 1 : regs.numRegs) <= i) throw runtime.newIndexError("index " + i + " out of matches");
return regs == null ? begin : regs.beg[i];
return RubyFixnum.newFixnum(runtime, b);
}

/** match_end
*
*/
@JRubyMethod
public IRubyObject end(ThreadContext context, IRubyObject index) {
return end19(context, index);
}
check();

@JRubyMethod(name = "end")
public IRubyObject end19(ThreadContext context, IRubyObject index) {
int i = backrefNumber(index);
Ruby runtime = context.runtime;
int e = endCommon(runtime, i);

if (i < 0 || (regs == null ? 1 : regs.numRegs) <= i) throw runtime.newIndexError("index " + i + " out of matches");

int e = regs == null ? end : regs.end[i];

if (e < 0) return runtime.getNil();

if (!str.singleByteOptimizable()) {
updateCharOffset();
e = charOffsets.end[i];
}
return RubyFixnum.newFixnum(runtime, e);
}

private int endCommon(Ruby runtime, int i) {
check();
if (i < 0 || (regs == null ? 1 : regs.numRegs) <= i) throw runtime.newIndexError("index " + i + " out of matches");
return regs == null ? end : regs.end[i];
return RubyFixnum.newFixnum(runtime, e);
}

/** match_offset
4 changes: 3 additions & 1 deletion core/src/main/java/org/jruby/RubyProc.java
Original file line number Diff line number Diff line change
@@ -159,7 +159,9 @@ private void setup(Block procBlock) {
oldBinding.getFrame().duplicate(),
oldBinding.getVisibility(),
oldBinding.getDynamicScope(),
oldBinding.getBacktrace().clone());
oldBinding.getMethod(),
oldBinding.getFile(),
oldBinding.getLine());
block = new Block(procBlock.getBody(), newBinding);

// modify the block with a new backref/lastline-grabbing scope
Loading

0 comments on commit 71e6131

Please sign in to comment.