Skip to content
Permalink
Browse files
Merge branch 'master' into truffle-head
  • Loading branch information
chrisseaton committed Dec 24, 2014
2 parents 03a8a55 + ecee892 commit f3e944c8a527e5354df3469f50b65669b1324b8f
Showing with 553 additions and 181 deletions.
  1. +1 −1 core/pom.rb
  2. +1 −1 core/pom.xml
  3. +6 −10 core/src/main/java/org/jruby/RubyProcess.java
  4. +0 −85 core/src/main/java/org/jruby/RubyRegexp.java
  5. +2 −2 core/src/main/java/org/jruby/ir/operands/Array.java
  6. +3 −4 core/src/main/java/org/jruby/ir/operands/AsString.java
  7. +1 −1 core/src/main/java/org/jruby/ir/operands/Complex.java
  8. +3 −1 core/src/main/java/org/jruby/ir/operands/DynamicSymbol.java
  9. +2 −0 core/src/main/java/org/jruby/ir/operands/StringLiteral.java
  10. +2 −16 core/src/main/java/org/jruby/ir/representations/BasicBlock.java
  11. +6 −0 core/src/main/java/org/jruby/ir/runtime/IRRuntimeHelpers.java
  12. +18 −0 core/src/main/java/org/jruby/ir/targets/IRBytecodeAdapter.java
  13. +89 −3 core/src/main/java/org/jruby/ir/targets/IRBytecodeAdapter6.java
  14. +24 −0 core/src/main/java/org/jruby/ir/targets/IRBytecodeAdapter7.java
  15. +3 −19 core/src/main/java/org/jruby/ir/targets/JVMVisitor.java
  16. +57 −0 core/src/main/java/org/jruby/platform/NTPlatform.java
  17. +21 −2 core/src/main/java/org/jruby/platform/Platform.java
  18. +69 −0 core/src/main/java/org/jruby/platform/SolarisPlatform.java
  19. +69 −0 core/src/main/java/org/jruby/platform/UnixPlatform.java
  20. +37 −0 core/src/main/java/org/jruby/platform/UnsupportedPlatform.java
  21. +5 −0 core/src/main/java/org/jruby/truffle/nodes/control/IfNode.java
  22. +13 −3 core/src/main/java/org/jruby/truffle/nodes/core/StringNodes.java
  23. +103 −25 core/src/main/java/org/jruby/truffle/translator/LoadArgumentsTranslator.java
  24. +5 −0 core/src/main/java/org/jruby/truffle/translator/MethodTranslator.java
  25. +1 −0 core/src/main/java/org/jruby/truffle/translator/Translator.java
  26. +11 −0 core/src/main/java/org/jruby/truffle/translator/TranslatorEnvironment.java
  27. +1 −0 core/src/main/java/org/jruby/util/cli/Options.java
  28. +0 −4 spec/truffle/tags/language/method_tags.txt
  29. +0 −4 test/jruby/test_load.rb
@@ -53,7 +53,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:dirgra:0.1'
jar 'org.jruby:dirgra:0.2'

