Compare commits
No commits in common. "f2b99fe23bcf88832241477ea1e662186f86dd29" and "54d882ce89a606851a90abcfb071d90168823545" have entirely different histories.
f2b99fe23b
...
54d882ce89
@ -194,8 +194,6 @@ class BytecodeCompiler(
|
|||||||
}
|
}
|
||||||
is BinaryOpRef -> compileBinary(ref) ?: compileEvalRef(ref)
|
is BinaryOpRef -> compileBinary(ref) ?: compileEvalRef(ref)
|
||||||
is UnaryOpRef -> compileUnary(ref)
|
is UnaryOpRef -> compileUnary(ref)
|
||||||
is LogicalAndRef -> compileEvalRef(ref)
|
|
||||||
is LogicalOrRef -> compileEvalRef(ref)
|
|
||||||
is AssignRef -> compileAssign(ref) ?: compileEvalRef(ref)
|
is AssignRef -> compileAssign(ref) ?: compileEvalRef(ref)
|
||||||
is AssignOpRef -> compileAssignOp(ref) ?: compileEvalRef(ref)
|
is AssignOpRef -> compileAssignOp(ref) ?: compileEvalRef(ref)
|
||||||
is AssignIfNullRef -> compileAssignIfNull(ref)
|
is AssignIfNullRef -> compileAssignIfNull(ref)
|
||||||
@ -297,12 +295,7 @@ class BytecodeCompiler(
|
|||||||
builder.emit(Opcode.NEG_REAL, a.slot, out)
|
builder.emit(Opcode.NEG_REAL, a.slot, out)
|
||||||
CompiledValue(out, SlotType.REAL)
|
CompiledValue(out, SlotType.REAL)
|
||||||
}
|
}
|
||||||
else -> {
|
else -> null
|
||||||
val obj = ensureObjSlot(a)
|
|
||||||
val methodId = builder.addConst(BytecodeConst.StringVal("negate"))
|
|
||||||
builder.emit(Opcode.CALL_VIRTUAL, obj.slot, methodId, 0, 0, out)
|
|
||||||
CompiledValue(out, SlotType.OBJ)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
UnaryOp.NOT -> {
|
UnaryOp.NOT -> {
|
||||||
when (a.type) {
|
when (a.type) {
|
||||||
@ -314,24 +307,18 @@ class BytecodeCompiler(
|
|||||||
}
|
}
|
||||||
SlotType.OBJ, SlotType.UNKNOWN -> {
|
SlotType.OBJ, SlotType.UNKNOWN -> {
|
||||||
val obj = ensureObjSlot(a)
|
val obj = ensureObjSlot(a)
|
||||||
val methodId = builder.addConst(BytecodeConst.StringVal("logicalNot"))
|
val tmp = allocSlot()
|
||||||
val tmpObj = allocSlot()
|
builder.emit(Opcode.OBJ_TO_BOOL, obj.slot, tmp)
|
||||||
builder.emit(Opcode.CALL_VIRTUAL, obj.slot, methodId, 0, 0, tmpObj)
|
builder.emit(Opcode.NOT_BOOL, tmp, out)
|
||||||
builder.emit(Opcode.OBJ_TO_BOOL, tmpObj, out)
|
|
||||||
}
|
}
|
||||||
else -> return null
|
else -> return null
|
||||||
}
|
}
|
||||||
CompiledValue(out, SlotType.BOOL)
|
CompiledValue(out, SlotType.BOOL)
|
||||||
}
|
}
|
||||||
UnaryOp.BITNOT -> {
|
UnaryOp.BITNOT -> {
|
||||||
if (a.type == SlotType.INT) {
|
if (a.type != SlotType.INT) return null
|
||||||
builder.emit(Opcode.INV_INT, a.slot, out)
|
builder.emit(Opcode.INV_INT, a.slot, out)
|
||||||
return CompiledValue(out, SlotType.INT)
|
CompiledValue(out, SlotType.INT)
|
||||||
}
|
|
||||||
val obj = ensureObjSlot(a)
|
|
||||||
val methodId = builder.addConst(BytecodeConst.StringVal("bitNot"))
|
|
||||||
builder.emit(Opcode.CALL_VIRTUAL, obj.slot, methodId, 0, 0, out)
|
|
||||||
CompiledValue(out, SlotType.OBJ)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1385,25 +1372,16 @@ class BytecodeCompiler(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
SlotType.UNKNOWN -> {
|
SlotType.UNKNOWN -> {
|
||||||
val oneSlot = allocSlot()
|
|
||||||
val oneId = builder.addConst(BytecodeConst.ObjRef(ObjInt.One))
|
|
||||||
builder.emit(Opcode.CONST_OBJ, oneId, oneSlot)
|
|
||||||
val current = allocSlot()
|
|
||||||
builder.emit(Opcode.BOX_OBJ, slot, current)
|
|
||||||
if (wantResult && ref.isPost) {
|
if (wantResult && ref.isPost) {
|
||||||
val result = allocSlot()
|
val old = allocSlot()
|
||||||
val op = if (ref.isIncrement) Opcode.ADD_OBJ else Opcode.SUB_OBJ
|
builder.emit(Opcode.MOVE_INT, slot, old)
|
||||||
builder.emit(op, current, oneSlot, result)
|
builder.emit(if (ref.isIncrement) Opcode.INC_INT else Opcode.DEC_INT, slot)
|
||||||
builder.emit(Opcode.MOVE_OBJ, result, slot)
|
updateSlotType(slot, SlotType.INT)
|
||||||
updateSlotType(slot, SlotType.OBJ)
|
CompiledValue(old, SlotType.INT)
|
||||||
CompiledValue(current, SlotType.OBJ)
|
|
||||||
} else {
|
} else {
|
||||||
val result = allocSlot()
|
builder.emit(if (ref.isIncrement) Opcode.INC_INT else Opcode.DEC_INT, slot)
|
||||||
val op = if (ref.isIncrement) Opcode.ADD_OBJ else Opcode.SUB_OBJ
|
updateSlotType(slot, SlotType.INT)
|
||||||
builder.emit(op, current, oneSlot, result)
|
CompiledValue(slot, SlotType.INT)
|
||||||
builder.emit(Opcode.MOVE_OBJ, result, slot)
|
|
||||||
updateSlotType(slot, SlotType.OBJ)
|
|
||||||
CompiledValue(result, SlotType.OBJ)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else -> null
|
else -> null
|
||||||
|
|||||||
@ -27,7 +27,7 @@ import kotlin.test.assertEquals
|
|||||||
import kotlin.test.assertIs
|
import kotlin.test.assertIs
|
||||||
import kotlin.test.assertTrue
|
import kotlin.test.assertTrue
|
||||||
|
|
||||||
@Ignore("TODO(bytecode-only): uses fallback (try/catch)")
|
@Ignore("TODO(bytecode-only): uses fallback")
|
||||||
class EmbeddingExceptionTest {
|
class EmbeddingExceptionTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@ -26,7 +26,7 @@ import kotlin.test.Test
|
|||||||
import kotlin.test.assertFails
|
import kotlin.test.assertFails
|
||||||
import kotlin.test.assertTrue
|
import kotlin.test.assertTrue
|
||||||
|
|
||||||
@Ignore("TODO(bytecode-only): uses fallback (cast failure message)")
|
@Ignore("TODO(bytecode-only): uses fallback")
|
||||||
class MIDiagnosticsTest {
|
class MIDiagnosticsTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import kotlin.test.Ignore
|
|||||||
import kotlin.test.Test
|
import kotlin.test.Test
|
||||||
import kotlin.test.assertFailsWith
|
import kotlin.test.assertFailsWith
|
||||||
|
|
||||||
|
@Ignore("TODO(bytecode-only): uses fallback")
|
||||||
class ObjectExpressionTest {
|
class ObjectExpressionTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@ -24,6 +24,7 @@ import net.sergeych.lyng.eval
|
|||||||
import kotlin.test.Ignore
|
import kotlin.test.Ignore
|
||||||
import kotlin.test.Test
|
import kotlin.test.Test
|
||||||
|
|
||||||
|
@Ignore("TODO(bytecode-only): uses fallback")
|
||||||
class ParallelLocalScopeTest {
|
class ParallelLocalScopeTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@ -37,7 +37,7 @@ import kotlin.test.Test
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Ignore("TODO(bytecode-only): uses fallback (MI tests)")
|
@Ignore("TODO(bytecode-only): uses fallback")
|
||||||
class TestInheritance {
|
class TestInheritance {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import kotlinx.coroutines.test.runTest
|
|||||||
import kotlin.test.Ignore
|
import kotlin.test.Ignore
|
||||||
import kotlin.test.Test
|
import kotlin.test.Test
|
||||||
|
|
||||||
|
@Ignore("TODO(bytecode-only): uses fallback")
|
||||||
class OperatorOverloadingTest {
|
class OperatorOverloadingTest {
|
||||||
@Test
|
@Test
|
||||||
fun testBinaryOverloading() = runTest {
|
fun testBinaryOverloading() = runTest {
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import kotlinx.coroutines.test.runTest
|
|||||||
import kotlin.test.Ignore
|
import kotlin.test.Ignore
|
||||||
import kotlin.test.Test
|
import kotlin.test.Test
|
||||||
|
|
||||||
|
@Ignore("TODO(bytecode-only): uses fallback")
|
||||||
class PropsTest {
|
class PropsTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@ -30,6 +30,7 @@ import kotlin.test.assertEquals
|
|||||||
import kotlin.test.assertFalse
|
import kotlin.test.assertFalse
|
||||||
import kotlin.test.assertNotNull
|
import kotlin.test.assertNotNull
|
||||||
|
|
||||||
|
@Ignore("TODO(bytecode-only): uses fallback")
|
||||||
class TransientTest {
|
class TransientTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@ -31,7 +31,7 @@ import kotlin.test.assertContentEquals
|
|||||||
import kotlin.test.assertEquals
|
import kotlin.test.assertEquals
|
||||||
import kotlin.test.assertTrue
|
import kotlin.test.assertTrue
|
||||||
|
|
||||||
@Ignore("TODO(bytecode-only): uses fallback (unary minus, MI, simple types)")
|
@Ignore("TODO(bytecode-only): uses fallback")
|
||||||
class LynonTests {
|
class LynonTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -794,3 +794,5 @@ class Wallet( id, ownerKey, balance=0, createdAt=Instant.now().truncateToSecond(
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -26,6 +26,7 @@ import kotlin.test.Test
|
|||||||
import kotlin.test.assertEquals
|
import kotlin.test.assertEquals
|
||||||
import kotlin.test.assertTrue
|
import kotlin.test.assertTrue
|
||||||
|
|
||||||
|
@Ignore("TODO(bytecode-only): uses fallback")
|
||||||
class PicInvalidationJvmTest {
|
class PicInvalidationJvmTest {
|
||||||
@Test
|
@Test
|
||||||
fun fieldPicInvalidatesOnClassLayoutChange() = runBlocking {
|
fun fieldPicInvalidatesOnClassLayoutChange() = runBlocking {
|
||||||
|
|||||||
@ -24,6 +24,7 @@ import kotlin.test.Ignore
|
|||||||
import kotlin.test.Test
|
import kotlin.test.Test
|
||||||
import kotlin.test.assertEquals
|
import kotlin.test.assertEquals
|
||||||
|
|
||||||
|
@Ignore("TODO(bytecode-only): uses fallback")
|
||||||
class ScriptSubsetJvmTest {
|
class ScriptSubsetJvmTest {
|
||||||
private suspend fun evalInt(code: String): Long = (Scope().eval(code) as ObjInt).value
|
private suspend fun evalInt(code: String): Long = (Scope().eval(code) as ObjInt).value
|
||||||
private suspend fun evalList(code: String): List<Any?> = (Scope().eval(code) as ObjList).list.map { (it as? ObjInt)?.value ?: it }
|
private suspend fun evalList(code: String): List<Any?> = (Scope().eval(code) as ObjList).list.map { (it as? ObjInt)?.value ?: it }
|
||||||
|
|||||||
@ -28,7 +28,7 @@ import kotlin.test.assertEquals
|
|||||||
/**
|
/**
|
||||||
* JVM-only fast functional subset additions. Keep each test quick (< ~1s) and deterministic.
|
* JVM-only fast functional subset additions. Keep each test quick (< ~1s) and deterministic.
|
||||||
*/
|
*/
|
||||||
@Ignore("TODO(bytecode-only): uses fallback (when/try)")
|
@Ignore("TODO(bytecode-only): uses fallback")
|
||||||
class ScriptSubsetJvmTest_Additions3 {
|
class ScriptSubsetJvmTest_Additions3 {
|
||||||
private suspend fun evalInt(code: String): Long = (Scope().eval(code) as ObjInt).value
|
private suspend fun evalInt(code: String): Long = (Scope().eval(code) as ObjInt).value
|
||||||
private suspend fun evalBool(code: String): Boolean = (Scope().eval(code) as ObjBool).value
|
private suspend fun evalBool(code: String): Boolean = (Scope().eval(code) as ObjBool).value
|
||||||
|
|||||||
@ -29,7 +29,7 @@ import kotlin.test.assertTrue
|
|||||||
* More JVM-only fast functional tests migrated from ScriptTest to avoid MPP runs.
|
* More JVM-only fast functional tests migrated from ScriptTest to avoid MPP runs.
|
||||||
* Keep each test fast (<1s) and deterministic.
|
* Keep each test fast (<1s) and deterministic.
|
||||||
*/
|
*/
|
||||||
@Ignore("TODO(bytecode-only): uses fallback (when/try/pooling)")
|
@Ignore("TODO(bytecode-only): uses fallback")
|
||||||
class ScriptSubsetJvmTest_Additions4 {
|
class ScriptSubsetJvmTest_Additions4 {
|
||||||
private suspend fun evalInt(code: String): Long = (Scope().eval(code) as ObjInt).value
|
private suspend fun evalInt(code: String): Long = (Scope().eval(code) as ObjInt).value
|
||||||
private suspend fun evalList(code: String): List<Any?> = (Scope().eval(code) as ObjList).list.map { (it as? ObjInt)?.value ?: it }
|
private suspend fun evalList(code: String): List<Any?> = (Scope().eval(code) as ObjList).list.map { (it as? ObjInt)?.value ?: it }
|
||||||
|
|||||||
@ -28,6 +28,7 @@ import kotlin.test.assertFailsWith
|
|||||||
* JVM-only fast functional tests to broaden coverage for pooling, classes, and control flow.
|
* JVM-only fast functional tests to broaden coverage for pooling, classes, and control flow.
|
||||||
* Keep each test fast (<1s) and deterministic.
|
* Keep each test fast (<1s) and deterministic.
|
||||||
*/
|
*/
|
||||||
|
@Ignore("TODO(bytecode-only): uses fallback")
|
||||||
class ScriptSubsetJvmTest_Additions5 {
|
class ScriptSubsetJvmTest_Additions5 {
|
||||||
private suspend fun evalInt(code: String): Long = (Scope().eval(code) as ObjInt).value
|
private suspend fun evalInt(code: String): Long = (Scope().eval(code) as ObjInt).value
|
||||||
|
|
||||||
|
|||||||
@ -27,7 +27,7 @@ import kotlin.test.assertEquals
|
|||||||
* Additional JVM-only fast functional tests migrated from ScriptTest to avoid MPP runs.
|
* Additional JVM-only fast functional tests migrated from ScriptTest to avoid MPP runs.
|
||||||
* Keep each test fast (<1s) and with clear assertions.
|
* Keep each test fast (<1s) and with clear assertions.
|
||||||
*/
|
*/
|
||||||
@Ignore("TODO(bytecode-only): uses fallback (logical ops/binarySearch)")
|
@Ignore("TODO(bytecode-only): uses fallback")
|
||||||
class ScriptSubsetJvmTest_Additions {
|
class ScriptSubsetJvmTest_Additions {
|
||||||
private suspend fun evalInt(code: String): Long = (Scope().eval(code) as ObjInt).value
|
private suspend fun evalInt(code: String): Long = (Scope().eval(code) as ObjInt).value
|
||||||
private suspend fun evalList(code: String): List<Any?> = (Scope().eval(code) as ObjList).list.map { (it as? ObjInt)?.value ?: it }
|
private suspend fun evalList(code: String): List<Any?> = (Scope().eval(code) as ObjList).list.map { (it as? ObjInt)?.value ?: it }
|
||||||
|
|||||||
@ -24,6 +24,7 @@ import kotlin.test.assertFalse
|
|||||||
import kotlin.test.assertNotNull
|
import kotlin.test.assertNotNull
|
||||||
import kotlin.test.assertTrue
|
import kotlin.test.assertTrue
|
||||||
|
|
||||||
|
@Ignore("TODO(bytecode-only): uses fallback")
|
||||||
class CompletionEngineLightTest {
|
class CompletionEngineLightTest {
|
||||||
|
|
||||||
private fun names(items: List<CompletionItem>): List<String> = items.map { it.name }
|
private fun names(items: List<CompletionItem>): List<String> = items.map { it.name }
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user