diff --git a/cranelift/frontend/src/frontend.rs b/cranelift/frontend/src/frontend.rs index 29dd5ca1df..2ea5242d2a 100644 --- a/cranelift/frontend/src/frontend.rs +++ b/cranelift/frontend/src/frontend.rs @@ -41,8 +41,17 @@ pub struct FunctionBuilder<'a> { #[derive(Clone, Default)] struct EbbData { - filled: bool, + /// An Ebb is "pristine" iff no instructions have been added since the last + /// call to `switch_to_block()`. pristine: bool, + + /// An Ebb is "filled" iff a terminator instruction has been inserted since + /// the last call to `switch_to_block()`. + /// + /// A filled block cannot be pristine. + filled: bool, + + /// Count of parameters not supplied implicitly by the SSABuilder. user_param_count: usize, } diff --git a/cranelift/wasm/src/func_translator.rs b/cranelift/wasm/src/func_translator.rs index 6842e4f92f..665f7f8cb4 100644 --- a/cranelift/wasm/src/func_translator.rs +++ b/cranelift/wasm/src/func_translator.rs @@ -89,7 +89,8 @@ impl FuncTranslator { let entry_block = builder.create_ebb(); builder.append_ebb_params_for_function_params(entry_block); builder.switch_to_block(entry_block); // This also creates values for the arguments. - builder.seal_block(entry_block); + builder.seal_block(entry_block); // Declare all predecessors known. + // Make sure the entry block is inserted in the layout before we make any callbacks to // `environ`. The callback functions may need to insert things in the entry block. builder.ensure_inserted_ebb();