Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory pool/reuse #732

Merged
merged 27 commits into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
1e205b6
Add memory reset function
Dentosal May 8, 2024
ebc60c6
Add a test case
Dentosal May 8, 2024
39fa053
Add changelog entry
Dentosal May 8, 2024
ab936e6
Add VmPool and use it for predicates and execution
Dentosal May 10, 2024
1fafd09
Add no_std support to pool
Dentosal May 10, 2024
f48b99d
Fix heap reallocation optimization on reset
Dentosal May 13, 2024
aca6a88
Move memory impl into a trait
Dentosal May 13, 2024
fc4a17e
Refactor Interpreter to allow using &mut Memory as well
Dentosal May 13, 2024
d7d1a54
Change grow_heap to grow_heap_by
Dentosal May 13, 2024
e82441b
Change the Interpreter memory to a generic
Dentosal May 13, 2024
41542f5
Cleanup
Dentosal May 13, 2024
fae708a
Feature-gating fix
Dentosal May 13, 2024
80a0616
Re-add interpreter clone for tests
Dentosal May 13, 2024
a29e3f7
Address pr feedback
Dentosal May 14, 2024
3f1a334
Cleanup
Dentosal May 14, 2024
452d439
Cleanup
Dentosal May 14, 2024
c8a7edf
Make MemoryPool to have a concrete return type. Improve docs.
Dentosal May 14, 2024
e2aa95c
Merge branch 'master' into dento/memory-reset
Dentosal May 19, 2024
6bbb741
Clippy
Dentosal May 20, 2024
ea78818
Use `Memory` trait.
xgreenx May 31, 2024
6667f0a
Simplified `VmMemoryPool` constrains
xgreenx May 31, 2024
5faa1ac
Merge branch 'refs/heads/master' into dento/memory-reset
xgreenx May 31, 2024
65f1b10
Simplify API
xgreenx May 31, 2024
0781848
Make clippy happy
xgreenx May 31, 2024
ac78892
Removed redundant addition
xgreenx May 31, 2024
694721e
Updated CHANGELOG.md
xgreenx May 31, 2024
7197ed9
Unify the signature
xgreenx May 31, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

### Added

- [#732](https://github.com/FuelLabs/fuel-vm/pull/732): Adds `reset` method to VM memory.

#### Breaking

- [#725](https://github.com/FuelLabs/fuel-vm/pull/725): `UtxoId::from_str` now rejects inputs with multiple `0x` prefixes. Many `::from_str` implementations also reject extra data in the end of the input, instead of silently ignoring it. `UtxoId::from_str` allows a single `:` between the fields. Unused `GasUnit` struct removed.
- [#726](https://github.com/FuelLabs/fuel-vm/pull/726): Removed code related to Binary Merkle Sum Trees (BMSTs). The BMST is deprecated and not used in production environments.
- [#732](https://github.com/FuelLabs/fuel-vm/pull/732): Adds `VmPool` to allow reusing relatively expensive-to-allocate VM memories… Functions and traits which require VM initalization such as `estimate_predicates` now take the `VmPool` as an argument. The old behavior cah be restored by just passing `Default::default()` as the argument.

## [Version 0.49.0]

Expand Down
1 change: 1 addition & 0 deletions fuel-vm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ rand = { version = "0.8", optional = true }
serde = { version = "1.0", features = ["derive", "rc"], optional = true }
serde_with = { version = "3.7", optional = true }
sha3 = { version = "0.10", default-features = false }
spin = "0.9"
static_assertions = "1.1"
strum = { version = "0.24", features = ["derive"], default-features = false }
tai64 = { version = "4.0", default-features = false }
Expand Down
7 changes: 4 additions & 3 deletions fuel-vm/examples/external.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ use fuel_tx::{
use fuel_vm::{
error::SimpleResult,
interpreter::EcalHandler,
pool::VmPool,
prelude::{
Interpreter,
IntoChecked,
Expand Down Expand Up @@ -104,7 +105,7 @@ fn example_file_read() {
.maturity(Default::default())
.add_random_fee_input()
.finalize()
.into_checked(Default::default(), &consensus_params)
.into_checked(Default::default(), &consensus_params, VmPool::default())
.expect("failed to generate a checked tx");
client.transact(tx);
let receipts = client.receipts().expect("Expected receipts");
Expand Down Expand Up @@ -163,7 +164,7 @@ fn example_counter() {
.maturity(Default::default())
.add_random_fee_input()
.finalize()
.into_checked(Default::default(), &consensus_params)
.into_checked(Default::default(), &consensus_params, VmPool::default())
.expect("failed to generate a checked tx");
client.transact(tx);
let receipts = client.receipts().expect("Expected receipts");
Expand Down Expand Up @@ -226,7 +227,7 @@ fn example_shared_counter() {
.maturity(Default::default())
.add_random_fee_input()
.finalize()
.into_checked(Default::default(), &consensus_params)
.into_checked(Default::default(), &consensus_params, VmPool::default())
.expect("failed to generate a checked tx");
client.transact(tx);
let receipts = client.receipts().expect("Expected receipts");
Expand Down
3 changes: 2 additions & 1 deletion fuel-vm/examples/single_step.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ use fuel_vm::{
Interpreter,
NotSupportedEcal,
},
pool::VmPool,
prelude::*,
};

Expand Down Expand Up @@ -46,7 +47,7 @@ fn main() {
.maturity(Default::default())
.add_random_fee_input()
.finalize()
.into_checked(Default::default(), &consensus_params)
.into_checked(Default::default(), &consensus_params, VmPool::default())
.expect("failed to generate a checked tx")
.into_ready(
0,
Expand Down
Loading
Loading