Skip to content

Commit

Permalink
Document ClosureMask::MAX_ARGUMENTS
Browse files Browse the repository at this point in the history
  • Loading branch information
wrwg committed Jan 21, 2025
1 parent 7d2535e commit 8140006
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
5 changes: 1 addition & 4 deletions third_party/move/move-binary-format/src/file_format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,7 @@ use move_core_types::{
use proptest::{collection::vec, prelude::*, strategy::BoxedStrategy};
use ref_cast::RefCast;
use serde::{Deserialize, Serialize};
use std::{
fmt::{self, Formatter},
ops::BitOr,
};
use std::fmt;
use variant_count::VariantCount;

/// Generic index into one of the tables in the binary format.
Expand Down
6 changes: 1 addition & 5 deletions third_party/move/move-bytecode-verifier/src/type_safety.rs
Original file line number Diff line number Diff line change
Expand Up @@ -414,11 +414,7 @@ fn clos_pack(
verifier.push(
meter,
instantiate(
&SignatureToken::Function(
not_captured_param_tys.into_iter().cloned().collect(),
ret_sign.0.to_vec(),
abilities,
),
&SignatureToken::Function(not_captured_param_tys, ret_sign.0.to_vec(), abilities),
type_actuals,
),
)
Expand Down
5 changes: 5 additions & 0 deletions third_party/move/move-core/types/src/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ impl fmt::Display for ClosureMask {
}

impl ClosureMask {
/// The maximal number of arguments which can be handled by a closure mask.
/// A captured argument's position in the argument list must be lower than
/// this number. Notice that this property is implicit in the bytecode:
/// a PACK_CLOSURE instruction will never pop more arguments from the
/// stack than this number.
pub const MAX_ARGS: usize = 64;

pub fn new(mask: u64) -> Self {
Expand Down
5 changes: 3 additions & 2 deletions third_party/move/move-vm/runtime/src/storage/ty_tag_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,10 @@ mod tests {
use super::*;
use crate::config::VMConfig;
use claims::{assert_err, assert_none, assert_ok, assert_ok_eq, assert_some};
use move_binary_format::file_format::{AbilitySet, StructTypeParameter};
use move_binary_format::file_format::StructTypeParameter;
use move_core_types::{
account_address::AccountAddress, identifier::Identifier, language_storage::ModuleId,
ability::AbilitySet, account_address::AccountAddress, identifier::Identifier,
language_storage::ModuleId,
};
use move_vm_types::loaded_data::runtime_types::{
AbilityInfo, StructIdentifier, StructLayout, StructType, TypeBuilder,
Expand Down

0 comments on commit 8140006

Please sign in to comment.