Skip to content

Commit

Permalink
[Truffle] Allow Array indexing with an integer index to compile.
Browse files Browse the repository at this point in the history
Without this, the chunky-encode-png-image-pass-to-stream benchmark from bench9000 fails to run.
  • Loading branch information
nirvdrum committed Jan 12, 2015
1 parent bc23c47 commit 1ca816f
Showing 1 changed file with 1 addition and 2 deletions.
Expand Up @@ -658,10 +658,9 @@ public Object index(RubyArray array, int index, UndefinedPlaceholder undefined)

@Specialization(guards = "isIntegerFixnum")
public Object sliceIntegerFixnum(RubyArray array, int start, int length) {
notDesignedForCompilation();

final int normalisedIndex = array.normaliseIndex(start);

// TODO (nirvdrum 12-Jan-15) Add branch profiling.
if (normalisedIndex < 0 || normalisedIndex > array.getSize() || length < 0) {
return getContext().getCoreLibrary().getNilObject();
} else if (normalisedIndex == array.getSize()) {
Expand Down

0 comments on commit 1ca816f

Please sign in to comment.