File tree Expand file tree Collapse file tree 7 files changed +50
-17
lines changed Expand file tree Collapse file tree 7 files changed +50
-17
lines changed Original file line number Diff line number Diff line change 1
- str s2 "I love men? !>"
2
- lit s1 24
3
- str f1 "kys"
4
- printr s1
5
- call io.println
6
- printr s1
1
+
2
+ lit f1 15
3
+ call alloc f1
Original file line number Diff line number Diff line change @@ -25,6 +25,8 @@ fun main(args: Array<String>): Unit = runBlocking(newSingleThreadContext("Kotlin
25
25
println (" Usage: mvm <command> [options]" )
26
26
exitProcess(1 )
27
27
}
28
+
29
+
28
30
when (args[0 ]) {
29
31
" irun" -> {
30
32
if (args.size < 2 ) {
@@ -50,8 +52,9 @@ fun main(args: Array<String>): Unit = runBlocking(newSingleThreadContext("Kotlin
50
52
println (" Usage: mvm tokenise <file.kar>" )
51
53
exitProcess(1 )
52
54
}
53
- println (" Deprecated!" )
54
- // VarRedundancy(globalInfo = parser(init, File(args[1]).readLines())).cleanRedundancy().forEach(::println)
55
+ println (
56
+ " Deprecated!"
57
+ ) // VarRedundancy(globalInfo = parser(init, File(args[1]).readLines())).cleanRedundancy().forEach(::println)
55
58
}
56
59
57
60
Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ import internals.instructions.xFloats.xMul
49
49
import internals.instructions.xFloats.xPow
50
50
import internals.instructions.xFloats.xSub
51
51
import kernel.process.KProcess
52
+ import os
52
53
53
54
54
55
class Execute (val kp : KProcess ) {
@@ -62,9 +63,11 @@ class Execute(val kp: KProcess) {
62
63
kp.vm.errors.invalidPcValueException((kp.vm.pc).toString())
63
64
}
64
65
66
+ os.snapShotManager.populateSnapShotRegister(kp) // Broken???
65
67
66
68
exeWhen(command.name, command.values)
67
69
70
+ os.snapShotManager.snapShotRegisters(kp) // Also broken????
68
71
kp.vm.pc++
69
72
70
73
}
@@ -112,8 +115,7 @@ class Execute(val kp: KProcess) {
112
115
suspend fun exeWhen (name : String , args : Array <Any ?>): Unit? { // This has to be suspended. I know it's terrible!
113
116
val vm = kp.vm
114
117
kp.currentInstruction = InstructData (name, args)
115
-
116
- kp.debug.act()
118
+ // kp.debug.act()
117
119
118
120
119
121
when (name) {
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import data.registers.RegisterType
4
4
import data.registers.Registers
5
5
import internals.Vm
6
6
import kernel.process.KProcess
7
-
7
+ // @Depre
8
8
class SnapShotManager (private val registers : Registers ) {
9
9
10
10
private val snapshots = mutableMapOf<KProcess , Map <RegisterType , Long >>()
@@ -16,9 +16,9 @@ class SnapShotManager(private val registers: Registers) {
16
16
17
17
}
18
18
19
- fun snapShotRegisters (kProcess : KProcess ) {
19
+ fun snapShotRegisters (kProcess : KProcess ) { // TODO NOT WORKING!!!
20
20
val allRegisters = mutableMapOf<RegisterType , Long >()
21
- for (i in RegisterType .entries) {
21
+ for (i in RegisterType .entries) { // NOT WORKING!
22
22
allRegisters[i] = registers.read(i)
23
23
}
24
24
snapshots[kProcess] = allRegisters // println("${kProcess.file.name}:${kProcess.vm.pc} -> [SNAPSHOT]")
Original file line number Diff line number Diff line change @@ -11,9 +11,11 @@ suspend fun ExecuteLib.executeKt(name: String) {
11
11
val newVm = Vm ()
12
12
val registerReserves =
13
13
vm.registers.registers.map { (k, v) -> k to v.copy() }.toMap()
14
+
14
15
val newKp = KProcess (newVm, File (" \$ lib-$name " ), isKlib = true )
15
- os.snapShotManager.snapShotRegisters(newKp)
16
+ // os.snapShotManager.snapShotRegisters(newKp)
16
17
for (registerType in registerReserves) vm.registers.registers[registerType.key] = registerType.value
17
18
if (! Klib (newKp).match(name)) vm.errors.missingLibraryException(name) // Kt should be the last resort
18
19
currentFunction = name
20
+
19
21
}
Original file line number Diff line number Diff line change @@ -11,15 +11,16 @@ import java.io.File
11
11
@OptIn(UnstableSnapShots ::class )
12
12
suspend fun ExecuteLib.executeMar (file : File ) {
13
13
14
- val localKp = KProcess (Vm (), file)
15
- os.snapShotManager.snapShotRegisters(kp )
14
+ val localKp = KProcess (Vm (), file) // os.snapShotManager.snapShotRegisters(kp)
15
+ val registerReserves = vm.registers.registers.map { (k, v) -> k to v.copy() }.toMap( )
16
16
17
17
val oldInstructs = kp.instructionMemory
18
18
19
19
localKp.instructionMemory = parserReturn(localKp.vm, file.readLines())
20
20
localKp.notifyOS()
21
+ for (registerType in registerReserves) vm.registers.registers[registerType.key] = registerType.value
21
22
22
23
kp.instructionMemory = oldInstructs
23
24
24
- os.snapShotManager.populateSnapShotRegister(kp)
25
+ // os.snapShotManager.populateSnapShotRegister(kp)
25
26
}
Original file line number Diff line number Diff line change
1
+ package kilb
2
+
3
+ import kernel.process.KProcess
4
+
5
+ class Ll (kp : KProcess ) {
6
+ val h = kp.addressSpace.heap
7
+ fun create (): Long {
8
+ val initP = h.alloc(2 )
9
+ return initP
10
+ }
11
+
12
+ fun add (ll : Long , element : Long ) {
13
+ // val addr = h.get()
14
+ }
15
+
16
+ fun getAt (index : Long ) {
17
+
18
+ }
19
+
20
+ fun removeAt (index : Long ) {}
21
+
22
+ fun clean () {}
23
+
24
+ fun findL () {}
25
+
26
+ fun findR () {}
27
+
28
+ }
You can’t perform that action at this time.
0 commit comments