Skip to content

Conversation

@afonso360
Copy link
Contributor

👋 Hey,

As a precursor to adding table support to the interpreter this PR adds support for tables to the runtest environment.

This allows run tests to request memory for tables and for it to be provided via vmctx.

.flat_map(|entry| match entry {
RuntestEntry::Heap(heap) => {
let size: u64 = heap.size.into();
[alloc_heap(size), size]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a behaviour change from what we had before.

We used to put the start and end pointers. However it looks like that's not whats expected by the bound mechanism for heaps.

This changes it to pass the size in bytes of the heap.

RuntestEntry::Table(table) => {
let entry_size: u64 = table.entry_size.into();
let entry_count: u64 = table.entry_count.into();
let bytes = entry_size * entry_count;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is wrong according to docs/ir.md.

Table bounds should be the number of elements and not the number of bytes.

However nothing works when I change it to that. Probably something to investigate further.

See:

The *table bound* is the number of elements currently in the table. This is
the bound that `table_addr` checks against.

@github-actions github-actions bot added cranelift Issues related to the Cranelift code generator cranelift:docs labels Jul 11, 2022
@afonso360 afonso360 marked this pull request as draft July 11, 2022 20:29
@afonso360
Copy link
Contributor Author

Closing this in favor of #4433.

We don't need special memory for tables, we can just use the current heap mechanism as backing.

@afonso360 afonso360 closed this Jul 12, 2022
@afonso360 afonso360 deleted the test-tables branch July 12, 2022 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cranelift:docs cranelift Issues related to the Cranelift code generator

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant