agnostic.h 16.8 KB
Newer Older
B
Bruce Forstall 已提交
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
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//

//----------------------------------------------------------
// agnostic.h - Definition of platform-agnostic data types used by SuperPMI.
//              MethodContext and CompileResult types use these.
//----------------------------------------------------------
#ifndef _Agnostic
#define _Agnostic

#pragma pack(push, 1)

struct Agnostic_CORINFO_SIG_INFO
{
    DWORD     callConv;
    DWORDLONG retTypeClass;
    DWORDLONG retTypeSigClass;
    DWORD     retType;
    DWORD     flags;
    DWORD     numArgs;
    DWORD     sigInst_classInstCount;
    DWORD     sigInst_classInst_Index;
    DWORD     sigInst_methInstCount;
    DWORD     sigInst_methInst_Index;
    DWORDLONG args;
    DWORD     pSig_Index;
    DWORD     cbSig;
30
    DWORDLONG methodSignature;
B
Bruce Forstall 已提交
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
    DWORDLONG scope;
    DWORD     token;
};

struct Agnostic_CORINFO_METHOD_INFO
{
    DWORDLONG                 ftn;
    DWORDLONG                 scope;
    DWORD                     ILCode_offset;
    DWORD                     ILCodeSize;
    DWORD                     maxStack;
    DWORD                     EHcount;
    DWORD                     options;
    DWORD                     regionKind;
    Agnostic_CORINFO_SIG_INFO args;
    Agnostic_CORINFO_SIG_INFO locals;
};

struct Agnostic_CompileMethod
{
    Agnostic_CORINFO_METHOD_INFO info;
    DWORD                        flags;
};

struct Agnostic_InitClass
{
    DWORDLONG field;
    DWORDLONG method;
    DWORDLONG context;
};

struct DLDL
{
    DWORDLONG A;
    DWORDLONG B;
};

struct Agnostic_CanInline
{
    DWORD Restrictions;
    DWORD result;
    DWORD exceptionCode;
};

struct Agnostic_GetClassGClayout
{
    DWORD gcPtrs_Index;
    DWORD len;
    DWORD valCount;
};

struct DLD
{
    DWORDLONG A;
    DWORD     B;
};

struct DLDD
{
    DWORDLONG A;
    DWORD     B;
    DWORD     C;
};

struct Agnostic_CORINFO_METHODNAME_TOKENin
{
    DWORDLONG ftn;
    DWORD     className;
    DWORD     namespaceName;
    DWORD     enclosingClassName;
};

struct Agnostic_CORINFO_METHODNAME_TOKENout
{
    DWORD methodName;
    DWORD className;
    DWORD namespaceName;
    DWORD enclosingClassName;
};

struct Agnostic_CORINFO_RESOLVED_TOKENin
{
    DWORDLONG tokenContext;
    DWORDLONG tokenScope;
    DWORD     token;
    DWORD     tokenType;
};

struct Agnostic_CORINFO_RESOLVED_TOKENout
{
    DWORDLONG hClass;
    DWORDLONG hMethod;
    DWORDLONG hField;
    DWORD     pTypeSpec_Index;
    DWORD     cbTypeSpec;
    DWORD     pMethodSpec_Index;
    DWORD     cbMethodSpec;
};

struct Agnostic_GetArgType_Key
{
132
    // Partial CORINFO_SIG_INFO data
B
Bruce Forstall 已提交
133 134 135 136 137 138
    DWORD     flags;
    DWORD     numArgs;
    DWORD     sigInst_classInstCount;
    DWORD     sigInst_classInst_Index;
    DWORD     sigInst_methInstCount;
    DWORD     sigInst_methInst_Index;
139
    DWORDLONG methodSignature;
B
Bruce Forstall 已提交
140
    DWORDLONG scope;
141 142

    // Other getArgType() arguments
B
Bruce Forstall 已提交
143 144 145 146 147 148 149 150 151
    DWORDLONG args;
};

struct Agnostic_GetArgClass_Key
{
    DWORD     sigInst_classInstCount;
    DWORD     sigInst_classInst_Index;
    DWORD     sigInst_methInstCount;
    DWORD     sigInst_methInst_Index;
152
    DWORDLONG methodSignature;
B
Bruce Forstall 已提交
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
    DWORDLONG scope;
    DWORDLONG args;
};

