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: 36c437e58b9a
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 8cb49b750864
Choose a head ref
  • 3 commits
  • 5 files changed
  • 1 contributor

Commits on Feb 20, 2016

  1. Copy the full SHA
    55a56e0 View commit details
  2. Copy the full SHA
    0a47709 View commit details
  3. 1
    Copy the full SHA
    8cb49b7 View commit details
8 changes: 4 additions & 4 deletions truffle/src/main/java/org/jruby/truffle/RubyContext.java
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@
import org.jruby.truffle.core.objectspace.ObjectSpaceManager;
import org.jruby.truffle.core.rope.RopeTable;
import org.jruby.truffle.core.rubinius.RubiniusPrimitiveManager;
import org.jruby.truffle.core.string.StringLiterals;
import org.jruby.truffle.core.string.CoreStrings;
import org.jruby.truffle.core.symbol.SymbolTable;
import org.jruby.truffle.core.thread.ThreadManager;
import org.jruby.truffle.extra.AttachmentsManager;
@@ -75,7 +75,7 @@ public class RubyContext extends ExecutionContext {
private final AtExitManager atExitManager = new AtExitManager(this);
private final SourceCache sourceCache = new SourceCache(new SourceLoader(this));
private final CallStackManager callStack = new CallStackManager(this);
private final StringLiterals stringLiterals = new StringLiterals(this);
private final CoreStrings coreStrings = new CoreStrings(this);

private final CompilerOptions compilerOptions = Truffle.getRuntime().createCompilerOptions();

@@ -319,7 +319,7 @@ public CallStackManager getCallStack() {
return callStack;
}

public StringLiterals getStringLiterals() {
return stringLiterals;
public CoreStrings getCoreStrings() {
return coreStrings;
}
}
Original file line number Diff line number Diff line change
@@ -12,21 +12,21 @@
import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
import com.oracle.truffle.api.object.DynamicObject;
import org.jcodings.specific.USASCIIEncoding;
import org.jcodings.specific.ASCIIEncoding;
import org.jruby.truffle.RubyContext;
import org.jruby.truffle.core.rope.CodeRange;
import org.jruby.truffle.core.rope.Rope;

import java.nio.charset.StandardCharsets;

public class StringLiteral {
public class CoreString {

private final RubyContext context;
private final String literal;

@CompilationFinal private volatile Rope rope;

public StringLiteral(RubyContext context, String literal) {
public CoreString(RubyContext context, String literal) {
assert is7Bit(literal);
this.context = context;
this.literal = literal;
@@ -41,7 +41,7 @@ public Rope getRope() {
return rope;
}

public DynamicObject getString() {
public DynamicObject createInstance() {
return StringOperations.createString(context, getRope());
}

@@ -50,7 +50,7 @@ private Rope createRope() {

return context.getRopeTable().getRope(
literal.getBytes(StandardCharsets.US_ASCII),
USASCIIEncoding.INSTANCE,
ASCIIEncoding.INSTANCE,
CodeRange.CR_7BIT);
}

Original file line number Diff line number Diff line change
@@ -11,15 +11,15 @@

import org.jruby.truffle.RubyContext;

public class StringLiterals {
public class CoreStrings {

private final RubyContext context;

public final StringLiteral NIL;
public final CoreString NIL;

public StringLiterals(RubyContext context) {
public CoreStrings(RubyContext context) {
this.context = context;
NIL = new StringLiteral(context, "nil");
NIL = new CoreString(context, "nil");
}

}
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@
import org.jruby.truffle.core.Layouts;
import org.jruby.truffle.core.rope.CodeRange;
import org.jruby.truffle.core.rope.Rope;
import org.jruby.truffle.core.string.StringLiterals;
import org.jruby.truffle.core.string.CoreStrings;
import org.jruby.truffle.core.string.StringOperations;
import org.jruby.truffle.platform.Sockets;
import org.jruby.util.ByteList;
@@ -171,8 +171,8 @@ protected DynamicObject createString(Rope rope) {
return StringOperations.createString(getContext(), rope);
}

protected StringLiterals stringLiterals() {
return getContext().getStringLiterals();
protected CoreStrings coreStrings() {
return getContext().getCoreStrings();
}

protected POSIX posix() {
Original file line number Diff line number Diff line change
@@ -13,7 +13,6 @@
import com.oracle.truffle.api.nodes.NodeCost;
import com.oracle.truffle.api.nodes.NodeInfo;
import com.oracle.truffle.api.source.SourceSection;
import org.jcodings.specific.UTF8Encoding;
import org.jruby.truffle.RubyContext;
import org.jruby.truffle.language.RubyNode;

@@ -32,7 +31,7 @@ public Object execute(VirtualFrame frame) {

@Override
public Object isDefined(VirtualFrame frame) {
return stringLiterals().NIL.getString();
return coreStrings().NIL.createInstance();
}

}