Class TableConvention.Delegating
- All Implemented Interfaces:
ConstructorCallback
,ExportableConvention
,TableConvention
,ExtContainer
- Enclosing interface:
- TableConvention
TableConvention
which delegates all calls to another.-
Nested Class Summary
Nested classes/interfaces inherited from interface io.github.eutro.wasm2j.core.conf.itf.ConstructorCallback
ConstructorCallback.Abstract
Nested classes/interfaces inherited from interface io.github.eutro.wasm2j.core.conf.itf.TableConvention
TableConvention.Delegating
-
Field Summary
Modifier and TypeFieldDescriptionprotected final TableConvention
The convention calls will be delegated to. -
Constructor Summary
ConstructorDescriptionDelegating
(TableConvention delegate) Construct a newTableConvention.Delegating
with the given delegate. -
Method Summary
Modifier and TypeMethodDescriptionvoid
emitTableCopy
(IRBuilder ib, Effect effect, TableConvention dst) Emit code for a WebAssemblytable.copy
instruction.void
emitTableFill
(IRBuilder ib, Effect effect) Emit code for a WebAssemblytable.fill
instruction.void
emitTableGrow
(IRBuilder ib, Effect effect) Emit code for a WebAssemblytable.grow
instruction.void
emitTableInit
(IRBuilder ib, Effect effect, Var data) Emit code for a WebAssemblytable.init
instruction.void
emitTableRef
(IRBuilder ib, Effect effect) Emit code for a WebAssemblytable.get
instruction.void
emitTableSize
(IRBuilder ib, Effect effect) Emit code for a WebAssemblytable.size
instruction.void
emitTableStore
(IRBuilder ib, Effect effect) Emit code for a WebAssemblytable.set
instruction.void
modifyConstructor
(IRBuilder ib, JClass.JavaMethod ctorMethod, Module module, JClass jClass) Modify the constructor in any way.Methods inherited from class io.github.eutro.wasm2j.core.conf.impl.DelegatingExporter
export, getDelegate
Methods inherited from class io.github.eutro.wasm2j.core.ext.DelegatingExtHolder
getNullable
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.github.eutro.wasm2j.core.conf.itf.ExportableConvention
export
Methods inherited from interface io.github.eutro.wasm2j.core.ext.ExtContainer
attachExt, getExt, getExtOrRun, getExtOrThrow, getNullable, removeExt
Methods inherited from interface io.github.eutro.wasm2j.core.conf.itf.TableConvention
emitBoundsCheck
-
Field Details
-
delegate
The convention calls will be delegated to.
-
-
Constructor Details
-
Delegating
Construct a newTableConvention.Delegating
with the given delegate.- Parameters:
delegate
- The delegate.
-
-
Method Details
-
emitTableRef
Description copied from interface:TableConvention
Emit code for a WebAssemblytable.get
instruction.The effect will have an instruction of type
WasmOps.TABLE_REF
,
with one argument: the index in the table;
it will assign to one variable: the retrieved table element.- Specified by:
emitTableRef
in interfaceTableConvention
- Parameters:
ib
- The instruction builder.effect
- The effect.
-
emitTableStore
Description copied from interface:TableConvention
Emit code for a WebAssemblytable.set
instruction.The effect will have an instruction of type
WasmOps.TABLE_STORE
,
with two arguments: the index in the table, the element to set it to;
it will assign to no variables.- Specified by:
emitTableStore
in interfaceTableConvention
- Parameters:
ib
- The instruction builder.effect
- The effect.
-
emitTableSize
Description copied from interface:TableConvention
Emit code for a WebAssemblytable.size
instruction.The effect will have an instruction of type
WasmOps.TABLE_SIZE
,
with no arguments;
it will assign to one variable: the retrieved table size.- Specified by:
emitTableSize
in interfaceTableConvention
- Parameters:
ib
- The instruction builder.effect
- The effect.
-
emitTableGrow
Description copied from interface:TableConvention
Emit code for a WebAssemblytable.grow
instruction.The effect will have an instruction of type
WasmOps.TABLE_GROW
,
with two arguments: the number of elements to grow by, the element to fill with;
it will assign to one variable: the previous size, or-1
if resizing failed.The default implementation returns
-1
and ignores the arguments.- Specified by:
emitTableGrow
in interfaceTableConvention
- Parameters:
ib
- The instruction builder.effect
- The effect.
-
emitTableInit
Description copied from interface:TableConvention
Emit code for a WebAssemblytable.init
instruction.The effect will have an instruction of type
WasmOps.TABLE_INIT
,
with three arguments: the table index to start at, the elem index to start at, the number of elements to copy;
it will assign to no variables.- Specified by:
emitTableInit
in interfaceTableConvention
- Parameters:
ib
- The instruction builder.effect
- The effect.data
- The array containing the data.
-
emitTableCopy
Description copied from interface:TableConvention
Emit code for a WebAssemblytable.copy
instruction.The effect will have an instruction of type
WasmOps.TABLE_COPY
,
with three arguments: the destination index to start at, the source index to start at, the number of elements to copy;
it will assign to no variables.Implementations are encouraged to override the default implementation when they can more efficiently copy within themselves, or to other instances of the same or similar table conventions.
For example, an array-based implementation would prefer to use
System.arraycopy(Object, int, Object, int, int)
, as it is more efficient, and smaller, than the default implementation.Ext
s should be used to find whether implementations are suitably compatible, as they may be obscured bydelegating
implementations.- Specified by:
emitTableCopy
in interfaceTableConvention
- Parameters:
ib
- The instruction builder.effect
- The effect.dst
- The destination table.
-
emitTableFill
Description copied from interface:TableConvention
Emit code for a WebAssemblytable.fill
instruction.The effect will have an instruction of type
WasmOps.TABLE_FILL
,
with three arguments: the destination index to start at, the element to fill with, the number of elements to fill;
it will assign to no variables.- Specified by:
emitTableFill
in interfaceTableConvention
- Parameters:
ib
- The instruction builder.effect
- The effect.
-
modifyConstructor
public void modifyConstructor(IRBuilder ib, JClass.JavaMethod ctorMethod, Module module, JClass jClass) Description copied from interface:ConstructorCallback
Modify the constructor in any way.- Specified by:
modifyConstructor
in interfaceConstructorCallback
- Parameters:
ib
- The instruction builder.ctorMethod
- The Java method which is the constructor.module
- The WebAssembly module being compiled.jClass
- The Java class being compiled into.
-