Skip to content
This repository was archived by the owner on Mar 24, 2022. It is now read-only.

Commit 3d26fc8

Browse files
rustfmt
1 parent 5eaa55e commit 3d26fc8

3 files changed

Lines changed: 77 additions & 19 deletions

File tree

benchmarks/lucet-benchmarks/src/context.rs

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,14 @@ fn context_init(c: &mut Criterion) {
1010
c.bench_function("context_init", move |b| {
1111
b.iter(|| {
1212
let mut parent = ContextHandle::new();
13-
ContextHandle::create_and_init(&mut *stack, &mut parent, f as usize, &[], std::ptr::null_mut()).unwrap();
13+
ContextHandle::create_and_init(
14+
&mut *stack,
15+
&mut parent,
16+
f as usize,
17+
&[],
18+
std::ptr::null_mut(),
19+
)
20+
.unwrap();
1421
})
1522
});
1623
}
@@ -24,9 +31,14 @@ fn context_swap_return(c: &mut Criterion) {
2431
|| {
2532
let mut stack = vec![0u64; 1024].into_boxed_slice();
2633
let mut parent = ContextHandle::new();
27-
let child =
28-
ContextHandle::create_and_init(&mut *stack, &mut parent, f as usize, &[], std::ptr::null_mut())
29-
.unwrap();
34+
let child = ContextHandle::create_and_init(
35+
&mut *stack,
36+
&mut parent,
37+
f as usize,
38+
&[],
39+
std::ptr::null_mut(),
40+
)
41+
.unwrap();
3042
(stack, parent, child)
3143
},
3244
|(stack, mut parent, child)| unsafe {
@@ -47,9 +59,14 @@ fn context_init_swap_return(c: &mut Criterion) {
4759
|| vec![0u64; 1024].into_boxed_slice(),
4860
|mut stack| {
4961
let mut parent = ContextHandle::new();
50-
let child =
51-
ContextHandle::create_and_init(&mut *stack, &mut parent, f as usize, &[], std::ptr::null_mut())
52-
.unwrap();
62+
let child = ContextHandle::create_and_init(
63+
&mut *stack,
64+
&mut parent,
65+
f as usize,
66+
&[],
67+
std::ptr::null_mut(),
68+
)
69+
.unwrap();
5370
unsafe { Context::swap(&mut parent, &child) };
5471
stack
5572
},
@@ -336,9 +353,14 @@ fn context_init_swap_return_many_args(c: &mut Criterion) {
336353
|| vec![0u64; 1024].into_boxed_slice(),
337354
|mut stack| {
338355
let mut parent = ContextHandle::new();
339-
let child =
340-
ContextHandle::create_and_init(&mut *stack, &mut parent, f as usize, &args, std::ptr::null_mut())
341-
.unwrap();
356+
let child = ContextHandle::create_and_init(
357+
&mut *stack,
358+
&mut parent,
359+
f as usize,
360+
&args,
361+
std::ptr::null_mut(),
362+
)
363+
.unwrap();
342364
unsafe { Context::swap(&mut parent, &child) };
343365
stack
344366
},

lucet-runtime/lucet-runtime-internals/src/context/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ struct GpRegs {
3434
r13: u64,
3535
r14: u64,
3636
r15: u64,
37-
r8: u64
37+
r8: u64,
3838
}
3939

4040
impl GpRegs {

lucetc/src/module.rs

Lines changed: 44 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,12 @@ impl<'a> ModuleEnvironment<'a> for ModuleInfo<'a> {
163163
Ok(())
164164
}
165165

166-
fn declare_func_import(&mut self, sig_index: SignatureIndex, module: &'a str, field: &'a str) -> Result<(), WasmError> {
166+
fn declare_func_import(
167+
&mut self,
168+
sig_index: SignatureIndex,
169+
module: &'a str,
170+
field: &'a str,
171+
) -> Result<(), WasmError> {
167172
debug_assert_eq!(
168173
self.functions.len(),
169174
self.imported_funcs.len(),
@@ -185,7 +190,12 @@ impl<'a> ModuleEnvironment<'a> for ModuleInfo<'a> {
185190
Ok(())
186191
}
187192

188-
fn declare_global_import(&mut self, global: Global, module: &'a str, field: &'a str) -> Result<(), WasmError> {
193+
fn declare_global_import(
194+
&mut self,
195+
global: Global,
196+
module: &'a str,
197+
field: &'a str,
198+
) -> Result<(), WasmError> {
189199
debug_assert_eq!(
190200
self.globals.len(),
191201
self.imported_globals.len(),
@@ -196,7 +206,12 @@ impl<'a> ModuleEnvironment<'a> for ModuleInfo<'a> {
196206
Ok(())
197207
}
198208

199-
fn declare_table_import(&mut self, table: Table, module: &'a str, field: &'a str) -> Result<(), WasmError> {
209+
fn declare_table_import(
210+
&mut self,
211+
table: Table,
212+
module: &'a str,
213+
field: &'a str,
214+
) -> Result<(), WasmError> {
200215
debug_assert_eq!(
201216
self.tables.len(),
202217
self.imported_tables.len(),
@@ -207,7 +222,12 @@ impl<'a> ModuleEnvironment<'a> for ModuleInfo<'a> {
207222
Ok(())
208223
}
209224

210-
fn declare_memory_import(&mut self, memory: Memory, module: &'a str, field: &'a str) -> Result<(), WasmError> {
225+
fn declare_memory_import(
226+
&mut self,
227+
memory: Memory,
228+
module: &'a str,
229+
field: &'a str,
230+
) -> Result<(), WasmError> {
211231
debug_assert_eq!(
212232
self.memories.len(),
213233
self.imported_memories.len(),
@@ -246,7 +266,11 @@ impl<'a> ModuleEnvironment<'a> for ModuleInfo<'a> {
246266
Ok(())
247267
}
248268

249-
fn declare_func_export(&mut self, func_index: FuncIndex, name: &'a str) -> Result<(), WasmError> {
269+
fn declare_func_export(
270+
&mut self,
271+
func_index: FuncIndex,
272+
name: &'a str,
273+
) -> Result<(), WasmError> {
250274
let unique_func_index = *self
251275
.function_mapping
252276
.get(func_index)
@@ -258,23 +282,35 @@ impl<'a> ModuleEnvironment<'a> for ModuleInfo<'a> {
258282
Ok(())
259283
}
260284

261-
fn declare_table_export(&mut self, table_index: TableIndex, name: &'a str) -> Result<(), WasmError> {
285+
fn declare_table_export(
286+
&mut self,
287+
table_index: TableIndex,
288+
name: &'a str,
289+
) -> Result<(), WasmError> {
262290
self.tables
263291
.get_mut(table_index)
264292
.expect("export of declared table")
265293
.push_export(name);
266294
Ok(())
267295
}
268296

269-
fn declare_memory_export(&mut self, memory_index: MemoryIndex, name: &'a str) -> Result<(), WasmError> {
297+
fn declare_memory_export(
298+
&mut self,
299+
memory_index: MemoryIndex,
300+
name: &'a str,
301+
) -> Result<(), WasmError> {
270302
self.memories
271303
.get_mut(memory_index)
272304
.expect("export of declared memory")
273305
.push_export(name);
274306
Ok(())
275307
}
276308

277-
fn declare_global_export(&mut self, global_index: GlobalIndex, name: &'a str) -> Result<(), WasmError> {
309+
fn declare_global_export(
310+
&mut self,
311+
global_index: GlobalIndex,
312+
name: &'a str,
313+
) -> Result<(), WasmError> {
278314
self.globals
279315
.get_mut(global_index)
280316
.expect("export of declared global")

0 commit comments

Comments
 (0)