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

Commits on Mar 11, 2017

  1. Copy the full SHA
    7bbe17b View commit details
  2. Copy the full SHA
    19f8ab3 View commit details
  3. Copy the full SHA
    04544d1 View commit details
5 changes: 5 additions & 0 deletions core/src/main/java/org/jruby/ir/operands/Complex.java
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@

import org.jruby.RubyComplex;
import org.jruby.ir.IRVisitor;
import org.jruby.ir.persistence.IRReaderDecoder;
import org.jruby.ir.persistence.IRWriterEncoder;
import org.jruby.runtime.ThreadContext;
import org.jruby.runtime.builtin.IRubyObject;
@@ -45,6 +46,10 @@ public void encode(IRWriterEncoder e) {
e.encode(number);
}

public static Complex decode(IRReaderDecoder d) {
return new Complex((ImmutableLiteral) d.decodeOperand());
}

public Operand getNumber() {
return number;
}
13 changes: 13 additions & 0 deletions core/src/main/java/org/jruby/ir/operands/Rational.java
Original file line number Diff line number Diff line change
@@ -2,6 +2,8 @@

import org.jruby.RubyRational;
import org.jruby.ir.IRVisitor;
import org.jruby.ir.persistence.IRReaderDecoder;
import org.jruby.ir.persistence.IRWriterEncoder;
import org.jruby.runtime.ThreadContext;
import org.jruby.runtime.builtin.IRubyObject;

@@ -30,6 +32,17 @@ public Object createCacheObject(ThreadContext context) {
(IRubyObject) numerator.cachedObject(context), (IRubyObject) denominator.cachedObject(context));
}

@Override
public void encode(IRWriterEncoder e) {
super.encode(e);
numerator.encode(e);
denominator.encode(e);
}

public static Rational decode(IRReaderDecoder d) {
return new Rational((ImmutableLiteral) d.decodeOperand(), (ImmutableLiteral) d.decodeOperand());
}

@Override
public String toString() {
return "Rational:" + numerator + "/1";
Original file line number Diff line number Diff line change
@@ -458,6 +458,7 @@ public Operand decode(OperandType type) {
case AS_STRING: return AsString.decode(this);
case BIGNUM: return Bignum.decode(this);
case BOOLEAN: return org.jruby.ir.operands.Boolean.decode(this);
case COMPLEX: return Complex.decode(this);
case CURRENT_SCOPE: return CurrentScope.decode(this);
case DYNAMIC_SYMBOL: return DynamicSymbol.decode(this);
case FILENAME: return Filename.decode(this);
@@ -473,6 +474,7 @@ public Operand decode(OperandType type) {
case NTH_REF: return NthRef.decode(this);
case NULL_BLOCK: return NullBlock.decode(this);
case OBJECT_CLASS: return new ObjectClass();
case RATIONAL: return Rational.decode(this);
case REGEXP: return Regexp.decode(this);
case SCOPE_MODULE: return ScopeModule.decode(this);
case SELF: return Self.SELF;
2 changes: 1 addition & 1 deletion spec/compiler/general_spec.rb
Original file line number Diff line number Diff line change
@@ -1137,7 +1137,7 @@ def self.foo
'

run(code) do |x|
x.should == :ok
expect(x).to eq(:ok)
end
end

5 changes: 5 additions & 0 deletions spec/jrubyc/java/files/operands.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
def numbers
[1r, 1c, 1, 1.0]
end

$numbers_result = numbers
6 changes: 6 additions & 0 deletions spec/jrubyc/java/loading_spec.rb
Original file line number Diff line number Diff line change
@@ -46,6 +46,12 @@ def compile_files(files)
expect( $symbol_proc_result ).to eql [ 1, 2, 3 ]
end

it "can load all number operands" do
load File.join(FILES_DIR, 'operands.class')

expect( $numbers_result ).to eql [1r, 1c, 1, 1.0]
end

it "compiles hashy_kwargs.class correctly" do
load File.join(FILES_DIR, 'hashy_kwargs.class')