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

Commits on Mar 22, 2016

  1. [Truffle] formatting

    pitr-ch committed Mar 22, 2016
    Copy the full SHA
    c7bee12 View commit details
  2. Copy the full SHA
    8d3d86f View commit details
  3. Copy the full SHA
    fc8e6b7 View commit details
  4. Copy the full SHA
    53f2596 View commit details
  5. Copy the full SHA
    3e902b7 View commit details
  6. 1
    Copy the full SHA
    e86b344 View commit details
  7. Copy the full SHA
    b469867 View commit details
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -47,7 +47,8 @@ env:
- JT='test specs :core'
- JT='test specs :library'
- JT='test specs :truffle'
- JT='test integration'
- JT='test integration fast'
- JT='test integration long' JAVA_OPTS="$JAVA_OPTS -Xmx512m"

matrix:
include:
@@ -84,7 +85,6 @@ matrix:
jdk: oraclejdk8
- env: PHASE='-Pj2ee'
jdk: oraclejdk7
- env: JT='test integration'
# NOTE: build seems to never start (waited for any to finish for more than a day) - probably a travis-ci bug
#- env: PHASE='-Pmain'
# sudo: required
25 changes: 25 additions & 0 deletions spec/ruby/core/thread/backtrace_spec.rb
Original file line number Diff line number Diff line change
@@ -2,4 +2,29 @@

describe "Thread#backtrace" do
it "needs to be reviewed for spec completeness"

it "returns current backtrace of a thread" do

t = Thread.new do
begin
sleep
rescue
end
end

Thread.pass while t.status != 'sleep'

backtrace = t.backtrace
backtrace.should be_kind_of(Array)
backtrace.first.should =~ /`sleep'/

t.raise 'finish the thread'
t.join
end

it "returns nil for dead thread" do
t = Thread.new {}
t.join
t.backtrace.should == nil
end
end
2 changes: 2 additions & 0 deletions test/truffle/integration/long-tests.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
rails.sh
gem-testing.sh
29 changes: 17 additions & 12 deletions tool/jt.rb
Original file line number Diff line number Diff line change
@@ -275,7 +275,7 @@ def help
puts 'jt test spec/ruby/language/while_spec.rb run specs in this file'
puts 'jt test compiler run compiler tests (uses the same logic as --graal to find Graal)'
puts ' --no-java-cmd don\'t set JAVACMD - rely on bin/jruby or RUBY_BIN to have Graal already'
puts 'jt test integration [fast] runs bigger integration tests'
puts 'jt test integration [fast|long|all] runs bigger integration tests (fast is default)'
puts ' --no-gems don\'t run tests that install gems'
puts 'jt tag spec/ruby/language tag failing specs in this directory'
puts 'jt tag spec/ruby/language/while_spec.rb tag failing specs in this file'
@@ -458,22 +458,27 @@ def test_compiler(*args)

def test_integration(*args)
no_gems = args.delete('--no-gems')
fast = args.delete('fast')

all = args.delete('all')
long = args.delete('long') || all
fast = args.delete('fast') || all ||
!long # fast is the default

env_vars = {}
env_vars["JRUBY_OPTS"] = '-Xtruffle.graal.warn_unless=false'
env_vars["PATH"] = "#{Utilities.find_jruby_bin_dir}:#{ENV["PATH"]}"
integration_path = "#{JRUBY_DIR}/test/truffle/integration"
long_tests = File.read(File.join(integration_path, 'long-tests.txt')).lines.map(&:chomp)
test_names = args.empty? ? '*' : '{' + args.join(',') + '}'

test_names = if args.empty?
'*'
else
'{' + args.join(',') + '}'
end

Dir["#{JRUBY_DIR}/test/truffle/integration/#{test_names}.sh"].each do |test_script|
Dir["#{integration_path}/#{test_names}.sh"].each do |test_script|
next if no_gems && File.read(test_script).include?('gem install')
next if fast && test_script.end_with?('integration/gem-testing.sh')
next if fast && test_script.end_with?('integration/rails.sh')
sh env_vars, test_script

is_long = long_tests.include?(File.basename(test_script))

if (is_long && long) || (!is_long && fast)
sh env_vars, test_script
end
end
end
private :test_integration
Original file line number Diff line number Diff line change
@@ -37,12 +37,13 @@ public abstract class ExceptionNodes {

@TruffleBoundary
public static DynamicObject backtraceAsRubyStringArray(RubyContext context, DynamicObject exception, Backtrace backtrace) {
final List<String> lines = new BacktraceFormatter(context, EnumSet.of(BacktraceFormatter.FormattingFlags.OMIT_FROM_PREFIX, BacktraceFormatter.FormattingFlags.OMIT_EXCEPTION))
.formatBacktrace(context, exception, backtrace);
final List<String> lines = new BacktraceFormatter(context,
EnumSet.of(BacktraceFormatter.FormattingFlags.OMIT_FROM_PREFIX,
BacktraceFormatter.FormattingFlags.OMIT_EXCEPTION)).formatBacktrace(context, exception, backtrace);

final Object[] array = new Object[lines.size()];

for (int n = 0;n < lines.size(); n++) {
for (int n = 0; n < lines.size(); n++) {
array[n] = StringOperations.createString(context, StringOperations.encodeRope(lines.get(n), UTF8Encoding.INSTANCE));
}

Original file line number Diff line number Diff line change
@@ -166,7 +166,8 @@ public AliveNode(RubyContext context, SourceSection sourceSection) {

@Specialization
public boolean alive(DynamicObject thread) {
return Layouts.THREAD.getStatus(thread) != Status.ABORTING && Layouts.THREAD.getStatus(thread) != Status.DEAD;
final Status status = Layouts.THREAD.getStatus(thread);
return status != Status.ABORTING && status != Status.DEAD;
}

}
@@ -192,7 +193,12 @@ public void run(DynamicObject thread, Node currentNode) {
}
});

return result[0];
// if the thread id dead or aborting the SafepointAction will not run
if (result[0] != null) {
return result[0];
} else {
return nil();
}
}

}
@@ -411,15 +417,16 @@ public StatusNode(RubyContext context, SourceSection sourceSection) {
@Specialization
public Object status(DynamicObject self) {
// TODO: slightly hackish
if (Layouts.THREAD.getStatus(self) == Status.DEAD) {
final Status status = Layouts.THREAD.getStatus(self);
if (status == Status.DEAD) {
if (Layouts.THREAD.getException(self) != null) {
return nil();
} else {
return false;
}
}

return createString(Layouts.THREAD.getStatus(self).bytes);
return createString(status.bytes);
}

}
@@ -433,7 +440,8 @@ public StopNode(RubyContext context, SourceSection sourceSection) {

@Specialization
public boolean stop(DynamicObject self) {
return Layouts.THREAD.getStatus(self) == Status.DEAD || Layouts.THREAD.getStatus(self) == Status.SLEEP;
final Status status = Layouts.THREAD.getStatus(self);
return status == Status.DEAD || status == Status.SLEEP;
}

}
Original file line number Diff line number Diff line change
@@ -137,7 +137,9 @@ public String formatLine(List<Activation> activations, int n, DynamicObject exce
String reportedName;

if (isCore(sourceSection) && !flags.contains(FormattingFlags.INCLUDE_CORE_FILES)) {
reportedSourceSection = nextUserSourceSection(activations, n);
final SourceSection nextUserSourceSection = nextUserSourceSection(activations, n);
// if there is no next source section use a core one to avoid ???
reportedSourceSection = nextUserSourceSection != null ? nextUserSourceSection : sourceSection;

try {
reportedName = activation.getMethod().getName();