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: bffa74688773
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 48dcafc8026a
Choose a head ref
  • 5 commits
  • 6 files changed
  • 3 contributors

Commits on May 25, 2015

  1. 1
    Copy the full SHA
    8d40490 View commit details
  2. 4
    Copy the full SHA
    6c85c32 View commit details
  3. Copy the full SHA
    ce40bac View commit details

Commits on May 26, 2015

  1. Copy the full SHA
    e57f7a4 View commit details
  2. Copy the full SHA
    48dcafc View commit details
1 change: 1 addition & 0 deletions spec/tags/ruby/core/hash/reject_tags.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
fails:Hash#reject taints the resulting hash
fails:Hash#reject with extra state does not taint the resulting hash
15 changes: 0 additions & 15 deletions spec/truffle/tags/library/csv/parse_tags.txt

This file was deleted.

3 changes: 0 additions & 3 deletions spec/truffle/tags/library/csv/readlines_tags.txt

This file was deleted.

Original file line number Diff line number Diff line change
@@ -20,7 +20,6 @@
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.interop.TruffleObject;
import com.oracle.truffle.api.source.SourceSection;
import com.oracle.truffle.interop.TruffleGlobalScope;
import com.oracle.truffle.interop.messages.Argument;
import com.oracle.truffle.interop.messages.Execute;
import com.oracle.truffle.interop.messages.GetSize;
@@ -34,20 +33,9 @@
import com.oracle.truffle.interop.messages.Write;
import com.oracle.truffle.interop.node.ForeignObjectAccessNode;


@CoreClass(name = "Truffle::Interop")
public abstract class TruffleInteropNodes {

private static TruffleGlobalScope globalScope;

public static void setGlobalScope(TruffleGlobalScope globalScope) {
TruffleInteropNodes.globalScope = globalScope;
}

public static TruffleGlobalScope getGlobalScope() {
return globalScope;
}

@CoreMethod(names = "interop_to_ruby_primitive", isModuleFunction = true, needsSelf = false, required = 1)
public abstract static class InteropToRubyNode extends CoreMethodArrayArgumentsNode {

@@ -314,11 +302,12 @@ public Object executeForeign(VirtualFrame frame, TruffleObject receiver) {
}

}


/*
@CoreMethod(names = "export", isModuleFunction = true, needsSelf = false, required = 2)
public abstract static class ExportNode extends CoreMethodArrayArgumentsNode {

public ExportNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
}
@@ -338,7 +327,7 @@ public Object export(VirtualFrame frame, RubyString name, TruffleObject object)
protected static String rubyStringToString(RubyString rubyString) {
return rubyString.toString();
}
protected TruffleGlobalScope getGlobal() {
return globalScope;
}
@@ -366,10 +355,12 @@ public Object importObject(VirtualFrame frame, RubyString name) {
protected FrameSlot getSlot(RubyString rubyString) {
return globalScope.getFrameSlot(rubyString.toString());
}
protected TruffleGlobalScope getGlobal() {
return globalScope;
}
}
*/
}
Original file line number Diff line number Diff line change
@@ -10,6 +10,7 @@
package org.jruby.truffle.nodes.rubinius;

import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
import com.oracle.truffle.api.dsl.Specialization;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.source.SourceSection;
@@ -46,7 +47,7 @@ public RubyTime timeSNow(VirtualFrame frame, RubyClass timeClass) {
return new RubyTime(timeClass, now(readTimeZoneNode.executeRubyString(frame)), nil());
}

@CompilerDirectives.TruffleBoundary
@TruffleBoundary
private DateTime now(RubyString timeZone) {
return DateTime.now(org.jruby.RubyTime.getTimeZoneFromTZString(getContext().getRuntime(), timeZone.toString()));
}
@@ -68,7 +69,7 @@ public RubyTime timeSDup(RubyTime other) {

}

