Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
substrate
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Denis_P
substrate
Commits
f46fa0d0
Unverified
Commit
f46fa0d0
authored
6 years ago
by
Michael Müller
Browse files
Options
Downloads
Patches
Plain Diff
Move variables into constructor
parent
6c06d4d7
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
core/executor/src/allocator.rs
+7
-1
7 additions, 1 deletion
core/executor/src/allocator.rs
core/executor/src/wasm_executor.rs
+1
-6
1 addition, 6 deletions
core/executor/src/wasm_executor.rs
with
8 additions
and
7 deletions
core/executor/src/allocator.rs
+
7
−
1
View file @
f46fa0d0
...
...
@@ -54,7 +54,13 @@ impl FreeingBumpHeapAllocator {
/// * `heap_size` - The size available to this heap instance (in bytes) for
/// allocating memory.
///
pub
fn
new
(
mut
ptr_offset
:
usize
,
heap_size
:
usize
,
heap
:
MemoryRef
)
->
Self
{
pub
fn
new
(
heap
:
MemoryRef
)
->
Self
{
let
current_size
:
Bytes
=
m
.current_size
()
.into
();
let
current_size
=
current_size
.0
;
let
used_size
=
m
.used_size
()
.0
;
let
heap_size
=
current_size
-
used_size
;
let
ptr_offset
=
used_size
;
let
padding
=
ptr_offset
%
ALIGNMENT
;
if
padding
!=
0
{
ptr_offset
+=
ALIGNMENT
-
padding
;
...
...
This diff is collapsed.
Click to expand it.
core/executor/src/wasm_executor.rs
+
1
−
6
View file @
f46fa0d0
...
...
@@ -57,14 +57,9 @@ struct FunctionExecutor<'e, E: Externalities<Blake2Hasher> + 'e> {
impl
<
'e
,
E
:
Externalities
<
Blake2Hasher
>>
FunctionExecutor
<
'e
,
E
>
{
fn
new
(
m
:
MemoryRef
,
t
:
Option
<
TableRef
>
,
e
:
&
'e
mut
E
)
->
Result
<
Self
>
{
let
current_size
:
Bytes
=
m
.current_size
()
.into
();
let
current_size
=
current_size
.0
;
let
used_size
=
m
.used_size
()
.0
;
let
heap_size
=
current_size
-
used_size
;
Ok
(
FunctionExecutor
{
sandbox_store
:
sandbox
::
Store
::
new
(),
heap
:
allocator
::
FreeingBumpHeapAllocator
::
new
(
used_size
,
heap_size
,
m
.clone
()),
heap
:
allocator
::
FreeingBumpHeapAllocator
::
new
(
m
.clone
()),
memory
:
m
,
table
:
t
,
ext
:
e
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment