Skip to content

Commit ab347b2

Browse files
committed
Materialized locals: update docs
1 parent debbe24 commit ab347b2

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

truffle/docs/bytecode_dsl/UserGuide.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -323,10 +323,10 @@ The setting is controlled by the `enableBlockScoping` flag in [`@GenerateBytecod
323323
The plain `LoadLocal` and `StoreLocal` operations access locals from the current frame.
324324
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.
325325

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`.
328328
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.
330330

331331
Below is a simple example where the inner root reads the outer local from the outer root's frame.
332332
```java
@@ -343,8 +343,8 @@ b.beginRoot(); // outer root
343343
b.endRoot();
344344
```
345345

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.
348348
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.
349349
Consider enabling the flag temporarily if you encounter unexpected behaviour with materialized local values.
350350

0 commit comments

Comments
 (0)