You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: truffle/docs/bytecode_dsl/UserGuide.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -323,10 +323,10 @@ The setting is controlled by the `enableBlockScoping` flag in [`@GenerateBytecod
323
323
The plain `LoadLocal` and `StoreLocal` operations access locals from the current frame.
324
324
In some cases, you may need to access locals from a different frame; for example, if root nodes are nested, an inner root may need to access locals of the outer root.
325
325
326
-
The `LoadLocalMaterialized` and `StoreLocalMaterialized` operations are intended for such cases.
327
-
They take an extra operand for the frame to read from/write to; this frame must be materialized.
326
+
Materialized local accesses are intended for such use cases (see the `enableMaterializedLocalAccesses` flag in [`@GenerateBytecode`](https://github.com/oracle/graal/blob/master/truffle/src/com.oracle.truffle.api.bytecode/src/com/oracle/truffle/api/bytecode/GenerateBytecode.java)).
327
+
When materialized local accesses are enabled, the interpreter defines `LoadLocalMaterialized` and `StoreLocalMaterialized` operations that behave analogously to `LoadLocal` and `StoreLocal`.
328
328
They can only access locals of the current root or an enclosing root.
329
-
You can also use [`MaterializedLocalAccessor`](https://github.com/oracle/graal/blob/master/truffle/src/com.oracle.truffle.api.bytecode/src/com/oracle/truffle/api/bytecode/MaterializedLocalAccessor.java) to access locals of a materialized frame from a custom operation.
329
+
When materialized accesses are enabled, you can also use [`MaterializedLocalAccessor`](https://github.com/oracle/graal/blob/master/truffle/src/com.oracle.truffle.api.bytecode/src/com/oracle/truffle/api/bytecode/MaterializedLocalAccessor.java) to access locals of a materialized frame from a custom operation.
330
330
331
331
Below is a simple example where the inner root reads the outer local from the outer root's frame.
332
332
```java
@@ -343,8 +343,8 @@ b.beginRoot(); // outer root
343
343
b.endRoot();
344
344
```
345
345
346
-
If an inner root accesses an outer local using materialized loads/stores, you should be careful to only call the inner root when the outer local is live; otherwise, a local load could produce unexpected values.
347
-
The bytecode builder statically checks that the local is in scope when emitting a materialized load/store, but the interpreter cannot easily check that the access occurs at that same point in execution.
346
+
When using materialized accesses with outer locals, you should be careful to only call the inner root when the outer local is live; otherwise, the access could produce unexpected values.
347
+
The bytecode builder statically checks that the local is in scope when emitting a materialized access, but the interpreter cannot easily check that the access occurs at that same point in execution.
348
348
The interpreter _will_ validate the access when it is configured to store the bytecode index in the frame (see the `storeBytecodeIndexInFrame` flag in [`@GenerateBytecode`](https://github.com/oracle/graal/blob/master/truffle/src/com.oracle.truffle.api.bytecode/src/com/oracle/truffle/api/bytecode/GenerateBytecode.java)), but for performance reasons this flag is `false` by default.
349
349
Consider enabling the flag temporarily if you encounter unexpected behaviour with materialized local values.
0 commit comments