Skip to content

Commit d342384

Browse files
rename owner_index to function_index for clarity
1 parent b13ba39 commit d342384

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

src/instance.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ pub enum RuntimeFunction {
257257
locals_count: usize,
258258
// For cross-instance calls, weak is to avoid cycles
259259
owner: Option<Weak<Instance>>,
260-
owner_idx: Option<usize>,
260+
function_index: Option<usize>,
261261
},
262262
Host {
263263
callback: Rc<dyn Fn(&[WasmValue]) -> Option<WasmValue>>,
@@ -396,7 +396,7 @@ impl Instance {
396396
pc_start: function.body.start,
397397
locals_count,
398398
owner: None,
399-
owner_idx: None
399+
function_index: None
400400
});
401401
}
402402
}
@@ -481,7 +481,7 @@ impl Instance {
481481
let func_idx = *idx as usize;
482482
let f = inst.functions[func_idx].clone();
483483
let (owner_id, owner_func_idx) = match &f {
484-
RuntimeFunction::Wasm { owner, owner_idx, .. } => {
484+
RuntimeFunction::Wasm { owner, function_index: owner_idx, .. } => {
485485
if let (Some(weak_owner), Some(idx)) = (owner, owner_idx) {
486486
if let Some(owner_rc) = weak_owner.upgrade() {
487487
(owner_rc.id, *idx as u32)
@@ -649,7 +649,7 @@ impl Instance {
649649
}
650650
let fi = &self.functions[idx];
651651
match fi {
652-
RuntimeFunction::Wasm { runtime_sig, pc_start, locals_count, owner, owner_idx } => {
652+
RuntimeFunction::Wasm { runtime_sig, pc_start, locals_count, owner, function_index: owner_idx } => {
653653
if let (Some(owner_weak), Some(owner_idx)) = (owner, owner_idx) {
654654
// Cross-instance call
655655
if let Some(owner_rc) = owner_weak.upgrade() {
@@ -1013,7 +1013,7 @@ impl Instance {
10131013
let f = &self.functions[fi as usize];
10141014

10151015
match f {
1016-
RuntimeFunction::Wasm { runtime_sig, pc_start, locals_count, owner, owner_idx } => {
1016+
RuntimeFunction::Wasm { runtime_sig, pc_start, locals_count, owner, function_index: owner_idx } => {
10171017
if let (Some(owner_weak), Some(idx)) = (owner, owner_idx) {
10181018
if let Some(owner_rc) = owner_weak.upgrade() {
10191019
let n_params = runtime_sig.n_params() as usize;
@@ -1120,7 +1120,7 @@ impl Instance {
11201120
}
11211121

11221122
match callee {
1123-
RuntimeFunction::Wasm { runtime_sig, pc_start, locals_count, owner, owner_idx } => {
1123+
RuntimeFunction::Wasm { runtime_sig, pc_start, locals_count, owner, function_index: owner_idx } => {
11241124
if let (Some(owner_weak), Some(idx)) = (&owner, owner_idx) {
11251125
if let Some(owner_rc) = owner_weak.upgrade() {
11261126
let n_params = runtime_sig.n_params() as usize;
@@ -1450,7 +1450,7 @@ impl Instance {
14501450
let return_pc: usize = 0;
14511451

14521452
match func {
1453-
RuntimeFunction::Wasm { runtime_sig, pc_start, locals_count, owner, owner_idx } => {
1453+
RuntimeFunction::Wasm { runtime_sig, pc_start, locals_count, owner, function_index: owner_idx } => {
14541454
// Execute in the correct instance: if this Function has an owner,
14551455
// delegate invocation to that instance.
14561456
if let (Some(owner_weak), Some(idx)) = (owner, owner_idx) {

tests/spec_tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ fn externalized_exports_for(inst: &Rc<Instance>) -> HashMap<String, ExportValue>
9393
pc_start: 0, // Not used for cross-instance calls
9494
locals_count: 0,
9595
owner: Some(weak.clone()),
96-
owner_idx: Some(fi),
96+
function_index: Some(fi),
9797
}));
9898
}
9999
}

0 commit comments

Comments
 (0)