@@ -31,7 +31,7 @@ namespace Wasm {
31
31
32
32
void Interpreter::interpret (Configuration& configuration)
33
33
{
34
- auto & instructions = configuration.frame ()-> expression ().instructions ();
34
+ auto & instructions = configuration.frame (). expression ().instructions ();
35
35
auto max_ip_value = InstructionPointer { instructions.size () };
36
36
auto & current_ip_value = configuration.ip ();
37
37
@@ -73,7 +73,7 @@ void Interpreter::branch_to_label(Configuration& configuration, LabelIndex index
73
73
74
74
ReadonlyBytes Interpreter::load_from_memory (Configuration& configuration, const Instruction& instruction, size_t size)
75
75
{
76
- auto & address = configuration.frame ()-> module ().memories ().first ();
76
+ auto & address = configuration.frame (). module ().memories ().first ();
77
77
auto memory = configuration.store ().get (address);
78
78
if (!memory) {
79
79
m_do_trap = true ;
@@ -97,7 +97,7 @@ ReadonlyBytes Interpreter::load_from_memory(Configuration& configuration, const
97
97
98
98
void Interpreter::store_to_memory (Configuration& configuration, const Instruction& instruction, ReadonlyBytes data)
99
99
{
100
- auto & address = configuration.frame ()-> module ().memories ().first ();
100
+ auto & address = configuration.frame (). module ().memories ().first ();
101
101
auto memory = configuration.store ().get (address);
102
102
TRAP_IF_NOT (memory);
103
103
auto & arg = instruction.arguments ().get <Instruction::MemoryArgument>();
@@ -366,11 +366,11 @@ void Interpreter::interpret(Configuration& configuration, InstructionPointer& ip
366
366
case Instructions::nop.value ():
367
367
return ;
368
368
case Instructions::local_get.value ():
369
- configuration.stack ().push (Value (configuration.frame ()-> locals ()[instruction.arguments ().get <LocalIndex>().value ()]));
369
+ configuration.stack ().push (Value (configuration.frame (). locals ()[instruction.arguments ().get <LocalIndex>().value ()]));
370
370
return ;
371
371
case Instructions::local_set.value (): {
372
372
auto entry = configuration.stack ().pop ();
373
- configuration.frame ()-> locals ()[instruction.arguments ().get <LocalIndex>().value ()] = move (entry.get <Value>());
373
+ configuration.frame (). locals ()[instruction.arguments ().get <LocalIndex>().value ()] = move (entry.get <Value>());
374
374
return ;
375
375
}
376
376
case Instructions::i32_const.value ():
@@ -448,7 +448,7 @@ void Interpreter::interpret(Configuration& configuration, InstructionPointer& ip
448
448
}
449
449
case Instructions::return_.value (): {
450
450
Vector<Stack::EntryType> results;
451
- auto & frame = * configuration.frame ();
451
+ auto & frame = configuration.frame ();
452
452
results.ensure_capacity (frame.arity ());
453
453
for (size_t i = 0 ; i < frame.arity (); ++i)
454
454
results.prepend (configuration.stack ().pop ());
@@ -460,7 +460,7 @@ void Interpreter::interpret(Configuration& configuration, InstructionPointer& ip
460
460
last_label = entry.get <Label>();
461
461
continue ;
462
462
}
463
- if (entry.has <NonnullOwnPtr< Frame> >()) {
463
+ if (entry.has <Frame>()) {
464
464
// Push the frame back
465
465
configuration.stack ().push (move (entry));
466
466
// Push its label back (if there is one)
@@ -475,7 +475,7 @@ void Interpreter::interpret(Configuration& configuration, InstructionPointer& ip
475
475
configuration.stack ().push (move (result));
476
476
477
477
// Jump past the call/indirect instruction
478
- configuration.ip () = configuration.frame ()-> expression ().instructions ().size () - 1 ;
478
+ configuration.ip () = configuration.frame (). expression ().instructions ().size () - 1 ;
479
479
return ;
480
480
}
481
481
case Instructions::br.value ():
@@ -489,14 +489,14 @@ void Interpreter::interpret(Configuration& configuration, InstructionPointer& ip
489
489
goto unimplemented;
490
490
case Instructions::call.value (): {
491
491
auto index = instruction.arguments ().get <FunctionIndex>();
492
- auto address = configuration.frame ()-> module ().functions ()[index.value ()];
492
+ auto address = configuration.frame (). module ().functions ()[index.value ()];
493
493
dbgln_if (WASM_TRACE_DEBUG, " call({})" , address.value ());
494
494
call_address (configuration, address);
495
495
return ;
496
496
}
497
497
case Instructions::call_indirect.value (): {
498
498
auto & args = instruction.arguments ().get <Instruction::IndirectCallArgs>();
499
- auto table_address = configuration.frame ()-> module ().tables ()[args.table .value ()];
499
+ auto table_address = configuration.frame (). module ().tables ()[args.table .value ()];
500
500
auto table_instance = configuration.store ().get (table_address);
501
501
auto index = configuration.stack ().pop ().get <Value>().to <i32 >();
502
502
TRAP_IF_NOT (index.has_value ());
@@ -565,40 +565,40 @@ void Interpreter::interpret(Configuration& configuration, InstructionPointer& ip
565
565
case Instructions::local_tee.value (): {
566
566
auto value = configuration.stack ().peek ().get <Value>();
567
567
auto local_index = instruction.arguments ().get <LocalIndex>();
568
- TRAP_IF_NOT (configuration.frame ()-> locals ().size () > local_index.value ());
568
+ TRAP_IF_NOT (configuration.frame (). locals ().size () > local_index.value ());
569
569
dbgln_if (WASM_TRACE_DEBUG, " stack:peek -> locals({})" , local_index.value ());
570
- configuration.frame ()-> locals ()[local_index.value ()] = move (value);
570
+ configuration.frame (). locals ()[local_index.value ()] = move (value);
571
571
return ;
572
572
}
573
573
case Instructions::global_get.value (): {
574
574
auto global_index = instruction.arguments ().get <GlobalIndex>();
575
- TRAP_IF_NOT (configuration.frame ()-> module ().globals ().size () > global_index.value ());
576
- auto address = configuration.frame ()-> module ().globals ()[global_index.value ()];
575
+ TRAP_IF_NOT (configuration.frame (). module ().globals ().size () > global_index.value ());
576
+ auto address = configuration.frame (). module ().globals ()[global_index.value ()];
577
577
dbgln_if (WASM_TRACE_DEBUG, " global({}) -> stack" , address.value ());
578
578
auto global = configuration.store ().get (address);
579
579
configuration.stack ().push (Value (global->value ()));
580
580
return ;
581
581
}
582
582
case Instructions::global_set.value (): {
583
583
auto global_index = instruction.arguments ().get <GlobalIndex>();
584
- TRAP_IF_NOT (configuration.frame ()-> module ().globals ().size () > global_index.value ());
585
- auto address = configuration.frame ()-> module ().globals ()[global_index.value ()];
584
+ TRAP_IF_NOT (configuration.frame (). module ().globals ().size () > global_index.value ());
585
+ auto address = configuration.frame (). module ().globals ()[global_index.value ()];
586
586
auto value = configuration.stack ().pop ().get <Value>();
587
587
dbgln_if (WASM_TRACE_DEBUG, " stack -> global({})" , address.value ());
588
588
auto global = configuration.store ().get (address);
589
589
global->set_value (move (value));
590
590
return ;
591
591
}
592
592
case Instructions::memory_size.value (): {
593
- auto address = configuration.frame ()-> module ().memories ()[0 ];
593
+ auto address = configuration.frame (). module ().memories ()[0 ];
594
594
auto instance = configuration.store ().get (address);
595
595
auto pages = instance->size () / Constants::page_size;
596
596
dbgln_if (WASM_TRACE_DEBUG, " memory.size -> stack({})" , pages);
597
597
configuration.stack ().push (Value ((i32 )pages));
598
598
return ;
599
599
}
600
600
case Instructions::memory_grow.value (): {
601
- auto address = configuration.frame ()-> module ().memories ()[0 ];
601
+ auto address = configuration.frame (). module ().memories ()[0 ];
602
602
auto instance = configuration.store ().get (address);
603
603
i32 old_pages = instance->size () / Constants::page_size;
604
604
auto new_pages = configuration.stack ().pop ().get <Value>().to <i32 >();
0 commit comments