79
79
import org .graalvm .wasm .WasmLanguage ;
80
80
import org .graalvm .wasm .WasmMath ;
81
81
import org .graalvm .wasm .WasmModule ;
82
- import org .graalvm .wasm .WasmStore ;
83
82
import org .graalvm .wasm .WasmTable ;
84
83
import org .graalvm .wasm .WasmType ;
85
84
import org .graalvm .wasm .api .Vector128 ;
@@ -265,7 +264,6 @@ public Object executeBodyFromOffset(WasmInstance instance, VirtualFrame frame, i
265
264
int stackPointer = startStackPointer ;
266
265
int lineIndex = startLineIndex ;
267
266
268
- final WasmStore store = instance .store ();
269
267
// Note: The module may not have any memories.
270
268
final WasmMemory zeroMemory = !codeEntry .usesMemoryZero () ? null : memory (instance , 0 );
271
269
final WasmMemoryLibrary zeroMemoryLib = !codeEntry .usesMemoryZero () ? null : memoryLib (0 );
@@ -546,7 +544,7 @@ public Object executeBodyFromOffset(WasmInstance instance, VirtualFrame frame, i
546
544
tableIndex = rawPeekI32 (bytecode , offset + 8 );
547
545
offset += 12 ;
548
546
}
549
- final WasmTable table = store .tables ().table (instance .tableAddress (tableIndex ));
547
+ final WasmTable table = instance . store () .tables ().table (instance .tableAddress (tableIndex ));
550
548
final Object [] elements = table .elements ();
551
549
final int elementIndex = popInt (frame , stackPointer );
552
550
if (elementIndex < 0 || elementIndex >= elements .length ) {
@@ -1499,13 +1497,13 @@ public Object executeBodyFromOffset(WasmInstance instance, VirtualFrame frame, i
1499
1497
break ;
1500
1498
case Bytecode .TABLE_GET : {
1501
1499
final int tableIndex = rawPeekI32 (bytecode , offset );
1502
- table_get (store , instance , frame , stackPointer , tableIndex );
1500
+ table_get (instance , frame , stackPointer , tableIndex );
1503
1501
offset += 4 ;
1504
1502
break ;
1505
1503
}
1506
1504
case Bytecode .TABLE_SET : {
1507
1505
final int tableIndex = rawPeekI32 (bytecode , offset );
1508
- table_set (store , instance , frame , stackPointer , tableIndex );
1506
+ table_set (instance , frame , stackPointer , tableIndex );
1509
1507
stackPointer -= 2 ;
1510
1508
offset += 4 ;
1511
1509
break ;
@@ -1580,7 +1578,7 @@ public Object executeBodyFromOffset(WasmInstance instance, VirtualFrame frame, i
1580
1578
final int n = popInt (frame , stackPointer - 1 );
1581
1579
final int src = popInt (frame , stackPointer - 2 );
1582
1580
final int dst = popInt (frame , stackPointer - 3 );
1583
- table_init (store , instance , n , src , dst , tableIndex , elementIndex );
1581
+ table_init (instance , n , src , dst , tableIndex , elementIndex );
1584
1582
stackPointer -= 3 ;
1585
1583
offset += 8 ;
1586
1584
break ;
@@ -1598,7 +1596,7 @@ public Object executeBodyFromOffset(WasmInstance instance, VirtualFrame frame, i
1598
1596
final int n = popInt (frame , stackPointer - 1 );
1599
1597
final int src = popInt (frame , stackPointer - 2 );
1600
1598
final int dst = popInt (frame , stackPointer - 3 );
1601
- table_copy (store , instance , n , src , dst , srcIndex , dstIndex );
1599
+ table_copy (instance , n , src , dst , srcIndex , dstIndex );
1602
1600
stackPointer -= 3 ;
1603
1601
offset += 8 ;
1604
1602
break ;
@@ -1609,15 +1607,15 @@ public Object executeBodyFromOffset(WasmInstance instance, VirtualFrame frame, i
1609
1607
final int n = popInt (frame , stackPointer - 1 );
1610
1608
final Object val = popReference (frame , stackPointer - 2 );
1611
1609
1612
- final int res = table_grow (store , instance , n , val , tableIndex );
1610
+ final int res = table_grow (instance , n , val , tableIndex );
1613
1611
pushInt (frame , stackPointer - 2 , res );
1614
1612
stackPointer --;
1615
1613
offset += 4 ;
1616
1614
break ;
1617
1615
}
1618
1616
case Bytecode .TABLE_SIZE : {
1619
1617
final int tableIndex = rawPeekI32 (bytecode , offset );
1620
- table_size (store , instance , frame , stackPointer , tableIndex );
1618
+ table_size (instance , frame , stackPointer , tableIndex );
1621
1619
stackPointer ++;
1622
1620
offset += 4 ;
1623
1621
break ;
@@ -1628,7 +1626,7 @@ public Object executeBodyFromOffset(WasmInstance instance, VirtualFrame frame, i
1628
1626
final int n = popInt (frame , stackPointer - 1 );
1629
1627
final Object val = popReference (frame , stackPointer - 2 );
1630
1628
final int i = popInt (frame , stackPointer - 3 );
1631
- table_fill (store , instance , n , val , i , tableIndex );
1629
+ table_fill (instance , n , val , i , tableIndex );
1632
1630
stackPointer -= 3 ;
1633
1631
offset += 4 ;
1634
1632
break ;
@@ -4360,8 +4358,8 @@ private static void i64_extend32_s(VirtualFrame frame, int stackPointer) {
4360
4358
}
4361
4359
4362
4360
@ TruffleBoundary
4363
- private void table_init (WasmStore store , WasmInstance instance , int length , int source , int destination , int tableIndex , int elementIndex ) {
4364
- final WasmTable table = store .tables ().table (instance .tableAddress (tableIndex ));
4361
+ private void table_init (WasmInstance instance , int length , int source , int destination , int tableIndex , int elementIndex ) {
4362
+ final WasmTable table = instance . store () .tables ().table (instance .tableAddress (tableIndex ));
4365
4363
final Object [] elementInstance = instance .elemInstance (elementIndex );
4366
4364
final int elementInstanceLength ;
4367
4365
if (elementInstance == null ) {
@@ -4379,8 +4377,8 @@ private void table_init(WasmStore store, WasmInstance instance, int length, int
4379
4377
table .initialize (elementInstance , source , destination , length );
4380
4378
}
4381
4379
4382
- private void table_get (WasmStore store , WasmInstance instance , VirtualFrame frame , int stackPointer , int index ) {
4383
- final WasmTable table = store .tables ().table (instance .tableAddress (index ));
4380
+ private void table_get (WasmInstance instance , VirtualFrame frame , int stackPointer , int index ) {
4381
+ final WasmTable table = instance . store () .tables ().table (instance .tableAddress (index ));
4384
4382
final int i = popInt (frame , stackPointer - 1 );
4385
4383
if (i < 0 || i >= table .size ()) {
4386
4384
enterErrorBranch ();
@@ -4390,8 +4388,8 @@ private void table_get(WasmStore store, WasmInstance instance, VirtualFrame fram
4390
4388
pushReference (frame , stackPointer - 1 , value );
4391
4389
}
4392
4390
4393
- private void table_set (WasmStore store , WasmInstance instance , VirtualFrame frame , int stackPointer , int index ) {
4394
- final WasmTable table = store .tables ().table (instance .tableAddress (index ));
4391
+ private void table_set (WasmInstance instance , VirtualFrame frame , int stackPointer , int index ) {
4392
+ final WasmTable table = instance . store () .tables ().table (instance .tableAddress (index ));
4395
4393
final Object value = popReference (frame , stackPointer - 1 );
4396
4394
final int i = popInt (frame , stackPointer - 2 );
4397
4395
if (i < 0 || i >= table .size ()) {
@@ -4401,21 +4399,21 @@ private void table_set(WasmStore store, WasmInstance instance, VirtualFrame fram
4401
4399
table .set (i , value );
4402
4400
}
4403
4401
4404
- private static void table_size (WasmStore store , WasmInstance instance , VirtualFrame frame , int stackPointer , int index ) {
4405
- final WasmTable table = store .tables ().table (instance .tableAddress (index ));
4402
+ private static void table_size (WasmInstance instance , VirtualFrame frame , int stackPointer , int index ) {
4403
+ final WasmTable table = instance . store () .tables ().table (instance .tableAddress (index ));
4406
4404
pushInt (frame , stackPointer , table .size ());
4407
4405
}
4408
4406
4409
4407
@ TruffleBoundary
4410
- private static int table_grow (WasmStore store , WasmInstance instance , int length , Object value , int index ) {
4411
- final WasmTable table = store .tables ().table (instance .tableAddress (index ));
4408
+ private static int table_grow (WasmInstance instance , int length , Object value , int index ) {
4409
+ final WasmTable table = instance . store () .tables ().table (instance .tableAddress (index ));
4412
4410
return table .grow (length , value );
4413
4411
}
4414
4412
4415
4413
@ TruffleBoundary
4416
- private void table_copy (WasmStore store , WasmInstance instance , int length , int source , int destination , int sourceTableIndex , int destinationTableIndex ) {
4417
- final WasmTable sourceTable = store .tables ().table (instance .tableAddress (sourceTableIndex ));
4418
- final WasmTable destinationTable = store .tables ().table (instance .tableAddress (destinationTableIndex ));
4414
+ private void table_copy (WasmInstance instance , int length , int source , int destination , int sourceTableIndex , int destinationTableIndex ) {
4415
+ final WasmTable sourceTable = instance . store () .tables ().table (instance .tableAddress (sourceTableIndex ));
4416
+ final WasmTable destinationTable = instance . store () .tables ().table (instance .tableAddress (destinationTableIndex ));
4419
4417
if (checkOutOfBounds (source , length , sourceTable .size ()) || checkOutOfBounds (destination , length , destinationTable .size ())) {
4420
4418
enterErrorBranch ();
4421
4419
throw WasmException .create (Failure .OUT_OF_BOUNDS_TABLE_ACCESS );
@@ -4427,8 +4425,8 @@ private void table_copy(WasmStore store, WasmInstance instance, int length, int
4427
4425
}
4428
4426
4429
4427
@ TruffleBoundary
4430
- private void table_fill (WasmStore store , WasmInstance instance , int length , Object value , int offset , int index ) {
4431
- final WasmTable table = store .tables ().table (instance .tableAddress (index ));
4428
+ private void table_fill (WasmInstance instance , int length , Object value , int offset , int index ) {
4429
+ final WasmTable table = instance . store () .tables ().table (instance .tableAddress (index ));
4432
4430
if (checkOutOfBounds (offset , length , table .size ())) {
4433
4431
enterErrorBranch ();
4434
4432
throw WasmException .create (Failure .OUT_OF_BOUNDS_TABLE_ACCESS );
0 commit comments