blob: 164f8c4d1a60c3a92f4fb78df375143f5fb3852a (
plain)
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
//
// Implementations of functions dealing with object layout related types.
//
#include "common.h"
#include "CommonTypes.h"
#include "CommonMacros.h"
#include "daccess.h"
#include "rhassert.h"
#include "RedhawkWarnings.h"
#include "PalRedhawkCommon.h"
#include "PalRedhawk.h"
#include "TargetPtrs.h"
#include "eetype.h"
#include "ObjectLayout.h"
#ifndef DACCESS_COMPILE
void Object::InitEEType(EEType * pEEType)
{
ASSERT(NULL == m_pEEType);
m_pEEType = pEEType;
}
#endif
UInt32 Array::GetArrayLength()
{
return m_Length;
}
void* Array::GetArrayData()
{
UInt8* pData = (UInt8*)this;
pData += (get_EEType()->get_BaseSize() - sizeof(ObjHeader));
return pData;
}
#ifndef DACCESS_COMPILE
void Array::InitArrayLength(UInt32 length)
{
ASSERT(NULL == m_Length);
m_Length = length;
}
void ObjHeader::SetBit(UInt32 uBit)
{
PalInterlockedOr(&m_uSyncBlockValue, uBit);
}
void ObjHeader::ClrBit(UInt32 uBit)
{
PalInterlockedAnd(&m_uSyncBlockValue, ~uBit);
}
size_t Object::GetSize()
{
EEType * pEEType = get_EEType();
// strings have component size2, all other non-arrays should have 0
ASSERT(( pEEType->get_ComponentSize() <= 2) || pEEType->IsArray());
size_t s = pEEType->get_BaseSize();
UInt16 componentSize = pEEType->get_ComponentSize();
if (componentSize > 0)
s += ((Array*)this)->GetArrayLength() * componentSize;
return s;
}
#endif
|