struct Agnostic_GetBoundaries
{
    DWORD cILOffsets;
    DWORD pILOffset_offset;
    DWORD implicitBoundaries;
};

struct Agnostic_CORINFO_EE_INFO
{
    struct Agnostic_InlinedCallFrameInfo
    {
        DWORD size;
        DWORD offsetOfGSCookie;
        DWORD offsetOfFrameVptr;
        DWORD offsetOfFrameLink;
        DWORD offsetOfCallSiteSP;
        DWORD offsetOfCalleeSavedFP;
        DWORD offsetOfCallTarget;
        DWORD offsetOfReturnAddress;
    } inlinedCallFrameInfo;
    DWORD offsetOfThreadFrame;
    DWORD offsetOfGCState;
    DWORD offsetOfDelegateInstance;
    DWORD offsetOfDelegateFirstTarget;
    DWORD offsetOfWrapperDelegateIndirectCell;
    DWORD sizeOfReversePInvokeFrame;
    DWORD osPageSize;
    DWORD maxUncheckedOffsetForNullObject;
    DWORD targetAbi;
    DWORD osType;
};

struct Agnostic_GetOSRInfo
{
    DWORD index;
    unsigned ilOffset;
};

struct Agnostic_GetFieldAddress
{
    DWORDLONG ppIndirection;
    DWORDLONG fieldAddress;
    DWORD     fieldValue;
};

struct Agnostic_GetStaticFieldCurrentClass
{
    DWORDLONG classHandle;
    bool      isSpeculative;
};

struct Agnostic_CORINFO_RESOLVED_TOKEN
{
    Agnostic_CORINFO_RESOLVED_TOKENin inValue;
    Agnostic_CORINFO_RESOLVED_TOKENout outValue;
};

struct Agnostic_GetFieldInfo
{
    Agnostic_CORINFO_RESOLVED_TOKEN ResolvedToken;
    DWORDLONG                       callerHandle;
    DWORD                           flags;
};

struct Agnostic_CORINFO_HELPER_ARG
{
    DWORDLONG constant; // one view of a large union of ptr size
    DWORD     argType;
};

struct Agnostic_CORINFO_HELPER_DESC
{
    DWORD                       helperNum;
    DWORD                       numArgs;
    Agnostic_CORINFO_HELPER_ARG args[CORINFO_ACCESS_ALLOWED_MAX_ARGS];
};

struct Agnostic_CORINFO_CONST_LOOKUP
{
    DWORD     accessType;
    DWORDLONG handle; // actually a union of two pointer sized things
};

struct Agnostic_CORINFO_LOOKUP_KIND
{
    DWORD needsRuntimeLookup;
    DWORD runtimeLookupKind;
    WORD  runtimeLookupFlags;
};

struct Agnostic_CORINFO_RUNTIME_LOOKUP
{
    DWORDLONG signature;
    DWORD     helper;
    DWORD     indirections;
    DWORD     testForNull;
    DWORD     testForFixup;
    WORD      sizeOffset;
    DWORDLONG offsets[CORINFO_MAXINDIRECTIONS];
    DWORD     indirectFirstOffset;
    DWORD     indirectSecondOffset;
};

struct Agnostic_CORINFO_LOOKUP
{
    Agnostic_CORINFO_LOOKUP_KIND    lookupKind;
    Agnostic_CORINFO_RUNTIME_LOOKUP runtimeLookup; // This and constLookup actually a union, but with different
                                                   // layouts.. :-| copy the right one based on lookupKinds value
    Agnostic_CORINFO_CONST_LOOKUP constLookup;
};

struct Agnostic_CORINFO_FIELD_INFO
{
    DWORD                         fieldAccessor;
    DWORD                         fieldFlags;
    DWORD                         helper;
    DWORD                         offset;
    DWORD                         fieldType;
    DWORDLONG                     structType;
    DWORD                         accessAllowed;
    Agnostic_CORINFO_HELPER_DESC  accessCalloutHelper;
    Agnostic_CORINFO_CONST_LOOKUP fieldLookup;
};

struct DD
{
    DWORD A;
    DWORD B;
};

struct DDD
{
    DWORD A;
    DWORD B;
    DWORD C;
};

struct Agnostic_CanTailCall
{
    DWORDLONG callerHnd;
    DWORDLONG declaredCalleeHnd;
    DWORDLONG exactCalleeHnd;
    WORD      fIsTailPrefix;
};

