This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
/
corinfo.h
3271 lines (2748 loc) · 146 KB
/
corinfo.h
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// 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.
//
/*****************************************************************************\
* *
* CorInfo.h - EE / Code generator interface *
* *
*******************************************************************************
*
* This file exposes CLR runtime functionality. It can be used by compilers,
* both Just-in-time and ahead-of-time, to generate native code which
* executes in the runtime environment.
*******************************************************************************
//////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE
//
// The JIT/EE interface is versioned. By "interface", we mean mean any and all communication between the
// JIT and the EE. Any time a change is made to the interface, the JIT/EE interface version identifier
// must be updated. See code:JITEEVersionIdentifier for more information.
//
// NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////
#EEJitContractDetails
The semantic contract between the EE and the JIT should be documented here It is incomplete, but as time goes
on, that hopefully will change
See file:../../doc/BookOfTheRuntime/JIT/JIT%20Design.doc for details on the JIT compiler. See
code:EEStartup#TableOfContents for information on the runtime as a whole.
-------------------------------------------------------------------------------
#Tokens
The tokens in IL stream needs to be resolved to EE handles (CORINFO_CLASS/METHOD/FIELD_HANDLE) that
the runtime operates with. ICorStaticInfo::resolveToken is the method that resolves the found in IL stream
to set of EE handles (CORINFO_RESOLVED_TOKEN). All other APIs take resolved token as input. This design
avoids redundant token resolutions.
The token validation is done as part of token resolution. The JIT is not required to do explicit upfront
token validation.
-------------------------------------------------------------------------------
#ClassConstruction
First of all class contruction comes in two flavors precise and 'beforeFieldInit'. In C# you get the former
if you declare an explicit class constructor method and the later if you declaratively initialize static
fields. Precise class construction guarentees that the .cctor is run precisely before the first access to any
method or field of the class. 'beforeFieldInit' semantics guarentees only that the .cctor will be run some
time before the first static field access (note that calling methods (static or insance) or accessing
instance fields does not cause .cctors to be run).
Next you need to know that there are two kinds of code generation that can happen in the JIT: appdomain
neutral and appdomain specialized. The difference between these two kinds of code is how statics are handled.
For appdomain specific code, the address of a particular static variable is embeded in the code. This makes
it usable only for one appdomain (since every appdomain gets a own copy of its statics). Appdomain neutral
code calls a helper that looks up static variables off of a thread local variable. Thus the same code can be
used by mulitple appdomains in the same process.
Generics also introduce a similar issue. Code for generic classes might be specialised for a particular set
of type arguments, or it could use helpers to access data that depends on type parameters and thus be shared
across several instantiations of the generic type.
Thus there four cases
* BeforeFieldInitCCtor - Unshared code. Cctors are only called when static fields are fetched. At the
time the method that touches the static field is JITed (or fixed up in the case of NGENed code), the
.cctor is called.
* BeforeFieldInitCCtor - Shared code. Since the same code is used for multiple classes, the act of JITing
the code can not be used as a hook. However, it is also the case that since the code is shared, it
can not wire in a particular address for the static and thus needs to use a helper that looks up the
correct address based on the thread ID. This helper does the .cctor check, and thus no additional
cctor logic is needed.
* PreciseCCtor - Unshared code. Any time a method is JITTed (or fixed up in the case of NGEN), a cctor
check for the class of the method being JITTed is done. In addition the JIT inserts explicit checks
before any static field accesses. Instance methods and fields do NOT have hooks because a .ctor
method must be called before the instance can be created.
* PreciseCctor - Shared code .cctor checks are placed in the prolog of every .ctor and static method. All
methods that access static fields have an explicit .cctor check before use. Again instance methods
don't have hooks because a .ctor would have to be called first.
Technically speaking, however the optimization of avoiding checks on instance methods is flawed. It requires
that a .ctor always preceed a call to an instance methods. This break down when
* A NULL is passed to an instance method.
* A .ctor does not call its superclasses .ctor. This allows an instance to be created without necessarily
calling all the .cctors of all the superclasses. A virtual call can then be made to a instance of a
superclass without necessarily calling the superclass's .cctor.
* The class is a value class (which exists without a .ctor being called)
Nevertheless, the cost of plugging these holes is considered to high and the benefit is low.
----------------------------------------------------------------------
#ClassConstructionFlags
Thus the JIT's cctor responsibilities require it to check with the EE on every static field access using
initClass and before jitting any method to see if a .cctor check must be placed in the prolog.
* CORINFO_FLG_BEFOREFIELDINIT indicate the class has beforeFieldInit semantics. The jit does not strictly
need this information however, it is valuable in optimizing static field fetch helper calls. Helper
call for classes with BeforeFieldInit semantics can be hoisted before other side effects where
classes with precise .cctor semantics do not allow this optimization.
Inlining also complicates things. Because the class could have precise semantics it is also required that the
inlining of any constructor or static method must also do the initClass check. The inliner has the option of
inserting any required runtime check or simply not inlining the function.
-------------------------------------------------------------------------------
#StaticFields
The first 4 options are mutially exclusive
* CORINFO_FLG_HELPER If the field has this set, then the JIT must call getFieldHelper and call the
returned helper with the object ref (for an instance field) and a fieldDesc. Note that this should be
able to handle ANY field so to get a JIT up quickly, it has the option of using helper calls for all
field access (and skip the complexity below). Note that for statics it is assumed that you will
alwasy ask for the ADDRESSS helper and to the fetch in the JIT.
* CORINFO_FLG_SHARED_HELPER This is currently only used for static fields. If this bit is set it means
that the field is feched by a helper call that takes a module identifier (see getModuleDomainID) and
a class identifier (see getClassDomainID) as arguments. The exact helper to call is determined by
getSharedStaticBaseHelper. The return value is of this function is the base of all statics in the
module. The offset from getFieldOffset must be added to this value to get the address of the field
itself. (see also CORINFO_FLG_STATIC_IN_HEAP).
* CORINFO_FLG_GENERICS_STATIC This is currently only used for static fields (of generic type). This
function is intended to be called with a Generic handle as a argument (from embedGenericHandle). The
exact helper to call is determined by getSharedStaticBaseHelper. The returned value is the base of
all statics in the class. The offset from getFieldOffset must be added to this value to get the
address of the (see also CORINFO_FLG_STATIC_IN_HEAP).
* CORINFO_FLG_TLS This indicate that the static field is a Windows style Thread Local Static. (We also
have managed thread local statics, which work through the HELPER. Support for this is considered
legacy, and going forward, the EE should
* <NONE> This is a normal static field. Its address in in memory is determined by getFieldAddress. (see
also CORINFO_FLG_STATIC_IN_HEAP).
This last field can modify any of the cases above except CORINFO_FLG_HELPER
CORINFO_FLG_STATIC_IN_HEAP This is currently only used for static fields of value classes. If the field has
this set then after computing what would normally be the field, what you actually get is a object pointer
(that must be reported to the GC) to a boxed version of the value. Thus the actual field address is computed
by addr = (*addr+sizeof(OBJECTREF))
Instance fields
* CORINFO_FLG_HELPER This is used if the class is MarshalByRef, which means that the object might be a
proxyt to the real object in some other appdomain or process. If the field has this set, then the JIT
must call getFieldHelper and call the returned helper with the object ref. If the helper returned is
helpers that are for structures the args are as follows
* CORINFO_HELP_GETFIELDSTRUCT - args are: retBuff, object, fieldDesc
* CORINFO_HELP_SETFIELDSTRUCT - args are object fieldDesc value
The other GET helpers take an object fieldDesc and return the value The other SET helpers take an object
fieldDesc and value
Note that unlike static fields there is no helper to take the address of a field because in general there
is no address for proxies (LDFLDA is illegal on proxies).
CORINFO_FLG_EnC This is to support adding new field for edit and continue. This field also indicates that
a helper is needed to access this field. However this helper is always CORINFO_HELP_GETFIELDADDR, and
this helper always takes the object and field handle and returns the address of the field. It is the
JIT's responcibility to do the fetch or set.
-------------------------------------------------------------------------------
TODO: Talk about initializing strutures before use
*******************************************************************************
*/
#ifndef _COR_INFO_H_
#define _COR_INFO_H_
#include <corhdr.h>
#include <specstrings.h>
//////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE
//
// #JITEEVersionIdentifier
//
// This GUID represents the version of the JIT/EE interface. Any time the interface between the JIT and
// the EE changes (by adding or removing methods to any interface shared between them), this GUID should
// be changed. This is the identifier verified by ICorJitCompiler::getVersionIdentifier().
//
// You can use "uuidgen.exe -s" to generate this value.
//
// **** NOTE TO INTEGRATORS:
//
// If there is a merge conflict here, because the version changed in two different places, you must
// create a **NEW** GUID, not simply choose one or the other!
//
// NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////
#if !defined(SELECTANY)
#if defined(__GNUC__)
#define SELECTANY extern __attribute__((weak))
#else
#define SELECTANY extern __declspec(selectany)
#endif
#endif
SELECTANY const GUID JITEEVersionIdentifier = { /* aec2498a-ca70-408e-903e-1e6d84e90bd2 */
0xaec2498a,
0xca70,
0x408e,
{0x90, 0x3e, 0x1e, 0x6d, 0x84, 0xe9, 0x0b, 0xd2}
};
//////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// END JITEEVersionIdentifier
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////
// For System V on the CLR type system number of registers to pass in and return a struct is the same.
// The CLR type system allows only up to 2 eightbytes to be passed in registers. There is no SSEUP classification types.
#define CLR_SYSTEMV_MAX_EIGHTBYTES_COUNT_TO_PASS_IN_REGISTERS 2
#define CLR_SYSTEMV_MAX_EIGHTBYTES_COUNT_TO_RETURN_IN_REGISTERS 2
#define CLR_SYSTEMV_MAX_STRUCT_BYTES_TO_PASS_IN_REGISTERS 16
// System V struct passing
// The Classification types are described in the ABI spec at http://www.x86-64.org/documentation/abi.pdf
enum SystemVClassificationType : unsigned __int8
{
SystemVClassificationTypeUnknown = 0,
SystemVClassificationTypeStruct = 1,
SystemVClassificationTypeNoClass = 2,
SystemVClassificationTypeMemory = 3,
SystemVClassificationTypeInteger = 4,
SystemVClassificationTypeIntegerReference = 5,
SystemVClassificationTypeIntegerByRef = 6,
SystemVClassificationTypeSSE = 7,
// SystemVClassificationTypeSSEUp = Unused, // Not supported by the CLR.
// SystemVClassificationTypeX87 = Unused, // Not supported by the CLR.
// SystemVClassificationTypeX87Up = Unused, // Not supported by the CLR.
// SystemVClassificationTypeComplexX87 = Unused, // Not supported by the CLR.
// Internal flags - never returned outside of the classification implementation.
// This value represents a very special type with two eightbytes.
// First ByRef, second Integer (platform int).
// The VM has a special Elem type for this type - ELEMENT_TYPE_TYPEDBYREF.
// This is the classification counterpart for that element type. It is used to detect
// the special TypedReference type and specialize its classification.
// This type is represented as a struct with two fields. The classification needs to do
// special handling of it since the source/methadata type of the fieds is IntPtr.
// The VM changes the first to ByRef. The second is left as IntPtr (TYP_I_IMPL really). The classification needs to match this and
// special handling is warranted (similar thing is done in the getGCLayout function for this type).
SystemVClassificationTypeTypedReference = 8,
SystemVClassificationTypeMAX = 9,
};
// Represents classification information for a struct.
struct SYSTEMV_AMD64_CORINFO_STRUCT_REG_PASSING_DESCRIPTOR
{
SYSTEMV_AMD64_CORINFO_STRUCT_REG_PASSING_DESCRIPTOR()
{
Initialize();
}
bool passedInRegisters; // Whether the struct is passable/passed (this includes struct returning) in registers.
unsigned __int8 eightByteCount; // Number of eightbytes for this struct.
SystemVClassificationType eightByteClassifications[CLR_SYSTEMV_MAX_EIGHTBYTES_COUNT_TO_PASS_IN_REGISTERS]; // The eightbytes type classification.
unsigned __int8 eightByteSizes[CLR_SYSTEMV_MAX_EIGHTBYTES_COUNT_TO_PASS_IN_REGISTERS]; // The size of the eightbytes (an eightbyte could include padding. This represents the no padding size of the eightbyte).
unsigned __int8 eightByteOffsets[CLR_SYSTEMV_MAX_EIGHTBYTES_COUNT_TO_PASS_IN_REGISTERS]; // The start offset of the eightbytes (in bytes).
// Members
//------------------------------------------------------------------------
// CopyFrom: Copies a struct classification into this one.
//
// Arguments:
// 'copyFrom' the struct classification to copy from.
//
void CopyFrom(const SYSTEMV_AMD64_CORINFO_STRUCT_REG_PASSING_DESCRIPTOR& copyFrom)
{
passedInRegisters = copyFrom.passedInRegisters;
eightByteCount = copyFrom.eightByteCount;
for (int i = 0; i < CLR_SYSTEMV_MAX_EIGHTBYTES_COUNT_TO_PASS_IN_REGISTERS; i++)
{
eightByteClassifications[i] = copyFrom.eightByteClassifications[i];
eightByteSizes[i] = copyFrom.eightByteSizes[i];
eightByteOffsets[i] = copyFrom.eightByteOffsets[i];
}
}
//------------------------------------------------------------------------
// IsIntegralSlot: Returns whether the eightbyte at slotIndex is of integral type.
//
// Arguments:
// 'slotIndex' the slot number we are determining if it is of integral type.
//
// Return value:
// returns true if we the eightbyte at index slotIndex is of integral type.
//
bool IsIntegralSlot(unsigned slotIndex) const
{
return ((eightByteClassifications[slotIndex] == SystemVClassificationTypeInteger) ||
(eightByteClassifications[slotIndex] == SystemVClassificationTypeIntegerReference) ||
(eightByteClassifications[slotIndex] == SystemVClassificationTypeIntegerByRef));
}
//------------------------------------------------------------------------
// IsSseSlot: Returns whether the eightbyte at slotIndex is SSE type.
//
// Arguments:
// 'slotIndex' the slot number we are determining if it is of SSE type.
//
// Return value:
// returns true if we the eightbyte at index slotIndex is of SSE type.
//
// Follows the rules of the AMD64 System V ABI specification at www.x86-64.org/documentation/abi.pdf.
// Please refer to it for definitions/examples.
//
bool IsSseSlot(unsigned slotIndex) const
{
return (eightByteClassifications[slotIndex] == SystemVClassificationTypeSSE);
}
private:
void Initialize()
{
passedInRegisters = false;
eightByteCount = 0;
for (int i = 0; i < CLR_SYSTEMV_MAX_EIGHTBYTES_COUNT_TO_PASS_IN_REGISTERS; i++)
{
eightByteClassifications[i] = SystemVClassificationTypeUnknown;
eightByteSizes[i] = 0;
eightByteOffsets[i] = 0;
}
}
};
// CorInfoHelpFunc defines the set of helpers (accessed via the ICorDynamicInfo::getHelperFtn())
// These helpers can be called by native code which executes in the runtime.
// Compilers can emit calls to these helpers.
//
// The signatures of the helpers are below (see RuntimeHelperArgumentCheck)
enum CorInfoHelpFunc
{
CORINFO_HELP_UNDEF, // invalid value. This should never be used
/* Arithmetic helpers */
CORINFO_HELP_DIV, // For the ARM 32-bit integer divide uses a helper call :-(
CORINFO_HELP_MOD,
CORINFO_HELP_UDIV,
CORINFO_HELP_UMOD,
CORINFO_HELP_LLSH,
CORINFO_HELP_LRSH,
CORINFO_HELP_LRSZ,
CORINFO_HELP_LMUL,
CORINFO_HELP_LMUL_OVF,
CORINFO_HELP_ULMUL_OVF,
CORINFO_HELP_LDIV,
CORINFO_HELP_LMOD,
CORINFO_HELP_ULDIV,
CORINFO_HELP_ULMOD,
CORINFO_HELP_LNG2DBL, // Convert a signed int64 to a double
CORINFO_HELP_ULNG2DBL, // Convert a unsigned int64 to a double
CORINFO_HELP_DBL2INT,
CORINFO_HELP_DBL2INT_OVF,
CORINFO_HELP_DBL2LNG,
CORINFO_HELP_DBL2LNG_OVF,
CORINFO_HELP_DBL2UINT,
CORINFO_HELP_DBL2UINT_OVF,
CORINFO_HELP_DBL2ULNG,
CORINFO_HELP_DBL2ULNG_OVF,
CORINFO_HELP_FLTREM,
CORINFO_HELP_DBLREM,
CORINFO_HELP_FLTROUND,
CORINFO_HELP_DBLROUND,
/* Allocating a new object. Always use ICorClassInfo::getNewHelper() to decide
which is the right helper to use to allocate an object of a given type. */
CORINFO_HELP_NEW_CROSSCONTEXT, // cross context new object
CORINFO_HELP_NEWFAST,
CORINFO_HELP_NEWSFAST, // allocator for small, non-finalizer, non-array object
CORINFO_HELP_NEWSFAST_FINALIZE, // allocator for small, finalizable, non-array object
CORINFO_HELP_NEWSFAST_ALIGN8, // allocator for small, non-finalizer, non-array object, 8 byte aligned
CORINFO_HELP_NEWSFAST_ALIGN8_VC,// allocator for small, value class, 8 byte aligned
CORINFO_HELP_NEWSFAST_ALIGN8_FINALIZE, // allocator for small, finalizable, non-array object, 8 byte aligned
CORINFO_HELP_NEW_MDARR, // multi-dim array helper (with or without lower bounds - dimensions passed in as vararg)
CORINFO_HELP_NEW_MDARR_NONVARARG,// multi-dim array helper (with or without lower bounds - dimensions passed in as unmanaged array)
CORINFO_HELP_NEWARR_1_DIRECT, // helper for any one dimensional array creation
CORINFO_HELP_NEWARR_1_R2R_DIRECT, // wrapper for R2R direct call, which extracts method table from ArrayTypeDesc
CORINFO_HELP_NEWARR_1_OBJ, // optimized 1-D object arrays
CORINFO_HELP_NEWARR_1_VC, // optimized 1-D value class arrays
CORINFO_HELP_NEWARR_1_ALIGN8, // like VC, but aligns the array start
CORINFO_HELP_STRCNS, // create a new string literal
CORINFO_HELP_STRCNS_CURRENT_MODULE, // create a new string literal from the current module (used by NGen code)
/* Object model */
CORINFO_HELP_INITCLASS, // Initialize class if not already initialized
CORINFO_HELP_INITINSTCLASS, // Initialize class for instantiated type
// Use ICorClassInfo::getCastingHelper to determine
// the right helper to use
CORINFO_HELP_ISINSTANCEOFINTERFACE, // Optimized helper for interfaces
CORINFO_HELP_ISINSTANCEOFARRAY, // Optimized helper for arrays
CORINFO_HELP_ISINSTANCEOFCLASS, // Optimized helper for classes
CORINFO_HELP_ISINSTANCEOFANY, // Slow helper for any type
CORINFO_HELP_CHKCASTINTERFACE,
CORINFO_HELP_CHKCASTARRAY,
CORINFO_HELP_CHKCASTCLASS,
CORINFO_HELP_CHKCASTANY,
CORINFO_HELP_CHKCASTCLASS_SPECIAL, // Optimized helper for classes. Assumes that the trivial cases
// has been taken care of by the inlined check
CORINFO_HELP_BOX,
CORINFO_HELP_BOX_NULLABLE, // special form of boxing for Nullable<T>
CORINFO_HELP_UNBOX,
CORINFO_HELP_UNBOX_NULLABLE, // special form of unboxing for Nullable<T>
CORINFO_HELP_GETREFANY, // Extract the byref from a TypedReference, checking that it is the expected type
CORINFO_HELP_ARRADDR_ST, // assign to element of object array with type-checking
CORINFO_HELP_LDELEMA_REF, // does a precise type comparision and returns address
/* Exceptions */
CORINFO_HELP_THROW, // Throw an exception object
CORINFO_HELP_RETHROW, // Rethrow the currently active exception
CORINFO_HELP_USER_BREAKPOINT, // For a user program to break to the debugger
CORINFO_HELP_RNGCHKFAIL, // array bounds check failed
CORINFO_HELP_OVERFLOW, // throw an overflow exception
CORINFO_HELP_THROWDIVZERO, // throw a divide by zero exception
CORINFO_HELP_THROWNULLREF, // throw a null reference exception
CORINFO_HELP_INTERNALTHROW, // Support for really fast jit
CORINFO_HELP_VERIFICATION, // Throw a VerificationException
CORINFO_HELP_SEC_UNMGDCODE_EXCPT, // throw a security unmanaged code exception
CORINFO_HELP_FAIL_FAST, // Kill the process avoiding any exceptions or stack and data dependencies (use for GuardStack unsafe buffer checks)
CORINFO_HELP_METHOD_ACCESS_EXCEPTION,//Throw an access exception due to a failed member/class access check.
CORINFO_HELP_FIELD_ACCESS_EXCEPTION,
CORINFO_HELP_CLASS_ACCESS_EXCEPTION,
CORINFO_HELP_ENDCATCH, // call back into the EE at the end of a catch block
/* Synchronization */
CORINFO_HELP_MON_ENTER,
CORINFO_HELP_MON_EXIT,
CORINFO_HELP_MON_ENTER_STATIC,
CORINFO_HELP_MON_EXIT_STATIC,
CORINFO_HELP_GETCLASSFROMMETHODPARAM, // Given a generics method handle, returns a class handle
CORINFO_HELP_GETSYNCFROMCLASSHANDLE, // Given a generics class handle, returns the sync monitor
// in its ManagedClassObject
/* Security callout support */
CORINFO_HELP_SECURITY_PROLOG, // Required if CORINFO_FLG_SECURITYCHECK is set, or CORINFO_FLG_NOSECURITYWRAP is not set
CORINFO_HELP_SECURITY_PROLOG_FRAMED, // Slow version of CORINFO_HELP_SECURITY_PROLOG. Used for instrumentation.
CORINFO_HELP_METHOD_ACCESS_CHECK, // Callouts to runtime security access checks
CORINFO_HELP_FIELD_ACCESS_CHECK,
CORINFO_HELP_CLASS_ACCESS_CHECK,
CORINFO_HELP_DELEGATE_SECURITY_CHECK, // Callout to delegate security transparency check
/* Verification runtime callout support */
CORINFO_HELP_VERIFICATION_RUNTIME_CHECK, // Do a Demand for UnmanagedCode permission at runtime
/* GC support */
CORINFO_HELP_STOP_FOR_GC, // Call GC (force a GC)
CORINFO_HELP_POLL_GC, // Ask GC if it wants to collect
CORINFO_HELP_STRESS_GC, // Force a GC, but then update the JITTED code to be a noop call
CORINFO_HELP_CHECK_OBJ, // confirm that ECX is a valid object pointer (debugging only)
/* GC Write barrier support */
CORINFO_HELP_ASSIGN_REF, // universal helpers with F_CALL_CONV calling convention
CORINFO_HELP_CHECKED_ASSIGN_REF,
CORINFO_HELP_ASSIGN_REF_ENSURE_NONHEAP, // Do the store, and ensure that the target was not in the heap.
CORINFO_HELP_ASSIGN_BYREF,
CORINFO_HELP_ASSIGN_STRUCT,
/* Accessing fields */
// For COM object support (using COM get/set routines to update object)
// and EnC and cross-context support
CORINFO_HELP_GETFIELD8,
CORINFO_HELP_SETFIELD8,
CORINFO_HELP_GETFIELD16,
CORINFO_HELP_SETFIELD16,
CORINFO_HELP_GETFIELD32,
CORINFO_HELP_SETFIELD32,
CORINFO_HELP_GETFIELD64,
CORINFO_HELP_SETFIELD64,
CORINFO_HELP_GETFIELDOBJ,
CORINFO_HELP_SETFIELDOBJ,
CORINFO_HELP_GETFIELDSTRUCT,
CORINFO_HELP_SETFIELDSTRUCT,
CORINFO_HELP_GETFIELDFLOAT,
CORINFO_HELP_SETFIELDFLOAT,
CORINFO_HELP_GETFIELDDOUBLE,
CORINFO_HELP_SETFIELDDOUBLE,
CORINFO_HELP_GETFIELDADDR,
CORINFO_HELP_GETSTATICFIELDADDR_CONTEXT, // Helper for context-static fields
CORINFO_HELP_GETSTATICFIELDADDR_TLS, // Helper for PE TLS fields
// There are a variety of specialized helpers for accessing static fields. The JIT should use
// ICorClassInfo::getSharedStaticsOrCCtorHelper to determine which helper to use
// Helpers for regular statics
CORINFO_HELP_GETGENERICS_GCSTATIC_BASE,
CORINFO_HELP_GETGENERICS_NONGCSTATIC_BASE,
CORINFO_HELP_GETSHARED_GCSTATIC_BASE,
CORINFO_HELP_GETSHARED_NONGCSTATIC_BASE,
CORINFO_HELP_GETSHARED_GCSTATIC_BASE_NOCTOR,
CORINFO_HELP_GETSHARED_NONGCSTATIC_BASE_NOCTOR,
CORINFO_HELP_GETSHARED_GCSTATIC_BASE_DYNAMICCLASS,
CORINFO_HELP_GETSHARED_NONGCSTATIC_BASE_DYNAMICCLASS,
// Helper to class initialize shared generic with dynamicclass, but not get static field address
CORINFO_HELP_CLASSINIT_SHARED_DYNAMICCLASS,
// Helpers for thread statics
CORINFO_HELP_GETGENERICS_GCTHREADSTATIC_BASE,
CORINFO_HELP_GETGENERICS_NONGCTHREADSTATIC_BASE,
CORINFO_HELP_GETSHARED_GCTHREADSTATIC_BASE,
CORINFO_HELP_GETSHARED_NONGCTHREADSTATIC_BASE,
CORINFO_HELP_GETSHARED_GCTHREADSTATIC_BASE_NOCTOR,
CORINFO_HELP_GETSHARED_NONGCTHREADSTATIC_BASE_NOCTOR,
CORINFO_HELP_GETSHARED_GCTHREADSTATIC_BASE_DYNAMICCLASS,
CORINFO_HELP_GETSHARED_NONGCTHREADSTATIC_BASE_DYNAMICCLASS,
/* Debugger */
CORINFO_HELP_DBG_IS_JUST_MY_CODE, // Check if this is "JustMyCode" and needs to be stepped through.
/* Profiling enter/leave probe addresses */
CORINFO_HELP_PROF_FCN_ENTER, // record the entry to a method (caller)
CORINFO_HELP_PROF_FCN_LEAVE, // record the completion of current method (caller)
CORINFO_HELP_PROF_FCN_TAILCALL, // record the completionof current method through tailcall (caller)
/* Miscellaneous */
CORINFO_HELP_BBT_FCN_ENTER, // record the entry to a method for collecting Tuning data
CORINFO_HELP_PINVOKE_CALLI, // Indirect pinvoke call
CORINFO_HELP_TAILCALL, // Perform a tail call
CORINFO_HELP_GETCURRENTMANAGEDTHREADID,
CORINFO_HELP_INIT_PINVOKE_FRAME, // initialize an inlined PInvoke Frame for the JIT-compiler
CORINFO_HELP_MEMSET, // Init block of memory
CORINFO_HELP_MEMCPY, // Copy block of memory
CORINFO_HELP_RUNTIMEHANDLE_METHOD, // determine a type/field/method handle at run-time
CORINFO_HELP_RUNTIMEHANDLE_METHOD_LOG, // determine a type/field/method handle at run-time, with IBC logging
CORINFO_HELP_RUNTIMEHANDLE_CLASS, // determine a type/field/method handle at run-time
CORINFO_HELP_RUNTIMEHANDLE_CLASS_LOG, // determine a type/field/method handle at run-time, with IBC logging
CORINFO_HELP_TYPEHANDLE_TO_RUNTIMETYPE, // Convert from a TypeHandle (native structure pointer) to RuntimeType at run-time
CORINFO_HELP_TYPEHANDLE_TO_RUNTIMETYPE_MAYBENULL, // Convert from a TypeHandle (native structure pointer) to RuntimeType at run-time, the type may be null
CORINFO_HELP_METHODDESC_TO_STUBRUNTIMEMETHOD, // Convert from a MethodDesc (native structure pointer) to RuntimeMethodHandle at run-time
CORINFO_HELP_FIELDDESC_TO_STUBRUNTIMEFIELD, // Convert from a FieldDesc (native structure pointer) to RuntimeFieldHandle at run-time
CORINFO_HELP_TYPEHANDLE_TO_RUNTIMETYPEHANDLE, // Convert from a TypeHandle (native structure pointer) to RuntimeTypeHandle at run-time
CORINFO_HELP_TYPEHANDLE_TO_RUNTIMETYPEHANDLE_MAYBENULL, // Convert from a TypeHandle (native structure pointer) to RuntimeTypeHandle at run-time, handle might point to a null type
CORINFO_HELP_ARE_TYPES_EQUIVALENT, // Check whether two TypeHandles (native structure pointers) are equivalent
CORINFO_HELP_VIRTUAL_FUNC_PTR, // look up a virtual method at run-time
//CORINFO_HELP_VIRTUAL_FUNC_PTR_LOG, // look up a virtual method at run-time, with IBC logging
// Not a real helpers. Instead of taking handle arguments, these helpers point to a small stub that loads the handle argument and calls the static helper.
CORINFO_HELP_READYTORUN_NEW,
CORINFO_HELP_READYTORUN_NEWARR_1,
CORINFO_HELP_READYTORUN_ISINSTANCEOF,
CORINFO_HELP_READYTORUN_CHKCAST,
CORINFO_HELP_READYTORUN_STATIC_BASE,
CORINFO_HELP_READYTORUN_VIRTUAL_FUNC_PTR,
CORINFO_HELP_READYTORUN_GENERIC_HANDLE,
CORINFO_HELP_READYTORUN_DELEGATE_CTOR,
CORINFO_HELP_READYTORUN_GENERIC_STATIC_BASE,
CORINFO_HELP_EE_PRESTUB, // Not real JIT helper. Used in native images.
CORINFO_HELP_EE_PRECODE_FIXUP, // Not real JIT helper. Used for Precode fixup in native images.
CORINFO_HELP_EE_PINVOKE_FIXUP, // Not real JIT helper. Used for PInvoke target fixup in native images.
CORINFO_HELP_EE_VSD_FIXUP, // Not real JIT helper. Used for VSD cell fixup in native images.
CORINFO_HELP_EE_EXTERNAL_FIXUP, // Not real JIT helper. Used for to fixup external method thunks in native images.
CORINFO_HELP_EE_VTABLE_FIXUP, // Not real JIT helper. Used for inherited vtable slot fixup in native images.
CORINFO_HELP_EE_REMOTING_THUNK, // Not real JIT helper. Used for remoting precode in native images.
CORINFO_HELP_EE_PERSONALITY_ROUTINE,// Not real JIT helper. Used in native images.
CORINFO_HELP_EE_PERSONALITY_ROUTINE_FILTER_FUNCLET,// Not real JIT helper. Used in native images to detect filter funclets.
// ASSIGN_REF_EAX - CHECKED_ASSIGN_REF_EBP: NOGC_WRITE_BARRIERS JIT helper calls
//
// For unchecked versions EDX is required to point into GC heap.
//
// NOTE: these helpers are only used for x86.
CORINFO_HELP_ASSIGN_REF_EAX, // EAX holds GC ptr, do a 'mov [EDX], EAX' and inform GC
CORINFO_HELP_ASSIGN_REF_EBX, // EBX holds GC ptr, do a 'mov [EDX], EBX' and inform GC
CORINFO_HELP_ASSIGN_REF_ECX, // ECX holds GC ptr, do a 'mov [EDX], ECX' and inform GC
CORINFO_HELP_ASSIGN_REF_ESI, // ESI holds GC ptr, do a 'mov [EDX], ESI' and inform GC
CORINFO_HELP_ASSIGN_REF_EDI, // EDI holds GC ptr, do a 'mov [EDX], EDI' and inform GC
CORINFO_HELP_ASSIGN_REF_EBP, // EBP holds GC ptr, do a 'mov [EDX], EBP' and inform GC
CORINFO_HELP_CHECKED_ASSIGN_REF_EAX, // These are the same as ASSIGN_REF above ...
CORINFO_HELP_CHECKED_ASSIGN_REF_EBX, // ... but also check if EDX points into heap.
CORINFO_HELP_CHECKED_ASSIGN_REF_ECX,
CORINFO_HELP_CHECKED_ASSIGN_REF_ESI,
CORINFO_HELP_CHECKED_ASSIGN_REF_EDI,
CORINFO_HELP_CHECKED_ASSIGN_REF_EBP,
CORINFO_HELP_LOOP_CLONE_CHOICE_ADDR, // Return the reference to a counter to decide to take cloned path in debug stress.
CORINFO_HELP_DEBUG_LOG_LOOP_CLONING, // Print a message that a loop cloning optimization has occurred in debug mode.
CORINFO_HELP_THROW_ARGUMENTEXCEPTION, // throw ArgumentException
CORINFO_HELP_THROW_ARGUMENTOUTOFRANGEEXCEPTION, // throw ArgumentOutOfRangeException
CORINFO_HELP_THROW_NOT_IMPLEMENTED, // throw NotImplementedException
CORINFO_HELP_THROW_PLATFORM_NOT_SUPPORTED, // throw PlatformNotSupportedException
CORINFO_HELP_THROW_TYPE_NOT_SUPPORTED, // throw TypeNotSupportedException
CORINFO_HELP_JIT_PINVOKE_BEGIN, // Transition to preemptive mode before a P/Invoke, frame is the first argument
CORINFO_HELP_JIT_PINVOKE_END, // Transition to cooperative mode after a P/Invoke, frame is the first argument
CORINFO_HELP_JIT_REVERSE_PINVOKE_ENTER, // Transition to cooperative mode in reverse P/Invoke prolog, frame is the first argument
CORINFO_HELP_JIT_REVERSE_PINVOKE_EXIT, // Transition to preemptive mode in reverse P/Invoke epilog, frame is the first argument
CORINFO_HELP_GVMLOOKUP_FOR_SLOT, // Resolve a generic virtual method target from this pointer and runtime method handle
CORINFO_HELP_STACK_PROBE, // Probes each page of the allocated stack frame
CORINFO_HELP_COUNT,
};
#define CORINFO_HELP_READYTORUN_ATYPICAL_CALLSITE 0x40000000
//This describes the signature for a helper method.
enum CorInfoHelpSig
{
CORINFO_HELP_SIG_UNDEF,
CORINFO_HELP_SIG_NO_ALIGN_STUB,
CORINFO_HELP_SIG_NO_UNWIND_STUB,
CORINFO_HELP_SIG_REG_ONLY,
CORINFO_HELP_SIG_4_STACK,
CORINFO_HELP_SIG_8_STACK,
CORINFO_HELP_SIG_12_STACK,
CORINFO_HELP_SIG_16_STACK,
CORINFO_HELP_SIG_8_VA, //2 arguments plus varargs
CORINFO_HELP_SIG_EBPCALL, //special calling convention that uses EDX and
//EBP as arguments
CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB,
CORINFO_HELP_SIG_COUNT
};
// The enumeration is returned in 'getSig','getType', getArgType methods
enum CorInfoType
{
CORINFO_TYPE_UNDEF = 0x0,
CORINFO_TYPE_VOID = 0x1,
CORINFO_TYPE_BOOL = 0x2,
CORINFO_TYPE_CHAR = 0x3,
CORINFO_TYPE_BYTE = 0x4,
CORINFO_TYPE_UBYTE = 0x5,
CORINFO_TYPE_SHORT = 0x6,
CORINFO_TYPE_USHORT = 0x7,
CORINFO_TYPE_INT = 0x8,
CORINFO_TYPE_UINT = 0x9,
CORINFO_TYPE_LONG = 0xa,
CORINFO_TYPE_ULONG = 0xb,
CORINFO_TYPE_NATIVEINT = 0xc,
CORINFO_TYPE_NATIVEUINT = 0xd,
CORINFO_TYPE_FLOAT = 0xe,
CORINFO_TYPE_DOUBLE = 0xf,
CORINFO_TYPE_STRING = 0x10, // Not used, should remove
CORINFO_TYPE_PTR = 0x11,
CORINFO_TYPE_BYREF = 0x12,
CORINFO_TYPE_VALUECLASS = 0x13,
CORINFO_TYPE_CLASS = 0x14,
CORINFO_TYPE_REFANY = 0x15,
// CORINFO_TYPE_VAR is for a generic type variable.
// Generic type variables only appear when the JIT is doing
// verification (not NOT compilation) of generic code
// for the EE, in which case we're running
// the JIT in "import only" mode.
CORINFO_TYPE_VAR = 0x16,
CORINFO_TYPE_COUNT, // number of jit types
};
enum CorInfoTypeWithMod
{
CORINFO_TYPE_MASK = 0x3F, // lower 6 bits are type mask
CORINFO_TYPE_MOD_PINNED = 0x40, // can be applied to CLASS, or BYREF to indiate pinned
};
inline CorInfoType strip(CorInfoTypeWithMod val) {
return CorInfoType(val & CORINFO_TYPE_MASK);
}
// The enumeration is returned in 'getSig'
enum CorInfoCallConv
{
// These correspond to CorCallingConvention
CORINFO_CALLCONV_DEFAULT = 0x0,
CORINFO_CALLCONV_C = 0x1,
CORINFO_CALLCONV_STDCALL = 0x2,
CORINFO_CALLCONV_THISCALL = 0x3,
CORINFO_CALLCONV_FASTCALL = 0x4,
CORINFO_CALLCONV_VARARG = 0x5,
CORINFO_CALLCONV_FIELD = 0x6,
CORINFO_CALLCONV_LOCAL_SIG = 0x7,
CORINFO_CALLCONV_PROPERTY = 0x8,
CORINFO_CALLCONV_NATIVEVARARG = 0xb, // used ONLY for IL stub PInvoke vararg calls
CORINFO_CALLCONV_MASK = 0x0f, // Calling convention is bottom 4 bits
CORINFO_CALLCONV_GENERIC = 0x10,
CORINFO_CALLCONV_HASTHIS = 0x20,
CORINFO_CALLCONV_EXPLICITTHIS=0x40,
CORINFO_CALLCONV_PARAMTYPE = 0x80, // Passed last. Same as CORINFO_GENERICS_CTXT_FROM_PARAMTYPEARG
};
#ifdef UNIX_X86_ABI
inline bool IsCallerPop(CorInfoCallConv callConv)
{
unsigned int umask = CORINFO_CALLCONV_STDCALL
| CORINFO_CALLCONV_THISCALL
| CORINFO_CALLCONV_FASTCALL;
return !(callConv & umask);
}
#endif // UNIX_X86_ABI
enum CorInfoUnmanagedCallConv
{
// These correspond to CorUnmanagedCallingConvention
CORINFO_UNMANAGED_CALLCONV_UNKNOWN,
CORINFO_UNMANAGED_CALLCONV_C,
CORINFO_UNMANAGED_CALLCONV_STDCALL,
CORINFO_UNMANAGED_CALLCONV_THISCALL,
CORINFO_UNMANAGED_CALLCONV_FASTCALL
};
// These are returned from getMethodOptions
enum CorInfoOptions
{
CORINFO_OPT_INIT_LOCALS = 0x00000010, // zero initialize all variables
CORINFO_GENERICS_CTXT_FROM_THIS = 0x00000020, // is this shared generic code that access the generic context from the this pointer? If so, then if the method has SEH then the 'this' pointer must always be reported and kept alive.
CORINFO_GENERICS_CTXT_FROM_METHODDESC = 0x00000040, // is this shared generic code that access the generic context from the ParamTypeArg(that is a MethodDesc)? If so, then if the method has SEH then the 'ParamTypeArg' must always be reported and kept alive. Same as CORINFO_CALLCONV_PARAMTYPE
CORINFO_GENERICS_CTXT_FROM_METHODTABLE = 0x00000080, // is this shared generic code that access the generic context from the ParamTypeArg(that is a MethodTable)? If so, then if the method has SEH then the 'ParamTypeArg' must always be reported and kept alive. Same as CORINFO_CALLCONV_PARAMTYPE
CORINFO_GENERICS_CTXT_MASK = (CORINFO_GENERICS_CTXT_FROM_THIS |
CORINFO_GENERICS_CTXT_FROM_METHODDESC |
CORINFO_GENERICS_CTXT_FROM_METHODTABLE),
CORINFO_GENERICS_CTXT_KEEP_ALIVE = 0x00000100, // Keep the generics context alive throughout the method even if there is no explicit use, and report its location to the CLR
};
//
// what type of code region we are in
//
enum CorInfoRegionKind
{
CORINFO_REGION_NONE,
CORINFO_REGION_HOT,
CORINFO_REGION_COLD,
CORINFO_REGION_JIT,
};
// these are the attribute flags for fields and methods (getMethodAttribs)
enum CorInfoFlag
{
// CORINFO_FLG_UNUSED = 0x00000001,
// CORINFO_FLG_UNUSED = 0x00000002,
CORINFO_FLG_PROTECTED = 0x00000004,
CORINFO_FLG_STATIC = 0x00000008,
CORINFO_FLG_FINAL = 0x00000010,
CORINFO_FLG_SYNCH = 0x00000020,
CORINFO_FLG_VIRTUAL = 0x00000040,
// CORINFO_FLG_UNUSED = 0x00000080,
CORINFO_FLG_NATIVE = 0x00000100,
CORINFO_FLG_INTRINSIC_TYPE = 0x00000200, // This type is marked by [Intrinsic]
CORINFO_FLG_ABSTRACT = 0x00000400,
CORINFO_FLG_EnC = 0x00000800, // member was added by Edit'n'Continue
// These are internal flags that can only be on methods
CORINFO_FLG_FORCEINLINE = 0x00010000, // The method should be inlined if possible.
CORINFO_FLG_SHAREDINST = 0x00020000, // the code for this method is shared between different generic instantiations (also set on classes/types)
CORINFO_FLG_DELEGATE_INVOKE = 0x00040000, // "Delegate
CORINFO_FLG_PINVOKE = 0x00080000, // Is a P/Invoke call
CORINFO_FLG_SECURITYCHECK = 0x00100000, // Is one of the security routines that does a stackwalk (e.g. Assert, Demand)
CORINFO_FLG_NOGCCHECK = 0x00200000, // This method is FCALL that has no GC check. Don't put alone in loops
CORINFO_FLG_INTRINSIC = 0x00400000, // This method MAY have an intrinsic ID
CORINFO_FLG_CONSTRUCTOR = 0x00800000, // This method is an instance or type initializer
CORINFO_FLG_AGGRESSIVE_OPT = 0x01000000, // The method may contain hot code and should be aggressively optimized if possible
CORINFO_FLG_DISABLE_TIER0_FOR_LOOPS = 0x02000000, // Indicates that tier 0 JIT should not be used for a method that contains a loop
CORINFO_FLG_NOSECURITYWRAP = 0x04000000, // The method requires no security checks
// CORINFO_FLG_UNUSED = 0x08000000,
CORINFO_FLG_DONT_INLINE = 0x10000000, // The method should not be inlined
CORINFO_FLG_DONT_INLINE_CALLER = 0x20000000, // The method should not be inlined, nor should its callers. It cannot be tail called.
CORINFO_FLG_JIT_INTRINSIC = 0x40000000, // Method is a potential jit intrinsic; verify identity by name check
// These are internal flags that can only be on Classes
CORINFO_FLG_VALUECLASS = 0x00010000, // is the class a value class
// This flag is define din the Methods section, but is also valid on classes.
// CORINFO_FLG_SHAREDINST = 0x00020000, // This class is satisfies TypeHandle::IsCanonicalSubtype
CORINFO_FLG_VAROBJSIZE = 0x00040000, // the object size varies depending of constructor args
CORINFO_FLG_ARRAY = 0x00080000, // class is an array class (initialized differently)
CORINFO_FLG_OVERLAPPING_FIELDS = 0x00100000, // struct or class has fields that overlap (aka union)
CORINFO_FLG_INTERFACE = 0x00200000, // it is an interface
CORINFO_FLG_CONTEXTFUL = 0x00400000, // is this a contextful class?
CORINFO_FLG_CUSTOMLAYOUT = 0x00800000, // does this struct have custom layout?
CORINFO_FLG_CONTAINS_GC_PTR = 0x01000000, // does the class contain a gc ptr ?
CORINFO_FLG_DELEGATE = 0x02000000, // is this a subclass of delegate or multicast delegate ?
CORINFO_FLG_MARSHAL_BYREF = 0x04000000, // is this a subclass of MarshalByRef ?
CORINFO_FLG_CONTAINS_STACK_PTR = 0x08000000, // This class has a stack pointer inside it
CORINFO_FLG_VARIANCE = 0x10000000, // MethodTable::HasVariance (sealed does *not* mean uncast-able)
CORINFO_FLG_BEFOREFIELDINIT = 0x20000000, // Additional flexibility for when to run .cctor (see code:#ClassConstructionFlags)
CORINFO_FLG_GENERIC_TYPE_VARIABLE = 0x40000000, // This is really a handle for a variable type
CORINFO_FLG_UNSAFE_VALUECLASS = 0x80000000, // Unsafe (C++'s /GS) value type
};
// Flags computed by a runtime compiler
enum CorInfoMethodRuntimeFlags
{
CORINFO_FLG_BAD_INLINEE = 0x00000001, // The method is not suitable for inlining
CORINFO_FLG_VERIFIABLE = 0x00000002, // The method has verifiable code
CORINFO_FLG_UNVERIFIABLE = 0x00000004, // The method has unverifiable code
CORINFO_FLG_SWITCHED_TO_MIN_OPT = 0x00000008, // The JIT decided to switch to MinOpt for this method, when it was not requested
CORINFO_FLG_SWITCHED_TO_OPTIMIZED = 0x00000010, // The JIT decided to switch to tier 1 for this method, when a different tier was requested
};
enum CORINFO_ACCESS_FLAGS
{
CORINFO_ACCESS_ANY = 0x0000, // Normal access
CORINFO_ACCESS_THIS = 0x0001, // Accessed via the this reference
CORINFO_ACCESS_UNWRAP = 0x0002, // Accessed via an unwrap reference
CORINFO_ACCESS_NONNULL = 0x0004, // Instance is guaranteed non-null
CORINFO_ACCESS_LDFTN = 0x0010, // Accessed via ldftn
// Field access flags
CORINFO_ACCESS_GET = 0x0100, // Field get (ldfld)
CORINFO_ACCESS_SET = 0x0200, // Field set (stfld)
CORINFO_ACCESS_ADDRESS = 0x0400, // Field address (ldflda)
CORINFO_ACCESS_INIT_ARRAY = 0x0800, // Field use for InitializeArray
CORINFO_ACCESS_ATYPICAL_CALLSITE = 0x4000, // Atypical callsite that cannot be disassembled by delay loading helper
CORINFO_ACCESS_INLINECHECK= 0x8000, // Return fieldFlags and fieldAccessor only. Used by JIT64 during inlining.
};
// These are the flags set on an CORINFO_EH_CLAUSE
enum CORINFO_EH_CLAUSE_FLAGS
{
CORINFO_EH_CLAUSE_NONE = 0,
CORINFO_EH_CLAUSE_FILTER = 0x0001, // If this bit is on, then this EH entry is for a filter
CORINFO_EH_CLAUSE_FINALLY = 0x0002, // This clause is a finally clause
CORINFO_EH_CLAUSE_FAULT = 0x0004, // This clause is a fault clause
CORINFO_EH_CLAUSE_DUPLICATE = 0x0008, // Duplicated clause. This clause was duplicated to a funclet which was pulled out of line
CORINFO_EH_CLAUSE_SAMETRY = 0x0010, // This clause covers same try block as the previous one. (Used by CoreRT ABI.)
};
// This enumeration is passed to InternalThrow
enum CorInfoException
{
CORINFO_NullReferenceException,
CORINFO_DivideByZeroException,
CORINFO_InvalidCastException,
CORINFO_IndexOutOfRangeException,
CORINFO_OverflowException,
CORINFO_SynchronizationLockException,
CORINFO_ArrayTypeMismatchException,
CORINFO_RankException,
CORINFO_ArgumentNullException,
CORINFO_ArgumentException,
CORINFO_Exception_Count,
};
// This enumeration is returned by getIntrinsicID. Methods corresponding to
// these values will have "well-known" specified behavior. Calls to these
// methods could be replaced with inlined code corresponding to the
// specified behavior (without having to examine the IL beforehand).
enum CorInfoIntrinsics
{
CORINFO_INTRINSIC_Sin,
CORINFO_INTRINSIC_Cos,
CORINFO_INTRINSIC_Cbrt,
CORINFO_INTRINSIC_Sqrt,
CORINFO_INTRINSIC_Abs,
CORINFO_INTRINSIC_Round,
CORINFO_INTRINSIC_Cosh,
CORINFO_INTRINSIC_Sinh,
CORINFO_INTRINSIC_Tan,
CORINFO_INTRINSIC_Tanh,
CORINFO_INTRINSIC_Asin,
CORINFO_INTRINSIC_Asinh,
CORINFO_INTRINSIC_Acos,
CORINFO_INTRINSIC_Acosh,
CORINFO_INTRINSIC_Atan,
CORINFO_INTRINSIC_Atan2,
CORINFO_INTRINSIC_Atanh,
CORINFO_INTRINSIC_Log10,
CORINFO_INTRINSIC_Pow,
CORINFO_INTRINSIC_Exp,
CORINFO_INTRINSIC_Ceiling,
CORINFO_INTRINSIC_Floor,
CORINFO_INTRINSIC_GetChar, // fetch character out of string
CORINFO_INTRINSIC_Array_GetDimLength, // Get number of elements in a given dimension of an array
CORINFO_INTRINSIC_Array_Get, // Get the value of an element in an array
CORINFO_INTRINSIC_Array_Address, // Get the address of an element in an array
CORINFO_INTRINSIC_Array_Set, // Set the value of an element in an array
CORINFO_INTRINSIC_StringGetChar, // fetch character out of string
CORINFO_INTRINSIC_StringLength, // get the length
CORINFO_INTRINSIC_InitializeArray, // initialize an array from static data
CORINFO_INTRINSIC_GetTypeFromHandle,
CORINFO_INTRINSIC_RTH_GetValueInternal,
CORINFO_INTRINSIC_TypeEQ,
CORINFO_INTRINSIC_TypeNEQ,
CORINFO_INTRINSIC_Object_GetType,
CORINFO_INTRINSIC_StubHelpers_GetStubContext,
CORINFO_INTRINSIC_StubHelpers_GetStubContextAddr,
CORINFO_INTRINSIC_StubHelpers_GetNDirectTarget,
CORINFO_INTRINSIC_InterlockedAdd32,
CORINFO_INTRINSIC_InterlockedAdd64,
CORINFO_INTRINSIC_InterlockedXAdd32,
CORINFO_INTRINSIC_InterlockedXAdd64,
CORINFO_INTRINSIC_InterlockedXchg32,
CORINFO_INTRINSIC_InterlockedXchg64,
CORINFO_INTRINSIC_InterlockedCmpXchg32,
CORINFO_INTRINSIC_InterlockedCmpXchg64,
CORINFO_INTRINSIC_MemoryBarrier,
CORINFO_INTRINSIC_GetCurrentManagedThread,
CORINFO_INTRINSIC_GetManagedThreadId,
CORINFO_INTRINSIC_ByReference_Ctor,
CORINFO_INTRINSIC_ByReference_Value,
CORINFO_INTRINSIC_Span_GetItem,
CORINFO_INTRINSIC_ReadOnlySpan_GetItem,
CORINFO_INTRINSIC_GetRawHandle,
CORINFO_INTRINSIC_Count,
CORINFO_INTRINSIC_Illegal = -1, // Not a true intrinsic,
};
// Can a value be accessed directly from JITed code.
enum InfoAccessType
{
IAT_VALUE, // The info value is directly available
IAT_PVALUE, // The value needs to be accessed via an indirection
IAT_PPVALUE, // The value needs to be accessed via a double indirection
IAT_RELPVALUE // The value needs to be accessed via a relative indirection
};
enum CorInfoGCType
{
TYPE_GC_NONE, // no embedded objectrefs
TYPE_GC_REF, // Is an object ref