jar 'com.headius:invokebinder:1.5'
jar 'com.headius:options:1.1'
@@ -147,7 +147,7 @@
<dependency>
<groupId>org.jruby</groupId>
<artifactId>dirgra</artifactId>
<version>0.1</version>
<version>0.2</version>
</dependency>
<dependency>
<groupId>com.headius</groupId>
@@ -113,7 +113,7 @@ public static RubyModule createProcessModule(Ruby runtime) {
public static final String CLOCK_UNIT_FLOAT_MILLISECOND = "float_millisecond";
public static final String CLOCK_UNIT_FLOAT_SECOND = "float_second";
public static final String CLOCK_UNIT_HERTZ = "hertz";

@JRubyClass(name="Process::Status")
public static class RubyStatus extends RubyObject {
private final long status;
@@ -573,16 +573,12 @@ public static IRubyObject exit_bang(IRubyObject recv, IRubyObject[] args) {

@JRubyMethod(name = "groups", module = true, visibility = PRIVATE)
public static IRubyObject groups(IRubyObject recv) {
if(Platform.IS_WINDOWS) {
throw recv.getRuntime().newNotImplementedError("groups() function is unimplemented on this machine");
} else {
long[] groups = (new com.sun.security.auth.module.UnixSystem()).getGroups();
RubyArray ary = RubyArray.newArray(recv.getRuntime(), groups.length);
for(int i = 0; i < groups.length; i++) {
ary.push(RubyFixnum.newFixnum(recv.getRuntime(), groups[i]));
}
return ary;
long[] groups = Platform.getPlatform().getGroups(recv);
RubyArray ary = RubyArray.newArray(recv.getRuntime(), groups.length);
for(int i = 0; i < groups.length; i++) {
ary.push(RubyFixnum.newFixnum(recv.getRuntime(), groups[i]));
}
return ary;
}

@JRubyMethod(name = "setrlimit", rest = true, module = true, visibility = PRIVATE)
@@ -1965,91 +1965,6 @@ public static IRubyObject match_last(IRubyObject match) {
return nth_match(i, match);
}

static RubyString regsub(RubyString str, RubyString src, Matcher matcher, Encoding enc) {
Region regs = matcher.getRegion();

int no = -1;
ByteList bs = str.getByteList();
int p = bs.getBegin();
int s = p;
int end = p + bs.getRealSize();
byte[]bytes = bs.getUnsafeBytes();

ByteList srcbs = src.getByteList();

ByteList val = null;

while (s < end) {
int ss = s;
int c = bytes[s] & 0xff;
int l = enc.length(bytes, s++, end);
if (l != 1) {
s += l - 1;
continue;
}
if (c != '\\' || s == end) continue;
if (val == null) val = new ByteList(ss - p);

val.append(bytes, p, ss - p);
c = bytes[s++] & 0xff;
p = s;

switch (c) {
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
no = c - '0';
break;
case '&':
no = 0;
break;
case '`':
val.append( srcbs.getUnsafeBytes(), srcbs.getBegin(), matcher.getBegin());
continue;
case '\'':
val.append(srcbs.getUnsafeBytes(), srcbs.getBegin() + matcher.getEnd(), srcbs.getRealSize() - matcher.getEnd());
continue;
case '+':
if (regs == null) {
if (matcher.getBegin() == -1) {
no = 0;
continue;
}
} else {
no = regs.numRegs - 1;
while (regs.beg[no] == -1 && no > 0) no--;
if (no == 0) continue;
}
break;
case '\\':
val.append(bytes, s - 1, 1);
continue;
default:
val.append(bytes, s - 2, 2);
continue;
}

if (regs != null) {
if (no >= 0) {
if (no >= regs.numRegs || regs.beg[no] == -1) continue;
val.append(srcbs.getUnsafeBytes(), srcbs.getBegin() + regs.beg[no], regs.end[no] - regs.beg[no]);
}
} else {
if (no != 0 || matcher.getBegin() == -1) continue;
val.append(srcbs.getUnsafeBytes(), srcbs.getBegin() + matcher.getBegin(), matcher.getEnd() - matcher.getBegin());
}
}

if (p < end) {
if (val == null) {
return RubyString.newString(str.getRuntime(), bs.makeShared(p - bs.getBegin(), end - p));
} else {
val.append(bytes, p, end - p);
}
}
if (val == null) return str;
return RubyString.newString(str.getRuntime(), val);
}

// MRI: ASCGET macro from rb_reg_regsub
private static final int ASCGET(boolean acompat, byte[] sBytes, int s, int e, int[] cl, Encoding strEnc) {
if (acompat) {
@@ -20,7 +20,7 @@ public class Array extends Operand {

// SSS FIXME: Do we create a special-case for zero-length arrays?
public Array() {
this(new Operand[0]);
this(EMPTY_ARRAY);
}

public Array(List<Operand> elts) {
@@ -30,7 +30,7 @@ public Array(List<Operand> elts) {
public Array(Operand[] elts) {
super(OperandType.ARRAY);

this.elts = elts == null ? new Operand[0] : elts;
this.elts = elts == null ? EMPTY_ARRAY : elts;
}

public boolean isBlank() {
@@ -16,19 +16,18 @@ public class AsString extends Operand {
public AsString(Operand source) {
super(OperandType.AS_STRING);

if (source == null) source = new StringLiteral("");
this.source = source;
this.source = source == null ? StringLiteral.EMPTY_STRING : source;
}

@Override
public Object retrieve(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp) {
return ((IRubyObject)source.retrieve(context, self, currScope, currDynScope, temp)).asString();
return ((IRubyObject) source.retrieve(context, self, currScope, currDynScope, temp)).asString();
}

@Override
public Operand getSimplifiedOperand(Map<Operand, Operand> valueMap, boolean force) {
Operand newSource = source.getSimplifiedOperand(valueMap, force);
return (newSource == source) ? this : new AsString(newSource);
return newSource == source ? this : new AsString(newSource);
}

@Override
@@ -9,7 +9,7 @@
* Represents a Complex literal.
*/
public class Complex extends ImmutableLiteral {
private ImmutableLiteral number;
private final ImmutableLiteral number;

public Complex(ImmutableLiteral number) {
super(OperandType.COMPLEX);
@@ -35,7 +35,9 @@ public void addUsedVariables(List<Variable> l) {
}

public Operand cloneForInlining(CloneInfo ii) {
return new DynamicSymbol(symbolName.cloneForInlining(ii));
Operand clonedSymbolName = symbolName.cloneForInlining(ii);

return clonedSymbolName == symbolName ? this : new DynamicSymbol(clonedSymbolName);
}

@Override
@@ -22,6 +22,8 @@
* This is not like a Java string.
*/
public class StringLiteral extends Operand {
public static final StringLiteral EMPTY_STRING = new StringLiteral("");

// SSS FIXME: Pick one of bytelist or string, or add internal conversion methods to convert to the default representation

final public ByteList bytelist;
@@ -21,7 +21,6 @@ public class BasicBlock implements ExplicitVertexID, Comparable {
private Label label; // All basic blocks have a starting label
private List<Instr> instrs; // List of non-label instructions
private boolean isRescueEntry; // Is this basic block entry of a rescue?
private Instr[] instrsArray;

public BasicBlock(CFG cfg, Label label) {
this.label = label;
@@ -30,21 +29,19 @@ public BasicBlock(CFG cfg, Label label) {
isRescueEntry = false;

assert label != null : "label is null";
assert cfg != null : "cfg is null";

initInstrs();
}

private void initInstrs() {
instrs = new ArrayList<Instr>();
instrs = new ArrayList<>();
if (RubyInstanceConfig.IR_COMPILER_DEBUG || RubyInstanceConfig.IR_VISUALIZER) {
IRManager irManager = cfg.getScope().getManager();
InstructionsListener listener = irManager.getInstructionsListener();
if (listener != null) {
instrs = new InstructionsListenerDecorator(instrs, listener);
}
}
instrsArray = null;
}

@Override
@@ -79,7 +76,6 @@ public boolean isRescueEntry() {

public void replaceInstrs(List<Instr> instrs) {
this.instrs = instrs;
this.instrsArray = null;
}

public void addInstr(Instr i) {
@@ -94,23 +90,13 @@ public List<Instr> getInstrs() {
return instrs;
}

public int instrCount() {
return instrs.size();
}

public Instr[] getInstrsArray() {
if (instrsArray == null) instrsArray = instrs.toArray(new Instr[instrs.size()]);

return instrsArray;
}

public Instr getLastInstr() {
int n = instrs.size();
return (n == 0) ? null : instrs.get(n-1);
}

public boolean removeInstr(Instr i) {
return i == null? false : instrs.remove(i);
return i != null && instrs.remove(i);
}

public boolean isEmpty() {
@@ -28,6 +28,7 @@
import org.jruby.parser.StaticScope;
import org.jruby.runtime.*;
import org.jruby.runtime.builtin.IRubyObject;
import org.jruby.runtime.callsite.FunctionalCachingCallSite;
import org.jruby.util.ByteList;
import org.jruby.util.DefinedMessage;
import org.jruby.util.RegexpOptions;
@@ -1292,4 +1293,9 @@ public static RaiseException newRequiredKeywordArgumentError(ThreadContext conte
public static void pushExitBlock(ThreadContext context, Block blk) {
context.runtime.pushExitBlock(context.runtime.newProc(Block.Type.LAMBDA, blk));
}

@JIT
public static FunctionalCachingCallSite newFunctionalCachingCallSite(String name) {
return new FunctionalCachingCallSite(name);
}
}
@@ -275,6 +275,24 @@ public org.objectweb.asm.Label newLabel() {
*/
public abstract void invokeOther(String name, int arity, boolean hasClosure);

/**
* Invoke a fixnum-receiving method on an object other than self.
*
* Stack required: context, self, receiver (fixnum will be handled separately)
*
* @param name name of the method to invoke
*/
public abstract void invokeOtherOneFixnum(String name, long fixnum);

/**
* Invoke a float-receiving method on an object other than self.
*
* Stack required: context, self, receiver (float will be handled separately)
*
* @param name name of the method to invoke
*/
public abstract void invokeOtherOneFloat(String name, double flote);


/**
* Invoke a method on self.

0 comments on commit f3e944c

Please sign in to comment.