struct Agnostic_Environment
{
    DWORD name_index;
    ;
    DWORD val_index;
};

struct Agnostic_GetCallInfo
{
    Agnostic_CORINFO_RESOLVED_TOKEN ResolvedToken;
    Agnostic_CORINFO_RESOLVED_TOKEN ConstrainedResolvedToken;
    DWORDLONG                       callerHandle;
    DWORD                           flags;
};

struct Agnostic_CORINFO_CALL_INFO
{
    DWORDLONG                     hMethod;
    DWORD                         methodFlags;
    DWORD                         classFlags;
    Agnostic_CORINFO_SIG_INFO     sig;
    DWORD                         verMethodFlags;
    Agnostic_CORINFO_SIG_INFO     verSig;
    DWORD                         accessAllowed;
    Agnostic_CORINFO_HELPER_DESC  callsiteCalloutHelper;
    DWORD                         thisTransform;
    DWORD                         kind;
    DWORD                         nullInstanceCheck;
    DWORDLONG                     contextHandle;
    DWORD                         exactContextNeedsRuntimeLookup;
    Agnostic_CORINFO_LOOKUP       stubLookup; // first view of union.  others are matching or subordinate
    Agnostic_CORINFO_CONST_LOOKUP instParamLookup;
    DWORD                         wrapperDelegateInvoke;
    DWORD                         exceptionCode;
};

struct Agnostic_GetMethodInfo
{
    Agnostic_CORINFO_METHOD_INFO info;
    bool                         result;
    DWORD                        exceptionCode;
};

struct Agnostic_FindSig
{
    DWORDLONG module;
    DWORD     sigTOK;
    DWORDLONG context;
};

struct MethodOrSigInfoValue
{
    DWORDLONG method;
    DWORD     pSig_Index;
    DWORD     cbSig;
    DWORDLONG scope;
};

struct Agnostic_CORINFO_EH_CLAUSE
{
    DWORD Flags;
    DWORD TryOffset;
    DWORD TryLength;
    DWORD HandlerOffset;
    DWORD HandlerLength;
    DWORD ClassToken; // first view of a two dword union
};

struct Agnostic_GetVars
{
    DWORD cVars;
    DWORD vars_offset;
    DWORD extendOthers;
};

struct Agnostic_CanAccessClassIn
{
    Agnostic_CORINFO_RESOLVED_TOKEN ResolvedToken;
    DWORDLONG                       callerHandle;
};

struct Agnostic_CanAccessClassOut
{
    Agnostic_CORINFO_HELPER_DESC AccessHelper;
    DWORD                        result;
};

struct Agnostic_AppendClassName
{
    DWORDLONG classHandle;
    DWORD     fNamespace;
    DWORD     fFullInst;
    DWORD     fAssembly;
};

struct Agnostic_CheckMethodModifier
{
    DWORDLONG hMethod;
    DWORD     modifier;
    DWORD     fOptional;
};

struct Agnostic_EmbedGenericHandle
{
    Agnostic_CORINFO_RESOLVED_TOKEN ResolvedToken;
    DWORD                           fEmbedParent;
};

struct Agnostic_CORINFO_GENERICHANDLE_RESULT
{
    Agnostic_CORINFO_LOOKUP lookup;
    DWORDLONG               compileTimeHandle;
    DWORD                   handleType;
};

struct Agnostic_GetDelegateCtorIn
{
    DWORDLONG methHnd;
    DWORDLONG clsHnd;
    DWORDLONG targetMethodHnd;
};

struct Agnostic_DelegateCtorArgs
{
    DWORDLONG pMethod;
    DWORDLONG pArg3;
    DWORDLONG pArg4;
    DWORDLONG pArg5;
};

struct Agnostic_GetDelegateCtorOut
{
    Agnostic_DelegateCtorArgs CtorData;
    DWORDLONG                 result;
};

struct Agnostic_FindCallSiteSig
{
    DWORDLONG module;
    DWORD     methTok;
    DWORDLONG context;
};

struct Agnostic_GetNewHelper
{
    DWORDLONG hClass;
    DWORDLONG callerHandle;
};

struct Agnostic_GetCastingHelper
{
    DWORDLONG hClass;
    DWORD     fThrowing;
};

