Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 0 additions & 24 deletions src/Memory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,30 +146,6 @@ public unsafe IntPtr GetPointer()
return (nint)data;
}

/// <summary>
/// Gets the span of the memory.
/// </summary>
/// <returns>Returns the span of the memory.</returns>
/// <exception cref="OverflowException">The memory has more than 32767 pages.</exception>
/// <remarks>
/// <para>
/// The span may become invalid if the memory grows.
///
/// This may happen if the memory is explicitly requested to grow or
/// grows as a result of WebAssembly execution.
/// </para>
/// <para>
/// Therefore, the returned span should not be used after calling the grow method or
/// after calling into WebAssembly code.
/// </para>
/// </remarks>
[Obsolete("This method will throw an OverflowException if the memory has more than 32767 pages. " +
"Use the " + nameof(GetSpan) + " overload taking an address and a length.")]
public Span<byte> GetSpan()
{
return GetSpan(0, checked((int)GetLength()));
}

/// <summary>
/// Gets a span of a section of the memory.
/// </summary>
Expand Down
14 changes: 0 additions & 14 deletions src/Table.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,6 @@ public enum TableKind
/// </summary>
public class Table : IExternal
{
/// <summary>
/// Creates a new WebAssembly table.
/// </summary>
/// <param name="store">The store to create the table in.</param>
/// <param name="kind">The value kind for the elements in the table.</param>
/// <param name="initialValue">The initial value for elements in the table.</param>
/// <param name="initial">The number of initial elements in the table.</param>
/// <param name="maximum">The maximum number of elements in the table.</param>
[Obsolete("Replace ValueKind parameter with TableKind")]
public Table(Store store, ValueKind kind, object? initialValue, uint initial, uint maximum = uint.MaxValue)
: this(store, (TableKind)kind, initialValue, initial, maximum)
{
}

/// <summary>
/// Creates a new WebAssembly table.
/// </summary>
Expand Down
11 changes: 3 additions & 8 deletions tests/Memory64AccessTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public unsafe void ItCanAccessMemoryWith65537Pages()
memoryExport.Is64Bit.Should().BeTrue();

var instance = Linker.Instantiate(Store, Fixture.Module);
var memory = instance.GetMemory("mem");
var memory = instance.GetMemory("mem")!;

memory.Minimum.Should().Be(0x10001);
memory.Maximum.Should().Be(0x1000000000000);
Expand Down Expand Up @@ -75,14 +75,9 @@ public unsafe void ItCanAccessMemoryWith65537Pages()
public void ItThrowsForOutOfBoundsAccess()
{
var instance = Linker.Instantiate(Store, Fixture.Module);
var memory = instance.GetMemory("mem");
var memory = instance.GetMemory("mem")!;

#pragma warning disable CS0618 // Type or member is obsolete
Action action = () => memory.GetSpan();
#pragma warning restore CS0618 // Type or member is obsolete
action.Should().Throw<OverflowException>();

action = () => memory.GetSpan<short>(0x10000);
Action action = () => memory.GetSpan<short>(0x10000);
action.Should().Throw<OverflowException>();

action = () => memory.GetSpan(-1L, 0);
Expand Down
11 changes: 3 additions & 8 deletions tests/MemoryAccessTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public unsafe void ItCanAccessMemoryWith65536Pages()
memoryExport.Is64Bit.Should().BeFalse();

var instance = Linker.Instantiate(Store, Fixture.Module);
var memory = instance.GetMemory("mem");
var memory = instance.GetMemory("mem")!;

memory.Minimum.Should().Be(0x10000);
memory.Maximum.Should().BeNull();
Expand Down Expand Up @@ -108,14 +108,9 @@ public unsafe void ItCanAccessMemoryWith65536Pages()
public void ItThrowsForOutOfBoundsAccess()
{
var instance = Linker.Instantiate(Store, Fixture.Module);
var memory = instance.GetMemory("mem");
var memory = instance.GetMemory("mem")!;

#pragma warning disable CS0618 // Type or member is obsolete
Action action = () => memory.GetSpan();
#pragma warning restore CS0618 // Type or member is obsolete
action.Should().Throw<OverflowException>();

action = () => memory.GetSpan<short>(0);
Action action = () => memory.GetSpan<short>(0);
action.Should().Throw<OverflowException>();

action = () => memory.GetSpan(-1L, 0);
Expand Down
Loading