summaryrefslogtreecommitdiff
path: root/src/gc/env/gcenv.object.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/gc/env/gcenv.object.h')
-rw-r--r--src/gc/env/gcenv.object.h30
1 files changed, 25 insertions, 5 deletions
diff --git a/src/gc/env/gcenv.object.h b/src/gc/env/gcenv.object.h
index db8995a118..4261c1a148 100644
--- a/src/gc/env/gcenv.object.h
+++ b/src/gc/env/gcenv.object.h
@@ -33,9 +33,11 @@ public:
static_assert(sizeof(ObjHeader) == sizeof(uintptr_t), "this assumption is made by the VM!");
-#define MTFlag_ContainsPointers 1
-#define MTFlag_HasFinalizer 2
-#define MTFlag_IsArray 4
+#define MTFlag_ContainsPointers 0x0100
+#define MTFlag_HasFinalizer 0x0010
+#define MTFlag_IsArray 0x0008
+#define MTFlag_Collectible 0x1000
+#define MTFlag_HasComponentSize 0x8000
class MethodTable
{
@@ -64,6 +66,11 @@ public:
return m_componentSize;
}
+ bool Collectible()
+ {
+ return (m_flags & MTFlag_Collectible) != 0;
+ }
+
bool ContainsPointers()
{
return (m_flags & MTFlag_ContainsPointers) != 0;
@@ -71,12 +78,19 @@ public:
bool ContainsPointersOrCollectible()
{
- return ContainsPointers();
+ return ContainsPointers() || Collectible();
}
bool HasComponentSize()
{
- return m_componentSize != 0;
+ // Note that we can't just check m_componentSize != 0 here. The VM
+ // may still construct a method table that does not have a component
+ // size, according to this method, but still has a number in the low
+ // 16 bits of the method table flags parameter.
+ //
+ // The solution here is to do what the VM does and check the
+ // HasComponentSize flag so that we're on the same page.
+ return (m_flags & MTFlag_HasComponentSize) != 0;
}
bool HasFinalizer()
@@ -104,6 +118,12 @@ public:
{
return true;
}
+
+ uint8_t* GetLoaderAllocatorObjectForGC()
+ {
+ // [LOCALGC TODO] this is not correct
+ return nullptr;
+ }
};
class Object