summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJiyoung Yun <jy910.yun@samsung.com>2017-04-27 07:54:50 (GMT)
committerJiyoung Yun <jy910.yun@samsung.com>2017-04-27 07:54:50 (GMT)
commit5b975f8233e8c8d17b215372f89ca713b45d6a0b (patch)
tree0267bcc331458a01f4c26fafd28110a72273beb3 /src
parenta56e30c8d33048216567753d9d3fefc2152af8ac (diff)
downloadcoreclr-5b975f8233e8c8d17b215372f89ca713b45d6a0b.zip
coreclr-5b975f8233e8c8d17b215372f89ca713b45d6a0b.tar.gz
coreclr-5b975f8233e8c8d17b215372f89ca713b45d6a0b.tar.bz2
Imported Upstream version 2.0.0.11599upstream/2.0.0.11599
Diffstat (limited to 'src')
-rw-r--r--src/.nuget/Microsoft.NETCore.Runtime.CoreCLR/runtime.Linux.Microsoft.NETCore.Runtime.CoreCLR.props3
-rw-r--r--src/CMakeLists.txt6
-rw-r--r--src/ToolBox/SOS/NETCore/project.json9
-rw-r--r--src/ToolBox/SOS/Strike/CMakeLists.txt6
-rw-r--r--src/ToolBox/SOS/Strike/sos_unixexports.src1
-rw-r--r--src/ToolBox/SOS/Strike/sosdocsunix.txt15
-rw-r--r--src/ToolBox/SOS/Strike/strike.cpp74
-rw-r--r--src/ToolBox/SOS/Strike/util.h79
-rw-r--r--src/ToolBox/SOS/lldbplugin/CMakeLists.txt9
-rw-r--r--src/ToolBox/SOS/lldbplugin/soscommand.cpp1
-rw-r--r--src/ToolBox/superpmi/mcs/commandline.cpp107
-rw-r--r--src/ToolBox/superpmi/mcs/commandline.h89
-rw-r--r--src/ToolBox/superpmi/mcs/mcs.cpp4
-rw-r--r--src/ToolBox/superpmi/mcs/verbasmdump.cpp9
-rw-r--r--src/ToolBox/superpmi/mcs/verbasmdump.h4
-rw-r--r--src/ToolBox/superpmi/mcs/verbconcat.cpp42
-rw-r--r--src/ToolBox/superpmi/mcs/verbconcat.h2
-rw-r--r--src/ToolBox/superpmi/mcs/verbdump.cpp2
-rw-r--r--src/ToolBox/superpmi/mcs/verbdump.h2
-rw-r--r--src/ToolBox/superpmi/mcs/verbdumpmap.cpp12
-rw-r--r--src/ToolBox/superpmi/mcs/verbdumpmap.h2
-rw-r--r--src/ToolBox/superpmi/mcs/verbdumptoc.cpp2
-rw-r--r--src/ToolBox/superpmi/mcs/verbdumptoc.h2
-rw-r--r--src/ToolBox/superpmi/mcs/verbfracture.cpp11
-rw-r--r--src/ToolBox/superpmi/mcs/verbfracture.h3
-rw-r--r--src/ToolBox/superpmi/mcs/verbildump.cpp1416
-rw-r--r--src/ToolBox/superpmi/mcs/verbildump.h8
-rw-r--r--src/ToolBox/superpmi/mcs/verbinteg.cpp6
-rw-r--r--src/ToolBox/superpmi/mcs/verbinteg.h2
-rw-r--r--src/ToolBox/superpmi/mcs/verbmerge.cpp120
-rw-r--r--src/ToolBox/superpmi/mcs/verbmerge.h13
-rw-r--r--src/ToolBox/superpmi/mcs/verbremovedup.cpp44
-rw-r--r--src/ToolBox/superpmi/mcs/verbremovedup.h2
-rw-r--r--src/ToolBox/superpmi/mcs/verbsmarty.cpp25
-rw-r--r--src/ToolBox/superpmi/mcs/verbsmarty.h2
-rw-r--r--src/ToolBox/superpmi/mcs/verbstat.cpp15
-rw-r--r--src/ToolBox/superpmi/mcs/verbstat.h2
-rw-r--r--src/ToolBox/superpmi/mcs/verbstrip.cpp49
-rw-r--r--src/ToolBox/superpmi/mcs/verbstrip.h10
-rw-r--r--src/ToolBox/superpmi/mcs/verbtoc.cpp31
-rw-r--r--src/ToolBox/superpmi/mcs/verbtoc.h2
-rw-r--r--src/ToolBox/superpmi/superpmi-shared/asmdumper.cpp66
-rw-r--r--src/ToolBox/superpmi/superpmi-shared/asmdumper.h2
-rw-r--r--src/ToolBox/superpmi/superpmi-shared/callutils.cpp136
-rw-r--r--src/ToolBox/superpmi/superpmi-shared/callutils.h28
-rw-r--r--src/ToolBox/superpmi/superpmi-shared/compileresult.cpp821
-rw-r--r--src/ToolBox/superpmi/superpmi-shared/compileresult.h232
-rw-r--r--src/ToolBox/superpmi/superpmi-shared/coreclrcommoncallbacks.h20
-rw-r--r--src/ToolBox/superpmi/superpmi-shared/errorhandling.cpp76
-rw-r--r--src/ToolBox/superpmi/superpmi-shared/errorhandling.h42
-rw-r--r--src/ToolBox/superpmi/superpmi-shared/icorjitcompilerimpl.h88
-rw-r--r--src/ToolBox/superpmi/superpmi-shared/icorjithostimpl.h49
-rw-r--r--src/ToolBox/superpmi/superpmi-shared/icorjitinfoimpl.h2136
-rw-r--r--src/ToolBox/superpmi/superpmi-shared/lightweightmap.h439
-rw-r--r--src/ToolBox/superpmi/superpmi-shared/logging.cpp139
-rw-r--r--src/ToolBox/superpmi/superpmi-shared/logging.h80
-rw-r--r--src/ToolBox/superpmi/superpmi-shared/mclist.cpp105
-rw-r--r--src/ToolBox/superpmi/superpmi-shared/mclist.h12
-rw-r--r--src/ToolBox/superpmi/superpmi-shared/methodcontext.cpp4696
-rw-r--r--src/ToolBox/superpmi/superpmi-shared/methodcontext.h1079
-rw-r--r--src/ToolBox/superpmi/superpmi-shared/methodcontextiterator.cpp13
-rw-r--r--src/ToolBox/superpmi/superpmi-shared/methodcontextiterator.h24
-rw-r--r--src/ToolBox/superpmi/superpmi-shared/methodcontextreader.cpp111
-rw-r--r--src/ToolBox/superpmi/superpmi-shared/methodcontextreader.h60
-rw-r--r--src/ToolBox/superpmi/superpmi-shared/registertablexarch.h174
-rw-r--r--src/ToolBox/superpmi/superpmi-shared/runtimedetails.h14
-rw-r--r--src/ToolBox/superpmi/superpmi-shared/simpletimer.cpp11
-rw-r--r--src/ToolBox/superpmi/superpmi-shared/simpletimer.h4
-rw-r--r--src/ToolBox/superpmi/superpmi-shared/spmiutil.cpp12
-rw-r--r--src/ToolBox/superpmi/superpmi-shared/spmiutil.h2
-rw-r--r--src/ToolBox/superpmi/superpmi-shared/standardpch.h9
-rw-r--r--src/ToolBox/superpmi/superpmi-shared/tocfile.cpp13
-rw-r--r--src/ToolBox/superpmi/superpmi-shared/tocfile.h16
-rw-r--r--src/ToolBox/superpmi/superpmi-shared/typeutils.cpp110
-rw-r--r--src/ToolBox/superpmi/superpmi-shared/typeutils.h4
-rw-r--r--src/ToolBox/superpmi/superpmi-shim-collector/coreclrcallbacks.cpp28
-rw-r--r--src/ToolBox/superpmi/superpmi-shim-collector/coreclrcallbacks.h12
-rw-r--r--src/ToolBox/superpmi/superpmi-shim-collector/icorjitcompiler.cpp44
-rw-r--r--src/ToolBox/superpmi/superpmi-shim-collector/icorjitcompiler.h6
-rw-r--r--src/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.cpp1316
-rw-r--r--src/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.h10
-rw-r--r--src/ToolBox/superpmi/superpmi-shim-collector/ieememorymanager.cpp16
-rw-r--r--src/ToolBox/superpmi/superpmi-shim-collector/ieememorymanager.h16
-rw-r--r--src/ToolBox/superpmi/superpmi-shim-collector/iexecutionengine.cpp20
-rw-r--r--src/ToolBox/superpmi/superpmi-shim-collector/iexecutionengine.h17
-rw-r--r--src/ToolBox/superpmi/superpmi-shim-collector/jithost.cpp2
-rw-r--r--src/ToolBox/superpmi/superpmi-shim-collector/jithost.h2
-rw-r--r--src/ToolBox/superpmi/superpmi-shim-collector/superpmi-shim-collector.cpp168
-rw-r--r--src/ToolBox/superpmi/superpmi-shim-counter/coreclrcallbacks.cpp28
-rw-r--r--src/ToolBox/superpmi/superpmi-shim-counter/coreclrcallbacks.h12
-rw-r--r--src/ToolBox/superpmi/superpmi-shim-counter/icorjitcompiler.cpp22
-rw-r--r--src/ToolBox/superpmi/superpmi-shim-counter/icorjitcompiler.h6
-rw-r--r--src/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.cpp978
-rw-r--r--src/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.h9
-rw-r--r--src/ToolBox/superpmi/superpmi-shim-counter/ieememorymanager.cpp16
-rw-r--r--src/ToolBox/superpmi/superpmi-shim-counter/ieememorymanager.h10
-rw-r--r--src/ToolBox/superpmi/superpmi-shim-counter/iexecutionengine.cpp24
-rw-r--r--src/ToolBox/superpmi/superpmi-shim-counter/iexecutionengine.h21
-rw-r--r--src/ToolBox/superpmi/superpmi-shim-counter/jithost.h2
-rw-r--r--src/ToolBox/superpmi/superpmi-shim-counter/methodcallsummarizer.cpp102
-rw-r--r--src/ToolBox/superpmi/superpmi-shim-counter/methodcallsummarizer.h12
-rw-r--r--src/ToolBox/superpmi/superpmi-shim-counter/superpmi-shim-counter.cpp112
-rw-r--r--src/ToolBox/superpmi/superpmi-shim-counter/superpmi-shim-counter.h1
-rw-r--r--src/ToolBox/superpmi/superpmi-shim-simple/coreclrcallbacks.cpp24
-rw-r--r--src/ToolBox/superpmi/superpmi-shim-simple/coreclrcallbacks.h12
-rw-r--r--src/ToolBox/superpmi/superpmi-shim-simple/icorjitcompiler.cpp22
-rw-r--r--src/ToolBox/superpmi/superpmi-shim-simple/icorjitcompiler.h5
-rw-r--r--src/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.cpp977
-rw-r--r--src/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.h7
-rw-r--r--src/ToolBox/superpmi/superpmi-shim-simple/ieememorymanager.cpp16
-rw-r--r--src/ToolBox/superpmi/superpmi-shim-simple/ieememorymanager.h10
-rw-r--r--src/ToolBox/superpmi/superpmi-shim-simple/iexecutionengine.cpp24
-rw-r--r--src/ToolBox/superpmi/superpmi-shim-simple/iexecutionengine.h21
-rw-r--r--src/ToolBox/superpmi/superpmi-shim-simple/superpmi-shim-simple.cpp127
-rw-r--r--src/ToolBox/superpmi/superpmi-shim-simple/superpmi-shim-simple.h1
-rw-r--r--src/ToolBox/superpmi/superpmi/commandline.cpp58
-rw-r--r--src/ToolBox/superpmi/superpmi/commandline.h69
-rw-r--r--src/ToolBox/superpmi/superpmi/coreclrcallbacks.cpp50
-rw-r--r--src/ToolBox/superpmi/superpmi/coreclrcallbacks.h11
-rw-r--r--src/ToolBox/superpmi/superpmi/cycletimer.cpp14
-rw-r--r--src/ToolBox/superpmi/superpmi/cycletimer.h4
-rw-r--r--src/ToolBox/superpmi/superpmi/filecache.cpp134
-rw-r--r--src/ToolBox/superpmi/superpmi/filecache.h87
-rw-r--r--src/ToolBox/superpmi/superpmi/icorjitinfo.cpp1073
-rw-r--r--src/ToolBox/superpmi/superpmi/icorjitinfo.h9
-rw-r--r--src/ToolBox/superpmi/superpmi/ieememorymanager.cpp36
-rw-r--r--src/ToolBox/superpmi/superpmi/ieememorymanager.h20
-rw-r--r--src/ToolBox/superpmi/superpmi/iexecutionengine.cpp44
-rw-r--r--src/ToolBox/superpmi/superpmi/iexecutionengine.h25
-rw-r--r--src/ToolBox/superpmi/superpmi/jitdebugger.cpp124
-rw-r--r--src/ToolBox/superpmi/superpmi/jitdebugger.h16
-rw-r--r--src/ToolBox/superpmi/superpmi/jithost.cpp23
-rw-r--r--src/ToolBox/superpmi/superpmi/jitinstance.cpp151
-rw-r--r--src/ToolBox/superpmi/superpmi/jitinstance.h34
-rw-r--r--src/ToolBox/superpmi/superpmi/methodstatsemitter.cpp42
-rw-r--r--src/ToolBox/superpmi/superpmi/methodstatsemitter.h8
-rw-r--r--src/ToolBox/superpmi/superpmi/neardiffer.cpp481
-rw-r--r--src/ToolBox/superpmi/superpmi/neardiffer.h85
-rw-r--r--src/ToolBox/superpmi/superpmi/parallelsuperpmi.cpp193
-rw-r--r--src/ToolBox/superpmi/superpmi/superpmi.cpp149
-rw-r--r--src/classlibnative/bcltype/currency.cpp2
-rw-r--r--src/classlibnative/bcltype/currency.h2
-rw-r--r--src/classlibnative/bcltype/objectnative.cpp6
-rw-r--r--src/coreclr/hosts/coreconsole/coreconsole.cpp24
-rw-r--r--src/coreclr/hosts/corerun/corerun.cpp38
-rw-r--r--src/coreclr/hosts/inc/coreclrhost.h5
-rw-r--r--src/coreclr/hosts/unixcoreruncommon/coreruncommon.cpp50
-rw-r--r--src/debug/CMakeLists.txt2
-rw-r--r--src/debug/createdump/.gitmirrorall1
-rw-r--r--src/debug/createdump/CMakeLists.txt38
-rw-r--r--src/debug/createdump/crashinfo.cpp628
-rw-r--r--src/debug/createdump/crashinfo.h73
-rw-r--r--src/debug/createdump/createdump.cpp69
-rw-r--r--src/debug/createdump/createdump.h57
-rw-r--r--src/debug/createdump/datatarget.cpp263
-rw-r--r--src/debug/createdump/datatarget.h90
-rw-r--r--src/debug/createdump/dumpwriter.cpp486
-rw-r--r--src/debug/createdump/dumpwriter.h77
-rw-r--r--src/debug/createdump/main.cpp99
-rw-r--r--src/debug/createdump/memoryregion.h97
-rw-r--r--src/debug/createdump/threadinfo.cpp235
-rw-r--r--src/debug/createdump/threadinfo.h42
-rw-r--r--src/debug/daccess/dacfn.cpp2
-rw-r--r--src/debug/daccess/enummem.cpp103
-rw-r--r--src/debug/daccess/request_svr.cpp16
-rw-r--r--src/debug/di/dbgtransportmanager.cpp4
-rw-r--r--src/debug/inc/dump/dumpcommon.h29
-rw-r--r--src/dlls/mscordac/mscordac_unixexports.src5
-rw-r--r--src/dlls/mscoree/coreclr/CMakeLists.txt4
-rw-r--r--src/dlls/mscoree/mscoree.cpp2
-rw-r--r--src/dlls/mscoree/mscorwks_ntdef.src1
-rw-r--r--src/dlls/mscoree/mscorwks_unixexports.src1
-rw-r--r--src/dlls/mscoree/unixinterface.cpp41
-rw-r--r--src/gc/env/gcenv.os.h80
-rw-r--r--src/gc/gc.cpp52
-rw-r--r--src/gc/gc.h6
-rw-r--r--src/gc/gccommon.cpp12
-rw-r--r--src/gc/gcee.cpp11
-rw-r--r--src/gc/gchandletable.cpp128
-rw-r--r--src/gc/gchandletableimpl.h43
-rw-r--r--src/gc/gcimpl.h7
-rw-r--r--src/gc/gcinterface.h50
-rw-r--r--src/gc/gcpriv.h28
-rw-r--r--src/gc/handletable.cpp12
-rw-r--r--src/gc/handletable.inl21
-rw-r--r--src/gc/handletablecore.cpp38
-rw-r--r--src/gc/handletablescan.cpp4
-rw-r--r--src/gc/objecthandle.cpp138
-rw-r--r--src/gc/objecthandle.h24
-rw-r--r--src/gc/sample/GCSample.cpp8
-rw-r--r--src/gc/unix/CMakeLists.txt1
-rw-r--r--src/gc/unix/config.h.in4
-rw-r--r--src/gc/unix/configure.cmake17
-rw-r--r--src/gc/unix/events.cpp323
-rw-r--r--src/gc/unix/gcenv.unix.cpp41
-rw-r--r--src/gc/unix/globals.h30
-rw-r--r--src/gc/windows/gcenv.windows.cpp142
-rw-r--r--src/gcinfo/CMakeLists.txt10
-rw-r--r--src/gcinfo/gcinfo_arm/CMakeLists.txt7
-rw-r--r--src/gcinfo/gcinfo_arm64/CMakeLists.txt7
-rw-r--r--src/ilasm/asmman.cpp7
-rw-r--r--src/inc/MSCOREE.IDL18
-rw-r--r--src/inc/arrayholder.h80
-rw-r--r--src/inc/corhost.h5
-rw-r--r--src/inc/corinfo.h3
-rw-r--r--src/inc/releaseholder.h77
-rw-r--r--src/inc/utilcode.h12
-rw-r--r--src/jit/block.cpp562
-rw-r--r--src/jit/block.h48
-rw-r--r--src/jit/codegenarm.cpp109
-rw-r--r--src/jit/codegenarm64.cpp210
-rw-r--r--src/jit/codegenarmarch.cpp216
-rw-r--r--src/jit/codegencommon.cpp26
-rw-r--r--src/jit/codegeninterface.h2
-rw-r--r--src/jit/codegenlinear.h2
-rw-r--r--src/jit/codegenxarch.cpp300
-rw-r--r--src/jit/compiler.cpp169
-rw-r--r--src/jit/compiler.h17
-rw-r--r--src/jit/compiler.hpp135
-rw-r--r--src/jit/dataflow.h6
-rw-r--r--src/jit/emitarm.cpp125
-rw-r--r--src/jit/emitarm64.cpp32
-rw-r--r--src/jit/emitxarch.cpp11
-rw-r--r--src/jit/error.h24
-rw-r--r--src/jit/flowgraph.cpp123
-rw-r--r--src/jit/gentree.cpp451
-rw-r--r--src/jit/gentree.h7
-rw-r--r--src/jit/importer.cpp201
-rw-r--r--src/jit/instr.cpp9
-rw-r--r--src/jit/jit.h6
-rw-r--r--src/jit/jitconfigvalues.h6
-rw-r--r--src/jit/lclvars.cpp2
-rw-r--r--src/jit/liveness.cpp6
-rw-r--r--src/jit/lsra.cpp19
-rw-r--r--src/jit/lsraarm.cpp66
-rw-r--r--src/jit/lsraarm64.cpp15
-rw-r--r--src/jit/morph.cpp232
-rw-r--r--src/jit/optimizer.cpp9
-rw-r--r--src/jit/protononjit/CMakeLists.txt4
-rw-r--r--src/jit/simdcodegenxarch.cpp78
-rw-r--r--src/jit/ssabuilder.cpp5
-rw-r--r--src/jit/valuenum.cpp4
-rw-r--r--src/mscorlib/Resources/Strings.resx12
-rw-r--r--src/mscorlib/System.Private.CoreLib.csproj7
-rw-r--r--src/mscorlib/shared/Interop/Unix/System.Native/Interop.Stat.cs2
-rw-r--r--src/mscorlib/shared/Interop/Windows/Kernel32/Interop.GetCPInfo.cs24
-rw-r--r--src/mscorlib/shared/System.Private.CoreLib.Shared.projitems7
-rw-r--r--src/mscorlib/shared/System/CharEnumerator.cs1
-rw-r--r--src/mscorlib/shared/System/Diagnostics/Tracing/EventCounter.cs436
-rw-r--r--src/mscorlib/shared/System/Diagnostics/Tracing/EventProvider.cs18
-rw-r--r--src/mscorlib/shared/System/ReadOnlySpan.cs (renamed from src/mscorlib/src/System/ReadOnlySpan.cs)22
-rw-r--r--src/mscorlib/shared/System/Runtime/CompilerServices/IsReadOnlyAttribute.cs (renamed from src/mscorlib/shared/System/Runtime/CompilerServices/ReadOnlyAttribute.cs)4
-rw-r--r--src/mscorlib/shared/System/Runtime/CompilerServices/RuntimeFeature.cs4
-rw-r--r--src/mscorlib/shared/System/Span.NonGeneric.cs (renamed from src/mscorlib/src/System/Span.cs)400
-rw-r--r--src/mscorlib/shared/System/Span.cs413
-rw-r--r--src/mscorlib/shared/System/Text/StringBuilder.cs78
-rw-r--r--src/mscorlib/shared/System/Threading/Tasks/TaskExtensions.cs4
-rw-r--r--src/mscorlib/src/Microsoft/Win32/Registry.cs134
-rw-r--r--src/mscorlib/src/Microsoft/Win32/RegistryKey.cs672
-rw-r--r--src/mscorlib/src/Microsoft/Win32/RegistryValueKind.cs10
-rw-r--r--src/mscorlib/src/Microsoft/Win32/RegistryView.cs22
-rw-r--r--src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeRegistryHandle.cs10
-rw-r--r--src/mscorlib/src/System/Collections/Generic/Dictionary.cs89
-rw-r--r--src/mscorlib/src/System/Collections/Generic/List.cs1
-rw-r--r--src/mscorlib/src/System/Delegate.cs5
-rw-r--r--src/mscorlib/src/System/Environment.cs2
-rw-r--r--src/mscorlib/src/System/Globalization/CompareInfo.cs48
-rw-r--r--src/mscorlib/src/System/Globalization/HijriCalendar.Win32.cs61
-rw-r--r--src/mscorlib/src/System/Globalization/JapaneseCalendar.Win32.cs38
-rw-r--r--src/mscorlib/src/System/IO/Stream.cs4
-rw-r--r--src/mscorlib/src/System/Reflection/Assembly.CoreCLR.cs24
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/TaskAwaiter.cs2
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/jithelpers.cs9
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/Marshal.cs3
-rw-r--r--src/mscorlib/src/System/String.Manipulation.cs7
-rw-r--r--src/mscorlib/src/System/String.cs2
-rw-r--r--src/mscorlib/src/System/Threading/Tasks/Task.cs3
-rw-r--r--src/mscorlib/src/System/Threading/Tasks/TaskContinuation.cs2
-rw-r--r--src/mscorlib/src/System/Threading/Tasks/future.cs6
-rw-r--r--src/mscorlib/src/System/ThrowHelper.cs1
-rw-r--r--src/mscorlib/src/System/TimeZoneInfo.Win32.cs30
-rw-r--r--src/mscorlib/src/System/TimeZoneInfo.cs114
-rw-r--r--src/pal/CMakeLists.txt7
-rw-r--r--src/pal/inc/pal.h170
-rw-r--r--src/pal/inc/pal_mstypes.h2
-rw-r--r--src/pal/inc/rt/intsafe.h165
-rw-r--r--src/pal/inc/rt/palrt.h2
-rw-r--r--src/pal/prebuilt/inc/mscoree.h16
-rw-r--r--src/pal/src/CMakeLists.txt7
-rw-r--r--src/pal/src/arch/amd64/processor.cpp2
-rw-r--r--src/pal/src/arch/i386/asmconstants.h1
-rw-r--r--src/pal/src/arch/i386/context2.S3
-rw-r--r--src/pal/src/arch/i386/exceptionhelper.S2
-rw-r--r--src/pal/src/arch/i386/signalhandlerhelper.cpp1
-rw-r--r--src/pal/src/config.h.in7
-rw-r--r--src/pal/src/configure.cmake15
-rw-r--r--src/pal/src/exception/seh-unwind.cpp1
-rw-r--r--src/pal/src/file/disk.cpp7
-rw-r--r--src/pal/src/file/file.cpp7
-rw-r--r--src/pal/src/include/pal/dbgmsg.h2
-rw-r--r--src/pal/src/include/pal/numa.h39
-rw-r--r--src/pal/src/include/pal/process.h19
-rw-r--r--src/pal/src/init/pal.cpp14
-rw-r--r--src/pal/src/map/map.cpp59
-rw-r--r--src/pal/src/map/virtual.cpp79
-rw-r--r--src/pal/src/misc/sysinfo.cpp55
-rw-r--r--src/pal/src/numa/numa.cpp692
-rw-r--r--src/pal/src/synchmgr/synchmanager.cpp81
-rw-r--r--src/pal/src/synchmgr/synchmanager.hpp3
-rw-r--r--src/pal/src/synchobj/mutex.cpp2
-rw-r--r--src/pal/src/thread/context.cpp3
-rw-r--r--src/pal/src/thread/process.cpp211
-rw-r--r--src/strongname/api/strongnamecoreclr.cpp8
-rw-r--r--src/unwinder/i386/unwinder_i386.cpp16
-rw-r--r--src/utilcode/pedecoder.cpp3
-rw-r--r--src/utilcode/util.cpp34
-rw-r--r--src/vm/CMakeLists.txt2
-rw-r--r--src/vm/amd64/JitHelpers_SingleAppDomain.asm64
-rw-r--r--src/vm/amd64/jithelpers_singleappdomain.S49
-rw-r--r--src/vm/amd64/unixstubs.cpp6
-rw-r--r--src/vm/appdomain.cpp26
-rw-r--r--src/vm/appdomain.hpp26
-rw-r--r--src/vm/argdestination.h43
-rw-r--r--src/vm/arm64/asmconstants.h6
-rw-r--r--src/vm/arm64/asmhelpers.S65
-rw-r--r--src/vm/arm64/asmhelpers.asm60
-rw-r--r--src/vm/arm64/stubs.cpp15
-rw-r--r--src/vm/assembly.cpp5
-rw-r--r--src/vm/callingconvention.h43
-rw-r--r--src/vm/ceemain.cpp14
-rw-r--r--src/vm/codeman.cpp100
-rw-r--r--src/vm/codeman.h1
-rw-r--r--src/vm/compile.cpp4
-rw-r--r--src/vm/corhost.cpp43
-rw-r--r--src/vm/dynamicmethod.cpp25
-rw-r--r--src/vm/dynamicmethod.h3
-rw-r--r--src/vm/ecalllist.h1
-rw-r--r--src/vm/eetwain.cpp100
-rw-r--r--src/vm/exceptionhandling.cpp38
-rw-r--r--src/vm/exceptionhandling.h11
-rw-r--r--src/vm/exstate.cpp6
-rw-r--r--src/vm/exstate.h2
-rw-r--r--src/vm/frames.h6
-rw-r--r--src/vm/gcenv.ee.cpp14
-rw-r--r--src/vm/gcenv.os.cpp209
-rw-r--r--src/vm/gchandletableutilities.h354
-rw-r--r--src/vm/gchandleutilities.h495
-rw-r--r--src/vm/gcheaputilities.cpp33
-rw-r--r--src/vm/gdbjit.cpp2
-rw-r--r--src/vm/hosting.cpp10
-rw-r--r--src/vm/i386/asmhelpers.S23
-rw-r--r--src/vm/i386/cgenx86.cpp62
-rw-r--r--src/vm/i386/ehhelpers.S2
-rw-r--r--src/vm/i386/excepx86.cpp12
-rw-r--r--src/vm/i386/gmsx86.cpp8
-rw-r--r--src/vm/jitinterface.cpp36
-rw-r--r--src/vm/jitinterfacegen.cpp15
-rw-r--r--src/vm/method.cpp2
-rw-r--r--src/vm/methodtable.h8
-rw-r--r--src/vm/methodtable.inl4
-rw-r--r--src/vm/mscorlib.h5
-rw-r--r--src/vm/object.cpp8
-rw-r--r--src/vm/object.h10
-rw-r--r--src/vm/peimagelayout.cpp26
-rw-r--r--src/vm/safehandle.cpp4
-rw-r--r--src/vm/siginfo.cpp5
-rw-r--r--src/vm/stubhelpers.cpp2
-rw-r--r--src/vm/stubhelpers.h2
-rw-r--r--src/vm/threads.cpp2
-rw-r--r--src/vm/threads.h27
-rw-r--r--src/vm/threadsuspend.cpp4
-rw-r--r--src/vm/typedesc.cpp6
-rw-r--r--src/vm/util.cpp10
-rw-r--r--src/zap/zapimage.cpp4
-rw-r--r--src/zap/zapwriter.cpp10
375 files changed, 19890 insertions, 14293 deletions
diff --git a/src/.nuget/Microsoft.NETCore.Runtime.CoreCLR/runtime.Linux.Microsoft.NETCore.Runtime.CoreCLR.props b/src/.nuget/Microsoft.NETCore.Runtime.CoreCLR/runtime.Linux.Microsoft.NETCore.Runtime.CoreCLR.props
index db8b031..4ad2538 100644
--- a/src/.nuget/Microsoft.NETCore.Runtime.CoreCLR/runtime.Linux.Microsoft.NETCore.Runtime.CoreCLR.props
+++ b/src/.nuget/Microsoft.NETCore.Runtime.CoreCLR/runtime.Linux.Microsoft.NETCore.Runtime.CoreCLR.props
@@ -4,8 +4,7 @@
<_PlatformDoesNotSupportNiFiles Condition="'$(Platform)' == 'arm'">true</_PlatformDoesNotSupportNiFiles>
<_PlatformDoesNotSupportNiFiles Condition="'$(Platform)' == 'armel'">true</_PlatformDoesNotSupportNiFiles>
<_PlatformDoesNotSupportNiFiles Condition="'$(Platform)' == 'x86'">true</_PlatformDoesNotSupportNiFiles>
- <_PlatformDoesNotSupportEventTrace Condition="'$(Platform)' == 'arm'">true</_PlatformDoesNotSupportEventTrace>
- <_PlatformDoesNotSupportEventTrace Condition="'$(Platform)' == 'armel'">true</_PlatformDoesNotSupportEventTrace>
+ <_PlatformDoesNotSupportEventTrace Condition="'$(_runtimeOSFamily)' == 'tizen'">true</_PlatformDoesNotSupportEventTrace>
<_PlatformDoesNotSupportEventTrace Condition="'$(Platform)' == 'x86'">true</_PlatformDoesNotSupportEventTrace>
</PropertyGroup>
<ItemGroup>
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index d13e8f9..9598d0c 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -96,6 +96,12 @@ function(add_executable_clr)
endfunction()
if(CLR_CMAKE_PLATFORM_UNIX)
+ if(CLR_CMAKE_PLATFORM_LINUX)
+ if(CLR_CMAKE_PLATFORM_UNIX_AMD64)
+ add_subdirectory(debug/createdump)
+ endif(CLR_CMAKE_PLATFORM_UNIX_AMD64)
+ endif(CLR_CMAKE_PLATFORM_LINUX)
+
add_subdirectory(ToolBox/SOS/Strike)
# Include the dummy c++ include files
diff --git a/src/ToolBox/SOS/NETCore/project.json b/src/ToolBox/SOS/NETCore/project.json
index 6b2061a..a92b173 100644
--- a/src/ToolBox/SOS/NETCore/project.json
+++ b/src/ToolBox/SOS/NETCore/project.json
@@ -11,14 +11,5 @@
"portable-net45+win8"
]
}
- },
- "runtimes": {
- "win7-x86": {},
- "win7-x64": {},
- "ubuntu.14.04-x64": {},
- "osx.10.10-x64": {},
- "centos.7-x64": {},
- "rhel.7-x64": {},
- "debian.8-x64": {}
}
}
diff --git a/src/ToolBox/SOS/Strike/CMakeLists.txt b/src/ToolBox/SOS/Strike/CMakeLists.txt
index 8ba0ade..ff5f864 100644
--- a/src/ToolBox/SOS/Strike/CMakeLists.txt
+++ b/src/ToolBox/SOS/Strike/CMakeLists.txt
@@ -145,6 +145,12 @@ else(WIN32)
endif(WIN32)
if(CLR_CMAKE_PLATFORM_ARCH_AMD64)
+ if(CLR_CMAKE_PLATFORM_LINUX)
+ list(APPEND
+ SOS_LIBRARY
+ createdump_lib
+ )
+ endif(CLR_CMAKE_PLATFORM_LINUX)
set(SOS_SOURCES_ARCH
disasmX86.cpp
)
diff --git a/src/ToolBox/SOS/Strike/sos_unixexports.src b/src/ToolBox/SOS/Strike/sos_unixexports.src
index ed811b6..a8cc712 100644
--- a/src/ToolBox/SOS/Strike/sos_unixexports.src
+++ b/src/ToolBox/SOS/Strike/sos_unixexports.src
@@ -4,6 +4,7 @@
bpmd
ClrStack
+CreateDump
DumpArray
DumpAssembly
DumpClass
diff --git a/src/ToolBox/SOS/Strike/sosdocsunix.txt b/src/ToolBox/SOS/Strike/sosdocsunix.txt
index 5ab2b31..517227c 100644
--- a/src/ToolBox/SOS/Strike/sosdocsunix.txt
+++ b/src/ToolBox/SOS/Strike/sosdocsunix.txt
@@ -53,8 +53,8 @@ DumpSigElem
Examining the GC history Other
----------------------------- -----------------------------
HistInit (histinit) FAQ
-HistRoot (histroot) Help (soshelp)
-HistObj (histobj)
+HistRoot (histroot) CreateDump (createdump)
+HistObj (histobj) Help (soshelp)
HistObjFind (histobjfind)
HistClear (histclear)
\\
@@ -618,6 +618,17 @@ should only need to execute "clrstack -i", and from there, click on the DML
hyperlinks to inspect the different managed stack frames and managed variables.
\\
+COMMAND: createdump.
+createdump [options] [dumpFileName]
+-n - create minidump.
+-h - create minidump with heap (default).
+-t - create triage minidump.
+-d - enable diagnostic messages.
+
+Creates a platform (ELF core on Linux, etc.) minidump. The pid can be placed in the dump
+file name with %d. The default is '/tmp/coredump.%d'.
+\\
+
COMMAND: ip2md.
IP2MD <Code address>
diff --git a/src/ToolBox/SOS/Strike/strike.cpp b/src/ToolBox/SOS/Strike/strike.cpp
index 2b54b4f..0d5d8c3 100644
--- a/src/ToolBox/SOS/Strike/strike.cpp
+++ b/src/ToolBox/SOS/Strike/strike.cpp
@@ -14368,6 +14368,80 @@ _EFN_GetManagedObjectFieldInfo(
return S_OK;
}
+#ifdef FEATURE_PAL
+
+#ifdef __linux__
+#include <dumpcommon.h>
+#include "datatarget.h"
+extern bool CreateDumpForSOS(const char* programPath, const char* dumpPathTemplate, pid_t pid, MINIDUMP_TYPE minidumpType, ICLRDataTarget* dataTarget);
+extern bool g_diagnostics;
+#endif // __linux__
+
+DECLARE_API(CreateDump)
+{
+ INIT_API();
+#ifdef __linux__
+ StringHolder sFileName;
+ BOOL normal = FALSE;
+ BOOL withHeap = FALSE;
+ BOOL triage = FALSE;
+ BOOL diag = FALSE;
+
+ size_t nArg = 0;
+ CMDOption option[] =
+ { // name, vptr, type, hasValue
+ {"-n", &normal, COBOOL, FALSE},
+ {"-h", &withHeap, COBOOL, FALSE},
+ {"-t", &triage, COBOOL, FALSE},
+ {"-d", &diag, COBOOL, FALSE},
+ };
+ CMDValue arg[] =
+ { // vptr, type
+ {&sFileName.data, COSTRING}
+ };
+ if (!GetCMDOption(args, option, _countof(option), arg, _countof(arg), &nArg))
+ {
+ return E_FAIL;
+ }
+ MINIDUMP_TYPE minidumpType = MiniDumpWithPrivateReadWriteMemory;
+ ULONG pid = 0;
+ g_ExtSystem->GetCurrentProcessId(&pid);
+
+ if (withHeap)
+ {
+ minidumpType = MiniDumpWithPrivateReadWriteMemory;
+ }
+ else if (triage)
+ {
+ minidumpType = MiniDumpFilterTriage;
+ }
+ else if (normal)
+ {
+ minidumpType = MiniDumpNormal;
+ }
+ g_diagnostics = diag;
+
+ const char* programPath = g_ExtServices->GetCoreClrDirectory();
+ const char* dumpPathTemplate = "/tmp/coredump.%d";
+ ToRelease<ICLRDataTarget> dataTarget = new DataTarget();
+ dataTarget->AddRef();
+
+ if (sFileName.data != nullptr)
+ {
+ dumpPathTemplate = sFileName.data;
+ }
+ if (!CreateDumpForSOS(programPath, dumpPathTemplate, pid, minidumpType, dataTarget))
+ {
+ Status = E_FAIL;
+ }
+#else // __linux__
+ ExtErr("CreateDump not supported on this platform\n");
+#endif // __linux__
+ return Status;
+}
+
+#endif // FEATURE_PAL
+
void PrintHelp (__in_z LPCSTR pszCmdName)
{
static LPSTR pText = NULL;
diff --git a/src/ToolBox/SOS/Strike/util.h b/src/ToolBox/SOS/Strike/util.h
index 4612acc..6d0e796 100644
--- a/src/ToolBox/SOS/Strike/util.h
+++ b/src/ToolBox/SOS/Strike/util.h
@@ -1429,84 +1429,7 @@ SafeReadMemory (TO_TADDR(src), &(dst), sizeof(dst), NULL)
extern "C" PDEBUG_DATA_SPACES g_ExtData;
-template <class T>
-class ArrayHolder
-{
-public:
- ArrayHolder(T *ptr)
- : mPtr(ptr)
- {
- }
-
- ~ArrayHolder()
- {
- Clear();
- }
-
- ArrayHolder(const ArrayHolder &rhs)
- {
- mPtr = const_cast<ArrayHolder *>(&rhs)->Detach();
- }
-
- ArrayHolder &operator=(T *ptr)
- {
- Clear();
- mPtr = ptr;
- return *this;
- }
-
- const T &operator[](int i) const
- {
- return mPtr[i];
- }
-
- T &operator[](int i)
- {
- return mPtr[i];
- }
-
- operator const T *() const
- {
- return mPtr;
- }
-
- operator T *()
- {
- return mPtr;
- }
-
- T **operator&()
- {
- return &mPtr;
- }
-
- T *GetPtr()
- {
- return mPtr;
- }
-
- T *Detach()
- {
- T *ret = mPtr;
- mPtr = NULL;
- return ret;
- }
-
-private:
- void Clear()
- {
- if (mPtr)
- {
- delete [] mPtr;
- mPtr = NULL;
- }
- }
-
-private:
- T *mPtr;
-};
-
-
+#include <arrayholder.h>
// This class acts a smart pointer which calls the Release method on any object
// you place in it when the ToRelease class falls out of scope. You may use it
diff --git a/src/ToolBox/SOS/lldbplugin/CMakeLists.txt b/src/ToolBox/SOS/lldbplugin/CMakeLists.txt
index 247c700..f0c2176 100644
--- a/src/ToolBox/SOS/lldbplugin/CMakeLists.txt
+++ b/src/ToolBox/SOS/lldbplugin/CMakeLists.txt
@@ -55,14 +55,15 @@ if(NOT ENABLE_LLDBPLUGIN)
endif()
# Check for LLDB library
-find_library(LLDB NAMES LLDB lldb lldb-3.9 lldb-3.8 lldb-3.7 lldb-3.6 lldb-3.5 PATHS "${WITH_LLDB_LIBS}" PATH_SUFFIXES llvm NO_DEFAULT_PATH)
-find_library(LLDB NAMES LLDB lldb lldb-3.9 lldb-3.8 lldb-3.7 lldb-3.6 lldb-3.5 PATH_SUFFIXES llvm)
+find_library(LLDB NAMES LLDB lldb lldb-4.0 lldb-3.9 lldb-3.8 lldb-3.7 lldb-3.6 lldb-3.5 PATHS "${WITH_LLDB_LIBS}" PATH_SUFFIXES llvm NO_DEFAULT_PATH)
+find_library(LLDB NAMES LLDB lldb lldb-4.0 lldb-3.8 lldb-3.7 lldb-3.6 lldb-3.5 PATH_SUFFIXES llvm)
if(LLDB STREQUAL LLDB-NOTFOUND)
if(REQUIRE_LLDBPLUGIN)
- message(FATAL_ERROR "Cannot find lldb-3.5, lldb-3.6, lldb-3.8 or lldb-3.9. Try installing lldb-3.6-dev (or the appropriate package for your platform)")
+ set(MESSAGE_MODE FATAL_ERROR)
else()
- message(WARNING "Cannot find lldb-3.5,lldb-3.6, lldb-3.8 or lldb-3.9. Try installing lldb-3.6-dev (or the appropriate package for your platform)")
+ set(MESSAGE_MODE WARNING)
endif()
+ message(${MESSAGE_MODE} "Cannot find lldb-3.5, lldb-3.6, lldb-3.8, lldb-3.9 or lldb-4.0. Try installing lldb-3.6-dev (or the appropriate package for your platform)")
return()
endif()
diff --git a/src/ToolBox/SOS/lldbplugin/soscommand.cpp b/src/ToolBox/SOS/lldbplugin/soscommand.cpp
index 4ca7ce3..64d198c 100644
--- a/src/ToolBox/SOS/lldbplugin/soscommand.cpp
+++ b/src/ToolBox/SOS/lldbplugin/soscommand.cpp
@@ -125,6 +125,7 @@ sosCommandInitialize(lldb::SBDebugger debugger)
interpreter.AddCommand("bpmd", new sosCommand("bpmd"), "Creates a breakpoint at the specified managed method in the specified module.");
interpreter.AddCommand("clrstack", new sosCommand("ClrStack"), "Provides a stack trace of managed code only.");
interpreter.AddCommand("clrthreads", new sosCommand("Threads"), "List the managed threads running.");
+ interpreter.AddCommand("createdump", new sosCommand("CreateDump"), "Create a xplat minidump.");
interpreter.AddCommand("clru", new sosCommand("u"), "Displays an annotated disassembly of a managed method.");
interpreter.AddCommand("dumpclass", new sosCommand("DumpClass"), "Displays information about a EE class structure at the specified address.");
interpreter.AddCommand("dumpheap", new sosCommand("DumpHeap"), "Displays info about the garbage-collected heap and collection statistics about objects.");
diff --git a/src/ToolBox/superpmi/mcs/commandline.cpp b/src/ToolBox/superpmi/mcs/commandline.cpp
index ea6a4a3..cc2244d 100644
--- a/src/ToolBox/superpmi/mcs/commandline.cpp
+++ b/src/ToolBox/superpmi/mcs/commandline.cpp
@@ -134,25 +134,26 @@ void CommandLine::DumpHelp(const char* program)
printf("Note: Inputs are case insensitive.\n");
}
-//Assumption: All inputs are initialized to default or real value. we'll just set the stuff in what we see on the command line.
-//Assumption: Single byte names are passed in.. mb stuff doesnt cause an obvious problem... but it might have issues...
-//Assumption: Values larger than 2^31 aren't expressible from the commandline.... (atoi) Unless you pass in negatives.. :-|
+// Assumption: All inputs are initialized to default or real value. we'll just set the stuff in what we see on the
+// command line. Assumption: Single byte names are passed in.. mb stuff doesnt cause an obvious problem... but it might
+// have issues... Assumption: Values larger than 2^31 aren't expressible from the commandline.... (atoi) Unless you pass
+// in negatives.. :-|
bool CommandLine::Parse(int argc, char* argv[], /* OUT */ Options* o)
{
- size_t argLen = 0;
+ size_t argLen = 0;
size_t tempLen = 0;
- bool foundVerb = false;
+ bool foundVerb = false;
bool foundFile1 = false;
bool foundFile2 = false;
- if (argc == 1) //Print help when no args are passed
+ if (argc == 1) // Print help when no args are passed
{
DumpHelp(argv[0]);
return false;
}
- for (int i = 1; i<argc; i++)
+ for (int i = 1; i < argc; i++)
{
bool isASwitch = (argv[i][0] == '-');
#ifndef FEATURE_PAL
@@ -162,98 +163,97 @@ bool CommandLine::Parse(int argc, char* argv[], /* OUT */ Options* o)
}
#endif // !FEATURE_PAL
- //Process a switch
+ // Process a switch
if (isASwitch)
{
argLen = strlen(argv[i]);
- if (argLen >1)
- argLen--; //adjust for leading switch
+ if (argLen > 1)
+ argLen--; // adjust for leading switch
else
{
DumpHelp(argv[0]);
return false;
}
- if ((_strnicmp(&argv[i][1], "help", argLen) == 0) ||
- (_strnicmp(&argv[i][1], "?", argLen) == 0))
+ if ((_strnicmp(&argv[i][1], "help", argLen) == 0) || (_strnicmp(&argv[i][1], "?", argLen) == 0))
{
DumpHelp(argv[0]);
return false;
}
else if ((_strnicmp(&argv[i][1], "ASMDump", argLen) == 0))
{
- tempLen = strlen(argv[i]);
- foundVerb = true;
+ tempLen = strlen(argv[i]);
+ foundVerb = true;
o->actionASMDump = true;
- if (i + 1 < argc) //Peek to see if we have an mcl file or an integer next
+ if (i + 1 < argc) // Peek to see if we have an mcl file or an integer next
goto processMCL;
}
else if ((_strnicmp(&argv[i][1], "concat", argLen) == 0))
{
- tempLen = strlen(argv[i]);
- foundVerb = true;
+ tempLen = strlen(argv[i]);
+ foundVerb = true;
o->actionConcat = true;
}
else if ((_strnicmp(&argv[i][1], "copy", argLen) == 0))
{
- tempLen = strlen(argv[i]);
- foundVerb = true;
+ tempLen = strlen(argv[i]);
+ foundVerb = true;
o->actionCopy = true;
- if (i + 1 < argc) //Peek to see if we have an mcl file or an integer next
+ if (i + 1 < argc) // Peek to see if we have an mcl file or an integer next
goto processMCL;
}
else if ((_strnicmp(&argv[i][1], "dump", argLen) == 0))
{
- tempLen = strlen(argv[i]);
- foundVerb = true;
+ tempLen = strlen(argv[i]);
+ foundVerb = true;
o->actionDump = true;
- if (i + 1 < argc) //Peek to see if we have an mcl file or an integer next
+ if (i + 1 < argc) // Peek to see if we have an mcl file or an integer next
goto processMCL;
}
else if ((_strnicmp(&argv[i][1], "fracture", argLen) == 0))
{
- tempLen = strlen(argv[i]);
- foundVerb = true;
+ tempLen = strlen(argv[i]);
+ foundVerb = true;
o->actionFracture = true;
- if (i + 1 < argc) //Peek to see if we have an mcl file or an integer next
+ if (i + 1 < argc) // Peek to see if we have an mcl file or an integer next
goto processMCL;
}
else if ((_strnicmp(&argv[i][1], "dumpmap", argLen) == 0))
{
- tempLen = strlen(argv[i]);
- foundVerb = true;
+ tempLen = strlen(argv[i]);
+ foundVerb = true;
o->actionDumpMap = true;
}
else if ((_strnicmp(&argv[i][1], "dumptoc", argLen) == 0))
{
- tempLen = strlen(argv[i]);
- foundVerb = true;
+ tempLen = strlen(argv[i]);
+ foundVerb = true;
o->actionDumpToc = true;
}
else if ((_strnicmp(&argv[i][1], "ildump", argLen) == 0))
{
- tempLen = strlen(argv[i]);
- foundVerb = true;
+ tempLen = strlen(argv[i]);
+ foundVerb = true;
o->actionILDump = true;
- if (i + 1 < argc) //Peek to see if we have an mcl file or an integer next
+ if (i + 1 < argc) // Peek to see if we have an mcl file or an integer next
goto processMCL;
}
else if ((_strnicmp(&argv[i][1], "merge", argLen) == 0))
{
- tempLen = strlen(argv[i]);
- foundVerb = true;
+ tempLen = strlen(argv[i]);
+ foundVerb = true;
o->actionMerge = true;
}
else if ((_strnicmp(&argv[i][1], "recursive", argLen) == 0))
{
- tempLen = strlen(argv[i]);
+ tempLen = strlen(argv[i]);
o->recursive = true;
}
else if ((_strnicmp(&argv[i][1], "toc", argLen) == 0))
{
- tempLen = strlen(argv[i]);
- foundVerb = true;
+ tempLen = strlen(argv[i]);
+ foundVerb = true;
o->actionTOC = true;
}
else if ((_strnicmp(&argv[i][1], "input", argLen) == 0))
@@ -294,8 +294,8 @@ bool CommandLine::Parse(int argc, char* argv[], /* OUT */ Options* o)
}
else if ((_strnicmp(&argv[i][1], "integ", argLen) == 0))
{
- tempLen = strlen(argv[i]);
- foundVerb = true;
+ tempLen = strlen(argv[i]);
+ foundVerb = true;
o->actionInteg = true;
}
else if ((_strnicmp(&argv[i][1], "mcl", argLen) == 0))
@@ -316,24 +316,24 @@ bool CommandLine::Parse(int argc, char* argv[], /* OUT */ Options* o)
}
else if ((_strnicmp(&argv[i][1], "removeDup", argLen) == 0))
{
- tempLen = strlen(argv[i]);
- foundVerb = true;
+ tempLen = strlen(argv[i]);
+ foundVerb = true;
o->actionRemoveDup = true;
}
else if ((_strnicmp(&argv[i][1], "stat", argLen) == 0))
{
- tempLen = strlen(argv[i]);
- foundVerb = true;
+ tempLen = strlen(argv[i]);
+ foundVerb = true;
o->actionStat = true;
- if (i + 1 < argc) //Peek to see if we have an mcl file or an integer next
+ if (i + 1 < argc) // Peek to see if we have an mcl file or an integer next
goto processMCL;
}
else if ((_strnicmp(&argv[i][1], "strip", argLen) == 0))
{
- tempLen = strlen(argv[i]);
- foundVerb = true;
+ tempLen = strlen(argv[i]);
+ foundVerb = true;
o->actionStrip = true;
- if (i + 1 < argc) //Peek to see if we have an mcl file or an integer next
+ if (i + 1 < argc) // Peek to see if we have an mcl file or an integer next
goto processMCL;
}
else if ((_strnicmp(&argv[i][1], "thin", argLen) == 0))
@@ -346,10 +346,10 @@ bool CommandLine::Parse(int argc, char* argv[], /* OUT */ Options* o)
}
else if ((_strnicmp(&argv[i][1], "smarty", argLen) == 0))
{
- tempLen = strlen(argv[i]);
+ tempLen = strlen(argv[i]);
o->actionSmarty = true;
- foundVerb = true;
- if (i + 1 < argc) //Peek to see if we have an mcl file or an integer next
+ foundVerb = true;
+ if (i + 1 < argc) // Peek to see if we have an mcl file or an integer next
goto processMCL;
}
else if ((_strnicmp(&argv[i][1], "verbosity", argLen) == 0))
@@ -378,12 +378,11 @@ bool CommandLine::Parse(int argc, char* argv[], /* OUT */ Options* o)
DumpHelp(argv[0]);
return false;
}
-
}
- //Process an input filename
+ // Process an input filename
else
{
- char *lastdot = strrchr(argv[i], '.');
+ char* lastdot = strrchr(argv[i], '.');
if (lastdot != nullptr)
{
if (_stricmp(lastdot, ".mcl") == 0)
diff --git a/src/ToolBox/superpmi/mcs/commandline.h b/src/ToolBox/superpmi/mcs/commandline.h
index a049696..442f2a4 100644
--- a/src/ToolBox/superpmi/mcs/commandline.h
+++ b/src/ToolBox/superpmi/mcs/commandline.h
@@ -12,60 +12,59 @@
class CommandLine
{
public:
-
class Options
{
public:
- Options() :
- actionASMDump(false),
- actionConcat(false),
- actionCopy(false),
- actionDump(false),
- actionDumpMap(false),
- actionDumpToc(false),
- actionFracture(false),
- actionILDump(false),
- actionInteg(false),
- actionMerge(false),
- actionRemoveDup(false),
- actionSmarty(false),
- actionStat(false),
- actionStrip(false),
- actionTOC(false),
- legacyCompare(false),
- recursive(false),
- stripCR(false),
- nameOfFile1(nullptr),
- nameOfFile2(nullptr),
- nameOfFile3(nullptr),
- indexCount(-1),
- indexes(nullptr)
+ Options()
+ : actionASMDump(false)
+ , actionConcat(false)
+ , actionCopy(false)
+ , actionDump(false)
+ , actionDumpMap(false)
+ , actionDumpToc(false)
+ , actionFracture(false)
+ , actionILDump(false)
+ , actionInteg(false)
+ , actionMerge(false)
+ , actionRemoveDup(false)
+ , actionSmarty(false)
+ , actionStat(false)
+ , actionStrip(false)
+ , actionTOC(false)
+ , legacyCompare(false)
+ , recursive(false)
+ , stripCR(false)
+ , nameOfFile1(nullptr)
+ , nameOfFile2(nullptr)
+ , nameOfFile3(nullptr)
+ , indexCount(-1)
+ , indexes(nullptr)
{
}
- bool actionASMDump;
- bool actionConcat;
- bool actionCopy;
- bool actionDump;
- bool actionDumpMap;
- bool actionDumpToc;
- bool actionFracture;
- bool actionILDump;
- bool actionInteg;
- bool actionMerge;
- bool actionRemoveDup;
- bool actionSmarty;
- bool actionStat;
- bool actionStrip;
- bool actionTOC;
- bool legacyCompare;
- bool recursive;
- bool stripCR;
+ bool actionASMDump;
+ bool actionConcat;
+ bool actionCopy;
+ bool actionDump;
+ bool actionDumpMap;
+ bool actionDumpToc;
+ bool actionFracture;
+ bool actionILDump;
+ bool actionInteg;
+ bool actionMerge;
+ bool actionRemoveDup;
+ bool actionSmarty;
+ bool actionStat;
+ bool actionStrip;
+ bool actionTOC;
+ bool legacyCompare;
+ bool recursive;
+ bool stripCR;
char* nameOfFile1;
char* nameOfFile2;
char* nameOfFile3;
- int indexCount;
- int* indexes;
+ int indexCount;
+ int* indexes;
};
static bool Parse(int argc, char* argv[], /* OUT */ Options* o);
diff --git a/src/ToolBox/superpmi/mcs/mcs.cpp b/src/ToolBox/superpmi/mcs/mcs.cpp
index d2debdd..7026ff5 100644
--- a/src/ToolBox/superpmi/mcs/mcs.cpp
+++ b/src/ToolBox/superpmi/mcs/mcs.cpp
@@ -35,12 +35,12 @@ int __cdecl main(int argc, char* argv[])
Logger::Initialize();
CommandLine::Options o;
- if(!CommandLine::Parse(argc, argv, &o))
+ if (!CommandLine::Parse(argc, argv, &o))
{
return -1;
}
- //execute the chosen command.
+ // execute the chosen command.
int exitCode = 0;
if (o.actionASMDump)
{
diff --git a/src/ToolBox/superpmi/mcs/verbasmdump.cpp b/src/ToolBox/superpmi/mcs/verbasmdump.cpp
index 3f018b3..ffefd55 100644
--- a/src/ToolBox/superpmi/mcs/verbasmdump.cpp
+++ b/src/ToolBox/superpmi/mcs/verbasmdump.cpp
@@ -13,7 +13,7 @@
#define BUFFER_SIZE 0xFFFFFF
-int verbASMDump::DoWork(const char *nameOfInput, const char *nameOfOutput, int indexCount, const int *indexes)
+int verbASMDump::DoWork(const char* nameOfInput, const char* nameOfOutput, int indexCount, const int* indexes)
{
LogVerbose("Loading from '%s' and writing ASM output into '%s-MC#.asm'", nameOfInput, nameOfOutput);
@@ -30,7 +30,8 @@ int verbASMDump::DoWork(const char *nameOfInput, const char *nameOfOutput, int i
char buff[500];
sprintf_s(buff, 500, "%s-%d.asm", nameOfOutput, mci.MethodContextNumber());
- HANDLE hFileOut = CreateFileA(buff, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL|FILE_FLAG_SEQUENTIAL_SCAN, NULL);
+ HANDLE hFileOut = CreateFileA(buff, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
+ FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
if (hFileOut == INVALID_HANDLE_VALUE)
{
LogError("Failed to open output '%s'. GetLastError()=%u", buff, GetLastError());
@@ -40,8 +41,8 @@ int verbASMDump::DoWork(const char *nameOfInput, const char *nameOfOutput, int i
if (mc->cr->IsEmpty())
{
const size_t bufflen = 4096;
- DWORD bytesWritten;
- char buff[bufflen];
+ DWORD bytesWritten;
+ char buff[bufflen];
ZeroMemory(buff, bufflen * sizeof(char));
int buff_offset = sprintf_s(buff, bufflen, ";;Method context has no compile result");
WriteFile(hFileOut, buff, buff_offset * sizeof(char), &bytesWritten, nullptr);
diff --git a/src/ToolBox/superpmi/mcs/verbasmdump.h b/src/ToolBox/superpmi/mcs/verbasmdump.h
index 693366e..b3873b2 100644
--- a/src/ToolBox/superpmi/mcs/verbasmdump.h
+++ b/src/ToolBox/superpmi/mcs/verbasmdump.h
@@ -12,8 +12,6 @@
class verbASMDump
{
public:
- static int DoWork(const char *nameOfInput1, const char *nameOfOutput, int indexCount, const int *indexes);
+ static int DoWork(const char* nameOfInput1, const char* nameOfOutput, int indexCount, const int* indexes);
};
#endif
-
-
diff --git a/src/ToolBox/superpmi/mcs/verbconcat.cpp b/src/ToolBox/superpmi/mcs/verbconcat.cpp
index 36620f1..a41e55d 100644
--- a/src/ToolBox/superpmi/mcs/verbconcat.cpp
+++ b/src/ToolBox/superpmi/mcs/verbconcat.cpp
@@ -10,7 +10,7 @@
#define BUFFER_SIZE 0xFFFFFF
-int verbConcat::DoWork(const char *nameOfFile1, const char *nameOfFile2)
+int verbConcat::DoWork(const char* nameOfFile1, const char* nameOfFile2)
{
SimpleTimer st1;
@@ -19,33 +19,35 @@ int verbConcat::DoWork(const char *nameOfFile1, const char *nameOfFile2)
LARGE_INTEGER DataTemp1;
LARGE_INTEGER DataTemp2;
- HANDLE hFileIn1 = CreateFileA(nameOfFile1, GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL|FILE_FLAG_SEQUENTIAL_SCAN, NULL);
- if(hFileIn1 == INVALID_HANDLE_VALUE)
+ HANDLE hFileIn1 = CreateFileA(nameOfFile1, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_ALWAYS,
+ FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
+ if (hFileIn1 == INVALID_HANDLE_VALUE)
{
LogError("Failed to open input 1 '%s'. GetLastError()=%u", nameOfFile1, GetLastError());
return -1;
}
- if(GetFileSizeEx(hFileIn1, &DataTemp1)==0)
+ if (GetFileSizeEx(hFileIn1, &DataTemp1) == 0)
{
LogError("GetFileSizeEx failed. GetLastError()=%u", GetLastError());
return -1;
}
- LONG highDWORD = 0;
- DWORD dwPtr = SetFilePointer(hFileIn1, 0, &highDWORD, FILE_END);
+ LONG highDWORD = 0;
+ DWORD dwPtr = SetFilePointer(hFileIn1, 0, &highDWORD, FILE_END);
if (dwPtr == INVALID_SET_FILE_POINTER)
{
LogError("Failed to SetFilePointer on input 1 '%s'. GetLastError()=%u", nameOfFile1, GetLastError());
return -1;
}
- HANDLE hFileIn2 = CreateFileA(nameOfFile2, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL|FILE_FLAG_SEQUENTIAL_SCAN, NULL);
- if(hFileIn2 == INVALID_HANDLE_VALUE)
+ HANDLE hFileIn2 = CreateFileA(nameOfFile2, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING,
+ FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
+ if (hFileIn2 == INVALID_HANDLE_VALUE)
{
LogError("Failed to open input 2 '%s'. GetLastError()=%u", nameOfFile2, GetLastError());
return -1;
}
- if(GetFileSizeEx(hFileIn2, &DataTemp2)==0)
+ if (GetFileSizeEx(hFileIn2, &DataTemp2) == 0)
{
LogError("2nd GetFileSizeEx failed. GetLastError()=%u", GetLastError());
return -1;
@@ -54,23 +56,23 @@ int verbConcat::DoWork(const char *nameOfFile1, const char *nameOfFile2)
unsigned char* buffer = new unsigned char[BUFFER_SIZE];
st1.Start();
- for(LONGLONG offset = 0; offset < DataTemp2.QuadPart; offset += BUFFER_SIZE)
+ for (LONGLONG offset = 0; offset < DataTemp2.QuadPart; offset += BUFFER_SIZE)
{
DWORD bytesRead = -1;
- BOOL res = ReadFile(hFileIn2, buffer, BUFFER_SIZE, &bytesRead, nullptr);
- if(res == 0)
+ BOOL res = ReadFile(hFileIn2, buffer, BUFFER_SIZE, &bytesRead, nullptr);
+ if (res == 0)
{
LogError("Failed to read '%s' from offset %lld. GetLastError()=%u", nameOfFile2, offset, GetLastError());
return -1;
}
DWORD bytesWritten = -1;
- BOOL res2 = WriteFile(hFileIn1, buffer, bytesRead, &bytesWritten, nullptr);
- if(res2 == 0)
+ BOOL res2 = WriteFile(hFileIn1, buffer, bytesRead, &bytesWritten, nullptr);
+ if (res2 == 0)
{
LogError("Failed to write '%s' at offset %lld. GetLastError()=%u", nameOfFile1, offset, GetLastError());
return -1;
}
- if(bytesRead!=bytesWritten)
+ if (bytesRead != bytesWritten)
{
LogError("Failed to read/write matching bytes %u!=%u", bytesRead, bytesWritten);
return -1;
@@ -80,20 +82,20 @@ int verbConcat::DoWork(const char *nameOfFile1, const char *nameOfFile2)
delete[] buffer;
- if(CloseHandle(hFileIn1)==0)
+ if (CloseHandle(hFileIn1) == 0)
{
LogError("CloseHandle failed. GetLastError()=%u", GetLastError());
return -1;
}
- if(CloseHandle(hFileIn2)==0)
+ if (CloseHandle(hFileIn2) == 0)
{
LogError("2nd CloseHandle failed. GetLastError()=%u", GetLastError());
return -1;
}
- LogInfo("Read/Wrote %lld MB @ %4.2f MB/s.\n",
- DataTemp2.QuadPart/(1000*1000),
- (((double)DataTemp2.QuadPart)/(1000*1000))/st1.GetSeconds()); //yes yes.. http://en.wikipedia.org/wiki/Megabyte_per_second#Megabyte_per_second
+ LogInfo("Read/Wrote %lld MB @ %4.2f MB/s.\n", DataTemp2.QuadPart / (1000 * 1000),
+ (((double)DataTemp2.QuadPart) / (1000 * 1000)) /
+ st1.GetSeconds()); // yes yes.. http://en.wikipedia.org/wiki/Megabyte_per_second#Megabyte_per_second
return 0;
}
diff --git a/src/ToolBox/superpmi/mcs/verbconcat.h b/src/ToolBox/superpmi/mcs/verbconcat.h
index 26e5585..85674ff 100644
--- a/src/ToolBox/superpmi/mcs/verbconcat.h
+++ b/src/ToolBox/superpmi/mcs/verbconcat.h
@@ -12,6 +12,6 @@
class verbConcat
{
public:
- static int DoWork(const char *nameOfFile1, const char *nameOfFile2);
+ static int DoWork(const char* nameOfFile1, const char* nameOfFile2);
};
#endif
diff --git a/src/ToolBox/superpmi/mcs/verbdump.cpp b/src/ToolBox/superpmi/mcs/verbdump.cpp
index 290cbdb..7a04abc 100644
--- a/src/ToolBox/superpmi/mcs/verbdump.cpp
+++ b/src/ToolBox/superpmi/mcs/verbdump.cpp
@@ -10,7 +10,7 @@
#include "methodcontextiterator.h"
#include "errorhandling.h"
-int verbDump::DoWork(const char *nameOfInput, int indexCount, const int *indexes)
+int verbDump::DoWork(const char* nameOfInput, int indexCount, const int* indexes)
{
LogVerbose("Dumping '%s' to console", nameOfInput);
diff --git a/src/ToolBox/superpmi/mcs/verbdump.h b/src/ToolBox/superpmi/mcs/verbdump.h
index 32f4b0d..4c0f295 100644
--- a/src/ToolBox/superpmi/mcs/verbdump.h
+++ b/src/ToolBox/superpmi/mcs/verbdump.h
@@ -12,6 +12,6 @@
class verbDump
{
public:
- static int DoWork(const char *nameofInput, int indexCount, const int *indexes);
+ static int DoWork(const char* nameofInput, int indexCount, const int* indexes);
};
#endif
diff --git a/src/ToolBox/superpmi/mcs/verbdumpmap.cpp b/src/ToolBox/superpmi/mcs/verbdumpmap.cpp
index 3fc8268..2acd2b6 100644
--- a/src/ToolBox/superpmi/mcs/verbdumpmap.cpp
+++ b/src/ToolBox/superpmi/mcs/verbdumpmap.cpp
@@ -19,16 +19,16 @@ void DumpMapHeader()
printf("full signature\n");
}
-void DumpMap(int index, MethodContext *mc)
+void DumpMap(int index, MethodContext* mc)
{
CORINFO_METHOD_INFO cmi;
- unsigned int flags = 0;
+ unsigned int flags = 0;
mc->repCompileMethod(&cmi, &flags);
- const char *moduleName = nullptr;
- const char *methodName = mc->repGetMethodName(cmi.ftn, &moduleName);
- const char *className = mc->repGetClassName(mc->repGetMethodClass(cmi.ftn));
+ const char* moduleName = nullptr;
+ const char* methodName = mc->repGetMethodName(cmi.ftn, &moduleName);
+ const char* className = mc->repGetClassName(mc->repGetMethodClass(cmi.ftn));
printf("%d,", index);
// printf("\"%s\",", mc->cr->repProcessName());
@@ -43,7 +43,7 @@ void DumpMap(int index, MethodContext *mc)
printf(")\"\n");
}
-int verbDumpMap::DoWork(const char *nameOfInput)
+int verbDumpMap::DoWork(const char* nameOfInput)
{
MethodContextIterator mci;
if (!mci.Initialize(nameOfInput))
diff --git a/src/ToolBox/superpmi/mcs/verbdumpmap.h b/src/ToolBox/superpmi/mcs/verbdumpmap.h
index 129b8d8..93e0854 100644
--- a/src/ToolBox/superpmi/mcs/verbdumpmap.h
+++ b/src/ToolBox/superpmi/mcs/verbdumpmap.h
@@ -12,6 +12,6 @@
class verbDumpMap
{
public:
- static int DoWork(const char *nameofInput);
+ static int DoWork(const char* nameofInput);
};
#endif
diff --git a/src/ToolBox/superpmi/mcs/verbdumptoc.cpp b/src/ToolBox/superpmi/mcs/verbdumptoc.cpp
index 2837f0b..f9cc69e 100644
--- a/src/ToolBox/superpmi/mcs/verbdumptoc.cpp
+++ b/src/ToolBox/superpmi/mcs/verbdumptoc.cpp
@@ -9,7 +9,7 @@
#include "tocfile.h"
#include "runtimedetails.h"
-int verbDumpToc::DoWork(const char *nameOfInput)
+int verbDumpToc::DoWork(const char* nameOfInput)
{
TOCFile tf;
diff --git a/src/ToolBox/superpmi/mcs/verbdumptoc.h b/src/ToolBox/superpmi/mcs/verbdumptoc.h
index c2ea880..dffb4b4 100644
--- a/src/ToolBox/superpmi/mcs/verbdumptoc.h
+++ b/src/ToolBox/superpmi/mcs/verbdumptoc.h
@@ -12,6 +12,6 @@
class verbDumpToc
{
public:
- static int DoWork(const char *nameOfInput1);
+ static int DoWork(const char* nameOfInput1);
};
#endif
diff --git a/src/ToolBox/superpmi/mcs/verbfracture.cpp b/src/ToolBox/superpmi/mcs/verbfracture.cpp
index bcc6d04..68cc7af 100644
--- a/src/ToolBox/superpmi/mcs/verbfracture.cpp
+++ b/src/ToolBox/superpmi/mcs/verbfracture.cpp
@@ -11,17 +11,19 @@
#include "errorhandling.h"
#include "logging.h"
-int verbFracture::DoWork(const char *nameOfInput, const char *nameOfOutput, int indexCount, const int *indexes, bool stripCR)
+int verbFracture::DoWork(
+ const char* nameOfInput, const char* nameOfOutput, int indexCount, const int* indexes, bool stripCR)
{
int rangeSize = indexes[0];
- LogVerbose("Reading from '%s' copying %d MethodContexts files into each output file of '%s'", nameOfInput, rangeSize, nameOfOutput);
+ LogVerbose("Reading from '%s' copying %d MethodContexts files into each output file of '%s'", nameOfInput,
+ rangeSize, nameOfOutput);
MethodContextIterator mci(true);
if (!mci.Initialize(nameOfInput))
return -1;
- int fileCount = 0;
+ int fileCount = 0;
char fileName[512];
HANDLE hFileOut = INVALID_HANDLE_VALUE;
@@ -41,7 +43,8 @@ int verbFracture::DoWork(const char *nameOfInput, const char *nameOfOutput, int
hFileOut = INVALID_HANDLE_VALUE;
}
sprintf_s(fileName, 512, "%s-%0*d.mch", nameOfOutput, 5, fileCount++);
- hFileOut = CreateFileA(fileName, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL|FILE_FLAG_SEQUENTIAL_SCAN, NULL);
+ hFileOut = CreateFileA(fileName, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
+ FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
if (hFileOut == INVALID_HANDLE_VALUE)
{
LogError("Failed to open output file '%s'. GetLastError()=%u", fileName, GetLastError());
diff --git a/src/ToolBox/superpmi/mcs/verbfracture.h b/src/ToolBox/superpmi/mcs/verbfracture.h
index feddbe1..f156be1 100644
--- a/src/ToolBox/superpmi/mcs/verbfracture.h
+++ b/src/ToolBox/superpmi/mcs/verbfracture.h
@@ -12,6 +12,7 @@
class verbFracture
{
public:
- static int DoWork(const char *nameOfInput1, const char *nameOfOutput, int indexCount, const int *indexes, bool stripCR);
+ static int DoWork(
+ const char* nameOfInput1, const char* nameOfOutput, int indexCount, const int* indexes, bool stripCR);
};
#endif
diff --git a/src/ToolBox/superpmi/mcs/verbildump.cpp b/src/ToolBox/superpmi/mcs/verbildump.cpp
index 23b68da..d46ad2b 100644
--- a/src/ToolBox/superpmi/mcs/verbildump.cpp
+++ b/src/ToolBox/superpmi/mcs/verbildump.cpp
@@ -9,48 +9,90 @@
#include "methodcontextiterator.h"
#include "verbildump.h"
-void DumpPrimToConsoleBare(MethodContext *mc, CorInfoType prim, DWORDLONG classHandle)
+void DumpPrimToConsoleBare(MethodContext* mc, CorInfoType prim, DWORDLONG classHandle)
{
- switch(prim)
+ switch (prim)
{
- case CORINFO_TYPE_VOID: printf("void"); return;
- case CORINFO_TYPE_BOOL: printf("bool"); return;
- case CORINFO_TYPE_CHAR: printf("char"); return;
- case CORINFO_TYPE_BYTE: printf("int8"); return;
- case CORINFO_TYPE_UBYTE: printf("unsigned int8"); return;
- case CORINFO_TYPE_SHORT: printf("int16"); return;
- case CORINFO_TYPE_USHORT: printf("unsigned int16"); return;
- case CORINFO_TYPE_INT: printf("int32"); return;
- case CORINFO_TYPE_UINT: printf("unsigned int32"); return;
- case CORINFO_TYPE_LONG: printf("int64"); return;
- case CORINFO_TYPE_ULONG: printf("unsigned int64"); return;
- case CORINFO_TYPE_NATIVEINT: printf("native int"); return;
- case CORINFO_TYPE_NATIVEUINT: printf("native unsigned int"); return;
- case CORINFO_TYPE_FLOAT: printf("float32"); return;
- case CORINFO_TYPE_DOUBLE: printf("float64"); return;
-// case CORINFO_TYPE_STRING: printf("string"); return;
- case CORINFO_TYPE_PTR: printf("ptr"); return;
- case CORINFO_TYPE_BYREF: printf("byref"); return;
- case CORINFO_TYPE_VALUECLASS: printf("valueclass %s", mc->repGetClassName((CORINFO_CLASS_HANDLE)classHandle)); return;
- case CORINFO_TYPE_CLASS: printf("class %s", mc->repGetClassName((CORINFO_CLASS_HANDLE)classHandle)); return;
- case CORINFO_TYPE_REFANY: printf("refany"); return;
- case CORINFO_TYPE_VAR: printf("var"); return;
- default:
- LogWarning("unknown type in PrimToString(0x%x)",prim);
- __debugbreak();
- return;
- }
+ case CORINFO_TYPE_VOID:
+ printf("void");
+ return;
+ case CORINFO_TYPE_BOOL:
+ printf("bool");
+ return;
+ case CORINFO_TYPE_CHAR:
+ printf("char");
+ return;
+ case CORINFO_TYPE_BYTE:
+ printf("int8");
+ return;
+ case CORINFO_TYPE_UBYTE:
+ printf("unsigned int8");
+ return;
+ case CORINFO_TYPE_SHORT:
+ printf("int16");
+ return;
+ case CORINFO_TYPE_USHORT:
+ printf("unsigned int16");
+ return;
+ case CORINFO_TYPE_INT:
+ printf("int32");
+ return;
+ case CORINFO_TYPE_UINT:
+ printf("unsigned int32");
+ return;
+ case CORINFO_TYPE_LONG:
+ printf("int64");
+ return;
+ case CORINFO_TYPE_ULONG:
+ printf("unsigned int64");
+ return;
+ case CORINFO_TYPE_NATIVEINT:
+ printf("native int");
+ return;
+ case CORINFO_TYPE_NATIVEUINT:
+ printf("native unsigned int");
+ return;
+ case CORINFO_TYPE_FLOAT:
+ printf("float32");
+ return;
+ case CORINFO_TYPE_DOUBLE:
+ printf("float64");
+ return;
+ // case CORINFO_TYPE_STRING: printf("string"); return;
+ case CORINFO_TYPE_PTR:
+ printf("ptr");
+ return;
+ case CORINFO_TYPE_BYREF:
+ printf("byref");
+ return;
+ case CORINFO_TYPE_VALUECLASS:
+ printf("valueclass %s", mc->repGetClassName((CORINFO_CLASS_HANDLE)classHandle));
+ return;
+ case CORINFO_TYPE_CLASS:
+ printf("class %s", mc->repGetClassName((CORINFO_CLASS_HANDLE)classHandle));
+ return;
+ case CORINFO_TYPE_REFANY:
+ printf("refany");
+ return;
+ case CORINFO_TYPE_VAR:
+ printf("var");
+ return;
+ default:
+ LogWarning("unknown type in PrimToString(0x%x)", prim);
+ __debugbreak();
+ return;
+ }
}
-void DumpSigToConsoleBare(MethodContext *mc, CORINFO_SIG_INFO *pSig)
+void DumpSigToConsoleBare(MethodContext* mc, CORINFO_SIG_INFO* pSig)
{
CORINFO_ARG_LIST_HANDLE currentItem = pSig->args;
- DWORD exceptionCode;
+ DWORD exceptionCode;
- for(int i=0; i < (int)pSig->numArgs; i++)
+ for (int i = 0; i < (int)pSig->numArgs; i++)
{
- DWORDLONG dl;
- CorInfoTypeWithMod type = mc->repGetArgType(pSig, currentItem, (CORINFO_CLASS_HANDLE *)&dl, &exceptionCode);
- CorInfoType cit = strip(type);
+ DWORDLONG dl;
+ CorInfoTypeWithMod type = mc->repGetArgType(pSig, currentItem, (CORINFO_CLASS_HANDLE*)&dl, &exceptionCode);
+ CorInfoType cit = strip(type);
if (cit == CORINFO_TYPE_CLASS)
dl = (DWORDLONG)mc->repGetArgClass(pSig, currentItem, &exceptionCode);
if ((type & CORINFO_TYPE_MOD_PINNED) == CORINFO_TYPE_MOD_PINNED)
@@ -62,521 +104,839 @@ void DumpSigToConsoleBare(MethodContext *mc, CORINFO_SIG_INFO *pSig)
}
}
-
-void DumpILToConsoleBare(unsigned char *ilCode, int len)
+void DumpILToConsoleBare(unsigned char* ilCode, int len)
{
- int i,j,k;
- for(i=0;i<len;i++)
+ int i, j, k;
+ for (i = 0; i < len; i++)
{
- printf("IL_%04x: ",i);
- switch(ilCode[i])
+ printf("IL_%04x: ", i);
+ switch (ilCode[i])
{
- case 0x00:printf("nop");continue;
- case 0x01:printf("break");continue;
- case 0x02:printf("ldarg.0");continue;
- case 0x03:printf("ldarg.1");continue;
- case 0x04:printf("ldarg.2");continue;
- case 0x05:printf("ldarg.3");continue;
- case 0x06:printf("ldloc.0");continue;
- case 0x07:printf("ldloc.1");continue;
- case 0x08:printf("ldloc.2");continue;
- case 0x09:printf("ldloc.3");continue;
- case 0x0a:printf("stloc.0");continue;
- case 0x0b:printf("stloc.1");continue;
- case 0x0c:printf("stloc.2");continue;
- case 0x0d:printf("stloc.3");continue;
- case 0x0e: //ldarg.s X
- printf("ldarg.s 0x%02x", ilCode[i+1]);
- i+=1;
- continue;
- case 0x0f: //ldarga.s X
- printf("ldarga.s 0x%02x", ilCode[i+1]);
- i+=1;
- continue;
- case 0x10: //starg.s X
- printf("starg.s 0x%02x", ilCode[i+1]);
- i+=1;
- continue;
- case 0x11: //ldloc.s X
- printf("ldloc.s 0x%02x", ilCode[i+1]);
- i+=1;
- continue;
- case 0x12: //ldloca.s X
- printf("ldloca.s 0x%02x", ilCode[i+1]);
- i+=1;
- continue;
- case 0x13: //stloc.s X
- printf("stloc.s 0x%02x", ilCode[i+1]);
- i+=1;
- continue;
- case 0x14:printf("ldnull");continue;
- case 0x15:printf("ldc.i4.m1");continue;
- case 0x16:printf("ldc.i4.0");continue;
- case 0x17:printf("ldc.i4.1");continue;
- case 0x18:printf("ldc.i4.2");continue;
- case 0x19:printf("ldc.i4.3");continue;
- case 0x1a:printf("ldc.i4.4");continue;
- case 0x1b:printf("ldc.i4.5");continue;
- case 0x1c:printf("ldc.i4.6");continue;
- case 0x1d:printf("ldc.i4.7");continue;
- case 0x1e:printf("ldc.i4.8");continue;
- case 0x1f: //ldc.i4.s X
- printf("ldc.i4.s 0x%02x", ilCode[i+1]);
- i+=1;
- continue;
- case 0x20: //ldc.i4 XXXX
- printf("ldc.i4 0x%02x%02x%02x%02x", ilCode[i+4], ilCode[i+3], ilCode[i+2], ilCode[i+1]);
- i+=4;
- continue;
- case 0x21: //ldc.i8 XXXXXXXX
- printf("ldc.i8 0x%02x%02x%02x%02x%02x%02x%02x%02x", ilCode[i+8], ilCode[i+7], ilCode[i+6], ilCode[i+5], ilCode[i+4], ilCode[i+3], ilCode[i+2], ilCode[i+1]);
- i+=8;
- continue;
- case 0x22: //ldc.r4 XXXX
- printf("ldc.r4 float32(0x%02x%02x%02x%02x)", ilCode[i+4], ilCode[i+3], ilCode[i+2], ilCode[i+1]);
- i+=4;
- continue;
- case 0x23: //ldc.r8 XXXXXXXX
- printf("ldc.r8 float64(0x%02x%02x%02x%02x%02x%02x%02x%02x)", ilCode[i+8], ilCode[i+7], ilCode[i+6], ilCode[i+5], ilCode[i+4], ilCode[i+3], ilCode[i+2], ilCode[i+1]);
- i+=8;
- continue;
- case 0x25:printf("dup");continue;
- case 0x26:printf("pop");continue;
- case 0x27: //JMP <T>
- printf("jmp <0x%02x%02x%02x%02x>", ilCode[i+4], ilCode[i+3], ilCode[i+2], ilCode[i+1]);
- i+=4;
- continue;
- case 0x28: //call <T>
- printf("call <0x%02x%02x%02x%02x>", ilCode[i+4], ilCode[i+3], ilCode[i+2], ilCode[i+1]);
- i+=4;
- continue;
- case 0x29: //calli <T>
- printf("calli <0x%02x%02x%02x%02x>", ilCode[i+4], ilCode[i+3], ilCode[i+2], ilCode[i+1]);
- i+=4;
- continue;
- case 0x2a:printf("ret");continue;
- case 0x2b: //br.s X
- printf("br.s IL_%04x", i+2+ilCode[i+1]);;
- i+=1;
- continue;
- case 0x2c: //brfalse.s X
- printf("brfalse.s IL_%04x", i+2+ilCode[i+1]);;
- i+=1;
- continue;
- case 0x2d: //brtrue.s X
- printf("brtrue.s IL_%04x", i+2+ilCode[i+1]);;
- i+=1;
- continue;
- case 0x2e: //beq.s X
- printf("beq.s IL_%04x", i+2+ilCode[i+1]);;
- i+=1;
- continue;
- case 0x2f: //bgt.s X
- printf("bgt.s IL_%04x", i+2+ilCode[i+1]);;
- i+=1;
- continue;
- case 0x30: //bgt.s X
- printf("bgt.s IL_%04x", i+2+ilCode[i+1]);;
- i+=1;
- continue;
- case 0x31: //ble.s X
- printf("ble.s IL_%04x", i+2+ilCode[i+1]);;
- i+=1;
- continue;
- case 0x32: //blt.s X
- printf("blt.s IL_%04x", i+2+ilCode[i+1]);;
- i+=1;
- continue;
- case 0x33: //bne.un.s X
- printf("bne.un.s IL_%04x", i+2+ilCode[i+1]);;
- i+=1;
- continue;
- case 0x34: //bge.un.s X
- printf("bge.un.s IL_%04x", i+2+ilCode[i+1]);;
- i+=1;
- continue;
- case 0x35: //bgt.un.s X
- printf("bgt.un.s IL_%04x", i+2+ilCode[i+1]);;
- i+=1;
- continue;
- case 0x36: //ble.un.s X
- printf("ble.un.s IL_%04x", i+2+ilCode[i+1]);;
- i+=1;
- continue;
- case 0x37: //blt.un.s X
- printf("blt.un.s IL_%04x", i+2+ilCode[i+1]);;
- i+=1;
- continue;
- case 0x38: //br XXXX
- printf("br IL_%04x", i+5+(ilCode[i+4]<<24|ilCode[i+3]<<16|ilCode[i+2]<<8|ilCode[i+1]));
- i+=4;
- continue;
- case 0x39: //brfalse XXXX
- printf("brfalse IL_%04x", i+5+(ilCode[i+4]<<24|ilCode[i+3]<<16|ilCode[i+2]<<8|ilCode[i+1]));
- i+=4;
- continue;
- case 0x3a: //brtrue XXXX
- printf("brtrue IL_%04x", i+5+(ilCode[i+4]<<24|ilCode[i+3]<<16|ilCode[i+2]<<8|ilCode[i+1]));
- i+=4;
- continue;
- case 0x3b: //beq XXXX
- printf("beq IL_%04x", i+5+(ilCode[i+4]<<24|ilCode[i+3]<<16|ilCode[i+2]<<8|ilCode[i+1]));
- i+=4;
- continue;
- case 0x3c: //bgt XXXX
- printf("bgt IL_%04x", i+5+(ilCode[i+4]<<24|ilCode[i+3]<<16|ilCode[i+2]<<8|ilCode[i+1]));
- i+=4;
- continue;
- case 0x3d: //bgt XXXX
- printf("bgt IL_%04x", i+5+(ilCode[i+4]<<24|ilCode[i+3]<<16|ilCode[i+2]<<8|ilCode[i+1]));
- i+=4;
- continue;
- case 0x3e: //ble XXXX
- printf("ble IL_%04x", i+5+(ilCode[i+4]<<24|ilCode[i+3]<<16|ilCode[i+2]<<8|ilCode[i+1]));
- i+=4;
- continue;
- case 0x3f: //blt XXXX
- printf("blt IL_%04x", i+5+(ilCode[i+4]<<24|ilCode[i+3]<<16|ilCode[i+2]<<8|ilCode[i+1]));
- i+=4;
- continue;
- case 0x40: //bne.un XXXX
- printf("bne.un IL_%04x", i+5+(ilCode[i+4]<<24|ilCode[i+3]<<16|ilCode[i+2]<<8|ilCode[i+1]));
- i+=4;
- continue;
- case 0x41: //bge.un XXXX
- printf("bge.un IL_%04x", i+5+(ilCode[i+4]<<24|ilCode[i+3]<<16|ilCode[i+2]<<8|ilCode[i+1]));
- i+=4;
- continue;
- case 0x42: //bgt.un XXXX
- printf("bgt.un IL_%04x", i+5+(ilCode[i+4]<<24|ilCode[i+3]<<16|ilCode[i+2]<<8|ilCode[i+1]));
- i+=4;
- continue;
- case 0x43: //ble.un XXXX
- printf("ble.un IL_%04x", i+5+(ilCode[i+4]<<24|ilCode[i+3]<<16|ilCode[i+2]<<8|ilCode[i+1]));
- i+=4;
- continue;
- case 0x44: //blt.un XXXX
- printf("blt.un IL_%04x", i+5+(ilCode[i+4]<<24|ilCode[i+3]<<16|ilCode[i+2]<<8|ilCode[i+1]));
- i+=4;
- continue;
- case 0x45: //switch NNNN NNNN*XXXX
- printf("switch (0x%02x%02x%02x%02x)", ilCode[i+4], ilCode[i+3], ilCode[i+2], ilCode[i+1]);
- k = (ilCode[i+4]<<24)|(ilCode[i+3]<<16)|(ilCode[i+2]<<8)|(ilCode[i+1]<<0);
- i+=4;
- for(j=0;j<k;j++)
- {
- printf(" <0x%02x%02x%02x%02x>", ilCode[i+4], ilCode[i+3], ilCode[i+2], ilCode[i+1]);
- i+=4;
- }
- continue;
- case 0x46:printf("ldind.i1");continue;
- case 0x47:printf("ldind.u1");continue;
- case 0x48:printf("ldind.i2");continue;
- case 0x49:printf("ldind.u2");continue;
- case 0x4a:printf("ldind.i4");continue;
- case 0x4b:printf("ldind.u4");continue;
- case 0x4c:printf("ldind.i8");continue;
- case 0x4d:printf("ldind.u8");continue;
- case 0x4e:printf("ldind.r4");continue;
- case 0x4f:printf("ldind.r8");continue;
- case 0x50:printf("ldind.ref");continue;
- case 0x51:printf("stind.ref");continue;
- case 0x52:printf("stind.i1");continue;
- case 0x53:printf("stind.i2");continue;
- case 0x54:printf("stind.i4");continue;
- case 0x55:printf("stind.i8");continue;
- case 0x56:printf("stind.r4");continue;
- case 0x57:printf("stind.r8");continue;
- case 0x58:printf("add");continue;
- case 0x59:printf("sub");continue;
- case 0x5a:printf("mul");continue;
- case 0x5b:printf("div");continue;
- case 0x5c:printf("div.un");continue;
- case 0x5d:printf("rem");continue;
- case 0x5e:printf("rem.un");continue;
- case 0x5f:printf("and");continue;
- case 0x60:printf("or");continue;
- case 0x61:printf("xor");continue;
- case 0x62:printf("shl");continue;
- case 0x63:printf("shr");continue;
- case 0x64:printf("shr.un");continue;
- case 0x65:printf("neg");continue;
- case 0x66:printf("not");continue;
- case 0x67:printf("conv.i1");continue;
- case 0x68:printf("conv.i2");continue;
- case 0x69:printf("conv.i4");continue;
- case 0x6a:printf("conv.i8");continue;
- case 0x6b:printf("conv.r4");continue;
- case 0x6c:printf("conv.r8");continue;
- case 0x6d:printf("conv.u4");continue;
- case 0x6e:printf("conv.u8");continue;
- case 0x6f: //callvirt <T>
- printf("callvirt <0x%02x%02x%02x%02x>", ilCode[i+4], ilCode[i+3], ilCode[i+2], ilCode[i+1]);
- i+=4;
- continue;
- case 0x70: //cpobj <T>
- printf("cpobj <0x%02x%02x%02x%02x>", ilCode[i+4], ilCode[i+3], ilCode[i+2], ilCode[i+1]);
- i+=4;
- continue;
- case 0x71: //ldobj <T>
- printf("ldobj <0x%02x%02x%02x%02x>", ilCode[i+4], ilCode[i+3], ilCode[i+2], ilCode[i+1]);
- i+=4;
- continue;
- case 0x72: //ldstr <T>
- printf("ldstr <0x%02x%02x%02x%02x>", ilCode[i+4], ilCode[i+3], ilCode[i+2], ilCode[i+1]);
- i+=4;
- continue;
- case 0x73: //newobj <T>
- printf("newobj <0x%02x%02x%02x%02x>", ilCode[i+4], ilCode[i+3], ilCode[i+2], ilCode[i+1]);
- i+=4;
- continue;
- case 0x74: //castclass <T>
- printf("castclass <0x%02x%02x%02x%02x>", ilCode[i+4], ilCode[i+3], ilCode[i+2], ilCode[i+1]);
- i+=4;
- continue;
- case 0x75: //isinst <T>
- printf("isinst <0x%02x%02x%02x%02x>", ilCode[i+4], ilCode[i+3], ilCode[i+2], ilCode[i+1]);
- i+=4;
- continue;
- case 0x76:printf("conv.r.un");continue;
- case 0x79: //unbox <T>
- printf("unbox <0x%02x%02x%02x%02x>", ilCode[i+4], ilCode[i+3], ilCode[i+2], ilCode[i+1]);
- i+=4;
- continue;
- case 0x7a:printf("throw");continue;
- case 0x7b: //ldfld <T>
- printf("ldfld <0x%02x%02x%02x%02x>", ilCode[i+4], ilCode[i+3], ilCode[i+2], ilCode[i+1]);
- i+=4;
- continue;
- case 0x7c: //ldflda <T>
- printf("ldflda <0x%02x%02x%02x%02x>", ilCode[i+4], ilCode[i+3], ilCode[i+2], ilCode[i+1]);
- i+=4;
- continue;
- case 0x7d: //stfld <T>
- printf("stfld <0x%02x%02x%02x%02x>", ilCode[i+4], ilCode[i+3], ilCode[i+2], ilCode[i+1]);
- i+=4;
- continue;
- case 0x7e: //ldsfld <T>
- printf("ldsfld <0x%02x%02x%02x%02x>", ilCode[i+4], ilCode[i+3], ilCode[i+2], ilCode[i+1]);
- i+=4;
- continue;
- case 0x7f: //ldsflda <T>
- printf("ldsflda <0x%02x%02x%02x%02x>", ilCode[i+4], ilCode[i+3], ilCode[i+2], ilCode[i+1]);
- i+=4;
- continue;
- case 0x80: //stsfld <T>
- printf("stsfld <0x%02x%02x%02x%02x>", ilCode[i+4], ilCode[i+3], ilCode[i+2], ilCode[i+1]);
- i+=4;
- continue;
- case 0x81: //stobj <T>
- printf("stobj <0x%02x%02x%02x%02x>", ilCode[i+4], ilCode[i+3], ilCode[i+2], ilCode[i+1]);
- i+=4;
- continue;
- case 0x82:printf("conv.ovf.i1.un");continue;
- case 0x83:printf("conv.ovf.i2.un");continue;
- case 0x84:printf("conv.ovf.i4.un");continue;
- case 0x85:printf("conv.ovf.i8.un");continue;
- case 0x86:printf("conv.ovf.u1.un");continue;
- case 0x87:printf("conv.ovf.u2.un");continue;
- case 0x88:printf("conv.ovf.u4.un");continue;
- case 0x89:printf("conv.ovf.u8.un");continue;
- case 0x8a:printf("conv.ovf.i.un");continue;
- case 0x8b:printf("conv.ovf.u.un");continue;
- case 0x8c: //box <T>
- printf("box <0x%02x%02x%02x%02x>", ilCode[i+4], ilCode[i+3], ilCode[i+2], ilCode[i+1]);
- i+=4;
- continue;
- case 0x8d: //newarr <T>
- printf("newarr <0x%02x%02x%02x%02x>", ilCode[i+4], ilCode[i+3], ilCode[i+2], ilCode[i+1]);
- i+=4;
- continue;
- case 0x8e:printf("ldlen");continue;
- case 0x8f:printf("ldelema <0x%02x%02x%02x%02x>", ilCode[i+4], ilCode[i+3], ilCode[i+2], ilCode[i+1]);
- i+=4;
- continue;
- case 0x90:printf("ldelem.i1");continue;
- case 0x91:printf("ldelem.u1");continue;
- case 0x92:printf("ldelem.i2");continue;
- case 0x93:printf("ldelem.u2");continue;
- case 0x94:printf("ldelem.i4");continue;
- case 0x95:printf("ldelem.u4");continue;
- case 0x96:printf("ldelem.i8");continue;
- case 0x97:printf("ldelem.i");continue;
- case 0x98:printf("ldelem.r4");continue;
- case 0x99:printf("ldelem.r8");continue;
- case 0x9a:printf("ldelem.ref");continue;
- case 0x9b:printf("stelem.i");continue;
- case 0x9c:printf("stelem.i1");continue;
- case 0x9d:printf("stelem.i2");continue;
- case 0x9e:printf("stelem.i4");continue;
- case 0x9f:printf("stelem.i8");continue;
- case 0xa0:printf("stelem.r4");continue;
- case 0xa1:printf("stelem.r8");continue;
- case 0xa2:printf("stelem.ref");continue;
- case 0xa3:printf("stelem <0x%02x%02x%02x%02x>", ilCode[i+4], ilCode[i+3], ilCode[i+2], ilCode[i+1]);
- i+=4;
- continue;
- case 0xa4:printf("stelem <0x%02x%02x%02x%02x>", ilCode[i+4], ilCode[i+3], ilCode[i+2], ilCode[i+1]);
- i+=4;
- continue;
- case 0xa5:printf("unbox.any <0x%02x%02x%02x%02x>", ilCode[i+4], ilCode[i+3], ilCode[i+2], ilCode[i+1]);
- i+=4;
- continue;
- case 0xb3:printf("conv.ovf.i1");continue;
- case 0xb4:printf("conv.ovf.u1");continue;
- case 0xb5:printf("conv.ovf.i2");continue;
- case 0xb6:printf("conv.ovf.u2");continue;
- case 0xb7:printf("conv.ovf.i4");continue;
- case 0xb8:printf("conv.ovf.u4");continue;
- case 0xb9:printf("conv.ovf.i8");continue;
- case 0xba:printf("conv.ovf.u8");continue;
- case 0xc2: //refanyval <T>
- printf("refanyval <0x%02x%02x%02x%02x>", ilCode[i+4], ilCode[i+3], ilCode[i+2], ilCode[i+1]);
- i+=4;
- continue;
- case 0xc3:printf("ckfinite");continue;
- case 0xc6: //mkrefany <T>
- printf("mkrefany <0x%02x%02x%02x%02x>", ilCode[i+4], ilCode[i+3], ilCode[i+2], ilCode[i+1]);
- i+=4;
- continue;
- case 0xd0: //ldtoken <T>
- printf("ldtoken <0x%02x%02x%02x%02x>", ilCode[i+4], ilCode[i+3], ilCode[i+2], ilCode[i+1]);
- i+=4;
- continue;
- case 0xd1:printf("conv.u2");continue;
- case 0xd2:printf("conv.u1");continue;
- case 0xd3:printf("conv.i");continue;
- case 0xd4:printf("conv.ovf.i");continue;
- case 0xd5:printf("conv.ovf.u");continue;
- case 0xd6:printf("add.ovf");continue;
- case 0xd7:printf("add.ovf.un");continue;
- case 0xd8:printf("mul.ovf");continue;
- case 0xd9:printf("mul.ovf.un");continue;
- case 0xda:printf("sub.ovf");continue;
- case 0xdb:printf("sub.ovf.un");continue;
- case 0xdc:printf("endfinally");continue;
- case 0xdd: //leave XXXX
- printf("leave 0x%02x%02x%02x%02x", ilCode[i+4], ilCode[i+3], ilCode[i+2], ilCode[i+1]);
- i+=4;
- continue;
- case 0xde: //leave.s X
- printf("leave 0x%02x", ilCode[i+1]);
- i+=1;
- continue;
- case 0xdf:printf("stind.i");continue;
- case 0xe0:printf("conv.u");continue;
- case 0xfe:
- i++;
- switch(ilCode[i])
- {
- case 0x00:printf("arglist");continue;
- case 0x01:printf("ceq");continue;
- case 0x02:printf("cgt");continue;
- case 0x03:printf("cgt.un");continue;
- case 0x04:printf("clt");continue;
- case 0x05:printf("clt.un");continue;
- case 0x06: //ldftn <T>
- printf("ldftn <0x%02x%02x%02x%02x>", ilCode[i+4], ilCode[i+3], ilCode[i+2], ilCode[i+1]);
- i+=4;
- continue;
- case 0x07: //ldvirtftn <T>
- printf("ldvirtftn <0x%02x%02x%02x%02x>", ilCode[i+4], ilCode[i+3], ilCode[i+2], ilCode[i+1]);
- i+=4;
- continue;
- case 0x09: //ldarg XX
- printf("ldarg 0x%02x%02x", ilCode[i+2], ilCode[i+1]);
- i+=2;
- continue;
- case 0x0a: //ldarga XX
- printf("ldarga 0x%02x%02x", ilCode[i+2], ilCode[i+1]);
- i+=2;
- continue;
- case 0x0b: //starg XX
- printf("starg 0x%02x%02x", ilCode[i+2], ilCode[i+1]);
- i+=2;
- continue;
- case 0x0c: //ldloc XX
- printf("ldloc 0x%02x%02x", ilCode[i+2], ilCode[i+1]);
- i+=2;
- continue;
- case 0x0d: //ldloca XX
- printf("ldloca 0x%02x%02x", ilCode[i+2], ilCode[i+1]);
- i+=2;
- continue;
- case 0x0e: //stloc XX
- printf("stloc 0x%02x%02x", ilCode[i+2], ilCode[i+1]);
- i+=2;
- continue;
- case 0x0f:printf("localloc");continue;
- case 0x11:printf("endfilter");continue;
- case 0x12: //unaligned X
- printf("unaligned. 0x%02x", ilCode[i+1]);
- i+=1;
- continue;
- case 0x13:printf("volatile.");continue;
- case 0x14:printf("tail.");continue;
- case 0x15: //initobj <T>
- printf("initobj <0x%02x%02x%02x%02x>", ilCode[i+4], ilCode[i+3], ilCode[i+2], ilCode[i+1]);
- i+=4;
- continue;
- case 0x16://incomplete?
- printf("constrained. <0x%02x%02x%02x%02x>", ilCode[i+4], ilCode[i+3], ilCode[i+2], ilCode[i+1]);
- i+=4;
- continue;
- case 0x17:printf("cpblk");continue;
- case 0x18:printf("initblk");continue;
- case 0x19:printf("no.");continue; //incomplete?
- case 0x1a:printf("rethrow");continue;
- case 0x1c: //sizeof <T>
- printf("sizeof <0x%02x%02x%02x%02x>", ilCode[i+4], ilCode[i+3], ilCode[i+2], ilCode[i+1]);
- i+=4;
- continue;
- case 0x1d:printf("refanytype");continue;
- default:
- LogError("unknown ilCode 0xfe%2x at offset %d in MethodGen::PrettyPrint", ilCode[i], i);
+ case 0x00:
+ printf("nop");
+ continue;
+ case 0x01:
+ printf("break");
+ continue;
+ case 0x02:
+ printf("ldarg.0");
+ continue;
+ case 0x03:
+ printf("ldarg.1");
+ continue;
+ case 0x04:
+ printf("ldarg.2");
+ continue;
+ case 0x05:
+ printf("ldarg.3");
+ continue;
+ case 0x06:
+ printf("ldloc.0");
+ continue;
+ case 0x07:
+ printf("ldloc.1");
+ continue;
+ case 0x08:
+ printf("ldloc.2");
+ continue;
+ case 0x09:
+ printf("ldloc.3");
+ continue;
+ case 0x0a:
+ printf("stloc.0");
+ continue;
+ case 0x0b:
+ printf("stloc.1");
+ continue;
+ case 0x0c:
+ printf("stloc.2");
+ continue;
+ case 0x0d:
+ printf("stloc.3");
+ continue;
+ case 0x0e: // ldarg.s X
+ printf("ldarg.s 0x%02x", ilCode[i + 1]);
+ i += 1;
+ continue;
+ case 0x0f: // ldarga.s X
+ printf("ldarga.s 0x%02x", ilCode[i + 1]);
+ i += 1;
+ continue;
+ case 0x10: // starg.s X
+ printf("starg.s 0x%02x", ilCode[i + 1]);
+ i += 1;
+ continue;
+ case 0x11: // ldloc.s X
+ printf("ldloc.s 0x%02x", ilCode[i + 1]);
+ i += 1;
+ continue;
+ case 0x12: // ldloca.s X
+ printf("ldloca.s 0x%02x", ilCode[i + 1]);
+ i += 1;
+ continue;
+ case 0x13: // stloc.s X
+ printf("stloc.s 0x%02x", ilCode[i + 1]);
+ i += 1;
+ continue;
+ case 0x14:
+ printf("ldnull");
+ continue;
+ case 0x15:
+ printf("ldc.i4.m1");
+ continue;
+ case 0x16:
+ printf("ldc.i4.0");
+ continue;
+ case 0x17:
+ printf("ldc.i4.1");
+ continue;
+ case 0x18:
+ printf("ldc.i4.2");
+ continue;
+ case 0x19:
+ printf("ldc.i4.3");
+ continue;
+ case 0x1a:
+ printf("ldc.i4.4");
+ continue;
+ case 0x1b:
+ printf("ldc.i4.5");
+ continue;
+ case 0x1c:
+ printf("ldc.i4.6");
+ continue;
+ case 0x1d:
+ printf("ldc.i4.7");
+ continue;
+ case 0x1e:
+ printf("ldc.i4.8");
+ continue;
+ case 0x1f: // ldc.i4.s X
+ printf("ldc.i4.s 0x%02x", ilCode[i + 1]);
+ i += 1;
+ continue;
+ case 0x20: // ldc.i4 XXXX
+ printf("ldc.i4 0x%02x%02x%02x%02x", ilCode[i + 4], ilCode[i + 3], ilCode[i + 2], ilCode[i + 1]);
+ i += 4;
+ continue;
+ case 0x21: // ldc.i8 XXXXXXXX
+ printf("ldc.i8 0x%02x%02x%02x%02x%02x%02x%02x%02x", ilCode[i + 8], ilCode[i + 7], ilCode[i + 6],
+ ilCode[i + 5], ilCode[i + 4], ilCode[i + 3], ilCode[i + 2], ilCode[i + 1]);
+ i += 8;
+ continue;
+ case 0x22: // ldc.r4 XXXX
+ printf("ldc.r4 float32(0x%02x%02x%02x%02x)", ilCode[i + 4], ilCode[i + 3], ilCode[i + 2],
+ ilCode[i + 1]);
+ i += 4;
+ continue;
+ case 0x23: // ldc.r8 XXXXXXXX
+ printf("ldc.r8 float64(0x%02x%02x%02x%02x%02x%02x%02x%02x)", ilCode[i + 8], ilCode[i + 7],
+ ilCode[i + 6], ilCode[i + 5], ilCode[i + 4], ilCode[i + 3], ilCode[i + 2], ilCode[i + 1]);
+ i += 8;
+ continue;
+ case 0x25:
+ printf("dup");
+ continue;
+ case 0x26:
+ printf("pop");
+ continue;
+ case 0x27: // JMP <T>
+ printf("jmp <0x%02x%02x%02x%02x>", ilCode[i + 4], ilCode[i + 3], ilCode[i + 2], ilCode[i + 1]);
+ i += 4;
+ continue;
+ case 0x28: // call <T>
+ printf("call <0x%02x%02x%02x%02x>", ilCode[i + 4], ilCode[i + 3], ilCode[i + 2], ilCode[i + 1]);
+ i += 4;
+ continue;
+ case 0x29: // calli <T>
+ printf("calli <0x%02x%02x%02x%02x>", ilCode[i + 4], ilCode[i + 3], ilCode[i + 2], ilCode[i + 1]);
+ i += 4;
+ continue;
+ case 0x2a:
+ printf("ret");
+ continue;
+ case 0x2b: // br.s X
+ printf("br.s IL_%04x", i + 2 + ilCode[i + 1]);
+ ;
+ i += 1;
+ continue;
+ case 0x2c: // brfalse.s X
+ printf("brfalse.s IL_%04x", i + 2 + ilCode[i + 1]);
+ ;
+ i += 1;
+ continue;
+ case 0x2d: // brtrue.s X
+ printf("brtrue.s IL_%04x", i + 2 + ilCode[i + 1]);
+ ;
+ i += 1;
+ continue;
+ case 0x2e: // beq.s X
+ printf("beq.s IL_%04x", i + 2 + ilCode[i + 1]);
+ ;
+ i += 1;
+ continue;
+ case 0x2f: // bgt.s X
+ printf("bgt.s IL_%04x", i + 2 + ilCode[i + 1]);
+ ;
+ i += 1;
+ continue;
+ case 0x30: // bgt.s X
+ printf("bgt.s IL_%04x", i + 2 + ilCode[i + 1]);
+ ;
+ i += 1;
+ continue;
+ case 0x31: // ble.s X
+ printf("ble.s IL_%04x", i + 2 + ilCode[i + 1]);
+ ;
+ i += 1;
+ continue;
+ case 0x32: // blt.s X
+ printf("blt.s IL_%04x", i + 2 + ilCode[i + 1]);
+ ;
+ i += 1;
+ continue;
+ case 0x33: // bne.un.s X
+ printf("bne.un.s IL_%04x", i + 2 + ilCode[i + 1]);
+ ;
+ i += 1;
+ continue;
+ case 0x34: // bge.un.s X
+ printf("bge.un.s IL_%04x", i + 2 + ilCode[i + 1]);
+ ;
+ i += 1;
+ continue;
+ case 0x35: // bgt.un.s X
+ printf("bgt.un.s IL_%04x", i + 2 + ilCode[i + 1]);
+ ;
+ i += 1;
+ continue;
+ case 0x36: // ble.un.s X
+ printf("ble.un.s IL_%04x", i + 2 + ilCode[i + 1]);
+ ;
+ i += 1;
+ continue;
+ case 0x37: // blt.un.s X
+ printf("blt.un.s IL_%04x", i + 2 + ilCode[i + 1]);
+ ;
+ i += 1;
+ continue;
+ case 0x38: // br XXXX
+ printf("br IL_%04x",
+ i + 5 + (ilCode[i + 4] << 24 | ilCode[i + 3] << 16 | ilCode[i + 2] << 8 | ilCode[i + 1]));
+ i += 4;
+ continue;
+ case 0x39: // brfalse XXXX
+ printf("brfalse IL_%04x",
+ i + 5 + (ilCode[i + 4] << 24 | ilCode[i + 3] << 16 | ilCode[i + 2] << 8 | ilCode[i + 1]));
+ i += 4;
+ continue;
+ case 0x3a: // brtrue XXXX
+ printf("brtrue IL_%04x",
+ i + 5 + (ilCode[i + 4] << 24 | ilCode[i + 3] << 16 | ilCode[i + 2] << 8 | ilCode[i + 1]));
+ i += 4;
+ continue;
+ case 0x3b: // beq XXXX
+ printf("beq IL_%04x",
+ i + 5 + (ilCode[i + 4] << 24 | ilCode[i + 3] << 16 | ilCode[i + 2] << 8 | ilCode[i + 1]));
+ i += 4;
+ continue;
+ case 0x3c: // bgt XXXX
+ printf("bgt IL_%04x",
+ i + 5 + (ilCode[i + 4] << 24 | ilCode[i + 3] << 16 | ilCode[i + 2] << 8 | ilCode[i + 1]));
+ i += 4;
+ continue;
+ case 0x3d: // bgt XXXX
+ printf("bgt IL_%04x",
+ i + 5 + (ilCode[i + 4] << 24 | ilCode[i + 3] << 16 | ilCode[i + 2] << 8 | ilCode[i + 1]));
+ i += 4;
+ continue;
+ case 0x3e: // ble XXXX
+ printf("ble IL_%04x",
+ i + 5 + (ilCode[i + 4] << 24 | ilCode[i + 3] << 16 | ilCode[i + 2] << 8 | ilCode[i + 1]));
+ i += 4;
+ continue;
+ case 0x3f: // blt XXXX
+ printf("blt IL_%04x",
+ i + 5 + (ilCode[i + 4] << 24 | ilCode[i + 3] << 16 | ilCode[i + 2] << 8 | ilCode[i + 1]));
+ i += 4;
+ continue;
+ case 0x40: // bne.un XXXX
+ printf("bne.un IL_%04x",
+ i + 5 + (ilCode[i + 4] << 24 | ilCode[i + 3] << 16 | ilCode[i + 2] << 8 | ilCode[i + 1]));
+ i += 4;
+ continue;
+ case 0x41: // bge.un XXXX
+ printf("bge.un IL_%04x",
+ i + 5 + (ilCode[i + 4] << 24 | ilCode[i + 3] << 16 | ilCode[i + 2] << 8 | ilCode[i + 1]));
+ i += 4;
+ continue;
+ case 0x42: // bgt.un XXXX
+ printf("bgt.un IL_%04x",
+ i + 5 + (ilCode[i + 4] << 24 | ilCode[i + 3] << 16 | ilCode[i + 2] << 8 | ilCode[i + 1]));
+ i += 4;
+ continue;
+ case 0x43: // ble.un XXXX
+ printf("ble.un IL_%04x",
+ i + 5 + (ilCode[i + 4] << 24 | ilCode[i + 3] << 16 | ilCode[i + 2] << 8 | ilCode[i + 1]));
+ i += 4;
+ continue;
+ case 0x44: // blt.un XXXX
+ printf("blt.un IL_%04x",
+ i + 5 + (ilCode[i + 4] << 24 | ilCode[i + 3] << 16 | ilCode[i + 2] << 8 | ilCode[i + 1]));
+ i += 4;
+ continue;
+ case 0x45: // switch NNNN NNNN*XXXX
+ printf("switch (0x%02x%02x%02x%02x)", ilCode[i + 4], ilCode[i + 3], ilCode[i + 2], ilCode[i + 1]);
+ k = (ilCode[i + 4] << 24) | (ilCode[i + 3] << 16) | (ilCode[i + 2] << 8) | (ilCode[i + 1] << 0);
+ i += 4;
+ for (j = 0; j < k; j++)
+ {
+ printf(" <0x%02x%02x%02x%02x>", ilCode[i + 4], ilCode[i + 3], ilCode[i + 2], ilCode[i + 1]);
+ i += 4;
+ }
+ continue;
+ case 0x46:
+ printf("ldind.i1");
+ continue;
+ case 0x47:
+ printf("ldind.u1");
+ continue;
+ case 0x48:
+ printf("ldind.i2");
+ continue;
+ case 0x49:
+ printf("ldind.u2");
+ continue;
+ case 0x4a:
+ printf("ldind.i4");
+ continue;
+ case 0x4b:
+ printf("ldind.u4");
+ continue;
+ case 0x4c:
+ printf("ldind.i8");
+ continue;
+ case 0x4d:
+ printf("ldind.u8");
+ continue;
+ case 0x4e:
+ printf("ldind.r4");
+ continue;
+ case 0x4f:
+ printf("ldind.r8");
+ continue;
+ case 0x50:
+ printf("ldind.ref");
+ continue;
+ case 0x51:
+ printf("stind.ref");
+ continue;
+ case 0x52:
+ printf("stind.i1");
+ continue;
+ case 0x53:
+ printf("stind.i2");
+ continue;
+ case 0x54:
+ printf("stind.i4");
+ continue;
+ case 0x55:
+ printf("stind.i8");
+ continue;
+ case 0x56:
+ printf("stind.r4");
+ continue;
+ case 0x57:
+ printf("stind.r8");
+ continue;
+ case 0x58:
+ printf("add");
+ continue;
+ case 0x59:
+ printf("sub");
+ continue;
+ case 0x5a:
+ printf("mul");
+ continue;
+ case 0x5b:
+ printf("div");
+ continue;
+ case 0x5c:
+ printf("div.un");
+ continue;
+ case 0x5d:
+ printf("rem");
+ continue;
+ case 0x5e:
+ printf("rem.un");
+ continue;
+ case 0x5f:
+ printf("and");
+ continue;
+ case 0x60:
+ printf("or");
+ continue;
+ case 0x61:
+ printf("xor");
+ continue;
+ case 0x62:
+ printf("shl");
+ continue;
+ case 0x63:
+ printf("shr");
+ continue;
+ case 0x64:
+ printf("shr.un");
+ continue;
+ case 0x65:
+ printf("neg");
+ continue;
+ case 0x66:
+ printf("not");
+ continue;
+ case 0x67:
+ printf("conv.i1");
+ continue;
+ case 0x68:
+ printf("conv.i2");
+ continue;
+ case 0x69:
+ printf("conv.i4");
+ continue;
+ case 0x6a:
+ printf("conv.i8");
+ continue;
+ case 0x6b:
+ printf("conv.r4");
+ continue;
+ case 0x6c:
+ printf("conv.r8");
+ continue;
+ case 0x6d:
+ printf("conv.u4");
+ continue;
+ case 0x6e:
+ printf("conv.u8");
+ continue;
+ case 0x6f: // callvirt <T>
+ printf("callvirt <0x%02x%02x%02x%02x>", ilCode[i + 4], ilCode[i + 3], ilCode[i + 2], ilCode[i + 1]);
+ i += 4;
+ continue;
+ case 0x70: // cpobj <T>
+ printf("cpobj <0x%02x%02x%02x%02x>", ilCode[i + 4], ilCode[i + 3], ilCode[i + 2], ilCode[i + 1]);
+ i += 4;
+ continue;
+ case 0x71: // ldobj <T>
+ printf("ldobj <0x%02x%02x%02x%02x>", ilCode[i + 4], ilCode[i + 3], ilCode[i + 2], ilCode[i + 1]);
+ i += 4;
+ continue;
+ case 0x72: // ldstr <T>
+ printf("ldstr <0x%02x%02x%02x%02x>", ilCode[i + 4], ilCode[i + 3], ilCode[i + 2], ilCode[i + 1]);
+ i += 4;
+ continue;
+ case 0x73: // newobj <T>
+ printf("newobj <0x%02x%02x%02x%02x>", ilCode[i + 4], ilCode[i + 3], ilCode[i + 2], ilCode[i + 1]);
+ i += 4;
+ continue;
+ case 0x74: // castclass <T>
+ printf("castclass <0x%02x%02x%02x%02x>", ilCode[i + 4], ilCode[i + 3], ilCode[i + 2], ilCode[i + 1]);
+ i += 4;
+ continue;
+ case 0x75: // isinst <T>
+ printf("isinst <0x%02x%02x%02x%02x>", ilCode[i + 4], ilCode[i + 3], ilCode[i + 2], ilCode[i + 1]);
+ i += 4;
+ continue;
+ case 0x76:
+ printf("conv.r.un");
+ continue;
+ case 0x79: // unbox <T>
+ printf("unbox <0x%02x%02x%02x%02x>", ilCode[i + 4], ilCode[i + 3], ilCode[i + 2], ilCode[i + 1]);
+ i += 4;
+ continue;
+ case 0x7a:
+ printf("throw");
+ continue;
+ case 0x7b: // ldfld <T>
+ printf("ldfld <0x%02x%02x%02x%02x>", ilCode[i + 4], ilCode[i + 3], ilCode[i + 2], ilCode[i + 1]);
+ i += 4;
+ continue;
+ case 0x7c: // ldflda <T>
+ printf("ldflda <0x%02x%02x%02x%02x>", ilCode[i + 4], ilCode[i + 3], ilCode[i + 2], ilCode[i + 1]);
+ i += 4;
+ continue;
+ case 0x7d: // stfld <T>
+ printf("stfld <0x%02x%02x%02x%02x>", ilCode[i + 4], ilCode[i + 3], ilCode[i + 2], ilCode[i + 1]);
+ i += 4;
+ continue;
+ case 0x7e: // ldsfld <T>
+ printf("ldsfld <0x%02x%02x%02x%02x>", ilCode[i + 4], ilCode[i + 3], ilCode[i + 2], ilCode[i + 1]);
+ i += 4;
+ continue;
+ case 0x7f: // ldsflda <T>
+ printf("ldsflda <0x%02x%02x%02x%02x>", ilCode[i + 4], ilCode[i + 3], ilCode[i + 2], ilCode[i + 1]);
+ i += 4;
+ continue;
+ case 0x80: // stsfld <T>
+ printf("stsfld <0x%02x%02x%02x%02x>", ilCode[i + 4], ilCode[i + 3], ilCode[i + 2], ilCode[i + 1]);
+ i += 4;
+ continue;
+ case 0x81: // stobj <T>
+ printf("stobj <0x%02x%02x%02x%02x>", ilCode[i + 4], ilCode[i + 3], ilCode[i + 2], ilCode[i + 1]);
+ i += 4;
+ continue;
+ case 0x82:
+ printf("conv.ovf.i1.un");
+ continue;
+ case 0x83:
+ printf("conv.ovf.i2.un");
+ continue;
+ case 0x84:
+ printf("conv.ovf.i4.un");
+ continue;
+ case 0x85:
+ printf("conv.ovf.i8.un");
+ continue;
+ case 0x86:
+ printf("conv.ovf.u1.un");
+ continue;
+ case 0x87:
+ printf("conv.ovf.u2.un");
+ continue;
+ case 0x88:
+ printf("conv.ovf.u4.un");
+ continue;
+ case 0x89:
+ printf("conv.ovf.u8.un");
+ continue;
+ case 0x8a:
+ printf("conv.ovf.i.un");
+ continue;
+ case 0x8b:
+ printf("conv.ovf.u.un");
+ continue;
+ case 0x8c: // box <T>
+ printf("box <0x%02x%02x%02x%02x>", ilCode[i + 4], ilCode[i + 3], ilCode[i + 2], ilCode[i + 1]);
+ i += 4;
+ continue;
+ case 0x8d: // newarr <T>
+ printf("newarr <0x%02x%02x%02x%02x>", ilCode[i + 4], ilCode[i + 3], ilCode[i + 2], ilCode[i + 1]);
+ i += 4;
+ continue;
+ case 0x8e:
+ printf("ldlen");
+ continue;
+ case 0x8f:
+ printf("ldelema <0x%02x%02x%02x%02x>", ilCode[i + 4], ilCode[i + 3], ilCode[i + 2], ilCode[i + 1]);
+ i += 4;
+ continue;
+ case 0x90:
+ printf("ldelem.i1");
+ continue;
+ case 0x91:
+ printf("ldelem.u1");
+ continue;
+ case 0x92:
+ printf("ldelem.i2");
+ continue;
+ case 0x93:
+ printf("ldelem.u2");
+ continue;
+ case 0x94:
+ printf("ldelem.i4");
+ continue;
+ case 0x95:
+ printf("ldelem.u4");
+ continue;
+ case 0x96:
+ printf("ldelem.i8");
+ continue;
+ case 0x97:
+ printf("ldelem.i");
+ continue;
+ case 0x98:
+ printf("ldelem.r4");
+ continue;
+ case 0x99:
+ printf("ldelem.r8");
+ continue;
+ case 0x9a:
+ printf("ldelem.ref");
+ continue;
+ case 0x9b:
+ printf("stelem.i");
+ continue;
+ case 0x9c:
+ printf("stelem.i1");
+ continue;
+ case 0x9d:
+ printf("stelem.i2");
+ continue;
+ case 0x9e:
+ printf("stelem.i4");
+ continue;
+ case 0x9f:
+ printf("stelem.i8");
+ continue;
+ case 0xa0:
+ printf("stelem.r4");
+ continue;
+ case 0xa1:
+ printf("stelem.r8");
+ continue;
+ case 0xa2:
+ printf("stelem.ref");
+ continue;
+ case 0xa3:
+ printf("stelem <0x%02x%02x%02x%02x>", ilCode[i + 4], ilCode[i + 3], ilCode[i + 2], ilCode[i + 1]);
+ i += 4;
+ continue;
+ case 0xa4:
+ printf("stelem <0x%02x%02x%02x%02x>", ilCode[i + 4], ilCode[i + 3], ilCode[i + 2], ilCode[i + 1]);
+ i += 4;
+ continue;
+ case 0xa5:
+ printf("unbox.any <0x%02x%02x%02x%02x>", ilCode[i + 4], ilCode[i + 3], ilCode[i + 2], ilCode[i + 1]);
+ i += 4;
+ continue;
+ case 0xb3:
+ printf("conv.ovf.i1");
+ continue;
+ case 0xb4:
+ printf("conv.ovf.u1");
+ continue;
+ case 0xb5:
+ printf("conv.ovf.i2");
+ continue;
+ case 0xb6:
+ printf("conv.ovf.u2");
+ continue;
+ case 0xb7:
+ printf("conv.ovf.i4");
+ continue;
+ case 0xb8:
+ printf("conv.ovf.u4");
+ continue;
+ case 0xb9:
+ printf("conv.ovf.i8");
+ continue;
+ case 0xba:
+ printf("conv.ovf.u8");
+ continue;
+ case 0xc2: // refanyval <T>
+ printf("refanyval <0x%02x%02x%02x%02x>", ilCode[i + 4], ilCode[i + 3], ilCode[i + 2], ilCode[i + 1]);
+ i += 4;
+ continue;
+ case 0xc3:
+ printf("ckfinite");
+ continue;
+ case 0xc6: // mkrefany <T>
+ printf("mkrefany <0x%02x%02x%02x%02x>", ilCode[i + 4], ilCode[i + 3], ilCode[i + 2], ilCode[i + 1]);
+ i += 4;
+ continue;
+ case 0xd0: // ldtoken <T>
+ printf("ldtoken <0x%02x%02x%02x%02x>", ilCode[i + 4], ilCode[i + 3], ilCode[i + 2], ilCode[i + 1]);
+ i += 4;
+ continue;
+ case 0xd1:
+ printf("conv.u2");
+ continue;
+ case 0xd2:
+ printf("conv.u1");
+ continue;
+ case 0xd3:
+ printf("conv.i");
+ continue;
+ case 0xd4:
+ printf("conv.ovf.i");
+ continue;
+ case 0xd5:
+ printf("conv.ovf.u");
+ continue;
+ case 0xd6:
+ printf("add.ovf");
+ continue;
+ case 0xd7:
+ printf("add.ovf.un");
+ continue;
+ case 0xd8:
+ printf("mul.ovf");
+ continue;
+ case 0xd9:
+ printf("mul.ovf.un");
+ continue;
+ case 0xda:
+ printf("sub.ovf");
+ continue;
+ case 0xdb:
+ printf("sub.ovf.un");
+ continue;
+ case 0xdc:
+ printf("endfinally");
+ continue;
+ case 0xdd: // leave XXXX
+ printf("leave 0x%02x%02x%02x%02x", ilCode[i + 4], ilCode[i + 3], ilCode[i + 2], ilCode[i + 1]);
+ i += 4;
+ continue;
+ case 0xde: // leave.s X
+ printf("leave 0x%02x", ilCode[i + 1]);
+ i += 1;
+ continue;
+ case 0xdf:
+ printf("stind.i");
+ continue;
+ case 0xe0:
+ printf("conv.u");
+ continue;
+ case 0xfe:
+ i++;
+ switch (ilCode[i])
+ {
+ case 0x00:
+ printf("arglist");
+ continue;
+ case 0x01:
+ printf("ceq");
+ continue;
+ case 0x02:
+ printf("cgt");
+ continue;
+ case 0x03:
+ printf("cgt.un");
+ continue;
+ case 0x04:
+ printf("clt");
+ continue;
+ case 0x05:
+ printf("clt.un");
+ continue;
+ case 0x06: // ldftn <T>
+ printf("ldftn <0x%02x%02x%02x%02x>", ilCode[i + 4], ilCode[i + 3], ilCode[i + 2],
+ ilCode[i + 1]);
+ i += 4;
+ continue;
+ case 0x07: // ldvirtftn <T>
+ printf("ldvirtftn <0x%02x%02x%02x%02x>", ilCode[i + 4], ilCode[i + 3], ilCode[i + 2],
+ ilCode[i + 1]);
+ i += 4;
+ continue;
+ case 0x09: // ldarg XX
+ printf("ldarg 0x%02x%02x", ilCode[i + 2], ilCode[i + 1]);
+ i += 2;
+ continue;
+ case 0x0a: // ldarga XX
+ printf("ldarga 0x%02x%02x", ilCode[i + 2], ilCode[i + 1]);
+ i += 2;
+ continue;
+ case 0x0b: // starg XX
+ printf("starg 0x%02x%02x", ilCode[i + 2], ilCode[i + 1]);
+ i += 2;
+ continue;
+ case 0x0c: // ldloc XX
+ printf("ldloc 0x%02x%02x", ilCode[i + 2], ilCode[i + 1]);
+ i += 2;
+ continue;
+ case 0x0d: // ldloca XX
+ printf("ldloca 0x%02x%02x", ilCode[i + 2], ilCode[i + 1]);
+ i += 2;
+ continue;
+ case 0x0e: // stloc XX
+ printf("stloc 0x%02x%02x", ilCode[i + 2], ilCode[i + 1]);
+ i += 2;
+ continue;
+ case 0x0f:
+ printf("localloc");
+ continue;
+ case 0x11:
+ printf("endfilter");
+ continue;
+ case 0x12: // unaligned X
+ printf("unaligned. 0x%02x", ilCode[i + 1]);
+ i += 1;
+ continue;
+ case 0x13:
+ printf("volatile.");
+ continue;
+ case 0x14:
+ printf("tail.");
+ continue;
+ case 0x15: // initobj <T>
+ printf("initobj <0x%02x%02x%02x%02x>", ilCode[i + 4], ilCode[i + 3], ilCode[i + 2],
+ ilCode[i + 1]);
+ i += 4;
+ continue;
+ case 0x16: // incomplete?
+ printf("constrained. <0x%02x%02x%02x%02x>", ilCode[i + 4], ilCode[i + 3], ilCode[i + 2],
+ ilCode[i + 1]);
+ i += 4;
+ continue;
+ case 0x17:
+ printf("cpblk");
+ continue;
+ case 0x18:
+ printf("initblk");
+ continue;
+ case 0x19:
+ printf("no.");
+ continue; // incomplete?
+ case 0x1a:
+ printf("rethrow");
+ continue;
+ case 0x1c: // sizeof <T>
+ printf("sizeof <0x%02x%02x%02x%02x>", ilCode[i + 4], ilCode[i + 3], ilCode[i + 2],
+ ilCode[i + 1]);
+ i += 4;
+ continue;
+ case 0x1d:
+ printf("refanytype");
+ continue;
+ default:
+ LogError("unknown ilCode 0xfe%2x at offset %d in MethodGen::PrettyPrint", ilCode[i], i);
+ break;
+ }
+ default:
+ LogError("unknown ilCode 0x%02x at offset %d in MethodGen::PrettyPrint", ilCode[i], i);
break;
- }
- default:
- LogError("unknown ilCode 0x%02x at offset %d in MethodGen::PrettyPrint", ilCode[i], i);
- break;
}
printf("\n");
}
}
-char * DumpAttributeToConsoleBare(DWORD attribute)
+char* DumpAttributeToConsoleBare(DWORD attribute)
{
- const char *s_static = "static";
- const char *s_dontInline = "$dontInline ";
- const char *s_constructor = "$constructor";
- const char *s_cfnw = "$noSecurityWrap";
+ const char* s_static = "static";
+ const char* s_dontInline = "$dontInline ";
+ const char* s_constructor = "$constructor";
+ const char* s_cfnw = "$noSecurityWrap";
-#define ifPrint(s,t) else if((s&attribute)==s) {printf(t); printf(" ");}
+#define ifPrint(s, t) \
+ else if ((s & attribute) == s) \
+ { \
+ printf(t); \
+ printf(" "); \
+ }
- if(0);
- ifPrint(CORINFO_FLG_STATIC, s_static)
- ifPrint(CORINFO_FLG_DONT_INLINE, s_dontInline)
- ifPrint(CORINFO_FLG_CONSTRUCTOR, s_constructor)
- ifPrint(CORINFO_FLG_NOSECURITYWRAP, s_cfnw)
- else
+ if (0)
+ ;
+ ifPrint(CORINFO_FLG_STATIC, s_static) ifPrint(CORINFO_FLG_DONT_INLINE, s_dontInline)
+ ifPrint(CORINFO_FLG_CONSTRUCTOR, s_constructor) ifPrint(CORINFO_FLG_NOSECURITYWRAP, s_cfnw) else
{
LogError("unknown attribute %x", attribute);
- __debugbreak();
+ __debugbreak();
}
return nullptr;
#undef ifPrint
}
-void DumpIL(MethodContext *mc)
+void DumpIL(MethodContext* mc)
{
CORINFO_METHOD_INFO cmi;
- unsigned int flags = 0;
+ unsigned int flags = 0;
mc->repCompileMethod(&cmi, &flags);
- const char *moduleName = nullptr;
- const char *methodName = mc->repGetMethodName(cmi.ftn, &moduleName);
- const char *className = mc->repGetClassName(mc->repGetMethodClass(cmi.ftn));
+ const char* moduleName = nullptr;
+ const char* methodName = mc->repGetMethodName(cmi.ftn, &moduleName);
+ const char* className = mc->repGetClassName(mc->repGetMethodClass(cmi.ftn));
printf("// ProcessName - '%s'\n", mc->cr->repProcessName());
printf(".assembly extern mscorlib{}\n");
@@ -591,7 +951,7 @@ void DumpIL(MethodContext *mc)
printf(")\n");
printf(" {\n");
printf(" .maxstack %u\n", cmi.maxStack);
- printf(" .locals%s(", (((cmi.options&CORINFO_OPT_INIT_LOCALS)==CORINFO_OPT_INIT_LOCALS)?" init ":" "));
+ printf(" .locals%s(", (((cmi.options & CORINFO_OPT_INIT_LOCALS) == CORINFO_OPT_INIT_LOCALS) ? " init " : " "));
DumpSigToConsoleBare(mc, &cmi.locals);
printf(")\n");
DumpILToConsoleBare(cmi.ILCode, cmi.ILCodeSize);
@@ -599,7 +959,7 @@ void DumpIL(MethodContext *mc)
printf("}\n");
}
-int verbILDump::DoWork(const char *nameOfInput, int indexCount, const int *indexes)
+int verbILDump::DoWork(const char* nameOfInput, int indexCount, const int* indexes)
{
LogVerbose("// Reading from '%s' dumping raw IL for MC Indexes to console", nameOfInput);
diff --git a/src/ToolBox/superpmi/mcs/verbildump.h b/src/ToolBox/superpmi/mcs/verbildump.h
index e947fcf..d93b9ac 100644
--- a/src/ToolBox/superpmi/mcs/verbildump.h
+++ b/src/ToolBox/superpmi/mcs/verbildump.h
@@ -14,11 +14,11 @@
class verbILDump
{
public:
- static int DoWork(const char *nameOfInput1, int indexCount, const int *indexes);
+ static int DoWork(const char* nameOfInput1, int indexCount, const int* indexes);
};
-void DumpPrimToConsoleBare(MethodContext *mc, CorInfoType prim, DWORDLONG classHandle);
-void DumpSigToConsoleBare(MethodContext *mc, CORINFO_SIG_INFO *pSig);
-char * DumpAttributeToConsoleBare(DWORD attribute);
+void DumpPrimToConsoleBare(MethodContext* mc, CorInfoType prim, DWORDLONG classHandle);
+void DumpSigToConsoleBare(MethodContext* mc, CORINFO_SIG_INFO* pSig);
+char* DumpAttributeToConsoleBare(DWORD attribute);
#endif
diff --git a/src/ToolBox/superpmi/mcs/verbinteg.cpp b/src/ToolBox/superpmi/mcs/verbinteg.cpp
index 9b10577..851ed9c 100644
--- a/src/ToolBox/superpmi/mcs/verbinteg.cpp
+++ b/src/ToolBox/superpmi/mcs/verbinteg.cpp
@@ -9,7 +9,7 @@
#include "methodcontext.h"
#include "methodcontextiterator.h"
-int verbInteg::DoWork(const char *nameOfInput)
+int verbInteg::DoWork(const char* nameOfInput)
{
LogVerbose("Checking the integrity of '%s'", nameOfInput);
@@ -27,8 +27,8 @@ int verbInteg::DoWork(const char *nameOfInput)
}
st2.Stop();
- LogInfo("Checked the integrity of %d methodContexts at %d per second",
- mci.MethodContextNumber(), (int)((double)mci.MethodContextNumber() / st2.GetSeconds()));
+ LogInfo("Checked the integrity of %d methodContexts at %d per second", mci.MethodContextNumber(),
+ (int)((double)mci.MethodContextNumber() / st2.GetSeconds()));
if (!mci.Destroy())
return -1;
diff --git a/src/ToolBox/superpmi/mcs/verbinteg.h b/src/ToolBox/superpmi/mcs/verbinteg.h
index d45ea15..3dfded4 100644
--- a/src/ToolBox/superpmi/mcs/verbinteg.h
+++ b/src/ToolBox/superpmi/mcs/verbinteg.h
@@ -12,6 +12,6 @@
class verbInteg
{
public:
- static int DoWork(const char *nameofInput);
+ static int DoWork(const char* nameofInput);
};
#endif
diff --git a/src/ToolBox/superpmi/mcs/verbmerge.cpp b/src/ToolBox/superpmi/mcs/verbmerge.cpp
index c4acfd8..c074fdd 100644
--- a/src/ToolBox/superpmi/mcs/verbmerge.cpp
+++ b/src/ToolBox/superpmi/mcs/verbmerge.cpp
@@ -17,10 +17,10 @@
// static
char* verbMerge::MergePathStrings(const char* dir, const char* file)
{
- size_t dirlen = strlen(dir);
+ size_t dirlen = strlen(dir);
size_t filelen = strlen(file);
- size_t newlen = dirlen + 1 /* slash */ + filelen + 1 /* null */;
- char* newpath = new char[newlen];
+ size_t newlen = dirlen + 1 /* slash */ + filelen + 1 /* null */;
+ char* newpath = new char[newlen];
strcpy(newpath, dir);
strcat(newpath, DIRECTORY_SEPARATOR_STR_A);
strcat(newpath, file);
@@ -39,7 +39,8 @@ int verbMerge::AppendFile(HANDLE hFileOut, const char* fileName, unsigned char*
LogInfo("Appending file '%s'", fileName);
- HANDLE hFileIn = CreateFileA(fileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL|FILE_FLAG_SEQUENTIAL_SCAN, NULL);
+ HANDLE hFileIn = CreateFileA(fileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING,
+ FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
if (hFileIn == INVALID_HANDLE_VALUE)
{
LogError("Failed to open input file '%s'. GetLastError()=%u", fileName, GetLastError());
@@ -57,7 +58,7 @@ int verbMerge::AppendFile(HANDLE hFileOut, const char* fileName, unsigned char*
for (LONGLONG offset = 0; offset < fileSize.QuadPart; offset += bufferSize)
{
DWORD bytesRead = -1;
- BOOL res = ReadFile(hFileIn, buffer, (DWORD)bufferSize, &bytesRead, nullptr);
+ BOOL res = ReadFile(hFileIn, buffer, (DWORD)bufferSize, &bytesRead, nullptr);
if (!res)
{
LogError("Failed to read '%s' from offset %lld. GetLastError()=%u", fileName, offset, GetLastError());
@@ -65,7 +66,7 @@ int verbMerge::AppendFile(HANDLE hFileOut, const char* fileName, unsigned char*
goto CLEAN_UP;
}
DWORD bytesWritten = -1;
- BOOL res2 = WriteFile(hFileOut, buffer, bytesRead, &bytesWritten, nullptr);
+ BOOL res2 = WriteFile(hFileOut, buffer, bytesRead, &bytesWritten, nullptr);
if (!res2)
{
LogError("Failed to write output file at offset %lld. GetLastError()=%u", offset, GetLastError());
@@ -98,11 +99,11 @@ bool verbMerge::DirectoryFilterDirectories(WIN32_FIND_DATAA* findData)
{
if ((findData->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0)
{
- // It's a directory. See if we want to exclude it because of other reasons, such as:
- // 1. reparse points: avoid the possibility of loops
- // 2. system directories
- // 3. hidden directories
- // 4. "." or ".."
+// It's a directory. See if we want to exclude it because of other reasons, such as:
+// 1. reparse points: avoid the possibility of loops
+// 2. system directories
+// 3. hidden directories
+// 4. "." or ".."
#ifndef FEATURE_PAL // FILE_ATTRIBUTE_REPARSE_POINT is not defined in the PAL
if ((findData->dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) != 0)
@@ -154,52 +155,52 @@ int __cdecl verbMerge::WIN32_FIND_DATAA_qsort_helper(const void* p1, const void*
// If success, fileArray and elemCount are set.
//
// static
-int verbMerge::FilterDirectory(const char* searchPattern, DirectoryFilterFunction_t filter, /* out */ WIN32_FIND_DATAA** ppFileArray, int* pElemCount)
+int verbMerge::FilterDirectory(const char* searchPattern,
+ DirectoryFilterFunction_t filter,
+ /* out */ WIN32_FIND_DATAA** ppFileArray,
+ int* pElemCount)
{
// First, build up a list, then create an array and sort it after we know how many elements there are.
struct findDataList
{
- findDataList(WIN32_FIND_DATAA* newFindData, findDataList* newNext)
- : findData(*newFindData)
- , next(newNext)
+ findDataList(WIN32_FIND_DATAA* newFindData, findDataList* newNext) : findData(*newFindData), next(newNext)
{
}
static void DeleteList(findDataList* root)
{
- for (findDataList* loop = root; loop != nullptr; )
+ for (findDataList* loop = root; loop != nullptr;)
{
- findDataList* tmp = loop;
- loop = loop->next;
- delete tmp;
+ findDataList* tmp = loop;
+ loop = loop->next;
+ delete tmp;
}
}
WIN32_FIND_DATAA findData;
- findDataList* next;
+ findDataList* next;
};
WIN32_FIND_DATAA* retArray = nullptr;
- findDataList* first = nullptr;
+ findDataList* first = nullptr;
- int result = 0; // default to zero == success
+ int result = 0; // default to zero == success
int elemCount = 0;
// NOTE: this function only works on Windows 7 and later.
WIN32_FIND_DATAA findData;
- HANDLE hSearch;
+ HANDLE hSearch;
#ifdef FEATURE_PAL
// PAL doesn't have FindFirstFileEx(). So just use FindFirstFile(). The only reason we use
// the Ex version is potentially better performance (don't populate short name; use large fetch),
// not functionality.
hSearch = FindFirstFileA(searchPattern, &findData);
-#else // !FEATURE_PAL
+#else // !FEATURE_PAL
hSearch = FindFirstFileExA(searchPattern,
FindExInfoBasic, // We don't care about the short names
&findData,
FindExSearchNameMatch, // standard name matching
- NULL,
- FIND_FIRST_EX_LARGE_FETCH);
+ NULL, FIND_FIRST_EX_LARGE_FETCH);
#endif // !FEATURE_PAL
if (hSearch == INVALID_HANDLE_VALUE)
@@ -246,7 +247,7 @@ int verbMerge::FilterDirectory(const char* searchPattern, DirectoryFilterFunctio
int i;
retArray = new WIN32_FIND_DATAA[elemCount];
- i = 0;
+ i = 0;
for (findDataList* tmp = first; tmp != nullptr; tmp = tmp->next)
{
retArray[i++] = tmp->findData;
@@ -266,23 +267,29 @@ CLEAN_UP:
}
*ppFileArray = retArray;
- *pElemCount = elemCount;
+ *pElemCount = elemCount;
return result;
}
// Append all files in the given directory matching the file pattern.
//
// static
-int verbMerge::AppendAllInDir(HANDLE hFileOut, const char* dir, const char* file, unsigned char* buffer, size_t bufferSize, bool recursive, /* out */ LONGLONG* size)
+int verbMerge::AppendAllInDir(HANDLE hFileOut,
+ const char* dir,
+ const char* file,
+ unsigned char* buffer,
+ size_t bufferSize,
+ bool recursive,
+ /* out */ LONGLONG* size)
{
- int result = 0; // default to zero == success
+ int result = 0; // default to zero == success
LONGLONG totalSize = 0;
char* searchPattern = MergePathStrings(dir, file);
WIN32_FIND_DATAA* fileArray = nullptr;
- int elemCount = 0;
- result = FilterDirectory(searchPattern, DirectoryFilterFile, &fileArray, &elemCount);
+ int elemCount = 0;
+ result = FilterDirectory(searchPattern, DirectoryFilterFile, &fileArray, &elemCount);
if (result != 0)
{
goto CLEAN_UP;
@@ -290,8 +297,8 @@ int verbMerge::AppendAllInDir(HANDLE hFileOut, const char* dir, const char* file
for (int i = 0; i < elemCount; i++)
{
- const WIN32_FIND_DATAA& findData = fileArray[i];
- char* fileFullPath = MergePathStrings(dir, findData.cFileName);
+ const WIN32_FIND_DATAA& findData = fileArray[i];
+ char* fileFullPath = MergePathStrings(dir, findData.cFileName);
// Is it zero length? If so, skip it.
if ((findData.nFileSizeLow == 0) && (findData.nFileSizeHigh == 0))
@@ -320,9 +327,9 @@ int verbMerge::AppendAllInDir(HANDLE hFileOut, const char* dir, const char* file
delete[] fileArray;
searchPattern = MergePathStrings(dir, "*");
- fileArray = nullptr;
- elemCount = 0;
- result = FilterDirectory(searchPattern, DirectoryFilterDirectories, &fileArray, &elemCount);
+ fileArray = nullptr;
+ elemCount = 0;
+ result = FilterDirectory(searchPattern, DirectoryFilterDirectories, &fileArray, &elemCount);
if (result != 0)
{
goto CLEAN_UP;
@@ -334,7 +341,7 @@ int verbMerge::AppendAllInDir(HANDLE hFileOut, const char* dir, const char* file
const WIN32_FIND_DATAA& findData = fileArray[i];
char* fileFullPath = MergePathStrings(dir, findData.cFileName);
- result = AppendAllInDir(hFileOut, fileFullPath, file, buffer, bufferSize, recursive, &dirSize);
+ result = AppendAllInDir(hFileOut, fileFullPath, file, buffer, bufferSize, recursive, &dirSize);
delete[] fileFullPath;
if (result != 0)
{
@@ -363,20 +370,22 @@ CLEAN_UP:
// 1. *.mc -- simple pattern. Assumes current directory.
// 2. foo\bar\*.mc -- simple pattern with relative directory.
// 3. c:\foo\bar\baz\*.mc -- simple pattern with full path.
-// If no pattern is given, then the last component of the path is expected to be a directory name, and the pattern is assumed to be "*" (that is, all files).
+// If no pattern is given, then the last component of the path is expected to be a directory name, and the pattern is
+// assumed to be "*" (that is, all files).
//
-// If "recursive" is true, then the pattern is searched for in the specified directory (or implicit current directory) and
-// all sub-directories, recursively.
+// If "recursive" is true, then the pattern is searched for in the specified directory (or implicit current directory)
+// and all sub-directories, recursively.
//
// static
int verbMerge::DoWork(const char* nameOfOutputFile, const char* pattern, bool recursive)
{
- int result = 0; // default to zero == success
+ int result = 0; // default to zero == success
SimpleTimer st1;
LogInfo("Merging files matching '%s' into '%s'", pattern, nameOfOutputFile);
- HANDLE hFileOut = CreateFileA(nameOfOutputFile, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL|FILE_FLAG_SEQUENTIAL_SCAN, NULL);
+ HANDLE hFileOut = CreateFileA(nameOfOutputFile, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
+ FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
if (hFileOut == INVALID_HANDLE_VALUE)
{
LogError("Failed to open output file '%s'. GetLastError()=%u", nameOfOutputFile, GetLastError());
@@ -385,16 +394,16 @@ int verbMerge::DoWork(const char* nameOfOutputFile, const char* pattern, bool re
// Create a buffer we can use for all the copies.
unsigned char* buffer = new unsigned char[BUFFER_SIZE];
- char* dir = nullptr;
- const char* file = nullptr;
+ char* dir = nullptr;
+ const char* file = nullptr;
- dir = _strdup(pattern);
+ dir = _strdup(pattern);
char* lastSlash = strrchr(dir, DIRECTORY_SEPARATOR_CHAR_A);
if (lastSlash == NULL)
{
// The user may have passed a relative path without a slash, or the current directory.
- // If there is a wildcard, we use it as the file pattern. If there isn't, we assume it's a relative directory name
- // and use it as a directory, with "*" as the file pattern.
+ // If there is a wildcard, we use it as the file pattern. If there isn't, we assume it's a relative directory
+ // name and use it as a directory, with "*" as the file pattern.
const char* wildcard = strchr(dir, '*');
if (wildcard == NULL)
{
@@ -403,7 +412,7 @@ int verbMerge::DoWork(const char* nameOfOutputFile, const char* pattern, bool re
else
{
file = dir;
- dir = _strdup(".");
+ dir = _strdup(".");
}
}
else
@@ -413,7 +422,8 @@ int verbMerge::DoWork(const char* nameOfOutputFile, const char* pattern, bool re
{
file = "*";
- // Minor canonicalization: if there is a trailing last slash, strip it (probably should do this in a loop...)
+ // Minor canonicalization: if there is a trailing last slash, strip it (probably should do this in a
+ // loop...)
if (*(lastSlash + 1) == '\0')
{
*lastSlash = '\0';
@@ -423,12 +433,12 @@ int verbMerge::DoWork(const char* nameOfOutputFile, const char* pattern, bool re
{
// ok, we found a wildcard after the last slash, so assume there is a pattern. Strip it at the last slash.
*lastSlash = '\0';
- file = lastSlash + 1;
+ file = lastSlash + 1;
}
}
LONGLONG totalSize = 0;
- LONGLONG dirSize = 0;
+ LONGLONG dirSize = 0;
st1.Start();
@@ -441,9 +451,9 @@ int verbMerge::DoWork(const char* nameOfOutputFile, const char* pattern, bool re
st1.Stop();
- LogInfo("Read/Wrote %lld MB @ %4.2f MB/s.",
- totalSize/(1000*1000),
- (((double)totalSize)/(1000*1000))/st1.GetSeconds()); //yes yes.. http://en.wikipedia.org/wiki/Megabyte_per_second#Megabyte_per_second
+ LogInfo("Read/Wrote %lld MB @ %4.2f MB/s.", totalSize / (1000 * 1000),
+ (((double)totalSize) / (1000 * 1000)) /
+ st1.GetSeconds()); // yes yes.. http://en.wikipedia.org/wiki/Megabyte_per_second#Megabyte_per_second
CLEAN_UP:
diff --git a/src/ToolBox/superpmi/mcs/verbmerge.h b/src/ToolBox/superpmi/mcs/verbmerge.h
index 1d61242..222669d 100644
--- a/src/ToolBox/superpmi/mcs/verbmerge.h
+++ b/src/ToolBox/superpmi/mcs/verbmerge.h
@@ -19,11 +19,20 @@ private:
static bool DirectoryFilterDirectories(WIN32_FIND_DATAA* findData);
static bool DirectoryFilterFile(WIN32_FIND_DATAA* findData);
static int __cdecl WIN32_FIND_DATAA_qsort_helper(const void* p1, const void* p2);
- static int FilterDirectory(const char* searchPattern, DirectoryFilterFunction_t filter, /* out */ WIN32_FIND_DATAA** ppFileArray, int* pElemCount);
+ static int FilterDirectory(const char* searchPattern,
+ DirectoryFilterFunction_t filter,
+ /* out */ WIN32_FIND_DATAA** ppFileArray,
+ int* pElemCount);
static char* MergePathStrings(const char* dir, const char* file);
static int AppendFile(HANDLE hFileOut, const char* fileName, unsigned char* buffer, size_t bufferSize);
- static int AppendAllInDir(HANDLE hFileOut, const char* dir, const char* file, unsigned char* buffer, size_t bufferSize, bool recursive, /* out */ LONGLONG* size);
+ static int AppendAllInDir(HANDLE hFileOut,
+ const char* dir,
+ const char* file,
+ unsigned char* buffer,
+ size_t bufferSize,
+ bool recursive,
+ /* out */ LONGLONG* size);
};
#endif
diff --git a/src/ToolBox/superpmi/mcs/verbremovedup.cpp b/src/ToolBox/superpmi/mcs/verbremovedup.cpp
index eca5dc1..cd2ead0 100644
--- a/src/ToolBox/superpmi/mcs/verbremovedup.cpp
+++ b/src/ToolBox/superpmi/mcs/verbremovedup.cpp
@@ -10,32 +10,32 @@
#include "methodcontext.h"
#include "methodcontextiterator.h"
-//We use a hash to limit the number of comparisons we need to do.
-//The first level key to our hash map is ILCodeSize and the second
-//level map key is just an index and the value is an existing MC Hash.
+// We use a hash to limit the number of comparisons we need to do.
+ //The first level key to our hash map is ILCodeSize and the second
+ //level map key is just an index and the value is an existing MC Hash.
-LightWeightMap<int, DenseLightWeightMap<char *> *> *inFile = nullptr;
+LightWeightMap<int, DenseLightWeightMap<char*>*>* inFile = nullptr;
-bool unique(MethodContext *mc)
+bool unique(MethodContext* mc)
{
if (inFile == nullptr)
- inFile = new LightWeightMap<int, DenseLightWeightMap<char *> *>();
+ inFile = new LightWeightMap<int, DenseLightWeightMap<char*>*>();
CORINFO_METHOD_INFO newInfo;
- unsigned newFlags = 0;
+ unsigned newFlags = 0;
mc->repCompileMethod(&newInfo, &newFlags);
- char *md5Buff = new char[MD5_HASH_BUFFER_SIZE];
+ char* md5Buff = new char[MD5_HASH_BUFFER_SIZE];
mc->dumpMethodMD5HashToBuffer(md5Buff, MD5_HASH_BUFFER_SIZE);
if (inFile->GetIndex(newInfo.ILCodeSize) == -1)
- inFile->Add(newInfo.ILCodeSize, new DenseLightWeightMap<char *>());
+ inFile->Add(newInfo.ILCodeSize, new DenseLightWeightMap<char*>());
- DenseLightWeightMap<char *> *ourRank = inFile->Get(newInfo.ILCodeSize);
+ DenseLightWeightMap<char*>* ourRank = inFile->Get(newInfo.ILCodeSize);
for (int i = 0; i < (int)ourRank->GetCount(); i++)
{
- char *md5Buff2 = ourRank->Get(i);
+ char* md5Buff2 = ourRank->Get(i);
if (strncmp(md5Buff, md5Buff2, MD5_HASH_BUFFER_SIZE) == 0)
{
@@ -48,25 +48,25 @@ bool unique(MethodContext *mc)
return true;
}
-LightWeightMap<int, DenseLightWeightMap<MethodContext *> *> *inFileLegacy = nullptr;
+LightWeightMap<int, DenseLightWeightMap<MethodContext*>*>* inFileLegacy = nullptr;
-bool uniqueLegacy(MethodContext *mc)
+bool uniqueLegacy(MethodContext* mc)
{
if (inFileLegacy == nullptr)
- inFileLegacy = new LightWeightMap<int, DenseLightWeightMap<MethodContext *> *>();
+ inFileLegacy = new LightWeightMap<int, DenseLightWeightMap<MethodContext*>*>();
CORINFO_METHOD_INFO newInfo;
- unsigned newFlags = 0;
+ unsigned newFlags = 0;
mc->repCompileMethod(&newInfo, &newFlags);
if (inFileLegacy->GetIndex(newInfo.ILCodeSize) == -1)
- inFileLegacy->Add(newInfo.ILCodeSize, new DenseLightWeightMap<MethodContext *>());
+ inFileLegacy->Add(newInfo.ILCodeSize, new DenseLightWeightMap<MethodContext*>());
- DenseLightWeightMap<MethodContext *> *ourRank = inFileLegacy->Get(newInfo.ILCodeSize);
+ DenseLightWeightMap<MethodContext*>* ourRank = inFileLegacy->Get(newInfo.ILCodeSize);
for (int i = 0; i < (int)ourRank->GetCount(); i++)
{
- MethodContext *scratch = ourRank->Get(i);
+ MethodContext* scratch = ourRank->Get(i);
if (mc->Equal(scratch))
{
return false;
@@ -78,7 +78,7 @@ bool uniqueLegacy(MethodContext *mc)
return true;
}
-int verbRemoveDup::DoWork(const char *nameOfInput, const char *nameOfOutput, bool stripCR, bool legacyCompare)
+int verbRemoveDup::DoWork(const char* nameOfInput, const char* nameOfOutput, bool stripCR, bool legacyCompare)
{
LogVerbose("Removing duplicates from '%s', writing to '%s'", nameOfInput, nameOfOutput);
@@ -88,7 +88,8 @@ int verbRemoveDup::DoWork(const char *nameOfInput, const char *nameOfOutput, boo
int savedCount = 0;
- HANDLE hFileOut = CreateFileA(nameOfOutput, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
+ HANDLE hFileOut = CreateFileA(nameOfOutput, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
+ FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
if (hFileOut == INVALID_HANDLE_VALUE)
{
LogError("Failed to open output '%s'. GetLastError()=%u", nameOfOutput, GetLastError());
@@ -110,7 +111,8 @@ int verbRemoveDup::DoWork(const char *nameOfInput, const char *nameOfOutput, boo
mc->saveToFile(hFileOut);
savedCount++;
- // In this case, for the legacy comparer, it has placed the 'mc' in the 'inFileLegacy' table, so we can't delete it.
+ // In this case, for the legacy comparer, it has placed the 'mc' in the 'inFileLegacy' table, so we
+ // can't delete it.
}
else
{
diff --git a/src/ToolBox/superpmi/mcs/verbremovedup.h b/src/ToolBox/superpmi/mcs/verbremovedup.h
index ab0cb98..e4cbad8 100644
--- a/src/ToolBox/superpmi/mcs/verbremovedup.h
+++ b/src/ToolBox/superpmi/mcs/verbremovedup.h
@@ -12,6 +12,6 @@
class verbRemoveDup
{
public:
- static int DoWork(const char *nameOfInput1, const char *nameOfOutput, bool stripCR, bool legacyCompare);
+ static int DoWork(const char* nameOfInput1, const char* nameOfOutput, bool stripCR, bool legacyCompare);
};
#endif
diff --git a/src/ToolBox/superpmi/mcs/verbsmarty.cpp b/src/ToolBox/superpmi/mcs/verbsmarty.cpp
index 9b881cd..a9425bd 100644
--- a/src/ToolBox/superpmi/mcs/verbsmarty.cpp
+++ b/src/ToolBox/superpmi/mcs/verbsmarty.cpp
@@ -20,7 +20,7 @@
//
verbSmarty::verbSmarty(HANDLE hFile)
{
- m_hFile=hFile;
+ m_hFile = hFile;
}
//
@@ -31,21 +31,21 @@ verbSmarty::verbSmarty(HANDLE hFile)
//
void verbSmarty::DumpTestInfo(int testID)
{
- #define bufflen 4096
+#define bufflen 4096
DWORD bytesWritten;
char buff[bufflen];
- int buff_offset = 0;
+ int buff_offset = 0;
ZeroMemory(buff, bufflen * sizeof(char));
- buff_offset+=sprintf_s(&buff[buff_offset], bufflen-buff_offset, "%i\r\n", testID);
+ buff_offset += sprintf_s(&buff[buff_offset], bufflen - buff_offset, "%i\r\n", testID);
WriteFile(m_hFile, buff, buff_offset * sizeof(char), &bytesWritten, nullptr);
}
-
-int verbSmarty::DoWork(const char *nameOfInput, const char *nameOfOutput, int indexCount, const int *indexes)
+int verbSmarty::DoWork(const char* nameOfInput, const char* nameOfOutput, int indexCount, const int* indexes)
{
- LogVerbose("Reading from '%s' reading Smarty ID for the Mc Indexes and writing into '%s'", nameOfInput, nameOfOutput);
+ LogVerbose("Reading from '%s' reading Smarty ID for the Mc Indexes and writing into '%s'", nameOfInput,
+ nameOfOutput);
MethodContextIterator mci(indexCount, indexes);
if (!mci.Initialize(nameOfInput))
@@ -53,16 +53,17 @@ int verbSmarty::DoWork(const char *nameOfInput, const char *nameOfOutput, int in
int savedCount = 0;
- HANDLE hFileOut = CreateFileA(nameOfOutput, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL|FILE_FLAG_SEQUENTIAL_SCAN, NULL);
- if(hFileOut == INVALID_HANDLE_VALUE)
+ HANDLE hFileOut = CreateFileA(nameOfOutput, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
+ FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
+ if (hFileOut == INVALID_HANDLE_VALUE)
{
LogError("Failed to open input 1 '%s'. GetLastError()=%u", nameOfOutput, GetLastError());
return -1;
}
- verbSmarty *verbList = new verbSmarty(hFileOut);
+ verbSmarty* verbList = new verbSmarty(hFileOut);
- //TODO-Cleanup: look to use toc for this
+ // TODO-Cleanup: look to use toc for this
while (mci.MoveNext())
{
MethodContext* mc = mci.Current();
@@ -70,7 +71,7 @@ int verbSmarty::DoWork(const char *nameOfInput, const char *nameOfOutput, int in
int testID = mc->repGetTestID();
if (testID != -1)
{
- //write to the file
+ // write to the file
verbList->DumpTestInfo(testID);
}
else
diff --git a/src/ToolBox/superpmi/mcs/verbsmarty.h b/src/ToolBox/superpmi/mcs/verbsmarty.h
index 994695d..c595ecb 100644
--- a/src/ToolBox/superpmi/mcs/verbsmarty.h
+++ b/src/ToolBox/superpmi/mcs/verbsmarty.h
@@ -14,7 +14,7 @@ class verbSmarty
public:
verbSmarty(HANDLE hFile);
void DumpTestInfo(int testID);
- static int DoWork(const char *nameOfInput, const char *nameofOutput, int indexCount, const int *indexes);
+ static int DoWork(const char* nameOfInput, const char* nameofOutput, int indexCount, const int* indexes);
private:
HANDLE m_hFile;
diff --git a/src/ToolBox/superpmi/mcs/verbstat.cpp b/src/ToolBox/superpmi/mcs/verbstat.cpp
index 473f452..1374519 100644
--- a/src/ToolBox/superpmi/mcs/verbstat.cpp
+++ b/src/ToolBox/superpmi/mcs/verbstat.cpp
@@ -10,7 +10,7 @@
#include "methodcontextiterator.h"
#include "errorhandling.h"
-int verbStat::DoWork(const char *nameOfInput, const char *nameOfOutput, int indexCount, const int *indexes)
+int verbStat::DoWork(const char* nameOfInput, const char* nameOfOutput, int indexCount, const int* indexes)
{
LogVerbose("Stat'ing from '%s' and writing output into '%s'", nameOfInput, nameOfOutput);
@@ -20,17 +20,18 @@ int verbStat::DoWork(const char *nameOfInput, const char *nameOfOutput, int inde
int savedCount = 0;
- HANDLE hFileOut = CreateFileA(nameOfOutput, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL|FILE_FLAG_SEQUENTIAL_SCAN, NULL);
- if(hFileOut == INVALID_HANDLE_VALUE)
+ HANDLE hFileOut = CreateFileA(nameOfOutput, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
+ FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
+ if (hFileOut == INVALID_HANDLE_VALUE)
{
LogError("Failed to open input 1 '%s'. GetLastError()=%u", nameOfOutput, GetLastError());
return -1;
}
- #define bufflen 50000
+#define bufflen 50000
DWORD bytesWritten;
- char buff[bufflen];
- int offset = 0;
+ char buff[bufflen];
+ int offset = 0;
ZeroMemory(&buff[0], bufflen);
offset += sprintf_s(buff, bufflen, "Title,MC#,");
offset += MethodContext::dumpStatTitleToBuffer(&buff[offset], bufflen - offset);
@@ -46,7 +47,7 @@ int verbStat::DoWork(const char *nameOfInput, const char *nameOfOutput, int inde
ZeroMemory(&buff[0], bufflen);
if ((mc->cr->ProcessName != nullptr) && (mc->cr->ProcessName->GetCount() > 0))
{
- const char *procname = mc->cr->repProcessName();
+ const char* procname = mc->cr->repProcessName();
strcpy_s(&buff[offset], bufflen, procname);
offset += (int)strlen(procname);
}
diff --git a/src/ToolBox/superpmi/mcs/verbstat.h b/src/ToolBox/superpmi/mcs/verbstat.h
index 53a3a78..8e74c25 100644
--- a/src/ToolBox/superpmi/mcs/verbstat.h
+++ b/src/ToolBox/superpmi/mcs/verbstat.h
@@ -12,6 +12,6 @@
class verbStat
{
public:
- static int DoWork(const char *nameOfInput1, const char *nameOfOutput, int indexCount, const int *indexes);
+ static int DoWork(const char* nameOfInput1, const char* nameOfOutput, int indexCount, const int* indexes);
};
#endif
diff --git a/src/ToolBox/superpmi/mcs/verbstrip.cpp b/src/ToolBox/superpmi/mcs/verbstrip.cpp
index 8783b1a..352ef04 100644
--- a/src/ToolBox/superpmi/mcs/verbstrip.cpp
+++ b/src/ToolBox/superpmi/mcs/verbstrip.cpp
@@ -13,37 +13,39 @@
// verbStrip::DoWork handles both "-copy" and "-strip". These both copy from input file to output file,
// but treat the passed-in indexes in opposite ways.
-int verbStrip::DoWork(const char *nameOfInput, const char *nameOfOutput, int indexCount, const int *indexes, bool strip, bool stripCR)
+int verbStrip::DoWork(
+ const char* nameOfInput, const char* nameOfOutput, int indexCount, const int* indexes, bool strip, bool stripCR)
{
if (strip)
return DoWorkTheOldWay(nameOfInput, nameOfOutput, indexCount, indexes, stripCR);
- SimpleTimer *st1 = new SimpleTimer();
+ SimpleTimer* st1 = new SimpleTimer();
LogVerbose("Reading from '%s' removing Mc Indexes and writing into '%s'", nameOfInput, nameOfOutput);
- int loadedCount = 0;
- MethodContext *mc = nullptr;
- int savedCount = 0;
- int index = 0;
+ int loadedCount = 0;
+ MethodContext* mc = nullptr;
+ int savedCount = 0;
+ int index = 0;
// The method context reader handles skipping any unrequested method contexts
// Used in conjunction with an MCI file, it does a lot less work...
- MethodContextReader *reader = new MethodContextReader(nameOfInput, indexes, indexCount);
+ MethodContextReader* reader = new MethodContextReader(nameOfInput, indexes, indexCount);
if (!reader->isValid())
{
return -1;
}
- HANDLE hFileOut = CreateFileA(nameOfOutput, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL|FILE_FLAG_SEQUENTIAL_SCAN, NULL);
- if(hFileOut == INVALID_HANDLE_VALUE)
+ HANDLE hFileOut = CreateFileA(nameOfOutput, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
+ FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
+ if (hFileOut == INVALID_HANDLE_VALUE)
{
LogError("Failed to open input 1 '%s'. GetLastError()=%u", nameOfOutput, GetLastError());
return -1;
}
- if(indexCount == -1)
- strip = true; //Copy command with no indexes listed should copy all the inputs...
- while(true)
+ if (indexCount == -1)
+ strip = true; // Copy command with no indexes listed should copy all the inputs...
+ while (true)
{
MethodContextBuffer mcb = reader->GetNextMethodContext();
if (mcb.Error())
@@ -56,17 +58,18 @@ int verbStrip::DoWork(const char *nameOfInput, const char *nameOfOutput, int ind
}
loadedCount++;
- if((loadedCount%500==0)&&(loadedCount>0))
+ if ((loadedCount % 500 == 0) && (loadedCount > 0))
{
st1->Stop();
- LogVerbose("%2.1f%% - Loaded %d at %d per second", reader->PercentComplete(), loadedCount, (int)((double)500 / st1->GetSeconds()));
+ LogVerbose("%2.1f%% - Loaded %d at %d per second", reader->PercentComplete(), loadedCount,
+ (int)((double)500 / st1->GetSeconds()));
st1->Start();
}
if (!MethodContext::Initialize(loadedCount, mcb.buff, mcb.size, &mc))
return -1;
- if(stripCR)
+ if (stripCR)
{
delete mc->cr;
mc->cr = new CompileResult();
@@ -75,7 +78,7 @@ int verbStrip::DoWork(const char *nameOfInput, const char *nameOfOutput, int ind
savedCount++;
delete mc;
}
- if(CloseHandle(hFileOut)==0)
+ if (CloseHandle(hFileOut) == 0)
{
LogError("2nd CloseHandle failed. GetLastError()=%u", GetLastError());
return -1;
@@ -85,9 +88,9 @@ int verbStrip::DoWork(const char *nameOfInput, const char *nameOfOutput, int ind
return 0;
}
-
// This is only used for "-strip".
-int verbStrip::DoWorkTheOldWay(const char *nameOfInput, const char *nameOfOutput, int indexCount, const int *indexes, bool stripCR)
+int verbStrip::DoWorkTheOldWay(
+ const char* nameOfInput, const char* nameOfOutput, int indexCount, const int* indexes, bool stripCR)
{
LogVerbose("Reading from '%s' removing MC Indexes and writing into '%s'", nameOfInput, nameOfOutput);
@@ -95,11 +98,12 @@ int verbStrip::DoWorkTheOldWay(const char *nameOfInput, const char *nameOfOutput
if (!mci.Initialize(nameOfInput))
return -1;
- int savedCount = 0;
+ int savedCount = 0;
bool write;
- int index = 0; // Can't use MethodContextIterator indexing, since we want the opposite of that.
+ int index = 0; // Can't use MethodContextIterator indexing, since we want the opposite of that.
- HANDLE hFileOut = CreateFileA(nameOfOutput, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
+ HANDLE hFileOut = CreateFileA(nameOfOutput, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
+ FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
if (hFileOut == INVALID_HANDLE_VALUE)
{
LogError("Failed to open input 1 '%s'. GetLastError()=%u", nameOfOutput, GetLastError());
@@ -139,7 +143,8 @@ int verbStrip::DoWorkTheOldWay(const char *nameOfInput, const char *nameOfOutput
}
if (index < indexCount)
- LogWarning("Didn't use all of index count input %d < %d (i.e. didn't see MC #%d)", index, indexCount, indexes[index]);
+ LogWarning("Didn't use all of index count input %d < %d (i.e. didn't see MC #%d)", index, indexCount,
+ indexes[index]);
LogInfo("Loaded %d, Saved %d", mci.MethodContextNumber(), savedCount);
diff --git a/src/ToolBox/superpmi/mcs/verbstrip.h b/src/ToolBox/superpmi/mcs/verbstrip.h
index 9db7773..c7b6255 100644
--- a/src/ToolBox/superpmi/mcs/verbstrip.h
+++ b/src/ToolBox/superpmi/mcs/verbstrip.h
@@ -12,7 +12,13 @@
class verbStrip
{
public:
- static int DoWork(const char *nameOfInput1, const char *nameOfOutput, int indexCount, const int *indexes, bool strip, bool stripCR);
- static int DoWorkTheOldWay(const char *nameOfInput, const char *nameOfOutput, int indexCount, const int *indexes, bool stripCR);
+ static int DoWork(const char* nameOfInput1,
+ const char* nameOfOutput,
+ int indexCount,
+ const int* indexes,
+ bool strip,
+ bool stripCR);
+ static int DoWorkTheOldWay(
+ const char* nameOfInput, const char* nameOfOutput, int indexCount, const int* indexes, bool stripCR);
};
#endif
diff --git a/src/ToolBox/superpmi/mcs/verbtoc.cpp b/src/ToolBox/superpmi/mcs/verbtoc.cpp
index a99fbf0..5fcf4ce 100644
--- a/src/ToolBox/superpmi/mcs/verbtoc.cpp
+++ b/src/ToolBox/superpmi/mcs/verbtoc.cpp
@@ -13,17 +13,15 @@
class TOCElementNode
{
public:
- TOCElementNode *Next;
- TOCElement tocElement;
+ TOCElementNode* Next;
+ TOCElement tocElement;
- TOCElementNode(int number, __int64 offset)
- : Next(nullptr)
- , tocElement(number, offset)
+ TOCElementNode(int number, __int64 offset) : Next(nullptr), tocElement(number, offset)
{
}
};
-int verbTOC::DoWork(const char *nameOfInput)
+int verbTOC::DoWork(const char* nameOfInput)
{
LogVerbose("Indexing from '%s' into '%s.mct'", nameOfInput, nameOfInput);
@@ -33,14 +31,14 @@ int verbTOC::DoWork(const char *nameOfInput)
int savedCount = 0;
- TOCElementNode *head = nullptr;
- TOCElementNode *curElem = nullptr;
+ TOCElementNode* head = nullptr;
+ TOCElementNode* curElem = nullptr;
while (mci.MoveNext())
{
MethodContext* mc = mci.Current();
- TOCElementNode *nxt = new TOCElementNode(mci.MethodContextNumber(), mci.CurrentPos());
+ TOCElementNode* nxt = new TOCElementNode(mci.MethodContextNumber(), mci.CurrentPos());
mc->dumpMethodMD5HashToBuffer(nxt->tocElement.Hash, MD5_HASH_BUFFER_SIZE);
if (curElem != nullptr)
@@ -55,11 +53,12 @@ int verbTOC::DoWork(const char *nameOfInput)
savedCount++;
}
- size_t maxLen = strlen(nameOfInput) + 5;
- char *nameOfOutput = (char*)_alloca(maxLen);
+ size_t maxLen = strlen(nameOfInput) + 5;
+ char* nameOfOutput = (char*)_alloca(maxLen);
strcpy_s(nameOfOutput, maxLen, nameOfInput);
strcat_s(nameOfOutput, maxLen, ".mct");
- HANDLE hFileOut = CreateFileA(nameOfOutput, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+ HANDLE hFileOut =
+ CreateFileA(nameOfOutput, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFileOut == INVALID_HANDLE_VALUE)
{
LogError("Failed to open input 1 '%s'. GetLastError()=%u", nameOfOutput, GetLastError());
@@ -69,7 +68,7 @@ int verbTOC::DoWork(const char *nameOfInput)
DWORD written;
// Write out the signature "INDX" and then the element count
LARGE_INTEGER token;
- token.u.LowPart = *(const int*)"INDX"; // cuz Type Safety is for languages that have good IO facilities
+ token.u.LowPart = *(const int*)"INDX"; // cuz Type Safety is for languages that have good IO facilities
token.u.HighPart = savedCount;
if (!WriteFile(hFileOut, &token, sizeof(token), &written, nullptr) || written != sizeof(token))
{
@@ -83,12 +82,14 @@ int verbTOC::DoWork(const char *nameOfInput)
{
if (!WriteFile(hFileOut, &curElem->tocElement, chunkSize, &written, nullptr) || written != chunkSize)
{
- LogError("Failed to write index element '%d'. GetLastError()=%u", curElem->tocElement.Number, GetLastError());
+ LogError("Failed to write index element '%d'. GetLastError()=%u", curElem->tocElement.Number,
+ GetLastError());
return -1;
}
}
// Now write out a final "INDX" to flag the end of the file...
- if (!WriteFile(hFileOut, &token.u.LowPart, sizeof(token.u.LowPart), &written, nullptr) || (written != sizeof(token.u.LowPart)))
+ if (!WriteFile(hFileOut, &token.u.LowPart, sizeof(token.u.LowPart), &written, nullptr) ||
+ (written != sizeof(token.u.LowPart)))
{
LogError("Failed to write index terminal. GetLastError()=%u", GetLastError());
}
diff --git a/src/ToolBox/superpmi/mcs/verbtoc.h b/src/ToolBox/superpmi/mcs/verbtoc.h
index 7eea371..aa4f481 100644
--- a/src/ToolBox/superpmi/mcs/verbtoc.h
+++ b/src/ToolBox/superpmi/mcs/verbtoc.h
@@ -12,6 +12,6 @@
class verbTOC
{
public:
- static int DoWork(const char *nameOfInput1);
+ static int DoWork(const char* nameOfInput1);
};
#endif
diff --git a/src/ToolBox/superpmi/superpmi-shared/asmdumper.cpp b/src/ToolBox/superpmi/superpmi-shared/asmdumper.cpp
index 240e228..8fc944a 100644
--- a/src/ToolBox/superpmi/superpmi-shared/asmdumper.cpp
+++ b/src/ToolBox/superpmi/superpmi-shared/asmdumper.cpp
@@ -6,38 +6,38 @@
#include "standardpch.h"
#include "asmdumper.h"
-void ASMDumper::DumpToFile(HANDLE hFile, MethodContext *mc, CompileResult *cr)
+void ASMDumper::DumpToFile(HANDLE hFile, MethodContext* mc, CompileResult* cr)
{
CORINFO_METHOD_INFO info;
- unsigned flags = 0;
+ unsigned flags = 0;
mc->repCompileMethod(&info, &flags);
- #define bufflen 4096
+#define bufflen 4096
DWORD bytesWritten;
- char buff[bufflen];
+ char buff[bufflen];
int buff_offset = 0;
ZeroMemory(buff, bufflen * sizeof(char));
- buff_offset+=sprintf_s(&buff[buff_offset], bufflen-buff_offset, ";;Generated from SuperPMI on original input '%s'",
- cr->repProcessName());
- buff_offset+=sprintf_s(&buff[buff_offset], bufflen-buff_offset, "\r\n Method Name \"%s\"",
- mc->repGetMethodName(info.ftn,nullptr));
+ buff_offset += sprintf_s(&buff[buff_offset], bufflen - buff_offset,
+ ";;Generated from SuperPMI on original input '%s'", cr->repProcessName());
+ buff_offset += sprintf_s(&buff[buff_offset], bufflen - buff_offset, "\r\n Method Name \"%s\"",
+ mc->repGetMethodName(info.ftn, nullptr));
WriteFile(hFile, buff, buff_offset * sizeof(char), &bytesWritten, nullptr);
- ULONG hotCodeSize;
- ULONG coldCodeSize;
- ULONG roDataSize;
- ULONG xcptnsCount;
+ ULONG hotCodeSize;
+ ULONG coldCodeSize;
+ ULONG roDataSize;
+ ULONG xcptnsCount;
CorJitAllocMemFlag flag;
- unsigned char *hotCodeBlock;
- unsigned char *coldCodeBlock;
- unsigned char *roDataBlock;
- void *orig_hotCodeBlock;
- void *orig_coldCodeBlock;
- void *orig_roDataBlock;
-
- cr->repAllocMem(&hotCodeSize, &coldCodeSize, &roDataSize, &xcptnsCount, &flag,
- &hotCodeBlock, &coldCodeBlock, &roDataBlock, &orig_hotCodeBlock, &orig_coldCodeBlock, &orig_roDataBlock);
+ unsigned char* hotCodeBlock;
+ unsigned char* coldCodeBlock;
+ unsigned char* roDataBlock;
+ void* orig_hotCodeBlock;
+ void* orig_coldCodeBlock;
+ void* orig_roDataBlock;
+
+ cr->repAllocMem(&hotCodeSize, &coldCodeSize, &roDataSize, &xcptnsCount, &flag, &hotCodeBlock, &coldCodeBlock,
+ &roDataBlock, &orig_hotCodeBlock, &orig_coldCodeBlock, &orig_roDataBlock);
cr->applyRelocs(hotCodeBlock, hotCodeSize, orig_hotCodeBlock);
cr->applyRelocs(coldCodeBlock, coldCodeSize, orig_coldCodeBlock);
cr->applyRelocs(roDataBlock, roDataSize, orig_roDataBlock);
@@ -45,9 +45,9 @@ void ASMDumper::DumpToFile(HANDLE hFile, MethodContext *mc, CompileResult *cr)
#ifdef USE_MSVCDIS
#ifdef _TARGET_AMD64_
- DIS *disasm = DIS::PdisNew(DIS::distX8664);
+ DIS* disasm = DIS::PdisNew(DIS::distX8664);
#elif _TARGET_X86_
- DIS *disasm = DIS::PdisNew(DIS::distX86);
+ DIS* disasm = DIS::PdisNew(DIS::distX86);
#endif
size_t offset = 0;
while (offset < hotCodeSize)
@@ -56,22 +56,24 @@ void ASMDumper::DumpToFile(HANDLE hFile, MethodContext *mc, CompileResult *cr)
ZeroMemory(buff, bufflen * sizeof(char));
DIS::INSTRUCTION instr;
- DIS::OPERAND ops[3];
+ DIS::OPERAND ops[3];
- size_t instrSize = disasm->CbDisassemble(0, (void *)(hotCodeBlock + offset), 15);
- if(instrSize==0)
+ size_t instrSize = disasm->CbDisassemble(0, (void*)(hotCodeBlock + offset), 15);
+ if (instrSize == 0)
{
LogWarning("Zero sized instruction");
break;
}
disasm->FDecode(&instr, ops, 3);
- wchar_t instrMnemonic[64]; // I never know how much to allocate...
+ wchar_t instrMnemonic[64]; // I never know how much to allocate...
disasm->CchFormatInstr(instrMnemonic, 64);
- buff_offset+=sprintf_s(&buff[buff_offset], bufflen-buff_offset, "\r\n%p %S", (void*)((size_t)orig_hotCodeBlock+offset), instrMnemonic);
- buff_offset+=sprintf_s(&buff[buff_offset], bufflen-buff_offset, " ; ");
- for(unsigned int i=0;i<instrSize;i++)
- buff_offset+=sprintf_s(&buff[buff_offset], bufflen-buff_offset, "%02x ", *((BYTE*)(hotCodeBlock + offset + i) ));
+ buff_offset += sprintf_s(&buff[buff_offset], bufflen - buff_offset, "\r\n%p %S",
+ (void*)((size_t)orig_hotCodeBlock + offset), instrMnemonic);
+ buff_offset += sprintf_s(&buff[buff_offset], bufflen - buff_offset, " ; ");
+ for (unsigned int i = 0; i < instrSize; i++)
+ buff_offset +=
+ sprintf_s(&buff[buff_offset], bufflen - buff_offset, "%02x ", *((BYTE*)(hotCodeBlock + offset + i)));
WriteFile(hFile, buff, buff_offset * sizeof(char), &bytesWritten, nullptr);
offset += instrSize;
}
@@ -82,7 +84,7 @@ void ASMDumper::DumpToFile(HANDLE hFile, MethodContext *mc, CompileResult *cr)
buff_offset = 0;
ZeroMemory(buff, bufflen * sizeof(char));
- buff_offset+=sprintf_s(&buff[buff_offset], bufflen-buff_offset, ";; No disassembler available");
+ buff_offset += sprintf_s(&buff[buff_offset], bufflen - buff_offset, ";; No disassembler available");
WriteFile(hFile, buff, buff_offset * sizeof(char), &bytesWritten, nullptr);
#endif // !USE_MSVCDIS
diff --git a/src/ToolBox/superpmi/superpmi-shared/asmdumper.h b/src/ToolBox/superpmi/superpmi-shared/asmdumper.h
index d848d60..683deed 100644
--- a/src/ToolBox/superpmi/superpmi-shared/asmdumper.h
+++ b/src/ToolBox/superpmi/superpmi-shared/asmdumper.h
@@ -12,7 +12,7 @@
class ASMDumper
{
public:
- static void DumpToFile(HANDLE hFile, MethodContext *mc, CompileResult *cr);
+ static void DumpToFile(HANDLE hFile, MethodContext* mc, CompileResult* cr);
};
#endif \ No newline at end of file
diff --git a/src/ToolBox/superpmi/superpmi-shared/callutils.cpp b/src/ToolBox/superpmi/superpmi-shared/callutils.cpp
index 027929b..42b9df5 100644
--- a/src/ToolBox/superpmi/superpmi-shared/callutils.cpp
+++ b/src/ToolBox/superpmi/superpmi-shared/callutils.cpp
@@ -14,10 +14,9 @@
#include "logging.h"
// String representations of the JIT helper functions
-const char *kHelperName[CORINFO_HELP_COUNT] =
-{
+const char* kHelperName[CORINFO_HELP_COUNT] = {
#define JITHELPER(code, pfnHelper, sig) #code,
-#define DYNAMICJITHELPER(code, pfnHelper,sig) #code,
+#define DYNAMICJITHELPER(code, pfnHelper, sig) #code,
#include "jithelpers.h"
};
@@ -53,26 +52,24 @@ const char *kHelperName[CORINFO_HELP_COUNT] =
// if it is able to understand that call (i.e. if it does not return CallType_Unknown). You, the caller,
// are responsible for freeing the memory (with delete[]).
//
-CallType CallUtils::GetRecordedCallSiteInfo(MethodContext *mc,
- CompileResult *cr,
- unsigned int callInstrOffset,
- /*out*/ CORINFO_SIG_INFO *outSigInfo,
- /*out*/ char **outCallTargetSymbol)
+CallType CallUtils::GetRecordedCallSiteInfo(MethodContext* mc,
+ CompileResult* cr,
+ unsigned int callInstrOffset,
+ /*out*/ CORINFO_SIG_INFO* outSigInfo,
+ /*out*/ char** outCallTargetSymbol)
{
AssertCodeMsg(mc != nullptr, EXCEPTIONCODE_CALLUTILS,
- "Null method context passed into GetCallTargetInfo for call at offset %x.",
- callInstrOffset);
+ "Null method context passed into GetCallTargetInfo for call at offset %x.", callInstrOffset);
AssertCodeMsg(cr != nullptr, EXCEPTIONCODE_CALLUTILS,
- "Null compile result passed into GetCallTargetInfo for call at offset %x.",
- callInstrOffset);
+ "Null compile result passed into GetCallTargetInfo for call at offset %x.", callInstrOffset);
CallType targetType = CallType_Unknown;
CORINFO_SIG_INFO callSig;
- bool recordedCallSig = cr->fndRecordCallSiteSigInfo(callInstrOffset, &callSig);
+ bool recordedCallSig = cr->fndRecordCallSiteSigInfo(callInstrOffset, &callSig);
- CORINFO_METHOD_HANDLE methodHandle = nullptr;
- bool recordedMethodHandle = cr->fndRecordCallSiteMethodHandle(callInstrOffset, &methodHandle);
+ CORINFO_METHOD_HANDLE methodHandle = nullptr;
+ bool recordedMethodHandle = cr->fndRecordCallSiteMethodHandle(callInstrOffset, &methodHandle);
if (recordedCallSig)
{
@@ -80,7 +77,7 @@ CallType CallUtils::GetRecordedCallSiteInfo(MethodContext *mc,
*outSigInfo = callSig;
if (outCallTargetSymbol != nullptr)
- *outCallTargetSymbol = (char *)GetMethodFullName(mc, methodHandle, callSig);
+ *outCallTargetSymbol = (char*)GetMethodFullName(mc, methodHandle, callSig);
targetType = CallType_UserFunction;
}
@@ -88,10 +85,9 @@ CallType CallUtils::GetRecordedCallSiteInfo(MethodContext *mc,
{
CorInfoHelpFunc helperNum = CallUtils::GetHelperNum(methodHandle);
AssertCodeMsg(helperNum != CORINFO_HELP_UNDEF, EXCEPTIONCODE_CALLUTILS,
- "Unknown call at offset %x with method handle %016llX.",
- callInstrOffset, methodHandle);
+ "Unknown call at offset %x with method handle %016llX.", callInstrOffset, methodHandle);
- size_t length = strlen(kHelperName[helperNum]) + 1;
+ size_t length = strlen(kHelperName[helperNum]) + 1;
*outCallTargetSymbol = new char[length];
strcpy_s(*outCallTargetSymbol, length, kHelperName[helperNum]);
@@ -134,38 +130,39 @@ CallType CallUtils::GetRecordedCallSiteInfo(MethodContext *mc,
// are responsible for freeing the memory (with delete[]).
//
-CallType CallUtils::GetDirectCallSiteInfo(MethodContext *mc,
- void *callTarget,
- /*out*/ CORINFO_SIG_INFO *outSigInfo,
- /*out*/ char **outCallTargetSymbol)
+CallType CallUtils::GetDirectCallSiteInfo(MethodContext* mc,
+ void* callTarget,
+ /*out*/ CORINFO_SIG_INFO* outSigInfo,
+ /*out*/ char** outCallTargetSymbol)
{
AssertCodeMsg(mc != nullptr, EXCEPTIONCODE_CALLUTILS,
- "Null method context passed into GetCallTargetInfo for call to target %016llX.", callTarget);
+ "Null method context passed into GetCallTargetInfo for call to target %016llX.", callTarget);
- CallType targetType = CallType_Unknown;
- MethodContext::DLD functionEntryPoint;
+ CallType targetType = CallType_Unknown;
+ MethodContext::DLD functionEntryPoint;
CORINFO_METHOD_HANDLE methodHandle;
// Try to first obtain a method handle associated with this call target
functionEntryPoint.A = (DWORDLONG)callTarget;
- functionEntryPoint.B = 0; // TODO-Cleanup: we should be more conscious of this...
+ functionEntryPoint.B = 0; // TODO-Cleanup: we should be more conscious of this...
if (mc->fndGetFunctionEntryPoint(functionEntryPoint, &methodHandle))
{
// Now try to obtain the call info associated with this method handle
- struct Param {
- MethodContext* mc;
- CORINFO_SIG_INFO* outSigInfo;
- char** outCallTargetSymbol;
- CallType* pTargetType;
- CORINFO_METHOD_HANDLE* pMethodHandle;
+ struct Param
+ {
+ MethodContext* mc;
+ CORINFO_SIG_INFO* outSigInfo;
+ char** outCallTargetSymbol;
+ CallType* pTargetType;
+ CORINFO_METHOD_HANDLE* pMethodHandle;
} param;
- param.mc = mc;
- param.outSigInfo = outSigInfo;
+ param.mc = mc;
+ param.outSigInfo = outSigInfo;
param.outCallTargetSymbol = outCallTargetSymbol;
- param.pTargetType = &targetType;
- param.pMethodHandle = &methodHandle;
+ param.pTargetType = &targetType;
+ param.pMethodHandle = &methodHandle;
PAL_TRY(Param*, pParam, &param)
{
@@ -177,14 +174,15 @@ CallType CallUtils::GetDirectCallSiteInfo(MethodContext *mc,
*pParam->outSigInfo = callInfo.sig;
if (pParam->outCallTargetSymbol != nullptr)
- *pParam->outCallTargetSymbol = (char *)GetMethodFullName(pParam->mc, *pParam->pMethodHandle, callInfo.sig);
+ *pParam->outCallTargetSymbol =
+ (char*)GetMethodFullName(pParam->mc, *pParam->pMethodHandle, callInfo.sig);
*pParam->pTargetType = CallType_UserFunction;
}
PAL_EXCEPT_FILTER(FilterSuperPMIExceptions_CatchMC)
{
- LogWarning("Didn't find call info for method handle %016llX (call target: %016llX)",
- methodHandle, callTarget);
+ LogWarning("Didn't find call info for method handle %016llX (call target: %016llX)", methodHandle,
+ callTarget);
}
PAL_ENDTRY
}
@@ -197,7 +195,7 @@ CallType CallUtils::GetDirectCallSiteInfo(MethodContext *mc,
{
if (outCallTargetSymbol != nullptr)
{
- size_t length = strlen(kHelperName[helperNum]) + 1;
+ size_t length = strlen(kHelperName[helperNum]) + 1;
*outCallTargetSymbol = new char[length];
strcpy_s(*outCallTargetSymbol, length, kHelperName[helperNum]);
}
@@ -206,8 +204,7 @@ CallType CallUtils::GetDirectCallSiteInfo(MethodContext *mc,
}
else
{
- LogWarning("Call to target %016llX has no method handle and is not a helper call.",
- callTarget);
+ LogWarning("Call to target %016llX has no method handle and is not a helper call.", callTarget);
}
}
@@ -220,10 +217,9 @@ CallType CallUtils::GetDirectCallSiteInfo(MethodContext *mc,
//-------------------------------------------------------------------------------------------------
// Stolen from Compiler::impMethodInfo_hasRetBuffArg (in the importer)
-bool CallUtils::HasRetBuffArg(MethodContext *mc, CORINFO_SIG_INFO args)
+bool CallUtils::HasRetBuffArg(MethodContext* mc, CORINFO_SIG_INFO args)
{
- if (args.retType != CORINFO_TYPE_VALUECLASS &&
- args.retType != CORINFO_TYPE_REFANY)
+ if (args.retType != CORINFO_TYPE_VALUECLASS && args.retType != CORINFO_TYPE_REFANY)
{
return false;
}
@@ -233,16 +229,14 @@ bool CallUtils::HasRetBuffArg(MethodContext *mc, CORINFO_SIG_INFO args)
// i) TYP_STRUCT argument that can fit into a single register and
// ii) Power of two sized TYP_STRUCT on AMD64.
unsigned size = mc->repGetClassSize(args.retTypeClass);
- return (size > sizeof(void*)) || ((size & (size-1)) != 0);
+ return (size > sizeof(void*)) || ((size & (size - 1)) != 0);
#else
return true;
#endif
}
// Originally from src/jit/ee_il_dll.cpp
-const char *CallUtils::GetMethodName(MethodContext *mc,
- CORINFO_METHOD_HANDLE method,
- const char **classNamePtr)
+const char* CallUtils::GetMethodName(MethodContext* mc, CORINFO_METHOD_HANDLE method, const char** classNamePtr)
{
if (GetHelperNum(method))
{
@@ -257,16 +251,14 @@ const char *CallUtils::GetMethodName(MethodContext *mc,
{
if (classNamePtr != nullptr)
*classNamePtr = "NATIVE";
- method = GetMethodHandleForNative(method);
+ method = GetMethodHandleForNative(method);
}
- return(mc->repGetMethodName(method, classNamePtr));
+ return (mc->repGetMethodName(method, classNamePtr));
}
// Originally from src/jit/eeinterface.cpp
-const char *CallUtils::GetMethodFullName(MethodContext *mc,
- CORINFO_METHOD_HANDLE hnd,
- CORINFO_SIG_INFO sig)
+const char* CallUtils::GetMethodFullName(MethodContext* mc, CORINFO_METHOD_HANDLE hnd, CORINFO_SIG_INFO sig)
{
const char* returnType = NULL;
@@ -277,7 +269,7 @@ const char *CallUtils::GetMethodFullName(MethodContext *mc,
return methodName;
}
- size_t length = 0;
+ size_t length = 0;
unsigned i;
/* Generating the full signature is a two-pass process. First we have to walk
@@ -290,7 +282,7 @@ const char *CallUtils::GetMethodFullName(MethodContext *mc,
/* initialize length with length of className and '.' */
if (className != nullptr)
- length = strlen(className)+1;
+ length = strlen(className) + 1;
else
{
// Tweaked to avoid using CRT assertions
@@ -307,8 +299,8 @@ const char *CallUtils::GetMethodFullName(MethodContext *mc,
{
// Tweaked to use EE types instead of JIT-specific types
CORINFO_CLASS_HANDLE typeHandle;
- DWORD exception;
- CorInfoType type = strip(mc->repGetArgType(&sig, argList, &typeHandle, &exception));
+ DWORD exception;
+ CorInfoType type = strip(mc->repGetArgType(&sig, argList, &typeHandle, &exception));
length += strlen(TypeUtils::GetCorInfoTypeName(type));
argList = mc->repGetArgNext(argList);
@@ -326,7 +318,8 @@ const char *CallUtils::GetMethodFullName(MethodContext *mc,
length += strlen(returnType) + 1; // don't forget the delimiter ':'
}
- // Does it have a 'this' pointer? Don't count explicit this, which has the this pointer type as the first element of the arg type list
+ // Does it have a 'this' pointer? Don't count explicit this, which has the this pointer type as the first element of
+ // the arg type list
if (sig.hasThis() && !sig.hasExplicitThis())
{
// Tweaked to avoid using CRT assertions
@@ -338,7 +331,7 @@ const char *CallUtils::GetMethodFullName(MethodContext *mc,
length += 2;
- char *retName = new char[length]; // Tweaked to use "new" instead of compGetMem
+ char* retName = new char[length]; // Tweaked to use "new" instead of compGetMem
/* Now generate the full signature string in the allocated buffer */
@@ -363,8 +356,8 @@ const char *CallUtils::GetMethodFullName(MethodContext *mc,
{
// Tweaked to use EE types instead of JIT-specific types
CORINFO_CLASS_HANDLE typeHandle;
- DWORD exception;
- CorInfoType type = strip(mc->repGetArgType(&sig, argList, &typeHandle, &exception));
+ DWORD exception;
+ CorInfoType type = strip(mc->repGetArgType(&sig, argList, &typeHandle, &exception));
strcat_s(retName, length, TypeUtils::GetCorInfoTypeName(type));
argList = mc->repGetArgNext(argList);
@@ -380,25 +373,26 @@ const char *CallUtils::GetMethodFullName(MethodContext *mc,
strcat_s(retName, length, returnType);
}
- // Does it have a 'this' pointer? Don't count explicit this, which has the this pointer type as the first element of the arg type list
+ // Does it have a 'this' pointer? Don't count explicit this, which has the this pointer type as the first element of
+ // the arg type list
if (sig.hasThis() && !sig.hasExplicitThis())
{
strcat_s(retName, length, ":this");
}
// Tweaked to avoid using CRT assertions
- Assert(strlen(retName) == (length-1));
+ Assert(strlen(retName) == (length - 1));
- return(retName);
+ return (retName);
}
// Originally from jit/compiler.hpp
inline CorInfoHelpFunc CallUtils::GetHelperNum(CORINFO_METHOD_HANDLE method)
{
// Helpers are marked by the fact that they are odd numbers
- if (!(((size_t) method) & 1))
- return(CORINFO_HELP_UNDEF);
- return((CorInfoHelpFunc) (((size_t) method) >> 2));
+ if (!(((size_t)method) & 1))
+ return (CORINFO_HELP_UNDEF);
+ return ((CorInfoHelpFunc)(((size_t)method) >> 2));
}
// Originally from jit/compiler.hpp
@@ -411,6 +405,6 @@ inline bool CallUtils::IsNativeMethod(CORINFO_METHOD_HANDLE method)
inline CORINFO_METHOD_HANDLE CallUtils::GetMethodHandleForNative(CORINFO_METHOD_HANDLE method)
{
// Tweaked to avoid using CRT assertions
- Assert((((size_t) method) & 0x3) == 0x2);
- return (CORINFO_METHOD_HANDLE)(((size_t)method)& ~0x3);
+ Assert((((size_t)method) & 0x3) == 0x2);
+ return (CORINFO_METHOD_HANDLE)(((size_t)method) & ~0x3);
}
diff --git a/src/ToolBox/superpmi/superpmi-shared/callutils.h b/src/ToolBox/superpmi/superpmi-shared/callutils.h
index f428d77..f0978d0 100644
--- a/src/ToolBox/superpmi/superpmi-shared/callutils.h
+++ b/src/ToolBox/superpmi/superpmi-shared/callutils.h
@@ -20,25 +20,21 @@ enum CallType
class CallUtils
{
public:
- static CallType GetRecordedCallSiteInfo(MethodContext *mc,
- CompileResult *cr,
- unsigned int callInstrOffset,
- /*out*/ CORINFO_SIG_INFO *outSigInfo,
- /*out*/ char **outCallTargetSymbol);
- static CallType GetDirectCallSiteInfo(MethodContext *mc,
- void *callTarget,
- /*out*/ CORINFO_SIG_INFO *outSigInfo,
- /*out*/ char **outCallTargetSymbol);
- static bool HasRetBuffArg(MethodContext *mc, CORINFO_SIG_INFO args);
+ static CallType GetRecordedCallSiteInfo(MethodContext* mc,
+ CompileResult* cr,
+ unsigned int callInstrOffset,
+ /*out*/ CORINFO_SIG_INFO* outSigInfo,
+ /*out*/ char** outCallTargetSymbol);
+ static CallType GetDirectCallSiteInfo(MethodContext* mc,
+ void* callTarget,
+ /*out*/ CORINFO_SIG_INFO* outSigInfo,
+ /*out*/ char** outCallTargetSymbol);
+ static bool HasRetBuffArg(MethodContext* mc, CORINFO_SIG_INFO args);
static CorInfoHelpFunc GetHelperNum(CORINFO_METHOD_HANDLE method);
static bool IsNativeMethod(CORINFO_METHOD_HANDLE method);
static CORINFO_METHOD_HANDLE GetMethodHandleForNative(CORINFO_METHOD_HANDLE method);
- static const char *GetMethodName(MethodContext *mc,
- CORINFO_METHOD_HANDLE method,
- const char **classNamePtr);
- static const char *GetMethodFullName(MethodContext *mc,
- CORINFO_METHOD_HANDLE hnd,
- CORINFO_SIG_INFO sig);
+ static const char* GetMethodName(MethodContext* mc, CORINFO_METHOD_HANDLE method, const char** classNamePtr);
+ static const char* GetMethodFullName(MethodContext* mc, CORINFO_METHOD_HANDLE hnd, CORINFO_SIG_INFO sig);
};
#endif \ No newline at end of file
diff --git a/src/ToolBox/superpmi/superpmi-shared/compileresult.cpp b/src/ToolBox/superpmi/superpmi-shared/compileresult.cpp
index b15c51f..918d87a 100644
--- a/src/ToolBox/superpmi/superpmi-shared/compileresult.cpp
+++ b/src/ToolBox/superpmi/superpmi-shared/compileresult.cpp
@@ -13,36 +13,39 @@
CompileResult::CompileResult()
{
- #define LWM(map,key,value) map = nullptr;
- #include "crlwmlist.h"
+#define LWM(map, key, value) map = nullptr;
+#include "crlwmlist.h"
- //Not persisted to disk. though should it be?
+ // Not persisted to disk. though should it be?
CallTargetTypes = new LightWeightMap<DWORDLONG, DWORD>();
- allocMemDets.hotCodeSize = 0;
- allocMemDets.coldCodeSize = 0;
- allocMemDets.roDataSize = 0;
- allocMemDets.xcptnsCount = 0;
- allocMemDets.flag = (CorJitAllocMemFlag)0;
- allocMemDets.hotCodeBlock = 0;
+ allocMemDets.hotCodeSize = 0;
+ allocMemDets.coldCodeSize = 0;
+ allocMemDets.roDataSize = 0;
+ allocMemDets.xcptnsCount = 0;
+ allocMemDets.flag = (CorJitAllocMemFlag)0;
+ allocMemDets.hotCodeBlock = 0;
allocMemDets.coldCodeBlock = 0;
- allocMemDets.roDataBlock = 0;
+ allocMemDets.roDataBlock = 0;
allocGCInfoDets.retval = 0;
- allocGCInfoDets.size = 0;
+ allocGCInfoDets.size = 0;
codeHeap = nullptr;
}
CompileResult::~CompileResult()
{
- #define LWM(map,key,value) if (map != nullptr) delete map;
- #include "crlwmlist.h"
+#define LWM(map, key, value) \
+ if (map != nullptr) \
+ delete map;
+#include "crlwmlist.h"
- if (CallTargetTypes != nullptr) delete CallTargetTypes;
+ if (CallTargetTypes != nullptr)
+ delete CallTargetTypes;
#ifndef FEATURE_PAL // PAL doesn't have HeapDestroy()
- if(codeHeap != nullptr)
+ if (codeHeap != nullptr)
::HeapDestroy(codeHeap);
#endif // !FEATURE_PAL
}
@@ -53,17 +56,19 @@ bool CompileResult::IsEmpty()
{
bool isEmpty = true;
- #define LWM(map,key,value) if (map != nullptr) isEmpty = false;
- #include "crlwmlist.h"
+#define LWM(map, key, value) \
+ if (map != nullptr) \
+ isEmpty = false;
+#include "crlwmlist.h"
return isEmpty;
}
HANDLE CompileResult::getCodeHeap()
{
- if(codeHeap == nullptr)
- codeHeap = ::HeapCreate(0,0,0);
- if(codeHeap == nullptr)
+ if (codeHeap == nullptr)
+ codeHeap = ::HeapCreate(0, 0, 0);
+ if (codeHeap == nullptr)
{
LogError("CompileResult::codeHeap() failed to acquire a heap.");
__debugbreak();
@@ -71,41 +76,41 @@ HANDLE CompileResult::getCodeHeap()
return codeHeap;
}
-void CompileResult::recAssert(const char *assertText)
+void CompileResult::recAssert(const char* assertText)
{
- if(AssertLog == nullptr)
+ if (AssertLog == nullptr)
AssertLog = new DenseLightWeightMap<DWORD>();
- AssertLog->Append(AssertLog->AddBuffer((const unsigned char*)assertText, (DWORD)strlen(assertText)+1));
+ AssertLog->Append(AssertLog->AddBuffer((const unsigned char*)assertText, (DWORD)strlen(assertText) + 1));
}
void CompileResult::dmpAssertLog(DWORD key, DWORD value)
{
- const char *assert = (const char *)AssertLog->GetBuffer(value);
+ const char* assert = (const char*)AssertLog->GetBuffer(value);
printf("AssertLog key %u, value '%s'", key, assert);
AssertLog->Unlock();
}
-const char *CompileResult::repAssert()
+const char* CompileResult::repAssert()
{
- if((AssertLog==nullptr)||(AssertLog->GetCount()==0))
+ if ((AssertLog == nullptr) || (AssertLog->GetCount() == 0))
return nullptr;
- return (const char *)AssertLog->GetBuffer(AssertLog->Get((DWORD)0));
+ return (const char*)AssertLog->GetBuffer(AssertLog->Get((DWORD)0));
}
-void CompileResult::AddCall(const char *name)
+void CompileResult::AddCall(const char* name)
{
- if(CallLog == nullptr)
+ if (CallLog == nullptr)
CallLog = new DenseLightWeightMap<DWORD>();
- //if(name[0] != '+')
- //CallLog->Append(CallLog->AddBuffer((const unsigned char *)name, (DWORD)strlen(name)+1));
+ // if(name[0] != '+')
+ //CallLog->Append(CallLog->AddBuffer((const unsigned char *)name, (DWORD)strlen(name)+1));
}
unsigned int CompileResult::CallLog_GetCount()
{
return CallLog->GetCount();
}
-bool CompileResult::CallLog_Contains(const char *str)
+bool CompileResult::CallLog_Contains(const char* str)
{
- return (CallLog->Contains((unsigned char *)str, (unsigned int)strlen(str))>0);
+ return (CallLog->Contains((unsigned char*)str, (unsigned int)strlen(str)) > 0);
}
void CompileResult::dmpCallLog(DWORD key, DWORD value)
{
@@ -118,132 +123,132 @@ void CompileResult::dumpToConsole()
{
printf("***************************************** CompileResult\n");
- #define LWM(map,key,value) dumpLWM(this,map)
- #define DENSELWM(map,value) dumpLWMDense(this,map)
- #include "crlwmlist.h"
+#define LWM(map, key, value) dumpLWM(this, map)
+#define DENSELWM(map, value) dumpLWMDense(this, map)
+#include "crlwmlist.h"
printf("-----------------------------------------\n");
}
-//Note - EE allocates these blocks (and the exception blocks) in a single linear region.
-//Note - EE assures that RoBlock is 8 byte aligned
-void CompileResult::recAllocMem(ULONG hotCodeSize, ULONG coldCodeSize, ULONG roDataSize, ULONG xcptnsCount, CorJitAllocMemFlag flag,
- void **hotCodeBlock, void **coldCodeBlock, void **roDataBlock)
-{
- //Grab the values, so we can scrape the real answers in the capture method
- allocMemDets.hotCodeSize = hotCodeSize;
- allocMemDets.coldCodeSize = coldCodeSize;
- allocMemDets.roDataSize = roDataSize;
- allocMemDets.xcptnsCount = xcptnsCount;
- allocMemDets.flag = flag;
- allocMemDets.hotCodeBlock = *hotCodeBlock;
+// Note - EE allocates these blocks (and the exception blocks) in a single linear region.
+ //Note - EE assures that RoBlock is 8 byte aligned
+void CompileResult::recAllocMem(ULONG hotCodeSize,
+ ULONG coldCodeSize,
+ ULONG roDataSize,
+ ULONG xcptnsCount,
+ CorJitAllocMemFlag flag,
+ void** hotCodeBlock,
+ void** coldCodeBlock,
+ void** roDataBlock)
+{
+ // Grab the values, so we can scrape the real answers in the capture method
+ allocMemDets.hotCodeSize = hotCodeSize;
+ allocMemDets.coldCodeSize = coldCodeSize;
+ allocMemDets.roDataSize = roDataSize;
+ allocMemDets.xcptnsCount = xcptnsCount;
+ allocMemDets.flag = flag;
+ allocMemDets.hotCodeBlock = *hotCodeBlock;
allocMemDets.coldCodeBlock = *coldCodeBlock;
- allocMemDets.roDataBlock = *roDataBlock;
+ allocMemDets.roDataBlock = *roDataBlock;
}
void CompileResult::recAllocMemCapture()
{
- if(AllocMem == nullptr)
+ if (AllocMem == nullptr)
AllocMem = new LightWeightMap<DWORD, Agnostic_AllocMemDetails>();
Agnostic_AllocMemDetails value;
- value.hotCodeSize = (DWORD)allocMemDets.hotCodeSize;
+ value.hotCodeSize = (DWORD)allocMemDets.hotCodeSize;
value.coldCodeSize = (DWORD)allocMemDets.coldCodeSize;
- value.roDataSize = (DWORD)allocMemDets.roDataSize;
- value.xcptnsCount = (DWORD)allocMemDets.xcptnsCount;
- value.flag = (DWORD)allocMemDets.flag;
- value.hotCodeBlock_offset = (DWORD)AllocMem->AddBuffer((const unsigned char*)allocMemDets.hotCodeBlock, allocMemDets.hotCodeSize);
- value.coldCodeBlock_offset = (DWORD)AllocMem->AddBuffer((const unsigned char*)allocMemDets.coldCodeBlock, allocMemDets.coldCodeSize);
- value.roDataBlock_offset = (DWORD)AllocMem->AddBuffer((const unsigned char*)allocMemDets.roDataBlock, allocMemDets.roDataSize);
- value.hotCodeBlock = (DWORDLONG)allocMemDets.hotCodeBlock;
+ value.roDataSize = (DWORD)allocMemDets.roDataSize;
+ value.xcptnsCount = (DWORD)allocMemDets.xcptnsCount;
+ value.flag = (DWORD)allocMemDets.flag;
+ value.hotCodeBlock_offset =
+ (DWORD)AllocMem->AddBuffer((const unsigned char*)allocMemDets.hotCodeBlock, allocMemDets.hotCodeSize);
+ value.coldCodeBlock_offset =
+ (DWORD)AllocMem->AddBuffer((const unsigned char*)allocMemDets.coldCodeBlock, allocMemDets.coldCodeSize);
+ value.roDataBlock_offset =
+ (DWORD)AllocMem->AddBuffer((const unsigned char*)allocMemDets.roDataBlock, allocMemDets.roDataSize);
+ value.hotCodeBlock = (DWORDLONG)allocMemDets.hotCodeBlock;
value.coldCodeBlock = (DWORDLONG)allocMemDets.coldCodeBlock;
- value.roDataBlock = (DWORDLONG)allocMemDets.roDataBlock;
+ value.roDataBlock = (DWORDLONG)allocMemDets.roDataBlock;
AllocMem->Add(0, value);
}
void CompileResult::dmpAllocMem(DWORD key, const Agnostic_AllocMemDetails& value)
{
- printf("AllocMem key 0, value hotCodeSize-%u coldCodeSize-%u roDataSize-%u xcptnsCount-%u flag-%08X hotCodeBlock_offset-%u coldCodeBlock_offset-%u roDataBlock_offset-%u hotCodeBlock-%016llX coldCodeBlock-%016llX roDataBlock-%016llX",
- value.hotCodeSize,
- value.coldCodeSize,
- value.roDataSize,
- value.xcptnsCount,
- value.flag,
- value.hotCodeBlock_offset,
- value.coldCodeBlock_offset,
- value.roDataBlock_offset,
- value.hotCodeBlock,
- value.coldCodeBlock,
- value.roDataBlock);
+ printf("AllocMem key 0, value hotCodeSize-%u coldCodeSize-%u roDataSize-%u xcptnsCount-%u flag-%08X "
+ "hotCodeBlock_offset-%u coldCodeBlock_offset-%u roDataBlock_offset-%u hotCodeBlock-%016llX "
+ "coldCodeBlock-%016llX roDataBlock-%016llX",
+ value.hotCodeSize, value.coldCodeSize, value.roDataSize, value.xcptnsCount, value.flag,
+ value.hotCodeBlock_offset, value.coldCodeBlock_offset, value.roDataBlock_offset, value.hotCodeBlock,
+ value.coldCodeBlock, value.roDataBlock);
}
// We can't allocate memory in the same place is was during recording, so we pass back code/data block pointers
// that point into the AllocMem LightWeightMap, but also return what the original addresses were during recording.
-void CompileResult::repAllocMem(
- ULONG *hotCodeSize,
- ULONG *coldCodeSize,
- ULONG *roDataSize,
- ULONG *xcptnsCount,
- CorJitAllocMemFlag *flag,
- unsigned char **hotCodeBlock,
- unsigned char **coldCodeBlock,
- unsigned char **roDataBlock,
- void **orig_hotCodeBlock,
- void **orig_coldCodeBlock,
- void **orig_roDataBlock)
+void CompileResult::repAllocMem(ULONG* hotCodeSize,
+ ULONG* coldCodeSize,
+ ULONG* roDataSize,
+ ULONG* xcptnsCount,
+ CorJitAllocMemFlag* flag,
+ unsigned char** hotCodeBlock,
+ unsigned char** coldCodeBlock,
+ unsigned char** roDataBlock,
+ void** orig_hotCodeBlock,
+ void** orig_coldCodeBlock,
+ void** orig_roDataBlock)
{
Agnostic_AllocMemDetails value;
value = AllocMem->Get(0);
- *hotCodeSize = (ULONG)value.hotCodeSize;
+ *hotCodeSize = (ULONG)value.hotCodeSize;
*coldCodeSize = (ULONG)value.coldCodeSize;
- *roDataSize = (ULONG)value.roDataSize;
- *xcptnsCount = (ULONG)value.xcptnsCount;
- *flag = (CorJitAllocMemFlag)value.flag;
+ *roDataSize = (ULONG)value.roDataSize;
+ *xcptnsCount = (ULONG)value.xcptnsCount;
+ *flag = (CorJitAllocMemFlag)value.flag;
- if(*hotCodeSize>0)
+ if (*hotCodeSize > 0)
*hotCodeBlock = AllocMem->GetBuffer(value.hotCodeBlock_offset);
else
*hotCodeBlock = nullptr;
- if(*coldCodeSize>0)
+ if (*coldCodeSize > 0)
*coldCodeBlock = AllocMem->GetBuffer(value.coldCodeBlock_offset);
else
*coldCodeBlock = nullptr;
- if(*roDataSize>0)
+ if (*roDataSize > 0)
*roDataBlock = AllocMem->GetBuffer(value.roDataBlock_offset);
else
*roDataBlock = nullptr;
- *orig_hotCodeBlock = (void *)value.hotCodeBlock;
- *orig_coldCodeBlock = (void *)value.coldCodeBlock;
- *orig_roDataBlock = (void *)value.roDataBlock;
+ *orig_hotCodeBlock = (void*)value.hotCodeBlock;
+ *orig_coldCodeBlock = (void*)value.coldCodeBlock;
+ *orig_roDataBlock = (void*)value.roDataBlock;
}
-//Note - Ownership of pMap is transfered with this call. In replay icorjitinfo we should free it.
-void CompileResult::recSetBoundaries(CORINFO_METHOD_HANDLE ftn, ULONG32 cMap, ICorDebugInfo::OffsetMapping *pMap)
+// Note - Ownership of pMap is transfered with this call. In replay icorjitinfo we should free it.
+void CompileResult::recSetBoundaries(CORINFO_METHOD_HANDLE ftn, ULONG32 cMap, ICorDebugInfo::OffsetMapping* pMap)
{
- if(SetBoundaries == nullptr)
+ if (SetBoundaries == nullptr)
SetBoundaries = new LightWeightMap<DWORD, Agnostic_SetBoundaries>();
Agnostic_SetBoundaries value;
- value.ftn = (DWORDLONG)ftn;
+ value.ftn = (DWORDLONG)ftn;
value.cMap = (DWORD)cMap;
- value.pMap_offset = (DWORD)SetBoundaries->AddBuffer((const unsigned char*)pMap, sizeof(ICorDebugInfo::OffsetMapping)*cMap);
+ value.pMap_offset =
+ (DWORD)SetBoundaries->AddBuffer((const unsigned char*)pMap, sizeof(ICorDebugInfo::OffsetMapping) * cMap);
SetBoundaries->Add(0, value);
}
void CompileResult::dmpSetBoundaries(DWORD key, const Agnostic_SetBoundaries& value)
{
- ICorDebugInfo::OffsetMapping *om = (ICorDebugInfo::OffsetMapping *)SetBoundaries->GetBuffer(value.pMap_offset);
- printf("SetBoundaries key 0, value ftn-%016llX cMap-%u %u{",
- value.ftn,
- value.cMap,
- value.pMap_offset);
- for(unsigned int i=0;i<value.cMap;i++)
+ ICorDebugInfo::OffsetMapping* om = (ICorDebugInfo::OffsetMapping*)SetBoundaries->GetBuffer(value.pMap_offset);
+ printf("SetBoundaries key 0, value ftn-%016llX cMap-%u %u{", value.ftn, value.cMap, value.pMap_offset);
+ for (unsigned int i = 0; i < value.cMap; i++)
{
if (i != 0)
printf(", ");
@@ -252,11 +257,11 @@ void CompileResult::dmpSetBoundaries(DWORD key, const Agnostic_SetBoundaries& va
printf("}");
SetBoundaries->Unlock();
}
-bool CompileResult::repSetBoundaries(CORINFO_METHOD_HANDLE *ftn, ULONG32 *cMap, ICorDebugInfo::OffsetMapping **pMap)
+bool CompileResult::repSetBoundaries(CORINFO_METHOD_HANDLE* ftn, ULONG32* cMap, ICorDebugInfo::OffsetMapping** pMap)
{
- if((SetBoundaries == nullptr)||(SetBoundaries->GetCount()==0))
+ if ((SetBoundaries == nullptr) || (SetBoundaries->GetCount() == 0))
{
- *ftn = (CORINFO_METHOD_HANDLE)-1;
+ *ftn = (CORINFO_METHOD_HANDLE)-1;
*cMap = -1;
*pMap = nullptr;
return false;
@@ -265,34 +270,32 @@ bool CompileResult::repSetBoundaries(CORINFO_METHOD_HANDLE *ftn, ULONG32 *cMap,
value = SetBoundaries->Get(0);
- *ftn = (CORINFO_METHOD_HANDLE)value.ftn;
+ *ftn = (CORINFO_METHOD_HANDLE)value.ftn;
*cMap = (ULONG32)value.cMap;
- *pMap = (ICorDebugInfo::OffsetMapping *)SetBoundaries->GetBuffer(value.pMap_offset);
+ *pMap = (ICorDebugInfo::OffsetMapping*)SetBoundaries->GetBuffer(value.pMap_offset);
return true;
}
-//Note - Ownership of vars is transfered with this call. In replay icorjitinfo we should free it.
-void CompileResult::recSetVars(CORINFO_METHOD_HANDLE ftn, ULONG32 cVars, ICorDebugInfo::NativeVarInfo *vars)
+// Note - Ownership of vars is transfered with this call. In replay icorjitinfo we should free it.
+void CompileResult::recSetVars(CORINFO_METHOD_HANDLE ftn, ULONG32 cVars, ICorDebugInfo::NativeVarInfo* vars)
{
- if(SetVars == nullptr)
+ if (SetVars == nullptr)
SetVars = new LightWeightMap<DWORD, Agnostic_SetVars>();
Agnostic_SetVars value;
- value.ftn = (DWORDLONG)ftn;
- value.cVars = (DWORD)cVars;
- value.vars_offset = (DWORD)SetVars->AddBuffer((const unsigned char*)vars, sizeof(ICorDebugInfo::NativeVarInfo)*cVars); //not deep enough.. vlt memory is pointer sized.
+ value.ftn = (DWORDLONG)ftn;
+ value.cVars = (DWORD)cVars;
+ value.vars_offset = (DWORD)SetVars->AddBuffer((const unsigned char*)vars,
+ sizeof(ICorDebugInfo::NativeVarInfo) *
+ cVars); // not deep enough.. vlt memory is pointer sized.
SetVars->Add(0, value);
}
void CompileResult::dmpSetVars(DWORD key, const Agnostic_SetVars& value)
{
- ICorDebugInfo::NativeVarInfo *om = (ICorDebugInfo::NativeVarInfo *)SetVars->GetBuffer(value.vars_offset);
- printf("SetVars key %u, value ftn-%016llX cVars-%u %u{",
- key,
- value.ftn,
- value.cVars,
- value.vars_offset);
+ ICorDebugInfo::NativeVarInfo* om = (ICorDebugInfo::NativeVarInfo*)SetVars->GetBuffer(value.vars_offset);
+ printf("SetVars key %u, value ftn-%016llX cVars-%u %u{", key, value.ftn, value.cVars, value.vars_offset);
for (unsigned int i = 0; i < value.cVars; i++)
{
if (i != 0)
@@ -302,13 +305,13 @@ void CompileResult::dmpSetVars(DWORD key, const Agnostic_SetVars& value)
printf("}");
SetVars->Unlock();
}
-bool CompileResult::repSetVars(CORINFO_METHOD_HANDLE *ftn, ULONG32 *cVars, ICorDebugInfo::NativeVarInfo **vars)
+bool CompileResult::repSetVars(CORINFO_METHOD_HANDLE* ftn, ULONG32* cVars, ICorDebugInfo::NativeVarInfo** vars)
{
- if((SetVars == nullptr)||(SetVars->GetCount()==0))
+ if ((SetVars == nullptr) || (SetVars->GetCount() == 0))
{
- *ftn = (CORINFO_METHOD_HANDLE)-1;
+ *ftn = (CORINFO_METHOD_HANDLE)-1;
*cVars = -1;
- *vars = nullptr;
+ *vars = nullptr;
return false;
}
@@ -316,96 +319,97 @@ bool CompileResult::repSetVars(CORINFO_METHOD_HANDLE *ftn, ULONG32 *cVars, ICorD
value = SetVars->Get(0);
- *ftn = (CORINFO_METHOD_HANDLE)value.ftn;
+ *ftn = (CORINFO_METHOD_HANDLE)value.ftn;
*cVars = (ULONG32)value.cVars;
- *vars = (ICorDebugInfo::NativeVarInfo*)SetVars->GetBuffer(value.vars_offset);
+ *vars = (ICorDebugInfo::NativeVarInfo*)SetVars->GetBuffer(value.vars_offset);
return true;
}
void CompileResult::recAllocGCInfo(size_t size, void* retval)
{
- allocGCInfoDets.size = size;
+ allocGCInfoDets.size = size;
allocGCInfoDets.retval = retval;
}
void CompileResult::recAllocGCInfoCapture()
{
- if(AllocGCInfo == nullptr)
+ if (AllocGCInfo == nullptr)
AllocGCInfo = new LightWeightMap<DWORD, Agnostic_AllocGCInfo>();
Agnostic_AllocGCInfo value;
value.size = allocGCInfoDets.size;
- value.retval_offset = (DWORD)AllocGCInfo->AddBuffer((const unsigned char *)allocGCInfoDets.retval, (DWORD)allocGCInfoDets.size);
+ value.retval_offset =
+ (DWORD)AllocGCInfo->AddBuffer((const unsigned char*)allocGCInfoDets.retval, (DWORD)allocGCInfoDets.size);
AllocGCInfo->Add(0, value);
}
void CompileResult::dmpAllocGCInfo(DWORD key, const Agnostic_AllocGCInfo& value)
{
- const unsigned char *buff = AllocGCInfo->GetBuffer(value.retval_offset);
+ const unsigned char* buff = AllocGCInfo->GetBuffer(value.retval_offset);
printf("AllocGCInfo key 0, ");
printf("sz-%llu %p{ ", value.size, buff);
- for(unsigned int i=0; i<value.size; i++)
- printf("%02X ", *(buff+i));
+ for (unsigned int i = 0; i < value.size; i++)
+ printf("%02X ", *(buff + i));
printf("}");
AllocGCInfo->Unlock();
}
-void CompileResult::repAllocGCInfo(size_t *size, void **retval)
+void CompileResult::repAllocGCInfo(size_t* size, void** retval)
{
Agnostic_AllocGCInfo value;
value = AllocGCInfo->Get(0);
*size = (size_t)value.size;
- if(*size>0)
- *retval = (void *)AllocGCInfo->GetBuffer(value.retval_offset);
+ if (*size > 0)
+ *retval = (void*)AllocGCInfo->GetBuffer(value.retval_offset);
}
-void CompileResult::recCompileMethod(BYTE **nativeEntry, ULONG *nativeSizeOfCode, CorJitResult result)
+void CompileResult::recCompileMethod(BYTE** nativeEntry, ULONG* nativeSizeOfCode, CorJitResult result)
{
- if(CompileMethod == nullptr)
+ if (CompileMethod == nullptr)
CompileMethod = new LightWeightMap<DWORD, Agnostic_CompileMethodResults>();
Agnostic_CompileMethodResults value;
- value.nativeEntry = (DWORDLONG)*nativeEntry;
+ value.nativeEntry = (DWORDLONG)*nativeEntry;
value.nativeSizeOfCode = (DWORD)*nativeSizeOfCode;
- value.CorJitResult = (DWORD)result;
+ value.CorJitResult = (DWORD)result;
CompileMethod->Add(0, value);
}
void CompileResult::dmpCompileMethod(DWORD key, const Agnostic_CompileMethodResults& value)
{
- printf("CompileMethod key %u, value nativeEntry-%016llX nativeSizeOfCode-%u CorJitResult-%u",
- key, value.nativeEntry, value.nativeSizeOfCode, value.CorJitResult);
+ printf("CompileMethod key %u, value nativeEntry-%016llX nativeSizeOfCode-%u CorJitResult-%u", key,
+ value.nativeEntry, value.nativeSizeOfCode, value.CorJitResult);
}
-void CompileResult::repCompileMethod(BYTE **nativeEntry, ULONG *nativeSizeOfCode, CorJitResult *result)
+void CompileResult::repCompileMethod(BYTE** nativeEntry, ULONG* nativeSizeOfCode, CorJitResult* result)
{
Agnostic_CompileMethodResults value;
- value = CompileMethod->Get(0);
- *nativeEntry = (BYTE *)value.nativeEntry;
+ value = CompileMethod->Get(0);
+ *nativeEntry = (BYTE*)value.nativeEntry;
*nativeSizeOfCode = (ULONG)value.nativeSizeOfCode;
- *result = (CorJitResult)value.CorJitResult;
+ *result = (CorJitResult)value.CorJitResult;
}
void CompileResult::recMessageLog(const char* fmt, ...)
{
// TODO-Cleanup: ???
return;
- if(MessageLog == nullptr)
+ if (MessageLog == nullptr)
MessageLog = new DenseLightWeightMap<DWORD>();
va_list args;
// retrieve the variable arguments
- va_start( args, fmt );
+ va_start(args, fmt);
- size_t len = _vscprintf(fmt, args) + 1; //space for the terminator
+ size_t len = _vscprintf(fmt, args) + 1; // space for the terminator
- unsigned char *messageLogBuffer = new unsigned char[len];
+ unsigned char* messageLogBuffer = new unsigned char[len];
vsprintf_s((char*)messageLogBuffer, len, fmt, args);
- messageLogBuffer[len-1] = 0;
+ messageLogBuffer[len - 1] = 0;
MessageLog->Append(MessageLog->AddBuffer(messageLogBuffer, (DWORD)len));
- delete []messageLogBuffer;
+ delete[] messageLogBuffer;
}
void CompileResult::dmpMessageLog(DWORD key, DWORD value)
{
@@ -414,56 +418,55 @@ void CompileResult::dmpMessageLog(DWORD key, DWORD value)
void CompileResult::recClassMustBeLoadedBeforeCodeIsRun(CORINFO_CLASS_HANDLE cls)
{
- if(ClassMustBeLoadedBeforeCodeIsRun == nullptr)
+ if (ClassMustBeLoadedBeforeCodeIsRun == nullptr)
ClassMustBeLoadedBeforeCodeIsRun = new DenseLightWeightMap<DWORDLONG>();
ClassMustBeLoadedBeforeCodeIsRun->Append((DWORDLONG)cls);
}
void CompileResult::dmpClassMustBeLoadedBeforeCodeIsRun(DWORD key, DWORDLONG value)
{
- printf("ClassMustBeLoadedBeforeCodeIsRun key %u, value cls-%016llX",
- key, value);
+ printf("ClassMustBeLoadedBeforeCodeIsRun key %u, value cls-%016llX", key, value);
}
-void CompileResult::recReportInliningDecision(CORINFO_METHOD_HANDLE inlinerHnd, CORINFO_METHOD_HANDLE inlineeHnd,
- CorInfoInline inlineResult, const char * reason)
+void CompileResult::recReportInliningDecision(CORINFO_METHOD_HANDLE inlinerHnd,
+ CORINFO_METHOD_HANDLE inlineeHnd,
+ CorInfoInline inlineResult,
+ const char* reason)
{
- if(ReportInliningDecision == nullptr)
+ if (ReportInliningDecision == nullptr)
ReportInliningDecision = new DenseLightWeightMap<Agnostic_ReportInliningDecision>();
Agnostic_ReportInliningDecision value;
- value.inlinerHnd = (DWORDLONG)inlinerHnd;
- value.inlineeHnd = (DWORDLONG)inlineeHnd;
+ value.inlinerHnd = (DWORDLONG)inlinerHnd;
+ value.inlineeHnd = (DWORDLONG)inlineeHnd;
value.inlineResult = (DWORD)inlineResult;
- if(reason!=nullptr)
- value.reason_offset = (DWORD)ReportInliningDecision->AddBuffer((unsigned char*)reason, (DWORD)strlen(reason)+1);
+ if (reason != nullptr)
+ value.reason_offset =
+ (DWORD)ReportInliningDecision->AddBuffer((unsigned char*)reason, (DWORD)strlen(reason) + 1);
else
- value.reason_offset = -1;
+ value.reason_offset = -1;
ReportInliningDecision->Append(value);
}
void CompileResult::dmpReportInliningDecision(DWORD key, const Agnostic_ReportInliningDecision& value)
{
- const char *reason = (const char*)ReportInliningDecision->GetBuffer(value.reason_offset);
- printf("ReportInliningDecision key %u, value inliner-%016llX inlinee-%016llX res-%u reason-'%s'",
- key,
- value.inlinerHnd,
- value.inlineeHnd,
- value.inlineResult,
- reason);
+ const char* reason = (const char*)ReportInliningDecision->GetBuffer(value.reason_offset);
+ printf("ReportInliningDecision key %u, value inliner-%016llX inlinee-%016llX res-%u reason-'%s'", key,
+ value.inlinerHnd, value.inlineeHnd, value.inlineResult, reason);
ReportInliningDecision->Unlock();
}
-CorInfoInline CompileResult::repReportInliningDecision(CORINFO_METHOD_HANDLE inlinerHnd, CORINFO_METHOD_HANDLE inlineeHnd)
+CorInfoInline CompileResult::repReportInliningDecision(CORINFO_METHOD_HANDLE inlinerHnd,
+ CORINFO_METHOD_HANDLE inlineeHnd)
{
CorInfoInline result = INLINE_FAIL;
- if(ReportInliningDecision!=nullptr)
+ if (ReportInliningDecision != nullptr)
{
- Agnostic_ReportInliningDecision *items = ReportInliningDecision->GetRawItems();
- unsigned int cnt = ReportInliningDecision->GetCount();
- for(unsigned int i=0;i<cnt;i++)
+ Agnostic_ReportInliningDecision* items = ReportInliningDecision->GetRawItems();
+ unsigned int cnt = ReportInliningDecision->GetCount();
+ for (unsigned int i = 0; i < cnt; i++)
{
- if((items[i].inlinerHnd == (DWORDLONG)inlinerHnd)&&(items[i].inlineeHnd == (DWORDLONG)inlineeHnd)&&
+ if ((items[i].inlinerHnd == (DWORDLONG)inlinerHnd) && (items[i].inlineeHnd == (DWORDLONG)inlineeHnd) &&
(items[i].inlineResult == INLINE_PASS))
result = INLINE_PASS;
}
@@ -473,7 +476,7 @@ CorInfoInline CompileResult::repReportInliningDecision(CORINFO_METHOD_HANDLE inl
void CompileResult::recSetEHcount(unsigned cEH)
{
- if(SetEHcount == nullptr)
+ if (SetEHcount == nullptr)
SetEHcount = new LightWeightMap<DWORD, DWORD>();
SetEHcount->Add((DWORD)0, (DWORD)cEH);
@@ -484,42 +487,37 @@ void CompileResult::dmpSetEHcount(DWORD key, DWORD value)
}
ULONG CompileResult::repSetEHcount()
{
- if(SetEHcount==nullptr)
+ if (SetEHcount == nullptr)
SetEHcount = new LightWeightMap<DWORD, DWORD>();
ULONG ehCount;
- int index = SetEHcount->GetIndex(0);
- if(index < 0)
+ int index = SetEHcount->GetIndex(0);
+ if (index < 0)
ehCount = 0;
else
ehCount = (ULONG)SetEHcount->Get(index);
return ehCount;
}
-void CompileResult::recSetEHinfo(unsigned EHnumber, const CORINFO_EH_CLAUSE *clause)
+void CompileResult::recSetEHinfo(unsigned EHnumber, const CORINFO_EH_CLAUSE* clause)
{
- if(SetEHinfo == nullptr)
+ if (SetEHinfo == nullptr)
SetEHinfo = new LightWeightMap<DWORD, Agnostic_CORINFO_EH_CLAUSE2>();
Agnostic_CORINFO_EH_CLAUSE2 value;
- value.Flags = (DWORD)clause->Flags;
- value.TryOffset = (DWORD)clause->TryOffset;
- value.TryLength = (DWORD)clause->TryLength;
+ value.Flags = (DWORD)clause->Flags;
+ value.TryOffset = (DWORD)clause->TryOffset;
+ value.TryLength = (DWORD)clause->TryLength;
value.HandlerOffset = (DWORD)clause->HandlerOffset;
value.HandlerLength = (DWORD)clause->HandlerLength;
- value.ClassToken = (DWORD)clause->ClassToken;
+ value.ClassToken = (DWORD)clause->ClassToken;
SetEHinfo->Add((DWORD)EHnumber, value);
}
void CompileResult::dmpSetEHinfo(DWORD key, const Agnostic_CORINFO_EH_CLAUSE2& value)
{
- printf("SetEHinfo key %u, value flg-%u to-%u tl-%u ho-%u hl-%u",
- key,
- value.Flags,
- value.TryOffset,
- value.TryLength,
- value.HandlerOffset,
- value.HandlerLength);
+ printf("SetEHinfo key %u, value flg-%u to-%u tl-%u ho-%u hl-%u", key, value.Flags, value.TryOffset, value.TryLength,
+ value.HandlerOffset, value.HandlerLength);
if ((CORINFO_EH_CLAUSE_FLAGS)value.Flags == CORINFO_EH_CLAUSE_FILTER)
{
printf(" fo-%u", value.ClassToken); // FilterOffset
@@ -530,22 +528,28 @@ void CompileResult::dmpSetEHinfo(DWORD key, const Agnostic_CORINFO_EH_CLAUSE2& v
}
// else, no need to print for finally/fault handlers
}
-void CompileResult::repSetEHinfo(unsigned EHnumber, ULONG *flags, ULONG *tryOffset, ULONG *tryLength, ULONG *handlerOffset, ULONG *handlerLength, ULONG *classToken)
+void CompileResult::repSetEHinfo(unsigned EHnumber,
+ ULONG* flags,
+ ULONG* tryOffset,
+ ULONG* tryLength,
+ ULONG* handlerOffset,
+ ULONG* handlerLength,
+ ULONG* classToken)
{
Agnostic_CORINFO_EH_CLAUSE2 value;
value = SetEHinfo->Get(EHnumber);
- *flags=(ULONG)value.Flags;
- *tryOffset=(ULONG)value.TryOffset;
- *tryLength=(ULONG)value.TryLength;
- *handlerOffset=(ULONG)value.HandlerOffset;
- *handlerLength=(ULONG)value.HandlerLength;
- *classToken=(ULONG)value.ClassToken;
+ *flags = (ULONG)value.Flags;
+ *tryOffset = (ULONG)value.TryOffset;
+ *tryLength = (ULONG)value.TryLength;
+ *handlerOffset = (ULONG)value.HandlerOffset;
+ *handlerLength = (ULONG)value.HandlerLength;
+ *classToken = (ULONG)value.ClassToken;
}
void CompileResult::recSetMethodAttribs(CORINFO_METHOD_HANDLE ftn, CorInfoMethodRuntimeFlags attribs)
{
- if(SetMethodAttribs == nullptr)
+ if (SetMethodAttribs == nullptr)
SetMethodAttribs = new LightWeightMap<DWORDLONG, DWORD>();
SetMethodAttribs->Add((DWORDLONG)ftn, (DWORD)attribs);
@@ -554,9 +558,9 @@ void CompileResult::dmpSetMethodAttribs(DWORDLONG key, DWORD value)
{
printf("SetMethodAttribs key ftn-%016llX, value attr-%08X", key, value);
}
-CorInfoMethodRuntimeFlags CompileResult::repSetMethodAttribs (CORINFO_METHOD_HANDLE ftn)
+CorInfoMethodRuntimeFlags CompileResult::repSetMethodAttribs(CORINFO_METHOD_HANDLE ftn)
{
- if((SetMethodAttribs==nullptr)||(SetMethodAttribs->GetIndex((DWORDLONG)ftn)==-1))
+ if ((SetMethodAttribs == nullptr) || (SetMethodAttribs->GetIndex((DWORDLONG)ftn) == -1))
return (CorInfoMethodRuntimeFlags)0;
CorInfoMethodRuntimeFlags result = (CorInfoMethodRuntimeFlags)SetMethodAttribs->Get((DWORDLONG)ftn);
return result;
@@ -564,7 +568,7 @@ CorInfoMethodRuntimeFlags CompileResult::repSetMethodAttribs (CORINFO_METHOD_HAN
void CompileResult::recMethodMustBeLoadedBeforeCodeIsRun(CORINFO_METHOD_HANDLE method)
{
- if(MethodMustBeLoadedBeforeCodeIsRun == nullptr)
+ if (MethodMustBeLoadedBeforeCodeIsRun == nullptr)
MethodMustBeLoadedBeforeCodeIsRun = new DenseLightWeightMap<DWORDLONG>();
MethodMustBeLoadedBeforeCodeIsRun->Append((DWORDLONG)method);
@@ -574,20 +578,24 @@ void CompileResult::dmpMethodMustBeLoadedBeforeCodeIsRun(DWORD key, DWORDLONG va
printf("MethodMustBeLoadedBeforeCodeIsRun key %u, value ftn-%016llX", key, value);
}
-void CompileResult::recReportTailCallDecision(CORINFO_METHOD_HANDLE callerHnd, CORINFO_METHOD_HANDLE calleeHnd, bool fIsTailPrefix,
- CorInfoTailCall tailCallResult, const char * reason)
+void CompileResult::recReportTailCallDecision(CORINFO_METHOD_HANDLE callerHnd,
+ CORINFO_METHOD_HANDLE calleeHnd,
+ bool fIsTailPrefix,
+ CorInfoTailCall tailCallResult,
+ const char* reason)
{
- if(ReportTailCallDecision == nullptr)
+ if (ReportTailCallDecision == nullptr)
ReportTailCallDecision = new DenseLightWeightMap<Agnostic_ReportTailCallDecision>();
Agnostic_ReportTailCallDecision value;
- value.callerHnd = (DWORDLONG)callerHnd;
- value.calleeHnd = (DWORDLONG)calleeHnd;
- value.fIsTailPrefix = (DWORD)fIsTailPrefix;
+ value.callerHnd = (DWORDLONG)callerHnd;
+ value.calleeHnd = (DWORDLONG)calleeHnd;
+ value.fIsTailPrefix = (DWORD)fIsTailPrefix;
value.tailCallResult = (DWORD)tailCallResult;
- if(reason!=nullptr) //protect strlen
- value.reason_index = (DWORD)ReportTailCallDecision->AddBuffer((unsigned char*)reason, (DWORD)strlen(reason)+1);
+ if (reason != nullptr) // protect strlen
+ value.reason_index =
+ (DWORD)ReportTailCallDecision->AddBuffer((unsigned char*)reason, (DWORD)strlen(reason) + 1);
else
value.reason_index = (DWORD)-1;
@@ -595,15 +603,15 @@ void CompileResult::recReportTailCallDecision(CORINFO_METHOD_HANDLE callerHnd, C
}
void CompileResult::dmpReportTailCallDecision(DWORD key, const Agnostic_ReportTailCallDecision& value)
{
- const char *reason = (const char*)ReportTailCallDecision->GetBuffer(value.reason_index);
- printf("ReportTailCallDecision key-%u, value cr-%016llX ce-%016llX tail-%u call-%u -%s",
- key, value.callerHnd, value.calleeHnd, value.tailCallResult, value.tailCallResult, reason);
+ const char* reason = (const char*)ReportTailCallDecision->GetBuffer(value.reason_index);
+ printf("ReportTailCallDecision key-%u, value cr-%016llX ce-%016llX tail-%u call-%u -%s", key, value.callerHnd,
+ value.calleeHnd, value.tailCallResult, value.tailCallResult, reason);
ReportTailCallDecision->Unlock();
}
void CompileResult::recReportFatalError(CorJitResult result)
{
- if(ReportFatalError == nullptr)
+ if (ReportFatalError == nullptr)
ReportFatalError = new DenseLightWeightMap<DWORD>();
ReportFatalError->Append((DWORD)result);
@@ -613,7 +621,7 @@ void CompileResult::dmpReportFatalError(DWORD key, DWORD value)
printf("ReportFatalError key Count-%u, value result-%08X", key, value);
}
-void CompileResult::recRecordRelocation(void *location, void *target, WORD fRelocType, WORD slotNum, INT32 addlDelta)
+void CompileResult::recRecordRelocation(void* location, void* target, WORD fRelocType, WORD slotNum, INT32 addlDelta)
{
repRecordRelocation(location, target, fRelocType, slotNum, addlDelta);
}
@@ -622,43 +630,47 @@ const char* relocationTypeToString(WORD fRelocType)
{
switch (fRelocType)
{
- // From winnt.h
- case IMAGE_REL_BASED_ABSOLUTE : return "absolute";
- case IMAGE_REL_BASED_HIGH : return "high";
- case IMAGE_REL_BASED_LOW : return "low";
- case IMAGE_REL_BASED_HIGHLOW : return "highlow";
- case IMAGE_REL_BASED_HIGHADJ : return "highadj";
- case IMAGE_REL_BASED_DIR64 : return "dir64";
-
- // From corinfo.h
- case IMAGE_REL_BASED_REL32 : return "rel32";
- case IMAGE_REL_BASED_THUMB_BRANCH24 : return "thumb_branch24";
- default : return "UNKNOWN";
+ // From winnt.h
+ case IMAGE_REL_BASED_ABSOLUTE:
+ return "absolute";
+ case IMAGE_REL_BASED_HIGH:
+ return "high";
+ case IMAGE_REL_BASED_LOW:
+ return "low";
+ case IMAGE_REL_BASED_HIGHLOW:
+ return "highlow";
+ case IMAGE_REL_BASED_HIGHADJ:
+ return "highadj";
+ case IMAGE_REL_BASED_DIR64:
+ return "dir64";
+
+ // From corinfo.h
+ case IMAGE_REL_BASED_REL32:
+ return "rel32";
+ case IMAGE_REL_BASED_THUMB_BRANCH24:
+ return "thumb_branch24";
+ default:
+ return "UNKNOWN";
}
}
void CompileResult::dmpRecordRelocation(DWORD key, const Agnostic_RecordRelocation& value)
{
- printf("RecordRelocation key %u, value loc-%016llX tgt-%016llX fRelocType-%u(%s) slotNum-%u addlDelta-%d",
- key,
- value.location,
- value.target,
- value.fRelocType,
- relocationTypeToString((WORD)value.fRelocType),
- value.slotNum,
- (INT32)value.addlDelta);
+ printf("RecordRelocation key %u, value loc-%016llX tgt-%016llX fRelocType-%u(%s) slotNum-%u addlDelta-%d", key,
+ value.location, value.target, value.fRelocType, relocationTypeToString((WORD)value.fRelocType),
+ value.slotNum, (INT32)value.addlDelta);
}
-void CompileResult::repRecordRelocation(void *location, void *target, WORD fRelocType, WORD slotNum, INT32 addlDelta)
+void CompileResult::repRecordRelocation(void* location, void* target, WORD fRelocType, WORD slotNum, INT32 addlDelta)
{
- if(RecordRelocation == nullptr)
+ if (RecordRelocation == nullptr)
RecordRelocation = new DenseLightWeightMap<Agnostic_RecordRelocation>();
Agnostic_RecordRelocation value;
- value.location = (DWORDLONG)location;
- value.target = (DWORDLONG)target;
+ value.location = (DWORDLONG)location;
+ value.target = (DWORDLONG)target;
value.fRelocType = (DWORD)fRelocType;
- value.slotNum = (DWORD)slotNum;
- value.addlDelta = (DWORD)addlDelta;
+ value.slotNum = (DWORD)slotNum;
+ value.addlDelta = (DWORD)addlDelta;
RecordRelocation->Append(value);
}
@@ -681,25 +693,22 @@ void CompileResult::repRecordRelocation(void *location, void *target, WORD fRelo
// current section (using originalAddr), assuming we needed a jump stub. We'll let multiple calls to potentially
// different functions use the same address because even if they used different ones, and diffs were generated,
// no textual diffs would appear because most of the textual call names are "hackishMethodName".
-void CompileResult::applyRelocs(unsigned char *block1, ULONG blocksize1, void *originalAddr)
+void CompileResult::applyRelocs(unsigned char* block1, ULONG blocksize1, void* originalAddr)
{
- if(RecordRelocation == nullptr)
+ if (RecordRelocation == nullptr)
return;
- if(blocksize1 == 0)
+ if (blocksize1 == 0)
return;
size_t section_begin = (size_t)block1;
size_t section_end = (size_t)block1 + (size_t)blocksize1; // address is exclusive
- LogDebug("applyRelocs block [%p,%p) block size %u, orig addr %p",
- block1,
- block1 + blocksize1,
- blocksize1,
- originalAddr);
+ LogDebug("applyRelocs block [%p,%p) block size %u, orig addr %p", block1, block1 + blocksize1, blocksize1,
+ originalAddr);
- for(unsigned int i=0;i<RecordRelocation->GetCount();i++)
+ for (unsigned int i = 0; i < RecordRelocation->GetCount(); i++)
{
- Agnostic_RecordRelocation tmp = RecordRelocation->GetRawItems()[i];
+ Agnostic_RecordRelocation tmp = RecordRelocation->GetRawItems()[i];
if (Logger::IsLogLevelEnabled(LOGLEVEL_DEBUG))
{
@@ -710,15 +719,16 @@ void CompileResult::applyRelocs(unsigned char *block1, ULONG blocksize1, void *o
switch (tmp.fRelocType)
{
- #if defined(_TARGET_X86_)
- case IMAGE_REL_BASED_HIGHLOW:
+#if defined(_TARGET_X86_)
+ case IMAGE_REL_BASED_HIGHLOW:
{
DWORDLONG fixupLocation = tmp.location;
size_t address = section_begin + (size_t)fixupLocation - (size_t)originalAddr;
- if ( (section_begin <= address) && (address < section_end) ) //A reloc for our section?
+ if ((section_begin <= address) && (address < section_end)) // A reloc for our section?
{
- LogDebug(" fixupLoc-%016llX (@%p) : %08X => %08X", fixupLocation, address, *(DWORD*)address, (DWORD)tmp.target);
+ LogDebug(" fixupLoc-%016llX (@%p) : %08X => %08X", fixupLocation, address, *(DWORD*)address,
+ (DWORD)tmp.target);
*(DWORD*)address = (DWORD)tmp.target;
}
if (tmp.addlDelta != 0)
@@ -727,131 +737,131 @@ void CompileResult::applyRelocs(unsigned char *block1, ULONG blocksize1, void *o
__debugbreak();
}
break;
- #endif // _TARGET_X86_
+#endif // _TARGET_X86_
- #if defined(_TARGET_X86_) || defined(_TARGET_AMD64_) || defined(_TARGET_ARM64_) || defined(_TARGET_ARM_)
- case IMAGE_REL_BASED_REL32:
+#if defined(_TARGET_X86_) || defined(_TARGET_AMD64_) || defined(_TARGET_ARM64_) || defined(_TARGET_ARM_)
+ case IMAGE_REL_BASED_REL32:
{
- DWORDLONG target = tmp.target + tmp.addlDelta;
+ DWORDLONG target = tmp.target + tmp.addlDelta;
DWORDLONG fixupLocation = tmp.location + tmp.slotNum;
- DWORDLONG baseAddr = fixupLocation + sizeof(INT32);
- INT64 delta = (INT64)((BYTE *)target - baseAddr);
+ DWORDLONG baseAddr = fixupLocation + sizeof(INT32);
+ INT64 delta = (INT64)((BYTE*)target - baseAddr);
- #if defined(_TARGET_AMD64_) || defined(_TARGET_ARM64_)
+#if defined(_TARGET_AMD64_) || defined(_TARGET_ARM64_)
if (delta != (INT64)(int)delta)
{
// This isn't going to fit in a signed 32-bit address. Use something that will fit,
// since we assume that original compilation fit fine. This is only an issue for
// 32-bit offsets on 64-bit targets.
- target = (DWORDLONG)originalAddr + (DWORDLONG)blocksize1;
- INT64 newdelta = (INT64)((BYTE *)target - baseAddr);
+ target = (DWORDLONG)originalAddr + (DWORDLONG)blocksize1;
+ INT64 newdelta = (INT64)((BYTE*)target - baseAddr);
- LogDebug(" REL32 overflow. Mapping target to %016llX. Mapping delta: %016llX => %016llX", target, delta, newdelta);
+ LogDebug(" REL32 overflow. Mapping target to %016llX. Mapping delta: %016llX => %016llX", target,
+ delta, newdelta);
delta = newdelta;
}
- #endif // defined(_TARGET_AMD64_) || defined(_TARGET_ARM64_)
+#endif // defined(_TARGET_AMD64_) || defined(_TARGET_ARM64_)
if (delta != (INT64)(int)delta)
{
- #if defined(_TARGET_AMD64_) || defined(_TARGET_ARM64_)
+#if defined(_TARGET_AMD64_) || defined(_TARGET_ARM64_)
LogError("REL32 relocation overflows field! delta=0x%016llX", delta);
- #else
+#else
LogError("REL32 relocation overflows field! delta=0x%08X", delta);
- #endif
+#endif
}
// Write 32-bits into location
size_t address = section_begin + (size_t)fixupLocation - (size_t)originalAddr;
- if ( (section_begin <= address) && (address < section_end) ) //A reloc for our section?
+ if ((section_begin <= address) && (address < section_end)) // A reloc for our section?
{
- LogDebug(" fixupLoc-%016llX (@%p) : %08X => %08X", fixupLocation, address, *(DWORD*)address, delta);
+ LogDebug(" fixupLoc-%016llX (@%p) : %08X => %08X", fixupLocation, address, *(DWORD*)address,
+ delta);
*(DWORD*)address = (DWORD)delta;
}
}
break;
- #endif // defined(_TARGET_X86_) || defined(_TARGET_AMD64_) || defined(_TARGET_ARM64_) || defined(_TARGET_ARM_)
+#endif // defined(_TARGET_X86_) || defined(_TARGET_AMD64_) || defined(_TARGET_ARM64_) || defined(_TARGET_ARM_)
- #if defined(_TARGET_AMD64_) || defined(_TARGET_ARM64_)
- case IMAGE_REL_BASED_DIR64:
+#if defined(_TARGET_AMD64_) || defined(_TARGET_ARM64_)
+ case IMAGE_REL_BASED_DIR64:
{
DWORDLONG fixupLocation = tmp.location + tmp.slotNum;
// Write 64-bits into location
size_t address = section_begin + (size_t)fixupLocation - (size_t)originalAddr;
- if ( (section_begin <= address) && (address < section_end) ) //A reloc for our section?
+ if ((section_begin <= address) && (address < section_end)) // A reloc for our section?
{
- LogDebug(" fixupLoc-%016llX (@%p) %016llX => %016llX", fixupLocation, address, *(DWORDLONG*)address, tmp.target);
+ LogDebug(" fixupLoc-%016llX (@%p) %016llX => %016llX", fixupLocation, address,
+ *(DWORDLONG*)address, tmp.target);
*(DWORDLONG*)address = tmp.target;
}
}
break;
- #endif // defined(_TARGET_AMD64_) || defined(_TARGET_ARM64_)
-
- #ifdef _TARGET_ARM64_
- case IMAGE_REL_ARM64_BRANCH26: // 26 bit offset << 2 & sign ext, for B and BL
- case IMAGE_REL_ARM64_PAGEBASE_REL21:
- case IMAGE_REL_ARM64_PAGEOFFSET_12A:
- LogError("Unimplemented reloc type %u", tmp.fRelocType);
- break;
- #endif // _TARGET_ARM64_
-
- default:
- LogError("Unknown reloc type %u", tmp.fRelocType);
- break;
+#endif // defined(_TARGET_AMD64_) || defined(_TARGET_ARM64_)
+
+#ifdef _TARGET_ARM64_
+ case IMAGE_REL_ARM64_BRANCH26: // 26 bit offset << 2 & sign ext, for B and BL
+ case IMAGE_REL_ARM64_PAGEBASE_REL21:
+ case IMAGE_REL_ARM64_PAGEOFFSET_12A:
+ LogError("Unimplemented reloc type %u", tmp.fRelocType);
+ break;
+#endif // _TARGET_ARM64_
+
+ default:
+ LogError("Unknown reloc type %u", tmp.fRelocType);
+ break;
}
}
}
void CompileResult::recProcessName(const char* name)
{
- if(ProcessName == nullptr)
+ if (ProcessName == nullptr)
ProcessName = new DenseLightWeightMap<DWORD>();
DWORD index = (DWORD)-1;
- if(name != nullptr)
- index = (DWORD)ProcessName->AddBuffer((unsigned char*)name, (DWORD)strlen(name)+1);
+ if (name != nullptr)
+ index = (DWORD)ProcessName->AddBuffer((unsigned char*)name, (DWORD)strlen(name) + 1);
ProcessName->Append(index);
}
void CompileResult::dmpProcessName(DWORD key, DWORD value)
{
- const char *procName = (const char *)ProcessName->GetBuffer(value);
+ const char* procName = (const char*)ProcessName->GetBuffer(value);
printf("ProcessName key %u, value '%s'", key, procName);
ProcessName->Unlock();
}
-const char *CompileResult::repProcessName()
+const char* CompileResult::repProcessName()
{
- if(ProcessName == nullptr)
+ if (ProcessName == nullptr)
return "hackishProcessName";
- if(ProcessName->GetCount()>0)
+ if (ProcessName->GetCount() > 0)
{
return (const char*)ProcessName->GetBuffer(ProcessName->Get((DWORD)0));
}
return nullptr;
}
-void CompileResult::recAddressMap(void *originalAddress, void *replayAddress, unsigned int size)
+void CompileResult::recAddressMap(void* originalAddress, void* replayAddress, unsigned int size)
{
- if(AddressMap == nullptr)
+ if (AddressMap == nullptr)
AddressMap = new LightWeightMap<DWORDLONG, Agnostic_AddressMap>();
Agnostic_AddressMap value;
value.Address = (DWORDLONG)originalAddress;
- value.size = (DWORD)size;
+ value.size = (DWORD)size;
AddressMap->Add((DWORDLONG)replayAddress, value);
}
void CompileResult::dmpAddressMap(DWORDLONG key, const Agnostic_AddressMap& value)
{
- printf("AddressMap key %016llX, value addr-%016llX, size-%u",
- key,
- value.Address,
- value.size);
+ printf("AddressMap key %016llX, value addr-%016llX, size-%u", key, value.Address, value.size);
}
-void* CompileResult::repAddressMap(void *replayAddress)
+void* CompileResult::repAddressMap(void* replayAddress)
{
if (AddressMap == nullptr)
return nullptr;
@@ -859,28 +869,28 @@ void* CompileResult::repAddressMap(void *replayAddress)
value = AddressMap->Get((DWORDLONG)replayAddress);
return (void*)value.Address;
}
-void *CompileResult::searchAddressMap(void *newAddress)
+void* CompileResult::searchAddressMap(void* newAddress)
{
- if(AddressMap==nullptr)
+ if (AddressMap == nullptr)
return (void*)-1;
- for(unsigned int i=0;i<AddressMap->GetCount();i++)
+ for (unsigned int i = 0; i < AddressMap->GetCount(); i++)
{
- DWORDLONG replayAddress = AddressMap->GetRawKeys()[i];
- Agnostic_AddressMap value = AddressMap->Get(replayAddress);
- if((replayAddress<=(DWORDLONG)newAddress)&&((DWORDLONG)newAddress<(replayAddress+value.size)))
- return (void *)(value.Address+((DWORDLONG)newAddress-replayAddress));
+ DWORDLONG replayAddress = AddressMap->GetRawKeys()[i];
+ Agnostic_AddressMap value = AddressMap->Get(replayAddress);
+ if ((replayAddress <= (DWORDLONG)newAddress) && ((DWORDLONG)newAddress < (replayAddress + value.size)))
+ return (void*)(value.Address + ((DWORDLONG)newAddress - replayAddress));
}
return (void*)-1;
}
void CompileResult::recReserveUnwindInfo(BOOL isFunclet, BOOL isColdCode, ULONG unwindSize)
{
- if(ReserveUnwindInfo == nullptr)
+ if (ReserveUnwindInfo == nullptr)
ReserveUnwindInfo = new DenseLightWeightMap<Agnostic_ReserveUnwindInfo>();
Agnostic_ReserveUnwindInfo value;
- value.isFunclet = (DWORD)isFunclet;
+ value.isFunclet = (DWORD)isFunclet;
value.isColdCode = (DWORD)isColdCode;
value.unwindSize = (DWORD)unwindSize;
@@ -888,102 +898,90 @@ void CompileResult::recReserveUnwindInfo(BOOL isFunclet, BOOL isColdCode, ULONG
}
void CompileResult::dmpReserveUnwindInfo(DWORD key, const Agnostic_ReserveUnwindInfo& value)
{
- printf("ReserveUnwindInfo key %u, value isFun-%u isCold-%u usz-%u",
- key, value.isFunclet, value.isColdCode, value.unwindSize);
+ printf("ReserveUnwindInfo key %u, value isFun-%u isCold-%u usz-%u", key, value.isFunclet, value.isColdCode,
+ value.unwindSize);
}
-void CompileResult::recAllocUnwindInfo(BYTE *pHotCode, BYTE *pColdCode, ULONG startOffset, ULONG endOffset, ULONG unwindSize, BYTE *pUnwindBlock,
- CorJitFuncKind funcKind)
+void CompileResult::recAllocUnwindInfo(BYTE* pHotCode,
+ BYTE* pColdCode,
+ ULONG startOffset,
+ ULONG endOffset,
+ ULONG unwindSize,
+ BYTE* pUnwindBlock,
+ CorJitFuncKind funcKind)
{
- if(AllocUnwindInfo == nullptr)
+ if (AllocUnwindInfo == nullptr)
AllocUnwindInfo = new DenseLightWeightMap<Agnostic_AllocUnwindInfo>();
Agnostic_AllocUnwindInfo value;
- value.pHotCode = (DWORDLONG)pHotCode;
- value.pColdCode = (DWORDLONG)pColdCode;
- value.startOffset = (DWORD)startOffset;
- value.endOffset = (DWORD)endOffset;
- value.unwindSize = (DWORD)unwindSize;
+ value.pHotCode = (DWORDLONG)pHotCode;
+ value.pColdCode = (DWORDLONG)pColdCode;
+ value.startOffset = (DWORD)startOffset;
+ value.endOffset = (DWORD)endOffset;
+ value.unwindSize = (DWORD)unwindSize;
value.pUnwindBlock_index = AllocUnwindInfo->AddBuffer((unsigned char*)pUnwindBlock, unwindSize);
- value.funcKind = funcKind;
+ value.funcKind = funcKind;
AllocUnwindInfo->Append(value);
}
void CompileResult::dmpAllocUnwindInfo(DWORD key, const Agnostic_AllocUnwindInfo& value)
{
- printf("AllocUnwindInfo key %u, value pHot-%016llX pCold-%016llX startOff-%u endOff-%u unwindSz-%u blki-%u funcKind-%u",
- key,
- value.pHotCode,
- value.pColdCode,
- value.startOffset,
- value.endOffset,
- value.unwindSize,
- value.pUnwindBlock_index,
- value.funcKind);
+ printf("AllocUnwindInfo key %u, value pHot-%016llX pCold-%016llX startOff-%u endOff-%u unwindSz-%u blki-%u "
+ "funcKind-%u",
+ key, value.pHotCode, value.pColdCode, value.startOffset, value.endOffset, value.unwindSize,
+ value.pUnwindBlock_index, value.funcKind);
}
-void CompileResult::recAllocBBProfileBuffer(ULONG count, ICorJitInfo::ProfileBuffer **profileBuffer, HRESULT result)
+void CompileResult::recAllocBBProfileBuffer(ULONG count, ICorJitInfo::ProfileBuffer** profileBuffer, HRESULT result)
{
- if(AllocBBProfileBuffer == nullptr)
- AllocBBProfileBuffer=new LightWeightMap<DWORD, Agnostic_AllocBBProfileBuffer>();
+ if (AllocBBProfileBuffer == nullptr)
+ AllocBBProfileBuffer = new LightWeightMap<DWORD, Agnostic_AllocBBProfileBuffer>();
Agnostic_AllocBBProfileBuffer value;
- value.count = (DWORD)count;
+ value.count = (DWORD)count;
value.result = (DWORD)result;
- value.profileBuffer_index = AllocBBProfileBuffer->AddBuffer((unsigned char*)*profileBuffer, count * sizeof(ICorJitInfo::ProfileBuffer));
+ value.profileBuffer_index =
+ AllocBBProfileBuffer->AddBuffer((unsigned char*)*profileBuffer, count * sizeof(ICorJitInfo::ProfileBuffer));
AllocBBProfileBuffer->Add((DWORD)0, value);
}
void CompileResult::dmpAllocBBProfileBuffer(DWORD key, const Agnostic_AllocBBProfileBuffer& value)
{
- printf("AllocBBProfileBuffer key %u, value cnt-%u ind-%u res-%08X",
- key,
- value.count,
- value.profileBuffer_index,
- value.result);
+ printf("AllocBBProfileBuffer key %u, value cnt-%u ind-%u res-%08X", key, value.count, value.profileBuffer_index,
+ value.result);
}
-HRESULT CompileResult::repAllocBBProfileBuffer(ULONG count, ICorJitInfo::ProfileBuffer **profileBuffer)
+HRESULT CompileResult::repAllocBBProfileBuffer(ULONG count, ICorJitInfo::ProfileBuffer** profileBuffer)
{
Agnostic_AllocBBProfileBuffer value;
value = AllocBBProfileBuffer->Get((DWORD)0);
- if(count != value.count)
+ if (count != value.count)
__debugbreak();
HRESULT result = (HRESULT)value.result;
- *profileBuffer = (ICorJitInfo::ProfileBuffer *)AllocBBProfileBuffer->GetBuffer(value.profileBuffer_index);
- recAddressMap((void*)0x4242, (void*)*profileBuffer, count *(sizeof(ICorJitInfo::ProfileBuffer)));
+ *profileBuffer = (ICorJitInfo::ProfileBuffer*)AllocBBProfileBuffer->GetBuffer(value.profileBuffer_index);
+ recAddressMap((void*)0x4242, (void*)*profileBuffer, count * (sizeof(ICorJitInfo::ProfileBuffer)));
return result;
}
-void CompileResult::recRecordCallSite(ULONG instrOffset, CORINFO_SIG_INFO *callSig, CORINFO_METHOD_HANDLE methodHandle)
+void CompileResult::recRecordCallSite(ULONG instrOffset, CORINFO_SIG_INFO* callSig, CORINFO_METHOD_HANDLE methodHandle)
{
repRecordCallSite(instrOffset, callSig, methodHandle);
}
void CompileResult::dmpRecordCallSite(DWORD key, const Agnostic_RecordCallSite& value)
{
- printf("RecordCallSite key %u, callSig{cc-%u rtc-%016llX rts-%016llX rt-%u flg-%u na-%u cc-%u ci-%u mc-%u mi-%u sig-%u pSig-%u scp-%016llX tok-%08X} ftn-%016llX",
- key,
- value.callSig.callConv,
- value.callSig.retTypeClass,
- value.callSig.retTypeSigClass,
- value.callSig.retType,
- value.callSig.flags,
- value.callSig.numArgs,
- value.callSig.sigInst_classInstCount,
- value.callSig.sigInst_classInst_Index,
- value.callSig.sigInst_methInstCount,
- value.callSig.sigInst_methInst_Index,
- value.callSig.cbSig,
- value.callSig.pSig,
- value.callSig.scope,
- value.callSig.token,
- value.methodHandle);
-}
-
-void CompileResult::repRecordCallSite(ULONG instrOffset, CORINFO_SIG_INFO *callSig, CORINFO_METHOD_HANDLE methodHandle)
+ printf("RecordCallSite key %u, callSig{cc-%u rtc-%016llX rts-%016llX rt-%u flg-%u na-%u cc-%u ci-%u mc-%u mi-%u "
+ "sig-%u pSig-%u scp-%016llX tok-%08X} ftn-%016llX",
+ key, value.callSig.callConv, value.callSig.retTypeClass, value.callSig.retTypeSigClass,
+ value.callSig.retType, value.callSig.flags, value.callSig.numArgs, value.callSig.sigInst_classInstCount,
+ value.callSig.sigInst_classInst_Index, value.callSig.sigInst_methInstCount,
+ value.callSig.sigInst_methInst_Index, value.callSig.cbSig, value.callSig.pSig, value.callSig.scope,
+ value.callSig.token, value.methodHandle);
+}
+
+void CompileResult::repRecordCallSite(ULONG instrOffset, CORINFO_SIG_INFO* callSig, CORINFO_METHOD_HANDLE methodHandle)
{
if (RecordCallSite == nullptr)
RecordCallSite = new LightWeightMap<DWORD, Agnostic_RecordCallSite>();
@@ -993,39 +991,43 @@ void CompileResult::repRecordCallSite(ULONG instrOffset, CORINFO_SIG_INFO *callS
if (callSig != nullptr)
{
- value.callSig.callConv = (DWORD)callSig->callConv;
- value.callSig.retTypeClass = (DWORDLONG)callSig->retTypeClass;
- value.callSig.retTypeSigClass = (DWORDLONG)callSig->retTypeSigClass;
- value.callSig.retType = (DWORD)callSig->retType;
- value.callSig.flags = (DWORD)callSig->flags;
- value.callSig.numArgs = (DWORD)callSig->numArgs;
+ value.callSig.callConv = (DWORD)callSig->callConv;
+ value.callSig.retTypeClass = (DWORDLONG)callSig->retTypeClass;
+ value.callSig.retTypeSigClass = (DWORDLONG)callSig->retTypeSigClass;
+ value.callSig.retType = (DWORD)callSig->retType;
+ value.callSig.flags = (DWORD)callSig->flags;
+ value.callSig.numArgs = (DWORD)callSig->numArgs;
value.callSig.sigInst_classInstCount = (DWORD)callSig->sigInst.classInstCount;
- value.callSig.sigInst_classInst_Index = RecordCallSite->AddBuffer((unsigned char*)callSig->sigInst.classInst, callSig->sigInst.classInstCount*8); // porting issue
+ value.callSig.sigInst_classInst_Index =
+ RecordCallSite->AddBuffer((unsigned char*)callSig->sigInst.classInst,
+ callSig->sigInst.classInstCount * 8); // porting issue
value.callSig.sigInst_methInstCount = (DWORD)callSig->sigInst.methInstCount;
- value.callSig.sigInst_methInst_Index = RecordCallSite->AddBuffer((unsigned char*)callSig->sigInst.methInst, callSig->sigInst.methInstCount*8); // porting issue
- value.callSig.args = (DWORDLONG)callSig->args;
+ value.callSig.sigInst_methInst_Index =
+ RecordCallSite->AddBuffer((unsigned char*)callSig->sigInst.methInst,
+ callSig->sigInst.methInstCount * 8); // porting issue
+ value.callSig.args = (DWORDLONG)callSig->args;
value.callSig.cbSig = (DWORD)callSig->cbSig;
- value.callSig.pSig = (DWORD)RecordCallSite->AddBuffer((unsigned char *)callSig->pSig, callSig->cbSig);
+ value.callSig.pSig = (DWORD)RecordCallSite->AddBuffer((unsigned char*)callSig->pSig, callSig->cbSig);
value.callSig.scope = (DWORDLONG)callSig->scope;
value.callSig.token = (DWORD)callSig->token;
}
else
{
- value.callSig.callConv = (DWORD)-1;
- value.callSig.retTypeClass = (DWORDLONG)-1;
- value.callSig.retTypeSigClass = (DWORDLONG)-1;
- value.callSig.retType = (DWORD)-1;
- value.callSig.flags = (DWORD)-1;
- value.callSig.numArgs = (DWORD)-1;
- value.callSig.sigInst_classInstCount = (DWORD)-1;
+ value.callSig.callConv = (DWORD)-1;
+ value.callSig.retTypeClass = (DWORDLONG)-1;
+ value.callSig.retTypeSigClass = (DWORDLONG)-1;
+ value.callSig.retType = (DWORD)-1;
+ value.callSig.flags = (DWORD)-1;
+ value.callSig.numArgs = (DWORD)-1;
+ value.callSig.sigInst_classInstCount = (DWORD)-1;
value.callSig.sigInst_classInst_Index = (DWORD)-1;
- value.callSig.sigInst_methInstCount = (DWORD)-1;
- value.callSig.sigInst_methInst_Index = (DWORD)-1;
- value.callSig.args = (DWORDLONG)-1;
- value.callSig.cbSig = (DWORD)-1;
- value.callSig.pSig = (DWORD)-1;
- value.callSig.scope = (DWORDLONG)-1;
- value.callSig.token = (DWORD)-1;
+ value.callSig.sigInst_methInstCount = (DWORD)-1;
+ value.callSig.sigInst_methInst_Index = (DWORD)-1;
+ value.callSig.args = (DWORDLONG)-1;
+ value.callSig.cbSig = (DWORD)-1;
+ value.callSig.pSig = (DWORD)-1;
+ value.callSig.scope = (DWORDLONG)-1;
+ value.callSig.token = (DWORD)-1;
}
value.methodHandle = (DWORDLONG)methodHandle;
@@ -1033,7 +1035,7 @@ void CompileResult::repRecordCallSite(ULONG instrOffset, CORINFO_SIG_INFO *callS
RecordCallSite->Add(instrOffset, value);
}
-bool CompileResult::fndRecordCallSiteSigInfo(ULONG instrOffset, CORINFO_SIG_INFO *pCallSig)
+bool CompileResult::fndRecordCallSiteSigInfo(ULONG instrOffset, CORINFO_SIG_INFO* pCallSig)
{
if (RecordCallSite == nullptr)
return false;
@@ -1046,26 +1048,27 @@ bool CompileResult::fndRecordCallSiteSigInfo(ULONG instrOffset, CORINFO_SIG_INFO
if (value.callSig.callConv == -1)
return false;
- pCallSig->callConv = (CorInfoCallConv)value.callSig.callConv;
- pCallSig->retTypeClass = (CORINFO_CLASS_HANDLE)value.callSig.retTypeClass;
- pCallSig->retTypeSigClass = (CORINFO_CLASS_HANDLE)value.callSig.retTypeSigClass;
- pCallSig->retType = (CorInfoType)value.callSig.retType;
- pCallSig->flags = (unsigned)value.callSig.flags;
- pCallSig->numArgs = (unsigned)value.callSig.numArgs;
+ pCallSig->callConv = (CorInfoCallConv)value.callSig.callConv;
+ pCallSig->retTypeClass = (CORINFO_CLASS_HANDLE)value.callSig.retTypeClass;
+ pCallSig->retTypeSigClass = (CORINFO_CLASS_HANDLE)value.callSig.retTypeSigClass;
+ pCallSig->retType = (CorInfoType)value.callSig.retType;
+ pCallSig->flags = (unsigned)value.callSig.flags;
+ pCallSig->numArgs = (unsigned)value.callSig.numArgs;
pCallSig->sigInst.classInstCount = (unsigned)value.callSig.sigInst_classInstCount;
- pCallSig->sigInst.classInst = (CORINFO_CLASS_HANDLE*)RecordCallSite->GetBuffer(value.callSig.sigInst_classInst_Index);
+ pCallSig->sigInst.classInst =
+ (CORINFO_CLASS_HANDLE*)RecordCallSite->GetBuffer(value.callSig.sigInst_classInst_Index);
pCallSig->sigInst.methInstCount = (unsigned)value.callSig.sigInst_methInstCount;
pCallSig->sigInst.methInst = (CORINFO_CLASS_HANDLE*)RecordCallSite->GetBuffer(value.callSig.sigInst_methInst_Index);
- pCallSig->args = (CORINFO_ARG_LIST_HANDLE)value.callSig.args;
- pCallSig->cbSig = (unsigned int)value.callSig.cbSig;
- pCallSig->pSig = (PCCOR_SIGNATURE)RecordCallSite->GetBuffer(value.callSig.pSig);
- pCallSig->scope = (CORINFO_MODULE_HANDLE)value.callSig.scope;
- pCallSig->token = (mdToken)value.callSig.token;
+ pCallSig->args = (CORINFO_ARG_LIST_HANDLE)value.callSig.args;
+ pCallSig->cbSig = (unsigned int)value.callSig.cbSig;
+ pCallSig->pSig = (PCCOR_SIGNATURE)RecordCallSite->GetBuffer(value.callSig.pSig);
+ pCallSig->scope = (CORINFO_MODULE_HANDLE)value.callSig.scope;
+ pCallSig->token = (mdToken)value.callSig.token;
return true;
}
-bool CompileResult::fndRecordCallSiteMethodHandle(ULONG instrOffset, CORINFO_METHOD_HANDLE *pMethodHandle)
+bool CompileResult::fndRecordCallSiteMethodHandle(ULONG instrOffset, CORINFO_METHOD_HANDLE* pMethodHandle)
{
if (RecordCallSite == nullptr)
return false;
@@ -1074,7 +1077,7 @@ bool CompileResult::fndRecordCallSiteMethodHandle(ULONG instrOffset, CORINFO_MET
return false;
Agnostic_RecordCallSite value = RecordCallSite->Get(instrOffset);
- *pMethodHandle = (CORINFO_METHOD_HANDLE)value.methodHandle;
+ *pMethodHandle = (CORINFO_METHOD_HANDLE)value.methodHandle;
return true;
}
diff --git a/src/ToolBox/superpmi/superpmi-shared/compileresult.h b/src/ToolBox/superpmi/superpmi-shared/compileresult.h
index 87853f4..ebb1e7f 100644
--- a/src/ToolBox/superpmi/superpmi-shared/compileresult.h
+++ b/src/ToolBox/superpmi/superpmi-shared/compileresult.h
@@ -19,46 +19,46 @@ public:
{
DWORDLONG location;
DWORDLONG target;
- DWORD fRelocType;
- DWORD slotNum;
- DWORD addlDelta;
+ DWORD fRelocType;
+ DWORD slotNum;
+ DWORD addlDelta;
};
struct Capture_AllocMemDetails
{
- ULONG hotCodeSize;
- ULONG coldCodeSize;
- ULONG roDataSize;
- ULONG xcptnsCount;
+ ULONG hotCodeSize;
+ ULONG coldCodeSize;
+ ULONG roDataSize;
+ ULONG xcptnsCount;
CorJitAllocMemFlag flag;
- void *hotCodeBlock;
- void *coldCodeBlock;
- void *roDataBlock;
+ void* hotCodeBlock;
+ void* coldCodeBlock;
+ void* roDataBlock;
};
struct allocGCInfoDetails
{
size_t size;
- void* retval;
+ void* retval;
};
struct Agnostic_AddressMap
{
DWORDLONG Address;
- DWORD size;
+ DWORD size;
};
struct Agnostic_AllocGCInfo
{
DWORDLONG size;
- DWORD retval_offset;
+ 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;
+ 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;
@@ -67,32 +67,32 @@ public:
{
DWORDLONG pHotCode;
DWORDLONG pColdCode;
- DWORD startOffset;
- DWORD endOffset;
- DWORD unwindSize;
- DWORD pUnwindBlock_index;
- DWORD funcKind;
+ DWORD startOffset;
+ DWORD endOffset;
+ DWORD unwindSize;
+ DWORD pUnwindBlock_index;
+ DWORD funcKind;
};
struct Agnostic_CompileMethodResults
{
DWORDLONG nativeEntry;
- DWORD nativeSizeOfCode;
- DWORD CorJitResult;
+ DWORD nativeSizeOfCode;
+ DWORD CorJitResult;
};
struct Agnostic_ReportInliningDecision
{
DWORDLONG inlinerHnd;
DWORDLONG inlineeHnd;
- DWORD inlineResult;
- DWORD reason_offset;
+ DWORD inlineResult;
+ DWORD reason_offset;
};
struct Agnostic_ReportTailCallDecision
{
DWORDLONG callerHnd;
DWORDLONG calleeHnd;
- DWORD fIsTailPrefix;
- DWORD tailCallResult;
- DWORD reason_index;
+ DWORD fIsTailPrefix;
+ DWORD tailCallResult;
+ DWORD reason_index;
};
struct Agnostic_ReserveUnwindInfo
{
@@ -103,14 +103,14 @@ public:
struct Agnostic_SetBoundaries
{
DWORDLONG ftn;
- DWORD cMap;
- DWORD pMap_offset;
+ DWORD cMap;
+ DWORD pMap_offset;
};
struct Agnostic_SetVars
{
DWORDLONG ftn;
- DWORD cVars;
- DWORD vars_offset;
+ DWORD cVars;
+ DWORD vars_offset;
};
struct Agnostic_CORINFO_EH_CLAUSE2
{
@@ -119,7 +119,7 @@ public:
DWORD TryLength;
DWORD HandlerOffset;
DWORD HandlerLength;
- DWORD ClassToken; //one view of symetric union
+ DWORD ClassToken; // one view of symetric union
};
struct Agnostic_AllocBBProfileBuffer
{
@@ -129,26 +129,26 @@ public:
};
struct Agnostic_CORINFO_SIG_INFO2
{
- DWORD callConv;
+ 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;
+ DWORD retType;
+ DWORD flags;
+ DWORD numArgs;
+ DWORD sigInst_classInstCount;
+ DWORD sigInst_classInst_Index;
+ DWORD sigInst_methInstCount;
+ DWORD sigInst_methInst_Index;
DWORDLONG args;
- DWORD pSig;
- DWORD cbSig;
+ DWORD pSig;
+ DWORD cbSig;
DWORDLONG scope;
- DWORD token;
+ DWORD token;
};
struct Agnostic_RecordCallSite
{
Agnostic_CORINFO_SIG_INFO2 callSig;
- DWORDLONG methodHandle;
+ DWORDLONG methodHandle;
};
#pragma pack(pop)
@@ -157,43 +157,57 @@ public:
bool IsEmpty();
- void AddCall(const char *name);
+ void AddCall(const char* name);
unsigned int CallLog_GetCount();
- bool CallLog_Contains(const char *str);
+ bool CallLog_Contains(const char* str);
void dmpCallLog(DWORD key, DWORD value);
void dumpToConsole();
HANDLE getCodeHeap();
- void recAssert(const char *buff);
+ void recAssert(const char* buff);
void dmpAssertLog(DWORD key, DWORD value);
- const char *repAssert();
-
- void recAllocMem(ULONG hotCodeSize, ULONG coldCodeSize, ULONG roDataSize, ULONG xcptnsCount, CorJitAllocMemFlag flag,
- void **hotCodeBlock, void **coldCodeBlock, void **roDataBlock);
+ const char* repAssert();
+
+ void recAllocMem(ULONG hotCodeSize,
+ ULONG coldCodeSize,
+ ULONG roDataSize,
+ ULONG xcptnsCount,
+ CorJitAllocMemFlag flag,
+ void** hotCodeBlock,
+ void** coldCodeBlock,
+ void** roDataBlock);
void recAllocMemCapture();
void dmpAllocMem(DWORD key, const Agnostic_AllocMemDetails& value);
- void repAllocMem(ULONG *hotCodeSize, ULONG *coldCodeSize, ULONG *roDataSize, ULONG *xcptnsCount, CorJitAllocMemFlag *flag,
- unsigned char **hotCodeBlock, unsigned char **coldCodeBlock, unsigned char **roDataBlock,
- void **orig_hotCodeBlock, void **orig_coldCodeBlock, void **orig_roDataBlock);
-
- void recSetBoundaries(CORINFO_METHOD_HANDLE ftn, ULONG32 cMap, ICorDebugInfo::OffsetMapping *pMap);
+ void repAllocMem(ULONG* hotCodeSize,
+ ULONG* coldCodeSize,
+ ULONG* roDataSize,
+ ULONG* xcptnsCount,
+ CorJitAllocMemFlag* flag,
+ unsigned char** hotCodeBlock,
+ unsigned char** coldCodeBlock,
+ unsigned char** roDataBlock,
+ void** orig_hotCodeBlock,
+ void** orig_coldCodeBlock,
+ void** orig_roDataBlock);
+
+ void recSetBoundaries(CORINFO_METHOD_HANDLE ftn, ULONG32 cMap, ICorDebugInfo::OffsetMapping* pMap);
void dmpSetBoundaries(DWORD key, const Agnostic_SetBoundaries& value);
- bool repSetBoundaries(CORINFO_METHOD_HANDLE *ftn, ULONG32 *cMap, ICorDebugInfo::OffsetMapping **pMap);
+ bool repSetBoundaries(CORINFO_METHOD_HANDLE* ftn, ULONG32* cMap, ICorDebugInfo::OffsetMapping** pMap);
- void recSetVars(CORINFO_METHOD_HANDLE ftn, ULONG32 cVars, ICorDebugInfo::NativeVarInfo *vars);
+ void recSetVars(CORINFO_METHOD_HANDLE ftn, ULONG32 cVars, ICorDebugInfo::NativeVarInfo* vars);
void dmpSetVars(DWORD key, const Agnostic_SetVars& value);
- bool repSetVars(CORINFO_METHOD_HANDLE *ftn, ULONG32 *cVars, ICorDebugInfo::NativeVarInfo **vars);
+ bool repSetVars(CORINFO_METHOD_HANDLE* ftn, ULONG32* cVars, ICorDebugInfo::NativeVarInfo** vars);
- void recAllocGCInfo(size_t size, void *retval);
+ void recAllocGCInfo(size_t size, void* retval);
void recAllocGCInfoCapture();
void dmpAllocGCInfo(DWORD key, const Agnostic_AllocGCInfo& value);
- void repAllocGCInfo(size_t *size, void **retval);
+ void repAllocGCInfo(size_t* size, void** retval);
- void recCompileMethod(BYTE **nativeEntry, ULONG *nativeSizeOfCode, CorJitResult result);
+ void recCompileMethod(BYTE** nativeEntry, ULONG* nativeSizeOfCode, CorJitResult result);
void dmpCompileMethod(DWORD key, const Agnostic_CompileMethodResults& value);
- void repCompileMethod(BYTE **nativeEntry, ULONG *nativeSizeOfCode, CorJitResult *result);
+ void repCompileMethod(BYTE** nativeEntry, ULONG* nativeSizeOfCode, CorJitResult* result);
void recMessageLog(const char* fmt, ...);
void dmpMessageLog(DWORD key, DWORD value);
@@ -201,7 +215,10 @@ public:
void recClassMustBeLoadedBeforeCodeIsRun(CORINFO_CLASS_HANDLE cls);
void dmpClassMustBeLoadedBeforeCodeIsRun(DWORD key, DWORDLONG value);
- void recReportInliningDecision(CORINFO_METHOD_HANDLE inlinerHnd, CORINFO_METHOD_HANDLE inlineeHnd, CorInfoInline inlineResult, const char * reason);
+ void recReportInliningDecision(CORINFO_METHOD_HANDLE inlinerHnd,
+ CORINFO_METHOD_HANDLE inlineeHnd,
+ CorInfoInline inlineResult,
+ const char* reason);
void dmpReportInliningDecision(DWORD key, const Agnostic_ReportInliningDecision& value);
CorInfoInline repReportInliningDecision(CORINFO_METHOD_HANDLE inlinerHnd, CORINFO_METHOD_HANDLE inlineeHnd);
@@ -209,68 +226,83 @@ public:
void dmpSetEHcount(DWORD key, DWORD value);
ULONG repSetEHcount();
- void recSetEHinfo(unsigned EHnumber, const CORINFO_EH_CLAUSE *clause);
+ void recSetEHinfo(unsigned EHnumber, const CORINFO_EH_CLAUSE* clause);
void dmpSetEHinfo(DWORD key, const Agnostic_CORINFO_EH_CLAUSE2& value);
- void repSetEHinfo(unsigned EHnumber, ULONG *flags, ULONG *tryOffset, ULONG *tryLength, ULONG *handlerOffset, ULONG *handlerLength, ULONG *classToken);
-
- void recSetMethodAttribs (CORINFO_METHOD_HANDLE ftn, CorInfoMethodRuntimeFlags attribs);
+ void repSetEHinfo(unsigned EHnumber,
+ ULONG* flags,
+ ULONG* tryOffset,
+ ULONG* tryLength,
+ ULONG* handlerOffset,
+ ULONG* handlerLength,
+ ULONG* classToken);
+
+ void recSetMethodAttribs(CORINFO_METHOD_HANDLE ftn, CorInfoMethodRuntimeFlags attribs);
void dmpSetMethodAttribs(DWORDLONG key, DWORD value);
- CorInfoMethodRuntimeFlags repSetMethodAttribs (CORINFO_METHOD_HANDLE ftn);
+ CorInfoMethodRuntimeFlags repSetMethodAttribs(CORINFO_METHOD_HANDLE ftn);
void recMethodMustBeLoadedBeforeCodeIsRun(CORINFO_METHOD_HANDLE method);
void dmpMethodMustBeLoadedBeforeCodeIsRun(DWORD key, DWORDLONG value);
- void recReportTailCallDecision(CORINFO_METHOD_HANDLE callerHnd, CORINFO_METHOD_HANDLE calleeHnd, bool fIsTailPrefix,
- CorInfoTailCall tailCallResult, const char * reason);
+ void recReportTailCallDecision(CORINFO_METHOD_HANDLE callerHnd,
+ CORINFO_METHOD_HANDLE calleeHnd,
+ bool fIsTailPrefix,
+ CorInfoTailCall tailCallResult,
+ const char* reason);
void dmpReportTailCallDecision(DWORD key, const Agnostic_ReportTailCallDecision& value);
void recReportFatalError(CorJitResult result);
void dmpReportFatalError(DWORD key, DWORD value);
- void recRecordRelocation(void *location, void *target, WORD fRelocType, WORD slotNum, INT32 addlDelta);
+ void recRecordRelocation(void* location, void* target, WORD fRelocType, WORD slotNum, INT32 addlDelta);
void dmpRecordRelocation(DWORD key, const Agnostic_RecordRelocation& value);
- void repRecordRelocation(void *location, void *target, WORD fRelocType, WORD slotNum, INT32 addlDelta);
- void applyRelocs(unsigned char *block1, ULONG blocksize1, void *originalAddr);
+ void repRecordRelocation(void* location, void* target, WORD fRelocType, WORD slotNum, INT32 addlDelta);
+ void applyRelocs(unsigned char* block1, ULONG blocksize1, void* originalAddr);
void recProcessName(const char* name);
void dmpProcessName(DWORD key, DWORD value);
- const char *repProcessName();
+ const char* repProcessName();
- void recAddressMap(void *original_address, void *replay_address, unsigned int size);
+ void recAddressMap(void* original_address, void* replay_address, unsigned int size);
void dmpAddressMap(DWORDLONG key, const Agnostic_AddressMap& value);
- void* repAddressMap(void *replay_address);
- void *searchAddressMap(void *replay_address);
+ void* repAddressMap(void* replay_address);
+ void* searchAddressMap(void* replay_address);
void recReserveUnwindInfo(BOOL isFunclet, BOOL isColdCode, ULONG unwindSize);
void dmpReserveUnwindInfo(DWORD key, const Agnostic_ReserveUnwindInfo& value);
- void recAllocUnwindInfo(BYTE *pHotCode, BYTE *pColdCode, ULONG startOffset, ULONG endOffset, ULONG unwindSize, BYTE *pUnwindBlock,
- CorJitFuncKind funcKind);
+ void recAllocUnwindInfo(BYTE* pHotCode,
+ BYTE* pColdCode,
+ ULONG startOffset,
+ ULONG endOffset,
+ ULONG unwindSize,
+ BYTE* pUnwindBlock,
+ CorJitFuncKind funcKind);
void dmpAllocUnwindInfo(DWORD key, const Agnostic_AllocUnwindInfo& value);
- void recAllocBBProfileBuffer(ULONG count, ICorJitInfo::ProfileBuffer **profileBuffer, HRESULT result);
+ void recAllocBBProfileBuffer(ULONG count, ICorJitInfo::ProfileBuffer** profileBuffer, HRESULT result);
void dmpAllocBBProfileBuffer(DWORD key, const Agnostic_AllocBBProfileBuffer& value);
- HRESULT repAllocBBProfileBuffer(ULONG count, ICorJitInfo::ProfileBuffer **profileBuffer);
+ HRESULT repAllocBBProfileBuffer(ULONG count, ICorJitInfo::ProfileBuffer** profileBuffer);
- void recRecordCallSite(ULONG instrOffset, CORINFO_SIG_INFO *callSig, CORINFO_METHOD_HANDLE methodHandle);
+ void recRecordCallSite(ULONG instrOffset, CORINFO_SIG_INFO* callSig, CORINFO_METHOD_HANDLE methodHandle);
void dmpRecordCallSite(DWORD key, const Agnostic_RecordCallSite& value);
- void repRecordCallSite(ULONG instrOffset, CORINFO_SIG_INFO *callSig, CORINFO_METHOD_HANDLE methodHandle);
- bool fndRecordCallSiteSigInfo(ULONG instrOffset, CORINFO_SIG_INFO *pCallSig);
- bool fndRecordCallSiteMethodHandle(ULONG instrOffset, CORINFO_METHOD_HANDLE *pMethodHandle);
+ void repRecordCallSite(ULONG instrOffset, CORINFO_SIG_INFO* callSig, CORINFO_METHOD_HANDLE methodHandle);
+ bool fndRecordCallSiteSigInfo(ULONG instrOffset, CORINFO_SIG_INFO* pCallSig);
+ bool fndRecordCallSiteMethodHandle(ULONG instrOffset, CORINFO_METHOD_HANDLE* pMethodHandle);
- DOUBLE secondsToCompile;
+ DOUBLE secondsToCompile;
ULONGLONG clockCyclesToCompile;
- #define LWM(map,key,value) LightWeightMap<key, value>* map;
- #define DENSELWM(map,value) DenseLightWeightMap<value>* map;
- #include "crlwmlist.h"
+#define LWM(map, key, value) LightWeightMap<key, value>* map;
+#define DENSELWM(map, value) DenseLightWeightMap<value>* map;
+#include "crlwmlist.h"
-//not persisted to disk.
+ // not persisted to disk.
public:
- LightWeightMap<DWORDLONG, DWORD> *CallTargetTypes;
+ LightWeightMap<DWORDLONG, DWORD>* CallTargetTypes;
+
private:
- HANDLE codeHeap;
+ HANDLE codeHeap;
Capture_AllocMemDetails allocMemDets;
- allocGCInfoDetails allocGCInfoDets;
+ allocGCInfoDetails allocGCInfoDets;
};
#endif
diff --git a/src/ToolBox/superpmi/superpmi-shared/coreclrcommoncallbacks.h b/src/ToolBox/superpmi/superpmi-shared/coreclrcommoncallbacks.h
new file mode 100644
index 0000000..ca542fb
--- /dev/null
+++ b/src/ToolBox/superpmi/superpmi-shared/coreclrcommoncallbacks.h
@@ -0,0 +1,20 @@
+//
+// Copyright (c) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+//
+
+#ifndef _CoreClrCommonCallbacks
+#define _CoreClrCommonCallbacks
+
+#include "runtimedetails.h"
+
+IExecutionEngine* IEE_t();
+HRESULT GetCORSystemDirectory(LPWSTR pbuffer, DWORD cchBuffer, DWORD* pdwlength);
+LPVOID EEHeapAllocInProcessHeap(DWORD dwFlags, SIZE_T dwBytes);
+BOOL EEHeapFreeInProcessHeap(DWORD dwFlags, LPVOID lpMem);
+void* GetCLRFunction(LPCSTR functionName);
+
+typedef LPVOID (*pfnEEHeapAllocInProcessHeap)(DWORD dwFlags, SIZE_T dwBytes);
+typedef BOOL (*pfnEEHeapFreeInProcessHeap)(DWORD dwFlags, LPVOID lpMem);
+
+#endif
diff --git a/src/ToolBox/superpmi/superpmi-shared/errorhandling.cpp b/src/ToolBox/superpmi/superpmi-shared/errorhandling.cpp
index ad871db..7131471 100644
--- a/src/ToolBox/superpmi/superpmi-shared/errorhandling.cpp
+++ b/src/ToolBox/superpmi/superpmi-shared/errorhandling.cpp
@@ -14,32 +14,31 @@ void MSC_ONLY(__declspec(noreturn)) ThrowException(DWORD exceptionCode)
}
// Allocating memory here seems moderately dangerous: we'll probably leak like a sieve...
-void MSC_ONLY(__declspec(noreturn)) ThrowException(DWORD exceptionCode, va_list args, const char *message)
+void MSC_ONLY(__declspec(noreturn)) ThrowException(DWORD exceptionCode, va_list args, const char* message)
{
- char *buffer = new char[8192];
- ULONG_PTR *ptr = new ULONG_PTR();
- *ptr = (ULONG_PTR)buffer;
+ char* buffer = new char[8192];
+ ULONG_PTR* ptr = new ULONG_PTR();
+ *ptr = (ULONG_PTR)buffer;
_vsnprintf_s(buffer, 8192, 8191, message, args);
RaiseException(exceptionCode, 0, 1, ptr);
}
-void MSC_ONLY(__declspec(noreturn)) ThrowException(DWORD exceptionCode, const char *msg, ...)
+void MSC_ONLY(__declspec(noreturn)) ThrowException(DWORD exceptionCode, const char* msg, ...)
{
va_list ap;
va_start(ap, msg);
ThrowException(exceptionCode, ap, msg);
}
-SpmiException::SpmiException(PEXCEPTION_POINTERS exp)
- : exCode(exp->ExceptionRecord->ExceptionCode)
+SpmiException::SpmiException(PEXCEPTION_POINTERS exp) : exCode(exp->ExceptionRecord->ExceptionCode)
{
- exMessage = (exp->ExceptionRecord->NumberParameters != 1) ? nullptr : (char *) exp->ExceptionRecord->ExceptionInformation[0];
+ exMessage =
+ (exp->ExceptionRecord->NumberParameters != 1) ? nullptr : (char*)exp->ExceptionRecord->ExceptionInformation[0];
}
SpmiException::SpmiException(DWORD exceptionCode, char* exceptionMessage)
- : exCode(exceptionCode)
- , exMessage(exceptionMessage)
+ : exCode(exceptionCode), exMessage(exceptionMessage)
{
}
@@ -51,7 +50,7 @@ SpmiException::~SpmiException()
}
#endif
-char *SpmiException::GetExceptionMessage()
+char* SpmiException::GetExceptionMessage()
{
return exMessage;
}
@@ -76,27 +75,30 @@ DWORD SpmiException::GetCode()
{
return exCode;
}
-
+
// This filter function executes the handler only for EXCEPTIONCODE_MC, otherwise it continues the handler search.
LONG FilterSuperPMIExceptions_CatchMC(PEXCEPTION_POINTERS pExceptionPointers, LPVOID lpvParam)
{
- return (pExceptionPointers->ExceptionRecord->ExceptionCode == EXCEPTIONCODE_MC) ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH;
+ return (pExceptionPointers->ExceptionRecord->ExceptionCode == EXCEPTIONCODE_MC) ? EXCEPTION_EXECUTE_HANDLER
+ : EXCEPTION_CONTINUE_SEARCH;
}
// This filter function captures the exception pointers and continues searching.
LONG FilterSuperPMIExceptions_CaptureExceptionAndContinue(PEXCEPTION_POINTERS pExceptionPointers, LPVOID lpvParam)
{
- FilterSuperPMIExceptionsParam_CaptureException* pSPMIEParam = (FilterSuperPMIExceptionsParam_CaptureException *)lpvParam;
- pSPMIEParam->exceptionPointers = *pExceptionPointers; // Capture the exception pointers for use later
- pSPMIEParam->exceptionCode = pSPMIEParam->exceptionPointers.ExceptionRecord->ExceptionCode;
+ FilterSuperPMIExceptionsParam_CaptureException* pSPMIEParam =
+ (FilterSuperPMIExceptionsParam_CaptureException*)lpvParam;
+ pSPMIEParam->exceptionPointers = *pExceptionPointers; // Capture the exception pointers for use later
+ pSPMIEParam->exceptionCode = pSPMIEParam->exceptionPointers.ExceptionRecord->ExceptionCode;
return EXCEPTION_CONTINUE_SEARCH;
}
LONG FilterSuperPMIExceptions_CaptureExceptionAndStop(PEXCEPTION_POINTERS pExceptionPointers, LPVOID lpvParam)
{
- FilterSuperPMIExceptionsParam_CaptureException* pSPMIEParam = (FilterSuperPMIExceptionsParam_CaptureException *)lpvParam;
- pSPMIEParam->exceptionPointers = *pExceptionPointers; // Capture the exception pointers for use later
- pSPMIEParam->exceptionCode = pSPMIEParam->exceptionPointers.ExceptionRecord->ExceptionCode;
+ FilterSuperPMIExceptionsParam_CaptureException* pSPMIEParam =
+ (FilterSuperPMIExceptionsParam_CaptureException*)lpvParam;
+ pSPMIEParam->exceptionPointers = *pExceptionPointers; // Capture the exception pointers for use later
+ pSPMIEParam->exceptionCode = pSPMIEParam->exceptionPointers.ExceptionRecord->ExceptionCode;
return EXCEPTION_EXECUTE_HANDLER;
}
@@ -104,23 +106,24 @@ bool IsSuperPMIException(unsigned code)
{
switch (code)
{
- case EXCEPTIONCODE_MC:
- case EXCEPTIONCODE_LWM:
- case EXCEPTIONCODE_CALLUTILS:
- case EXCEPTIONCODE_TYPEUTILS:
- case EXCEPTIONCODE_ASSERT:
- return true;
- default:
- if ((EXCEPTIONCODE_DebugBreakorAV <= code) && (code < EXCEPTIONCODE_DebugBreakorAV_MAX))
- {
+ case EXCEPTIONCODE_MC:
+ case EXCEPTIONCODE_LWM:
+ case EXCEPTIONCODE_CALLUTILS:
+ case EXCEPTIONCODE_TYPEUTILS:
+ case EXCEPTIONCODE_ASSERT:
return true;
- }
- return false;
+ default:
+ if ((EXCEPTIONCODE_DebugBreakorAV <= code) && (code < EXCEPTIONCODE_DebugBreakorAV_MAX))
+ {
+ return true;
+ }
+ return false;
}
}
-
-// This filter function executes the handler only for non-SuperPMI generated exceptions, otherwise it continues the handler search.
-// This allows for SuperPMI-thrown exceptions to pass through the JIT and be caught by the outer SuperPMI handler.
+
+// This filter function executes the handler only for non-SuperPMI generated exceptions, otherwise it continues the
+// handler search. This allows for SuperPMI-thrown exceptions to pass through the JIT and be caught by the outer
+// SuperPMI handler.
LONG FilterSuperPMIExceptions_CatchNonSuperPMIException(PEXCEPTION_POINTERS pExceptionPointers, LPVOID lpvParam)
{
return !IsSuperPMIException(pExceptionPointers->ExceptionRecord->ExceptionCode);
@@ -130,12 +133,13 @@ bool RunWithErrorTrap(void (*function)(void*), void* param)
{
bool success = true;
- struct TrapParam {
+ struct TrapParam
+ {
void (*function)(void*);
- void *param;
+ void* param;
} trapParam;
trapParam.function = function;
- trapParam.param = param;
+ trapParam.param = param;
PAL_TRY(TrapParam*, pTrapParam, &trapParam)
{
diff --git a/src/ToolBox/superpmi/superpmi-shared/errorhandling.h b/src/ToolBox/superpmi/superpmi-shared/errorhandling.h
index 412bf97..8c0cadd 100644
--- a/src/ToolBox/superpmi/superpmi-shared/errorhandling.h
+++ b/src/ToolBox/superpmi/superpmi-shared/errorhandling.h
@@ -14,32 +14,36 @@
// EXCEPTIONCODE_DebugBreakorAV is just the base exception number; calls to DebugBreakorAV()
// pass a unique number to add to this. EXCEPTIONCODE_DebugBreakorAV_MAX is the maximum number
// of this exception range.
-#define EXCEPTIONCODE_DebugBreakorAV 0xe0421000
+#define EXCEPTIONCODE_DebugBreakorAV 0xe0421000
#define EXCEPTIONCODE_DebugBreakorAV_MAX 0xe0422000
-#define EXCEPTIONCODE_MC 0xe0422000
-#define EXCEPTIONCODE_LWM 0xe0423000
-#define EXCEPTIONCODE_CALLUTILS 0xe0426000
-#define EXCEPTIONCODE_TYPEUTILS 0xe0427000
-#define EXCEPTIONCODE_ASSERT 0xe0440000
+#define EXCEPTIONCODE_MC 0xe0422000
+#define EXCEPTIONCODE_LWM 0xe0423000
+#define EXCEPTIONCODE_CALLUTILS 0xe0426000
+#define EXCEPTIONCODE_TYPEUTILS 0xe0427000
+#define EXCEPTIONCODE_ASSERT 0xe0440000
// RaiseException wrappers
void MSC_ONLY(__declspec(noreturn)) ThrowException(DWORD exceptionCode);
-void MSC_ONLY(__declspec(noreturn)) ThrowException(DWORD exceptionCode, const char *message, ...);
+void MSC_ONLY(__declspec(noreturn)) ThrowException(DWORD exceptionCode, const char* message, ...);
// Assert stuff
-#define AssertCodeMsg(expr, exCode, msg, ...) \
- do { \
- if (!(expr)) LogException(exCode, "SuperPMI assertion '%s' failed (" #msg ")", #expr, ##__VA_ARGS__); \
+#define AssertCodeMsg(expr, exCode, msg, ...) \
+ do \
+ { \
+ if (!(expr)) \
+ LogException(exCode, "SuperPMI assertion '%s' failed (" #msg ")", #expr, ##__VA_ARGS__); \
} while (0)
-#define AssertCode(expr, exCode) \
- do { \
- if (!(expr)) LogException(exCode, "SuperPMI assertion '%s' failed", #expr); \
+#define AssertCode(expr, exCode) \
+ do \
+ { \
+ if (!(expr)) \
+ LogException(exCode, "SuperPMI assertion '%s' failed", #expr); \
} while (0)
#define AssertMsg(expr, msg, ...) AssertCodeMsg(expr, EXCEPTIONCODE_ASSERT, msg, ##__VA_ARGS__)
-#define Assert(expr) AssertCode(expr, EXCEPTIONCODE_ASSERT)
+#define Assert(expr) AssertCode(expr, EXCEPTIONCODE_ASSERT)
class SpmiException
{
@@ -54,7 +58,7 @@ public:
~SpmiException();
#endif
- char *GetExceptionMessage();
+ char* GetExceptionMessage();
DWORD GetCode();
void ShowAndDeleteMessage();
@@ -72,15 +76,15 @@ struct FilterSuperPMIExceptionsParam_CaptureException
EXCEPTION_POINTERS exceptionPointers;
DWORD exceptionCode;
- FilterSuperPMIExceptionsParam_CaptureException()
- : exceptionCode(0)
+ FilterSuperPMIExceptionsParam_CaptureException() : exceptionCode(0)
{
exceptionPointers.ExceptionRecord = nullptr;
- exceptionPointers.ContextRecord = nullptr;
+ exceptionPointers.ContextRecord = nullptr;
}
};
-extern LONG FilterSuperPMIExceptions_CaptureExceptionAndContinue(PEXCEPTION_POINTERS pExceptionPointers, LPVOID lpvParam);
+extern LONG FilterSuperPMIExceptions_CaptureExceptionAndContinue(PEXCEPTION_POINTERS pExceptionPointers,
+ LPVOID lpvParam);
extern LONG FilterSuperPMIExceptions_CaptureExceptionAndStop(PEXCEPTION_POINTERS pExceptionPointers, LPVOID lpvParam);
extern bool RunWithErrorTrap(void (*function)(void*), void* param);
diff --git a/src/ToolBox/superpmi/superpmi-shared/icorjitcompilerimpl.h b/src/ToolBox/superpmi/superpmi-shared/icorjitcompilerimpl.h
index 0e36562..28d67c2 100644
--- a/src/ToolBox/superpmi/superpmi-shared/icorjitcompilerimpl.h
+++ b/src/ToolBox/superpmi/superpmi-shared/icorjitcompilerimpl.h
@@ -16,55 +16,53 @@
// against the interface declaration.
public:
- // compileMethod is the main routine to ask the JIT Compiler to create native code for a method. The
- // method to be compiled is passed in the 'info' parameter, and the code:ICorJitInfo is used to allow the
- // JIT to resolve tokens, and make any other callbacks needed to create the code. nativeEntry, and
- // nativeSizeOfCode are just for convenience because the JIT asks the EE for the memory to emit code into
- // (see code:ICorJitInfo.allocMem), so really the EE already knows where the method starts and how big
- // it is (in fact, it could be in more than one chunk).
- //
- // * In the 32 bit jit this is implemented by code:CILJit.compileMethod
- // * For the 64 bit jit this is implemented by code:PreJit.compileMethod
- //
- // Note: Obfuscators that are hacking the JIT depend on this method having __stdcall calling convention
- CorJitResult __stdcall compileMethod (
- ICorJitInfo *comp, /* IN */
- struct CORINFO_METHOD_INFO *info, /* IN */
- unsigned /* code:CorJitFlag */ flags, /* IN */
- BYTE **nativeEntry, /* OUT */
- ULONG *nativeSizeOfCode /* OUT */
- );
+// compileMethod is the main routine to ask the JIT Compiler to create native code for a method. The
+// method to be compiled is passed in the 'info' parameter, and the code:ICorJitInfo is used to allow the
+// JIT to resolve tokens, and make any other callbacks needed to create the code. nativeEntry, and
+// nativeSizeOfCode are just for convenience because the JIT asks the EE for the memory to emit code into
+// (see code:ICorJitInfo.allocMem), so really the EE already knows where the method starts and how big
+// it is (in fact, it could be in more than one chunk).
+//
+// * In the 32 bit jit this is implemented by code:CILJit.compileMethod
+// * For the 64 bit jit this is implemented by code:PreJit.compileMethod
+//
+// Note: Obfuscators that are hacking the JIT depend on this method having __stdcall calling convention
+CorJitResult __stdcall compileMethod(ICorJitInfo* comp, /* IN */
+ struct CORINFO_METHOD_INFO* info, /* IN */
+ unsigned /* code:CorJitFlag */ flags, /* IN */
+ BYTE** nativeEntry, /* OUT */
+ ULONG* nativeSizeOfCode /* OUT */
+ );
- // Some JIT compilers (most notably Phoenix), cache information about EE structures from one invocation
- // of the compiler to the next. This can be a problem when appdomains are unloaded, as some of this
- // cached information becomes stale. The code:ICorJitCompiler.isCacheCleanupRequired is called by the EE
- // early first to see if jit needs these notifications, and if so, the EE will call ClearCache is called
- // whenever the compiler should abandon its cache (eg on appdomain unload)
- void clearCache();
- BOOL isCacheCleanupRequired();
+// Some JIT compilers (most notably Phoenix), cache information about EE structures from one invocation
+// of the compiler to the next. This can be a problem when appdomains are unloaded, as some of this
+// cached information becomes stale. The code:ICorJitCompiler.isCacheCleanupRequired is called by the EE
+// early first to see if jit needs these notifications, and if so, the EE will call ClearCache is called
+// whenever the compiler should abandon its cache (eg on appdomain unload)
+void clearCache();
+BOOL isCacheCleanupRequired();
- // Do any appropriate work at process shutdown. Default impl is to do nothing.
- void ProcessShutdownWork(ICorStaticInfo* info); /* {}; */
+// Do any appropriate work at process shutdown. Default impl is to do nothing.
+void ProcessShutdownWork(ICorStaticInfo* info); /* {}; */
- // The EE asks the JIT for a "version identifier". This represents the version of the JIT/EE interface.
- // If the JIT doesn't implement the same JIT/EE interface expected by the EE (because the JIT doesn't
- // return the version identifier that the EE expects), then the EE fails to load the JIT.
- //
- void getVersionIdentifier(
- GUID* versionIdentifier /* OUT */
- );
+// The EE asks the JIT for a "version identifier". This represents the version of the JIT/EE interface.
+// If the JIT doesn't implement the same JIT/EE interface expected by the EE (because the JIT doesn't
+// return the version identifier that the EE expects), then the EE fails to load the JIT.
+//
+void getVersionIdentifier(GUID* versionIdentifier /* OUT */
+ );
- // When the EE loads the System.Numerics.Vectors assembly, it asks the JIT what length (in bytes) of
- // SIMD vector it supports as an intrinsic type. Zero means that the JIT does not support SIMD
- // intrinsics, so the EE should use the default size (i.e. the size of the IL implementation).
- unsigned getMaxIntrinsicSIMDVectorLength(CORJIT_FLAGS cpuCompileFlags); /* { return 0; } */
+// When the EE loads the System.Numerics.Vectors assembly, it asks the JIT what length (in bytes) of
+// SIMD vector it supports as an intrinsic type. Zero means that the JIT does not support SIMD
+// intrinsics, so the EE should use the default size (i.e. the size of the IL implementation).
+unsigned getMaxIntrinsicSIMDVectorLength(CORJIT_FLAGS cpuCompileFlags); /* { return 0; } */
- // IL obfuscators sometimes interpose on the EE-JIT interface. This function allows the VM to
- // tell the JIT to use a particular ICorJitCompiler to implement the methods of this interface,
- // and not to implement those methods itself. The JIT must not return this method when getJit()
- // is called. Instead, it must pass along all calls to this interface from within its own
- // ICorJitCompiler implementation. If 'realJitCompiler' is nullptr, then the JIT should resume
- // executing all the functions itself.
- void setRealJit(ICorJitCompiler* realJitCompiler); /* { } */
+// IL obfuscators sometimes interpose on the EE-JIT interface. This function allows the VM to
+// tell the JIT to use a particular ICorJitCompiler to implement the methods of this interface,
+// and not to implement those methods itself. The JIT must not return this method when getJit()
+// is called. Instead, it must pass along all calls to this interface from within its own
+// ICorJitCompiler implementation. If 'realJitCompiler' is nullptr, then the JIT should resume
+// executing all the functions itself.
+void setRealJit(ICorJitCompiler* realJitCompiler); /* { } */
#endif
diff --git a/src/ToolBox/superpmi/superpmi-shared/icorjithostimpl.h b/src/ToolBox/superpmi/superpmi-shared/icorjithostimpl.h
index 8bd09e5..aac6842 100644
--- a/src/ToolBox/superpmi/superpmi-shared/icorjithostimpl.h
+++ b/src/ToolBox/superpmi/superpmi-shared/icorjithostimpl.h
@@ -23,33 +23,26 @@
// against the interface declaration.
public:
- // Allocate memory of the given size in bytes. All bytes of the returned block
- // must be initialized to zero. If `usePageAllocator` is true, the implementation
- // should use an allocator that deals in OS pages if one exists.
- void* allocateMemory(size_t size, bool usePageAllocator = false);
-
- // Frees memory previous obtained by a call to `ICorJitHost::allocateMemory`. The
- // value of the `usePageAllocator` parameter must match the value that was
- // provided to the call to used to allocate the memory.
- void freeMemory(void* block, bool usePageAllocator = false);
-
- // Return an integer config value for the given key, if any exists.
- int getIntConfigValue(
- const wchar_t* name,
- int defaultValue
- );
-
- // Return a string config value for the given key, if any exists.
- const wchar_t* getStringConfigValue(
- const wchar_t* name
- );
-
- // Free a string ConfigValue returned by the runtime.
- // JITs using the getStringConfigValue query are required
- // to return the string values to the runtime for deletion.
- // This avoids leaking the memory in the JIT.
- void freeStringConfigValue(
- const wchar_t* value
- );
+// Allocate memory of the given size in bytes. All bytes of the returned block
+// must be initialized to zero. If `usePageAllocator` is true, the implementation
+// should use an allocator that deals in OS pages if one exists.
+void* allocateMemory(size_t size, bool usePageAllocator = false);
+
+// Frees memory previous obtained by a call to `ICorJitHost::allocateMemory`. The
+// value of the `usePageAllocator` parameter must match the value that was
+// provided to the call to used to allocate the memory.
+void freeMemory(void* block, bool usePageAllocator = false);
+
+// Return an integer config value for the given key, if any exists.
+int getIntConfigValue(const wchar_t* name, int defaultValue);
+
+// Return a string config value for the given key, if any exists.
+const wchar_t* getStringConfigValue(const wchar_t* name);
+
+// Free a string ConfigValue returned by the runtime.
+// JITs using the getStringConfigValue query are required
+// to return the string values to the runtime for deletion.
+// This avoids leaking the memory in the JIT.
+void freeStringConfigValue(const wchar_t* value);
#endif
diff --git a/src/ToolBox/superpmi/superpmi-shared/icorjitinfoimpl.h b/src/ToolBox/superpmi/superpmi-shared/icorjitinfoimpl.h
index 0c5b269..19feffa 100644
--- a/src/ToolBox/superpmi/superpmi-shared/icorjitinfoimpl.h
+++ b/src/ToolBox/superpmi/superpmi-shared/icorjitinfoimpl.h
@@ -16,791 +16,627 @@
// against the interface declaration.
public:
- /**********************************************************************************/
- //
- // ICorMethodInfo
- //
- /**********************************************************************************/
-
- // return flags (defined above, CORINFO_FLG_PUBLIC ...)
- DWORD getMethodAttribs (
- CORINFO_METHOD_HANDLE ftn /* IN */
- );
-
- // sets private JIT flags, which can be, retrieved using getAttrib.
- void setMethodAttribs (
- CORINFO_METHOD_HANDLE ftn, /* IN */
- CorInfoMethodRuntimeFlags attribs /* IN */
- );
-
- // Given a method descriptor ftnHnd, extract signature information into sigInfo
- //
- // 'memberParent' is typically only set when verifying. It should be the
- // result of calling getMemberParent.
- void getMethodSig (
- CORINFO_METHOD_HANDLE ftn, /* IN */
- CORINFO_SIG_INFO *sig, /* OUT */
- CORINFO_CLASS_HANDLE memberParent = NULL /* IN */
- );
+/**********************************************************************************/
+//
+// ICorMethodInfo
+//
+/**********************************************************************************/
- /*********************************************************************
- * Note the following methods can only be used on functions known
- * to be IL. This includes the method being compiled and any method
- * that 'getMethodInfo' returns true for
- *********************************************************************/
-
- // return information about a method private to the implementation
- // returns false if method is not IL, or is otherwise unavailable.
- // This method is used to fetch data needed to inline functions
- bool getMethodInfo (
- CORINFO_METHOD_HANDLE ftn, /* IN */
- CORINFO_METHOD_INFO* info /* OUT */
- );
-
- // Decides if you have any limitations for inlining. If everything's OK, it will return
- // INLINE_PASS and will fill out pRestrictions with a mask of restrictions the caller of this
- // function must respect. If caller passes pRestrictions = NULL, if there are any restrictions
- // INLINE_FAIL will be returned
- //
- // The callerHnd must be the immediate caller (i.e. when we have a chain of inlined calls)
- //
- // The inlined method need not be verified
-
- CorInfoInline canInline (
- CORINFO_METHOD_HANDLE callerHnd, /* IN */
- CORINFO_METHOD_HANDLE calleeHnd, /* IN */
- DWORD* pRestrictions /* OUT */
- );
-
- // Reports whether or not a method can be inlined, and why. canInline is responsible for reporting all
- // inlining results when it returns INLINE_FAIL and INLINE_NEVER. All other results are reported by the
- // JIT.
- void reportInliningDecision (CORINFO_METHOD_HANDLE inlinerHnd,
- CORINFO_METHOD_HANDLE inlineeHnd,
- CorInfoInline inlineResult,
- const char * reason);
-
-
- // Returns false if the call is across security boundaries thus we cannot tailcall
- //
- // The callerHnd must be the immediate caller (i.e. when we have a chain of inlined calls)
- bool canTailCall (
- CORINFO_METHOD_HANDLE callerHnd, /* IN */
- CORINFO_METHOD_HANDLE declaredCalleeHnd, /* IN */
- CORINFO_METHOD_HANDLE exactCalleeHnd, /* IN */
- bool fIsTailPrefix /* IN */
- );
-
- // Reports whether or not a method can be tail called, and why.
- // canTailCall is responsible for reporting all results when it returns
- // false. All other results are reported by the JIT.
- void reportTailCallDecision (CORINFO_METHOD_HANDLE callerHnd,
- CORINFO_METHOD_HANDLE calleeHnd,
- bool fIsTailPrefix,
- CorInfoTailCall tailCallResult,
- const char * reason);
-
- // get individual exception handler
- void getEHinfo(
- CORINFO_METHOD_HANDLE ftn, /* IN */
- unsigned EHnumber, /* IN */
- CORINFO_EH_CLAUSE* clause /* OUT */
- );
-
- // return class it belongs to
- CORINFO_CLASS_HANDLE getMethodClass (
- CORINFO_METHOD_HANDLE method
- );
-
- // return module it belongs to
- CORINFO_MODULE_HANDLE getMethodModule (
- CORINFO_METHOD_HANDLE method
- );
-
- // This function returns the offset of the specified method in the
- // vtable of it's owning class or interface.
- void getMethodVTableOffset (
- CORINFO_METHOD_HANDLE method, /* IN */
- unsigned* offsetOfIndirection, /* OUT */
- unsigned* offsetAfterIndirection /* OUT */
- );
-
- // Find the virtual method in implementingClass that overrides virtualMethod.
- // Return null if devirtualization is not possible.
- CORINFO_METHOD_HANDLE resolveVirtualMethod(
- CORINFO_METHOD_HANDLE virtualMethod,
- CORINFO_CLASS_HANDLE implementingClass,
- CORINFO_CONTEXT_HANDLE ownerType
- );
-
- // If a method's attributes have (getMethodAttribs) CORINFO_FLG_INTRINSIC set,
- // getIntrinsicID() returns the intrinsic ID.
- // *pMustExpand tells whether or not JIT must expand the intrinsic.
- CorInfoIntrinsics getIntrinsicID(
- CORINFO_METHOD_HANDLE method,
- bool* pMustExpand = NULL /* OUT */
- );
-
- // Is the given module the System.Numerics.Vectors module?
- // This defaults to false.
- bool isInSIMDModule(
- CORINFO_CLASS_HANDLE classHnd
- ); /* { return false; } */
-
- // return the unmanaged calling convention for a PInvoke
- CorInfoUnmanagedCallConv getUnmanagedCallConv(
- CORINFO_METHOD_HANDLE method
- );
-
- // return if any marshaling is required for PInvoke methods. Note that
- // method == 0 => calli. The call site sig is only needed for the varargs or calli case
- BOOL pInvokeMarshalingRequired(
- CORINFO_METHOD_HANDLE method,
- CORINFO_SIG_INFO* callSiteSig
- );
-
- // Check constraints on method type arguments (only).
- // The parent class should be checked separately using satisfiesClassConstraints(parent).
- BOOL satisfiesMethodConstraints(
- CORINFO_CLASS_HANDLE parent, // the exact parent of the method
- CORINFO_METHOD_HANDLE method
- );
-
- // Given a delegate target class, a target method parent class, a target method,
- // a delegate class, check if the method signature is compatible with the Invoke method of the delegate
- // (under the typical instantiation of any free type variables in the memberref signatures).
- BOOL isCompatibleDelegate(
- CORINFO_CLASS_HANDLE objCls, /* type of the delegate target, if any */
- CORINFO_CLASS_HANDLE methodParentCls, /* exact parent of the target method, if any */
- CORINFO_METHOD_HANDLE method, /* (representative) target method, if any */
- CORINFO_CLASS_HANDLE delegateCls, /* exact type of the delegate */
- BOOL *pfIsOpenDelegate /* is the delegate open */
- );
-
- // Determines whether the delegate creation obeys security transparency rules
- BOOL isDelegateCreationAllowed (
- CORINFO_CLASS_HANDLE delegateHnd,
- CORINFO_METHOD_HANDLE calleeHnd
- );
-
-
- // Indicates if the method is an instance of the generic
- // method that passes (or has passed) verification
- CorInfoInstantiationVerification isInstantiationOfVerifiedGeneric (
- CORINFO_METHOD_HANDLE method /* IN */
- );
-
- // Loads the constraints on a typical method definition, detecting cycles;
- // for use in verification.
- void initConstraintsForVerification(
- CORINFO_METHOD_HANDLE method, /* IN */
- BOOL *pfHasCircularClassConstraints, /* OUT */
- BOOL *pfHasCircularMethodConstraint /* OUT */
- );
-
- // Returns enum whether the method does not require verification
- // Also see ICorModuleInfo::canSkipVerification
- CorInfoCanSkipVerificationResult canSkipMethodVerification (
- CORINFO_METHOD_HANDLE ftnHandle
- );
-
- // load and restore the method
- void methodMustBeLoadedBeforeCodeIsRun(
- CORINFO_METHOD_HANDLE method
- );
-
- CORINFO_METHOD_HANDLE mapMethodDeclToMethodImpl(
- CORINFO_METHOD_HANDLE method
- );
-
- // Returns the global cookie for the /GS unsafe buffer checks
- // The cookie might be a constant value (JIT), or a handle to memory location (Ngen)
- void getGSCookie(
- GSCookie * pCookieVal, // OUT
- GSCookie ** ppCookieVal // OUT
- );
-
- /**********************************************************************************/
- //
- // ICorModuleInfo
- //
- /**********************************************************************************/
-
- // Resolve metadata token into runtime method handles. This function may not
- // return normally (e.g. it may throw) if it encounters invalid metadata or other
- // failures during token resolution.
- void resolveToken(/* IN, OUT */ CORINFO_RESOLVED_TOKEN * pResolvedToken);
-
- // Attempt to resolve a metadata token into a runtime method handle. Returns true
- // if resolution succeeded and false otherwise (e.g. if it encounters invalid metadata
- // during token reoslution). This method should be used instead of `resolveToken` in
- // situations that need to be resilient to invalid metadata.
- bool tryResolveToken(/* IN, OUT */ CORINFO_RESOLVED_TOKEN * pResolvedToken);
-
- // Signature information about the call sig
- void findSig (
- CORINFO_MODULE_HANDLE module, /* IN */
- unsigned sigTOK, /* IN */
- CORINFO_CONTEXT_HANDLE context, /* IN */
- CORINFO_SIG_INFO *sig /* OUT */
- );
-
- // for Varargs, the signature at the call site may differ from
- // the signature at the definition. Thus we need a way of
- // fetching the call site information
- void findCallSiteSig (
- CORINFO_MODULE_HANDLE module, /* IN */
- unsigned methTOK, /* IN */
- CORINFO_CONTEXT_HANDLE context, /* IN */
- CORINFO_SIG_INFO *sig /* OUT */
- );
-
- CORINFO_CLASS_HANDLE getTokenTypeAsHandle (
- CORINFO_RESOLVED_TOKEN * pResolvedToken /* IN */);
-
- // Returns true if the module does not require verification
- //
- // If fQuickCheckOnlyWithoutCommit=TRUE, the function only checks that the
- // module does not currently require verification in the current AppDomain.
- // This decision could change in the future, and so should not be cached.
- // If it is cached, it should only be used as a hint.
- // This is only used by ngen for calculating certain hints.
- //
-
- // Returns enum whether the module does not require verification
- // Also see ICorMethodInfo::canSkipMethodVerification();
- CorInfoCanSkipVerificationResult canSkipVerification (
- CORINFO_MODULE_HANDLE module /* IN */
- );
-
- // Checks if the given metadata token is valid
- BOOL isValidToken (
- CORINFO_MODULE_HANDLE module, /* IN */
- unsigned metaTOK /* IN */
- );
-
- // Checks if the given metadata token is valid StringRef
- BOOL isValidStringRef (
- CORINFO_MODULE_HANDLE module, /* IN */
- unsigned metaTOK /* IN */
- );
-
- BOOL shouldEnforceCallvirtRestriction(
- CORINFO_MODULE_HANDLE scope
- );
-
- /**********************************************************************************/
- //
- // ICorClassInfo
- //
- /**********************************************************************************/
-
- // If the value class 'cls' is isomorphic to a primitive type it will
- // return that type, otherwise it will return CORINFO_TYPE_VALUECLASS
- CorInfoType asCorInfoType (
- CORINFO_CLASS_HANDLE cls
- );
-
- // for completeness
- const char* getClassName (
- CORINFO_CLASS_HANDLE cls
- );
-
-
- // Append a (possibly truncated) representation of the type cls to the preallocated buffer ppBuf of length pnBufLen
- // If fNamespace=TRUE, include the namespace/enclosing classes
- // If fFullInst=TRUE (regardless of fNamespace and fAssembly), include namespace and assembly for any type parameters
- // If fAssembly=TRUE, suffix with a comma and the full assembly qualification
- // return size of representation
- int appendClassName(
- __deref_inout_ecount(*pnBufLen) WCHAR** ppBuf,
- int* pnBufLen,
- CORINFO_CLASS_HANDLE cls,
- BOOL fNamespace,
- BOOL fFullInst,
- BOOL fAssembly
- );
-
- // Quick check whether the type is a value class. Returns the same value as getClassAttribs(cls) & CORINFO_FLG_VALUECLASS, except faster.
- BOOL isValueClass(CORINFO_CLASS_HANDLE cls);
-
- // If this method returns true, JIT will do optimization to inline the check for
- // GetTypeFromHandle(handle) == obj.GetType()
- BOOL canInlineTypeCheckWithObjectVTable(CORINFO_CLASS_HANDLE cls);
-
- // return flags (defined above, CORINFO_FLG_PUBLIC ...)
- DWORD getClassAttribs (
- CORINFO_CLASS_HANDLE cls
- );
-
- // Returns "TRUE" iff "cls" is a struct type such that return buffers used for returning a value
- // of this type must be stack-allocated. This will generally be true only if the struct
- // contains GC pointers, and does not exceed some size limit. Maintaining this as an invariant allows
- // an optimization: the JIT may assume that return buffer pointers for return types for which this predicate
- // returns TRUE are always stack allocated, and thus, that stores to the GC-pointer fields of such return
- // buffers do not require GC write barriers.
- BOOL isStructRequiringStackAllocRetBuf(CORINFO_CLASS_HANDLE cls);
-
- CORINFO_MODULE_HANDLE getClassModule (
- CORINFO_CLASS_HANDLE cls
- );
-
- // Returns the assembly that contains the module "mod".
- CORINFO_ASSEMBLY_HANDLE getModuleAssembly (
- CORINFO_MODULE_HANDLE mod
- );
-
- // Returns the name of the assembly "assem".
- const char* getAssemblyName (
- CORINFO_ASSEMBLY_HANDLE assem
- );
-
- // Allocate and delete process-lifetime objects. Should only be
- // referred to from static fields, lest a leak occur.
- // Note that "LongLifetimeFree" does not execute destructors, if "obj"
- // is an array of a struct type with a destructor.
- void* LongLifetimeMalloc(size_t sz);
- void LongLifetimeFree(void* obj);
-
- size_t getClassModuleIdForStatics (
- CORINFO_CLASS_HANDLE cls,
- CORINFO_MODULE_HANDLE *pModule,
- void **ppIndirection
- );
-
- // return the number of bytes needed by an instance of the class
- unsigned getClassSize (
- CORINFO_CLASS_HANDLE cls
- );
-
- unsigned getClassAlignmentRequirement (
- CORINFO_CLASS_HANDLE cls,
- BOOL fDoubleAlignHint = FALSE
- );
-
- // This is only called for Value classes. It returns a boolean array
- // in representing of 'cls' from a GC perspective. The class is
- // assumed to be an array of machine words
- // (of length // getClassSize(cls) / sizeof(void*)),
- // 'gcPtrs' is a pointer to an array of BYTEs of this length.
- // getClassGClayout fills in this array so that gcPtrs[i] is set
- // to one of the CorInfoGCType values which is the GC type of
- // the i-th machine word of an object of type 'cls'
- // returns the number of GC pointers in the array
- unsigned getClassGClayout (
- CORINFO_CLASS_HANDLE cls, /* IN */
- BYTE *gcPtrs /* OUT */
- );
-
- // returns the number of instance fields in a class
- unsigned getClassNumInstanceFields (
- CORINFO_CLASS_HANDLE cls /* IN */
- );
-
- CORINFO_FIELD_HANDLE getFieldInClass(
- CORINFO_CLASS_HANDLE clsHnd,
- INT num
- );
-
- BOOL checkMethodModifier(
- CORINFO_METHOD_HANDLE hMethod,
- LPCSTR modifier,
- BOOL fOptional
- );
-
- // returns the "NEW" helper optimized for "newCls."
- CorInfoHelpFunc getNewHelper(
- CORINFO_RESOLVED_TOKEN * pResolvedToken,
- CORINFO_METHOD_HANDLE callerHandle
- );
-
- // returns the newArr (1-Dim array) helper optimized for "arrayCls."
- CorInfoHelpFunc getNewArrHelper(
- CORINFO_CLASS_HANDLE arrayCls
- );
-
- // returns the optimized "IsInstanceOf" or "ChkCast" helper
- CorInfoHelpFunc getCastingHelper(
- CORINFO_RESOLVED_TOKEN * pResolvedToken,
- bool fThrowing
- );
-
- // returns helper to trigger static constructor
- CorInfoHelpFunc getSharedCCtorHelper(
- CORINFO_CLASS_HANDLE clsHnd
- );
-
- CorInfoHelpFunc getSecurityPrologHelper(
- CORINFO_METHOD_HANDLE ftn
- );
-
- // This is not pretty. Boxing nullable<T> actually returns
- // a boxed<T> not a boxed Nullable<T>. This call allows the verifier
- // to call back to the EE on the 'box' instruction and get the transformed
- // type to use for verification.
- CORINFO_CLASS_HANDLE getTypeForBox(
- CORINFO_CLASS_HANDLE cls
- );
-
- // returns the correct box helper for a particular class. Note
- // that if this returns CORINFO_HELP_BOX, the JIT can assume
- // 'standard' boxing (allocate object and copy), and optimize
- CorInfoHelpFunc getBoxHelper(
- CORINFO_CLASS_HANDLE cls
- );
-
- // returns the unbox helper. If 'helperCopies' points to a true
- // value it means the JIT is requesting a helper that unboxes the
- // value into a particular location and thus has the signature
- // void unboxHelper(void* dest, CORINFO_CLASS_HANDLE cls, Object* obj)
- // Otherwise (it is null or points at a FALSE value) it is requesting
- // a helper that returns a pointer to the unboxed data
- // void* unboxHelper(CORINFO_CLASS_HANDLE cls, Object* obj)
- // The EE has the option of NOT returning the copy style helper
- // (But must be able to always honor the non-copy style helper)
- // The EE set 'helperCopies' on return to indicate what kind of
- // helper has been created.
-
- CorInfoHelpFunc getUnBoxHelper(
- CORINFO_CLASS_HANDLE cls
- );
-
- bool getReadyToRunHelper(
- CORINFO_RESOLVED_TOKEN * pResolvedToken,
- CORINFO_LOOKUP_KIND * pGenericLookupKind,
- CorInfoHelpFunc id,
- CORINFO_CONST_LOOKUP * pLookup
- );
-
- void getReadyToRunDelegateCtorHelper(
- CORINFO_RESOLVED_TOKEN * pTargetMethod,
- CORINFO_CLASS_HANDLE delegateType,
- CORINFO_LOOKUP * pLookup
- );
-
- const char* getHelperName(
- CorInfoHelpFunc
- );
-
- // This function tries to initialize the class (run the class constructor).
- // this function returns whether the JIT must insert helper calls before
- // accessing static field or method.
- //
- // See code:ICorClassInfo#ClassConstruction.
- CorInfoInitClassResult initClass(
- CORINFO_FIELD_HANDLE field, // Non-NULL - inquire about cctor trigger before static field access
- // NULL - inquire about cctor trigger in method prolog
- CORINFO_METHOD_HANDLE method, // Method referencing the field or prolog
- CORINFO_CONTEXT_HANDLE context, // Exact context of method
- BOOL speculative = FALSE // TRUE means don't actually run it
- );
-
- // This used to be called "loadClass". This records the fact
- // that the class must be loaded (including restored if necessary) before we execute the
- // code that we are currently generating. When jitting code
- // the function loads the class immediately. When zapping code
- // the zapper will if necessary use the call to record the fact that we have
- // to do a fixup/restore before running the method currently being generated.
- //
- // This is typically used to ensure value types are loaded before zapped
- // code that manipulates them is executed, so that the GC can access information
- // about those value types.
- void classMustBeLoadedBeforeCodeIsRun(
- CORINFO_CLASS_HANDLE cls
- );
-
- // returns the class handle for the special builtin classes
- CORINFO_CLASS_HANDLE getBuiltinClass (
- CorInfoClassId classId
- );
-
- // "System.Int32" ==> CORINFO_TYPE_INT..
- CorInfoType getTypeForPrimitiveValueClass(
- CORINFO_CLASS_HANDLE cls
- );
-
- // TRUE if child is a subtype of parent
- // if parent is an interface, then does child implement / extend parent
- BOOL canCast(
- CORINFO_CLASS_HANDLE child, // subtype (extends parent)
- CORINFO_CLASS_HANDLE parent // base type
- );
-
- // TRUE if cls1 and cls2 are considered equivalent types.
- BOOL areTypesEquivalent(
- CORINFO_CLASS_HANDLE cls1,
- CORINFO_CLASS_HANDLE cls2
- );
-
- // returns is the intersection of cls1 and cls2.
- CORINFO_CLASS_HANDLE mergeClasses(
- CORINFO_CLASS_HANDLE cls1,
- CORINFO_CLASS_HANDLE cls2
- );
-
- // Given a class handle, returns the Parent type.
- // For COMObjectType, it returns Class Handle of System.Object.
- // Returns 0 if System.Object is passed in.
- CORINFO_CLASS_HANDLE getParentType (
- CORINFO_CLASS_HANDLE cls
- );
-
- // Returns the CorInfoType of the "child type". If the child type is
- // not a primitive type, *clsRet will be set.
- // Given an Array of Type Foo, returns Foo.
- // Given BYREF Foo, returns Foo
- CorInfoType getChildType (
- CORINFO_CLASS_HANDLE clsHnd,
- CORINFO_CLASS_HANDLE *clsRet
- );
-
- // Check constraints on type arguments of this class and parent classes
- BOOL satisfiesClassConstraints(
- CORINFO_CLASS_HANDLE cls
- );
-
- // Check if this is a single dimensional array type
- BOOL isSDArray(
- CORINFO_CLASS_HANDLE cls
- );
-
- // Get the numbmer of dimensions in an array
- unsigned getArrayRank(
- CORINFO_CLASS_HANDLE cls
- );
-
- // Get static field data for an array
- void * getArrayInitializationData(
- CORINFO_FIELD_HANDLE field,
- DWORD size
- );
-
- // Check Visibility rules.
- CorInfoIsAccessAllowedResult canAccessClass(
- CORINFO_RESOLVED_TOKEN * pResolvedToken,
- CORINFO_METHOD_HANDLE callerHandle,
- CORINFO_HELPER_DESC *pAccessHelper /* If canAccessMethod returns something other
- than ALLOWED, then this is filled in. */
- );
+// return flags (defined above, CORINFO_FLG_PUBLIC ...)
+DWORD getMethodAttribs(CORINFO_METHOD_HANDLE ftn /* IN */
+ );
- /**********************************************************************************/
- //
- // ICorFieldInfo
- //
- /**********************************************************************************/
-
- // this function is for debugging only. It returns the field name
- // and if 'moduleName' is non-null, it sets it to something that will
- // says which method (a class name, or a module name)
- const char* getFieldName (
- CORINFO_FIELD_HANDLE ftn, /* IN */
- const char **moduleName /* OUT */
- );
+// sets private JIT flags, which can be, retrieved using getAttrib.
+void setMethodAttribs(CORINFO_METHOD_HANDLE ftn, /* IN */
+ CorInfoMethodRuntimeFlags attribs /* IN */
+ );
- // return class it belongs to
- CORINFO_CLASS_HANDLE getFieldClass (
- CORINFO_FIELD_HANDLE field
- );
+// Given a method descriptor ftnHnd, extract signature information into sigInfo
+//
+// 'memberParent' is typically only set when verifying. It should be the
+// result of calling getMemberParent.
+void getMethodSig(CORINFO_METHOD_HANDLE ftn, /* IN */
+ CORINFO_SIG_INFO* sig, /* OUT */
+ CORINFO_CLASS_HANDLE memberParent = NULL /* IN */
+ );
+
+/*********************************************************************
+ * Note the following methods can only be used on functions known
+ * to be IL. This includes the method being compiled and any method
+ * that 'getMethodInfo' returns true for
+ *********************************************************************/
+
+// return information about a method private to the implementation
+// returns false if method is not IL, or is otherwise unavailable.
+// This method is used to fetch data needed to inline functions
+bool getMethodInfo(CORINFO_METHOD_HANDLE ftn, /* IN */
+ CORINFO_METHOD_INFO* info /* OUT */
+ );
+
+// Decides if you have any limitations for inlining. If everything's OK, it will return
+// INLINE_PASS and will fill out pRestrictions with a mask of restrictions the caller of this
+// function must respect. If caller passes pRestrictions = NULL, if there are any restrictions
+// INLINE_FAIL will be returned
+//
+// The callerHnd must be the immediate caller (i.e. when we have a chain of inlined calls)
+//
+// The inlined method need not be verified
- // Return the field's type, if it is CORINFO_TYPE_VALUECLASS 'structType' is set
- // the field's value class (if 'structType' == 0, then don't bother
- // the structure info).
- //
- // 'memberParent' is typically only set when verifying. It should be the
- // result of calling getMemberParent.
- CorInfoType getFieldType(
- CORINFO_FIELD_HANDLE field,
- CORINFO_CLASS_HANDLE *structType,
- CORINFO_CLASS_HANDLE memberParent = NULL /* IN */
+CorInfoInline canInline(CORINFO_METHOD_HANDLE callerHnd, /* IN */
+ CORINFO_METHOD_HANDLE calleeHnd, /* IN */
+ DWORD* pRestrictions /* OUT */
);
- // return the data member's instance offset
- unsigned getFieldOffset(
- CORINFO_FIELD_HANDLE field
- );
+// Reports whether or not a method can be inlined, and why. canInline is responsible for reporting all
+// inlining results when it returns INLINE_FAIL and INLINE_NEVER. All other results are reported by the
+// JIT.
+void reportInliningDecision(CORINFO_METHOD_HANDLE inlinerHnd,
+ CORINFO_METHOD_HANDLE inlineeHnd,
+ CorInfoInline inlineResult,
+ const char* reason);
+
+// Returns false if the call is across security boundaries thus we cannot tailcall
+//
+// The callerHnd must be the immediate caller (i.e. when we have a chain of inlined calls)
+bool canTailCall(CORINFO_METHOD_HANDLE callerHnd, /* IN */
+ CORINFO_METHOD_HANDLE declaredCalleeHnd, /* IN */
+ CORINFO_METHOD_HANDLE exactCalleeHnd, /* IN */
+ bool fIsTailPrefix /* IN */
+ );
+
+// Reports whether or not a method can be tail called, and why.
+// canTailCall is responsible for reporting all results when it returns
+// false. All other results are reported by the JIT.
+void reportTailCallDecision(CORINFO_METHOD_HANDLE callerHnd,
+ CORINFO_METHOD_HANDLE calleeHnd,
+ bool fIsTailPrefix,
+ CorInfoTailCall tailCallResult,
+ const char* reason);
+
+// get individual exception handler
+void getEHinfo(CORINFO_METHOD_HANDLE ftn, /* IN */
+ unsigned EHnumber, /* IN */
+ CORINFO_EH_CLAUSE* clause /* OUT */
+ );
+
+// return class it belongs to
+CORINFO_CLASS_HANDLE getMethodClass(CORINFO_METHOD_HANDLE method);
+
+// return module it belongs to
+CORINFO_MODULE_HANDLE getMethodModule(CORINFO_METHOD_HANDLE method);
+
+// This function returns the offset of the specified method in the
+// vtable of it's owning class or interface.
+void getMethodVTableOffset(CORINFO_METHOD_HANDLE method, /* IN */
+ unsigned* offsetOfIndirection, /* OUT */
+ unsigned* offsetAfterIndirection /* OUT */
+ );
+
+// Find the virtual method in implementingClass that overrides virtualMethod.
+// Return null if devirtualization is not possible.
+CORINFO_METHOD_HANDLE resolveVirtualMethod(CORINFO_METHOD_HANDLE virtualMethod,
+ CORINFO_CLASS_HANDLE implementingClass,
+ CORINFO_CONTEXT_HANDLE ownerType);
+
+// If a method's attributes have (getMethodAttribs) CORINFO_FLG_INTRINSIC set,
+// getIntrinsicID() returns the intrinsic ID.
+// *pMustExpand tells whether or not JIT must expand the intrinsic.
+CorInfoIntrinsics getIntrinsicID(CORINFO_METHOD_HANDLE method, bool* pMustExpand = NULL /* OUT */
+ );
+
+// Is the given module the System.Numerics.Vectors module?
+// This defaults to false.
+bool isInSIMDModule(CORINFO_CLASS_HANDLE classHnd); /* { return false; } */
+
+// return the unmanaged calling convention for a PInvoke
+CorInfoUnmanagedCallConv getUnmanagedCallConv(CORINFO_METHOD_HANDLE method);
+
+// return if any marshaling is required for PInvoke methods. Note that
+// method == 0 => calli. The call site sig is only needed for the varargs or calli case
+BOOL pInvokeMarshalingRequired(CORINFO_METHOD_HANDLE method, CORINFO_SIG_INFO* callSiteSig);
+
+// Check constraints on method type arguments (only).
+// The parent class should be checked separately using satisfiesClassConstraints(parent).
+BOOL satisfiesMethodConstraints(CORINFO_CLASS_HANDLE parent, // the exact parent of the method
+ CORINFO_METHOD_HANDLE method);
+
+// Given a delegate target class, a target method parent class, a target method,
+// a delegate class, check if the method signature is compatible with the Invoke method of the delegate
+// (under the typical instantiation of any free type variables in the memberref signatures).
+BOOL isCompatibleDelegate(CORINFO_CLASS_HANDLE objCls, /* type of the delegate target, if any */
+ CORINFO_CLASS_HANDLE methodParentCls, /* exact parent of the target method, if any */
+ CORINFO_METHOD_HANDLE method, /* (representative) target method, if any */
+ CORINFO_CLASS_HANDLE delegateCls, /* exact type of the delegate */
+ BOOL* pfIsOpenDelegate /* is the delegate open */
+ );
+
+// Determines whether the delegate creation obeys security transparency rules
+BOOL isDelegateCreationAllowed(CORINFO_CLASS_HANDLE delegateHnd, CORINFO_METHOD_HANDLE calleeHnd);
+
+// Indicates if the method is an instance of the generic
+// method that passes (or has passed) verification
+CorInfoInstantiationVerification isInstantiationOfVerifiedGeneric(CORINFO_METHOD_HANDLE method /* IN */
+ );
+
+// Loads the constraints on a typical method definition, detecting cycles;
+// for use in verification.
+void initConstraintsForVerification(CORINFO_METHOD_HANDLE method, /* IN */
+ BOOL* pfHasCircularClassConstraints, /* OUT */
+ BOOL* pfHasCircularMethodConstraint /* OUT */
+ );
+
+// Returns enum whether the method does not require verification
+// Also see ICorModuleInfo::canSkipVerification
+CorInfoCanSkipVerificationResult canSkipMethodVerification(CORINFO_METHOD_HANDLE ftnHandle);
+
+// load and restore the method
+void methodMustBeLoadedBeforeCodeIsRun(CORINFO_METHOD_HANDLE method);
+
+CORINFO_METHOD_HANDLE mapMethodDeclToMethodImpl(CORINFO_METHOD_HANDLE method);
+
+// Returns the global cookie for the /GS unsafe buffer checks
+// The cookie might be a constant value (JIT), or a handle to memory location (Ngen)
+void getGSCookie(GSCookie* pCookieVal, // OUT
+ GSCookie** ppCookieVal // OUT
+ );
+
+/**********************************************************************************/
+//
+// ICorModuleInfo
+//
+/**********************************************************************************/
+
+// Resolve metadata token into runtime method handles. This function may not
+// return normally (e.g. it may throw) if it encounters invalid metadata or other
+// failures during token resolution.
+void resolveToken(/* IN, OUT */ CORINFO_RESOLVED_TOKEN* pResolvedToken);
+
+// Attempt to resolve a metadata token into a runtime method handle. Returns true
+// if resolution succeeded and false otherwise (e.g. if it encounters invalid metadata
+// during token reoslution). This method should be used instead of `resolveToken` in
+// situations that need to be resilient to invalid metadata.
+bool tryResolveToken(/* IN, OUT */ CORINFO_RESOLVED_TOKEN* pResolvedToken);
+
+// Signature information about the call sig
+void findSig(CORINFO_MODULE_HANDLE module, /* IN */
+ unsigned sigTOK, /* IN */
+ CORINFO_CONTEXT_HANDLE context, /* IN */
+ CORINFO_SIG_INFO* sig /* OUT */
+ );
+
+// for Varargs, the signature at the call site may differ from
+// the signature at the definition. Thus we need a way of
+// fetching the call site information
+void findCallSiteSig(CORINFO_MODULE_HANDLE module, /* IN */
+ unsigned methTOK, /* IN */
+ CORINFO_CONTEXT_HANDLE context, /* IN */
+ CORINFO_SIG_INFO* sig /* OUT */
+ );
- // TODO: jit64 should be switched to the same plan as the i386 jits - use
- // getClassGClayout to figure out the need for writebarrier helper, and inline the copying.
- // The interpretted value class copy is slow. Once this happens, USE_WRITE_BARRIER_HELPERS
- bool isWriteBarrierHelperRequired(
- CORINFO_FIELD_HANDLE field);
+CORINFO_CLASS_HANDLE getTokenTypeAsHandle(CORINFO_RESOLVED_TOKEN* pResolvedToken /* IN */);
+
+// Returns true if the module does not require verification
+//
+// If fQuickCheckOnlyWithoutCommit=TRUE, the function only checks that the
+// module does not currently require verification in the current AppDomain.
+// This decision could change in the future, and so should not be cached.
+// If it is cached, it should only be used as a hint.
+// This is only used by ngen for calculating certain hints.
+//
+
+// Returns enum whether the module does not require verification
+// Also see ICorMethodInfo::canSkipMethodVerification();
+CorInfoCanSkipVerificationResult canSkipVerification(CORINFO_MODULE_HANDLE module /* IN */
+ );
+
+// Checks if the given metadata token is valid
+BOOL isValidToken(CORINFO_MODULE_HANDLE module, /* IN */
+ unsigned metaTOK /* IN */
+ );
+
+// Checks if the given metadata token is valid StringRef
+BOOL isValidStringRef(CORINFO_MODULE_HANDLE module, /* IN */
+ unsigned metaTOK /* IN */
+ );
+
+BOOL shouldEnforceCallvirtRestriction(CORINFO_MODULE_HANDLE scope);
+
+/**********************************************************************************/
+//
+// ICorClassInfo
+//
+/**********************************************************************************/
+
+// If the value class 'cls' is isomorphic to a primitive type it will
+// return that type, otherwise it will return CORINFO_TYPE_VALUECLASS
+CorInfoType asCorInfoType(CORINFO_CLASS_HANDLE cls);
+
+// for completeness
+const char* getClassName(CORINFO_CLASS_HANDLE cls);
+
+// Append a (possibly truncated) representation of the type cls to the preallocated buffer ppBuf of length pnBufLen
+// If fNamespace=TRUE, include the namespace/enclosing classes
+// If fFullInst=TRUE (regardless of fNamespace and fAssembly), include namespace and assembly for any type parameters
+// If fAssembly=TRUE, suffix with a comma and the full assembly qualification
+// return size of representation
+int appendClassName(__deref_inout_ecount(*pnBufLen) WCHAR** ppBuf,
+ int* pnBufLen,
+ CORINFO_CLASS_HANDLE cls,
+ BOOL fNamespace,
+ BOOL fFullInst,
+ BOOL fAssembly);
+
+// Quick check whether the type is a value class. Returns the same value as getClassAttribs(cls) &
+// CORINFO_FLG_VALUECLASS, except faster.
+BOOL isValueClass(CORINFO_CLASS_HANDLE cls);
+
+// If this method returns true, JIT will do optimization to inline the check for
+// GetTypeFromHandle(handle) == obj.GetType()
+BOOL canInlineTypeCheckWithObjectVTable(CORINFO_CLASS_HANDLE cls);
+
+// return flags (defined above, CORINFO_FLG_PUBLIC ...)
+DWORD getClassAttribs(CORINFO_CLASS_HANDLE cls);
+
+// Returns "TRUE" iff "cls" is a struct type such that return buffers used for returning a value
+// of this type must be stack-allocated. This will generally be true only if the struct
+// contains GC pointers, and does not exceed some size limit. Maintaining this as an invariant allows
+// an optimization: the JIT may assume that return buffer pointers for return types for which this predicate
+// returns TRUE are always stack allocated, and thus, that stores to the GC-pointer fields of such return
+// buffers do not require GC write barriers.
+BOOL isStructRequiringStackAllocRetBuf(CORINFO_CLASS_HANDLE cls);
+
+CORINFO_MODULE_HANDLE getClassModule(CORINFO_CLASS_HANDLE cls);
+
+// Returns the assembly that contains the module "mod".
+CORINFO_ASSEMBLY_HANDLE getModuleAssembly(CORINFO_MODULE_HANDLE mod);
+
+// Returns the name of the assembly "assem".
+const char* getAssemblyName(CORINFO_ASSEMBLY_HANDLE assem);
+
+// Allocate and delete process-lifetime objects. Should only be
+// referred to from static fields, lest a leak occur.
+// Note that "LongLifetimeFree" does not execute destructors, if "obj"
+// is an array of a struct type with a destructor.
+void* LongLifetimeMalloc(size_t sz);
+void LongLifetimeFree(void* obj);
+
+size_t getClassModuleIdForStatics(CORINFO_CLASS_HANDLE cls, CORINFO_MODULE_HANDLE* pModule, void** ppIndirection);
+
+// return the number of bytes needed by an instance of the class
+unsigned getClassSize(CORINFO_CLASS_HANDLE cls);
+
+unsigned getClassAlignmentRequirement(CORINFO_CLASS_HANDLE cls, BOOL fDoubleAlignHint = FALSE);
+
+// This is only called for Value classes. It returns a boolean array
+// in representing of 'cls' from a GC perspective. The class is
+// assumed to be an array of machine words
+// (of length // getClassSize(cls) / sizeof(void*)),
+// 'gcPtrs' is a pointer to an array of BYTEs of this length.
+// getClassGClayout fills in this array so that gcPtrs[i] is set
+// to one of the CorInfoGCType values which is the GC type of
+// the i-th machine word of an object of type 'cls'
+// returns the number of GC pointers in the array
+unsigned getClassGClayout(CORINFO_CLASS_HANDLE cls, /* IN */
+ BYTE* gcPtrs /* OUT */
+ );
+
+// returns the number of instance fields in a class
+unsigned getClassNumInstanceFields(CORINFO_CLASS_HANDLE cls /* IN */
+ );
+
+CORINFO_FIELD_HANDLE getFieldInClass(CORINFO_CLASS_HANDLE clsHnd, INT num);
+
+BOOL checkMethodModifier(CORINFO_METHOD_HANDLE hMethod, LPCSTR modifier, BOOL fOptional);
+
+// returns the "NEW" helper optimized for "newCls."
+CorInfoHelpFunc getNewHelper(CORINFO_RESOLVED_TOKEN* pResolvedToken, CORINFO_METHOD_HANDLE callerHandle);
+
+// returns the newArr (1-Dim array) helper optimized for "arrayCls."
+CorInfoHelpFunc getNewArrHelper(CORINFO_CLASS_HANDLE arrayCls);
+
+// returns the optimized "IsInstanceOf" or "ChkCast" helper
+CorInfoHelpFunc getCastingHelper(CORINFO_RESOLVED_TOKEN* pResolvedToken, bool fThrowing);
+
+// returns helper to trigger static constructor
+CorInfoHelpFunc getSharedCCtorHelper(CORINFO_CLASS_HANDLE clsHnd);
+
+CorInfoHelpFunc getSecurityPrologHelper(CORINFO_METHOD_HANDLE ftn);
+
+// This is not pretty. Boxing nullable<T> actually returns
+// a boxed<T> not a boxed Nullable<T>. This call allows the verifier
+// to call back to the EE on the 'box' instruction and get the transformed
+// type to use for verification.
+CORINFO_CLASS_HANDLE getTypeForBox(CORINFO_CLASS_HANDLE cls);
+
+// returns the correct box helper for a particular class. Note
+// that if this returns CORINFO_HELP_BOX, the JIT can assume
+// 'standard' boxing (allocate object and copy), and optimize
+CorInfoHelpFunc getBoxHelper(CORINFO_CLASS_HANDLE cls);
+
+// returns the unbox helper. If 'helperCopies' points to a true
+// value it means the JIT is requesting a helper that unboxes the
+// value into a particular location and thus has the signature
+// void unboxHelper(void* dest, CORINFO_CLASS_HANDLE cls, Object* obj)
+// Otherwise (it is null or points at a FALSE value) it is requesting
+// a helper that returns a pointer to the unboxed data
+// void* unboxHelper(CORINFO_CLASS_HANDLE cls, Object* obj)
+// The EE has the option of NOT returning the copy style helper
+// (But must be able to always honor the non-copy style helper)
+// The EE set 'helperCopies' on return to indicate what kind of
+// helper has been created.
+
+CorInfoHelpFunc getUnBoxHelper(CORINFO_CLASS_HANDLE cls);
+
+bool getReadyToRunHelper(CORINFO_RESOLVED_TOKEN* pResolvedToken,
+ CORINFO_LOOKUP_KIND* pGenericLookupKind,
+ CorInfoHelpFunc id,
+ CORINFO_CONST_LOOKUP* pLookup);
+
+void getReadyToRunDelegateCtorHelper(CORINFO_RESOLVED_TOKEN* pTargetMethod,
+ CORINFO_CLASS_HANDLE delegateType,
+ CORINFO_LOOKUP* pLookup);
+
+const char* getHelperName(CorInfoHelpFunc);
+
+// This function tries to initialize the class (run the class constructor).
+// this function returns whether the JIT must insert helper calls before
+// accessing static field or method.
+//
+// See code:ICorClassInfo#ClassConstruction.
+CorInfoInitClassResult initClass(CORINFO_FIELD_HANDLE field, // Non-NULL - inquire about cctor trigger before static
+ // field access NULL - inquire about cctor trigger in
+ // method prolog
+ CORINFO_METHOD_HANDLE method, // Method referencing the field or prolog
+ CORINFO_CONTEXT_HANDLE context, // Exact context of method
+ BOOL speculative = FALSE // TRUE means don't actually run it
+ );
+
+// This used to be called "loadClass". This records the fact
+// that the class must be loaded (including restored if necessary) before we execute the
+// code that we are currently generating. When jitting code
+// the function loads the class immediately. When zapping code
+// the zapper will if necessary use the call to record the fact that we have
+// to do a fixup/restore before running the method currently being generated.
+//
+// This is typically used to ensure value types are loaded before zapped
+// code that manipulates them is executed, so that the GC can access information
+// about those value types.
+void classMustBeLoadedBeforeCodeIsRun(CORINFO_CLASS_HANDLE cls);
+
+// returns the class handle for the special builtin classes
+CORINFO_CLASS_HANDLE getBuiltinClass(CorInfoClassId classId);
+
+// "System.Int32" ==> CORINFO_TYPE_INT..
+CorInfoType getTypeForPrimitiveValueClass(CORINFO_CLASS_HANDLE cls);
+
+// TRUE if child is a subtype of parent
+// if parent is an interface, then does child implement / extend parent
+BOOL canCast(CORINFO_CLASS_HANDLE child, // subtype (extends parent)
+ CORINFO_CLASS_HANDLE parent // base type
+ );
- void getFieldInfo (CORINFO_RESOLVED_TOKEN * pResolvedToken,
- CORINFO_METHOD_HANDLE callerHandle,
- CORINFO_ACCESS_FLAGS flags,
- CORINFO_FIELD_INFO *pResult
+// TRUE if cls1 and cls2 are considered equivalent types.
+BOOL areTypesEquivalent(CORINFO_CLASS_HANDLE cls1, CORINFO_CLASS_HANDLE cls2);
+
+// returns is the intersection of cls1 and cls2.
+CORINFO_CLASS_HANDLE mergeClasses(CORINFO_CLASS_HANDLE cls1, CORINFO_CLASS_HANDLE cls2);
+
+// Given a class handle, returns the Parent type.
+// For COMObjectType, it returns Class Handle of System.Object.
+// Returns 0 if System.Object is passed in.
+CORINFO_CLASS_HANDLE getParentType(CORINFO_CLASS_HANDLE cls);
+
+// Returns the CorInfoType of the "child type". If the child type is
+// not a primitive type, *clsRet will be set.
+// Given an Array of Type Foo, returns Foo.
+// Given BYREF Foo, returns Foo
+CorInfoType getChildType(CORINFO_CLASS_HANDLE clsHnd, CORINFO_CLASS_HANDLE* clsRet);
+
+// Check constraints on type arguments of this class and parent classes
+BOOL satisfiesClassConstraints(CORINFO_CLASS_HANDLE cls);
+
+// Check if this is a single dimensional array type
+BOOL isSDArray(CORINFO_CLASS_HANDLE cls);
+
+// Get the numbmer of dimensions in an array
+unsigned getArrayRank(CORINFO_CLASS_HANDLE cls);
+
+// Get static field data for an array
+void* getArrayInitializationData(CORINFO_FIELD_HANDLE field, DWORD size);
+
+// Check Visibility rules.
+CorInfoIsAccessAllowedResult canAccessClass(CORINFO_RESOLVED_TOKEN* pResolvedToken,
+ CORINFO_METHOD_HANDLE callerHandle,
+ CORINFO_HELPER_DESC* pAccessHelper /* If canAccessMethod returns something
+ other than ALLOWED, then this is
+ filled in. */
+ );
+
+/**********************************************************************************/
+//
+// ICorFieldInfo
+//
+/**********************************************************************************/
+
+// this function is for debugging only. It returns the field name
+// and if 'moduleName' is non-null, it sets it to something that will
+// says which method (a class name, or a module name)
+const char* getFieldName(CORINFO_FIELD_HANDLE ftn, /* IN */
+ const char** moduleName /* OUT */
+ );
+
+// return class it belongs to
+CORINFO_CLASS_HANDLE getFieldClass(CORINFO_FIELD_HANDLE field);
+
+// Return the field's type, if it is CORINFO_TYPE_VALUECLASS 'structType' is set
+// the field's value class (if 'structType' == 0, then don't bother
+// the structure info).
+//
+// 'memberParent' is typically only set when verifying. It should be the
+// result of calling getMemberParent.
+CorInfoType getFieldType(CORINFO_FIELD_HANDLE field,
+ CORINFO_CLASS_HANDLE* structType,
+ CORINFO_CLASS_HANDLE memberParent = NULL /* IN */
+ );
+
+// return the data member's instance offset
+unsigned getFieldOffset(CORINFO_FIELD_HANDLE field);
+
+// TODO: jit64 should be switched to the same plan as the i386 jits - use
+// getClassGClayout to figure out the need for writebarrier helper, and inline the copying.
+// The interpretted value class copy is slow. Once this happens, USE_WRITE_BARRIER_HELPERS
+bool isWriteBarrierHelperRequired(CORINFO_FIELD_HANDLE field);
+
+void getFieldInfo(CORINFO_RESOLVED_TOKEN* pResolvedToken,
+ CORINFO_METHOD_HANDLE callerHandle,
+ CORINFO_ACCESS_FLAGS flags,
+ CORINFO_FIELD_INFO* pResult);
+
+// Returns true iff "fldHnd" represents a static field.
+bool isFieldStatic(CORINFO_FIELD_HANDLE fldHnd);
+
+/*********************************************************************************/
+//
+// ICorDebugInfo
+//
+/*********************************************************************************/
+
+// Query the EE to find out where interesting break points
+// in the code are. The native compiler will ensure that these places
+// have a corresponding break point in native code.
+//
+// Note that unless CORJIT_FLAG_DEBUG_CODE is specified, this function will
+// be used only as a hint and the native compiler should not change its
+// code generation.
+void getBoundaries(CORINFO_METHOD_HANDLE ftn, // [IN] method of interest
+ unsigned int* cILOffsets, // [OUT] size of pILOffsets
+ DWORD** pILOffsets, // [OUT] IL offsets of interest
+ // jit MUST free with freeArray!
+ ICorDebugInfo::BoundaryTypes* implictBoundaries // [OUT] tell jit, all boundries of this type
+ );
+
+// Report back the mapping from IL to native code,
+// this map should include all boundaries that 'getBoundaries'
+// reported as interesting to the debugger.
+
+// Note that debugger (and profiler) is assuming that all of the
+// offsets form a contiguous block of memory, and that the
+// OffsetMapping is sorted in order of increasing native offset.
+void setBoundaries(CORINFO_METHOD_HANDLE ftn, // [IN] method of interest
+ ULONG32 cMap, // [IN] size of pMap
+ ICorDebugInfo::OffsetMapping* pMap // [IN] map including all points of interest.
+ // jit allocated with allocateArray, EE frees
+ );
+
+// Query the EE to find out the scope of local varables.
+// normally the JIT would trash variables after last use, but
+// under debugging, the JIT needs to keep them live over their
+// entire scope so that they can be inspected.
+//
+// Note that unless CORJIT_FLAG_DEBUG_CODE is specified, this function will
+// be used only as a hint and the native compiler should not change its
+// code generation.
+void getVars(CORINFO_METHOD_HANDLE ftn, // [IN] method of interest
+ ULONG32* cVars, // [OUT] size of 'vars'
+ ICorDebugInfo::ILVarInfo** vars, // [OUT] scopes of variables of interest
+ // jit MUST free with freeArray!
+ bool* extendOthers // [OUT] it TRUE, then assume the scope
+ // of unmentioned vars is entire method
+ );
+
+// Report back to the EE the location of every variable.
+// note that the JIT might split lifetimes into different
+// locations etc.
+
+void setVars(CORINFO_METHOD_HANDLE ftn, // [IN] method of interest
+ ULONG32 cVars, // [IN] size of 'vars'
+ ICorDebugInfo::NativeVarInfo* vars // [IN] map telling where local vars are stored at what points
+ // jit allocated with allocateArray, EE frees
+ );
+
+/*-------------------------- Misc ---------------------------------------*/
+
+// Used to allocate memory that needs to handed to the EE.
+// For eg, use this to allocated memory for reporting debug info,
+// which will be handed to the EE by setVars() and setBoundaries()
+void* allocateArray(ULONG cBytes);
+
+// JitCompiler will free arrays passed by the EE using this
+// For eg, The EE returns memory in getVars() and getBoundaries()
+// to the JitCompiler, which the JitCompiler should release using
+// freeArray()
+void freeArray(void* array);
+
+/*********************************************************************************/
+//
+// ICorArgInfo
+//
+/*********************************************************************************/
+
+// advance the pointer to the argument list.
+// a ptr of 0, is special and always means the first argument
+CORINFO_ARG_LIST_HANDLE getArgNext(CORINFO_ARG_LIST_HANDLE args /* IN */
+ );
+
+// Get the type of a particular argument
+// CORINFO_TYPE_UNDEF is returned when there are no more arguments
+// If the type returned is a primitive type (or an enum) *vcTypeRet set to NULL
+// otherwise it is set to the TypeHandle associted with the type
+// Enumerations will always look their underlying type (probably should fix this)
+// Otherwise vcTypeRet is the type as would be seen by the IL,
+// The return value is the type that is used for calling convention purposes
+// (Thus if the EE wants a value class to be passed like an int, then it will
+// return CORINFO_TYPE_INT
+CorInfoTypeWithMod getArgType(CORINFO_SIG_INFO* sig, /* IN */
+ CORINFO_ARG_LIST_HANDLE args, /* IN */
+ CORINFO_CLASS_HANDLE* vcTypeRet /* OUT */
);
- // Returns true iff "fldHnd" represents a static field.
- bool isFieldStatic(CORINFO_FIELD_HANDLE fldHnd);
-
- /*********************************************************************************/
- //
- // ICorDebugInfo
- //
- /*********************************************************************************/
-
- // Query the EE to find out where interesting break points
- // in the code are. The native compiler will ensure that these places
- // have a corresponding break point in native code.
- //
- // Note that unless CORJIT_FLAG_DEBUG_CODE is specified, this function will
- // be used only as a hint and the native compiler should not change its
- // code generation.
- void getBoundaries(
- CORINFO_METHOD_HANDLE ftn, // [IN] method of interest
- unsigned int *cILOffsets, // [OUT] size of pILOffsets
- DWORD **pILOffsets, // [OUT] IL offsets of interest
- // jit MUST free with freeArray!
- ICorDebugInfo::BoundaryTypes *implictBoundaries // [OUT] tell jit, all boundries of this type
- );
+// If the Arg is a CORINFO_TYPE_CLASS fetch the class handle associated with it
+CORINFO_CLASS_HANDLE getArgClass(CORINFO_SIG_INFO* sig, /* IN */
+ CORINFO_ARG_LIST_HANDLE args /* IN */
+ );
- // Report back the mapping from IL to native code,
- // this map should include all boundaries that 'getBoundaries'
- // reported as interesting to the debugger.
-
- // Note that debugger (and profiler) is assuming that all of the
- // offsets form a contiguous block of memory, and that the
- // OffsetMapping is sorted in order of increasing native offset.
- void setBoundaries(
- CORINFO_METHOD_HANDLE ftn, // [IN] method of interest
- ULONG32 cMap, // [IN] size of pMap
- ICorDebugInfo::OffsetMapping *pMap // [IN] map including all points of interest.
- // jit allocated with allocateArray, EE frees
- );
+// Returns type of HFA for valuetype
+CorInfoType getHFAType(CORINFO_CLASS_HANDLE hClass);
- // Query the EE to find out the scope of local varables.
- // normally the JIT would trash variables after last use, but
- // under debugging, the JIT needs to keep them live over their
- // entire scope so that they can be inspected.
- //
- // Note that unless CORJIT_FLAG_DEBUG_CODE is specified, this function will
- // be used only as a hint and the native compiler should not change its
- // code generation.
- void getVars(
- CORINFO_METHOD_HANDLE ftn, // [IN] method of interest
- ULONG32 *cVars, // [OUT] size of 'vars'
- ICorDebugInfo::ILVarInfo **vars, // [OUT] scopes of variables of interest
- // jit MUST free with freeArray!
- bool *extendOthers // [OUT] it TRUE, then assume the scope
- // of unmentioned vars is entire method
- );
-
- // Report back to the EE the location of every variable.
- // note that the JIT might split lifetimes into different
- // locations etc.
-
- void setVars(
- CORINFO_METHOD_HANDLE ftn, // [IN] method of interest
- ULONG32 cVars, // [IN] size of 'vars'
- ICorDebugInfo::NativeVarInfo *vars // [IN] map telling where local vars are stored at what points
- // jit allocated with allocateArray, EE frees
- );
-
- /*-------------------------- Misc ---------------------------------------*/
-
- // Used to allocate memory that needs to handed to the EE.
- // For eg, use this to allocated memory for reporting debug info,
- // which will be handed to the EE by setVars() and setBoundaries()
- void * allocateArray(
- ULONG cBytes
- );
+/*****************************************************************************
+* ICorErrorInfo contains methods to deal with SEH exceptions being thrown
+* from the corinfo interface. These methods may be called when an exception
+* with code EXCEPTION_COMPLUS is caught.
+*****************************************************************************/
- // JitCompiler will free arrays passed by the EE using this
- // For eg, The EE returns memory in getVars() and getBoundaries()
- // to the JitCompiler, which the JitCompiler should release using
- // freeArray()
- void freeArray(
- void *array
- );
-
- /*********************************************************************************/
- //
- // ICorArgInfo
- //
- /*********************************************************************************/
-
- // advance the pointer to the argument list.
- // a ptr of 0, is special and always means the first argument
- CORINFO_ARG_LIST_HANDLE getArgNext (
- CORINFO_ARG_LIST_HANDLE args /* IN */
- );
-
- // Get the type of a particular argument
- // CORINFO_TYPE_UNDEF is returned when there are no more arguments
- // If the type returned is a primitive type (or an enum) *vcTypeRet set to NULL
- // otherwise it is set to the TypeHandle associted with the type
- // Enumerations will always look their underlying type (probably should fix this)
- // Otherwise vcTypeRet is the type as would be seen by the IL,
- // The return value is the type that is used for calling convention purposes
- // (Thus if the EE wants a value class to be passed like an int, then it will
- // return CORINFO_TYPE_INT
- CorInfoTypeWithMod getArgType (
- CORINFO_SIG_INFO* sig, /* IN */
- CORINFO_ARG_LIST_HANDLE args, /* IN */
- CORINFO_CLASS_HANDLE *vcTypeRet /* OUT */
- );
-
- // If the Arg is a CORINFO_TYPE_CLASS fetch the class handle associated with it
- CORINFO_CLASS_HANDLE getArgClass (
- CORINFO_SIG_INFO* sig, /* IN */
- CORINFO_ARG_LIST_HANDLE args /* IN */
- );
-
- // Returns type of HFA for valuetype
- CorInfoType getHFAType (
- CORINFO_CLASS_HANDLE hClass
- );
-
- /*****************************************************************************
- * ICorErrorInfo contains methods to deal with SEH exceptions being thrown
- * from the corinfo interface. These methods may be called when an exception
- * with code EXCEPTION_COMPLUS is caught.
- *****************************************************************************/
+// Returns the HRESULT of the current exception
+HRESULT GetErrorHRESULT(struct _EXCEPTION_POINTERS* pExceptionPointers);
+
+// Fetches the message of the current exception
+// Returns the size of the message (including terminating null). This can be
+// greater than bufferLength if the buffer is insufficient.
+ULONG GetErrorMessage(__inout_ecount(bufferLength) LPWSTR buffer, ULONG bufferLength);
+
+// returns EXCEPTION_EXECUTE_HANDLER if it is OK for the compile to handle the
+// exception, abort some work (like the inlining) and continue compilation
+// returns EXCEPTION_CONTINUE_SEARCH if exception must always be handled by the EE
+// things like ThreadStoppedException ...
+// returns EXCEPTION_CONTINUE_EXECUTION if exception is fixed up by the EE
+
+int FilterException(struct _EXCEPTION_POINTERS* pExceptionPointers);
+
+// Cleans up internal EE tracking when an exception is caught.
+void HandleException(struct _EXCEPTION_POINTERS* pExceptionPointers);
- // Returns the HRESULT of the current exception
- HRESULT GetErrorHRESULT(
- struct _EXCEPTION_POINTERS *pExceptionPointers
- );
-
- // Fetches the message of the current exception
- // Returns the size of the message (including terminating null). This can be
- // greater than bufferLength if the buffer is insufficient.
- ULONG GetErrorMessage(
- __inout_ecount(bufferLength) LPWSTR buffer,
- ULONG bufferLength
- );
-
- // returns EXCEPTION_EXECUTE_HANDLER if it is OK for the compile to handle the
- // exception, abort some work (like the inlining) and continue compilation
- // returns EXCEPTION_CONTINUE_SEARCH if exception must always be handled by the EE
- // things like ThreadStoppedException ...
- // returns EXCEPTION_CONTINUE_EXECUTION if exception is fixed up by the EE
-
- int FilterException(
- struct _EXCEPTION_POINTERS *pExceptionPointers
- );
-
- // Cleans up internal EE tracking when an exception is caught.
- void HandleException(
- struct _EXCEPTION_POINTERS *pExceptionPointers
- );
-
- void ThrowExceptionForJitResult(
- HRESULT result);
-
- //Throws an exception defined by the given throw helper.
- void ThrowExceptionForHelper(
- const CORINFO_HELPER_DESC * throwHelper);
-
- // Runs the given function under an error trap. This allows the JIT to make calls
- // to interface functions that may throw exceptions without needing to be aware of
- // the EH ABI, exception types, etc. Returns true if the given function completed
- // successfully and false otherwise.
- bool runWithErrorTrap(
- void (*function)(void*), // The function to run
- void* parameter // The context parameter that will be passed to the function and the handler
- );
+void ThrowExceptionForJitResult(HRESULT result);
+
+// Throws an exception defined by the given throw helper.
+void ThrowExceptionForHelper(const CORINFO_HELPER_DESC* throwHelper);
+
+// Runs the given function under an error trap. This allows the JIT to make calls
+// to interface functions that may throw exceptions without needing to be aware of
+// the EH ABI, exception types, etc. Returns true if the given function completed
+// successfully and false otherwise.
+bool runWithErrorTrap(void (*function)(void*), // The function to run
+ void* parameter // The context parameter that will be passed to the function and the handler
+ );
/*****************************************************************************
* ICorStaticInfo contains EE interface methods which return values that are
@@ -809,54 +645,46 @@ public:
* assuming that all code versions are identical each time.)
*****************************************************************************/
- // Return details about EE internal data structures
- void getEEInfo(
- CORINFO_EE_INFO *pEEInfoOut
- );
+// Return details about EE internal data structures
+void getEEInfo(CORINFO_EE_INFO* pEEInfoOut);
+
+// Returns name of the JIT timer log
+LPCWSTR getJitTimeLogFilename();
- // Returns name of the JIT timer log
- LPCWSTR getJitTimeLogFilename();
-
- /*********************************************************************************/
- //
- // Diagnostic methods
- //
- /*********************************************************************************/
-
- // this function is for debugging only. Returns method token.
- // Returns mdMethodDefNil for dynamic methods.
- mdMethodDef getMethodDefFromMethod(
- CORINFO_METHOD_HANDLE hMethod
- );
-
- // this function is for debugging only. It returns the method name
- // and if 'moduleName' is non-null, it sets it to something that will
- // says which method (a class name, or a module name)
- const char* getMethodName (
- CORINFO_METHOD_HANDLE ftn, /* IN */
- const char **moduleName /* OUT */
- );
-
- // this function is for debugging only. It returns a value that
- // is will always be the same for a given method. It is used
- // to implement the 'jitRange' functionality
- unsigned getMethodHash (
- CORINFO_METHOD_HANDLE ftn /* IN */
- );
-
- // this function is for debugging only.
- size_t findNameOfToken (
- CORINFO_MODULE_HANDLE module, /* IN */
- mdToken metaTOK, /* IN */
- __out_ecount (FQNameCapacity) char * szFQName, /* OUT */
- size_t FQNameCapacity /* IN */
- );
-
- // returns whether the struct is enregisterable. Only valid on a System V VM. Returns true on success, false on failure.
- bool getSystemVAmd64PassStructInRegisterDescriptor(
- /* IN */ CORINFO_CLASS_HANDLE structHnd,
- /* OUT */ SYSTEMV_AMD64_CORINFO_STRUCT_REG_PASSING_DESCRIPTOR* structPassInRegDescPtr
- );
+/*********************************************************************************/
+//
+// Diagnostic methods
+//
+/*********************************************************************************/
+
+// this function is for debugging only. Returns method token.
+// Returns mdMethodDefNil for dynamic methods.
+mdMethodDef getMethodDefFromMethod(CORINFO_METHOD_HANDLE hMethod);
+
+// this function is for debugging only. It returns the method name
+// and if 'moduleName' is non-null, it sets it to something that will
+// says which method (a class name, or a module name)
+const char* getMethodName(CORINFO_METHOD_HANDLE ftn, /* IN */
+ const char** moduleName /* OUT */
+ );
+
+// this function is for debugging only. It returns a value that
+// is will always be the same for a given method. It is used
+// to implement the 'jitRange' functionality
+unsigned getMethodHash(CORINFO_METHOD_HANDLE ftn /* IN */
+ );
+
+// this function is for debugging only.
+size_t findNameOfToken(CORINFO_MODULE_HANDLE module, /* IN */
+ mdToken metaTOK, /* IN */
+ __out_ecount(FQNameCapacity) char* szFQName, /* OUT */
+ size_t FQNameCapacity /* IN */
+ );
+
+// returns whether the struct is enregisterable. Only valid on a System V VM. Returns true on success, false on failure.
+bool getSystemVAmd64PassStructInRegisterDescriptor(
+ /* IN */ CORINFO_CLASS_HANDLE structHnd,
+ /* OUT */ SYSTEMV_AMD64_CORINFO_STRUCT_REG_PASSING_DESCRIPTOR* structPassInRegDescPtr);
/*****************************************************************************
* ICorDynamicInfo contains EE interface methods which return values that may
@@ -864,433 +692,331 @@ public:
* data; they must be requeried each time the EE is run.
*****************************************************************************/
- //
- // These methods return values to the JIT which are not constant
- // from session to session.
- //
- // These methods take an extra parameter : void **ppIndirection.
- // If a JIT supports generation of prejit code (install-o-jit), it
- // must pass a non-null value for this parameter, and check the
- // resulting value. If *ppIndirection is NULL, code should be
- // generated normally. If non-null, then the value of
- // *ppIndirection is an address in the cookie table, and the code
- // generator needs to generate an indirection through the table to
- // get the resulting value. In this case, the return result of the
- // function must NOT be directly embedded in the generated code.
- //
- // Note that if a JIT does not support prejit code generation, it
- // may ignore the extra parameter & pass the default of NULL - the
- // prejit ICorDynamicInfo implementation will see this & generate
- // an error if the jitter is used in a prejit scenario.
- //
-
- // Return details about EE internal data structures
-
- DWORD getThreadTLSIndex(
- void **ppIndirection = NULL
- );
+//
+// These methods return values to the JIT which are not constant
+// from session to session.
+//
+// These methods take an extra parameter : void **ppIndirection.
+// If a JIT supports generation of prejit code (install-o-jit), it
+// must pass a non-null value for this parameter, and check the
+// resulting value. If *ppIndirection is NULL, code should be
+// generated normally. If non-null, then the value of
+// *ppIndirection is an address in the cookie table, and the code
+// generator needs to generate an indirection through the table to
+// get the resulting value. In this case, the return result of the
+// function must NOT be directly embedded in the generated code.
+//
+// Note that if a JIT does not support prejit code generation, it
+// may ignore the extra parameter & pass the default of NULL - the
+// prejit ICorDynamicInfo implementation will see this & generate
+// an error if the jitter is used in a prejit scenario.
+//
- const void * getInlinedCallFrameVptr(
- void **ppIndirection = NULL
- );
+// Return details about EE internal data structures
- LONG * getAddrOfCaptureThreadGlobal(
- void **ppIndirection = NULL
- );
+DWORD getThreadTLSIndex(void** ppIndirection = NULL);
- SIZE_T* getAddrModuleDomainID(CORINFO_MODULE_HANDLE module);
+const void* getInlinedCallFrameVptr(void** ppIndirection = NULL);
- // return the native entry point to an EE helper (see CorInfoHelpFunc)
- void* getHelperFtn (
- CorInfoHelpFunc ftnNum,
- void **ppIndirection = NULL
- );
+LONG* getAddrOfCaptureThreadGlobal(void** ppIndirection = NULL);
- // return a callable address of the function (native code). This function
- // may return a different value (depending on whether the method has
- // been JITed or not.
- void getFunctionEntryPoint(
- CORINFO_METHOD_HANDLE ftn, /* IN */
- CORINFO_CONST_LOOKUP * pResult, /* OUT */
- CORINFO_ACCESS_FLAGS accessFlags = CORINFO_ACCESS_ANY);
-
- // return a directly callable address. This can be used similarly to the
- // value returned by getFunctionEntryPoint() except that it is
- // guaranteed to be multi callable entrypoint.
- void getFunctionFixedEntryPoint(
- CORINFO_METHOD_HANDLE ftn,
- CORINFO_CONST_LOOKUP * pResult);
-
- // get the synchronization handle that is passed to monXstatic function
- void* getMethodSync(
- CORINFO_METHOD_HANDLE ftn,
- void **ppIndirection = NULL
- );
+SIZE_T* getAddrModuleDomainID(CORINFO_MODULE_HANDLE module);
- // get slow lazy string literal helper to use (CORINFO_HELP_STRCNS*).
- // Returns CORINFO_HELP_UNDEF if lazy string literal helper cannot be used.
- CorInfoHelpFunc getLazyStringLiteralHelper(
- CORINFO_MODULE_HANDLE handle
- );
+// return the native entry point to an EE helper (see CorInfoHelpFunc)
+void* getHelperFtn(CorInfoHelpFunc ftnNum, void** ppIndirection = NULL);
- CORINFO_MODULE_HANDLE embedModuleHandle(
- CORINFO_MODULE_HANDLE handle,
- void **ppIndirection = NULL
- );
+// return a callable address of the function (native code). This function
+// may return a different value (depending on whether the method has
+// been JITed or not.
+void getFunctionEntryPoint(CORINFO_METHOD_HANDLE ftn, /* IN */
+ CORINFO_CONST_LOOKUP* pResult, /* OUT */
+ CORINFO_ACCESS_FLAGS accessFlags = CORINFO_ACCESS_ANY);
- CORINFO_CLASS_HANDLE embedClassHandle(
- CORINFO_CLASS_HANDLE handle,
- void **ppIndirection = NULL
- );
+// return a directly callable address. This can be used similarly to the
+// value returned by getFunctionEntryPoint() except that it is
+// guaranteed to be multi callable entrypoint.
+void getFunctionFixedEntryPoint(CORINFO_METHOD_HANDLE ftn, CORINFO_CONST_LOOKUP* pResult);
- CORINFO_METHOD_HANDLE embedMethodHandle(
- CORINFO_METHOD_HANDLE handle,
- void **ppIndirection = NULL
- );
+// get the synchronization handle that is passed to monXstatic function
+void* getMethodSync(CORINFO_METHOD_HANDLE ftn, void** ppIndirection = NULL);
- CORINFO_FIELD_HANDLE embedFieldHandle(
- CORINFO_FIELD_HANDLE handle,
- void **ppIndirection = NULL
- );
+// get slow lazy string literal helper to use (CORINFO_HELP_STRCNS*).
+// Returns CORINFO_HELP_UNDEF if lazy string literal helper cannot be used.
+CorInfoHelpFunc getLazyStringLiteralHelper(CORINFO_MODULE_HANDLE handle);
- // Given a module scope (module), a method handle (context) and
- // a metadata token (metaTOK), fetch the handle
- // (type, field or method) associated with the token.
- // If this is not possible at compile-time (because the current method's
- // code is shared and the token contains generic parameters)
- // then indicate how the handle should be looked up at run-time.
- //
- void embedGenericHandle(
- CORINFO_RESOLVED_TOKEN * pResolvedToken,
- BOOL fEmbedParent, // TRUE - embeds parent type handle of the field/method handle
- CORINFO_GENERICHANDLE_RESULT * pResult);
-
- // Return information used to locate the exact enclosing type of the current method.
- // Used only to invoke .cctor method from code shared across generic instantiations
- // !needsRuntimeLookup statically known (enclosing type of method itself)
- // needsRuntimeLookup:
- // CORINFO_LOOKUP_THISOBJ use vtable pointer of 'this' param
- // CORINFO_LOOKUP_CLASSPARAM use vtable hidden param
- // CORINFO_LOOKUP_METHODPARAM use enclosing type of method-desc hidden param
- CORINFO_LOOKUP_KIND getLocationOfThisType(
- CORINFO_METHOD_HANDLE context
- );
+CORINFO_MODULE_HANDLE embedModuleHandle(CORINFO_MODULE_HANDLE handle, void** ppIndirection = NULL);
- // NOTE: the two methods below--getPInvokeUnmanagedTarget and getAddressOfPInvokeFixup--are
- // deprecated. New code should instead use getAddressOfPInvokeTarget, which subsumes the
- // functionality of these methods.
+CORINFO_CLASS_HANDLE embedClassHandle(CORINFO_CLASS_HANDLE handle, void** ppIndirection = NULL);
- // return the unmanaged target *if method has already been prelinked.*
- void* getPInvokeUnmanagedTarget(
- CORINFO_METHOD_HANDLE method,
- void **ppIndirection = NULL
- );
+CORINFO_METHOD_HANDLE embedMethodHandle(CORINFO_METHOD_HANDLE handle, void** ppIndirection = NULL);
- // return address of fixup area for late-bound PInvoke calls.
- void* getAddressOfPInvokeFixup(
- CORINFO_METHOD_HANDLE method,
- void **ppIndirection = NULL
- );
+CORINFO_FIELD_HANDLE embedFieldHandle(CORINFO_FIELD_HANDLE handle, void** ppIndirection = NULL);
- // return the address of the PInvoke target. May be a fixup area in the
- // case of late-bound PInvoke calls.
- void getAddressOfPInvokeTarget(
- CORINFO_METHOD_HANDLE method,
- CORINFO_CONST_LOOKUP *pLookup
- );
+// Given a module scope (module), a method handle (context) and
+// a metadata token (metaTOK), fetch the handle
+// (type, field or method) associated with the token.
+// If this is not possible at compile-time (because the current method's
+// code is shared and the token contains generic parameters)
+// then indicate how the handle should be looked up at run-time.
+//
+void embedGenericHandle(CORINFO_RESOLVED_TOKEN* pResolvedToken,
+ BOOL fEmbedParent, // TRUE - embeds parent type handle of the field/method handle
+ CORINFO_GENERICHANDLE_RESULT* pResult);
- // Generate a cookie based on the signature that would needs to be passed
- // to CORINFO_HELP_PINVOKE_CALLI
- LPVOID GetCookieForPInvokeCalliSig(
- CORINFO_SIG_INFO* szMetaSig,
- void ** ppIndirection = NULL
- );
-
- // returns true if a VM cookie can be generated for it (might be false due to cross-module
- // inlining, in which case the inlining should be aborted)
- bool canGetCookieForPInvokeCalliSig(
- CORINFO_SIG_INFO* szMetaSig
- );
+// Return information used to locate the exact enclosing type of the current method.
+// Used only to invoke .cctor method from code shared across generic instantiations
+// !needsRuntimeLookup statically known (enclosing type of method itself)
+// needsRuntimeLookup:
+// CORINFO_LOOKUP_THISOBJ use vtable pointer of 'this' param
+// CORINFO_LOOKUP_CLASSPARAM use vtable hidden param
+// CORINFO_LOOKUP_METHODPARAM use enclosing type of method-desc hidden param
+CORINFO_LOOKUP_KIND getLocationOfThisType(CORINFO_METHOD_HANDLE context);
- // Gets a handle that is checked to see if the current method is
- // included in "JustMyCode"
- CORINFO_JUST_MY_CODE_HANDLE getJustMyCodeHandle(
- CORINFO_METHOD_HANDLE method,
- CORINFO_JUST_MY_CODE_HANDLE**ppIndirection = NULL
- );
+// NOTE: the two methods below--getPInvokeUnmanagedTarget and getAddressOfPInvokeFixup--are
+// deprecated. New code should instead use getAddressOfPInvokeTarget, which subsumes the
+// functionality of these methods.
- // Gets a method handle that can be used to correlate profiling data.
- // This is the IP of a native method, or the address of the descriptor struct
- // for IL. Always guaranteed to be unique per process, and not to move. */
- void GetProfilingHandle(
- BOOL *pbHookFunction,
- void **pProfilerHandle,
- BOOL *pbIndirectedHandles
- );
+// return the unmanaged target *if method has already been prelinked.*
+void* getPInvokeUnmanagedTarget(CORINFO_METHOD_HANDLE method, void** ppIndirection = NULL);
- // Returns instructions on how to make the call. See code:CORINFO_CALL_INFO for possible return values.
- void getCallInfo(
- // Token info
- CORINFO_RESOLVED_TOKEN * pResolvedToken,
+// return address of fixup area for late-bound PInvoke calls.
+void* getAddressOfPInvokeFixup(CORINFO_METHOD_HANDLE method, void** ppIndirection = NULL);
- //Generics info
- CORINFO_RESOLVED_TOKEN * pConstrainedResolvedToken,
+// return the address of the PInvoke target. May be a fixup area in the
+// case of late-bound PInvoke calls.
+void getAddressOfPInvokeTarget(CORINFO_METHOD_HANDLE method, CORINFO_CONST_LOOKUP* pLookup);
- //Security info
- CORINFO_METHOD_HANDLE callerHandle,
+// Generate a cookie based on the signature that would needs to be passed
+// to CORINFO_HELP_PINVOKE_CALLI
+LPVOID GetCookieForPInvokeCalliSig(CORINFO_SIG_INFO* szMetaSig, void** ppIndirection = NULL);
- //Jit info
- CORINFO_CALLINFO_FLAGS flags,
+// returns true if a VM cookie can be generated for it (might be false due to cross-module
+// inlining, in which case the inlining should be aborted)
+bool canGetCookieForPInvokeCalliSig(CORINFO_SIG_INFO* szMetaSig);
- //out params
- CORINFO_CALL_INFO *pResult
- );
+// Gets a handle that is checked to see if the current method is
+// included in "JustMyCode"
+CORINFO_JUST_MY_CODE_HANDLE getJustMyCodeHandle(CORINFO_METHOD_HANDLE method,
+ CORINFO_JUST_MY_CODE_HANDLE** ppIndirection = NULL);
- BOOL canAccessFamily(CORINFO_METHOD_HANDLE hCaller,
- CORINFO_CLASS_HANDLE hInstanceType);
+// Gets a method handle that can be used to correlate profiling data.
+// This is the IP of a native method, or the address of the descriptor struct
+// for IL. Always guaranteed to be unique per process, and not to move. */
+void GetProfilingHandle(BOOL* pbHookFunction, void** pProfilerHandle, BOOL* pbIndirectedHandles);
- // Returns TRUE if the Class Domain ID is the RID of the class (currently true for every class
- // except reflection emitted classes and generics)
- BOOL isRIDClassDomainID(CORINFO_CLASS_HANDLE cls);
+// Returns instructions on how to make the call. See code:CORINFO_CALL_INFO for possible return values.
+void getCallInfo(
+ // Token info
+ CORINFO_RESOLVED_TOKEN* pResolvedToken,
- // returns the class's domain ID for accessing shared statics
- unsigned getClassDomainID (
- CORINFO_CLASS_HANDLE cls,
- void **ppIndirection = NULL
- );
+ // Generics info
+ CORINFO_RESOLVED_TOKEN* pConstrainedResolvedToken,
+ // Security info
+ CORINFO_METHOD_HANDLE callerHandle,
- // return the data's address (for static fields only)
- void* getFieldAddress(
- CORINFO_FIELD_HANDLE field,
- void **ppIndirection = NULL
- );
+ // Jit info
+ CORINFO_CALLINFO_FLAGS flags,
- // registers a vararg sig & returns a VM cookie for it (which can contain other stuff)
- CORINFO_VARARGS_HANDLE getVarArgsHandle(
- CORINFO_SIG_INFO *pSig,
- void **ppIndirection = NULL
- );
+ // out params
+ CORINFO_CALL_INFO* pResult);
- // returns true if a VM cookie can be generated for it (might be false due to cross-module
- // inlining, in which case the inlining should be aborted)
- bool canGetVarArgsHandle(
- CORINFO_SIG_INFO *pSig
- );
+BOOL canAccessFamily(CORINFO_METHOD_HANDLE hCaller, CORINFO_CLASS_HANDLE hInstanceType);
- // Allocate a string literal on the heap and return a handle to it
- InfoAccessType constructStringLiteral(
- CORINFO_MODULE_HANDLE module,
- mdToken metaTok,
- void **ppValue
- );
+// Returns TRUE if the Class Domain ID is the RID of the class (currently true for every class
+// except reflection emitted classes and generics)
+BOOL isRIDClassDomainID(CORINFO_CLASS_HANDLE cls);
- InfoAccessType emptyStringLiteral(
- void **ppValue
- );
+// returns the class's domain ID for accessing shared statics
+unsigned getClassDomainID(CORINFO_CLASS_HANDLE cls, void** ppIndirection = NULL);
- // (static fields only) given that 'field' refers to thread local store,
- // return the ID (TLS index), which is used to find the begining of the
- // TLS data area for the particular DLL 'field' is associated with.
- DWORD getFieldThreadLocalStoreID (
- CORINFO_FIELD_HANDLE field,
- void **ppIndirection = NULL
- );
+// return the data's address (for static fields only)
+void* getFieldAddress(CORINFO_FIELD_HANDLE field, void** ppIndirection = NULL);
- // Sets another object to intercept calls to "self" and current method being compiled
- void setOverride(
- ICorDynamicInfo *pOverride,
- CORINFO_METHOD_HANDLE currentMethod
- );
+// registers a vararg sig & returns a VM cookie for it (which can contain other stuff)
+CORINFO_VARARGS_HANDLE getVarArgsHandle(CORINFO_SIG_INFO* pSig, void** ppIndirection = NULL);
- // Adds an active dependency from the context method's module to the given module
- // This is internal callback for the EE. JIT should not call it directly.
- void addActiveDependency(
- CORINFO_MODULE_HANDLE moduleFrom,
- CORINFO_MODULE_HANDLE moduleTo
- );
+// returns true if a VM cookie can be generated for it (might be false due to cross-module
+// inlining, in which case the inlining should be aborted)
+bool canGetVarArgsHandle(CORINFO_SIG_INFO* pSig);
+
+// Allocate a string literal on the heap and return a handle to it
+InfoAccessType constructStringLiteral(CORINFO_MODULE_HANDLE module, mdToken metaTok, void** ppValue);
- CORINFO_METHOD_HANDLE GetDelegateCtor(
- CORINFO_METHOD_HANDLE methHnd,
- CORINFO_CLASS_HANDLE clsHnd,
- CORINFO_METHOD_HANDLE targetMethodHnd,
- DelegateCtorArgs * pCtorData
- );
+InfoAccessType emptyStringLiteral(void** ppValue);
- void MethodCompileComplete(
- CORINFO_METHOD_HANDLE methHnd
+// (static fields only) given that 'field' refers to thread local store,
+// return the ID (TLS index), which is used to find the begining of the
+// TLS data area for the particular DLL 'field' is associated with.
+DWORD getFieldThreadLocalStoreID(CORINFO_FIELD_HANDLE field, void** ppIndirection = NULL);
+
+// Sets another object to intercept calls to "self" and current method being compiled
+void setOverride(ICorDynamicInfo* pOverride, CORINFO_METHOD_HANDLE currentMethod);
+
+// Adds an active dependency from the context method's module to the given module
+// This is internal callback for the EE. JIT should not call it directly.
+void addActiveDependency(CORINFO_MODULE_HANDLE moduleFrom, CORINFO_MODULE_HANDLE moduleTo);
+
+CORINFO_METHOD_HANDLE GetDelegateCtor(CORINFO_METHOD_HANDLE methHnd,
+ CORINFO_CLASS_HANDLE clsHnd,
+ CORINFO_METHOD_HANDLE targetMethodHnd,
+ DelegateCtorArgs* pCtorData);
+
+void MethodCompileComplete(CORINFO_METHOD_HANDLE methHnd);
+
+// return a thunk that will copy the arguments for the given signature.
+void* getTailCallCopyArgsThunk(CORINFO_SIG_INFO* pSig, CorInfoHelperTailCallSpecialHandling flags);
+
+// return memory manager that the JIT can use to allocate a regular memory
+IEEMemoryManager* getMemoryManager();
+
+// get a block of memory for the code, readonly data, and read-write data
+void allocMem(ULONG hotCodeSize, /* IN */
+ ULONG coldCodeSize, /* IN */
+ ULONG roDataSize, /* IN */
+ ULONG xcptnsCount, /* IN */
+ CorJitAllocMemFlag flag, /* IN */
+ void** hotCodeBlock, /* OUT */
+ void** coldCodeBlock, /* OUT */
+ void** roDataBlock /* OUT */
+ );
+
+// Reserve memory for the method/funclet's unwind information.
+// Note that this must be called before allocMem. It should be
+// called once for the main method, once for every funclet, and
+// once for every block of cold code for which allocUnwindInfo
+// will be called.
+//
+// This is necessary because jitted code must allocate all the
+// memory needed for the unwindInfo at the allocMem call.
+// For prejitted code we split up the unwinding information into
+// separate sections .rdata and .pdata.
+//
+void reserveUnwindInfo(BOOL isFunclet, /* IN */
+ BOOL isColdCode, /* IN */
+ ULONG unwindSize /* IN */
+ );
+
+// Allocate and initialize the .rdata and .pdata for this method or
+// funclet, and get the block of memory needed for the machine-specific
+// unwind information (the info for crawling the stack frame).
+// Note that allocMem must be called first.
+//
+// Parameters:
+//
+// pHotCode main method code buffer, always filled in
+// pColdCode cold code buffer, only filled in if this is cold code,
+// null otherwise
+// startOffset start of code block, relative to appropriate code buffer
+// (e.g. pColdCode if cold, pHotCode if hot).
+// endOffset end of code block, relative to appropriate code buffer
+// unwindSize size of unwind info pointed to by pUnwindBlock
+// pUnwindBlock pointer to unwind info
+// funcKind type of funclet (main method code, handler, filter)
+//
+void allocUnwindInfo(BYTE* pHotCode, /* IN */
+ BYTE* pColdCode, /* IN */
+ ULONG startOffset, /* IN */
+ ULONG endOffset, /* IN */
+ ULONG unwindSize, /* IN */
+ BYTE* pUnwindBlock, /* IN */
+ CorJitFuncKind funcKind /* IN */
+ );
+
+// Get a block of memory needed for the code manager information,
+// (the info for enumerating the GC pointers while crawling the
+// stack frame).
+// Note that allocMem must be called first
+void* allocGCInfo(size_t size /* IN */
+ );
+
+void yieldExecution();
+
+// Indicate how many exception handler blocks are to be returned.
+// This is guaranteed to be called before any 'setEHinfo' call.
+// Note that allocMem must be called before this method can be called.
+void setEHcount(unsigned cEH /* IN */
);
- // return a thunk that will copy the arguments for the given signature.
- void* getTailCallCopyArgsThunk (
- CORINFO_SIG_INFO *pSig,
- CorInfoHelperTailCallSpecialHandling flags
+// Set the values for one particular exception handler block.
+//
+// Handler regions should be lexically contiguous.
+// This is because FinallyIsUnwinding() uses lexicality to
+// determine if a "finally" clause is executing.
+void setEHinfo(unsigned EHnumber, /* IN */
+ const CORINFO_EH_CLAUSE* clause /* IN */
+ );
+
+// Level -> fatalError, Level 2 -> Error, Level 3 -> Warning
+// Level 4 means happens 10 times in a run, level 5 means 100, level 6 means 1000 ...
+// returns non-zero if the logging succeeded
+BOOL logMsg(unsigned level, const char* fmt, va_list args);
+
+// do an assert. will return true if the code should retry (DebugBreak)
+// returns false, if the assert should be igored.
+int doAssert(const char* szFile, int iLine, const char* szExpr);
+
+void reportFatalError(CorJitResult result);
+
+/*
+struct ProfileBuffer // Also defined here: code:CORBBTPROF_BLOCK_DATA
+{
+ ULONG ILOffset;
+ ULONG ExecutionCount;
+};
+*/
+
+// allocate a basic block profile buffer where execution counts will be stored
+// for jitted basic blocks.
+HRESULT allocBBProfileBuffer(ULONG count, // The number of basic blocks that we have
+ ProfileBuffer** profileBuffer);
+
+// get profile information to be used for optimizing the current method. The format
+// of the buffer is the same as the format the JIT passes to allocBBProfileBuffer.
+HRESULT getBBProfileData(CORINFO_METHOD_HANDLE ftnHnd,
+ ULONG* count, // The number of basic blocks that we have
+ ProfileBuffer** profileBuffer,
+ ULONG* numRuns);
+
+// Associates a native call site, identified by its offset in the native code stream, with
+// the signature information and method handle the JIT used to lay out the call site. If
+// the call site has no signature information (e.g. a helper call) or has no method handle
+// (e.g. a CALLI P/Invoke), then null should be passed instead.
+void recordCallSite(ULONG instrOffset, /* IN */
+ CORINFO_SIG_INFO* callSig, /* IN */
+ CORINFO_METHOD_HANDLE methodHandle /* IN */
);
- // return memory manager that the JIT can use to allocate a regular memory
- IEEMemoryManager* getMemoryManager();
-
- // get a block of memory for the code, readonly data, and read-write data
- void allocMem (
- ULONG hotCodeSize, /* IN */
- ULONG coldCodeSize, /* IN */
- ULONG roDataSize, /* IN */
- ULONG xcptnsCount, /* IN */
- CorJitAllocMemFlag flag, /* IN */
- void ** hotCodeBlock, /* OUT */
- void ** coldCodeBlock, /* OUT */
- void ** roDataBlock /* OUT */
- );
-
- // Reserve memory for the method/funclet's unwind information.
- // Note that this must be called before allocMem. It should be
- // called once for the main method, once for every funclet, and
- // once for every block of cold code for which allocUnwindInfo
- // will be called.
- //
- // This is necessary because jitted code must allocate all the
- // memory needed for the unwindInfo at the allocMem call.
- // For prejitted code we split up the unwinding information into
- // separate sections .rdata and .pdata.
- //
- void reserveUnwindInfo (
- BOOL isFunclet, /* IN */
- BOOL isColdCode, /* IN */
- ULONG unwindSize /* IN */
- );
-
- // Allocate and initialize the .rdata and .pdata for this method or
- // funclet, and get the block of memory needed for the machine-specific
- // unwind information (the info for crawling the stack frame).
- // Note that allocMem must be called first.
- //
- // Parameters:
- //
- // pHotCode main method code buffer, always filled in
- // pColdCode cold code buffer, only filled in if this is cold code,
- // null otherwise
- // startOffset start of code block, relative to appropriate code buffer
- // (e.g. pColdCode if cold, pHotCode if hot).
- // endOffset end of code block, relative to appropriate code buffer
- // unwindSize size of unwind info pointed to by pUnwindBlock
- // pUnwindBlock pointer to unwind info
- // funcKind type of funclet (main method code, handler, filter)
- //
- void allocUnwindInfo (
- BYTE * pHotCode, /* IN */
- BYTE * pColdCode, /* IN */
- ULONG startOffset, /* IN */
- ULONG endOffset, /* IN */
- ULONG unwindSize, /* IN */
- BYTE * pUnwindBlock, /* IN */
- CorJitFuncKind funcKind /* IN */
- );
-
- // Get a block of memory needed for the code manager information,
- // (the info for enumerating the GC pointers while crawling the
- // stack frame).
- // Note that allocMem must be called first
- void * allocGCInfo (
- size_t size /* IN */
- );
-
- void yieldExecution();
-
- // Indicate how many exception handler blocks are to be returned.
- // This is guaranteed to be called before any 'setEHinfo' call.
- // Note that allocMem must be called before this method can be called.
- void setEHcount (
- unsigned cEH /* IN */
- );
-
- // Set the values for one particular exception handler block.
- //
- // Handler regions should be lexically contiguous.
- // This is because FinallyIsUnwinding() uses lexicality to
- // determine if a "finally" clause is executing.
- void setEHinfo (
- unsigned EHnumber, /* IN */
- const CORINFO_EH_CLAUSE *clause /* IN */
- );
-
- // Level -> fatalError, Level 2 -> Error, Level 3 -> Warning
- // Level 4 means happens 10 times in a run, level 5 means 100, level 6 means 1000 ...
- // returns non-zero if the logging succeeded
- BOOL logMsg(unsigned level, const char* fmt, va_list args);
-
- // do an assert. will return true if the code should retry (DebugBreak)
- // returns false, if the assert should be igored.
- int doAssert(const char* szFile, int iLine, const char* szExpr);
-
- void reportFatalError(CorJitResult result);
-
- /*
- struct ProfileBuffer // Also defined here: code:CORBBTPROF_BLOCK_DATA
- {
- ULONG ILOffset;
- ULONG ExecutionCount;
- };
- */
-
- // allocate a basic block profile buffer where execution counts will be stored
- // for jitted basic blocks.
- HRESULT allocBBProfileBuffer (
- ULONG count, // The number of basic blocks that we have
- ProfileBuffer ** profileBuffer
- );
-
- // get profile information to be used for optimizing the current method. The format
- // of the buffer is the same as the format the JIT passes to allocBBProfileBuffer.
- HRESULT getBBProfileData(
- CORINFO_METHOD_HANDLE ftnHnd,
- ULONG * count, // The number of basic blocks that we have
- ProfileBuffer ** profileBuffer,
- ULONG * numRuns
- );
-
- // Associates a native call site, identified by its offset in the native code stream, with
- // the signature information and method handle the JIT used to lay out the call site. If
- // the call site has no signature information (e.g. a helper call) or has no method handle
- // (e.g. a CALLI P/Invoke), then null should be passed instead.
- void recordCallSite(
- ULONG instrOffset, /* IN */
- CORINFO_SIG_INFO * callSig, /* IN */
- CORINFO_METHOD_HANDLE methodHandle /* IN */
- );
-
- // A relocation is recorded if we are pre-jitting.
- // A jump thunk may be inserted if we are jitting
- void recordRelocation(
- void * location, /* IN */
- void * target, /* IN */
- WORD fRelocType, /* IN */
- WORD slotNum, /* IN */
- INT32 addlDelta /* IN */
- );
-
- WORD getRelocTypeHint(void * target);
-
- // A callback to identify the range of address known to point to
- // compiler-generated native entry points that call back into
- // MSIL.
- void getModuleNativeEntryPointRange(
- void ** pStart, /* OUT */
- void ** pEnd /* OUT */
- );
-
- // For what machine does the VM expect the JIT to generate code? The VM
- // returns one of the IMAGE_FILE_MACHINE_* values. Note that if the VM
- // is cross-compiling (such as the case for crossgen), it will return a
- // different value than if it was compiling for the host architecture.
- //
- DWORD getExpectedTargetArchitecture();
-
- // Fetches extended flags for a particular compilation instance. Returns
- // the number of bytes written to the provided buffer.
- DWORD getJitFlags(
- CORJIT_FLAGS* flags, /* IN: Points to a buffer that will hold the extended flags. */
- DWORD sizeInBytes /* IN: The size of the buffer. Note that this is effectively a
- version number for the CORJIT_FLAGS value. */
- );
+// A relocation is recorded if we are pre-jitting.
+// A jump thunk may be inserted if we are jitting
+void recordRelocation(void* location, /* IN */
+ void* target, /* IN */
+ WORD fRelocType, /* IN */
+ WORD slotNum, /* IN */
+ INT32 addlDelta /* IN */
+ );
+
+WORD getRelocTypeHint(void* target);
+
+// A callback to identify the range of address known to point to
+// compiler-generated native entry points that call back into
+// MSIL.
+void getModuleNativeEntryPointRange(void** pStart, /* OUT */
+ void** pEnd /* OUT */
+ );
+
+// For what machine does the VM expect the JIT to generate code? The VM
+// returns one of the IMAGE_FILE_MACHINE_* values. Note that if the VM
+// is cross-compiling (such as the case for crossgen), it will return a
+// different value than if it was compiling for the host architecture.
+//
+DWORD getExpectedTargetArchitecture();
+
+// Fetches extended flags for a particular compilation instance. Returns
+// the number of bytes written to the provided buffer.
+DWORD getJitFlags(CORJIT_FLAGS* flags, /* IN: Points to a buffer that will hold the extended flags. */
+ DWORD sizeInBytes /* IN: The size of the buffer. Note that this is effectively a
+ version number for the CORJIT_FLAGS value. */
+ );
#endif // _ICorJitInfoImpl
diff --git a/src/ToolBox/superpmi/superpmi-shared/lightweightmap.h b/src/ToolBox/superpmi/superpmi-shared/lightweightmap.h
index 860f545..12e7100 100644
--- a/src/ToolBox/superpmi/superpmi-shared/lightweightmap.h
+++ b/src/ToolBox/superpmi/superpmi-shared/lightweightmap.h
@@ -27,12 +27,12 @@ public:
InitialClear();
}
- LightWeightMapBuffer(const LightWeightMapBuffer &lwm)
+ LightWeightMapBuffer(const LightWeightMapBuffer& lwm)
{
InitialClear();
bufferLength = lwm.bufferLength;
- if((lwm.buffer!=nullptr)&&(lwm.bufferLength>0))
+ if ((lwm.buffer != nullptr) && (lwm.bufferLength > 0))
{
buffer = new unsigned char[lwm.bufferLength];
memcpy(buffer, lwm.buffer, lwm.bufferLength);
@@ -41,87 +41,87 @@ public:
~LightWeightMapBuffer()
{
- delete []buffer;
+ delete[] buffer;
}
- unsigned int AddBuffer(const unsigned char *buff, unsigned int len)
+ unsigned int AddBuffer(const unsigned char* buff, unsigned int len)
{
return AddBuffer(buff, len, false);
}
- unsigned int AddBuffer(const unsigned char *buff, unsigned int len, bool forceUnique)
+ unsigned int AddBuffer(const unsigned char* buff, unsigned int len, bool forceUnique)
{
- if(len == 0)
+ if (len == 0)
return -1;
- if(buff == nullptr)
+ if (buff == nullptr)
return -1;
- int index = Contains(buff, len); //See if there is already a copy of this data in our buffer
- if((index != -1)&&(!forceUnique))
+ int index = Contains(buff, len); // See if there is already a copy of this data in our buffer
+ if ((index != -1) && (!forceUnique))
return index;
- if(locked)
+ if (locked)
{
LogError("Added item that extended the buffer after it was locked by a call to GetBuffer()");
__debugbreak();
}
- unsigned int newbuffsize = bufferLength + sizeof(unsigned int) + len;
- unsigned char *newbuffer = new unsigned char[newbuffsize];
- unsigned int newOffset = bufferLength;
- if(bufferLength>0)
+ unsigned int newbuffsize = bufferLength + sizeof(unsigned int) + len;
+ unsigned char* newbuffer = new unsigned char[newbuffsize];
+ unsigned int newOffset = bufferLength;
+ if (bufferLength > 0)
memcpy(newbuffer, buffer, bufferLength);
memcpy(newbuffer + bufferLength + sizeof(unsigned int), buff, len);
- *((unsigned int *)(newbuffer + bufferLength)) = len;
+ *((unsigned int*)(newbuffer + bufferLength)) = len;
bufferLength += sizeof(unsigned int) + len;
- if(buffer!=nullptr)
- delete []buffer;
+ if (buffer != nullptr)
+ delete[] buffer;
buffer = newbuffer;
return newOffset + sizeof(unsigned int);
}
- unsigned char *GetBuffer(unsigned int offset)
+ unsigned char* GetBuffer(unsigned int offset)
{
- if(offset == (unsigned int)-1)
+ if (offset == (unsigned int)-1)
return nullptr;
- AssertCodeMsg(offset < bufferLength, EXCEPTIONCODE_LWM,
- "Hit offset bigger than bufferLength %u >= %u", offset, bufferLength);
+ AssertCodeMsg(offset < bufferLength, EXCEPTIONCODE_LWM, "Hit offset bigger than bufferLength %u >= %u", offset,
+ bufferLength);
locked = true;
// LogDebug("Address given %p", &buffer[offset]);
return &buffer[offset];
}
- int Contains(const unsigned char *buff, unsigned int len)
+ int Contains(const unsigned char* buff, unsigned int len)
{
#ifdef DEBUG_LWM
LogDebug("New call to Contains %d {", len);
- for(int i=0;i<len;i++)
+ for (int i = 0; i < len; i++)
LogDebug("0x%02x ", buff[len]);
LogDebug("}");
#endif
- if(len == 0)
+ if (len == 0)
return -1;
- if(bufferLength == 0)
+ if (bufferLength == 0)
return -1;
unsigned int offset = 0;
- while((offset+sizeof(unsigned int)+len) <= bufferLength)
+ while ((offset + sizeof(unsigned int) + len) <= bufferLength)
{
unsigned int buffChunkLen = *(unsigned int*)(&buffer[offset]);
#ifdef DEBUG_LWM
LogDebug("Investigating len %d @ %d", buffChunkLen, offset);
#endif
- if(buffChunkLen == len)
+ if (buffChunkLen == len)
{
#ifdef DEBUG_LWM
LogDebug("peering into {");
- for(int i=0;i<len;i++)
+ for (int i = 0; i < len; i++)
LogDebug("0x%02x ", buff[len]);
LogDebug("}");
#endif
- if(memcmp(&buffer[offset+sizeof(unsigned int)], buff, len)==0)
+ if (memcmp(&buffer[offset + sizeof(unsigned int)], buff, len) == 0)
{
#ifdef DEBUG_LWM
LogDebug("Found!");
#endif
- return offset+sizeof(unsigned int);
+ return offset + sizeof(unsigned int);
}
}
offset += sizeof(unsigned int) + buffChunkLen;
@@ -132,26 +132,26 @@ public:
return -1;
}
- void Unlock() //did you really mean to use this?
+ void Unlock() // did you really mean to use this?
{
locked = false;
}
protected:
-
void InitialClear()
{
- buffer = nullptr;
+ buffer = nullptr;
bufferLength = 0;
- locked = false;
+ locked = false;
}
- unsigned char* buffer; // TODO-Cleanup: this should really be a linked list; we reallocate it with every call to AddBuffer().
+ unsigned char* buffer; // TODO-Cleanup: this should really be a linked list; we reallocate it with every call to
+ // AddBuffer().
unsigned int bufferLength;
- bool locked;
+ bool locked;
};
-template<typename _Key, typename _Item>
+template <typename _Key, typename _Item>
class LightWeightMap : public LightWeightMapBuffer
{
public:
@@ -160,28 +160,28 @@ public:
InitialClear();
}
- LightWeightMap(const LightWeightMap &lwm)
+ LightWeightMap(const LightWeightMap& lwm)
{
InitialClear();
- numItems = lwm.numItems;
- strideSize = lwm.strideSize;
+ numItems = lwm.numItems;
+ strideSize = lwm.strideSize;
bufferLength = lwm.bufferLength;
- locked = false;
+ locked = false;
- pKeys = nullptr;
+ pKeys = nullptr;
pItems = nullptr;
- if(lwm.pKeys!=nullptr)
+ if (lwm.pKeys != nullptr)
{
pKeys = new _Key[numItems];
memcpy(pKeys, lwm.pKeys, numItems * sizeof(_Key));
}
- if(lwm.pItems!=nullptr)
+ if (lwm.pItems != nullptr)
{
pItems = new _Item[numItems];
memcpy(pItems, lwm.pItems, numItems * sizeof(_Item));
}
- if((lwm.buffer!=nullptr)&&(lwm.bufferLength>0))
+ if ((lwm.buffer != nullptr) && (lwm.bufferLength > 0))
{
buffer = new unsigned char[lwm.bufferLength];
memcpy(buffer, lwm.buffer, lwm.bufferLength);
@@ -190,17 +190,17 @@ public:
~LightWeightMap()
{
- if(pKeys!=nullptr)
- delete []pKeys;
- if(pItems!=nullptr)
- delete []pItems;
+ if (pKeys != nullptr)
+ delete[] pKeys;
+ if (pItems != nullptr)
+ delete[] pItems;
}
- void ReadFromArray(const unsigned char *rawData, unsigned int size)
+ void ReadFromArray(const unsigned char* rawData, unsigned int size)
{
- unsigned int sizeOfKey = sizeof(_Key);
- unsigned int sizeOfItem = sizeof(_Item);
- const unsigned char *ptr = rawData;
+ unsigned int sizeOfKey = sizeof(_Key);
+ unsigned int sizeOfItem = sizeof(_Item);
+ const unsigned char* ptr = rawData;
// The tag is optional, to roll forward previous formats which don't have
// the tag, but which also have the same format.
@@ -213,156 +213,154 @@ public:
ptr += sizeof(unsigned int);
strideSize = numItems;
- if(numItems > 0)
+ if (numItems > 0)
{
- //Read the buffersize
+ // Read the buffersize
memcpy(&bufferLength, ptr, sizeof(unsigned int));
ptr += sizeof(unsigned int);
AssertCodeMsg(pKeys == nullptr, EXCEPTIONCODE_LWM, "Found existing pKeys");
pKeys = new _Key[numItems];
- //Set the Keys
+ // Set the Keys
memcpy(pKeys, ptr, sizeOfKey * numItems);
ptr += sizeOfKey * numItems;
AssertCodeMsg(pItems == nullptr, EXCEPTIONCODE_LWM, "Found existing pItems");
pItems = new _Item[numItems];
- //Set the Items
+ // Set the Items
memcpy(pItems, ptr, sizeOfItem * numItems);
ptr += sizeOfItem * numItems;
AssertCodeMsg(buffer == nullptr, EXCEPTIONCODE_LWM, "Found existing buffer");
buffer = new unsigned char[bufferLength];
- //Read the buffer
+ // Read the buffer
memcpy(buffer, ptr, bufferLength * sizeof(unsigned char));
ptr += bufferLength * sizeof(unsigned char);
}
// If we have RTTI, we can make this assert report the correct type. No RTTI, though, when
// built with .NET Core, especially when built against the PAL.
- AssertCodeMsg((ptr - rawData) == size, EXCEPTIONCODE_LWM,
- "%s - Ended with unexpected sizes %Ix != %x",
- "Unknown type" /*typeid(_Item).name()*/, ptr - rawData, size);
+ AssertCodeMsg((ptr - rawData) == size, EXCEPTIONCODE_LWM, "%s - Ended with unexpected sizes %Ix != %x",
+ "Unknown type" /*typeid(_Item).name()*/, ptr - rawData, size);
}
unsigned int CalculateArraySize()
{
int size = 4 /* tag */ + sizeof(unsigned int) /* numItems */;
- if(numItems >0)
+ if (numItems > 0)
{
- size += sizeof(unsigned int); //size of bufferLength
- size += sizeof(_Key) * numItems; //size of keyset
- size += sizeof(_Item) * numItems; //size of itemset
- size += sizeof(unsigned char) * bufferLength; //bulk size of raw buffer
+ size += sizeof(unsigned int); // size of bufferLength
+ size += sizeof(_Key) * numItems; // size of keyset
+ size += sizeof(_Item) * numItems; // size of itemset
+ size += sizeof(unsigned char) * bufferLength; // bulk size of raw buffer
}
return size;
}
- unsigned int DumpToArray(unsigned char *bytes)
+ unsigned int DumpToArray(unsigned char* bytes)
{
- unsigned char *ptr = bytes;
- unsigned int size = CalculateArraySize();
+ unsigned char* ptr = bytes;
+ unsigned int size = CalculateArraySize();
- //Write the tag
+ // Write the tag
memcpy(ptr, "LWM1", 4);
ptr += 4;
- //Write the header
+ // Write the header
memcpy(ptr, &numItems, sizeof(unsigned int));
ptr += sizeof(unsigned int);
- if(numItems > 0)
+ if (numItems > 0)
{
- unsigned int sizeOfKey = sizeof(_Key);
+ unsigned int sizeOfKey = sizeof(_Key);
unsigned int sizeOfItem = sizeof(_Item);
- //Write the buffersize
+ // Write the buffersize
memcpy(ptr, &bufferLength, sizeof(unsigned int));
ptr += sizeof(unsigned int);
- //Write the Keys
+ // Write the Keys
memcpy(ptr, pKeys, sizeOfKey * numItems);
ptr += sizeOfKey * numItems;
- //Write the Items
+ // Write the Items
memcpy(ptr, pItems, sizeOfItem * numItems);
ptr += sizeOfItem * numItems;
- //Write the buffer
+ // Write the buffer
memcpy(ptr, buffer, bufferLength * sizeof(unsigned char));
ptr += bufferLength * sizeof(unsigned char);
}
// If we have RTTI, we can make this assert report the correct type. No RTTI, though, when
// built with .NET Core, especially when built against the PAL.
- AssertCodeMsg((ptr - bytes) == size, EXCEPTIONCODE_LWM,
- "%s - Ended with unexpected sizes %p != %x",
- "Unknown type" /*typeid(_Item).name()*/, (void*)(ptr - bytes), size);
+ AssertCodeMsg((ptr - bytes) == size, EXCEPTIONCODE_LWM, "%s - Ended with unexpected sizes %p != %x",
+ "Unknown type" /*typeid(_Item).name()*/, (void*)(ptr - bytes), size);
return size;
}
- //its worth noting that the acutal order of insert here doesnt meet what you migth expect. Its using memcmp, so
+ // its worth noting that the acutal order of insert here doesnt meet what you migth expect. Its using memcmp, so
// since we are on a little endian machine we'd use the lowest 8 bits as the first part of the key. This is
// a side effect of using the same code for large structs and DWORDS etc...
bool Add(_Key key, _Item item)
{
- //Make sure we have space left, expand if needed
- if(numItems == strideSize)
+ // Make sure we have space left, expand if needed
+ if (numItems == strideSize)
{
- _Key *tKeys = pKeys;
- _Item *tItems = pItems;
- pKeys = new _Key[(strideSize * 2) + 4];
+ _Key* tKeys = pKeys;
+ _Item* tItems = pItems;
+ pKeys = new _Key[(strideSize * 2) + 4];
memcpy(pKeys, tKeys, strideSize * sizeof(_Key));
pItems = new _Item[(strideSize * 2) + 4];
memcpy(pItems, tItems, strideSize * sizeof(_Item));
- strideSize = (strideSize * 2) + 4;
- delete []tKeys;
- delete []tItems;
+ strideSize = (strideSize * 2) + 4;
+ delete[] tKeys;
+ delete[] tItems;
}
unsigned int insert = 0;
- //Find the right place to insert O(n) version
-/* for(;insert < numItems; insert++)
- {
- int res = memcmp(&pKeys[insert], &key, sizeof(_Key));
- if(res == 0)
- return false;
- if(res>0)
- break;
- }
-*/
- //O(log n) version
+ // Find the right place to insert O(n) version
+ /* for(;insert < numItems; insert++)
+ {
+ int res = memcmp(&pKeys[insert], &key, sizeof(_Key));
+ if(res == 0)
+ return false;
+ if(res>0)
+ break;
+ }
+ */
+ // O(log n) version
int first = 0;
- int mid = 0;
- int last = numItems-1;
+ int mid = 0;
+ int last = numItems - 1;
while (first <= last)
{
- mid = (first + last) / 2; // compute mid point.
- int res = memcmp(&pKeys[mid], &key, sizeof(_Key));
-
- if (res < 0)
- first = mid + 1; // repeat search in top half.
- else if (res > 0)
- last = mid - 1; // repeat search in bottom half.
- else
- return false; // found it. return position /////
+ mid = (first + last) / 2; // compute mid point.
+ int res = memcmp(&pKeys[mid], &key, sizeof(_Key));
+
+ if (res < 0)
+ first = mid + 1; // repeat search in top half.
+ else if (res > 0)
+ last = mid - 1; // repeat search in bottom half.
+ else
+ return false; // found it. return position /////
}
insert = first;
- if(insert!=first)
+ if (insert != first)
{
LogDebug("index = %u f %u mid = %u l %u***************************", insert, first, mid, last);
__debugbreak();
}
- if(numItems>0)
+ if (numItems > 0)
{
- for(unsigned int i=numItems; i>insert; i--)
+ for (unsigned int i = numItems; i > insert; i--)
{
- pKeys[i] = pKeys[i-1];
- pItems[i] = pItems[i-1];
+ pKeys[i] = pKeys[i - 1];
+ pItems[i] = pItems[i - 1];
}
}
- pKeys[insert] = key;
+ pKeys[insert] = key;
pItems[insert] = item;
numItems++;
return true;
@@ -370,24 +368,24 @@ public:
int GetIndex(_Key key)
{
- if(numItems == 0)
+ if (numItems == 0)
return -1;
- //O(log n) version
+ // O(log n) version
int first = 0;
- int mid = 0;
- int last = numItems;
+ int mid = 0;
+ int last = numItems;
while (first <= last)
{
- mid = (first + last) / 2; // compute mid point.
- int res = memcmp(&pKeys[mid], &key, sizeof(_Key));
-
- if (res < 0)
- first = mid + 1; // repeat search in top half.
- else if (res > 0)
- last = mid - 1; // repeat search in bottom half.
- else
- return mid; // found it. return position /////
+ mid = (first + last) / 2; // compute mid point.
+ int res = memcmp(&pKeys[mid], &key, sizeof(_Key));
+
+ if (res < 0)
+ first = mid + 1; // repeat search in top half.
+ else if (res > 0)
+ last = mid - 1; // repeat search in bottom half.
+ else
+ return mid; // found it. return position /////
}
return -1; // Didn't find key
}
@@ -395,7 +393,7 @@ public:
_Item GetItem(int index)
{
AssertCodeMsg(index != -1, EXCEPTIONCODE_LWM, "Didn't find Key");
- return pItems[index]; // found it. return position /////
+ return pItems[index]; // found it. return position /////
}
_Key GetKey(int index)
@@ -410,12 +408,12 @@ public:
return GetItem(index);
}
- _Item *GetRawItems()
+ _Item* GetRawItems()
{
return pItems;
}
- _Key *GetRawKeys()
+ _Key* GetRawKeys()
{
return pKeys;
}
@@ -426,27 +424,26 @@ public:
}
private:
-
void InitialClear()
{
- numItems = 0;
+ numItems = 0;
strideSize = 0;
- pKeys = nullptr;
- pItems = nullptr;
+ pKeys = nullptr;
+ pItems = nullptr;
}
- unsigned int numItems; // Number of active items in the pKeys and pItems arrays.
- unsigned int strideSize; // Allocated count of items in the pKeys and pItems arrays.
- _Key *pKeys;
- _Item *pItems;
+ unsigned int numItems; // Number of active items in the pKeys and pItems arrays.
+ unsigned int strideSize; // Allocated count of items in the pKeys and pItems arrays.
+ _Key* pKeys;
+ _Item* pItems;
};
-
// Second implementation of LightWeightMap where the Key type is an unsigned int in the range [0 .. numItems - 1] (where
// numItems is the number of items stored in the map). Keys are not stored, since the index into the pItems array is
-// the key. Appending to the end of the map is O(1), since we don't have to search for it, and we don't have to move anything down.
+// the key. Appending to the end of the map is O(1), since we don't have to search for it, and we don't have to move
+// anything down.
-template<typename _Item>
+template <typename _Item>
class DenseLightWeightMap : public LightWeightMapBuffer
{
public:
@@ -455,19 +452,19 @@ public:
InitialClear();
}
- DenseLightWeightMap(const DenseLightWeightMap &lwm)
+ DenseLightWeightMap(const DenseLightWeightMap& lwm)
{
InitialClear();
- numItems = lwm.numItems;
- strideSize = lwm.strideSize;
+ numItems = lwm.numItems;
+ strideSize = lwm.strideSize;
bufferLength = lwm.bufferLength;
- if(lwm.pItems!=nullptr)
+ if (lwm.pItems != nullptr)
{
pItems = new _Item[numItems];
memcpy(pItems, lwm.pItems, numItems * sizeof(_Item));
}
- if((lwm.buffer!=nullptr)&&(lwm.bufferLength>0))
+ if ((lwm.buffer != nullptr) && (lwm.bufferLength > 0))
{
buffer = new unsigned char[lwm.bufferLength];
memcpy(buffer, lwm.buffer, lwm.bufferLength);
@@ -476,14 +473,14 @@ public:
~DenseLightWeightMap()
{
- if(pItems!=nullptr)
- delete []pItems;
+ if (pItems != nullptr)
+ delete[] pItems;
}
- void ReadFromArray(const unsigned char *rawData, unsigned int size)
+ void ReadFromArray(const unsigned char* rawData, unsigned int size)
{
- unsigned int sizeOfItem = sizeof(_Item);
- const unsigned char *ptr = rawData;
+ unsigned int sizeOfItem = sizeof(_Item);
+ const unsigned char* ptr = rawData;
// Check tag; if this is a v1 LWM, convert it to a DenseLightWeightMap in memory
if (0 != memcmp(ptr, "DWM1", 4))
@@ -497,59 +494,59 @@ public:
ptr += sizeof(unsigned int);
strideSize = numItems;
- if(numItems > 0)
+ if (numItems > 0)
{
- //Read the buffersize
+ // Read the buffersize
memcpy(&bufferLength, ptr, sizeof(unsigned int));
ptr += sizeof(unsigned int);
AssertCodeMsg(pItems == nullptr, EXCEPTIONCODE_LWM, "Found existing pItems");
pItems = new _Item[numItems];
- //Set the Items
+ // Set the Items
memcpy(pItems, ptr, sizeOfItem * numItems);
ptr += sizeOfItem * numItems;
AssertCodeMsg(buffer == nullptr, EXCEPTIONCODE_LWM, "Found existing buffer");
buffer = new unsigned char[bufferLength];
- //Read the buffer
+ // Read the buffer
memcpy(buffer, ptr, bufferLength * sizeof(unsigned char));
ptr += bufferLength * sizeof(unsigned char);
}
- AssertCodeMsg((ptr - rawData) == size, EXCEPTIONCODE_LWM, "Ended with unexpected sizes %Ix != %x", ptr - rawData, size);
+ AssertCodeMsg((ptr - rawData) == size, EXCEPTIONCODE_LWM, "Ended with unexpected sizes %Ix != %x",
+ ptr - rawData, size);
}
private:
-
- void ReadFromArrayAndConvertLWM1(const unsigned char *rawData, unsigned int size)
+ void ReadFromArrayAndConvertLWM1(const unsigned char* rawData, unsigned int size)
{
- unsigned int sizeOfKey = sizeof(DWORD);
- unsigned int sizeOfItem = sizeof(_Item);
- const unsigned char *ptr = rawData;
+ unsigned int sizeOfKey = sizeof(DWORD);
+ unsigned int sizeOfItem = sizeof(_Item);
+ const unsigned char* ptr = rawData;
memcpy(&numItems, ptr, sizeof(unsigned int));
ptr += sizeof(unsigned int);
strideSize = numItems;
- if(numItems > 0)
+ if (numItems > 0)
{
- //Read the buffersize
+ // Read the buffersize
memcpy(&bufferLength, ptr, sizeof(unsigned int));
ptr += sizeof(unsigned int);
DWORD* tKeys = new DWORD[numItems];
- //Set the Keys
+ // Set the Keys
memcpy(tKeys, ptr, sizeOfKey * numItems);
ptr += sizeOfKey * numItems;
_Item* tItems = new _Item[numItems];
- //Set the Items
+ // Set the Items
memcpy(tItems, ptr, sizeOfItem * numItems);
ptr += sizeOfItem * numItems;
AssertCodeMsg(buffer == nullptr, EXCEPTIONCODE_LWM, "Found existing buffer");
buffer = new unsigned char[bufferLength];
- //Read the buffer
+ // Read the buffer
memcpy(buffer, ptr, bufferLength * sizeof(unsigned char));
ptr += bufferLength * sizeof(unsigned char);
@@ -567,7 +564,7 @@ private:
AssertCodeMsg(key < numItems, EXCEPTIONCODE_LWM, "Illegal key %d, numItems == %d", key, numItems);
AssertCodeMsg(!tKeySeen[key], EXCEPTIONCODE_LWM, "Duplicate key %d", key);
tKeySeen[key] = true;
- pItems[key] = tItems[index];
+ pItems[key] = tItems[index];
}
// Note that if we get here, we've seen every key [0 .. numItems - 1].
@@ -576,68 +573,69 @@ private:
delete[] tItems;
}
- AssertCodeMsg((ptr - rawData) == size, EXCEPTIONCODE_LWM, "Ended with unexpected sizes %Ix != %x", ptr - rawData, size);
+ AssertCodeMsg((ptr - rawData) == size, EXCEPTIONCODE_LWM, "Ended with unexpected sizes %Ix != %x",
+ ptr - rawData, size);
}
public:
-
unsigned int CalculateArraySize()
{
int size = 4 /* tag */ + sizeof(unsigned int) /* numItems */;
- if(numItems >0)
+ if (numItems > 0)
{
- size += sizeof(unsigned int); //size of bufferLength
- size += sizeof(_Item) * numItems; //size of itemset
- size += sizeof(unsigned char) * bufferLength; //bulk size of raw buffer
+ size += sizeof(unsigned int); // size of bufferLength
+ size += sizeof(_Item) * numItems; // size of itemset
+ size += sizeof(unsigned char) * bufferLength; // bulk size of raw buffer
}
return size;
}
- unsigned int DumpToArray(unsigned char *bytes)
+ unsigned int DumpToArray(unsigned char* bytes)
{
- unsigned char *ptr = bytes;
- unsigned int size = CalculateArraySize();
+ unsigned char* ptr = bytes;
+ unsigned int size = CalculateArraySize();
- //Write the tag
+ // Write the tag
memcpy(ptr, "DWM1", 4);
ptr += 4;
- //Write the header
+ // Write the header
memcpy(ptr, &numItems, sizeof(unsigned int));
ptr += sizeof(unsigned int);
- if(numItems > 0)
+ if (numItems > 0)
{
unsigned int sizeOfItem = sizeof(_Item);
- //Write the buffersize
+ // Write the buffersize
memcpy(ptr, &bufferLength, sizeof(unsigned int));
ptr += sizeof(unsigned int);
- //Write the Items
+ // Write the Items
memcpy(ptr, pItems, sizeOfItem * numItems);
ptr += sizeOfItem * numItems;
- //Write the buffer
+ // Write the buffer
memcpy(ptr, buffer, bufferLength * sizeof(unsigned char));
ptr += bufferLength * sizeof(unsigned char);
}
- AssertCodeMsg((ptr - bytes) == size, EXCEPTIONCODE_LWM, "Ended with unexpected sizes %Ix != %x", ptr - bytes, size);
+ AssertCodeMsg((ptr - bytes) == size, EXCEPTIONCODE_LWM, "Ended with unexpected sizes %Ix != %x", ptr - bytes,
+ size);
return size;
}
bool Append(_Item item)
{
- //Make sure we have space left, expand if needed
+ // Make sure we have space left, expand if needed
if (numItems == strideSize)
{
// NOTE: if this is the first allocation, we'll just allocate 4 items. ok?
- _Item *tItems = pItems;
- pItems = new _Item[(strideSize * 2) + 4];
+ _Item* tItems = pItems;
+ pItems = new _Item[(strideSize * 2) + 4];
memcpy(pItems, tItems, strideSize * sizeof(_Item));
- strideSize = (strideSize * 2) + 4;
- delete []tItems;
+ strideSize = (strideSize * 2) + 4;
+ delete[] tItems;
}
pItems[numItems] = item;
@@ -656,7 +654,7 @@ public:
_Item GetItem(int index)
{
AssertCodeMsg(index != -1, EXCEPTIONCODE_LWM, "Didn't find Key");
- return pItems[index]; // found it. return position /////
+ return pItems[index]; // found it. return position /////
}
_Item Get(unsigned int key)
@@ -665,7 +663,7 @@ public:
return GetItem(index);
}
- _Item *GetRawItems()
+ _Item* GetRawItems()
{
return pItems;
}
@@ -676,12 +674,11 @@ public:
}
private:
-
void InitialClear()
{
- numItems = 0;
+ numItems = 0;
strideSize = 0;
- pItems = nullptr;
+ pItems = nullptr;
}
static int CompareKeys(unsigned int key1, unsigned int key2)
@@ -694,33 +691,33 @@ private:
return 0; // equal
}
- unsigned int numItems; // Number of active items in the pKeys and pItems arrays.
- unsigned int strideSize; // Allocated count of items in the pKeys and pItems arrays.
- _Item *pItems;
+ unsigned int numItems; // Number of active items in the pKeys and pItems arrays.
+ unsigned int strideSize; // Allocated count of items in the pKeys and pItems arrays.
+ _Item* pItems;
};
-#define dumpLWM(ptr,mapName) \
- if (ptr->mapName != nullptr) \
- { \
- printf("%s - %u\n", #mapName, ptr->mapName->GetCount()); \
- for (unsigned int i = 0; i < ptr->mapName->GetCount(); i++) \
- { \
- printf("%u-", i); \
- ptr->dmp##mapName(ptr->mapName->GetRawKeys()[i], ptr->mapName->GetRawItems()[i]); \
- printf("\n"); \
- } \
- }
-
-#define dumpLWMDense(ptr,mapName) \
- if (ptr->mapName != nullptr) \
- { \
- printf("%s - %u\n", #mapName, ptr->mapName->GetCount()); \
- for (unsigned int i = 0; i < ptr->mapName->GetCount(); i++) \
- { \
- printf("%u-", i); \
- ptr->dmp##mapName(i, ptr->mapName->GetRawItems()[i]); \
- printf("\n"); \
- } \
+#define dumpLWM(ptr, mapName) \
+ if (ptr->mapName != nullptr) \
+ { \
+ printf("%s - %u\n", #mapName, ptr->mapName->GetCount()); \
+ for (unsigned int i = 0; i < ptr->mapName->GetCount(); i++) \
+ { \
+ printf("%u-", i); \
+ ptr->dmp##mapName(ptr->mapName->GetRawKeys()[i], ptr->mapName->GetRawItems()[i]); \
+ printf("\n"); \
+ } \
+ }
+
+#define dumpLWMDense(ptr, mapName) \
+ if (ptr->mapName != nullptr) \
+ { \
+ printf("%s - %u\n", #mapName, ptr->mapName->GetCount()); \
+ for (unsigned int i = 0; i < ptr->mapName->GetCount(); i++) \
+ { \
+ printf("%u-", i); \
+ ptr->dmp##mapName(i, ptr->mapName->GetRawItems()[i]); \
+ printf("\n"); \
+ } \
}
#endif // _LightWeightMap
diff --git a/src/ToolBox/superpmi/superpmi-shared/logging.cpp b/src/ToolBox/superpmi/superpmi-shared/logging.cpp
index 69c321b..bd7de08 100644
--- a/src/ToolBox/superpmi/superpmi-shared/logging.cpp
+++ b/src/ToolBox/superpmi/superpmi-shared/logging.cpp
@@ -17,10 +17,10 @@
// that occur while logging will print a message to the console. Fatal errors trigger a debugbreak.
//
-bool Logger::s_initialized = false;
-UINT32 Logger::s_logLevel = LOGMASK_DEFAULT;
-HANDLE Logger::s_logFile = INVALID_HANDLE_VALUE;
-char *Logger::s_logFilePath = nullptr;
+bool Logger::s_initialized = false;
+UINT32 Logger::s_logLevel = LOGMASK_DEFAULT;
+HANDLE Logger::s_logFile = INVALID_HANDLE_VALUE;
+char* Logger::s_logFilePath = nullptr;
CRITICAL_SECTION Logger::s_critSec;
//
@@ -54,17 +54,12 @@ void Logger::Shutdown()
// Opens a log file at the given path and enables file-based logging, if the given path is valid.
//
/* static */
-void Logger::OpenLogFile(char *logFilePath)
+void Logger::OpenLogFile(char* logFilePath)
{
if (s_logFile == INVALID_HANDLE_VALUE && logFilePath != nullptr)
{
- s_logFile = CreateFileA(logFilePath,
- GENERIC_WRITE,
- FILE_SHARE_READ | FILE_SHARE_DELETE,
- NULL,
- CREATE_ALWAYS,
- FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN,
- NULL);
+ s_logFile = CreateFileA(logFilePath, GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_DELETE, NULL, CREATE_ALWAYS,
+ FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
if (s_logFile != INVALID_HANDLE_VALUE)
{
@@ -73,7 +68,8 @@ void Logger::OpenLogFile(char *logFilePath)
}
else
{
- fprintf(stderr, "WARNING: [Logger::OpenLogFile] Failed to open log file '%s'. GetLastError()=%u\n", logFilePath, GetLastError());
+ fprintf(stderr, "WARNING: [Logger::OpenLogFile] Failed to open log file '%s'. GetLastError()=%u\n",
+ logFilePath, GetLastError());
}
}
}
@@ -92,7 +88,8 @@ void Logger::CloseLogFile()
// We can call this before closing the handle because DeleteFile just marks the file
// for deletion, i.e. it does not actually get deleted until its last handle is closed.
if (!DeleteFileA(s_logFilePath))
- fprintf(stderr, "WARNING: [Logger::CloseLogFile] DeleteFile failed. GetLastError()=%u\n", GetLastError());
+ fprintf(stderr, "WARNING: [Logger::CloseLogFile] DeleteFile failed. GetLastError()=%u\n",
+ GetLastError());
}
if (!CloseHandle(s_logFile))
@@ -118,13 +115,13 @@ void Logger::CloseLogFile()
// to avoid looking up all the log levels and enabling them all by specifying all the individual characters.
//
/* static */
-UINT32 Logger::ParseLogLevelString(const char *specifierStr)
+UINT32 Logger::ParseLogLevelString(const char* specifierStr)
{
UINT32 logLevelMask = LOGMASK_NONE;
- if (strchr(specifierStr, 'q') == nullptr) // "Quiet" overrides all other specifiers
+ if (strchr(specifierStr, 'q') == nullptr) // "Quiet" overrides all other specifiers
{
- if (strchr(specifierStr, 'a') != nullptr) // "All" overrides the other specifiers
+ if (strchr(specifierStr, 'a') != nullptr) // "All" overrides the other specifiers
{
logLevelMask |= LOGMASK_ALL;
}
@@ -157,8 +154,7 @@ UINT32 Logger::ParseLogLevelString(const char *specifierStr)
}
/* static */
-void Logger::LogPrintf(const char *function, const char *file, int line,
- LogLevel level, const char *msg, ...)
+void Logger::LogPrintf(const char* function, const char* file, int line, LogLevel level, const char* msg, ...)
{
va_list argList;
va_start(argList, msg);
@@ -170,8 +166,8 @@ void Logger::LogPrintf(const char *function, const char *file, int line,
// main logging function that all other logging functions eventually funnel into.
//
/* static */
-void Logger::LogVprintf(const char *function, const char *file, int line,
- LogLevel level, va_list argList, const char *msg)
+void Logger::LogVprintf(
+ const char* function, const char* file, int line, LogLevel level, va_list argList, const char* msg)
{
if (!s_initialized)
{
@@ -182,42 +178,42 @@ void Logger::LogVprintf(const char *function, const char *file, int line,
// Capture this first to make the timestamp more accurately reflect the actual time of logging
time_t timestamp = time(nullptr);
- int fullMsgLen = _vscprintf(msg, argList) + 1; // This doesn't count the null terminator
- char *fullMsg = new char[fullMsgLen];
+ int fullMsgLen = _vscprintf(msg, argList) + 1; // This doesn't count the null terminator
+ char* fullMsg = new char[fullMsgLen];
_vsnprintf_s(fullMsg, fullMsgLen, fullMsgLen, msg, argList);
va_end(argList);
- const char *logLevelStr = "INVALID_LOGLEVEL";
+ const char* logLevelStr = "INVALID_LOGLEVEL";
switch (level)
{
- case LOGLEVEL_ERROR:
- logLevelStr = "ERROR";
- break;
+ case LOGLEVEL_ERROR:
+ logLevelStr = "ERROR";
+ break;
- case LOGLEVEL_WARNING:
- logLevelStr = "WARNING";
- break;
+ case LOGLEVEL_WARNING:
+ logLevelStr = "WARNING";
+ break;
- case LOGLEVEL_MISSING:
- logLevelStr = "MISSING";
- break;
+ case LOGLEVEL_MISSING:
+ logLevelStr = "MISSING";
+ break;
- case LOGLEVEL_ISSUE:
- logLevelStr = "ISSUE";
- break;
+ case LOGLEVEL_ISSUE:
+ logLevelStr = "ISSUE";
+ break;
- case LOGLEVEL_INFO:
- logLevelStr = "INFO";
- break;
+ case LOGLEVEL_INFO:
+ logLevelStr = "INFO";
+ break;
- case LOGLEVEL_VERBOSE:
- logLevelStr = "VERBOSE";
- break;
+ case LOGLEVEL_VERBOSE:
+ logLevelStr = "VERBOSE";
+ break;
- case LOGLEVEL_DEBUG:
- logLevelStr = "DEBUG";
- break;
+ case LOGLEVEL_DEBUG:
+ logLevelStr = "DEBUG";
+ break;
}
// NOTE: This implementation doesn't guarantee that log messages will be written in chronological
@@ -230,7 +226,7 @@ void Logger::LogVprintf(const char *function, const char *file, int line,
if (level & GetLogLevel())
{
// Sends error messages to stderr instead out stdout
- FILE *dest = (level <= LOGLEVEL_WARNING) ? stderr : stdout;
+ FILE* dest = (level <= LOGLEVEL_WARNING) ? stderr : stdout;
if (level < LOGLEVEL_INFO)
fprintf(dest, "%s: ", logLevelStr);
@@ -240,7 +236,7 @@ void Logger::LogVprintf(const char *function, const char *file, int line,
if (s_logFile != INVALID_HANDLE_VALUE)
{
#ifndef FEATURE_PAL // TODO: no localtime_s() or strftime() in PAL
- tm timeInfo;
+ tm timeInfo;
errno_t err = localtime_s(&timeInfo, &timestamp);
if (err != 0)
{
@@ -249,34 +245,35 @@ void Logger::LogVprintf(const char *function, const char *file, int line,
}
size_t timeStrBuffSize = 20 * sizeof(char);
- char *timeStr = (char *)malloc(timeStrBuffSize); // Use malloc so we can realloc if necessary
+ char* timeStr = (char*)malloc(timeStrBuffSize); // Use malloc so we can realloc if necessary
// This particular format string should always generate strings of the same size, but
// for the sake of robustness, we shouldn't rely on that assumption.
while (strftime(timeStr, timeStrBuffSize, "%Y-%m-%d %H:%M:%S", &timeInfo) == 0)
{
timeStrBuffSize *= 2;
- timeStr = (char *)realloc(timeStr, timeStrBuffSize);
+ timeStr = (char*)realloc(timeStr, timeStrBuffSize);
}
-#else // FEATURE_PAL
- const char *timeStr = "";
+#else // FEATURE_PAL
+ const char* timeStr = "";
#endif // FEATURE_PAL
const char logEntryFmtStr[] = "%s - %s [%s:%d] - %s - %s\r\n";
- size_t logEntryBuffSize = sizeof(logEntryFmtStr) + strlen(timeStr) + strlen(function) +
- strlen(file) + 10 + strlen(logLevelStr) + strlen(fullMsg);
+ size_t logEntryBuffSize = sizeof(logEntryFmtStr) + strlen(timeStr) + strlen(function) + strlen(file) + 10 +
+ strlen(logLevelStr) + strlen(fullMsg);
- char *logEntry = new char[logEntryBuffSize];
- sprintf_s(logEntry, logEntryBuffSize, logEntryFmtStr,
- timeStr, function, file, line, logLevelStr, fullMsg);
+ char* logEntry = new char[logEntryBuffSize];
+ sprintf_s(logEntry, logEntryBuffSize, logEntryFmtStr, timeStr, function, file, line, logLevelStr, fullMsg);
DWORD bytesWritten;
if (!WriteFile(s_logFile, logEntry, (DWORD)logEntryBuffSize - 1, &bytesWritten, nullptr))
- fprintf(stderr, "WARNING: [Logger::LogVprintf] Failed to write to log file. GetLastError()=%u\n", GetLastError());
+ fprintf(stderr, "WARNING: [Logger::LogVprintf] Failed to write to log file. GetLastError()=%u\n",
+ GetLastError());
if (!FlushFileBuffers(s_logFile))
- fprintf(stderr, "WARNING: [Logger::LogVprintf] Failed to flush log file. GetLastError()=%u\n", GetLastError());
+ fprintf(stderr, "WARNING: [Logger::LogVprintf] Failed to flush log file. GetLastError()=%u\n",
+ GetLastError());
delete[] logEntry;
@@ -298,8 +295,8 @@ CleanUp:
// Special helper for logging exceptions. This logs the exception message given as a debug message.
//
/* static */
-void Logger::LogExceptionMessage(const char *function, const char *file, int line,
- DWORD exceptionCode, const char *msg, ...)
+void Logger::LogExceptionMessage(
+ const char* function, const char* file, int line, DWORD exceptionCode, const char* msg, ...)
{
std::string fullMsg = "Exception thrown: ";
fullMsg += msg;
@@ -313,24 +310,24 @@ void Logger::LogExceptionMessage(const char *function, const char *file, int lin
// Logger for JIT issues. Identifies the issue type and logs the given message normally.
//
/* static */
-void IssueLogger::LogIssueHelper(const char *function, const char *file, int line,
- IssueType issue, const char *msg, ...)
+void IssueLogger::LogIssueHelper(
+ const char* function, const char* file, int line, IssueType issue, const char* msg, ...)
{
std::string fullMsg;
switch (issue)
{
- case ISSUE_ASSERT:
- fullMsg += "<ASSERT>";
- break;
+ case ISSUE_ASSERT:
+ fullMsg += "<ASSERT>";
+ break;
- case ISSUE_ASM_DIFF:
- fullMsg += "<ASM_DIFF>";
- break;
+ case ISSUE_ASM_DIFF:
+ fullMsg += "<ASM_DIFF>";
+ break;
- default:
- fullMsg += "<UNKNOWN_ISSUE_TYPE>";
- break;
+ default:
+ fullMsg += "<UNKNOWN_ISSUE_TYPE>";
+ break;
}
fullMsg += " ";
diff --git a/src/ToolBox/superpmi/superpmi-shared/logging.h b/src/ToolBox/superpmi/superpmi-shared/logging.h
index a2c388e..dbde4af 100644
--- a/src/ToolBox/superpmi/superpmi-shared/logging.h
+++ b/src/ToolBox/superpmi/superpmi-shared/logging.h
@@ -13,43 +13,42 @@
// General purpose logging macros
//
-#define LogMessage(level, ...) \
- Logger::LogPrintf(__func__, __FILE__, __LINE__, level, __VA_ARGS__)
+#define LogMessage(level, ...) Logger::LogPrintf(__func__, __FILE__, __LINE__, level, __VA_ARGS__)
-#define LogError(...) LogMessage(LOGLEVEL_ERROR, __VA_ARGS__)
+#define LogError(...) LogMessage(LOGLEVEL_ERROR, __VA_ARGS__)
#define LogWarning(...) LogMessage(LOGLEVEL_WARNING, __VA_ARGS__)
#define LogMissing(...) LogMessage(LOGLEVEL_MISSING, __VA_ARGS__)
-#define LogInfo(...) LogMessage(LOGLEVEL_INFO, __VA_ARGS__)
+#define LogInfo(...) LogMessage(LOGLEVEL_INFO, __VA_ARGS__)
#define LogVerbose(...) LogMessage(LOGLEVEL_VERBOSE, __VA_ARGS__)
-#define LogDebug(...) LogMessage(LOGLEVEL_DEBUG, __VA_ARGS__)
+#define LogDebug(...) LogMessage(LOGLEVEL_DEBUG, __VA_ARGS__)
-#define LogIssue(issue, msg, ...) \
- IssueLogger::LogIssueHelper(__FUNCTION__, __FILE__, __LINE__, issue, msg, __VA_ARGS__)
+#define LogIssue(issue, msg, ...) IssueLogger::LogIssueHelper(__FUNCTION__, __FILE__, __LINE__, issue, msg, __VA_ARGS__)
// Captures the exception message before throwing so we can log it at the point of occurrence
-#define LogException(exCode, msg, ...) \
- do { \
- Logger::LogExceptionMessage(__FUNCTION__, __FILE__, __LINE__, exCode, msg, __VA_ARGS__); \
- ThrowException(exCode, msg, __VA_ARGS__); \
+#define LogException(exCode, msg, ...) \
+ do \
+ { \
+ Logger::LogExceptionMessage(__FUNCTION__, __FILE__, __LINE__, exCode, msg, __VA_ARGS__); \
+ ThrowException(exCode, msg, __VA_ARGS__); \
} while (0)
// These are specified as flags so subsets of the logging functionality can be enabled/disabled at once
enum LogLevel : UINT32
{
- LOGLEVEL_ERROR = 0x00000001, // Internal fatal errors that are non-recoverable
- LOGLEVEL_WARNING = 0x00000002, // Internal conditions that are unusual, but not serious
- LOGLEVEL_MISSING = 0x00000004, // Failures to due to missing JIT-EE details
- LOGLEVEL_ISSUE = 0x00000008, // Issues found with the JIT, e.g. asm diffs, asserts
- LOGLEVEL_INFO = 0x00000010, // Notifications/summaries, e.g. 'Loaded 5 Jitted 4 FailedCompile 1'
- LOGLEVEL_VERBOSE = 0x00000020, // Status messages, e.g. 'Jit startup took 151.12ms'
- LOGLEVEL_DEBUG = 0x00000040 // Detailed output that's only useful for SuperPMI debugging
+ LOGLEVEL_ERROR = 0x00000001, // Internal fatal errors that are non-recoverable
+ LOGLEVEL_WARNING = 0x00000002, // Internal conditions that are unusual, but not serious
+ LOGLEVEL_MISSING = 0x00000004, // Failures to due to missing JIT-EE details
+ LOGLEVEL_ISSUE = 0x00000008, // Issues found with the JIT, e.g. asm diffs, asserts
+ LOGLEVEL_INFO = 0x00000010, // Notifications/summaries, e.g. 'Loaded 5 Jitted 4 FailedCompile 1'
+ LOGLEVEL_VERBOSE = 0x00000020, // Status messages, e.g. 'Jit startup took 151.12ms'
+ LOGLEVEL_DEBUG = 0x00000040 // Detailed output that's only useful for SuperPMI debugging
};
// Preset log level combinations
enum LogLevelMask : UINT32
{
LOGMASK_NONE = 0x00000000,
- LOGMASK_DEFAULT = (LOGLEVEL_DEBUG - 1), // Default is essentially "enable everything except debug"
+ LOGMASK_DEFAULT = (LOGLEVEL_DEBUG - 1), // Default is essentially "enable everything except debug"
LOGMASK_ALL = 0xffffffff
};
@@ -59,32 +58,40 @@ enum LogLevelMask : UINT32
class Logger
{
private:
- static bool s_initialized;
- static UINT32 s_logLevel;
- static HANDLE s_logFile;
- static char *s_logFilePath;
+ static bool s_initialized;
+ static UINT32 s_logLevel;
+ static HANDLE s_logFile;
+ static char* s_logFilePath;
static CRITICAL_SECTION s_critSec;
public:
static void Initialize();
static void Shutdown();
- static void OpenLogFile(char *logFilePath);
+ static void OpenLogFile(char* logFilePath);
static void CloseLogFile();
- static UINT32 ParseLogLevelString(const char *specifierStr);
- static void SetLogLevel(UINT32 logLevelMask) { s_logLevel = logLevelMask; }
- static UINT32 GetLogLevel() { return s_logLevel; }
+ static UINT32 ParseLogLevelString(const char* specifierStr);
+ static void SetLogLevel(UINT32 logLevelMask)
+ {
+ s_logLevel = logLevelMask;
+ }
+ static UINT32 GetLogLevel()
+ {
+ return s_logLevel;
+ }
// Return true if all specified log levels are enabled.
- static bool IsLogLevelEnabled(UINT32 logLevelMask) { return (logLevelMask & GetLogLevel()) == logLevelMask; }
-
- static void LogPrintf(const char *function, const char *file, int line,
- LogLevel level, const char *msg, ...);
- static void LogVprintf(const char *function, const char *file, int line,
- LogLevel level, va_list argList, const char *msg);
- static void LogExceptionMessage(const char *function, const char *file, int line,
- DWORD exceptionCode, const char *msg, ...);
+ static bool IsLogLevelEnabled(UINT32 logLevelMask)
+ {
+ return (logLevelMask & GetLogLevel()) == logLevelMask;
+ }
+
+ static void LogPrintf(const char* function, const char* file, int line, LogLevel level, const char* msg, ...);
+ static void LogVprintf(
+ const char* function, const char* file, int line, LogLevel level, va_list argList, const char* msg);
+ static void LogExceptionMessage(
+ const char* function, const char* file, int line, DWORD exceptionCode, const char* msg, ...);
};
enum IssueType
@@ -101,8 +108,7 @@ enum IssueType
class IssueLogger
{
public:
- static void LogIssueHelper(const char *function, const char *file, int line,
- IssueType issue, const char *msg, ...);
+ static void LogIssueHelper(const char* function, const char* file, int line, IssueType issue, const char* msg, ...);
};
#endif
diff --git a/src/ToolBox/superpmi/superpmi-shared/mclist.cpp b/src/ToolBox/superpmi/superpmi-shared/mclist.cpp
index 511893f..b8141a5 100644
--- a/src/ToolBox/superpmi/superpmi-shared/mclist.cpp
+++ b/src/ToolBox/superpmi/superpmi-shared/mclist.cpp
@@ -11,14 +11,14 @@
#include "mclist.h"
#include "logging.h"
-bool MCList::processArgAsMCL(char *input, int *count, int **list)
+bool MCList::processArgAsMCL(char* input, int* count, int** list)
{
// If it contains only '0-9', '-', ',' try to see it as a range list, else try to load as a file
bool isRangeList = true;
size_t len = strlen(input);
- for (unsigned int i=0; (i < len) && isRangeList; i++)
+ for (unsigned int i = 0; (i < len) && isRangeList; i++)
{
if ((input[i] != '-') && (input[i] != ',') && (!isdigit((unsigned char)input[i])))
isRangeList = false;
@@ -26,36 +26,36 @@ bool MCList::processArgAsMCL(char *input, int *count, int **list)
if (isRangeList)
{
- //Count items
- *count = 0;
+ // Count items
+ *count = 0;
unsigned rangeStart = 0;
- bool inRange = false;
- unsigned scratch = 0;
- bool foundDigit = false;
+ bool inRange = false;
+ unsigned scratch = 0;
+ bool foundDigit = false;
- char *tail = input+len;
+ char* tail = input + len;
- for(char* head = input; head <= tail; head++)
+ for (char* head = input; head <= tail; head++)
{
- scratch = 0;
+ scratch = 0;
foundDigit = false;
- while((head<=tail)&&(isdigit((unsigned char)*head)))
+ while ((head <= tail) && (isdigit((unsigned char)*head)))
{
- scratch = (scratch*10)+((*head)-'0');
+ scratch = (scratch * 10) + ((*head) - '0');
foundDigit = true;
head++;
}
- if(foundDigit)
+ if (foundDigit)
{
- if(inRange)
+ if (inRange)
{
inRange = false;
- if(rangeStart>=scratch)
+ if (rangeStart >= scratch)
{
LogError("Invalid range in '%s'", input);
return false;
}
- (*count) += scratch-rangeStart;
+ (*count) += scratch - rangeStart;
}
else
{
@@ -63,7 +63,7 @@ bool MCList::processArgAsMCL(char *input, int *count, int **list)
(*count)++;
}
}
- if(*head == '-')
+ if (*head == '-')
inRange = true;
}
@@ -73,42 +73,42 @@ bool MCList::processArgAsMCL(char *input, int *count, int **list)
return false;
}
- inRange = false;
+ inRange = false;
rangeStart = 0;
- int *ll = new int[*count];
- *list = ll;
+ int* ll = new int[*count];
+ *list = ll;
int index = 0;
ll[index] = 0;
- for(char* head = input; head <= tail; head++)
+ for (char* head = input; head <= tail; head++)
{
- scratch = 0;
+ scratch = 0;
foundDigit = false;
- while((head<=tail)&&(isdigit((unsigned char)*head)))
+ while ((head <= tail) && (isdigit((unsigned char)*head)))
{
- scratch = (scratch*10)+((*head)-'0');
+ scratch = (scratch * 10) + ((*head) - '0');
foundDigit = true;
head++;
}
- if(foundDigit)
+ if (foundDigit)
{
- if(inRange)
+ if (inRange)
{
inRange = false;
- for(unsigned int i=rangeStart+1;i<=scratch;i++)
- ll[index++] = i;
+ for (unsigned int i = rangeStart + 1; i <= scratch; i++)
+ ll[index++] = i;
}
else
{
- rangeStart = scratch;
+ rangeStart = scratch;
ll[index++] = scratch;
}
}
- if(*head == '-')
+ if (*head == '-')
inRange = true;
}
- if(inRange)
+ if (inRange)
{
LogError("Found invalid external range in '%s'", input);
return false;
@@ -117,10 +117,10 @@ bool MCList::processArgAsMCL(char *input, int *count, int **list)
}
else
{
- char *lastdot = strrchr(input,'.');
- if(lastdot != nullptr && _stricmp(lastdot, ".mcl")==0)
+ char* lastdot = strrchr(input, '.');
+ if (lastdot != nullptr && _stricmp(lastdot, ".mcl") == 0)
{
- //Read MCLFile
+ // Read MCLFile
if (!getLineData(input, count, list))
return false;
if (*count >= 0)
@@ -129,8 +129,8 @@ bool MCList::processArgAsMCL(char *input, int *count, int **list)
return false;
}
-checkMCL: //check that mcl list is increasing only
- int *ll = (*list);
+checkMCL: // check that mcl list is increasing only
+ int* ll = (*list);
if (ll[0] == 0)
{
LogError("MCL list needs to start from 1!");
@@ -138,7 +138,7 @@ checkMCL: //check that mcl list is increasing only
}
for (int i = 1; i < *count; i++)
{
- if (ll[i-1] >= ll[i])
+ if (ll[i - 1] >= ll[i])
{
LogError("MCL list must be increasing.. found %d -> %d", ll[i - 1], ll[i]);
return false;
@@ -148,12 +148,13 @@ checkMCL: //check that mcl list is increasing only
}
// Returns true on success, false on failure.
-// On success, sets *pIndexCount to the number of indices read, and *pIndexes to a new array with all the indices read. The caller must
-// free the memory with delete[].
+// On success, sets *pIndexCount to the number of indices read, and *pIndexes to a new array with all the indices read.
+// The caller must free the memory with delete[].
/* static */
-bool MCList::getLineData(const char *nameOfInput, /* OUT */ int *pIndexCount, /* OUT */ int **pIndexes)
+bool MCList::getLineData(const char* nameOfInput, /* OUT */ int* pIndexCount, /* OUT */ int** pIndexes)
{
- HANDLE hFile = CreateFileA(nameOfInput, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL|FILE_FLAG_SEQUENTIAL_SCAN, NULL);
+ HANDLE hFile = CreateFileA(nameOfInput, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING,
+ FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
if (hFile == INVALID_HANDLE_VALUE)
{
LogError("Unable to open '%s'. GetLastError()=%u", nameOfInput, GetLastError());
@@ -172,7 +173,7 @@ bool MCList::getLineData(const char *nameOfInput, /* OUT */ int *pIndexCount, /*
return false;
}
- int sz = DataTemp.u.LowPart;
+ int sz = DataTemp.u.LowPart;
char* buff = new char[sz];
DWORD bytesRead;
if (ReadFile(hFile, buff, sz, &bytesRead, nullptr) == 0)
@@ -198,17 +199,17 @@ bool MCList::getLineData(const char *nameOfInput, /* OUT */ int *pIndexCount, /*
}
}
- int* indexes = new int[lineCount];
- int indexCount = 0;
- int i = 0;
+ int* indexes = new int[lineCount];
+ int indexCount = 0;
+ int i = 0;
while (i < sz)
{
- //seek the first number on the line. This will skip empty lines and lines with no digits.
+ // seek the first number on the line. This will skip empty lines and lines with no digits.
while (!isdigit((unsigned char)buff[i]))
i++;
- //read in the number
+ // read in the number
indexes[indexCount++] = atoi(&buff[i]);
- //seek to the start of next line
+ // seek to the start of next line
while ((i < sz) && (buff[i] != '\n'))
i++;
i++;
@@ -216,11 +217,11 @@ bool MCList::getLineData(const char *nameOfInput, /* OUT */ int *pIndexCount, /*
delete[] buff;
*pIndexCount = indexCount;
- *pIndexes = indexes;
+ *pIndexes = indexes;
return true;
}
-void MCList::InitializeMCL(char *filename)
+void MCList::InitializeMCL(char* filename)
{
hMCLFile = CreateFileA(filename, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (hMCLFile == INVALID_HANDLE_VALUE)
@@ -233,8 +234,8 @@ void MCList::AddMethodToMCL(int methodIndex)
{
if (hMCLFile != INVALID_HANDLE_VALUE)
{
- char strMethodIndex[12];
- DWORD charCount = 0;
+ char strMethodIndex[12];
+ DWORD charCount = 0;
DWORD bytesWritten = 0;
charCount = sprintf_s(strMethodIndex, sizeof(strMethodIndex), "%d\r\n", methodIndex);
diff --git a/src/ToolBox/superpmi/superpmi-shared/mclist.h b/src/ToolBox/superpmi/superpmi-shared/mclist.h
index 93b2879..dd5073b 100644
--- a/src/ToolBox/superpmi/superpmi-shared/mclist.h
+++ b/src/ToolBox/superpmi/superpmi-shared/mclist.h
@@ -13,23 +13,23 @@
class MCList
{
public:
- static bool processArgAsMCL(char *input, int *count, int **list);
+ static bool processArgAsMCL(char* input, int* count, int** list);
MCList()
{
- //Initialize the static file handle
+ // Initialize the static file handle
hMCLFile = INVALID_HANDLE_VALUE;
}
- //Methods to create an MCL file
- void InitializeMCL(char *filename);
+ // Methods to create an MCL file
+ void InitializeMCL(char* filename);
void AddMethodToMCL(int methodIndex);
void CloseMCL();
private:
- static bool getLineData(const char *nameOfInput, /* OUT */ int *pIndexCount, /* OUT */ int **pIndexes);
+ static bool getLineData(const char* nameOfInput, /* OUT */ int* pIndexCount, /* OUT */ int** pIndexes);
- //File handle for MCL file
+ // File handle for MCL file
HANDLE hMCLFile;
};
#endif
diff --git a/src/ToolBox/superpmi/superpmi-shared/methodcontext.cpp b/src/ToolBox/superpmi/superpmi-shared/methodcontext.cpp
index 8638e0d..e60ef83 100644
--- a/src/ToolBox/superpmi/superpmi-shared/methodcontext.cpp
+++ b/src/ToolBox/superpmi/superpmi-shared/methodcontext.cpp
@@ -15,32 +15,39 @@
#include "lightweightmap.h"
#include "callutils.h"
-struct { int packetID; const char *message; } retiredPackets[] =
-{
- { 6, "CanEmbedModuleHandleForHelper id 6 superseded by GetLazyStringLiteralHelper id 147 on 12/20/2013" },
- { 13, "CheckMethodModifier id 13 superseded by id 142 on 2013/07/04. Re-record input with newer shim." },
- { 14, "CompileMethod id 14 superseded by id 141 on 2013/07/03. Re-record input with newer shim." },
- { 24, "FindNameOfToken id 24 superseded by id 145 on 2013/07/19. Re-record input with newer shim. Adjusted members to be proper." },
- { 28, "GetArgClass id 28 superseded by id 139 on 2013/07/03. Re-record input with newer shim." },
- { 30, "GetArgType id 30 superseded by id 140 on 2013/07/03. Re-record input with newer shim." },
- { 93, "GetUnBoxHelper2 id 93 unused. 2016/02/19. Re-record input with newer shim." },
- { 104, "IsValidToken id 104 superseded by id 144 on 2013/07/19. Re-record input with newer shim. Adjusted members to be proper." },
- { 141, "CompileMethod id 141 superseded by id 142 on 2013/07/09. Re-record input with newer shim. We basically reset lots of other stuff too. :-)" },
+struct
+{
+ int packetID;
+ const char* message;
+} retiredPackets[] = {
+ {6, "CanEmbedModuleHandleForHelper id 6 superseded by GetLazyStringLiteralHelper id 147 on 12/20/2013"},
+ {13, "CheckMethodModifier id 13 superseded by id 142 on 2013/07/04. Re-record input with newer shim."},
+ {14, "CompileMethod id 14 superseded by id 141 on 2013/07/03. Re-record input with newer shim."},
+ {24, "FindNameOfToken id 24 superseded by id 145 on 2013/07/19. Re-record input with newer shim. Adjusted members "
+ "to be proper."},
+ {28, "GetArgClass id 28 superseded by id 139 on 2013/07/03. Re-record input with newer shim."},
+ {30, "GetArgType id 30 superseded by id 140 on 2013/07/03. Re-record input with newer shim."},
+ {93, "GetUnBoxHelper2 id 93 unused. 2016/02/19. Re-record input with newer shim."},
+ {104, "IsValidToken id 104 superseded by id 144 on 2013/07/19. Re-record input with newer shim. Adjusted members "
+ "to be proper."},
+ {141, "CompileMethod id 141 superseded by id 142 on 2013/07/09. Re-record input with newer shim. We basically "
+ "reset lots of other stuff too. :-)"},
};
int retiredPacketCount = 7;
-#define sparseMC //Support filling in details where guesses are okay and will still generate good code. (i.e. helper function addresses)
+#define sparseMC // Support filling in details where guesses are okay and will still generate good code. (i.e. helper
+ // function addresses)
#if 0
// Enable these to get verbose logging during record or playback.
-#define DEBUG_REC(x) \
- printf("rec"); \
- x; \
+#define DEBUG_REC(x) \
+ printf("rec"); \
+ x; \
printf("\n");
-#define DEBUG_REP(x) \
- printf("rep"); \
- x; \
+#define DEBUG_REP(x) \
+ printf("rep"); \
+ x; \
printf("\n");
#else
#define DEBUG_REC(x)
@@ -51,10 +58,10 @@ MethodContext::MethodContext()
{
methodSize = 0;
- #define LWM(map,key,value) map = nullptr;
- #include "lwmlist.h"
+#define LWM(map, key, value) map = nullptr;
+#include "lwmlist.h"
- cr = new CompileResult();
+ cr = new CompileResult();
index = -1;
}
@@ -65,93 +72,95 @@ MethodContext::~MethodContext()
void MethodContext::Destroy()
{
- #define LWM(map,key,value) if (map != nullptr) delete map;
- #include "lwmlist.h"
+#define LWM(map, key, value) \
+ if (map != nullptr) \
+ delete map;
+#include "lwmlist.h"
delete cr;
}
-#define sparseAddLen(target) \
- if (target != nullptr) \
- { \
- if (target->GetCount() != 0) \
- totalLen += target->CalculateArraySize() + 6; /* packet canary from lightweightmap + packet marker */ \
+#define sparseAddLen(target) \
+ if (target != nullptr) \
+ { \
+ if (target->GetCount() != 0) \
+ totalLen += target->CalculateArraySize() + 6; /* packet canary from lightweightmap + packet marker */ \
}
-#define sparseWriteFile(target) \
- if (target != nullptr) \
- { \
- if (target->GetCount() != 0) \
- { \
- buff2[buffIndex++] = (unsigned char) Packet_##target; \
- unsigned int loc = target->DumpToArray(&buff2[buffIndex + 4]); \
- memcpy(&buff2[buffIndex], &loc, sizeof(unsigned int)); \
- buffIndex += 4 + loc; \
- buff2[buffIndex++] = 0x42; \
- } \
+#define sparseWriteFile(target) \
+ if (target != nullptr) \
+ { \
+ if (target->GetCount() != 0) \
+ { \
+ buff2[buffIndex++] = (unsigned char)Packet_##target; \
+ unsigned int loc = target->DumpToArray(&buff2[buffIndex + 4]); \
+ memcpy(&buff2[buffIndex], &loc, sizeof(unsigned int)); \
+ buffIndex += 4 + loc; \
+ buff2[buffIndex++] = 0x42; \
+ } \
}
-#define sparseWriteFileCR(target) \
- if (cr != nullptr) \
- { \
- if (cr->target != nullptr) \
- { \
- if (cr->target->GetCount() != 0) \
- { \
- buff2[buffIndex++] = (unsigned char) PacketCR_##target; \
- unsigned int loc = cr->target->DumpToArray(&buff2[buffIndex + 4]); \
- memcpy(&buff2[buffIndex], &loc, sizeof(unsigned int)); \
- buffIndex += 4 + loc; \
- buff2[buffIndex++] = 0x42; \
- } \
- } \
+#define sparseWriteFileCR(target) \
+ if (cr != nullptr) \
+ { \
+ if (cr->target != nullptr) \
+ { \
+ if (cr->target->GetCount() != 0) \
+ { \
+ buff2[buffIndex++] = (unsigned char)PacketCR_##target; \
+ unsigned int loc = cr->target->DumpToArray(&buff2[buffIndex + 4]); \
+ memcpy(&buff2[buffIndex], &loc, sizeof(unsigned int)); \
+ buffIndex += 4 + loc; \
+ buff2[buffIndex++] = 0x42; \
+ } \
+ } \
}
-#define sparseReadFile(target, key, value) \
- case Packet_##target: \
- { \
- target = new LightWeightMap<key, value>(); \
- target->ReadFromArray(&buff2[buffIndex], localsize); \
- break; \
+#define sparseReadFile(target, key, value) \
+ case Packet_##target: \
+ { \
+ target = new LightWeightMap<key, value>(); \
+ target->ReadFromArray(&buff2[buffIndex], localsize); \
+ break; \
}
-#define sparseReadFileCR(target, key, value) \
- case PacketCR_##target: \
- { \
- cr->target = new LightWeightMap<key, value>(); \
- cr->target->ReadFromArray(&buff2[buffIndex], localsize); \
- break; \
+#define sparseReadFileCR(target, key, value) \
+ case PacketCR_##target: \
+ { \
+ cr->target = new LightWeightMap<key, value>(); \
+ cr->target->ReadFromArray(&buff2[buffIndex], localsize); \
+ break; \
}
-#define sparseReadFileDense(target, value) \
- case Packet_##target: \
- { \
- target = new DenseLightWeightMap<value>(); \
- target->ReadFromArray(&buff2[buffIndex], localsize); \
- break; \
+#define sparseReadFileDense(target, value) \
+ case Packet_##target: \
+ { \
+ target = new DenseLightWeightMap<value>(); \
+ target->ReadFromArray(&buff2[buffIndex], localsize); \
+ break; \
}
-#define sparseReadFileCRDense(target, value) \
- case PacketCR_##target: \
- { \
- cr->target = new DenseLightWeightMap<value>(); \
- cr->target->ReadFromArray(&buff2[buffIndex], localsize); \
- break; \
+#define sparseReadFileCRDense(target, value) \
+ case PacketCR_##target: \
+ { \
+ cr->target = new DenseLightWeightMap<value>(); \
+ cr->target->ReadFromArray(&buff2[buffIndex], localsize); \
+ break; \
}
unsigned int MethodContext::calculateFileSize()
{
- //Calculate file size
+ // Calculate file size
unsigned int totalLen = 0;
- #define LWM(map,key,value) sparseAddLen(map)
- #include "lwmlist.h"
+#define LWM(map, key, value) sparseAddLen(map)
+#include "lwmlist.h"
- //Compile Result members
+ // Compile Result members
if (cr != nullptr)
{
- #define LWM(map,key,value) sparseAddLen(cr->map);
- #include "crlwmlist.h"
+#define LWM(map, key, value) sparseAddLen(cr->map);
+#include "crlwmlist.h"
}
return totalLen;
@@ -159,28 +168,30 @@ unsigned int MethodContext::calculateFileSize()
unsigned int MethodContext::calculateRawFileSize()
{
- return 2 /* leading magic cookie 'm', 'c' */ + 4 /* 4-byte data length */ + calculateFileSize() + 2 /* end canary '4', '2' */;
+ return 2 /* leading magic cookie 'm', 'c' */ + 4 /* 4-byte data length */ + calculateFileSize() +
+ 2 /* end canary '4', '2' */;
}
unsigned int MethodContext::saveToFile(HANDLE hFile)
{
unsigned int totalLen = calculateFileSize();
- unsigned int totalFileSize = 2 /* leading magic cookie 'm', 'c' */ + 4 /* 4-byte data length */ + totalLen + 2 /* end canary '4', '2' */;
-
- DWORD bytesWritten = 0;
- unsigned int buffIndex = 0;
- unsigned char *buff2 = new unsigned char[totalFileSize];
- buff2[buffIndex++] = 'm';
- buff2[buffIndex++] = 'c';
+ unsigned int totalFileSize =
+ 2 /* leading magic cookie 'm', 'c' */ + 4 /* 4-byte data length */ + totalLen + 2 /* end canary '4', '2' */;
+
+ DWORD bytesWritten = 0;
+ unsigned int buffIndex = 0;
+ unsigned char* buff2 = new unsigned char[totalFileSize];
+ buff2[buffIndex++] = 'm';
+ buff2[buffIndex++] = 'c';
memcpy(&buff2[buffIndex], &totalLen, sizeof(unsigned int));
buffIndex += 4;
- #define LWM(map,key,value) sparseWriteFile(map)
- #include "lwmlist.h"
+#define LWM(map, key, value) sparseWriteFile(map)
+#include "lwmlist.h"
- //Compile Result members
- #define LWM(map,key,value) sparseWriteFileCR(map);
- #include "crlwmlist.h"
+// Compile Result members
+#define LWM(map, key, value) sparseWriteFileCR(map);
+#include "crlwmlist.h"
// Write the end canary
buff2[buffIndex++] = '4';
@@ -189,7 +200,7 @@ unsigned int MethodContext::saveToFile(HANDLE hFile)
Assert(buffIndex == totalFileSize);
WriteFile(hFile, buff2, totalFileSize, &bytesWritten, NULL);
- delete[]buff2;
+ delete[] buff2;
return bytesWritten;
}
@@ -200,8 +211,8 @@ unsigned int MethodContext::saveToFile(HANDLE hFile)
bool MethodContext::Initialize(int loadedCount, unsigned char* buff, DWORD size, /* OUT */ MethodContext** ppmc)
{
MethodContext* mc = new MethodContext();
- mc->index = loadedCount;
- *ppmc = mc;
+ mc->index = loadedCount;
+ *ppmc = mc;
return mc->Initialize(loadedCount, buff, size);
}
@@ -209,8 +220,8 @@ bool MethodContext::Initialize(int loadedCount, unsigned char* buff, DWORD size,
bool MethodContext::Initialize(int loadedCount, HANDLE hFile, /* OUT */ MethodContext** ppmc)
{
MethodContext* mc = new MethodContext();
- mc->index = loadedCount;
- *ppmc = mc;
+ mc->index = loadedCount;
+ *ppmc = mc;
return mc->Initialize(loadedCount, hFile);
}
@@ -221,11 +232,11 @@ bool MethodContext::Initialize(int loadedCount, unsigned char* buff, DWORD size)
struct Param
{
unsigned char* buff;
- DWORD size;
+ DWORD size;
MethodContext* pThis;
} param;
- param.buff = buff;
- param.size = size;
+ param.buff = buff;
+ param.size = size;
param.pThis = this;
PAL_TRY(Param*, pParam, &param)
@@ -248,7 +259,7 @@ bool MethodContext::Initialize(int loadedCount, HANDLE hFile)
struct Param
{
- HANDLE hFile;
+ HANDLE hFile;
MethodContext* pThis;
} param;
param.hFile = hFile;
@@ -270,27 +281,28 @@ bool MethodContext::Initialize(int loadedCount, HANDLE hFile)
void MethodContext::MethodInitHelperFile(HANDLE hFile)
{
- DWORD bytesRead;
- char buff[512];
+ DWORD bytesRead;
+ char buff[512];
unsigned int totalLen = 0;
- AssertCode(ReadFile(hFile, buff, 2 + sizeof(unsigned int), &bytesRead, NULL) == TRUE, EXCEPTIONCODE_MC); //Read Magic number and totalLen
+ AssertCode(ReadFile(hFile, buff, 2 + sizeof(unsigned int), &bytesRead, NULL) == TRUE,
+ EXCEPTIONCODE_MC); // Read Magic number and totalLen
AssertCodeMsg((buff[0] == 'm') && (buff[1] == 'c'), EXCEPTIONCODE_MC, "Didn't find magic number");
memcpy(&totalLen, &buff[2], sizeof(unsigned int));
- unsigned char *buff2 = new unsigned char[totalLen + 2]; //total + End Canary
+ unsigned char* buff2 = new unsigned char[totalLen + 2]; // total + End Canary
AssertCode(ReadFile(hFile, buff2, totalLen + 2, &bytesRead, NULL) == TRUE, EXCEPTIONCODE_MC);
AssertCodeMsg((buff2[totalLen] == '4') && (buff2[totalLen + 1] == '2'), EXCEPTIONCODE_MC, "Didn't find end canary");
MethodInitHelper(buff2, totalLen);
}
-void MethodContext::MethodInitHelper(unsigned char *buff2, unsigned int totalLen)
+void MethodContext::MethodInitHelper(unsigned char* buff2, unsigned int totalLen)
{
MethodContext::MethodContext();
- unsigned int buffIndex = 0;
- unsigned int localsize = 0;
- unsigned char canary = 0xff;
- unsigned char *buff3 = nullptr;
+ unsigned int buffIndex = 0;
+ unsigned int localsize = 0;
+ unsigned char canary = 0xff;
+ unsigned char* buff3 = nullptr;
while (buffIndex < totalLen)
{
@@ -300,79 +312,82 @@ void MethodContext::MethodInitHelper(unsigned char *buff2, unsigned int totalLen
switch (packetType)
{
- #define LWM(map,key,value) sparseReadFile(map,key,value)
- #define DENSELWM(map,value) sparseReadFileDense(map,value)
- #include "lwmlist.h"
+#define LWM(map, key, value) sparseReadFile(map, key, value)
+#define DENSELWM(map, value) sparseReadFileDense(map, value)
+#include "lwmlist.h"
- #define LWM(map,key,value) sparseReadFileCR(map,key,value)
- #define DENSELWM(map,value) sparseReadFileCRDense(map,value)
- #include "crlwmlist.h"
+#define LWM(map, key, value) sparseReadFileCR(map, key, value)
+#define DENSELWM(map, value) sparseReadFileCRDense(map, value)
+#include "crlwmlist.h"
- default:
- for (int i = 0; i < retiredPacketCount; i++)
- {
- AssertCodeMsg(retiredPackets[i].packetID != packetType, EXCEPTIONCODE_MC, "Ran into retired packet %u '%s'", packetType, retiredPackets[i].message);
- }
- LogException(EXCEPTIONCODE_MC, "Read ran into unknown packet type %u. Are you using a newer recorder?", packetType);
- // break;
+ default:
+ for (int i = 0; i < retiredPacketCount; i++)
+ {
+ AssertCodeMsg(retiredPackets[i].packetID != packetType, EXCEPTIONCODE_MC,
+ "Ran into retired packet %u '%s'", packetType, retiredPackets[i].message);
+ }
+ LogException(EXCEPTIONCODE_MC, "Read ran into unknown packet type %u. Are you using a newer recorder?",
+ packetType);
+ // break;
}
buffIndex += localsize;
canary = buff2[buffIndex++];
AssertCodeMsg(canary == 0x42, EXCEPTIONCODE_MC, "Didn't find trailing canary for map");
}
- AssertCodeMsg((buff2[buffIndex++] == '4') && (buff2[buffIndex++] == '2'), EXCEPTIONCODE_MC, "Didn't find trailing canary for map");
- delete[]buff2;
-}
-
-#define dumpStat(target) \
- if (target != nullptr) \
- { \
- if (target->GetCount() > 0) \
- { \
- int t = sprintf_s(buff, len, "%u", target->GetCount()); \
- buff += t; \
- len -= t; \
- } \
- } \
- { \
- *buff++ = ','; \
- len--; \
- } \
- if (target != nullptr) \
- { \
- int t = sprintf_s(buff, len, "%u", target->CalculateArraySize()); \
- buff += t; \
- len -= t; \
- } \
- { \
- *buff++ = ','; \
- len--; \
+ AssertCodeMsg((buff2[buffIndex++] == '4') && (buff2[buffIndex++] == '2'), EXCEPTIONCODE_MC,
+ "Didn't find trailing canary for map");
+ delete[] buff2;
+}
+
+#define dumpStat(target) \
+ if (target != nullptr) \
+ { \
+ if (target->GetCount() > 0) \
+ { \
+ int t = sprintf_s(buff, len, "%u", target->GetCount()); \
+ buff += t; \
+ len -= t; \
+ } \
+ } \
+ { \
+ *buff++ = ','; \
+ len--; \
+ } \
+ if (target != nullptr) \
+ { \
+ int t = sprintf_s(buff, len, "%u", target->CalculateArraySize()); \
+ buff += t; \
+ len -= t; \
+ } \
+ { \
+ *buff++ = ','; \
+ len--; \
}
// Dump statistics about each LightWeightMap to the buffer: count of elements, and total size in bytes of map.
-int MethodContext::dumpStatToBuffer(char *buff, int len)
+int MethodContext::dumpStatToBuffer(char* buff, int len)
{
- char *obuff = buff;
- //assumption of enough buffer.. :-|
+ char* obuff = buff;
+// assumption of enough buffer.. :-|
- #define LWM(map,key,value) dumpStat(map)
- #include "lwmlist.h"
+#define LWM(map, key, value) dumpStat(map)
+#include "lwmlist.h"
- //Compile Result members
- #define LWM(map,key,value) dumpStat(cr->map);
- #include "crlwmlist.h"
+// Compile Result members
+#define LWM(map, key, value) dumpStat(cr->map);
+#include "crlwmlist.h"
return (int)(buff - obuff);
}
-int MethodContext::dumpStatTitleToBuffer(char *buff, int len)
+int MethodContext::dumpStatTitleToBuffer(char* buff, int len)
{
- const char *title =
+ const char* title =
- #define LWM(map,key,value) #map "," #map " SZ,"
- #include "lwmlist.h"
+#define LWM(map, key, value) #map "," #map " SZ,"
+#include "lwmlist.h"
- #define LWM(map,key,value) "CR_" #map ",CR_" #map " SZ,"
- #include "crlwmlist.h"
+#define LWM(map, key, value) "CR_" #map ",CR_" #map " SZ,"
+#include "crlwmlist.h"
;
@@ -386,26 +401,29 @@ int MethodContext::dumpStatTitleToBuffer(char *buff, int len)
return titleLen;
}
-#define softMapEqual(a) \
- if (a != nullptr) \
- { \
- if (other->a == nullptr) return false; \
- if (a->GetCount() != other->a->GetCount()) return false; \
- } \
- else if (other->a != nullptr) return false;
-
+#define softMapEqual(a) \
+ if (a != nullptr) \
+ { \
+ if (other->a == nullptr) \
+ return false; \
+ if (a->GetCount() != other->a->GetCount()) \
+ return false; \
+ } \
+ else if (other->a != nullptr) \
+ return false;
-bool MethodContext::Equal(MethodContext *other)
+bool MethodContext::Equal(MethodContext* other)
{
- //returns true if equal. Note this is permissive, that is to say that we may reason that too many things are equal. Adding more detailed checks would cause us to reason more things as unique;
+ // returns true if equal. Note this is permissive, that is to say that we may reason that too many things are
+ // equal. Adding more detailed checks would cause us to reason more things as unique;
- //Compare MethodInfo's first.
+ // Compare MethodInfo's first.
CORINFO_METHOD_INFO otherInfo;
- unsigned otherFlags = 0;
+ unsigned otherFlags = 0;
other->repCompileMethod(&otherInfo, &otherFlags);
CORINFO_METHOD_INFO ourInfo;
- unsigned ourFlags = 0;
+ unsigned ourFlags = 0;
repCompileMethod(&ourInfo, &ourFlags);
if (otherInfo.ILCodeSize != ourInfo.ILCodeSize)
@@ -421,8 +439,8 @@ bool MethodContext::Equal(MethodContext *other)
if (otherInfo.options != ourInfo.options)
return false;
for (unsigned int j = 0; j < otherInfo.ILCodeSize; j++)
- if (otherInfo.ILCode[j] != ourInfo.ILCode[j])
- return false;
+ if (otherInfo.ILCode[j] != ourInfo.ILCode[j])
+ return false;
if (otherInfo.maxStack != ourInfo.maxStack)
return false;
if (otherInfo.regionKind != ourInfo.regionKind)
@@ -438,16 +456,16 @@ bool MethodContext::Equal(MethodContext *other)
if (otherFlags != ourFlags)
return false;
- //Now compare the other maps to "estimate" equality.
+// Now compare the other maps to "estimate" equality.
- #define LWM(map,key,value) softMapEqual(map)
- #include "lwmlist.h"
+#define LWM(map, key, value) softMapEqual(map)
+#include "lwmlist.h"
- //Compile Result members
- #define LWM(map,key,value) softMapEqual(cr->map)
- #include "crlwmlist.h"
+// Compile Result members
+#define LWM(map, key, value) softMapEqual(cr->map)
+#include "crlwmlist.h"
- //Base case is we "match"
+ // Base case is we "match"
return true;
}
@@ -483,12 +501,12 @@ void MethodContext::recEnvironment()
if (Environment == nullptr)
Environment = new DenseLightWeightMap<Agnostic_Environment>();
- char *l_EnvStr;
- char *l_val;
+ char* l_EnvStr;
+ char* l_val;
#ifdef FEATURE_PAL
l_EnvStr = GetEnvironmentStringsA();
-#else // !FEATURE_PAL
+#else // !FEATURE_PAL
l_EnvStr = GetEnvironmentStrings();
#endif // !FEATURE_PAL
@@ -499,26 +517,29 @@ void MethodContext::recEnvironment()
int count = 0;
while (true)
{
- if (*l_str == 0) break;
- while (*l_str != 0) l_str++;
+ if (*l_str == 0)
+ break;
+ while (*l_str != 0)
+ l_str++;
l_str++;
count++;
}
for (int i = 0; i < count; i++)
{
- if ((_strnicmp(l_EnvStr, "complus_", 8) == 0) || (_strnicmp(l_EnvStr, "dbflag", 6) == 0) || (_strnicmp(l_EnvStr, "BVT_TEST_ID", 11) == 0))
+ if ((_strnicmp(l_EnvStr, "complus_", 8) == 0) || (_strnicmp(l_EnvStr, "dbflag", 6) == 0) ||
+ (_strnicmp(l_EnvStr, "BVT_TEST_ID", 11) == 0))
{
- char *val = l_EnvStr;
+ char* val = l_EnvStr;
while (*val != '=')
val++;
- *val++ = 0;
- int nameind = Environment->AddBuffer((unsigned char*)l_EnvStr, (int)strlen(l_EnvStr) + 1);
- int valind = Environment->AddBuffer((unsigned char*)val, (int)strlen(val) + 1);
+ *val++ = 0;
+ int nameind = Environment->AddBuffer((unsigned char*)l_EnvStr, (int)strlen(l_EnvStr) + 1);
+ int valind = Environment->AddBuffer((unsigned char*)val, (int)strlen(val) + 1);
Agnostic_Environment value;
value.name_index = nameind;
- value.val_index = valind;
- DWORD key = (DWORD)Environment->GetCount();
+ value.val_index = valind;
+ DWORD key = (DWORD)Environment->GetCount();
Environment->Append(value);
DEBUG_REC(dmpEnvironment(key, value));
l_EnvStr = val;
@@ -532,7 +553,7 @@ void MethodContext::recEnvironment()
void MethodContext::dmpEnvironment(DWORD key, const Agnostic_Environment& value)
{
printf("Environment key %u, value '%s' '%s'", key, (LPCSTR)Environment->GetBuffer(value.name_index),
- (LPCSTR)Environment->GetBuffer(value.val_index));
+ (LPCSTR)Environment->GetBuffer(value.val_index));
Environment->Unlock();
}
void MethodContext::repEnvironmentSet()
@@ -545,20 +566,21 @@ void MethodContext::repEnvironmentSet()
val = Environment->Get((DWORD)i);
DEBUG_REP(dmpEnvironment(i, val));
- SetEnvironmentVariableA((LPCSTR)Environment->GetBuffer(val.name_index), (LPCSTR)Environment->GetBuffer(val.val_index));
+ SetEnvironmentVariableA((LPCSTR)Environment->GetBuffer(val.name_index),
+ (LPCSTR)Environment->GetBuffer(val.val_index));
}
}
int MethodContext::repGetTestID()
{
- //CLR Test asset only - we capture the testID via smarty-environnent (BVT_TEST_ID) during record time
- //This procedure returns the test id if found and -1 otherwise
+ // CLR Test asset only - we capture the testID via smarty-environnent (BVT_TEST_ID) during record time
+ //This procedure returns the test id if found and -1 otherwise
if (Environment == nullptr)
return -1;
Agnostic_Environment val;
- LPCSTR key;
- int value = -1;
+ LPCSTR key;
+ int value = -1;
for (unsigned int i = 0; i < Environment->GetCount(); i++)
{
val = Environment->Get((DWORD)i);
@@ -607,44 +629,68 @@ void MethodContext::dumpToConsole(int mcNumber)
}
printf("\n");
- #define LWM(map,key,value) dumpLWM(this,map)
- #define DENSELWM(map,value) dumpLWMDense(this,map)
- #include "lwmlist.h"
+#define LWM(map, key, value) dumpLWM(this, map)
+#define DENSELWM(map, value) dumpLWMDense(this, map)
+#include "lwmlist.h"
- //Compile Result members
- #define LWM(map,key,value) dumpLWM(this->cr,map)
- #define DENSELWM(map,value) dumpLWMDense(this->cr,map)
- #include "crlwmlist.h"
+// Compile Result members
+#define LWM(map, key, value) dumpLWM(this->cr, map)
+#define DENSELWM(map, value) dumpLWMDense(this->cr, map)
+#include "crlwmlist.h"
}
const char* toString(CorInfoType cit)
{
switch (cit)
{
- case CORINFO_TYPE_UNDEF : return "undef";
- case CORINFO_TYPE_VOID : return "void";
- case CORINFO_TYPE_BOOL : return "bool";
- case CORINFO_TYPE_CHAR : return "char";
- case CORINFO_TYPE_BYTE : return "byte";
- case CORINFO_TYPE_UBYTE : return "ubyte";
- case CORINFO_TYPE_SHORT : return "short";
- case CORINFO_TYPE_USHORT : return "ushort";
- case CORINFO_TYPE_INT : return "int";
- case CORINFO_TYPE_UINT : return "uint";
- case CORINFO_TYPE_LONG : return "long";
- case CORINFO_TYPE_ULONG : return "ulong";
- case CORINFO_TYPE_NATIVEINT : return "nativeint";
- case CORINFO_TYPE_NATIVEUINT : return "nativeuint";
- case CORINFO_TYPE_FLOAT : return "float";
- case CORINFO_TYPE_DOUBLE : return "double";
- case CORINFO_TYPE_STRING : return "string";
- case CORINFO_TYPE_PTR : return "ptr";
- case CORINFO_TYPE_BYREF : return "byref";
- case CORINFO_TYPE_VALUECLASS : return "valueclass";
- case CORINFO_TYPE_CLASS : return "class";
- case CORINFO_TYPE_REFANY : return "refany";
- case CORINFO_TYPE_VAR : return "var";
- default : return "UNKNOWN";
+ case CORINFO_TYPE_UNDEF:
+ return "undef";
+ case CORINFO_TYPE_VOID:
+ return "void";
+ case CORINFO_TYPE_BOOL:
+ return "bool";
+ case CORINFO_TYPE_CHAR:
+ return "char";
+ case CORINFO_TYPE_BYTE:
+ return "byte";
+ case CORINFO_TYPE_UBYTE:
+ return "ubyte";
+ case CORINFO_TYPE_SHORT:
+ return "short";
+ case CORINFO_TYPE_USHORT:
+ return "ushort";
+ case CORINFO_TYPE_INT:
+ return "int";
+ case CORINFO_TYPE_UINT:
+ return "uint";
+ case CORINFO_TYPE_LONG:
+ return "long";
+ case CORINFO_TYPE_ULONG:
+ return "ulong";
+ case CORINFO_TYPE_NATIVEINT:
+ return "nativeint";
+ case CORINFO_TYPE_NATIVEUINT:
+ return "nativeuint";
+ case CORINFO_TYPE_FLOAT:
+ return "float";
+ case CORINFO_TYPE_DOUBLE:
+ return "double";
+ case CORINFO_TYPE_STRING:
+ return "string";
+ case CORINFO_TYPE_PTR:
+ return "ptr";
+ case CORINFO_TYPE_BYREF:
+ return "byref";
+ case CORINFO_TYPE_VALUECLASS:
+ return "valueclass";
+ case CORINFO_TYPE_CLASS:
+ return "class";
+ case CORINFO_TYPE_REFANY:
+ return "refany";
+ case CORINFO_TYPE_VAR:
+ return "var";
+ default:
+ return "UNKNOWN";
}
}
@@ -652,91 +698,99 @@ unsigned int toCorInfoSize(CorInfoType cit)
{
switch (cit)
{
- case CORINFO_TYPE_BOOL:
- case CORINFO_TYPE_BYTE:
- case CORINFO_TYPE_UBYTE:
- return 1;
-
- case CORINFO_TYPE_CHAR:
- case CORINFO_TYPE_SHORT:
- case CORINFO_TYPE_USHORT:
- return 2;
-
- case CORINFO_TYPE_FLOAT:
- case CORINFO_TYPE_INT:
- case CORINFO_TYPE_UINT:
- return 4;
-
- case CORINFO_TYPE_DOUBLE:
- case CORINFO_TYPE_LONG:
- case CORINFO_TYPE_ULONG:
- return 8;
-
- case CORINFO_TYPE_NATIVEINT:
- case CORINFO_TYPE_NATIVEUINT:
- case CORINFO_TYPE_PTR:
- case CORINFO_TYPE_BYREF:
- case CORINFO_TYPE_CLASS:
- return sizeof(void *);
-
- case CORINFO_TYPE_STRING:
- case CORINFO_TYPE_VALUECLASS:
- case CORINFO_TYPE_REFANY:
- case CORINFO_TYPE_UNDEF:
- case CORINFO_TYPE_VOID:
- default:
- __debugbreak();
- return 0;
+ case CORINFO_TYPE_BOOL:
+ case CORINFO_TYPE_BYTE:
+ case CORINFO_TYPE_UBYTE:
+ return 1;
+
+ case CORINFO_TYPE_CHAR:
+ case CORINFO_TYPE_SHORT:
+ case CORINFO_TYPE_USHORT:
+ return 2;
+
+ case CORINFO_TYPE_FLOAT:
+ case CORINFO_TYPE_INT:
+ case CORINFO_TYPE_UINT:
+ return 4;
+
+ case CORINFO_TYPE_DOUBLE:
+ case CORINFO_TYPE_LONG:
+ case CORINFO_TYPE_ULONG:
+ return 8;
+
+ case CORINFO_TYPE_NATIVEINT:
+ case CORINFO_TYPE_NATIVEUINT:
+ case CORINFO_TYPE_PTR:
+ case CORINFO_TYPE_BYREF:
+ case CORINFO_TYPE_CLASS:
+ return sizeof(void*);
+
+ case CORINFO_TYPE_STRING:
+ case CORINFO_TYPE_VALUECLASS:
+ case CORINFO_TYPE_REFANY:
+ case CORINFO_TYPE_UNDEF:
+ case CORINFO_TYPE_VOID:
+ default:
+ __debugbreak();
+ return 0;
}
return -1;
}
-void MethodContext::recCompileMethod(CORINFO_METHOD_INFO *info, unsigned flags)
+void MethodContext::recCompileMethod(CORINFO_METHOD_INFO* info, unsigned flags)
{
if (CompileMethod == nullptr)
CompileMethod = new LightWeightMap<DWORD, Agnostic_CompileMethod>();
Agnostic_CompileMethod value;
- value.info.ftn = (DWORDLONG)info->ftn;
- value.info.scope = (DWORDLONG)info->scope;
- value.info.ILCode_offset = (DWORD)CompileMethod->AddBuffer(info->ILCode, info->ILCodeSize);
- value.info.ILCodeSize = (DWORD)info->ILCodeSize;
- value.info.maxStack = (DWORD)info->maxStack;
- value.info.EHcount = (DWORD)info->EHcount;
- value.info.options = (DWORD)info->options;
- value.info.regionKind = (DWORD)info->regionKind;
- value.info.args.callConv = (DWORD)info->args.callConv;
- value.info.args.retTypeClass = (DWORDLONG)info->args.retTypeClass;
- value.info.args.retTypeSigClass = (DWORDLONG)info->args.retTypeSigClass;
- value.info.args.retType = (DWORD)info->args.retType;
- value.info.args.flags = (DWORD)info->args.flags;
- value.info.args.numArgs = (DWORD)info->args.numArgs;
+ value.info.ftn = (DWORDLONG)info->ftn;
+ value.info.scope = (DWORDLONG)info->scope;
+ value.info.ILCode_offset = (DWORD)CompileMethod->AddBuffer(info->ILCode, info->ILCodeSize);
+ value.info.ILCodeSize = (DWORD)info->ILCodeSize;
+ value.info.maxStack = (DWORD)info->maxStack;
+ value.info.EHcount = (DWORD)info->EHcount;
+ value.info.options = (DWORD)info->options;
+ value.info.regionKind = (DWORD)info->regionKind;
+ value.info.args.callConv = (DWORD)info->args.callConv;
+ value.info.args.retTypeClass = (DWORDLONG)info->args.retTypeClass;
+ value.info.args.retTypeSigClass = (DWORDLONG)info->args.retTypeSigClass;
+ value.info.args.retType = (DWORD)info->args.retType;
+ value.info.args.flags = (DWORD)info->args.flags;
+ value.info.args.numArgs = (DWORD)info->args.numArgs;
value.info.args.sigInst_classInstCount = (DWORD)info->args.sigInst.classInstCount;
- value.info.args.sigInst_classInst_Index = CompileMethod->AddBuffer((unsigned char*)info->args.sigInst.classInst, info->args.sigInst.classInstCount * 8); // porting issue
+ value.info.args.sigInst_classInst_Index =
+ CompileMethod->AddBuffer((unsigned char*)info->args.sigInst.classInst,
+ info->args.sigInst.classInstCount * 8); // porting issue
value.info.args.sigInst_methInstCount = (DWORD)info->args.sigInst.methInstCount;
- value.info.args.sigInst_methInst_Index = CompileMethod->AddBuffer((unsigned char*)info->args.sigInst.methInst, info->args.sigInst.methInstCount * 8); // porting issue
- value.info.args.args = (DWORDLONG)info->args.args;
- value.info.args.cbSig = (DWORD)info->args.cbSig;
- value.info.args.pSig = (DWORD)CompileMethod->AddBuffer((unsigned char *)info->args.pSig, info->args.cbSig);
- value.info.args.scope = (DWORDLONG)info->args.scope;
- value.info.args.token = (DWORD)info->args.token;
- value.info.locals.callConv = (DWORD)info->locals.callConv;
+ value.info.args.sigInst_methInst_Index =
+ CompileMethod->AddBuffer((unsigned char*)info->args.sigInst.methInst,
+ info->args.sigInst.methInstCount * 8); // porting issue
+ value.info.args.args = (DWORDLONG)info->args.args;
+ value.info.args.cbSig = (DWORD)info->args.cbSig;
+ value.info.args.pSig = (DWORD)CompileMethod->AddBuffer((unsigned char*)info->args.pSig, info->args.cbSig);
+ value.info.args.scope = (DWORDLONG)info->args.scope;
+ value.info.args.token = (DWORD)info->args.token;
+ value.info.locals.callConv = (DWORD)info->locals.callConv;
value.info.locals.retTypeClass = (DWORDLONG)info->locals.retTypeClass;
- value.info.locals.retTypeSigClass = (DWORDLONG)info->locals.retTypeSigClass;
- value.info.locals.retType = (DWORD)info->locals.retType;
- value.info.locals.flags = (DWORD)info->locals.flags;
- value.info.locals.numArgs = (DWORD)info->locals.numArgs;
+ value.info.locals.retTypeSigClass = (DWORDLONG)info->locals.retTypeSigClass;
+ value.info.locals.retType = (DWORD)info->locals.retType;
+ value.info.locals.flags = (DWORD)info->locals.flags;
+ value.info.locals.numArgs = (DWORD)info->locals.numArgs;
value.info.locals.sigInst_classInstCount = (DWORD)info->locals.sigInst.classInstCount;
- value.info.locals.sigInst_classInst_Index = CompileMethod->AddBuffer((unsigned char*)info->locals.sigInst.classInst, info->locals.sigInst.classInstCount * 8); // porting issue
+ value.info.locals.sigInst_classInst_Index =
+ CompileMethod->AddBuffer((unsigned char*)info->locals.sigInst.classInst,
+ info->locals.sigInst.classInstCount * 8); // porting issue
value.info.locals.sigInst_methInstCount = (DWORD)info->locals.sigInst.methInstCount;
- value.info.locals.sigInst_methInst_Index = CompileMethod->AddBuffer((unsigned char*)info->locals.sigInst.methInst, info->locals.sigInst.methInstCount * 8); // porting issue
- value.info.locals.args = (DWORDLONG)info->locals.args;
+ value.info.locals.sigInst_methInst_Index =
+ CompileMethod->AddBuffer((unsigned char*)info->locals.sigInst.methInst,
+ info->locals.sigInst.methInstCount * 8); // porting issue
+ value.info.locals.args = (DWORDLONG)info->locals.args;
value.info.locals.cbSig = (DWORD)info->locals.cbSig;
- value.info.locals.pSig = (DWORD)CompileMethod->AddBuffer((unsigned char *)info->locals.pSig, info->locals.cbSig);
+ value.info.locals.pSig = (DWORD)CompileMethod->AddBuffer((unsigned char*)info->locals.pSig, info->locals.cbSig);
value.info.locals.scope = (DWORDLONG)info->locals.scope;
value.info.locals.token = (DWORD)info->locals.token;
- value.flags = (DWORD)flags;
+ value.flags = (DWORD)flags;
CompileMethod->Add(0, value);
DEBUG_REC(dmpCompileMethod(0, value));
@@ -744,98 +798,75 @@ void MethodContext::recCompileMethod(CORINFO_METHOD_INFO *info, unsigned flags)
void MethodContext::dmpCompileMethod(DWORD key, const Agnostic_CompileMethod& value)
{
printf("CompiledMethod key %u, value ftn-%016llX scp-%016llX ilo-%u ils-%u ms-%u ehc-%u opt-%u rk-%u "
- "args{cc-%u rc-%016llX rts-%016llX rt-%u(%s) flg-%08X nA-%u cc-%u ci-%u mc-%u mi-%u arg-%016llX cb-%u pSig-%u scp-%016llX tok-%08X} "
- "locals{cc-%u rc-%016llX rts-%016llX rt-%u(%s) flg-%08X nA-%u cc-%u ci-%u mc-%u mi-%u arg-%016llX cb-%u pSig-%u scp-%016llX tok-%08X} "
+ "args{cc-%u rc-%016llX rts-%016llX rt-%u(%s) flg-%08X nA-%u cc-%u ci-%u mc-%u mi-%u arg-%016llX cb-%u "
+ "pSig-%u scp-%016llX tok-%08X} "
+ "locals{cc-%u rc-%016llX rts-%016llX rt-%u(%s) flg-%08X nA-%u cc-%u ci-%u mc-%u mi-%u arg-%016llX cb-%u "
+ "pSig-%u scp-%016llX tok-%08X} "
"flg-%08X",
- key,
- value.info.ftn,
- value.info.scope,
- value.info.ILCode_offset,
- value.info.ILCodeSize,
- value.info.maxStack,
- value.info.EHcount,
- value.info.options,
- value.info.regionKind,
- value.info.args.callConv,
- value.info.args.retTypeClass,
- value.info.args.retTypeSigClass,
- value.info.args.retType,
- toString((CorInfoType)value.info.args.retType),
- value.info.args.flags,
- value.info.args.numArgs,
- value.info.args.sigInst_classInstCount,
- value.info.args.sigInst_classInst_Index,
- value.info.args.sigInst_methInstCount,
- value.info.args.sigInst_methInst_Index,
- value.info.args.args,
- value.info.args.cbSig,
- value.info.args.pSig,
- value.info.args.scope,
- value.info.args.token,
- value.info.locals.callConv,
- value.info.locals.retTypeClass,
- value.info.locals.retTypeSigClass,
- value.info.locals.retType,
- toString((CorInfoType)value.info.locals.retType),
- value.info.locals.flags,
- value.info.locals.numArgs,
- value.info.locals.sigInst_classInstCount,
- value.info.locals.sigInst_classInst_Index,
- value.info.locals.sigInst_methInstCount,
- value.info.locals.sigInst_methInst_Index,
- value.info.locals.args,
- value.info.locals.cbSig,
- value.info.locals.pSig,
- value.info.locals.scope,
- value.info.locals.token,
- value.flags);
-}
-void MethodContext::repCompileMethod(CORINFO_METHOD_INFO *info, unsigned *flags)
+ key, value.info.ftn, value.info.scope, value.info.ILCode_offset, value.info.ILCodeSize, value.info.maxStack,
+ value.info.EHcount, value.info.options, value.info.regionKind, value.info.args.callConv,
+ value.info.args.retTypeClass, value.info.args.retTypeSigClass, value.info.args.retType,
+ toString((CorInfoType)value.info.args.retType), value.info.args.flags, value.info.args.numArgs,
+ value.info.args.sigInst_classInstCount, value.info.args.sigInst_classInst_Index,
+ value.info.args.sigInst_methInstCount, value.info.args.sigInst_methInst_Index, value.info.args.args,
+ value.info.args.cbSig, value.info.args.pSig, value.info.args.scope, value.info.args.token,
+ value.info.locals.callConv, value.info.locals.retTypeClass, value.info.locals.retTypeSigClass,
+ value.info.locals.retType, toString((CorInfoType)value.info.locals.retType), value.info.locals.flags,
+ value.info.locals.numArgs, value.info.locals.sigInst_classInstCount,
+ value.info.locals.sigInst_classInst_Index, value.info.locals.sigInst_methInstCount,
+ value.info.locals.sigInst_methInst_Index, value.info.locals.args, value.info.locals.cbSig,
+ value.info.locals.pSig, value.info.locals.scope, value.info.locals.token, value.flags);
+}
+void MethodContext::repCompileMethod(CORINFO_METHOD_INFO* info, unsigned* flags)
{
Agnostic_CompileMethod value;
- value = CompileMethod->Get((DWORD)0); //The only item in this set is a single group of inputs to CompileMethod
-
- info->ftn = (CORINFO_METHOD_HANDLE)value.info.ftn;
- info->scope = (CORINFO_MODULE_HANDLE)value.info.scope;
- info->ILCode = CompileMethod->GetBuffer(value.info.ILCode_offset);
- info->ILCodeSize = (unsigned)value.info.ILCodeSize;
- methodSize = info->ILCodeSize;
- info->maxStack = (unsigned)value.info.maxStack;
- info->EHcount = (unsigned)value.info.EHcount;
- info->options = (CorInfoOptions)value.info.options;
- info->regionKind = (CorInfoRegionKind)value.info.regionKind;
- info->args.callConv = (CorInfoCallConv)value.info.args.callConv;
- info->args.retTypeClass = (CORINFO_CLASS_HANDLE)value.info.args.retTypeClass;
- info->args.retTypeSigClass = (CORINFO_CLASS_HANDLE)value.info.args.retTypeSigClass;
- info->args.retType = (CorInfoType)value.info.args.retType;
- info->args.flags = (unsigned)value.info.args.flags;
- info->args.numArgs = (unsigned)value.info.args.numArgs;
+ value = CompileMethod->Get((DWORD)0); // The only item in this set is a single group of inputs to CompileMethod
+
+ info->ftn = (CORINFO_METHOD_HANDLE)value.info.ftn;
+ info->scope = (CORINFO_MODULE_HANDLE)value.info.scope;
+ info->ILCode = CompileMethod->GetBuffer(value.info.ILCode_offset);
+ info->ILCodeSize = (unsigned)value.info.ILCodeSize;
+ methodSize = info->ILCodeSize;
+ info->maxStack = (unsigned)value.info.maxStack;
+ info->EHcount = (unsigned)value.info.EHcount;
+ info->options = (CorInfoOptions)value.info.options;
+ info->regionKind = (CorInfoRegionKind)value.info.regionKind;
+ info->args.callConv = (CorInfoCallConv)value.info.args.callConv;
+ info->args.retTypeClass = (CORINFO_CLASS_HANDLE)value.info.args.retTypeClass;
+ info->args.retTypeSigClass = (CORINFO_CLASS_HANDLE)value.info.args.retTypeSigClass;
+ info->args.retType = (CorInfoType)value.info.args.retType;
+ info->args.flags = (unsigned)value.info.args.flags;
+ info->args.numArgs = (unsigned)value.info.args.numArgs;
info->args.sigInst.classInstCount = (unsigned)value.info.args.sigInst_classInstCount;
- info->args.sigInst.classInst = (CORINFO_CLASS_HANDLE*)CompileMethod->GetBuffer(value.info.args.sigInst_classInst_Index);
+ info->args.sigInst.classInst =
+ (CORINFO_CLASS_HANDLE*)CompileMethod->GetBuffer(value.info.args.sigInst_classInst_Index);
info->args.sigInst.methInstCount = (unsigned)value.info.args.sigInst_methInstCount;
- info->args.sigInst.methInst = (CORINFO_CLASS_HANDLE*)CompileMethod->GetBuffer(value.info.args.sigInst_methInst_Index);
- info->args.args = (CORINFO_ARG_LIST_HANDLE)value.info.args.args;
- info->args.cbSig = (unsigned int)value.info.args.cbSig;
- info->args.pSig = (PCCOR_SIGNATURE)CompileMethod->GetBuffer(value.info.args.pSig);
- info->args.scope = (CORINFO_MODULE_HANDLE)value.info.args.scope;
- info->args.token = (mdToken)value.info.args.token;
- info->locals.callConv = (CorInfoCallConv)value.info.locals.callConv;
- info->locals.retTypeClass = (CORINFO_CLASS_HANDLE)value.info.locals.retTypeClass;
- info->locals.retTypeSigClass = (CORINFO_CLASS_HANDLE)value.info.locals.retTypeSigClass;
- info->locals.retType = (CorInfoType)value.info.locals.retType;
- info->locals.flags = (unsigned)value.info.locals.flags;
- info->locals.numArgs = (unsigned)value.info.locals.numArgs;
+ info->args.sigInst.methInst =
+ (CORINFO_CLASS_HANDLE*)CompileMethod->GetBuffer(value.info.args.sigInst_methInst_Index);
+ info->args.args = (CORINFO_ARG_LIST_HANDLE)value.info.args.args;
+ info->args.cbSig = (unsigned int)value.info.args.cbSig;
+ info->args.pSig = (PCCOR_SIGNATURE)CompileMethod->GetBuffer(value.info.args.pSig);
+ info->args.scope = (CORINFO_MODULE_HANDLE)value.info.args.scope;
+ info->args.token = (mdToken)value.info.args.token;
+ info->locals.callConv = (CorInfoCallConv)value.info.locals.callConv;
+ info->locals.retTypeClass = (CORINFO_CLASS_HANDLE)value.info.locals.retTypeClass;
+ info->locals.retTypeSigClass = (CORINFO_CLASS_HANDLE)value.info.locals.retTypeSigClass;
+ info->locals.retType = (CorInfoType)value.info.locals.retType;
+ info->locals.flags = (unsigned)value.info.locals.flags;
+ info->locals.numArgs = (unsigned)value.info.locals.numArgs;
info->locals.sigInst.classInstCount = (unsigned)value.info.locals.sigInst_classInstCount;
- info->locals.sigInst.classInst = (CORINFO_CLASS_HANDLE*)CompileMethod->GetBuffer(value.info.locals.sigInst_classInst_Index);
+ info->locals.sigInst.classInst =
+ (CORINFO_CLASS_HANDLE*)CompileMethod->GetBuffer(value.info.locals.sigInst_classInst_Index);
info->locals.sigInst.methInstCount = (unsigned)value.info.locals.sigInst_methInstCount;
- info->locals.sigInst.methInst = (CORINFO_CLASS_HANDLE*)CompileMethod->GetBuffer(value.info.locals.sigInst_methInst_Index);
- info->locals.args = (CORINFO_ARG_LIST_HANDLE)value.info.locals.args;
+ info->locals.sigInst.methInst =
+ (CORINFO_CLASS_HANDLE*)CompileMethod->GetBuffer(value.info.locals.sigInst_methInst_Index);
+ info->locals.args = (CORINFO_ARG_LIST_HANDLE)value.info.locals.args;
info->locals.cbSig = (unsigned int)value.info.locals.cbSig;
- info->locals.pSig = (PCCOR_SIGNATURE)CompileMethod->GetBuffer(value.info.locals.pSig);
+ info->locals.pSig = (PCCOR_SIGNATURE)CompileMethod->GetBuffer(value.info.locals.pSig);
info->locals.scope = (CORINFO_MODULE_HANDLE)value.info.locals.scope;
info->locals.token = (mdToken)value.info.locals.token;
- *flags = (unsigned)value.flags;
+ *flags = (unsigned)value.flags;
DEBUG_REP(dmpCompileMethod(0, value));
}
@@ -853,9 +884,11 @@ void MethodContext::dmpGetMethodClass(DWORDLONG key, DWORDLONG value)
}
CORINFO_CLASS_HANDLE MethodContext::repGetMethodClass(CORINFO_METHOD_HANDLE methodHandle)
{
- AssertCodeMsg(GetMethodClass != nullptr, EXCEPTIONCODE_MC, "Found a null GetMethodClass. Probably missing a fatTrigger for %016llX.", (DWORDLONG)methodHandle);
+ AssertCodeMsg(GetMethodClass != nullptr, EXCEPTIONCODE_MC,
+ "Found a null GetMethodClass. Probably missing a fatTrigger for %016llX.", (DWORDLONG)methodHandle);
int index = GetMethodClass->GetIndex((DWORDLONG)methodHandle);
- AssertCodeMsg(index != -1, EXCEPTIONCODE_MC, "Didn't find %016llX. Probably missing a fatTrigger", (DWORDLONG)methodHandle);
+ AssertCodeMsg(index != -1, EXCEPTIONCODE_MC, "Didn't find %016llX. Probably missing a fatTrigger",
+ (DWORDLONG)methodHandle);
CORINFO_CLASS_HANDLE value = (CORINFO_CLASS_HANDLE)GetMethodClass->Get((DWORDLONG)methodHandle);
DEBUG_REP(dmpGetMethodClass((DWORDLONG)methodHandle, (DWORDLONG)value));
return value;
@@ -875,9 +908,11 @@ void MethodContext::dmpGetClassAttribs(DWORDLONG key, DWORD value)
}
DWORD MethodContext::repGetClassAttribs(CORINFO_CLASS_HANDLE classHandle)
{
- AssertCodeMsg(GetClassAttribs != nullptr, EXCEPTIONCODE_MC, "Found a null GetMethodClass. Probably missing a fatTrigger for %016llX.", (DWORDLONG)classHandle);
+ AssertCodeMsg(GetClassAttribs != nullptr, EXCEPTIONCODE_MC,
+ "Found a null GetMethodClass. Probably missing a fatTrigger for %016llX.", (DWORDLONG)classHandle);
int index = GetClassAttribs->GetIndex((DWORDLONG)classHandle);
- AssertCodeMsg(index != -1, EXCEPTIONCODE_MC, "Didn't find %016llX. Probably missing a fatTrigger", (DWORDLONG)classHandle);
+ AssertCodeMsg(index != -1, EXCEPTIONCODE_MC, "Didn't find %016llX. Probably missing a fatTrigger",
+ (DWORDLONG)classHandle);
DWORD value = (DWORD)GetClassAttribs->Get((DWORDLONG)classHandle);
DEBUG_REP(dmpGetClassAttribs((DWORDLONG)classHandle, value));
return value;
@@ -897,9 +932,12 @@ void MethodContext::dmpGetMethodAttribs(DWORDLONG key, DWORD value)
}
DWORD MethodContext::repGetMethodAttribs(CORINFO_METHOD_HANDLE methodHandle)
{
- AssertCodeMsg(GetMethodAttribs != nullptr, EXCEPTIONCODE_MC, "Found a null GetMethodAttribs. Probably missing a fatTrigger for %016llX.", (DWORDLONG)methodHandle);
+ AssertCodeMsg(GetMethodAttribs != nullptr, EXCEPTIONCODE_MC,
+ "Found a null GetMethodAttribs. Probably missing a fatTrigger for %016llX.",
+ (DWORDLONG)methodHandle);
int index = GetMethodAttribs->GetIndex((DWORDLONG)methodHandle);
- AssertCodeMsg(index != -1, EXCEPTIONCODE_MC, "Didn't find %016llX. Probably missing a fatTrigger", (DWORDLONG)methodHandle);
+ AssertCodeMsg(index != -1, EXCEPTIONCODE_MC, "Didn't find %016llX. Probably missing a fatTrigger",
+ (DWORDLONG)methodHandle);
DWORD value = (DWORD)GetMethodAttribs->Get((DWORDLONG)methodHandle);
DEBUG_REP(dmpGetMethodAttribs((DWORDLONG)methodHandle, value));
if (cr->repSetMethodAttribs(methodHandle) == CORINFO_FLG_BAD_INLINEE)
@@ -907,8 +945,11 @@ DWORD MethodContext::repGetMethodAttribs(CORINFO_METHOD_HANDLE methodHandle)
return value;
}
-//Note - the jit will call freearray on the array we give back....
-void MethodContext::recGetVars(CORINFO_METHOD_HANDLE ftn, ULONG32 *cVars, ICorDebugInfo::ILVarInfo **vars_in, bool *extendOthers)
+// Note - the jit will call freearray on the array we give back....
+void MethodContext::recGetVars(CORINFO_METHOD_HANDLE ftn,
+ ULONG32* cVars,
+ ICorDebugInfo::ILVarInfo** vars_in,
+ bool* extendOthers)
{
if (GetVars == nullptr)
GetVars = new LightWeightMap<DWORDLONG, Agnostic_GetVars>();
@@ -916,7 +957,8 @@ void MethodContext::recGetVars(CORINFO_METHOD_HANDLE ftn, ULONG32 *cVars, ICorDe
Agnostic_GetVars value;
value.cVars = (DWORD)*cVars;
- value.vars_offset = (DWORD)GetVars->AddBuffer((unsigned char*)*vars_in, sizeof(ICorDebugInfo::ILVarInfo) * (*cVars));
+ value.vars_offset =
+ (DWORD)GetVars->AddBuffer((unsigned char*)*vars_in, sizeof(ICorDebugInfo::ILVarInfo) * (*cVars));
value.extendOthers = (DWORD)*extendOthers;
GetVars->Add((DWORDLONG)ftn, value);
@@ -924,14 +966,17 @@ void MethodContext::recGetVars(CORINFO_METHOD_HANDLE ftn, ULONG32 *cVars, ICorDe
}
void MethodContext::dmpGetVars(DWORDLONG key, const Agnostic_GetVars& value)
{
- ICorDebugInfo::ILVarInfo *vars = (ICorDebugInfo::ILVarInfo *)GetVars->GetBuffer(value.vars_offset);
+ ICorDebugInfo::ILVarInfo* vars = (ICorDebugInfo::ILVarInfo*)GetVars->GetBuffer(value.vars_offset);
printf("GetVars key ftn-%016llX, value cVars-%u extendOthers-%u (", key, value.cVars, value.extendOthers);
for (unsigned int i = 0; i < value.cVars; i++)
printf("(%u %u %u %u)", i, vars[i].startOffset, vars[i].endOffset, vars[i].varNumber);
printf(")");
GetVars->Unlock();
}
-void MethodContext::repGetVars(CORINFO_METHOD_HANDLE ftn, ULONG32 *cVars, ICorDebugInfo::ILVarInfo **vars_in, bool *extendOthers)
+void MethodContext::repGetVars(CORINFO_METHOD_HANDLE ftn,
+ ULONG32* cVars,
+ ICorDebugInfo::ILVarInfo** vars_in,
+ bool* extendOthers)
{
Agnostic_GetVars value;
if (GetVars == nullptr)
@@ -939,16 +984,19 @@ void MethodContext::repGetVars(CORINFO_METHOD_HANDLE ftn, ULONG32 *cVars, ICorDe
*cVars = 0;
return;
}
- value = GetVars->Get((DWORDLONG)ftn);
+ value = GetVars->Get((DWORDLONG)ftn);
*cVars = (ULONG32)value.cVars;
if (*cVars > 0)
- *vars_in = (ICorDebugInfo::ILVarInfo *)GetVars->GetBuffer(value.vars_offset);
+ *vars_in = (ICorDebugInfo::ILVarInfo*)GetVars->GetBuffer(value.vars_offset);
*extendOthers = value.extendOthers != 0;
DEBUG_REP(dmpGetVars((DWORDLONG)ftn, value));
}
-//Note - the jit will call freearray on the array we give back....
-void MethodContext::recGetBoundaries(CORINFO_METHOD_HANDLE ftn, unsigned int *cILOffsets, DWORD **pILOffsets, ICorDebugInfo::BoundaryTypes *implictBoundaries)
+// Note - the jit will call freearray on the array we give back....
+void MethodContext::recGetBoundaries(CORINFO_METHOD_HANDLE ftn,
+ unsigned int* cILOffsets,
+ DWORD** pILOffsets,
+ ICorDebugInfo::BoundaryTypes* implictBoundaries)
{
if (GetBoundaries == nullptr)
GetBoundaries = new LightWeightMap<DWORDLONG, Agnostic_GetBoundaries>();
@@ -956,7 +1004,8 @@ void MethodContext::recGetBoundaries(CORINFO_METHOD_HANDLE ftn, unsigned int *cI
Agnostic_GetBoundaries value;
value.cILOffsets = (DWORD)*cILOffsets;
- value.pILOffset_offset = (DWORD)GetBoundaries->AddBuffer((unsigned char*)*pILOffsets, sizeof(DWORD)*(*cILOffsets));
+ value.pILOffset_offset =
+ (DWORD)GetBoundaries->AddBuffer((unsigned char*)*pILOffsets, sizeof(DWORD) * (*cILOffsets));
value.implicitBoundaries = *implictBoundaries;
GetBoundaries->Add((DWORDLONG)ftn, value);
@@ -965,7 +1014,7 @@ void MethodContext::recGetBoundaries(CORINFO_METHOD_HANDLE ftn, unsigned int *cI
void MethodContext::dmpGetBoundaries(DWORDLONG key, const Agnostic_GetBoundaries& value)
{
printf("GetBoundaries key ftn-%016llX, value cnt-%u imp-%u{", key, value.cILOffsets, value.implicitBoundaries);
- DWORD *bnd = (DWORD *)GetBoundaries->GetBuffer(value.pILOffset_offset);
+ DWORD* bnd = (DWORD*)GetBoundaries->GetBuffer(value.pILOffset_offset);
for (unsigned int i = 0; i < value.cILOffsets; i++)
{
printf("%u", bnd[i]);
@@ -975,7 +1024,10 @@ void MethodContext::dmpGetBoundaries(DWORDLONG key, const Agnostic_GetBoundaries
GetBoundaries->Unlock();
printf("}");
}
-void MethodContext::repGetBoundaries(CORINFO_METHOD_HANDLE ftn, unsigned int *cILOffsets, DWORD **pILOffsets, ICorDebugInfo::BoundaryTypes *implictBoundaries)
+void MethodContext::repGetBoundaries(CORINFO_METHOD_HANDLE ftn,
+ unsigned int* cILOffsets,
+ DWORD** pILOffsets,
+ ICorDebugInfo::BoundaryTypes* implictBoundaries)
{
Agnostic_GetBoundaries value;
@@ -983,22 +1035,27 @@ void MethodContext::repGetBoundaries(CORINFO_METHOD_HANDLE ftn, unsigned int *cI
*cILOffsets = (unsigned int)value.cILOffsets;
if (*cILOffsets > 0)
- *pILOffsets = (DWORD *)GetBoundaries->GetBuffer(value.pILOffset_offset);
+ *pILOffsets = (DWORD*)GetBoundaries->GetBuffer(value.pILOffset_offset);
*implictBoundaries = (ICorDebugInfo::BoundaryTypes)value.implicitBoundaries;
DEBUG_REP(dmpGetBoundaries((DWORDLONG)ftn, value));
}
-void MethodContext::recInitClass(CORINFO_FIELD_HANDLE field, CORINFO_METHOD_HANDLE method, CORINFO_CONTEXT_HANDLE context, BOOL speculative, CorInfoInitClassResult result)
+void MethodContext::recInitClass(CORINFO_FIELD_HANDLE field,
+ CORINFO_METHOD_HANDLE method,
+ CORINFO_CONTEXT_HANDLE context,
+ BOOL speculative,
+ CorInfoInitClassResult result)
{
if (InitClass == nullptr)
InitClass = new LightWeightMap<Agnostic_InitClass, DWORD>();
Agnostic_InitClass key;
- ZeroMemory(&key, sizeof(Agnostic_InitClass)); //We use the input structs as a key and use memcmp to compare.. so we need to zero out padding too
- key.field = (DWORDLONG)field;
- key.method = (DWORDLONG)method;
- key.context = (DWORDLONG)context;
+ ZeroMemory(&key, sizeof(Agnostic_InitClass)); // We use the input structs as a key and use memcmp to compare.. so we
+ // need to zero out padding too
+ key.field = (DWORDLONG)field;
+ key.method = (DWORDLONG)method;
+ key.context = (DWORDLONG)context;
key.speculative = (DWORD)speculative;
InitClass->Add(key, (DWORD)result);
@@ -1006,16 +1063,21 @@ void MethodContext::recInitClass(CORINFO_FIELD_HANDLE field, CORINFO_METHOD_HAND
}
void MethodContext::dmpInitClass(const Agnostic_InitClass& key, DWORD value)
{
- printf("InitClass key fld-%016llX meth-%016llX con-%016llX spec-%u, value res-%u", key.field, key.method, key.context, key.speculative, value);
+ printf("InitClass key fld-%016llX meth-%016llX con-%016llX spec-%u, value res-%u", key.field, key.method,
+ key.context, key.speculative, value);
}
-CorInfoInitClassResult MethodContext::repInitClass(CORINFO_FIELD_HANDLE field, CORINFO_METHOD_HANDLE method, CORINFO_CONTEXT_HANDLE context, BOOL speculative)
+CorInfoInitClassResult MethodContext::repInitClass(CORINFO_FIELD_HANDLE field,
+ CORINFO_METHOD_HANDLE method,
+ CORINFO_CONTEXT_HANDLE context,
+ BOOL speculative)
{
Agnostic_InitClass key;
- ZeroMemory(&key, sizeof(Agnostic_InitClass)); //We use the input structs as a key and use memcmp to compare.. so we need to zero out padding too
+ ZeroMemory(&key, sizeof(Agnostic_InitClass)); // We use the input structs as a key and use memcmp to compare.. so we
+ // need to zero out padding too
- key.field = (DWORDLONG)field;
- key.method = (DWORDLONG)method;
- key.context = (DWORDLONG)context;
+ key.field = (DWORDLONG)field;
+ key.method = (DWORDLONG)method;
+ key.context = (DWORDLONG)context;
key.speculative = (DWORD)speculative;
AssertCodeMsg(InitClass != nullptr, EXCEPTIONCODE_MC, "Didn't find anything for %016llX", (DWORDLONG)key.method);
@@ -1026,22 +1088,22 @@ CorInfoInitClassResult MethodContext::repInitClass(CORINFO_FIELD_HANDLE field, C
return result;
}
-void MethodContext::recGetMethodName(CORINFO_METHOD_HANDLE ftn, char *methodname, const char **moduleName)
+void MethodContext::recGetMethodName(CORINFO_METHOD_HANDLE ftn, char* methodname, const char** moduleName)
{
if (GetMethodName == nullptr)
GetMethodName = new LightWeightMap<DLD, DD>();
- DD value;
+ DD value;
DLD key;
key.A = (DWORDLONG)ftn;
key.B = (moduleName != nullptr);
if (methodname != nullptr)
- value.A = GetMethodName->AddBuffer((unsigned char *)methodname, (DWORD)strlen(methodname) + 1);
+ value.A = GetMethodName->AddBuffer((unsigned char*)methodname, (DWORD)strlen(methodname) + 1);
else
value.A = (DWORD)-1;
if (moduleName != nullptr)
- value.B = GetMethodName->AddBuffer((unsigned char *)*moduleName, (DWORD)strlen(*moduleName) + 1);
+ value.B = GetMethodName->AddBuffer((unsigned char*)*moduleName, (DWORD)strlen(*moduleName) + 1);
else
value.B = (DWORD)-1;
@@ -1050,16 +1112,17 @@ void MethodContext::recGetMethodName(CORINFO_METHOD_HANDLE ftn, char *methodname
}
void MethodContext::dmpGetMethodName(DLD key, DD value)
{
- unsigned char *methodName = (unsigned char *)GetMethodName->GetBuffer(value.A);
- unsigned char *moduleName = (unsigned char *)GetMethodName->GetBuffer(value.B);
- printf("GetMethodName key - ftn-%016llX modNonNull-%u, value meth-'%s', mod-'%s'", key.A, key.B, methodName, moduleName);
+ unsigned char* methodName = (unsigned char*)GetMethodName->GetBuffer(value.A);
+ unsigned char* moduleName = (unsigned char*)GetMethodName->GetBuffer(value.B);
+ printf("GetMethodName key - ftn-%016llX modNonNull-%u, value meth-'%s', mod-'%s'", key.A, key.B, methodName,
+ moduleName);
GetMethodName->Unlock();
}
-const char *MethodContext::repGetMethodName(CORINFO_METHOD_HANDLE ftn, const char **moduleName)
+const char* MethodContext::repGetMethodName(CORINFO_METHOD_HANDLE ftn, const char** moduleName)
{
const char* result = "hackishMethodName";
- DD value;
- DLD key;
+ DD value;
+ DLD key;
key.A = (DWORDLONG)ftn;
key.B = (moduleName != nullptr);
@@ -1075,20 +1138,20 @@ const char *MethodContext::repGetMethodName(CORINFO_METHOD_HANDLE ftn, const cha
{
value = GetMethodName->Get(key);
if (moduleName != nullptr)
- *moduleName = (const char *)GetMethodName->GetBuffer(value.B);
- result = (const char *)GetMethodName->GetBuffer(value.A);
+ *moduleName = (const char*)GetMethodName->GetBuffer(value.B);
+ result = (const char*)GetMethodName->GetBuffer(value.A);
}
DEBUG_REP(dmpGetMethodName(key, value));
return result;
}
-void MethodContext::recGetJitFlags(CORJIT_FLAGS *jitFlags, DWORD sizeInBytes, DWORD result)
+void MethodContext::recGetJitFlags(CORJIT_FLAGS* jitFlags, DWORD sizeInBytes, DWORD result)
{
if (GetJitFlags == nullptr)
GetJitFlags = new LightWeightMap<DWORD, DD>();
DD value;
- value.A = (DWORD)GetJitFlags->AddBuffer((unsigned char *)jitFlags, sizeInBytes);
+ value.A = (DWORD)GetJitFlags->AddBuffer((unsigned char*)jitFlags, sizeInBytes);
value.B = result;
// NOTE: getJitFlags() is expected to be idempotent per method, so the mapping key is always
@@ -1098,14 +1161,14 @@ void MethodContext::recGetJitFlags(CORJIT_FLAGS *jitFlags, DWORD sizeInBytes, DW
}
void MethodContext::dmpGetJitFlags(DWORD key, DD value)
{
- CORJIT_FLAGS *jitflags = (CORJIT_FLAGS*)GetJitFlags->GetBuffer(value.A);
+ CORJIT_FLAGS* jitflags = (CORJIT_FLAGS*)GetJitFlags->GetBuffer(value.A);
printf("GetJitFlags key %u sizeInBytes-%u jitFlags-%016llX", key, value.B, jitflags->GetFlagsRaw());
GetJitFlags->Unlock();
}
-DWORD MethodContext::repGetJitFlags(CORJIT_FLAGS *jitFlags, DWORD sizeInBytes)
+DWORD MethodContext::repGetJitFlags(CORJIT_FLAGS* jitFlags, DWORD sizeInBytes)
{
- DD value = GetJitFlags->Get((DWORD)0);
- CORJIT_FLAGS *resultFlags = (CORJIT_FLAGS*)GetJitFlags->GetBuffer(value.A);
+ DD value = GetJitFlags->Get((DWORD)0);
+ CORJIT_FLAGS* resultFlags = (CORJIT_FLAGS*)GetJitFlags->GetBuffer(value.A);
memcpy(jitFlags, resultFlags, value.B);
DEBUG_REP(dmpGetJitFlags((DWORD)0, value));
return value.B;
@@ -1119,36 +1182,42 @@ void MethodContext::recGetJitTimeLogFilename(LPCWSTR tempFileName)
DWORD name_index = -1;
if (tempFileName != nullptr)
{
- name_index = (DWORD)GetJitTimeLogFilename->AddBuffer((unsigned char *)tempFileName, (DWORD)wcslen(tempFileName) + 2);
+ name_index =
+ (DWORD)GetJitTimeLogFilename->AddBuffer((unsigned char*)tempFileName, (DWORD)wcslen(tempFileName) + 2);
}
GetJitTimeLogFilename->Add((DWORD)0, name_index);
DEBUG_REC(dmpGetJitTimeLogFilename((DWORD)0, name_index));
}
void MethodContext::dmpGetJitTimeLogFilename(DWORD key, DWORD value)
{
- unsigned char *fileName = nullptr;
+ unsigned char* fileName = nullptr;
if (value != 0)
- fileName = (unsigned char *)GetJitTimeLogFilename->GetBuffer(value);
+ fileName = (unsigned char*)GetJitTimeLogFilename->GetBuffer(value);
printf("GetJitTimeLogFilename key %u, value '%s'", key, fileName);
GetJitTimeLogFilename->Unlock();
}
LPCWSTR MethodContext::repGetJitTimeLogFilename()
{
- DWORD offset = GetJitTimeLogFilename->Get((DWORD)0);
- LPCWSTR value = nullptr;
+ DWORD offset = GetJitTimeLogFilename->Get((DWORD)0);
+ LPCWSTR value = nullptr;
if (offset != 0)
value = (LPCWSTR)GetJitTimeLogFilename->GetBuffer(offset);
DEBUG_REP(dmpGetJitTimeLogFilename((DWORD)0, offset));
return value;
}
-void MethodContext::recCanInline(CORINFO_METHOD_HANDLE callerHnd, CORINFO_METHOD_HANDLE calleeHnd, DWORD *pRestrictions, CorInfoInline response, DWORD exceptionCode)
+void MethodContext::recCanInline(CORINFO_METHOD_HANDLE callerHnd,
+ CORINFO_METHOD_HANDLE calleeHnd,
+ DWORD* pRestrictions,
+ CorInfoInline response,
+ DWORD exceptionCode)
{
if (CanInline == nullptr)
CanInline = new LightWeightMap<DLDL, Agnostic_CanInline>();
DLDL key;
- ZeroMemory(&key, sizeof(DLDL)); //We use the input structs as a key and use memcmp to compare.. so we need to zero out padding too
+ ZeroMemory(&key, sizeof(DLDL)); // We use the input structs as a key and use memcmp to compare.. so we need to zero
+ // out padding too
Agnostic_CanInline value;
key.A = (DWORDLONG)callerHnd;
@@ -1158,20 +1227,25 @@ void MethodContext::recCanInline(CORINFO_METHOD_HANDLE callerHnd, CORINFO_METHOD
value.Restrictions = (DWORD)*pRestrictions;
else
value.Restrictions = (DWORD)0;
- value.result = (DWORD)response;
- value.exceptionCode = (DWORD)exceptionCode;
+ value.result = (DWORD)response;
+ value.exceptionCode = (DWORD)exceptionCode;
CanInline->Add(key, value);
DEBUG_REC(dmpCanInline(key, value));
}
void MethodContext::dmpCanInline(DLDL key, const Agnostic_CanInline& value)
{
- printf("CanInline key - callerHnd-%016llX calleeHnd-%016llX, value pRestrictions-%u result-%u exceptionCode-%08X", key.A, key.B, value.Restrictions, value.result, value.exceptionCode);
+ printf("CanInline key - callerHnd-%016llX calleeHnd-%016llX, value pRestrictions-%u result-%u exceptionCode-%08X",
+ key.A, key.B, value.Restrictions, value.result, value.exceptionCode);
}
-CorInfoInline MethodContext::repCanInline(CORINFO_METHOD_HANDLE callerHnd, CORINFO_METHOD_HANDLE calleeHnd, DWORD* pRestrictions, DWORD *exceptionCode)
+CorInfoInline MethodContext::repCanInline(CORINFO_METHOD_HANDLE callerHnd,
+ CORINFO_METHOD_HANDLE calleeHnd,
+ DWORD* pRestrictions,
+ DWORD* exceptionCode)
{
DLDL key;
- ZeroMemory(&key, sizeof(DLDL)); //We use the input structs as a key and use memcmp to compare.. so we need to zero out padding too
+ ZeroMemory(&key, sizeof(DLDL)); // We use the input structs as a key and use memcmp to compare.. so we need to zero
+ // out padding too
Agnostic_CanInline value;
key.A = (DWORDLONG)callerHnd;
@@ -1181,9 +1255,10 @@ CorInfoInline MethodContext::repCanInline(CORINFO_METHOD_HANDLE callerHnd, CORIN
{
#ifdef sparseMC
LogDebug("Sparse - repCanInline saying INLINE_FAIL");
- return INLINE_FAIL; //if we have no info, its pretty safe to say we can't inline it.
+ return INLINE_FAIL; // if we have no info, its pretty safe to say we can't inline it.
#else
- LogException(EXCEPTIONCODE_MC, "Didn't find %016llx, %016llx. probably a missing exception in canInline", key.A, key.B);
+ LogException(EXCEPTIONCODE_MC, "Didn't find %016llx, %016llx. probably a missing exception in canInline",
+ key.A, key.B);
#endif
}
@@ -1192,135 +1267,127 @@ CorInfoInline MethodContext::repCanInline(CORINFO_METHOD_HANDLE callerHnd, CORIN
*exceptionCode = value.exceptionCode;
if (pRestrictions != nullptr)
- *pRestrictions = (DWORD)value.Restrictions;
+ *pRestrictions = (DWORD)value.Restrictions;
CorInfoInline response = (CorInfoInline)value.result;
DEBUG_REP(dmpCanInline(key, value));
return response;
}
-void MethodContext::recResolveToken(CORINFO_RESOLVED_TOKEN * pResolvedToken, DWORD exceptionCode)
+void MethodContext::recResolveToken(CORINFO_RESOLVED_TOKEN* pResolvedToken, DWORD exceptionCode)
{
if (ResolveToken == nullptr)
ResolveToken = new LightWeightMap<Agnostic_CORINFO_RESOLVED_TOKENin, Agnostic_CORINFO_RESOLVED_TOKENout>();
Agnostic_CORINFO_RESOLVED_TOKENin key;
- ZeroMemory(&key, sizeof(Agnostic_CORINFO_RESOLVED_TOKENin)); //We use the input structs as a key and use memcmp to compare.. so we need to zero out padding too
+ ZeroMemory(&key, sizeof(Agnostic_CORINFO_RESOLVED_TOKENin)); // We use the input structs as a key and use memcmp to
+ // compare.. so we need to zero out padding too
Agnostic_CORINFO_RESOLVED_TOKENout value;
key.tokenContext = (DWORDLONG)pResolvedToken->tokenContext;
- key.tokenScope = (DWORDLONG)pResolvedToken->tokenScope;
- key.token = (DWORD)pResolvedToken->token;
- key.tokenType = (DWORD)pResolvedToken->tokenType;
+ key.tokenScope = (DWORDLONG)pResolvedToken->tokenScope;
+ key.token = (DWORD)pResolvedToken->token;
+ key.tokenType = (DWORD)pResolvedToken->tokenType;
- value.hClass = (DWORDLONG)pResolvedToken->hClass;
+ value.hClass = (DWORDLONG)pResolvedToken->hClass;
value.hMethod = (DWORDLONG)pResolvedToken->hMethod;
- value.hField = (DWORDLONG)pResolvedToken->hField;
- value.pTypeSpec_Index = (DWORD)ResolveToken->AddBuffer((unsigned char*)pResolvedToken->pTypeSpec, pResolvedToken->cbTypeSpec);
+ value.hField = (DWORDLONG)pResolvedToken->hField;
+ value.pTypeSpec_Index =
+ (DWORD)ResolveToken->AddBuffer((unsigned char*)pResolvedToken->pTypeSpec, pResolvedToken->cbTypeSpec);
value.cbTypeSpec = (DWORD)pResolvedToken->cbTypeSpec;
- value.pMethodSpec_Index = (DWORD)ResolveToken->AddBuffer((unsigned char*)pResolvedToken->pMethodSpec, pResolvedToken->cbMethodSpec);
- value.cbMethodSpec = (DWORD)pResolvedToken->cbMethodSpec;
+ value.pMethodSpec_Index =
+ (DWORD)ResolveToken->AddBuffer((unsigned char*)pResolvedToken->pMethodSpec, pResolvedToken->cbMethodSpec);
+ value.cbMethodSpec = (DWORD)pResolvedToken->cbMethodSpec;
value.exceptionCode = (DWORD)exceptionCode;
ResolveToken->Add(key, value);
DEBUG_REC(dmpResolveToken(key, value));
}
-void MethodContext::dmpResolveToken(const Agnostic_CORINFO_RESOLVED_TOKENin& key, const Agnostic_CORINFO_RESOLVED_TOKENout& value)
-{
- printf("ResolveToken key tc-%016llX ts-%016llX tok-%08X tt-%u",
- key.tokenContext,
- key.tokenScope,
- key.token,
- key.tokenType);
- printf(", value cls-%016llX meth-%016llX fld-%016llX ti-%u ts-%u mi-%u ms-%u excp-%08X",
- value.hClass,
- value.hMethod,
- value.hField,
- value.pTypeSpec_Index,
- value.cbTypeSpec,
- value.pMethodSpec_Index,
- value.cbMethodSpec,
- value.exceptionCode);
-}
-void MethodContext::repResolveToken(CORINFO_RESOLVED_TOKEN * pResolvedToken, DWORD *exceptionCode)
+void MethodContext::dmpResolveToken(const Agnostic_CORINFO_RESOLVED_TOKENin& key,
+ const Agnostic_CORINFO_RESOLVED_TOKENout& value)
+{
+ printf("ResolveToken key tc-%016llX ts-%016llX tok-%08X tt-%u", key.tokenContext, key.tokenScope, key.token,
+ key.tokenType);
+ printf(", value cls-%016llX meth-%016llX fld-%016llX ti-%u ts-%u mi-%u ms-%u excp-%08X", value.hClass,
+ value.hMethod, value.hField, value.pTypeSpec_Index, value.cbTypeSpec, value.pMethodSpec_Index,
+ value.cbMethodSpec, value.exceptionCode);
+}
+void MethodContext::repResolveToken(CORINFO_RESOLVED_TOKEN* pResolvedToken, DWORD* exceptionCode)
{
Agnostic_CORINFO_RESOLVED_TOKENin key;
- ZeroMemory(&key, sizeof(Agnostic_CORINFO_RESOLVED_TOKENin)); //We use the input structs as a key and use memcmp to compare.. so we need to zero out padding too
+ ZeroMemory(&key, sizeof(Agnostic_CORINFO_RESOLVED_TOKENin)); // We use the input structs as a key and use memcmp to
+ // compare.. so we need to zero out padding too
Agnostic_CORINFO_RESOLVED_TOKENout value;
key.tokenContext = (DWORDLONG)pResolvedToken->tokenContext;
- key.tokenScope = (DWORDLONG)pResolvedToken->tokenScope;
- key.token = (DWORD)pResolvedToken->token;
- key.tokenType = (DWORD)pResolvedToken->tokenType;
+ key.tokenScope = (DWORDLONG)pResolvedToken->tokenScope;
+ key.token = (DWORD)pResolvedToken->token;
+ key.tokenType = (DWORD)pResolvedToken->tokenType;
AssertCodeMsg(ResolveToken->GetIndex(key) != -1, EXCEPTIONCODE_MC, "Didn't find %x", pResolvedToken->token);
value = ResolveToken->Get(key);
- pResolvedToken->hClass = (CORINFO_CLASS_HANDLE)value.hClass;
- pResolvedToken->hMethod = (CORINFO_METHOD_HANDLE)value.hMethod;
- pResolvedToken->hField = (CORINFO_FIELD_HANDLE)value.hField;
- pResolvedToken->pTypeSpec = (PCCOR_SIGNATURE)ResolveToken->GetBuffer(value.pTypeSpec_Index);
- pResolvedToken->cbTypeSpec = (ULONG)value.cbTypeSpec;
- pResolvedToken->pMethodSpec = (PCCOR_SIGNATURE)ResolveToken->GetBuffer(value.pMethodSpec_Index);
+ pResolvedToken->hClass = (CORINFO_CLASS_HANDLE)value.hClass;
+ pResolvedToken->hMethod = (CORINFO_METHOD_HANDLE)value.hMethod;
+ pResolvedToken->hField = (CORINFO_FIELD_HANDLE)value.hField;
+ pResolvedToken->pTypeSpec = (PCCOR_SIGNATURE)ResolveToken->GetBuffer(value.pTypeSpec_Index);
+ pResolvedToken->cbTypeSpec = (ULONG)value.cbTypeSpec;
+ pResolvedToken->pMethodSpec = (PCCOR_SIGNATURE)ResolveToken->GetBuffer(value.pMethodSpec_Index);
pResolvedToken->cbMethodSpec = (ULONG)value.cbMethodSpec;
- *exceptionCode = (DWORD)value.exceptionCode;
+ *exceptionCode = (DWORD)value.exceptionCode;
DEBUG_REP(dmpResolveToken(key, value));
}
-void MethodContext::recTryResolveToken(CORINFO_RESOLVED_TOKEN * pResolvedToken, bool success)
+void MethodContext::recTryResolveToken(CORINFO_RESOLVED_TOKEN* pResolvedToken, bool success)
{
if (TryResolveToken == nullptr)
TryResolveToken = new LightWeightMap<Agnostic_CORINFO_RESOLVED_TOKENin, Agnostic_CORINFO_RESOLVED_TOKENout>();
Agnostic_CORINFO_RESOLVED_TOKENin key;
- ZeroMemory(&key, sizeof(Agnostic_CORINFO_RESOLVED_TOKENin)); //We use the input structs as a key and use memcmp to compare.. so we need to zero out padding too
+ ZeroMemory(&key, sizeof(Agnostic_CORINFO_RESOLVED_TOKENin)); // We use the input structs as a key and use memcmp to
+ // compare.. so we need to zero out padding too
Agnostic_CORINFO_RESOLVED_TOKENout value;
key.tokenContext = (DWORDLONG)pResolvedToken->tokenContext;
- key.tokenScope = (DWORDLONG)pResolvedToken->tokenScope;
- key.token = (DWORD)pResolvedToken->token;
- key.tokenType = (DWORD)pResolvedToken->tokenType;
+ key.tokenScope = (DWORDLONG)pResolvedToken->tokenScope;
+ key.token = (DWORD)pResolvedToken->token;
+ key.tokenType = (DWORD)pResolvedToken->tokenType;
- value.hClass = (DWORDLONG)pResolvedToken->hClass;
+ value.hClass = (DWORDLONG)pResolvedToken->hClass;
value.hMethod = (DWORDLONG)pResolvedToken->hMethod;
- value.hField = (DWORDLONG)pResolvedToken->hField;
- value.pTypeSpec_Index = (DWORD)ResolveToken->AddBuffer((unsigned char*)pResolvedToken->pTypeSpec, pResolvedToken->cbTypeSpec);
+ value.hField = (DWORDLONG)pResolvedToken->hField;
+ value.pTypeSpec_Index =
+ (DWORD)ResolveToken->AddBuffer((unsigned char*)pResolvedToken->pTypeSpec, pResolvedToken->cbTypeSpec);
value.cbTypeSpec = (DWORD)pResolvedToken->cbTypeSpec;
- value.pMethodSpec_Index = (DWORD)ResolveToken->AddBuffer((unsigned char*)pResolvedToken->pMethodSpec, pResolvedToken->cbMethodSpec);
- value.cbMethodSpec = (DWORD)pResolvedToken->cbMethodSpec;
+ value.pMethodSpec_Index =
+ (DWORD)ResolveToken->AddBuffer((unsigned char*)pResolvedToken->pMethodSpec, pResolvedToken->cbMethodSpec);
+ value.cbMethodSpec = (DWORD)pResolvedToken->cbMethodSpec;
value.exceptionCode = success ? 0 : 1;
TryResolveToken->Add(key, value);
DEBUG_REC(dmpTryResolveToken(key, value));
}
-void MethodContext::dmpTryResolveToken(const Agnostic_CORINFO_RESOLVED_TOKENin& key, const Agnostic_CORINFO_RESOLVED_TOKENout& value)
-{
- printf("TryResolveToken key tc-%016llX ts-%016llX tok-%08X tt-%u",
- key.tokenContext,
- key.tokenScope,
- key.token,
- key.tokenType);
- printf(", value cls-%016llX meth-%016llX fld-%016llX ti-%u ts-%u mi-%u ms-%u failed-%u",
- value.hClass,
- value.hMethod,
- value.hField,
- value.pTypeSpec_Index,
- value.cbTypeSpec,
- value.pMethodSpec_Index,
- value.cbMethodSpec,
- value.exceptionCode);
-}
-bool MethodContext::repTryResolveToken(CORINFO_RESOLVED_TOKEN * pResolvedToken)
+void MethodContext::dmpTryResolveToken(const Agnostic_CORINFO_RESOLVED_TOKENin& key,
+ const Agnostic_CORINFO_RESOLVED_TOKENout& value)
+{
+ printf("TryResolveToken key tc-%016llX ts-%016llX tok-%08X tt-%u", key.tokenContext, key.tokenScope, key.token,
+ key.tokenType);
+ printf(", value cls-%016llX meth-%016llX fld-%016llX ti-%u ts-%u mi-%u ms-%u failed-%u", value.hClass,
+ value.hMethod, value.hField, value.pTypeSpec_Index, value.cbTypeSpec, value.pMethodSpec_Index,
+ value.cbMethodSpec, value.exceptionCode);
+}
+bool MethodContext::repTryResolveToken(CORINFO_RESOLVED_TOKEN* pResolvedToken)
{
Agnostic_CORINFO_RESOLVED_TOKENin key;
- ZeroMemory(&key, sizeof(Agnostic_CORINFO_RESOLVED_TOKENin)); //We use the input structs as a key and use memcmp to compare.. so we need to zero out padding too
+ ZeroMemory(&key, sizeof(Agnostic_CORINFO_RESOLVED_TOKENin)); // We use the input structs as a key and use memcmp to
+ // compare.. so we need to zero out padding too
Agnostic_CORINFO_RESOLVED_TOKENout value;
key.tokenContext = (DWORDLONG)pResolvedToken->tokenContext;
- key.tokenScope = (DWORDLONG)pResolvedToken->tokenScope;
- key.token = (DWORD)pResolvedToken->token;
- key.tokenType = (DWORD)pResolvedToken->tokenType;
+ key.tokenScope = (DWORDLONG)pResolvedToken->tokenScope;
+ key.token = (DWORD)pResolvedToken->token;
+ key.tokenType = (DWORD)pResolvedToken->tokenType;
// Best-effort: if the `tryResolveToken` map is missing or the key is not found therein,
// fall back to the `resolveToken` map.
@@ -1334,181 +1401,198 @@ bool MethodContext::repTryResolveToken(CORINFO_RESOLVED_TOKEN * pResolvedToken)
value = ResolveToken->Get(key);
}
- pResolvedToken->hClass = (CORINFO_CLASS_HANDLE)value.hClass;
- pResolvedToken->hMethod = (CORINFO_METHOD_HANDLE)value.hMethod;
- pResolvedToken->hField = (CORINFO_FIELD_HANDLE)value.hField;
- pResolvedToken->pTypeSpec = (PCCOR_SIGNATURE)ResolveToken->GetBuffer(value.pTypeSpec_Index);
- pResolvedToken->cbTypeSpec = (ULONG)value.cbTypeSpec;
- pResolvedToken->pMethodSpec = (PCCOR_SIGNATURE)ResolveToken->GetBuffer(value.pMethodSpec_Index);
+ pResolvedToken->hClass = (CORINFO_CLASS_HANDLE)value.hClass;
+ pResolvedToken->hMethod = (CORINFO_METHOD_HANDLE)value.hMethod;
+ pResolvedToken->hField = (CORINFO_FIELD_HANDLE)value.hField;
+ pResolvedToken->pTypeSpec = (PCCOR_SIGNATURE)ResolveToken->GetBuffer(value.pTypeSpec_Index);
+ pResolvedToken->cbTypeSpec = (ULONG)value.cbTypeSpec;
+ pResolvedToken->pMethodSpec = (PCCOR_SIGNATURE)ResolveToken->GetBuffer(value.pMethodSpec_Index);
pResolvedToken->cbMethodSpec = (ULONG)value.cbMethodSpec;
DEBUG_REP(dmpTryResolveToken(key, value));
return (DWORD)value.exceptionCode == 0;
}
-void MethodContext::recGetCallInfo(
- CORINFO_RESOLVED_TOKEN *pResolvedToken,
- CORINFO_RESOLVED_TOKEN *pConstrainedResolvedToken,
- CORINFO_METHOD_HANDLE callerHandle,
- CORINFO_CALLINFO_FLAGS flags,
- CORINFO_CALL_INFO *pResult,
- DWORD exceptionCode)
+void MethodContext::recGetCallInfo(CORINFO_RESOLVED_TOKEN* pResolvedToken,
+ CORINFO_RESOLVED_TOKEN* pConstrainedResolvedToken,
+ CORINFO_METHOD_HANDLE callerHandle,
+ CORINFO_CALLINFO_FLAGS flags,
+ CORINFO_CALL_INFO* pResult,
+ DWORD exceptionCode)
{
if (GetCallInfo == nullptr)
GetCallInfo = new LightWeightMap<Agnostic_GetCallInfo, Agnostic_CORINFO_CALL_INFO>();
Agnostic_GetCallInfo key;
- ZeroMemory(&key, sizeof(Agnostic_GetCallInfo)); //We use the input structs as a key and use memcmp to compare.. so we need to zero out padding too
+ ZeroMemory(&key, sizeof(Agnostic_GetCallInfo)); // We use the input structs as a key and use memcmp to compare.. so
+ // we need to zero out padding too
Agnostic_CORINFO_CALL_INFO value;
key.ResolvedToken.tokenContext = (DWORDLONG)pResolvedToken->tokenContext;
- key.ResolvedToken.tokenScope = (DWORDLONG)pResolvedToken->tokenScope;
- key.ResolvedToken.token = (DWORD)pResolvedToken->token;
- key.ResolvedToken.tokenType = (DWORD)pResolvedToken->tokenType;
- key.ResolvedToken.hClass = (DWORDLONG)pResolvedToken->hClass;
- key.ResolvedToken.hMethod = (DWORDLONG)pResolvedToken->hMethod;
- key.ResolvedToken.hField = (DWORDLONG)pResolvedToken->hField;
- key.ResolvedToken.typeSpec_Index = (DWORD)GetCallInfo->AddBuffer((unsigned char*)pResolvedToken->pTypeSpec, pResolvedToken->cbTypeSpec);
+ key.ResolvedToken.tokenScope = (DWORDLONG)pResolvedToken->tokenScope;
+ key.ResolvedToken.token = (DWORD)pResolvedToken->token;
+ key.ResolvedToken.tokenType = (DWORD)pResolvedToken->tokenType;
+ key.ResolvedToken.hClass = (DWORDLONG)pResolvedToken->hClass;
+ key.ResolvedToken.hMethod = (DWORDLONG)pResolvedToken->hMethod;
+ key.ResolvedToken.hField = (DWORDLONG)pResolvedToken->hField;
+ key.ResolvedToken.typeSpec_Index =
+ (DWORD)GetCallInfo->AddBuffer((unsigned char*)pResolvedToken->pTypeSpec, pResolvedToken->cbTypeSpec);
key.ResolvedToken.cbTypeSpec = (DWORD)pResolvedToken->cbTypeSpec;
- key.ResolvedToken.methodSpec_Index = (DWORD)GetCallInfo->AddBuffer((unsigned char*)pResolvedToken->pMethodSpec, pResolvedToken->cbMethodSpec);
+ key.ResolvedToken.methodSpec_Index =
+ (DWORD)GetCallInfo->AddBuffer((unsigned char*)pResolvedToken->pMethodSpec, pResolvedToken->cbMethodSpec);
key.ResolvedToken.cbMethodSpec = (DWORD)pResolvedToken->cbMethodSpec;
if (pConstrainedResolvedToken != nullptr)
{
key.ConstrainedResolvedToken.tokenContext = (DWORDLONG)pConstrainedResolvedToken->tokenContext;
- key.ConstrainedResolvedToken.tokenScope = (DWORDLONG)pConstrainedResolvedToken->tokenScope;
- key.ConstrainedResolvedToken.token = (DWORD)pConstrainedResolvedToken->token;
- key.ConstrainedResolvedToken.tokenType = (DWORD)pConstrainedResolvedToken->tokenType;
- key.ConstrainedResolvedToken.hClass = (DWORDLONG)pConstrainedResolvedToken->hClass;
- key.ConstrainedResolvedToken.hMethod = (DWORDLONG)pConstrainedResolvedToken->hMethod;
- key.ConstrainedResolvedToken.hField = (DWORDLONG)pConstrainedResolvedToken->hField;
- key.ConstrainedResolvedToken.typeSpec_Index = (DWORD)GetCallInfo->AddBuffer((unsigned char*)pConstrainedResolvedToken->pTypeSpec, pConstrainedResolvedToken->cbTypeSpec);
+ key.ConstrainedResolvedToken.tokenScope = (DWORDLONG)pConstrainedResolvedToken->tokenScope;
+ key.ConstrainedResolvedToken.token = (DWORD)pConstrainedResolvedToken->token;
+ key.ConstrainedResolvedToken.tokenType = (DWORD)pConstrainedResolvedToken->tokenType;
+ key.ConstrainedResolvedToken.hClass = (DWORDLONG)pConstrainedResolvedToken->hClass;
+ key.ConstrainedResolvedToken.hMethod = (DWORDLONG)pConstrainedResolvedToken->hMethod;
+ key.ConstrainedResolvedToken.hField = (DWORDLONG)pConstrainedResolvedToken->hField;
+ key.ConstrainedResolvedToken.typeSpec_Index =
+ (DWORD)GetCallInfo->AddBuffer((unsigned char*)pConstrainedResolvedToken->pTypeSpec,
+ pConstrainedResolvedToken->cbTypeSpec);
key.ConstrainedResolvedToken.cbTypeSpec = (DWORD)pConstrainedResolvedToken->cbTypeSpec;
- key.ConstrainedResolvedToken.methodSpec_Index = (DWORD)GetCallInfo->AddBuffer((unsigned char*)pConstrainedResolvedToken->pMethodSpec, pConstrainedResolvedToken->cbMethodSpec);
+ key.ConstrainedResolvedToken.methodSpec_Index =
+ (DWORD)GetCallInfo->AddBuffer((unsigned char*)pConstrainedResolvedToken->pMethodSpec,
+ pConstrainedResolvedToken->cbMethodSpec);
key.ConstrainedResolvedToken.cbMethodSpec = (DWORD)pConstrainedResolvedToken->cbMethodSpec;
}
else
{
- key.ConstrainedResolvedToken.tokenContext = (DWORDLONG)0;
- key.ConstrainedResolvedToken.tokenScope = (DWORDLONG)0;
- key.ConstrainedResolvedToken.token = (DWORD)0;
- key.ConstrainedResolvedToken.tokenType = (DWORD)0;
- key.ConstrainedResolvedToken.hClass = (DWORDLONG)0;
- key.ConstrainedResolvedToken.hMethod = (DWORDLONG)0;
- key.ConstrainedResolvedToken.hField = (DWORDLONG)0;
- key.ConstrainedResolvedToken.typeSpec_Index = (DWORD)0;
- key.ConstrainedResolvedToken.cbTypeSpec = (DWORD)0;
+ key.ConstrainedResolvedToken.tokenContext = (DWORDLONG)0;
+ key.ConstrainedResolvedToken.tokenScope = (DWORDLONG)0;
+ key.ConstrainedResolvedToken.token = (DWORD)0;
+ key.ConstrainedResolvedToken.tokenType = (DWORD)0;
+ key.ConstrainedResolvedToken.hClass = (DWORDLONG)0;
+ key.ConstrainedResolvedToken.hMethod = (DWORDLONG)0;
+ key.ConstrainedResolvedToken.hField = (DWORDLONG)0;
+ key.ConstrainedResolvedToken.typeSpec_Index = (DWORD)0;
+ key.ConstrainedResolvedToken.cbTypeSpec = (DWORD)0;
key.ConstrainedResolvedToken.methodSpec_Index = (DWORD)0;
- key.ConstrainedResolvedToken.cbMethodSpec = (DWORD)0;
+ key.ConstrainedResolvedToken.cbMethodSpec = (DWORD)0;
}
key.callerHandle = (DWORDLONG)callerHandle;
- key.flags = (DWORD)flags;
+ key.flags = (DWORD)flags;
if (exceptionCode == 0)
{
- value.hMethod = (DWORDLONG)pResult->hMethod;
- value.methodFlags = (DWORD)pResult->methodFlags;
- value.classFlags = (DWORD)pResult->classFlags;
- value.sig.callConv = (DWORD)pResult->sig.callConv;
- value.sig.retTypeClass = (DWORDLONG)pResult->sig.retTypeClass;
- value.sig.retTypeSigClass = (DWORDLONG)pResult->sig.retTypeSigClass;
- value.sig.retType = (DWORD)pResult->sig.retType;
- value.sig.flags = (DWORD)pResult->sig.flags;
- value.sig.numArgs = (DWORD)pResult->sig.numArgs;
+ value.hMethod = (DWORDLONG)pResult->hMethod;
+ value.methodFlags = (DWORD)pResult->methodFlags;
+ value.classFlags = (DWORD)pResult->classFlags;
+ value.sig.callConv = (DWORD)pResult->sig.callConv;
+ value.sig.retTypeClass = (DWORDLONG)pResult->sig.retTypeClass;
+ value.sig.retTypeSigClass = (DWORDLONG)pResult->sig.retTypeSigClass;
+ value.sig.retType = (DWORD)pResult->sig.retType;
+ value.sig.flags = (DWORD)pResult->sig.flags;
+ value.sig.numArgs = (DWORD)pResult->sig.numArgs;
value.sig.sigInst_classInstCount = (DWORD)pResult->sig.sigInst.classInstCount;
- value.sig.sigInst_classInst_Index = GetCallInfo->AddBuffer((unsigned char*)pResult->sig.sigInst.classInst, pResult->sig.sigInst.classInstCount * 8); //porting issue
+ value.sig.sigInst_classInst_Index =
+ GetCallInfo->AddBuffer((unsigned char*)pResult->sig.sigInst.classInst,
+ pResult->sig.sigInst.classInstCount * 8); // porting issue
value.sig.sigInst_methInstCount = (DWORD)pResult->sig.sigInst.methInstCount;
- value.sig.sigInst_methInst_Index = GetCallInfo->AddBuffer((unsigned char*)pResult->sig.sigInst.methInst, pResult->sig.sigInst.methInstCount * 8); //porting issue
- value.sig.args = (DWORDLONG)pResult->sig.args;
+ value.sig.sigInst_methInst_Index =
+ GetCallInfo->AddBuffer((unsigned char*)pResult->sig.sigInst.methInst,
+ pResult->sig.sigInst.methInstCount * 8); // porting issue
+ value.sig.args = (DWORDLONG)pResult->sig.args;
value.sig.cbSig = (DWORD)pResult->sig.cbSig;
- value.sig.pSig = (DWORD)GetCallInfo->AddBuffer((unsigned char *)pResult->sig.pSig, pResult->sig.cbSig);
+ value.sig.pSig = (DWORD)GetCallInfo->AddBuffer((unsigned char*)pResult->sig.pSig, pResult->sig.cbSig);
value.sig.scope = (DWORDLONG)pResult->sig.scope;
value.sig.token = (DWORD)pResult->sig.token;
if (flags & CORINFO_CALLINFO_VERIFICATION)
{
- value.verMethodFlags = (DWORD)pResult->verMethodFlags;
- value.verSig.callConv = (DWORD)pResult->verSig.callConv;
- value.verSig.retTypeClass = (DWORDLONG)pResult->verSig.retTypeClass;
- value.verSig.retTypeSigClass = (DWORDLONG)pResult->verSig.retTypeSigClass;
- value.verSig.retType = (DWORD)pResult->verSig.retType;
- value.verSig.flags = (DWORD)pResult->verSig.flags;
- value.verSig.numArgs = (DWORD)pResult->verSig.numArgs;
+ value.verMethodFlags = (DWORD)pResult->verMethodFlags;
+ value.verSig.callConv = (DWORD)pResult->verSig.callConv;
+ value.verSig.retTypeClass = (DWORDLONG)pResult->verSig.retTypeClass;
+ value.verSig.retTypeSigClass = (DWORDLONG)pResult->verSig.retTypeSigClass;
+ value.verSig.retType = (DWORD)pResult->verSig.retType;
+ value.verSig.flags = (DWORD)pResult->verSig.flags;
+ value.verSig.numArgs = (DWORD)pResult->verSig.numArgs;
value.verSig.sigInst_classInstCount = (DWORD)pResult->verSig.sigInst.classInstCount;
- value.verSig.sigInst_classInst_Index = GetCallInfo->AddBuffer((unsigned char*)pResult->verSig.sigInst.classInst, pResult->verSig.sigInst.classInstCount * 8); //porting issue
+ value.verSig.sigInst_classInst_Index =
+ GetCallInfo->AddBuffer((unsigned char*)pResult->verSig.sigInst.classInst,
+ pResult->verSig.sigInst.classInstCount * 8); // porting issue
value.verSig.sigInst_methInstCount = (DWORD)pResult->verSig.sigInst.methInstCount;
- value.verSig.sigInst_methInst_Index = GetCallInfo->AddBuffer((unsigned char*)pResult->verSig.sigInst.methInst, pResult->verSig.sigInst.methInstCount * 8); //porting issue
- value.verSig.args = (DWORDLONG)pResult->verSig.args;
+ value.verSig.sigInst_methInst_Index =
+ GetCallInfo->AddBuffer((unsigned char*)pResult->verSig.sigInst.methInst,
+ pResult->verSig.sigInst.methInstCount * 8); // porting issue
+ value.verSig.args = (DWORDLONG)pResult->verSig.args;
value.verSig.cbSig = (DWORD)pResult->verSig.cbSig;
- value.verSig.pSig = (DWORD)GetCallInfo->AddBuffer((unsigned char *)pResult->verSig.pSig, pResult->verSig.cbSig);
+ value.verSig.pSig =
+ (DWORD)GetCallInfo->AddBuffer((unsigned char*)pResult->verSig.pSig, pResult->verSig.cbSig);
value.verSig.scope = (DWORDLONG)pResult->verSig.scope;
value.verSig.token = (DWORD)pResult->verSig.token;
}
else
{
- value.verMethodFlags = (DWORD)0;
- value.verSig.callConv = (DWORD)0;
- value.verSig.retTypeClass = (DWORDLONG)0;
- value.verSig.retTypeSigClass = (DWORDLONG)0;
- value.verSig.retType = (DWORD)0;
- value.verSig.flags = (DWORD)0;
- value.verSig.numArgs = (DWORD)0;
- value.verSig.sigInst_classInstCount = (DWORD)0;
+ value.verMethodFlags = (DWORD)0;
+ value.verSig.callConv = (DWORD)0;
+ value.verSig.retTypeClass = (DWORDLONG)0;
+ value.verSig.retTypeSigClass = (DWORDLONG)0;
+ value.verSig.retType = (DWORD)0;
+ value.verSig.flags = (DWORD)0;
+ value.verSig.numArgs = (DWORD)0;
+ value.verSig.sigInst_classInstCount = (DWORD)0;
value.verSig.sigInst_classInst_Index = (DWORD)0;
- value.verSig.sigInst_methInstCount = (DWORD)0;
- value.verSig.sigInst_methInst_Index = (DWORD)0;
- value.verSig.args = (DWORDLONG)0;
- value.verSig.cbSig = (DWORD)0;
- value.verSig.pSig = (DWORD)0;
- value.verSig.scope = (DWORDLONG)0;
- value.verSig.token = (DWORD)0;
+ value.verSig.sigInst_methInstCount = (DWORD)0;
+ value.verSig.sigInst_methInst_Index = (DWORD)0;
+ value.verSig.args = (DWORDLONG)0;
+ value.verSig.cbSig = (DWORD)0;
+ value.verSig.pSig = (DWORD)0;
+ value.verSig.scope = (DWORDLONG)0;
+ value.verSig.token = (DWORD)0;
}
- value.accessAllowed = (DWORD)pResult->accessAllowed;
+ value.accessAllowed = (DWORD)pResult->accessAllowed;
value.callsiteCalloutHelper.helperNum = (DWORD)pResult->callsiteCalloutHelper.helperNum;
- value.callsiteCalloutHelper.numArgs = (DWORD)pResult->callsiteCalloutHelper.numArgs;
+ value.callsiteCalloutHelper.numArgs = (DWORD)pResult->callsiteCalloutHelper.numArgs;
for (int i = 0; i < CORINFO_ACCESS_ALLOWED_MAX_ARGS; i++)
{
value.callsiteCalloutHelper.args[i].constant = (DWORDLONG)pResult->callsiteCalloutHelper.args[i].constant;
- value.callsiteCalloutHelper.args[i].argType = (DWORD)pResult->callsiteCalloutHelper.args[i].argType;
+ value.callsiteCalloutHelper.args[i].argType = (DWORD)pResult->callsiteCalloutHelper.args[i].argType;
}
value.thisTransform = (DWORD)pResult->thisTransform;
- value.kind = (DWORD)pResult->kind;
- value.nullInstanceCheck = (DWORD)pResult->nullInstanceCheck;
- value.contextHandle = (DWORDLONG)pResult->contextHandle;
- value.exactContextNeedsRuntimeLookup = (DWORD)pResult->exactContextNeedsRuntimeLookup;
+ value.kind = (DWORD)pResult->kind;
+ value.nullInstanceCheck = (DWORD)pResult->nullInstanceCheck;
+ value.contextHandle = (DWORDLONG)pResult->contextHandle;
+ value.exactContextNeedsRuntimeLookup = (DWORD)pResult->exactContextNeedsRuntimeLookup;
value.stubLookup.lookupKind.needsRuntimeLookup = (DWORD)pResult->stubLookup.lookupKind.needsRuntimeLookup;
- value.stubLookup.lookupKind.runtimeLookupKind = (DWORD)pResult->stubLookup.lookupKind.runtimeLookupKind;
+ value.stubLookup.lookupKind.runtimeLookupKind = (DWORD)pResult->stubLookup.lookupKind.runtimeLookupKind;
if (pResult->stubLookup.lookupKind.needsRuntimeLookup)
{
value.stubLookup.constLookup.accessType = (DWORD)0;
- value.stubLookup.constLookup.handle = (DWORDLONG)0;
+ value.stubLookup.constLookup.handle = (DWORDLONG)0;
- value.stubLookup.runtimeLookup.signature = (DWORDLONG)pResult->stubLookup.runtimeLookup.signature; // needs to be a more flexible copy based on value
- value.stubLookup.runtimeLookup.helper = (DWORD)pResult->stubLookup.runtimeLookup.helper;
+ value.stubLookup.runtimeLookup.signature =
+ (DWORDLONG)pResult->stubLookup.runtimeLookup.signature; // needs to be a more flexible copy based on
+ // value
+ value.stubLookup.runtimeLookup.helper = (DWORD)pResult->stubLookup.runtimeLookup.helper;
value.stubLookup.runtimeLookup.indirections = (DWORD)pResult->stubLookup.runtimeLookup.indirections;
- value.stubLookup.runtimeLookup.testForNull = (DWORD)pResult->stubLookup.runtimeLookup.testForNull;
+ value.stubLookup.runtimeLookup.testForNull = (DWORD)pResult->stubLookup.runtimeLookup.testForNull;
value.stubLookup.runtimeLookup.testForFixup = (DWORD)pResult->stubLookup.runtimeLookup.testForFixup;
- for (int i = 0; i < CORINFO_MAXINDIRECTIONS; i++)
+ for (int i = 0; i < CORINFO_MAXINDIRECTIONS; i++)
value.stubLookup.runtimeLookup.offsets[i] = (DWORDLONG)pResult->stubLookup.runtimeLookup.offsets[i];
}
else
{
- value.stubLookup.runtimeLookup.signature = (DWORDLONG)0;
- value.stubLookup.runtimeLookup.helper = (DWORD)0;
+ value.stubLookup.runtimeLookup.signature = (DWORDLONG)0;
+ value.stubLookup.runtimeLookup.helper = (DWORD)0;
value.stubLookup.runtimeLookup.indirections = (DWORD)0;
- value.stubLookup.runtimeLookup.testForNull = (DWORD)0;
+ value.stubLookup.runtimeLookup.testForNull = (DWORD)0;
value.stubLookup.runtimeLookup.testForFixup = (DWORD)0;
- for (int i = 0; i < CORINFO_MAXINDIRECTIONS; i++)
+ for (int i = 0; i < CORINFO_MAXINDIRECTIONS; i++)
value.stubLookup.runtimeLookup.offsets[i] = (DWORDLONG)0;
value.stubLookup.constLookup.accessType = (DWORD)pResult->stubLookup.constLookup.accessType;
- value.stubLookup.constLookup.handle = (DWORDLONG)pResult->stubLookup.constLookup.handle;
+ value.stubLookup.constLookup.handle = (DWORDLONG)pResult->stubLookup.constLookup.handle;
}
value.instParamLookup.accessType = (DWORD)pResult->instParamLookup.accessType;
- value.instParamLookup.handle = (DWORDLONG)pResult->instParamLookup.handle;
- value.secureDelegateInvoke = (DWORD)pResult->secureDelegateInvoke;
+ value.instParamLookup.handle = (DWORDLONG)pResult->instParamLookup.handle;
+ value.secureDelegateInvoke = (DWORD)pResult->secureDelegateInvoke;
}
else
ZeroMemory(&value, sizeof(Agnostic_CORINFO_CALL_INFO));
@@ -1520,197 +1604,180 @@ void MethodContext::recGetCallInfo(
void MethodContext::dmpGetCallInfo(const Agnostic_GetCallInfo& key, const Agnostic_CORINFO_CALL_INFO& value)
{
printf("GetCallInfo key"
- " rt{tc-%016llX ts-%016llX tok-%08X tt-%u cls-%016llX meth-%016llX fld-%016llX ti-%u ts-%u mi-%u ms-%u}"
+ " rt{tc-%016llX ts-%016llX tok-%08X tt-%u cls-%016llX meth-%016llX fld-%016llX ti-%u ts-%u mi-%u ms-%u}"
" crt{tc-%016llX ts-%016llX tok-%08X tt-%u cls-%016llX meth-%016llX fld-%016llX ti-%u ts-%u mi-%u ms-%u}"
" ch-%016llX flg-%08X",
- key.ResolvedToken.tokenContext,
- key.ResolvedToken.tokenScope,
- key.ResolvedToken.token,
- key.ResolvedToken.tokenType,
- key.ResolvedToken.hClass,
- key.ResolvedToken.hMethod,
- key.ResolvedToken.hField,
- key.ResolvedToken.typeSpec_Index,
- key.ResolvedToken.cbTypeSpec,
- key.ResolvedToken.methodSpec_Index,
- key.ResolvedToken.cbMethodSpec,
- key.ConstrainedResolvedToken.tokenContext,
- key.ConstrainedResolvedToken.tokenScope,
- key.ConstrainedResolvedToken.token,
- key.ConstrainedResolvedToken.tokenType,
- key.ConstrainedResolvedToken.hClass,
- key.ConstrainedResolvedToken.hMethod,
- key.ConstrainedResolvedToken.hField,
- key.ConstrainedResolvedToken.typeSpec_Index,
- key.ConstrainedResolvedToken.cbTypeSpec,
- key.ConstrainedResolvedToken.methodSpec_Index,
- key.ConstrainedResolvedToken.cbMethodSpec,
- key.callerHandle,
- key.flags);
+ key.ResolvedToken.tokenContext, key.ResolvedToken.tokenScope, key.ResolvedToken.token,
+ key.ResolvedToken.tokenType, key.ResolvedToken.hClass, key.ResolvedToken.hMethod, key.ResolvedToken.hField,
+ key.ResolvedToken.typeSpec_Index, key.ResolvedToken.cbTypeSpec, key.ResolvedToken.methodSpec_Index,
+ key.ResolvedToken.cbMethodSpec, key.ConstrainedResolvedToken.tokenContext,
+ key.ConstrainedResolvedToken.tokenScope, key.ConstrainedResolvedToken.token,
+ key.ConstrainedResolvedToken.tokenType, key.ConstrainedResolvedToken.hClass,
+ key.ConstrainedResolvedToken.hMethod, key.ConstrainedResolvedToken.hField,
+ key.ConstrainedResolvedToken.typeSpec_Index, key.ConstrainedResolvedToken.cbTypeSpec,
+ key.ConstrainedResolvedToken.methodSpec_Index, key.ConstrainedResolvedToken.cbMethodSpec, key.callerHandle,
+ key.flags);
printf(", value mth-%016llX, mf-%08X cf-%08X"
- " sig{flg-%08X na-%u cc-%u ci-%u mc-%u mi-%u args-%016llX scp-%016llX tok-%08X}"
+ " sig{flg-%08X na-%u cc-%u ci-%u mc-%u mi-%u args-%016llX scp-%016llX tok-%08X}"
" vsig{flg-%08X na-%u cc-%u ci-%u mc-%u mi-%u args-%016llX scp-%016llX tok-%08X}"
" ipl{at-%08X hnd-%016llX}"
" sdi-%08X"
" excp-%08X",
- value.hMethod,
- value.methodFlags,
- value.classFlags,
- value.sig.flags,
- value.sig.numArgs,
- value.sig.sigInst_classInstCount,
- value.sig.sigInst_classInst_Index,
- value.sig.sigInst_methInstCount,
- value.sig.sigInst_methInst_Index,
- value.sig.args,
- value.sig.scope,
- value.sig.token,
- value.verSig.flags,
- value.verSig.numArgs,
- value.verSig.sigInst_classInstCount,
- value.verSig.sigInst_classInst_Index,
- value.verSig.sigInst_methInstCount,
- value.verSig.sigInst_methInst_Index,
- value.verSig.args,
- value.verSig.scope,
- value.verSig.token,
- value.instParamLookup.accessType,
- value.instParamLookup.handle,
- value.secureDelegateInvoke,
- value.exceptionCode);
-}
-void MethodContext::repGetCallInfo(
- CORINFO_RESOLVED_TOKEN *pResolvedToken,
- CORINFO_RESOLVED_TOKEN *pConstrainedResolvedToken,
- CORINFO_METHOD_HANDLE callerHandle,
- CORINFO_CALLINFO_FLAGS flags,
- CORINFO_CALL_INFO *pResult,
- DWORD *exceptionCode)
+ value.hMethod, value.methodFlags, value.classFlags, value.sig.flags, value.sig.numArgs,
+ value.sig.sigInst_classInstCount, value.sig.sigInst_classInst_Index, value.sig.sigInst_methInstCount,
+ value.sig.sigInst_methInst_Index, value.sig.args, value.sig.scope, value.sig.token, value.verSig.flags,
+ value.verSig.numArgs, value.verSig.sigInst_classInstCount, value.verSig.sigInst_classInst_Index,
+ value.verSig.sigInst_methInstCount, value.verSig.sigInst_methInst_Index, value.verSig.args,
+ value.verSig.scope, value.verSig.token, value.instParamLookup.accessType, value.instParamLookup.handle,
+ value.secureDelegateInvoke, value.exceptionCode);
+}
+void MethodContext::repGetCallInfo(CORINFO_RESOLVED_TOKEN* pResolvedToken,
+ CORINFO_RESOLVED_TOKEN* pConstrainedResolvedToken,
+ CORINFO_METHOD_HANDLE callerHandle,
+ CORINFO_CALLINFO_FLAGS flags,
+ CORINFO_CALL_INFO* pResult,
+ DWORD* exceptionCode)
{
Agnostic_GetCallInfo key;
- ZeroMemory(&key, sizeof(Agnostic_GetCallInfo)); //We use the input structs as a key and use memcmp to compare.. so we need to zero out padding too
+ ZeroMemory(&key, sizeof(Agnostic_GetCallInfo)); // We use the input structs as a key and use memcmp to compare.. so
+ // we need to zero out padding too
Agnostic_CORINFO_CALL_INFO value;
key.ResolvedToken.tokenContext = (DWORDLONG)pResolvedToken->tokenContext;
- key.ResolvedToken.tokenScope = (DWORDLONG)pResolvedToken->tokenScope;
- key.ResolvedToken.token = (DWORD)pResolvedToken->token;
- key.ResolvedToken.tokenType = (DWORD)pResolvedToken->tokenType;
- key.ResolvedToken.hClass = (DWORDLONG)pResolvedToken->hClass;
- key.ResolvedToken.hMethod = (DWORDLONG)pResolvedToken->hMethod;
- key.ResolvedToken.hField = (DWORDLONG)pResolvedToken->hField;
- key.ResolvedToken.typeSpec_Index = (DWORD)GetCallInfo->Contains((unsigned char *)pResolvedToken->pTypeSpec, pResolvedToken->cbTypeSpec);
+ key.ResolvedToken.tokenScope = (DWORDLONG)pResolvedToken->tokenScope;
+ key.ResolvedToken.token = (DWORD)pResolvedToken->token;
+ key.ResolvedToken.tokenType = (DWORD)pResolvedToken->tokenType;
+ key.ResolvedToken.hClass = (DWORDLONG)pResolvedToken->hClass;
+ key.ResolvedToken.hMethod = (DWORDLONG)pResolvedToken->hMethod;
+ key.ResolvedToken.hField = (DWORDLONG)pResolvedToken->hField;
+ key.ResolvedToken.typeSpec_Index =
+ (DWORD)GetCallInfo->Contains((unsigned char*)pResolvedToken->pTypeSpec, pResolvedToken->cbTypeSpec);
key.ResolvedToken.cbTypeSpec = (DWORD)pResolvedToken->cbTypeSpec;
- key.ResolvedToken.methodSpec_Index = (DWORD)GetCallInfo->Contains((unsigned char *)pResolvedToken->pMethodSpec, pResolvedToken->cbMethodSpec);
+ key.ResolvedToken.methodSpec_Index =
+ (DWORD)GetCallInfo->Contains((unsigned char*)pResolvedToken->pMethodSpec, pResolvedToken->cbMethodSpec);
key.ResolvedToken.cbMethodSpec = (DWORD)pResolvedToken->cbMethodSpec;
if (pConstrainedResolvedToken != nullptr)
{
key.ConstrainedResolvedToken.tokenContext = (DWORDLONG)pConstrainedResolvedToken->tokenContext;
- key.ConstrainedResolvedToken.tokenScope = (DWORDLONG)pConstrainedResolvedToken->tokenScope;
- key.ConstrainedResolvedToken.token = (DWORD)pConstrainedResolvedToken->token;
- key.ConstrainedResolvedToken.tokenType = (DWORD)pConstrainedResolvedToken->tokenType;
- key.ConstrainedResolvedToken.hClass = (DWORDLONG)pConstrainedResolvedToken->hClass;
- key.ConstrainedResolvedToken.hMethod = (DWORDLONG)pConstrainedResolvedToken->hMethod;
- key.ConstrainedResolvedToken.hField = (DWORDLONG)pConstrainedResolvedToken->hField;
- key.ConstrainedResolvedToken.typeSpec_Index = (DWORD)GetCallInfo->Contains((unsigned char *)pConstrainedResolvedToken->pTypeSpec, pConstrainedResolvedToken->cbTypeSpec);
+ key.ConstrainedResolvedToken.tokenScope = (DWORDLONG)pConstrainedResolvedToken->tokenScope;
+ key.ConstrainedResolvedToken.token = (DWORD)pConstrainedResolvedToken->token;
+ key.ConstrainedResolvedToken.tokenType = (DWORD)pConstrainedResolvedToken->tokenType;
+ key.ConstrainedResolvedToken.hClass = (DWORDLONG)pConstrainedResolvedToken->hClass;
+ key.ConstrainedResolvedToken.hMethod = (DWORDLONG)pConstrainedResolvedToken->hMethod;
+ key.ConstrainedResolvedToken.hField = (DWORDLONG)pConstrainedResolvedToken->hField;
+ key.ConstrainedResolvedToken.typeSpec_Index =
+ (DWORD)GetCallInfo->Contains((unsigned char*)pConstrainedResolvedToken->pTypeSpec,
+ pConstrainedResolvedToken->cbTypeSpec);
key.ConstrainedResolvedToken.cbTypeSpec = (DWORD)pConstrainedResolvedToken->cbTypeSpec;
- key.ConstrainedResolvedToken.methodSpec_Index = (DWORD)GetCallInfo->Contains((unsigned char *)pConstrainedResolvedToken->pMethodSpec, pConstrainedResolvedToken->cbMethodSpec);
+ key.ConstrainedResolvedToken.methodSpec_Index =
+ (DWORD)GetCallInfo->Contains((unsigned char*)pConstrainedResolvedToken->pMethodSpec,
+ pConstrainedResolvedToken->cbMethodSpec);
key.ConstrainedResolvedToken.cbMethodSpec = (DWORD)pConstrainedResolvedToken->cbMethodSpec;
}
else
{
- key.ConstrainedResolvedToken.tokenContext = (DWORDLONG)0;
- key.ConstrainedResolvedToken.tokenScope = (DWORDLONG)0;
- key.ConstrainedResolvedToken.token = (DWORD)0;
- key.ConstrainedResolvedToken.tokenType = (DWORD)0;
- key.ConstrainedResolvedToken.hClass = (DWORDLONG)0;
- key.ConstrainedResolvedToken.hMethod = (DWORDLONG)0;
- key.ConstrainedResolvedToken.hField = (DWORDLONG)0;
- key.ConstrainedResolvedToken.typeSpec_Index = (DWORD)0;
- key.ConstrainedResolvedToken.cbTypeSpec = (DWORD)0;
+ key.ConstrainedResolvedToken.tokenContext = (DWORDLONG)0;
+ key.ConstrainedResolvedToken.tokenScope = (DWORDLONG)0;
+ key.ConstrainedResolvedToken.token = (DWORD)0;
+ key.ConstrainedResolvedToken.tokenType = (DWORD)0;
+ key.ConstrainedResolvedToken.hClass = (DWORDLONG)0;
+ key.ConstrainedResolvedToken.hMethod = (DWORDLONG)0;
+ key.ConstrainedResolvedToken.hField = (DWORDLONG)0;
+ key.ConstrainedResolvedToken.typeSpec_Index = (DWORD)0;
+ key.ConstrainedResolvedToken.cbTypeSpec = (DWORD)0;
key.ConstrainedResolvedToken.methodSpec_Index = (DWORD)0;
- key.ConstrainedResolvedToken.cbMethodSpec = (DWORD)0;
+ key.ConstrainedResolvedToken.cbMethodSpec = (DWORD)0;
}
key.callerHandle = (DWORDLONG)callerHandle;
- key.flags = (DWORD)flags;
+ key.flags = (DWORD)flags;
- AssertCodeMsg(GetCallInfo->GetIndex(key) != -1, EXCEPTIONCODE_MC, "Didn't find %08x, %016llx. Probably a missing exception in GetCallInfo", key.ResolvedToken.token, key.ResolvedToken.hClass);
+ AssertCodeMsg(GetCallInfo->GetIndex(key) != -1, EXCEPTIONCODE_MC,
+ "Didn't find %08x, %016llx. Probably a missing exception in GetCallInfo", key.ResolvedToken.token,
+ key.ResolvedToken.hClass);
value = GetCallInfo->Get(key);
- pResult->hMethod = (CORINFO_METHOD_HANDLE)value.hMethod;
- pResult->methodFlags = (unsigned)value.methodFlags;
- pResult->classFlags = (unsigned)value.classFlags;
- pResult->sig.callConv = (CorInfoCallConv)value.sig.callConv;
- pResult->sig.retTypeClass = (CORINFO_CLASS_HANDLE)value.sig.retTypeClass;
- pResult->sig.retTypeSigClass = (CORINFO_CLASS_HANDLE)value.sig.retTypeSigClass;
- pResult->sig.retType = (CorInfoType)value.sig.retType;
- pResult->sig.flags = (unsigned)value.sig.flags;
- pResult->sig.numArgs = (unsigned)value.sig.numArgs;
+ pResult->hMethod = (CORINFO_METHOD_HANDLE)value.hMethod;
+ pResult->methodFlags = (unsigned)value.methodFlags;
+ pResult->classFlags = (unsigned)value.classFlags;
+ pResult->sig.callConv = (CorInfoCallConv)value.sig.callConv;
+ pResult->sig.retTypeClass = (CORINFO_CLASS_HANDLE)value.sig.retTypeClass;
+ pResult->sig.retTypeSigClass = (CORINFO_CLASS_HANDLE)value.sig.retTypeSigClass;
+ pResult->sig.retType = (CorInfoType)value.sig.retType;
+ pResult->sig.flags = (unsigned)value.sig.flags;
+ pResult->sig.numArgs = (unsigned)value.sig.numArgs;
pResult->sig.sigInst.classInstCount = (unsigned)value.sig.sigInst_classInstCount;
pResult->sig.sigInst.classInst = (CORINFO_CLASS_HANDLE*)GetCallInfo->GetBuffer(value.sig.sigInst_classInst_Index);
pResult->sig.sigInst.methInstCount = (unsigned)value.sig.sigInst_methInstCount;
pResult->sig.sigInst.methInst = (CORINFO_CLASS_HANDLE*)GetCallInfo->GetBuffer(value.sig.sigInst_methInst_Index);
- pResult->sig.args = (CORINFO_ARG_LIST_HANDLE)value.sig.args;
- pResult->sig.cbSig = (unsigned int)value.sig.cbSig;
- pResult->sig.pSig = (PCCOR_SIGNATURE)GetCallInfo->GetBuffer(value.sig.pSig);
- pResult->sig.scope = (CORINFO_MODULE_HANDLE)value.sig.scope;
- pResult->sig.token = (mdToken)value.sig.token;
+ pResult->sig.args = (CORINFO_ARG_LIST_HANDLE)value.sig.args;
+ pResult->sig.cbSig = (unsigned int)value.sig.cbSig;
+ pResult->sig.pSig = (PCCOR_SIGNATURE)GetCallInfo->GetBuffer(value.sig.pSig);
+ pResult->sig.scope = (CORINFO_MODULE_HANDLE)value.sig.scope;
+ pResult->sig.token = (mdToken)value.sig.token;
if (flags & CORINFO_CALLINFO_VERIFICATION)
{
- pResult->verMethodFlags = (unsigned)value.verMethodFlags;
- pResult->verSig.callConv = (CorInfoCallConv)value.verSig.callConv;
- pResult->verSig.retTypeClass = (CORINFO_CLASS_HANDLE)value.verSig.retTypeClass;
- pResult->verSig.retTypeSigClass = (CORINFO_CLASS_HANDLE)value.verSig.retTypeSigClass;
- pResult->verSig.retType = (CorInfoType)value.verSig.retType;
- pResult->verSig.flags = (unsigned)value.verSig.flags;
- pResult->verSig.numArgs = (unsigned)value.verSig.numArgs;
+ pResult->verMethodFlags = (unsigned)value.verMethodFlags;
+ pResult->verSig.callConv = (CorInfoCallConv)value.verSig.callConv;
+ pResult->verSig.retTypeClass = (CORINFO_CLASS_HANDLE)value.verSig.retTypeClass;
+ pResult->verSig.retTypeSigClass = (CORINFO_CLASS_HANDLE)value.verSig.retTypeSigClass;
+ pResult->verSig.retType = (CorInfoType)value.verSig.retType;
+ pResult->verSig.flags = (unsigned)value.verSig.flags;
+ pResult->verSig.numArgs = (unsigned)value.verSig.numArgs;
pResult->verSig.sigInst.classInstCount = (unsigned)value.verSig.sigInst_classInstCount;
- pResult->verSig.sigInst.classInst = (CORINFO_CLASS_HANDLE*)GetCallInfo->GetBuffer(value.verSig.sigInst_classInst_Index);
+ pResult->verSig.sigInst.classInst =
+ (CORINFO_CLASS_HANDLE*)GetCallInfo->GetBuffer(value.verSig.sigInst_classInst_Index);
pResult->verSig.sigInst.methInstCount = (unsigned)value.verSig.sigInst_methInstCount;
- pResult->verSig.sigInst.methInst = (CORINFO_CLASS_HANDLE*)GetCallInfo->GetBuffer(value.verSig.sigInst_methInst_Index);
- pResult->verSig.args = (CORINFO_ARG_LIST_HANDLE)value.verSig.args;
+ pResult->verSig.sigInst.methInst =
+ (CORINFO_CLASS_HANDLE*)GetCallInfo->GetBuffer(value.verSig.sigInst_methInst_Index);
+ pResult->verSig.args = (CORINFO_ARG_LIST_HANDLE)value.verSig.args;
pResult->verSig.cbSig = (unsigned int)value.verSig.cbSig;
- pResult->verSig.pSig = (PCCOR_SIGNATURE)GetCallInfo->GetBuffer(value.verSig.pSig);
+ pResult->verSig.pSig = (PCCOR_SIGNATURE)GetCallInfo->GetBuffer(value.verSig.pSig);
pResult->verSig.scope = (CORINFO_MODULE_HANDLE)value.verSig.scope;
pResult->verSig.token = (mdToken)value.verSig.token;
}
- pResult->accessAllowed = (CorInfoIsAccessAllowedResult)value.accessAllowed;
+ pResult->accessAllowed = (CorInfoIsAccessAllowedResult)value.accessAllowed;
pResult->callsiteCalloutHelper.helperNum = (CorInfoHelpFunc)value.callsiteCalloutHelper.helperNum;
- pResult->callsiteCalloutHelper.numArgs = (unsigned)value.callsiteCalloutHelper.numArgs;
+ pResult->callsiteCalloutHelper.numArgs = (unsigned)value.callsiteCalloutHelper.numArgs;
for (int i = 0; i < CORINFO_ACCESS_ALLOWED_MAX_ARGS; i++)
{
pResult->callsiteCalloutHelper.args[i].constant = (size_t)value.callsiteCalloutHelper.args[i].constant;
- pResult->callsiteCalloutHelper.args[i].argType = (CorInfoAccessAllowedHelperArgType)value.callsiteCalloutHelper.args[i].argType;
+ pResult->callsiteCalloutHelper.args[i].argType =
+ (CorInfoAccessAllowedHelperArgType)value.callsiteCalloutHelper.args[i].argType;
}
- pResult->thisTransform = (CORINFO_THIS_TRANSFORM)value.thisTransform;
- pResult->kind = (CORINFO_CALL_KIND)value.kind;
- pResult->nullInstanceCheck = (BOOL)value.nullInstanceCheck;
- pResult->contextHandle = (CORINFO_CONTEXT_HANDLE)value.contextHandle;
- pResult->exactContextNeedsRuntimeLookup = (BOOL)value.exactContextNeedsRuntimeLookup;
+ pResult->thisTransform = (CORINFO_THIS_TRANSFORM)value.thisTransform;
+ pResult->kind = (CORINFO_CALL_KIND)value.kind;
+ pResult->nullInstanceCheck = (BOOL)value.nullInstanceCheck;
+ pResult->contextHandle = (CORINFO_CONTEXT_HANDLE)value.contextHandle;
+ pRe