struct Agnostic_GetClassModuleIdForStatics
{
    DWORDLONG Module;
    DWORDLONG pIndirection;
    DWORDLONG result;
};

struct Agnostic_IsCompatibleDelegate
{
    DWORDLONG objCls;
    DWORDLONG methodParentCls;
    DWORDLONG method;
    DWORDLONG delegateCls;
};

472 473
struct Agnostic_PgoInstrumentationSchema
{
474 475 476 477 478
    DWORDLONG Offset;          // size_t
    DWORD InstrumentationKind; // ICorJitInfo::PgoInstrumentationKind
    DWORD ILOffset;            // int32_t
    DWORD Count;               // int32_t
    DWORD Other;               // int32_t
479 480 481
};

struct Agnostic_AllocPgoInstrumentationBySchema
B
Bruce Forstall 已提交
482
{
483
    DWORDLONG instrumentationDataAddress;
484
    DWORD schema_index;
485
    DWORD countSchemaItems;
B
Bruce Forstall 已提交
486 487 488
    DWORD result;
};

489
struct Agnostic_GetPgoInstrumentationResults
B
Bruce Forstall 已提交
490
{
491
    DWORD countSchemaItems;
492 493
    DWORD schema_index;
    DWORD data_index;
494
    DWORD dataByteCount;
B
Bruce Forstall 已提交
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
    DWORD result;
};

struct Agnostic_GetLikelyClass
{
    DWORDLONG ftnHnd;
    DWORDLONG baseHnd;
    DWORD     ilOffset;
};

struct Agnostic_GetLikelyClassResult
{
    DWORDLONG classHnd;
    DWORD     likelihood;
    DWORD     numberOfClasses;
};

struct Agnostic_GetProfilingHandle
{
    DWORD     bHookFunction;
    DWORDLONG ProfilerHandle;
    DWORD     bIndirectedHandles;
};

struct Agnostic_GetTailCallHelpers
{
    Agnostic_CORINFO_RESOLVED_TOKEN callToken;
    Agnostic_CORINFO_SIG_INFO sig;
    DWORD flags;
};

struct Agnostic_CORINFO_TAILCALL_HELPERS
{
    bool result;
    DWORD flags;
    DWORDLONG hStoreArgs;
    DWORDLONG hCallTarget;
    DWORDLONG hDispatcher;
};

struct Agnostic_GetArgClass_Value
{
    DWORDLONG result;
    DWORD     exceptionCode;
};

struct Agnostic_GetArgType_Value
{
    DWORDLONG vcTypeRet;
    DWORD     result;
    DWORD     exceptionCode;
};

// Agnostic_ConfigIntInfo combines as a single key the name
// and defaultValue of a integer config query.
// Note: nameIndex is treated as a DWORD index to the name string.
struct Agnostic_ConfigIntInfo
{
    DWORD nameIndex;
    DWORD defaultValue;
};

// SYSTEMV_AMD64_CORINFO_STRUCT_REG_PASSING_DESCRIPTOR
struct Agnostic_GetSystemVAmd64PassStructInRegisterDescriptor
{
    DWORD passedInRegisters; // Whether the struct is passable/passed (this includes struct returning) in registers.
    DWORD eightByteCount;    // Number of eightbytes for this struct.
    DWORD eightByteClassifications[CLR_SYSTEMV_MAX_EIGHTBYTES_COUNT_TO_PASS_IN_REGISTERS]; // The eightbytes type
                                                                                           // classification.
    DWORD 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).
    DWORD eightByteOffsets[CLR_SYSTEMV_MAX_EIGHTBYTES_COUNT_TO_PASS_IN_REGISTERS]; // The start offset of the
                                                                                   // eightbytes (in bytes).
    DWORD result;
};

struct Agnostic_ResolveVirtualMethodKey
{
    DWORDLONG virtualMethod;
    DWORDLONG objClass;
    DWORDLONG context;
};

struct Agnostic_ResolveVirtualMethodResult
{
    bool      returnValue;
    DWORDLONG devirtualizedMethod;
    bool      requiresInstMethodTableArg;
    DWORDLONG exactContext;
};

struct ResolveTokenValue
{
    Agnostic_CORINFO_RESOLVED_TOKENout tokenOut;
    DWORD                              exceptionCode;
};

struct TryResolveTokenValue
{
    Agnostic_CORINFO_RESOLVED_TOKENout tokenOut;
    DWORD                              success;
};

