/
SqueakImageFlags.java
55 lines (45 loc) · 1.7 KB
/
SqueakImageFlags.java
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
46
47
48
49
50
51
52
53
54
55
/*
* Copyright (c) 2017-2022 Software Architecture Group, Hasso Plattner Institute
* Copyright (c) 2021-2022 Oracle and/or its affiliates
*
* Licensed under the MIT License.
*/
package de.hpi.swa.trufflesqueak.image;
import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
public final class SqueakImageFlags {
@CompilationFinal private long oldBaseAddress = -1;
@CompilationFinal private long headerFlags;
@CompilationFinal private long snapshotScreenSize;
@CompilationFinal private int maxExternalSemaphoreTableSize;
public void initialize(final long oldBaseAddressValue, final long flags, final long screenSize, final int lastMaxExternalSemaphoreTableSize) {
CompilerDirectives.transferToInterpreterAndInvalidate();
oldBaseAddress = oldBaseAddressValue;
headerFlags = flags;
snapshotScreenSize = screenSize;
maxExternalSemaphoreTableSize = lastMaxExternalSemaphoreTableSize;
}
public long getOldBaseAddress() {
assert oldBaseAddress > 0;
return oldBaseAddress;
}
public long getHeaderFlags() {
return headerFlags;
}
// For some reason, header flags appear to be shifted by 2.
public long getHeaderFlagsDecoded() {
return headerFlags >> 2;
}
public long getSnapshotScreenSize() {
return snapshotScreenSize;
}
public int getSnapshotScreenWidth() {
return (int) snapshotScreenSize >> 16 & 0xffff;
}
public int getSnapshotScreenHeight() {
return (int) snapshotScreenSize & 0xffff;
}
public int getMaxExternalSemaphoreTableSize() {
return maxExternalSemaphoreTableSize;
}
}