24
#include "precompiled.hpp"
25
#include "gc/x/xAddress.hpp"
26
#include "gc/x/xGlobals.hpp"
28
void XAddress::set_good_mask(uintptr_t mask) {
29
XAddressGoodMask = mask;
30
XAddressBadMask = XAddressGoodMask ^ XAddressMetadataMask;
31
XAddressWeakBadMask = (XAddressGoodMask | XAddressMetadataRemapped | XAddressMetadataFinalizable) ^ XAddressMetadataMask;
34
void XAddress::initialize() {
35
XAddressOffsetBits = XPlatformAddressOffsetBits();
36
XAddressOffsetMask = (((uintptr_t)1 << XAddressOffsetBits) - 1) << XAddressOffsetShift;
37
XAddressOffsetMax = (uintptr_t)1 << XAddressOffsetBits;
39
XAddressMetadataShift = XPlatformAddressMetadataShift();
40
XAddressMetadataMask = (((uintptr_t)1 << XAddressMetadataBits) - 1) << XAddressMetadataShift;
42
XAddressMetadataMarked0 = (uintptr_t)1 << (XAddressMetadataShift + 0);
43
XAddressMetadataMarked1 = (uintptr_t)1 << (XAddressMetadataShift + 1);
44
XAddressMetadataRemapped = (uintptr_t)1 << (XAddressMetadataShift + 2);
45
XAddressMetadataFinalizable = (uintptr_t)1 << (XAddressMetadataShift + 3);
47
XAddressMetadataMarked = XAddressMetadataMarked0;
48
set_good_mask(XAddressMetadataRemapped);
51
void XAddress::flip_to_marked() {
52
XAddressMetadataMarked ^= (XAddressMetadataMarked0 | XAddressMetadataMarked1);
53
set_good_mask(XAddressMetadataMarked);
56
void XAddress::flip_to_remapped() {
57
set_good_mask(XAddressMetadataRemapped);