Skip to content

Commit

Permalink
refactor: replace lol_alloc with dlmalloc (#4857)
Browse files Browse the repository at this point in the history
Signed-off-by: Shanin Roman <[email protected]>
  • Loading branch information
Erigara authored Jul 17, 2024
1 parent 04d2be0 commit aaeab13
Show file tree
Hide file tree
Showing 32 changed files with 46 additions and 46 deletions.
2 changes: 1 addition & 1 deletion client/tests/integration/smartcontracts/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,5 @@ serde_json = { version = "1.0.91", default-features = false }
getrandom = { version = "0.2", features = ["custom"] }
nonzero_ext = { version = "0.3.0", default-features = false }

lol_alloc = "0.4.0"
dlmalloc = { version = "0.2.6", features = ["global"] }
panic-halt = "0.2.0"
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ crate-type = ['cdylib']
iroha_trigger.workspace = true

panic-halt.workspace = true
lol_alloc.workspace = true
dlmalloc.workspace = true
getrandom.workspace = true
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ extern crate panic_halt;

use alloc::{format, string::ToString};

use dlmalloc::GlobalDlmalloc;
use iroha_trigger::prelude::*;
use lol_alloc::{FreeListAllocator, LockedAllocator};

#[global_allocator]
static ALLOC: LockedAllocator<FreeListAllocator> = LockedAllocator::new(FreeListAllocator::new());
static ALLOC: GlobalDlmalloc = GlobalDlmalloc;

getrandom::register_custom_getrandom!(iroha_trigger::stub_getrandom);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ serde_json.workspace = true
serde.workspace = true

panic-halt.workspace = true
lol_alloc.workspace = true
dlmalloc.workspace = true
getrandom.workspace = true
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ extern crate alloc;
#[cfg(not(test))]
extern crate panic_halt;

use dlmalloc::GlobalDlmalloc;
use executor_custom_data_model::complex_isi::{
ConditionalExpr, CoreExpr, CustomInstructionExpr, Evaluate, Value,
};
use iroha_executor::{
data_model::{isi::CustomInstruction, query::QueryOutputBox},
prelude::*,
};
use lol_alloc::{FreeListAllocator, LockedAllocator};

#[global_allocator]
static ALLOC: LockedAllocator<FreeListAllocator> = LockedAllocator::new(FreeListAllocator::new());
static ALLOC: GlobalDlmalloc = GlobalDlmalloc;

getrandom::register_custom_getrandom!(iroha_executor::stub_getrandom);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ serde_json.workspace = true
serde.workspace = true

panic-halt.workspace = true
lol_alloc.workspace = true
dlmalloc.workspace = true
getrandom.workspace = true
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ extern crate alloc;
#[cfg(not(test))]
extern crate panic_halt;

use dlmalloc::GlobalDlmalloc;
use executor_custom_data_model::simple_isi::{CustomInstructionBox, MintAssetForAllAccounts};
use iroha_executor::{data_model::isi::CustomInstruction, debug::DebugExpectExt, prelude::*};
use lol_alloc::{FreeListAllocator, LockedAllocator};

#[global_allocator]
static ALLOC: LockedAllocator<FreeListAllocator> = LockedAllocator::new(FreeListAllocator::new());
static ALLOC: GlobalDlmalloc = GlobalDlmalloc;

getrandom::register_custom_getrandom!(iroha_executor::stub_getrandom);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ serde_json.workspace = true
serde.workspace = true

panic-halt.workspace = true
lol_alloc.workspace = true
dlmalloc.workspace = true
getrandom.workspace = true
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
#[cfg(not(test))]
extern crate panic_halt;

use dlmalloc::GlobalDlmalloc;
use iroha_executor::{prelude::*, DataModelBuilder};
use iroha_executor_data_model::permission::domain::CanUnregisterDomain;
use lol_alloc::{FreeListAllocator, LockedAllocator};

#[global_allocator]
static ALLOC: LockedAllocator<FreeListAllocator> = LockedAllocator::new(FreeListAllocator::new());
static ALLOC: GlobalDlmalloc = GlobalDlmalloc;

getrandom::register_custom_getrandom!(iroha_executor::stub_getrandom);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ iroha_executor.workspace = true
iroha_schema.workspace = true

panic-halt.workspace = true
lol_alloc.workspace = true
dlmalloc.workspace = true
getrandom.workspace = true
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
#[cfg(not(test))]
extern crate panic_halt;

use dlmalloc::GlobalDlmalloc;
use iroha_executor::prelude::*;
use lol_alloc::{FreeListAllocator, LockedAllocator};

#[global_allocator]
static ALLOC: LockedAllocator<FreeListAllocator> = LockedAllocator::new(FreeListAllocator::new());
static ALLOC: GlobalDlmalloc = GlobalDlmalloc;

getrandom::register_custom_getrandom!(iroha_executor::stub_getrandom);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ serde_json.workspace = true
serde.workspace = true

panic-halt.workspace = true
lol_alloc.workspace = true
dlmalloc.workspace = true
getrandom.workspace = true
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ extern crate panic_halt;

use alloc::format;

use dlmalloc::GlobalDlmalloc;
use executor_custom_data_model::parameters::DomainLimits;
use iroha_executor::{prelude::*, DataModelBuilder};
use iroha_executor_data_model::parameter::Parameter;
use lol_alloc::{FreeListAllocator, LockedAllocator};

#[global_allocator]
static ALLOC: LockedAllocator<FreeListAllocator> = LockedAllocator::new(FreeListAllocator::new());
static ALLOC: GlobalDlmalloc = GlobalDlmalloc;

getrandom::register_custom_getrandom!(iroha_executor::stub_getrandom);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ serde_json.workspace = true
serde.workspace = true

panic-halt.workspace = true
lol_alloc.workspace = true
dlmalloc.workspace = true
getrandom.workspace = true
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ extern crate alloc;
#[cfg(not(test))]
extern crate panic_halt;

use dlmalloc::GlobalDlmalloc;
use executor_custom_data_model::permissions::CanControlDomainLives;
use iroha_executor::{
data_model::prelude::*, permission::ExecutorPermision as _, prelude::*, DataModelBuilder,
};
use iroha_executor_data_model::permission::domain::CanUnregisterDomain;
use lol_alloc::{FreeListAllocator, LockedAllocator};

#[global_allocator]
static ALLOC: LockedAllocator<FreeListAllocator> = LockedAllocator::new(FreeListAllocator::new());
static ALLOC: GlobalDlmalloc = GlobalDlmalloc;

getrandom::register_custom_getrandom!(iroha_executor::stub_getrandom);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ iroha_executor.workspace = true
anyhow.workspace = true

panic-halt.workspace = true
lol_alloc.workspace = true
dlmalloc.workspace = true
getrandom.workspace = true
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ extern crate alloc;
#[cfg(not(test))]
extern crate panic_halt;

use dlmalloc::GlobalDlmalloc;
use iroha_executor::{debug::dbg_panic, prelude::*};
use lol_alloc::{FreeListAllocator, LockedAllocator};

#[global_allocator]
static ALLOC: LockedAllocator<FreeListAllocator> = LockedAllocator::new(FreeListAllocator::new());
static ALLOC: GlobalDlmalloc = GlobalDlmalloc;

getrandom::register_custom_getrandom!(iroha_executor::stub_getrandom);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ crate-type = ['cdylib']
iroha_trigger.workspace = true

panic-halt.workspace = true
lol_alloc.workspace = true
dlmalloc.workspace = true
getrandom.workspace = true
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ extern crate panic_halt;

use core::str::FromStr as _;

use dlmalloc::GlobalDlmalloc;
use iroha_trigger::prelude::*;
use lol_alloc::{FreeListAllocator, LockedAllocator};

#[global_allocator]
static ALLOC: LockedAllocator<FreeListAllocator> = LockedAllocator::new(FreeListAllocator::new());
static ALLOC: GlobalDlmalloc = GlobalDlmalloc;

getrandom::register_custom_getrandom!(iroha_trigger::stub_getrandom);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ iroha_trigger.workspace = true
executor_custom_data_model.workspace = true

panic-halt.workspace = true
lol_alloc.workspace = true
dlmalloc.workspace = true
getrandom.workspace = true

serde = { workspace = true, features = ["derive"] }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ extern crate panic_halt;

use core::str::FromStr as _;

use dlmalloc::GlobalDlmalloc;
use executor_custom_data_model::mint_rose_args::MintRoseArgs;
use iroha_trigger::{debug::dbg_panic, prelude::*};
use lol_alloc::{FreeListAllocator, LockedAllocator};

#[global_allocator]
static ALLOC: LockedAllocator<FreeListAllocator> = LockedAllocator::new(FreeListAllocator::new());
static ALLOC: GlobalDlmalloc = GlobalDlmalloc;

getrandom::register_custom_getrandom!(iroha_trigger::stub_getrandom);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ iroha_trigger.workspace = true
executor_custom_data_model.workspace = true

panic-halt.workspace = true
lol_alloc.workspace = true
dlmalloc.workspace = true
getrandom.workspace = true

serde = { workspace = true, features = ["derive"] }
Expand Down
4 changes: 2 additions & 2 deletions client/tests/integration/smartcontracts/multisig/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ extern crate panic_halt;

use alloc::{collections::btree_set::BTreeSet, format, vec::Vec};

use dlmalloc::GlobalDlmalloc;
use executor_custom_data_model::multisig::MultisigArgs;
use iroha_trigger::{debug::dbg_panic, prelude::*};
use lol_alloc::{FreeListAllocator, LockedAllocator};

#[global_allocator]
static ALLOC: LockedAllocator<FreeListAllocator> = LockedAllocator::new(FreeListAllocator::new());
static ALLOC: GlobalDlmalloc = GlobalDlmalloc;

getrandom::register_custom_getrandom!(iroha_trigger::stub_getrandom);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ iroha_executor_data_model.workspace = true
executor_custom_data_model.workspace = true

panic-halt.workspace = true
lol_alloc.workspace = true
dlmalloc.workspace = true
getrandom.workspace = true

serde = { workspace = true, features = ["derive"] }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ extern crate panic_halt;

use alloc::format;

use dlmalloc::GlobalDlmalloc;
use executor_custom_data_model::multisig::MultisigRegisterArgs;
use iroha_executor_data_model::permission::trigger::CanExecuteUserTrigger;
use iroha_trigger::{debug::dbg_panic, prelude::*};
use lol_alloc::{FreeListAllocator, LockedAllocator};

#[global_allocator]
static ALLOC: LockedAllocator<FreeListAllocator> = LockedAllocator::new(FreeListAllocator::new());
static ALLOC: GlobalDlmalloc = GlobalDlmalloc;

getrandom::register_custom_getrandom!(iroha_trigger::stub_getrandom);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ crate-type = ['cdylib']
iroha_smart_contract.workspace = true

panic-halt.workspace = true
lol_alloc.workspace = true
dlmalloc.workspace = true
getrandom.workspace = true
parity-scale-codec.workspace = true
nonzero_ext.workspace = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ extern crate panic_halt;

extern crate alloc;

use dlmalloc::GlobalDlmalloc;
use iroha_smart_contract::{data_model::query::cursor::ForwardCursor, prelude::*};
use lol_alloc::{FreeListAllocator, LockedAllocator};
use nonzero_ext::nonzero;
use parity_scale_codec::{Decode, DecodeAll, Encode};

#[global_allocator]
static ALLOC: LockedAllocator<FreeListAllocator> = LockedAllocator::new(FreeListAllocator::new());
static ALLOC: GlobalDlmalloc = GlobalDlmalloc;

getrandom::register_custom_getrandom!(iroha_smart_contract::stub_getrandom);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ crate-type = ['cdylib']
iroha_smart_contract.workspace = true

panic-halt.workspace = true
lol_alloc.workspace = true
dlmalloc.workspace = true
getrandom.workspace = true
parity-scale-codec.workspace = true
nonzero_ext.workspace = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ extern crate alloc;

use alloc::{collections::BTreeSet, string::ToString, vec::Vec};

use dlmalloc::GlobalDlmalloc;
use iroha_smart_contract::{
data_model::query::predicate::{string::StringPredicate, value::QueryOutputPredicate},
prelude::*,
QueryOutputCursor,
};
use lol_alloc::{FreeListAllocator, LockedAllocator};

#[global_allocator]
static ALLOC: LockedAllocator<FreeListAllocator> = LockedAllocator::new(FreeListAllocator::new());
static ALLOC: GlobalDlmalloc = GlobalDlmalloc;

getrandom::register_custom_getrandom!(iroha_smart_contract::stub_getrandom);

Expand Down
Binary file modified configs/swarm/executor.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion default_executor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ codegen-units = 1 # Further reduces binary size but increases compilation time
iroha_executor = { version = "2.0.0-pre-rc.21", path = "../smart_contract/executor", features = ["debug"] }
getrandom = { version = "0.2", features = ["custom"] }

lol_alloc = "0.4.0"
dlmalloc = { version = "0.2.6", features = ["global"] }
panic-halt = "0.2.0"
4 changes: 2 additions & 2 deletions default_executor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ extern crate alloc;
#[cfg(not(test))]
extern crate panic_halt;

use dlmalloc::GlobalDlmalloc;
use iroha_executor::{debug::dbg_panic, prelude::*, DataModelBuilder};
use lol_alloc::{FreeListAllocator, LockedAllocator};

#[global_allocator]
static ALLOC: LockedAllocator<FreeListAllocator> = LockedAllocator::new(FreeListAllocator::new());
static ALLOC: GlobalDlmalloc = GlobalDlmalloc;

getrandom::register_custom_getrandom!(iroha_executor::stub_getrandom);

Expand Down

0 comments on commit aaeab13

Please sign in to comment.