Repository navigation
feat: first-class RT-safe callable contracts for function pointers - #1310
Conversation
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Adds the ability to declare an `rt_safe` contract on function pointer types using the effect row syntax (e.g., `(i32) -> i32 with rt_safe`). The semantic checker enforces that calls through such pointers do not emit an `__unresolved_dynamic_call` failure on an RT-safe path, and binding a function to an `rt_safe` function pointer type verifies its call graph. Part of #766 Co-authored-by: godofecht <[email protected]>
Co-authored-by: Abhishek Shivakumar <[email protected]>
a7e8604 to
9a2e7a3
Compare
Resolve bootstrap binary conflict by taking current main; the generated C will be regenerated after the remaining compiler/src rt_safe fixes. Co-authored-by: Abhishek Shivakumar <[email protected]>
`effect` is a reserved word and cannot be used as a parameter name. Rename it to `eff_name` so flowc can compile compiler/src. Co-authored-by: Abhishek Shivakumar <[email protected]>
Fixed-point emit after merging current main and renaming the reserved `effect` parameter so compiler/src compiles under flowc. Co-authored-by: Abhishek Shivakumar <[email protected]>
Treat a function-typed variable without an `rt_safe` contract as an unresolved dynamic call. Move compile-fail cases to typecheck_rules because tests/lang cannot express expected type errors. Co-authored-by: Abhishek Shivakumar <[email protected]>
Co-authored-by: Abhishek Shivakumar <[email protected]>
tests/lang/test_typecheck_overload_integration.flow imports compiler/src/typecheck.flow, so its recorded MLIR digest changes with the rt_safe contract checks. Co-authored-by: Abhishek Shivakumar <[email protected]>
…-calls-2191090288977208181 Co-authored-by: Abhishek Shivakumar <[email protected]>
Include first-class RT-safe callable contracts from #1310 (5d97890) while keeping AST_GPU_FRAME parser/typecheck. Take main's bootstrap C so it can be regenerated from the merged compiler/src. Co-authored-by: Abhishek Shivakumar <[email protected]>
Self-emit from the merged compiler/src until the C reaches a fixed point at gen2 so bootstrap_from_c.sh --verify matches AST_GPU_FRAME and the #1310 rt_safe callable-contract work. Co-authored-by: Abhishek Shivakumar <[email protected]>
tests/lang/test_typecheck_overload_integration.flow imports compiler/src/typecheck.flow, so its normalized MLIR digest changes when AST_GPU_FRAME and the #1310 rt_safe row checks sit together. Update that one corpus entry only. Co-authored-by: Abhishek Shivakumar <[email protected]>
* feat(gpu): Add parsing support for `gpu frame` AST block
This PR adds the `AST_GPU_FRAME` node to the Flow compiler's AST and implements parsing for `gpu frame { ... }` blocks in the `flowc` parser. The blocks are correctly passed through to the type checker to resolve statements within the frame block. This forms the foundation for representing render and compute passes natively in Flow, allowing multi-pass GPU programs to execute without host-side choreography.
Part of #812
Co-authored-by: godofecht <[email protected]>
* fix: regenerate bootstrap C after gpu frame AST rebase
Co-authored-by: Abhishek Shivakumar <[email protected]>
* fix: regenerate bootstrap C after gpu frame AST merge
Self-emit from the merged compiler/src until the C reaches a fixed
point at gen2 so bootstrap_from_c.sh --verify matches AST_GPU_FRAME.
Co-authored-by: Abhishek Shivakumar <[email protected]>
* fix: update MLIR corpus goldens for AST_GPU_FRAME
Programs that import compiler/src now include the gpu-frame AST node
and parser, so their normalized MLIR digests change. Update those 28
corpus entries only.
Co-authored-by: Abhishek Shivakumar <[email protected]>
* fix: regenerate bootstrap C after gpu frame + rt_safe merge
Self-emit from the merged compiler/src until the C reaches a fixed
point at gen2 so bootstrap_from_c.sh --verify matches AST_GPU_FRAME
and the #1310 rt_safe callable-contract work.
Co-authored-by: Abhishek Shivakumar <[email protected]>
* fix: update MLIR corpus digest after gpu frame + rt_safe merge
tests/lang/test_typecheck_overload_integration.flow imports
compiler/src/typecheck.flow, so its normalized MLIR digest changes
when AST_GPU_FRAME and the #1310 rt_safe row checks sit together.
Update that one corpus entry only.
Co-authored-by: Abhishek Shivakumar <[email protected]>
---------
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Co-authored-by: godofecht <[email protected]>
Co-authored-by: Cursor Agent <[email protected]>
Extend the #1310 `with rt_safe` function-pointer contract so a callback-safe higher-order function can accept a proven-safe named function or closure and reject an allocating one. Closures get a compile-time summary: the body is walked into the existing pointer/span captures are rejected, and diagnostics name the closure and the unsafe op. The contract is erased before codegen. Stop `with E1, E2` on a nested function type from swallowing the next parameter (`f: (T) -> R with rt_safe, x: i32`). Trait-method contracts remain a documented gap. Part of #766. Co-authored-by: Abhishek Shivakumar <[email protected]>
Extend the #1310 `with rt_safe` function-pointer contract so a callback-safe higher-order function can accept a proven-safe named function or closure and reject an allocating one. Closures get a compile-time summary: the body is walked into the existing pointer/span captures are rejected, and diagnostics name the closure and the unsafe op. The contract is erased before codegen. Stop `with E1, E2` on a nested function type from swallowing the next parameter (`f: (T) -> R with rt_safe, x: i32`). Trait-method contracts remain a documented gap. Part of #766. Co-authored-by: Abhishek Shivakumar <[email protected]>
Extend the #1310 `with rt_safe` function-pointer contract so a callback-safe higher-order function can accept a proven-safe named function or closure and reject an allocating one. Closures get a compile-time summary: the body is walked into the existing pointer/span captures are rejected, and diagnostics name the closure and the unsafe op. The contract is erased before codegen. Stop `with E1, E2` on a nested function type from swallowing the next parameter (`f: (T) -> R with rt_safe, x: i32`). Trait-method contracts remain a documented gap. Part of #766. Co-authored-by: Abhishek Shivakumar <[email protected]>
Extend the #1310 `with rt_safe` function-pointer contract so a callback-safe higher-order function can accept a proven-safe named function or closure and reject an allocating one. Closures get a compile-time summary: the body is walked into the existing pointer/span captures are rejected, and diagnostics name the closure and the unsafe op. The contract is erased before codegen. Stop `with E1, E2` on a nested function type from swallowing the next parameter (`f: (T) -> R with rt_safe, x: i32`). Trait-method contracts remain a documented gap. Part of #766. Co-authored-by: Abhishek Shivakumar <[email protected]>
Extend the #1310 `with rt_safe` function-pointer contract so a callback-safe higher-order function can accept a proven-safe named function or closure and reject an allocating one. Closures get a compile-time summary: the body is walked into the existing pointer/span captures are rejected, and diagnostics name the closure and the unsafe op. The contract is erased before codegen. Stop `with E1, E2` on a nested function type from swallowing the next parameter (`f: (T) -> R with rt_safe, x: i32`). Trait-method contracts remain a documented gap. Part of #766. Co-authored-by: Abhishek Shivakumar <[email protected]>
Extend the #1310 `with rt_safe` function-pointer contract so a callback-safe higher-order function can accept a proven-safe named function or closure and reject an allocating one. Closures get a compile-time summary: the body is walked into the existing pointer/span captures are rejected, and diagnostics name the closure and the unsafe op. The contract is erased before codegen. Stop `with E1, E2` on a nested function type from swallowing the next parameter (`f: (T) -> R with rt_safe, x: i32`). Trait-method contracts remain a documented gap. Part of #766. Co-authored-by: Abhishek Shivakumar <[email protected]>
Extend the #1310 `with rt_safe` function-pointer contract so a callback-safe higher-order function can accept a proven-safe named function or closure and reject an allocating one. Closures get a compile-time summary: the body is walked into the existing pointer/span captures are rejected, and diagnostics name the closure and the unsafe op. The contract is erased before codegen. Stop `with E1, E2` on a nested function type from swallowing the next parameter (`f: (T) -> R with rt_safe, x: i32`). Trait-method contracts remain a documented gap. Part of #766. Co-authored-by: Abhishek Shivakumar <[email protected]>
Extend the #1310 `with rt_safe` function-pointer contract so a callback-safe higher-order function can accept a proven-safe named function or closure and reject an allocating one. Closures get a compile-time summary: the body is walked into the existing pointer/span captures are rejected, and diagnostics name the closure and the unsafe op. The contract is erased before codegen. Stop `with E1, E2` on a nested function type from swallowing the next parameter (`f: (T) -> R with rt_safe, x: i32`). Trait-method contracts remain a documented gap. Part of #766. Co-authored-by: Abhishek Shivakumar <[email protected]>
Extend the #1310 `with rt_safe` function-pointer contract so a callback-safe higher-order function can accept a proven-safe named function or closure and reject an allocating one. Closures get a compile-time summary: the body is walked into the existing pointer/span captures are rejected, and diagnostics name the closure and the unsafe op. The contract is erased before codegen. Stop `with E1, E2` on a nested function type from swallowing the next parameter (`f: (T) -> R with rt_safe, x: i32`). Trait-method contracts remain a documented gap. Part of #766. Co-authored-by: Abhishek Shivakumar <[email protected]>
Implements the requested capability to add a compile-time callable contract that lets the checker prove that an indirect callable is callback-safe. This implements the contract for function pointers via the effect row, leaving closures and trait methods out of scope for this PR.
sem_check.flowandtypecheck.flowto understandrt_safeon function pointer types.rt_safe.tests/lang.PR created automatically by Jules for task 2191090288977208181 started by @godofecht