Skip to content

Commit 9a2df6e

Browse files
committed
cleanup: turn off tco feature
1 parent 312f6d5 commit 9a2df6e

File tree

29 files changed

+48
-37
lines changed

29 files changed

+48
-37
lines changed

crates/cli/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#![cfg_attr(feature = "tco", allow(incomplete_features))]
2+
#![cfg_attr(feature = "tco", feature(explicit_tail_calls))]
3+
14
pub mod commands;
25
pub mod default;
36
pub mod input;

crates/sdk/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ rrs-lib.workspace = true
6161
num-bigint.workspace = true
6262

6363
[features]
64-
default = ["parallel", "jemalloc", "tco"]
64+
default = ["parallel", "jemalloc"]
6565
evm-prove = [
6666
"openvm-continuations/static-verifier",
6767
"openvm-native-recursion/evm-prove",

crates/sdk/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![cfg_attr(feature = "tco", allow(incomplete_features))]
2+
#![cfg_attr(feature = "tco", feature(explicit_tail_calls))]
13
use std::{
24
borrow::Borrow,
35
fs::read,

crates/vm/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ openvm-native-compiler.workspace = true
5050
openvm-rv32im-transpiler.workspace = true
5151

5252
[features]
53-
default = ["parallel", "jemalloc", "tco"]
53+
default = ["parallel", "jemalloc"]
5454
parallel = [
5555
"openvm-stark-backend/parallel",
5656
"dashmap/rayon",

crates/vm/derive/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,6 @@ syn = { version = "2.0", features = ["parsing", "full"] }
1414
quote = "1.0"
1515
proc-macro2 = "1.0"
1616
itertools = { workspace = true }
17+
18+
[features]
19+
tco = []

crates/vm/derive/src/lib.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use syn::{
99
GenericParam, Ident, Meta, Token,
1010
};
1111

12+
#[cfg(feature = "tco")]
1213
mod tco;
1314

1415
#[proc_macro_derive(PreflightExecutor)]
@@ -772,7 +773,7 @@ fn parse_executor_type(
772773
///
773774
/// Place this attribute above a function definition:
774775
/// ```
775-
/// #[create_tco_handler = "handler_name"]
776+
/// #[create_tco_handler]
776777
/// unsafe fn execute_e1_impl<F: PrimeField32, CTX, const B_IS_IMM: bool>(
777778
/// pre_compute: &[u8],
778779
/// state: &mut VmExecState<F, GuestMemory, CTX>,
@@ -793,5 +794,12 @@ fn parse_executor_type(
793794
/// check.
794795
#[proc_macro_attribute]
795796
pub fn create_tco_handler(_attr: TokenStream, item: TokenStream) -> TokenStream {
796-
tco::tco_impl(item)
797+
#[cfg(feature = "tco")]
798+
{
799+
tco::tco_impl(item)
800+
}
801+
#[cfg(not(feature = "tco"))]
802+
{
803+
item
804+
}
797805
}

crates/vm/derive/src/tco.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ pub fn tco_impl(item: TokenStream) -> TokenStream {
6767
}
6868
let next_handler = next_handler.unwrap_unchecked();
6969

70+
// NOTE: `become` is a keyword that requires Rust Nightly.
71+
// It is part of the explicit tail calls RFC: <https://github.com/rust-lang/rust/issues/112788>
72+
// which is still incomplete.
7073
become next_handler(interpreter, exec_state)
7174
}
7275
};

crates/vm/src/arch/interpreter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ pub struct InterpretedInstance<'a, F, Ctx> {
5050
pre_compute_max_size: usize,
5151
/// Handler function pointers for tail call optimization.
5252
#[cfg(feature = "tco")]
53-
handlers: Vec<Handler<F, Ctx>>, // *const ()>,
53+
handlers: Vec<Handler<F, Ctx>>,
5454

5555
pc_base: u32,
5656
pc_start: u32,

extensions/algebra/circuit/Cargo.toml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@ edition.workspace = true
77
homepage.workspace = true
88
repository.workspace = true
99

10-
[features]
11-
default = ["jemalloc", "tco"]
12-
tco = ["openvm-rv32im-circuit/tco"]
13-
jemalloc = ["openvm-circuit/jemalloc"]
14-
1510
[dependencies]
1611
openvm-circuit-primitives = { workspace = true }
1712
openvm-circuit-primitives-derive = { workspace = true }
@@ -43,5 +38,9 @@ openvm-rv32-adapters = { workspace = true, features = ["test-utils"] }
4338
openvm-pairing-guest = { workspace = true, features = ["halo2curves"] }
4439
test-case = { workspace = true }
4540

41+
[features]
42+
default = []
43+
tco = ["openvm-rv32im-circuit/tco"]
44+
4645
[package.metadata.cargo-shear]
4746
ignored = ["derive_more"]

extensions/algebra/circuit/src/execution.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,7 @@ impl<F: PrimeField32, const BLOCKS: usize, const BLOCK_SIZE: usize, const IS_FP2
336336
)
337337
}
338338

339+
#[cfg(feature = "tco")]
339340
fn metered_handler<Ctx>(
340341
&self,
341342
chip_idx: usize,

0 commit comments

Comments
 (0)