struct GetTokenTypeAsHandleValue
{
    DWORDLONG hMethod;
    DWORDLONG hField;
};

struct GetVarArgsHandleValue
{
    DWORD     cbSig;
    DWORD     pSig_Index;
    DWORDLONG scope;
    DWORD     token;
};

struct CanGetVarArgsHandleValue
{
    DWORDLONG scope;
    DWORD     token;
};

struct GetCookieForPInvokeCalliSigValue
{
    DWORD     cbSig;
    DWORD     pSig_Index;
    DWORDLONG scope;
    DWORD     token;
};

struct CanGetCookieForPInvokeCalliSigValue
{
    DWORDLONG scope;
    DWORD     token;
};

struct GetReadyToRunHelper_TOKENin
{
    Agnostic_CORINFO_RESOLVED_TOKEN ResolvedToken;
    Agnostic_CORINFO_LOOKUP_KIND    GenericLookupKind;
    DWORD                           id;
};

struct GetReadyToRunHelper_TOKENout
{
    Agnostic_CORINFO_CONST_LOOKUP Lookup;
    bool                          result;
};

struct GetReadyToRunDelegateCtorHelper_TOKENIn
{
    Agnostic_CORINFO_RESOLVED_TOKEN TargetMethod;
    DWORDLONG                       delegateType;
};

struct Agnostic_RecordRelocation
{
    DWORDLONG location;
    DWORDLONG target;
    DWORD     fRelocType;
    DWORD     slotNum;
    DWORD     addlDelta;
};

struct Capture_AllocMemDetails
{
    ULONG              hotCodeSize;
    ULONG              coldCodeSize;
    ULONG              roDataSize;
    ULONG              xcptnsCount;
    CorJitAllocMemFlag flag;
    void*              hotCodeBlock;
    void*              coldCodeBlock;
    void*              roDataBlock;
};

struct allocGCInfoDetails
{
    size_t size;
    void*  retval;
};

struct Agnostic_AddressMap
{
    DWORDLONG Address;
    DWORD     size;
};

struct Agnostic_AllocGCInfo
{
    DWORDLONG size;
    DWORD     retval_offset;
};

struct Agnostic_AllocMemDetails
{
    DWORD     hotCodeSize;
    DWORD     coldCodeSize;
    DWORD     roDataSize;
    DWORD     xcptnsCount;
    DWORD     flag;
    DWORD     hotCodeBlock_offset;
    DWORD     coldCodeBlock_offset;
    DWORD     roDataBlock_offset;
    DWORDLONG hotCodeBlock;
    DWORDLONG coldCodeBlock;
    DWORDLONG roDataBlock;
};

struct Agnostic_AllocUnwindInfo
{
    DWORDLONG pHotCode;
    DWORDLONG pColdCode;
    DWORD     startOffset;
    DWORD     endOffset;
    DWORD     unwindSize;
    DWORD     pUnwindBlock_index;
    DWORD     funcKind;
};

struct Agnostic_CompileMethodResults
{
    DWORDLONG nativeEntry;
    DWORD     nativeSizeOfCode;
    DWORD     CorJitResult;
};

struct Agnostic_ReportInliningDecision
{
    DWORDLONG inlinerHnd;
    DWORDLONG inlineeHnd;
    DWORD     inlineResult;
    DWORD     reason_offset;
};

struct Agnostic_ReportTailCallDecision
{
    DWORDLONG callerHnd;
    DWORDLONG calleeHnd;
    DWORD     fIsTailPrefix;
    DWORD     tailCallResult;
    DWORD     reason_index;
};

struct Agnostic_ReserveUnwindInfo
{
    DWORD isFunclet;
    DWORD isColdCode;
    DWORD unwindSize;
};

struct Agnostic_SetBoundaries
{
    DWORDLONG ftn;
    DWORD     cMap;
    DWORD     pMap_offset;
};

struct Agnostic_SetVars
{
    DWORDLONG ftn;
    DWORD     cVars;
    DWORD     vars_offset;
};

struct Agnostic_SetPatchpointInfo
{
    DWORD     index;
};

struct Agnostic_RecordCallSite
{
    Agnostic_CORINFO_SIG_INFO callSig;
    DWORDLONG                 methodHandle;
};

#pragma pack(pop)

#endif // _Agnostic