Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 9cd2ccc43470
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 629cbd3a9890
Choose a head ref
  • 5 commits
  • 4 files changed
  • 1 contributor

Commits on May 18, 2016

  1. Copy the full SHA
    a53e82f View commit details
  2. Copy the full SHA
    2f8c7e7 View commit details
  3. Copy the full SHA
    2826c73 View commit details
  4. 4
    Copy the full SHA
    ea3b122 View commit details
  5. Copy the full SHA
    629cbd3 View commit details
Original file line number Diff line number Diff line change
@@ -39,10 +39,13 @@

import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
import com.oracle.truffle.api.dsl.Cached;
import com.oracle.truffle.api.dsl.Fallback;
import com.oracle.truffle.api.dsl.Specialization;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.object.DynamicObject;
import com.oracle.truffle.api.profiles.BranchProfile;
import com.oracle.truffle.api.profiles.ConditionProfile;
import com.oracle.truffle.api.source.SourceSection;
import jnr.constants.platform.Sysconf;
import jnr.posix.Passwd;
@@ -62,7 +65,6 @@
import org.jruby.truffle.core.string.StringOperations;
import org.jruby.truffle.core.thread.ThreadManager;
import org.jruby.truffle.language.RubyGuards;
import org.jruby.truffle.language.RubyNode;
import org.jruby.truffle.language.control.ExitException;
import org.jruby.truffle.language.control.RaiseException;
import org.jruby.truffle.language.control.ThrowException;
@@ -78,12 +80,10 @@
import org.jruby.truffle.platform.signal.SignalHandler;
import org.jruby.truffle.platform.signal.SignalManager;
import org.jruby.util.io.PosixShim;

import java.lang.management.ManagementFactory;
import java.lang.management.ThreadMXBean;
import java.util.ArrayList;
import java.util.List;

import static jnr.constants.platform.Errno.ECHILD;
import static jnr.constants.platform.Errno.EINTR;
import static jnr.constants.platform.WaitFlags.WNOHANG;
@@ -110,13 +110,14 @@ private boolean areSame(VirtualFrame frame, Object left, Object right) {
}

@Specialization
public Object doCatch(VirtualFrame frame, Object tag, DynamicObject block) {
CompilerDirectives.transferToInterpreter();

public Object doCatch(VirtualFrame frame, Object tag, DynamicObject block,
@Cached("create()") BranchProfile catchProfile,
@Cached("createBinaryProfile()") ConditionProfile matchProfile) {
try {
return dispatchNode.dispatch(frame, block, tag);
} catch (ThrowException e) {
if (areSame(frame, e.getTag(), tag)) {
catchProfile.enter();
if (matchProfile.profile(areSame(frame, e.getTag(), tag))) {
return e.getValue();
} else {
throw e;
@@ -196,9 +197,9 @@ public DynamicObject vmGetModuleName(DynamicObject module) {
@Primitive(name = "vm_get_user_home", needsSelf = false, unsafe = UnsafeGroup.IO)
public abstract static class VMGetUserHomePrimitiveNode extends PrimitiveArrayArgumentsNode {

@TruffleBoundary
@Specialization(guards = "isRubyString(username)")
public DynamicObject vmGetUserHome(DynamicObject username) {
CompilerDirectives.transferToInterpreter();
// TODO BJF 30-APR-2015 Review the more robust getHomeDirectoryPath implementation
final Passwd passwd = posix().getpwnam(username.toString());
if (passwd == null) {
Original file line number Diff line number Diff line change
@@ -209,15 +209,11 @@ public InstanceExecNode(RubyContext context, SourceSection sourceSection) {

@Specialization
public Object instanceExec(VirtualFrame frame, Object receiver, Object[] arguments, DynamicObject block) {
CompilerDirectives.transferToInterpreter();

return yield.dispatchWithModifiedSelf(frame, block, receiver, arguments);
}

@Specialization
public Object instanceExec(Object receiver, Object[] arguments, NotProvided block) {
CompilerDirectives.transferToInterpreter();

throw new RaiseException(coreExceptions().localJumpError("no block given", this));
}

@@ -254,7 +250,6 @@ public abstract static class MethodMissingNode extends CoreMethodArrayArgumentsN

@Specialization
public Object methodMissingNoName(Object self, NotProvided name, Object[] args, NotProvided block) {
CompilerDirectives.transferToInterpreter();
throw new RaiseException(coreExceptions().argumentError("no id given", this));
}

@@ -268,18 +263,22 @@ public Object methodMissingBlock(Object self, DynamicObject name, Object[] args,
return methodMissing(self, name, args, block);
}

@TruffleBoundary
private Object methodMissing(Object self, DynamicObject nameObject, Object[] args, DynamicObject block) {
throw new RaiseException(buildMethodMissingException(self, nameObject, args, block));
}

@TruffleBoundary
private DynamicObject buildMethodMissingException(Object self, DynamicObject nameObject, Object[] args, DynamicObject block) {
final String name = nameObject.toString();

if (lastCallWasSuper()) {
throw new RaiseException(coreExceptions().noSuperMethodError(name, this));
return coreExceptions().noSuperMethodError(name, this);
} else if (lastCallWasCallingPrivateMethod(self, name)) {
throw new RaiseException(coreExceptions().privateMethodError(name, self, this));
return coreExceptions().privateMethodError(name, self, this);
} else if (lastCallWasVCall()) {
throw new RaiseException(coreExceptions().nameErrorUndefinedLocalVariableOrMethod(name, self, this));
return coreExceptions().nameErrorUndefinedLocalVariableOrMethod(name, self, this);
} else {
throw new RaiseException(coreExceptions().noMethodErrorOnReceiver(name, self, this));
return coreExceptions().noMethodErrorOnReceiver(name, self, this);
}
}

Original file line number Diff line number Diff line change
@@ -54,6 +54,7 @@ public class RopeOperations {

private static final ConcurrentHashMap<Encoding, Charset> encodingToCharsetMap = new ConcurrentHashMap<>();

@TruffleBoundary
public static LeafRope create(byte[] bytes, Encoding encoding, CodeRange codeRange) {
if (bytes.length == 1) {
final int index = bytes[0] & 0xff;
Original file line number Diff line number Diff line change
@@ -58,7 +58,7 @@ public Assumption getUnmodifiedAssumption(DynamicObject module) {
return Layouts.MODULE.getFields(module).getUnmodifiedAssumption();
}

@Specialization(guards = "isRubyModule(module)")
@Specialization(guards = "isRubyModule(module)", contains = "isACached")
public boolean isAUncached(Object self, DynamicObject module) {
return isA(getMetaClass(self), module);
}