Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GR-61282] [GR-63630] Support source sections when linear parsing without look-ahead. #10942

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions truffle/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ This changelog summarizes major changes between Truffle versions relevant to lan
* GR-57063 Bytecode-DSL: Added a `variadicStackLimit` parameter to `@GenerateBytecode` that allows to specify how many variable arguments are stored on the stack before they are collapsed into an object array.
* GR-50017 TruffleStringIterator.NextNode and TruffleStringIterator.PreviousNode now require the iterated string's encoding as a parameter for performance reasons.
* GR-63075 Java host interop again inherits public method methods from non-public base classes if public access is enabled. This was originally changed in 24.1.
* GR-61282 Bytecode DSL: Bytecode builders now also allow emitting source sections using the start and length source indices in the end method in addition to the begin method. This was added to support linear parsing without look-ahead.
* GR-61282 Bytecode DSL: (breaking) If multiple source sections were specified around root operations, only the innermost source section directly encapsulating the root will be accessible. Other encapsulating source sections will be discarded for outer most root operations.

## Version 24.2.0
* GR-60636 Truffle now stops compiling when the code cache fills up on HotSpot. A warning is printed when that happens.

## Version 24.2.0
* GR-57658 Added `TruffleLanguage.Env.getLanguageInfo(Class<? extends TruffleLanguage>)` to lookup a `LanguageInfo` instance for a language class returned by `InteropLibrary.getLanguage(Object)`.
* GR-57164 Added support for reading unaligned ints, shorts and long to `ByteArraySupport`.
* GR-57164 `RootNode.translateStackTraceElement()` is now always consulted for polyglot and debugger stack traces. Stack traces now use the source section, the executable name, the name of the declared meta-object to build `StackTraceElement` instances.
Expand All @@ -36,8 +36,6 @@ This changelog summarizes major changes between Truffle versions relevant to lan
* GR-55296 Added support to convert any string to a `byte[]` with a given `Value.StringEncoding` using `Value.asStringBytes(...)`.
* GR-40323 Deprecated `Shape.Builder.layout(Class)` for removal and added replacement API [`Shape.Builder.layout(Class, MethodHandles.Lookup)`](https://www.graalvm.org/truffle/javadoc/com/oracle/truffle/api/object/Shape.Builder.html#layout(java.lang.Class,java.lang.MethodHandles.Lookup)). Replace usages with the new method, additionally providing a `Lookup` that has full privilege access to the layout class or the module in which it is declared, as obtained by `MethodHandles.lookup()`. See javadoc for the updated usage.
* GR-55296 Added support for UTF-16 and UTF-32 in non-system-endianness without dependency on the JCodings library in TruffleString.


* GR-58550 Added `FrameDescriptor.Builder.illegalDefaultValue()` which initializes all frame slots as `FrameSlotKind.Illegal` for newly created frames. This is different from the default behavior, which initializes all frame slot kinds as `FrameSlotKind.Object`. This means that frame slots, when they are read before they were written, throw a `FrameSlotTypeException`, consistent with the behavior after clearing a frame slot.
* GR-58550 Deprecated the default constructor for `FrameSlotTypeException` and replaced it with `FrameSlotTypeException.create(...)`. Exceptions of this kind thrown by the `Frame` now contain the slot index and the expected and the actual frame slot kind which are accessible with the respective instance methods.
* GR-58550 Fixed invalid `PolyglotException.getMessage()` javadoc. A polyglot exception may in fact return a `null` message.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@
import org.junit.function.ThrowingRunnable;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameter;
import org.junit.runners.Parameterized.Parameters;

import com.oracle.truffle.api.CompilerDirectives;
Expand Down Expand Up @@ -263,7 +262,11 @@ public static List<TestRun> getParameters() {
return result;
}

@Parameter(0) public TestRun run;
public final TestRun run;

public AbstractBasicInterpreterTest(TestRun run) {
this.run = run;
}

public <T extends BasicInterpreterBuilder> RootCallTarget parse(String rootName, BytecodeParser<T> builder) {
BytecodeRootNode rootNode = parseNode(run.interpreterClass, LANGUAGE, run.testSerialize, rootName, builder);
Expand Down Expand Up @@ -305,7 +308,11 @@ public static <T extends BasicInterpreterBuilder> BytecodeRootNodes<BasicInterpr
}

for (BasicInterpreter interpreter : result.getNodes()) {
testIntrospectionInvariants(interpreter.getBytecodeNode());
try {
testIntrospectionInvariants(interpreter.getBytecodeNode());
} catch (Throwable e) {
throw new AssertionError("Invariant failure " + interpreter.dump(), e);
}
}

return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@
*/
@RunWith(Parameterized.class)
public class BasicInterpreterTest extends AbstractBasicInterpreterTest {

public BasicInterpreterTest(TestRun run) {
super(run);
}

private record ExpectedArgument(String name, Argument.Kind kind, Object value) {
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@

public class BindingsTest extends AbstractBasicInterpreterTest {

public BindingsTest(TestRun run) {
super(run);
}

@Test
public void testExplicit() {
BasicInterpreter node = parseNode("explicitBindings", b -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@
public class BranchTest extends AbstractBasicInterpreterTest {
// @formatter:off

public BranchTest(TestRun run) {
super(run);
}


@Test
public void testBranchForward() {
// goto lbl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@

@RunWith(Parameterized.class)
public class BytecodeLocationTest extends AbstractBasicInterpreterTest {

public BytecodeLocationTest(TestRun run) {
super(run);
}

@Test
public void testGetBytecodeLocation() {
Source source = Source.newBuilder("test", "getBytecodeLocation", "baz").build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@
@RunWith(Parameterized.class)
public class CopyLocalsTest extends AbstractBasicInterpreterTest {

public CopyLocalsTest(TestRun run) {
super(run);
}

@Test
public void testCopyAllLocals() {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@

@RunWith(Parameterized.class)
public class ExceptionHandlerTableTest extends AbstractBasicInterpreterTest {

public ExceptionHandlerTableTest(TestRun run) {
super(run);
}

private record ExceptionRangeTree(int index, String name, HandlerKind kind, ExceptionRangeTree[] nested) {
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@

public class LocalsTest extends AbstractBasicInterpreterTest {

public LocalsTest(TestRun run) {
super(run);
}

@Test
public void testBasicLocals() {
for (int i = 0; i < 100; i++) {
Expand Down
Loading
Loading