-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b4aef0c
commit 1a55481
Showing
13 changed files
with
335 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright © Aptos Foundation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use move_binary_format::file_format::CompiledScript; | ||
use move_vm_runtime::Script; | ||
use std::sync::Arc; | ||
|
||
/// An entry for the script cache, used by the Aptos code cache. Entries | ||
/// can live in the cache in different states (deserialized / verified). | ||
#[derive(Debug)] | ||
pub(crate) enum ScriptCacheEntry { | ||
Deserialized(Arc<CompiledScript>), | ||
Verified(Arc<Script>), | ||
} | ||
|
||
impl ScriptCacheEntry { | ||
/// Returns the deserialized (compiled) representation of the script. | ||
pub(crate) fn as_compiled_script(&self) -> Arc<CompiledScript> { | ||
match self { | ||
Self::Deserialized(compiled_script) => compiled_script.clone(), | ||
Self::Verified(script) => script.as_compiled_script(), | ||
} | ||
} | ||
|
||
/// Returns true if the script entry has already been verified. | ||
pub(crate) fn is_verified(&self) -> bool { | ||
match self { | ||
Self::Verified(_) => true, | ||
Self::Deserialized(_) => false, | ||
} | ||
} | ||
} |
Oops, something went wrong.