@RubiniusPrimitive(name = "time_s_specific", needsSelf = false)
@RubiniusPrimitive(name = "time_s_specific", needsSelf = false, lowerFixnumParameters = { 0, 1 })
public static abstract class TimeSSpecificPrimitiveNode extends RubiniusPrimitiveNode {

@Child private ReadTimeZoneNode readTimeZoneNode;
@@ -78,48 +79,27 @@ public TimeSSpecificPrimitiveNode(RubyContext context, SourceSection sourceSecti
readTimeZoneNode = new ReadTimeZoneNode(context, sourceSection);
}

@Specialization(guards = {"isTrue(isUTC)", "isNil(offset)"})
public RubyTime timeSSpecificUTC(long seconds, long nanoseconds, boolean isUTC, Object offset) {
return timeSSpecificUTC((int) seconds, (int) nanoseconds, isUTC, offset);
}

@Specialization(guards = {"isTrue(isUTC)", "isNil(offset)"})
public RubyTime timeSSpecificUTC(long seconds, int nanoseconds, boolean isUTC, Object offset) {
return timeSSpecificUTC((int) seconds, nanoseconds, isUTC, offset);
}

@Specialization(guards = {"isTrue(isUTC)", "isNil(offset)"})
@Specialization(guards = { "isTrue(isUTC)", "isNil(offset)" })
public RubyTime timeSSpecificUTC(int seconds, int nanoseconds, boolean isUTC, Object offset) {
// TODO(CS): overflow checks needed?
final long milliseconds = seconds * 1_000L + (nanoseconds / 1_000_000);
return new RubyTime(getContext().getCoreLibrary().getTimeClass(), time(milliseconds), nil());
}


@Specialization(guards = {"!isTrue(isUTC)", "isNil(offset)"})
public RubyTime timeSSpecific(VirtualFrame frame, long seconds, long nanoseconds, boolean isUTC, Object offset) {
return timeSSpecific(frame, (int) seconds, (int) nanoseconds, isUTC, offset);
}

@Specialization(guards = {"!isTrue(isUTC)", "isNil(offset)"})
public RubyTime timeSSpecific(VirtualFrame frame, long seconds, int nanoseconds, boolean isUTC, Object offset) {
return timeSSpecific(frame, (int) seconds, nanoseconds, isUTC, offset);
}

@Specialization(guards = {"!isTrue(isUTC)", "isNil(offset)"})
@Specialization(guards = { "!isTrue(isUTC)", "isNil(offset)" })
public RubyTime timeSSpecific(VirtualFrame frame, int seconds, int nanoseconds, boolean isUTC, Object offset) {
// TODO(CS): overflow checks needed?
final long milliseconds = (long) seconds * 1_000 + ((long) nanoseconds / 1_000_000);
return new RubyTime(getContext().getCoreLibrary().getTimeClass(), time(milliseconds, readTimeZoneNode.executeRubyString(frame)), offset);
return new RubyTime(getContext().getCoreLibrary().getTimeClass(), localtime(milliseconds, readTimeZoneNode.executeRubyString(frame)), offset);
}

@CompilerDirectives.TruffleBoundary
public DateTime time(long milliseconds) {
@TruffleBoundary
private DateTime time(long milliseconds) {
return new DateTime(milliseconds, DateTimeZone.UTC);
}

@CompilerDirectives.TruffleBoundary
private DateTime time(long milliseconds, RubyString timeZone) {
@TruffleBoundary
private DateTime localtime(long milliseconds, RubyString timeZone) {
return new DateTime(milliseconds, org.jruby.RubyTime.getTimeZoneFromTZString(getContext().getRuntime(), timeZone.toString()));
}

@@ -160,7 +140,7 @@ public TimeDecomposePrimitiveNode(RubyContext context, SourceSection sourceSecti
super(context, sourceSection);
}

@CompilerDirectives.TruffleBoundary
@TruffleBoundary
@Specialization
public RubyArray timeDecompose(RubyTime time) {
final DateTime dateTime = time.getDateTime();
@@ -203,7 +183,7 @@ public TimeStrftimePrimitiveNode(RubyContext context, SourceSection sourceSectio
super(context, sourceSection);
}

@CompilerDirectives.TruffleBoundary
@TruffleBoundary
@Specialization
public RubyString timeStrftime(RubyTime time, RubyString format) {
final RubyDateFormatter rdf = getContext().getRuntime().getCurrentContext().getRubyDateFormatter();
46 changes: 46 additions & 0 deletions truffle/src/main/java/org/jruby/truffle/runtime/RubyLanguage.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. This
* code is released under a tri EPL/GPL/LGPL license. You can use it,
* redistribute it and/or modify it under the terms of the:
*
* Eclipse Public License version 1.0
* GNU General Public License version 2
* GNU Lesser General Public License version 2.1
*/
package org.jruby.truffle.runtime;

import com.oracle.truffle.api.TruffleLanguage;
import com.oracle.truffle.api.source.Source;

import java.io.IOException;

public class RubyLanguage extends TruffleLanguage {

private final RubyContext context;

public RubyLanguage(Env env, RubyContext context) {
super(env);
this.context = context;
}

@Override
protected Object eval(Source source) throws IOException {
throw new UnsupportedOperationException();
}

@Override
protected Object findExportedSymbol(String s) {
throw new UnsupportedOperationException();
}

@Override
protected Object getLanguageGlobal() {
return context.getCoreLibrary().getObjectClass();
}

@Override
protected boolean isObjectOfLanguage(Object o) {
throw new UnsupportedOperationException();
}

}