From bb442231ea7816c93474affc8540b109b26c7016 Mon Sep 17 00:00:00 2001 From: minjaesong Date: Mon, 23 Nov 2020 15:54:21 +0900 Subject: [PATCH] more minor fixes on things --- src/net/torvald/tsvm/UnsafePtr.kt | 9 ++++----- src/net/torvald/tsvm/peripheral/GraphicsAdapter.kt | 3 +++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/net/torvald/tsvm/UnsafePtr.kt b/src/net/torvald/tsvm/UnsafePtr.kt index f898f8f..d00f690 100644 --- a/src/net/torvald/tsvm/UnsafePtr.kt +++ b/src/net/torvald/tsvm/UnsafePtr.kt @@ -83,12 +83,11 @@ internal class UnsafePtr(pointer: Long, allocSize: Long) { } private inline fun checkNullPtr(index: Long) { // ignore what IDEA says and do inline this - // commenting out because of the suspected (or minor?) performance impact. - // You may break the glass and use this tool when some fucking incomprehensible bugs ("vittujen vitun bugit") - // appear (e.g. getting garbage values when it fucking shouldn't) - assert(!destroyed) { throw NullPointerException("The pointer is already destroyed ($this)") } + //// commenting out because of the suspected (or minor?) performance impact. + //// You may break the glass and use this tool when some fucking incomprehensible bugs ("vittujen vitun bugit") + //// appear (e.g. getting garbage values when it fucking shouldn't) - // OOB Check: debugging purposes only -- comment out for the production + //assert(!destroyed) { throw NullPointerException("The pointer is already destroyed ($this)") } //if (index !in 0 until size) throw IndexOutOfBoundsException("Index: $index; alloc size: $size") } diff --git a/src/net/torvald/tsvm/peripheral/GraphicsAdapter.kt b/src/net/torvald/tsvm/peripheral/GraphicsAdapter.kt index bdee26c..6ffc3a0 100644 --- a/src/net/torvald/tsvm/peripheral/GraphicsAdapter.kt +++ b/src/net/torvald/tsvm/peripheral/GraphicsAdapter.kt @@ -31,6 +31,9 @@ data class AdapterConfig( val paletteShader: String = DRAW_SHADER_FRAG ) +/** + * NOTE: if TTY size is greater than 80*32, SEGFAULT will occur because text buffer is fixed in size + */ open class GraphicsAdapter(val vm: VM, val config: AdapterConfig) : GlassTty(config.textRows, config.textCols), PeriBase {