-
-
Notifications
You must be signed in to change notification settings - Fork 925
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- 9.4.12.0
- 9.4.11.0
- 9.4.10.0
- 9.4.9.0
- 9.4.8.0
- 9.4.7.0
- 9.4.6.0
- 9.4.5.0
- 9.4.4.0
- 9.4.3.0
- 9.4.2.0
- 9.4.1.0
- 9.4.0.0
- 9.3.15.0
- 9.3.14.0
- 9.3.13.0
- 9.3.12.0
- 9.3.11.0
- 9.3.10.0
- 9.3.9.0
- 9.3.8.0
- 9.3.7.0
- 9.3.6.0
- 9.3.5.0
- 9.3.4.0
- 9.3.3.0
- 9.3.2.0
- 9.3.1.0
- 9.3.0.0
- 9.2.21.0
- 9.2.20.1
- 9.2.20.0
- 9.2.19.0
- 9.2.18.0
- 9.2.17.0
- 9.2.16.0
- 9.2.15.0
- 9.2.14.0
- 9.2.13.0
- 9.2.12.0
- 9.2.11.1
- 9.2.11.0
- 9.2.10.0
- 9.2.9.0
- 9.2.8.0
- 9.2.7.0
- 9.2.6.0
- 9.2.5.0
- 9.2.4.1
- 9.2.4.0
- 9.2.3.0
- 9.2.2.0
- 9.2.1.0
- 9.2.0.0
- 9.1.17.0
- 9.1.16.0
- 9.1.15.0
- 9.1.14.0
- 9.1.13.0
- 9.1.12.0
- 9.1.11.0
- 9.1.10.0
- 9.1.9.0
- 9.1.8.0
- 9.1.7.0
- 9.1.6.0
- 9.1.5.0
- 9.1.4.0
- 9.1.3.0
- 9.1.2.0
- 9.1.1.0
- 9.1.0.0
- 9.0.5.0
Showing
42 changed files
with
2,901 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
fails:String#unpack with format 'M' calls #to_str to coerce the directives string | ||
fails:String#unpack with format 'm' calls #to_str to coerce the directives string | ||
fails:String#unpack with format 'M' ignores the count or '*' modifier and decodes the entire string | ||
fails:String#unpack with format 'm' ignores the count or '*' modifier and decodes the entire string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
fails:String#unpack with format 'Z' calls #to_str to coerce the directives string | ||
fails:String#unpack with format 'Z' stops decoding at NULL bytes when passed the '*' modifier | ||
fails:String#unpack with format 'Z' decodes the number of bytes specified by the count modifier and truncates the decoded string at the first NULL byte |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
93 changes: 93 additions & 0 deletions
93
truffle/src/main/java/org/jruby/truffle/format/nodes/UnpackRootNode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
/* | ||
* 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.format.nodes; | ||
|
||
import com.oracle.truffle.api.CompilerDirectives; | ||
import com.oracle.truffle.api.CompilerDirectives.CompilationFinal; | ||
import com.oracle.truffle.api.frame.FrameSlotTypeException; | ||
import com.oracle.truffle.api.frame.VirtualFrame; | ||
import com.oracle.truffle.api.nodes.RootNode; | ||
import com.oracle.truffle.api.source.SourceSection; | ||
import org.jruby.truffle.format.runtime.PackEncoding; | ||
import org.jruby.truffle.format.runtime.PackFrameDescriptor; | ||
import org.jruby.truffle.format.runtime.PackResult; | ||
import org.jruby.truffle.runtime.RubyLanguage; | ||
import org.jruby.truffle.runtime.array.ArrayUtils; | ||
|
||
public class UnpackRootNode extends RootNode { | ||
|
||
private final String description; | ||
private final PackEncoding encoding; | ||
|
||
@Child private PackNode child; | ||
|
||
@CompilationFinal private int expectedLength = ArrayUtils.capacity(0, 0); | ||
|
||
public UnpackRootNode(String description, PackEncoding encoding, PackNode child) { | ||
super(RubyLanguage.class, SourceSection.createUnavailable("unpack", description), PackFrameDescriptor.FRAME_DESCRIPTOR); | ||
this.description = description; | ||
this.encoding = encoding; | ||
this.child = child; | ||
} | ||
|
||
@Override | ||
public Object execute(VirtualFrame frame) { | ||
frame.setObject(PackFrameDescriptor.SOURCE_SLOT, frame.getArguments()[0]); | ||
frame.setInt(PackFrameDescriptor.SOURCE_LENGTH_SLOT, (int) frame.getArguments()[1]); | ||
frame.setInt(PackFrameDescriptor.SOURCE_POSITION_SLOT, 0); | ||
frame.setObject(PackFrameDescriptor.OUTPUT_SLOT, new Object[expectedLength]); | ||
frame.setInt(PackFrameDescriptor.OUTPUT_POSITION_SLOT, 0); | ||
frame.setBoolean(PackFrameDescriptor.TAINT_SLOT, false); | ||
|
||
child.execute(frame); | ||
|
||
final int outputLength; | ||
|
||
try { | ||
outputLength = frame.getInt(PackFrameDescriptor.OUTPUT_POSITION_SLOT); | ||
} catch (FrameSlotTypeException e) { | ||
throw new IllegalStateException(e); | ||
} | ||
|
||
if (outputLength > expectedLength) { | ||
CompilerDirectives.transferToInterpreterAndInvalidate(); | ||
expectedLength = ArrayUtils.capacity(expectedLength, outputLength); | ||
} | ||
|
||
final Object[] output; | ||
|
||
try { | ||
output = (Object[]) frame.getObject(PackFrameDescriptor.OUTPUT_SLOT); | ||
} catch (FrameSlotTypeException e) { | ||
throw new IllegalStateException(e); | ||
} | ||
|
||
final boolean taint; | ||
|
||
try { | ||
taint = frame.getBoolean(PackFrameDescriptor.TAINT_SLOT); | ||
} catch (FrameSlotTypeException e) { | ||
throw new IllegalStateException(e); | ||
} | ||
|
||
return new PackResult(output, outputLength, taint, encoding); | ||
} | ||
|
||
@Override | ||
public boolean isCloningAllowed() { | ||
return true; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return description; | ||
} | ||
|
||
} |
37 changes: 37 additions & 0 deletions
37
truffle/src/main/java/org/jruby/truffle/format/nodes/control/AtUnpackNode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright (c) 2016 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.format.nodes.control; | ||
|
||
import com.oracle.truffle.api.frame.VirtualFrame; | ||
import org.jruby.truffle.format.nodes.PackNode; | ||
import org.jruby.truffle.format.runtime.exceptions.OutsideOfStringException; | ||
import org.jruby.truffle.runtime.RubyContext; | ||
|
||
public class AtUnpackNode extends PackNode { | ||
|
||
private final int position; | ||
|
||
public AtUnpackNode(RubyContext context, int position) { | ||
super(context); | ||
this.position = position; | ||
} | ||
|
||
@Override | ||
public Object execute(VirtualFrame frame) { | ||
if (position > getSourceLength(frame)) { | ||
throw new OutsideOfStringException(); | ||
} | ||
|
||
setSourcePosition(frame, position); | ||
|
||
return null; | ||
} | ||
|
||
} |
Oops, something went wrong.