To protect your data, the CISO officer has suggested users to enable GitLab 2FA as soon as possible.

MemoryManager.scala 751 Bytes
Newer Older
1
2
package uvm.refimpl.mem

Kunshan Wang's avatar
Kunshan Wang committed
3
4
5
import uvm.refimpl._
import TypeSizes._
import uvm.refimpl.mem.simpleimmix._
6
7
8
9
10
11
import MemoryManager._

object MemoryManager {
  val MEMORY_BEGIN = 0x100000L
}

Kunshan Wang's avatar
Kunshan Wang committed
12
class MemoryManager(val heapSize: Word, val globalSize: Word, val stackSize: Word, microVM: MicroVM) {
13

Kunshan Wang's avatar
Kunshan Wang committed
14
  val heap = new SimpleImmixHeap(MEMORY_BEGIN, heapSize, microVM)
15
16
17

  val globalMemory = new GlobalMemory(MEMORY_BEGIN + heapSize, globalSize, microVM)

Kunshan Wang's avatar
Kunshan Wang committed
18
  private val internalMutator = heap.makeMutator()
19

Kunshan Wang's avatar
Kunshan Wang committed
20
  def makeMutator(): Mutator = heap.makeMutator()
21

Kunshan Wang's avatar
Kunshan Wang committed
22
23
24
25
26
  def makeStackMemory(): StackMemory = {
    val objRef = internalMutator.newHybrid(InternalTypes.BYTE_ARRAY, stackSize)
    val stackMemory = new StackMemory(objRef, stackSize, microVM)
    stackMemory
  }
27
}