Skip to content
Merged
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
8 changes: 4 additions & 4 deletions compiler/src/main/kotlin/asmble/compile/jvm/ByteBufferMem.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ open class ByteBufferMem(val direct: Boolean = true) : Mem {
override fun init(func: Func, initial: Int) = func.popExpecting(memType).addInsns(
// Set the limit to initial
(initial * Mem.PAGE_SIZE).const,
forceFnType<ByteBuffer.(Int) -> Buffer>(ByteBuffer::limit).invokeVirtual(),
forceFnType<ByteBuffer.(Int) -> Buffer>(Buffer::limit).invokeVirtual(),
TypeInsnNode(Opcodes.CHECKCAST, ByteBuffer::class.ref.asmName),
// Set it to use little endian
ByteOrder::LITTLE_ENDIAN.getStatic(),
Expand All @@ -45,7 +45,7 @@ open class ByteBufferMem(val direct: Boolean = true) : Mem {
addInsns(ByteBuffer::duplicate.invokeVirtual()).
let(buildOffset).popExpecting(Int::class.ref).
addInsns(
forceFnType<ByteBuffer.(Int) -> Buffer>(ByteBuffer::position).invokeVirtual(),
forceFnType<ByteBuffer.(Int) -> Buffer>(Buffer::position).invokeVirtual(),
TypeInsnNode(Opcodes.CHECKCAST, memType.asmName)
).addInsns(
// We're going to do this as an LDC string in ISO-8859 and read it back at runtime. However,
Expand Down Expand Up @@ -111,7 +111,7 @@ open class ByteBufferMem(val direct: Boolean = true) : Mem {
InsnNode(Opcodes.IRETURN),
okLim, // [lim, mem, newlimL]
InsnNode(Opcodes.L2I), // [lim, mem, newlim]
forceFnType<ByteBuffer.(Int) -> Buffer>(ByteBuffer::limit).invokeVirtual(), // [lim, mem]
forceFnType<ByteBuffer.(Int) -> Buffer>(Buffer::limit).invokeVirtual(), // [lim, mem]
InsnNode(Opcodes.POP), // [lim]
Mem.PAGE_SIZE.const, // [lim, pagesize]
InsnNode(Opcodes.IDIV), // [limpages]
Expand Down Expand Up @@ -261,4 +261,4 @@ open class ByteBufferMem(val direct: Boolean = true) : Mem {
override val storeLeavesMemOnStack get() = true

companion object : ByteBufferMem()
}
}