1// Licensed to the .NET Foundation under one or more agreements.
2// The .NET Foundation licenses this file to you under the MIT license.
3// See the LICENSE file in the project root for more information.
4//
5// classloadlevel.h
6
7
8#ifndef _H_CLASSLOADLEVEL
9#define _H_CLASSLOADLEVEL
10
11// Class loading is split into phases in order to handle recursion
12// through field types and generic instantiations in the presence of
13// multiple threads and the possibility of load failures.
14//
15// This enum represents the level to which a class has been loaded.
16// (See GetLoadLevel() on TypeHandle, MethodTable and TypeDesc).
17//
18// CLASS_LOAD_BEGIN
19//
20// Placeholder level used before type has been created or located in ngen image
21//
22//
23// CLASS_LOAD_UNRESTOREDTYPEKEY
24//
25// Type lives in an ngen image and components of its type key need restoring:
26// for methodtables: generic arguments, EEClass pointer, Module pointer in EEClass
27// for typedescs: param type, template methodtable
28//
29//
30// CLASS_LOAD_UNRESTORED
31//
32// Type lives in an ngen image and contains fields that need restoring
33// (e.g. parent, interfaces, param type)
34//
35//
36// CLASS_LOAD_APPROXPARENTS
37//
38// Type has been created, or loaded from an ngen image and fields
39// have been restored, but some fields have been filled in with only
40// "approximate" information for generic type arguments. In
41// particular, the parent class is approximate, and interfaces are
42// generic (instantiation at formal type parameters). Other
43// information (vtable and dictionary) may be based on these
44// approximate type arguments.
45//
46//
47// CLASS_LOAD_EXACTPARENTS
48//
49// The generic arguments to parent class and interfaces are exact
50// types, and the whole hierarchy (parent and interfaces) is loaded
51// to this level. However, other dependent types (such as generic arguments)
52// may still be loaded at a lower level.
53//
54//
55// CLASS_DEPENDENCIES_LOADED
56//
57// The type is fully loaded, as are all dependents (hierarchy, generic args,
58// canonical MT, etc). For generic instantiations, the constraints
59// have not yet been verified.
60//
61//
62// CLASS_LOADED
63//
64// This is a "read-only" verification phase that changes no state other than
65// to flip the IsFullyLoaded() bit. We use this phase to do conformity
66// checks (which can't be done in an earlier phase) on the class in a
67// recursion-proof manner.
68// For eg, we check constraints on generic types, and access checks for
69// the type of (valuetype) fields.
70//
71
72enum ClassLoadLevel
73{
74 CLASS_LOAD_BEGIN,
75 CLASS_LOAD_UNRESTOREDTYPEKEY,
76 CLASS_LOAD_UNRESTORED,
77 CLASS_LOAD_APPROXPARENTS,
78 CLASS_LOAD_EXACTPARENTS,
79 CLASS_DEPENDENCIES_LOADED,
80 CLASS_LOADED,
81
82 CLASS_LOAD_LEVEL_FINAL = CLASS_LOADED,
83};
84
85
86extern const char * const classLoadLevelName[];
87
88#endif // _H_CLASSLOADLEVEL
89