WARNING! Access to this system is limited to authorised users only.
Unauthorised users may be subject to prosecution.
Unauthorised access to this system is a criminal offence under Australian law (Federal Crimes Act 1914 Part VIA)
It is a criminal offence to:
(1) Obtain access to data without authority. -Penalty 2 years imprisonment.
(2) Damage, delete, alter or insert data without authority. -Penalty 10 years imprisonment.
User activity is monitored and recorded. Anyone using this system expressly consents to such monitoring and recording.

To protect your data, the CISO officer has suggested users to enable 2FA as soon as possible.
Currently 2.7% of users enabled 2FA.

HeaderUtils.scala 1.24 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package uvm.refimpl.mem

import uvm.types.Type
import uvm.refimpl.MicroVM
import uvm.refimpl.mem.TypeSizes.Word
import com.typesafe.scalalogging._
import org.slf4j.LoggerFactory

object HeaderUtils extends StrictLogging {

  def postAllocScalar(addr: Word, tag: Long) {
    setTag(addr, tag)
  }

  def postAllocHybrid(addr: Word, tag: Long, len: Long) {
    postAllocScalar(addr, tag)
    setVarLength(addr, len)
  }

  def getTag(objRef: Word): Long = {
    MemorySupport.loadLong(objRef + TypeSizes.GC_HEADER_OFFSET_TAG)
  }

  def getVarLength(objRef: Word): Long = {
    MemorySupport.loadLong(objRef + TypeSizes.GC_HEADER_OFFSET_HYBRID_LENGTH)
  }

  def setTag(objRef: Word, tag: Long) {
    logger.debug(s"Storing tag ${tag} at addr ${TypeSizes.GC_HEADER_OFFSET_TAG}")
    MemorySupport.storeLong(objRef + TypeSizes.GC_HEADER_OFFSET_TAG, tag)
  }

  def setVarLength(objRef: Word, len: Long) {
    MemorySupport.storeLong(objRef + TypeSizes.GC_HEADER_OFFSET_HYBRID_LENGTH, len)
  }

  def getTypeID(tag: Long): Int = (tag & 0x00000000ffffffffL).toInt

  def getType(microVM: MicroVM, tag: Long): Type = {
    val typeID = getTypeID(tag)
    microVM.globalBundle.typeNs(typeID)
  }

  def getForwardedDest(oldHeader: Long): Long = oldHeader & 0x0000ffffffffffffL
}