summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiyoung Yun <jy910.yun@samsung.com>2017-04-27 16:54:50 +0900
committerJiyoung Yun <jy910.yun@samsung.com>2017-04-27 16:54:50 +0900
commit5b975f8233e8c8d17b215372f89ca713b45d6a0b (patch)
tree0267bcc331458a01f4c26fafd28110a72273beb3
parenta56e30c8d33048216567753d9d3fefc2152af8ac (diff)
downloadcoreclr-5b975f8233e8c8d17b215372f89ca713b45d6a0b.tar.gz
coreclr-5b975f8233e8c8d17b215372f89ca713b45d6a0b.tar.bz2
coreclr-5b975f8233e8c8d17b215372f89ca713b45d6a0b.zip
Imported Upstream version 2.0.0.11599upstream/2.0.0.11599
-rw-r--r--CMakeLists.txt15
-rw-r--r--Documentation/botr/README.md1
-rw-r--r--Documentation/botr/clr-abi.md2
-rw-r--r--Documentation/botr/xplat-minidump-generation.md80
-rw-r--r--Documentation/building/linux-instructions.md14
-rw-r--r--Documentation/building/viewing-jit-dumps.md166
-rw-r--r--Documentation/building/windows-instructions.md2
-rw-r--r--Documentation/project-docs/contributing-workflow.md2
-rw-r--r--Linkedbin0 -> 534016 bytes
-rw-r--r--README.md4
-rw-r--r--Tools-Override/codeOptimization.targets118
-rw-r--r--build-test.cmd113
-rw-r--r--build.cmd5
-rwxr-xr-xbuild.sh24
-rw-r--r--buildpipeline/Dotnet-CoreClr-Trusted-BuildTests.json10
-rw-r--r--buildpipeline/pipelines.json88
-rw-r--r--clrdefinitions.cmake18
-rw-r--r--clrfeatures.cmake27
-rw-r--r--config.json28
-rw-r--r--cross/x86/tryrun.cmake2
-rw-r--r--dependencies.props8
-rw-r--r--dir.props2
-rwxr-xr-xnetci.groovy7
-rw-r--r--perf.groovy6
-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
-rw-r--r--tests/arm64/Tests.lst2
-rw-r--r--tests/helixprep.proj41
-rw-r--r--tests/issues.targets17
-rw-r--r--tests/publishdependency.targets78
-rw-r--r--tests/runtest.proj19
-rwxr-xr-xtests/scripts/arm32_ci_script.sh2
-rwxr-xr-xtests/scripts/arm32_ci_test.sh7
-rw-r--r--tests/scripts/run-xunit-perf.cmd497
-rwxr-xr-xtests/scripts/x86_ci_script.sh4
-rw-r--r--tests/src/Common/PerfHarness/project.json2
-rw-r--r--tests/src/Common/build_against_pkg_dependencies/project.json13
-rw-r--r--tests/src/Common/external/external.depproj7
-rw-r--r--tests/src/Common/external/project.json10
-rw-r--r--tests/src/Common/netcoreapp/project.json2
-rw-r--r--tests/src/Common/targeting_pack_ref/project.json2
-rw-r--r--tests/src/Common/test_dependencies/project.json12
-rw-r--r--tests/src/Common/test_runtime/project.json8
-rw-r--r--tests/src/CoreMangLib/cti/system/delegate/delegateequals1.csbin23538 -> 11651 bytes
-rw-r--r--tests/src/CoreMangLib/cti/system/delegate/delegategethashcode1.csbin25374 -> 12561 bytes
-rw-r--r--tests/src/CoreMangLib/cti/system/delegate/delegategetinvocationlist1.csbin19234 -> 9593 bytes
-rw-r--r--tests/src/CoreMangLib/cti/system/delegate/delegateremove.csbin27380 -> 13569 bytes
-rw-r--r--tests/src/CoreMangLib/cti/system/delegate/delegateremoveimpl.csbin23370 -> 11598 bytes
-rw-r--r--tests/src/GC/API/GC/GetGenerationWR2.csproj2
-rw-r--r--tests/src/GC/Stress/Framework/ReliabilityConfiguration.cs21
-rw-r--r--tests/src/GC/Stress/Framework/ReliabilityFramework.cs107
-rw-r--r--[-rwxr-xr-x]tests/src/Interop/StringMarshalling/LPSTR/CMakeLists.txt2
-rw-r--r--[-rwxr-xr-x]tests/src/Interop/StringMarshalling/LPSTR/LPSTRTest.csbin17120 -> 8341 bytes
-rw-r--r--[-rwxr-xr-x]tests/src/Interop/StringMarshalling/LPSTR/LPSTRTest.csproj2
-rw-r--r--[-rwxr-xr-x]tests/src/Interop/StringMarshalling/LPSTR/LPSTRTestNative.cpp0
-rw-r--r--[-rwxr-xr-x]tests/src/Interop/StringMarshalling/LPSTR/PinvokeDef.cs2
-rw-r--r--[-rwxr-xr-x]tests/src/Interop/StringMarshalling/LPTSTR/CMakeLists.txt0
-rw-r--r--[-rwxr-xr-x]tests/src/Interop/StringMarshalling/LPTSTR/LPTSTRTest.csbin17934 -> 17934 bytes
-rw-r--r--[-rwxr-xr-x]tests/src/Interop/StringMarshalling/LPTSTR/LPTSTRTestNative.cpp46
-rw-r--r--[-rwxr-xr-x]tests/src/Interop/StringMarshalling/LPTSTR/LPTSTRTestPInvokeDef.cs0
-rw-r--r--tests/src/Interop/common/xplatform.h4
-rw-r--r--tests/src/JIT/CheckProjects/CheckProjects.cs10
-rw-r--r--tests/src/JIT/Directed/pinvoke/calli_excep.il4
-rw-r--r--tests/src/JIT/Performance/CodeQuality/Span/Indexer.cs1021
-rw-r--r--tests/src/JIT/Performance/CodeQuality/Span/Indexer.csproj44
-rw-r--r--tests/src/JIT/Performance/RunBenchmarks/RunBenchmarks.cs186
-rw-r--r--tests/src/JIT/Regression/JitBlue/DevDiv_397793/DevDiv_397793.il147
-rw-r--r--tests/src/JIT/Regression/JitBlue/DevDiv_397793/DevDiv_397793.ilproj34
-rw-r--r--tests/src/JIT/Regression/JitBlue/DevDiv_406160/DevDiv_406160.il83
-rw-r--r--tests/src/JIT/Regression/JitBlue/DevDiv_406160/DevDiv_406160.ilproj37
-rw-r--r--tests/src/JIT/Regression/JitBlue/GitHub_10940/GitHub_10940.cs58
-rw-r--r--tests/src/JIT/Regression/JitBlue/GitHub_10940/GitHub_10940.csproj42
-rw-r--r--tests/src/JIT/config/benchmark+roslyn/project.json14
-rw-r--r--tests/src/JIT/config/benchmark+serialize/project.json12
-rw-r--r--tests/src/JIT/config/benchmark/project.json19
-rw-r--r--tests/src/JIT/jit64/hfa/main/dll/hfa_native.h305
-rw-r--r--tests/src/Loader/classloader/methodoverriding/regressions/549411/exploit.csproj1
-rw-r--r--tests/src/NuGet.Config2
-rw-r--r--tests/src/Regressions/coreclr/GitHub_7685/test7685.cs191
-rw-r--r--tests/src/TestWrappersConfig/project.json2
-rw-r--r--tests/src/baseservices/multidimmarray/rank1array.il160
-rw-r--r--tests/src/baseservices/multidimmarray/rank1array.ilproj31
-rw-r--r--tests/src/performance/linkbench/assets/MusicStore/MusicStoreReflection.xml27
-rw-r--r--tests/src/performance/linkbench/assets/Roslyn/RoslynRoots.txt3
-rw-r--r--tests/src/performance/linkbench/assets/Roslyn/RoslynRoots.xml5
-rw-r--r--tests/src/performance/linkbench/assets/Roslyn/illinkcsproj9
-rw-r--r--tests/src/performance/linkbench/linkbench.cs372
-rw-r--r--tests/src/performance/linkbench/linkbench.csproj41
-rw-r--r--tests/src/performance/linkbench/scripts/build.cmd116
-rw-r--r--tests/src/performance/linkbench/scripts/clone.cmd30
-rw-r--r--tests/src/performance/linkbench/scripts/empty.cmd1
-rw-r--r--tests/src/performance/linkbench/scripts/getcert.cmd2
-rw-r--r--tests/src/performance/project.json17
-rw-r--r--tests/src/readytorun/tests/fieldgetter.il (renamed from tests/src/readytorun/fieldgetter.il)0
-rw-r--r--tests/src/readytorun/tests/fieldgetter.ilproj (renamed from tests/src/readytorun/fieldgetter.ilproj)0
-rw-r--r--tests/src/readytorun/tests/generics.cs (renamed from tests/src/readytorun/generics.cs)0
-rw-r--r--tests/src/readytorun/tests/generics.csproj (renamed from tests/src/readytorun/generics.csproj)0
-rw-r--r--tests/src/readytorun/tests/genericsload/callgenericctor.cs (renamed from tests/src/readytorun/genericsload/callgenericctor.cs)0
-rw-r--r--tests/src/readytorun/tests/genericsload/callgenericctor.csproj (renamed from tests/src/readytorun/genericsload/callgenericctor.csproj)0
-rw-r--r--tests/src/readytorun/tests/genericsload/genericslib.il (renamed from tests/src/readytorun/genericsload/genericslib.il)0
-rw-r--r--tests/src/readytorun/tests/genericsload/genericslib.ilproj (renamed from tests/src/readytorun/genericsload/genericslib.ilproj)0
-rw-r--r--tests/src/readytorun/tests/genericsload/usegenericfield.cs (renamed from tests/src/readytorun/genericsload/usegenericfield.cs)0
-rw-r--r--tests/src/readytorun/tests/genericsload/usegenericfield.csproj (renamed from tests/src/readytorun/genericsload/usegenericfield.csproj)0
-rw-r--r--tests/src/readytorun/tests/main.cs (renamed from tests/src/readytorun/main.cs)0
-rw-r--r--tests/src/readytorun/tests/mainv1.csproj (renamed from tests/src/readytorun/mainv1.csproj)0
-rw-r--r--tests/src/readytorun/tests/mainv2.csproj (renamed from tests/src/readytorun/mainv2.csproj)0
-rw-r--r--tests/src/readytorun/tests/test.cs (renamed from tests/src/readytorun/test.cs)0
-rw-r--r--tests/src/readytorun/tests/testv1/test.csproj (renamed from tests/src/readytorun/testv1/test.csproj)0
-rw-r--r--tests/src/readytorun/tests/testv2/test.csproj (renamed from tests/src/readytorun/testv2/test.csproj)0
-rw-r--r--tests/testsFailingOutsideWindows.txt1
-rw-r--r--tests/testsUnsupportedOutsideWindows.txt2
-rw-r--r--tests/x86_jit32_issues.targets6
485 files changed, 23726 insertions, 15143 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4aad5a02c3..f55b54c498 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -166,9 +166,16 @@ if(CMAKE_SYSTEM_NAME STREQUAL Linux)
# Detect Linux ID
if(DEFINED CLR_CMAKE_LINUX_ID)
- if(CLR_CMAKE_LINUX_ID STREQUAL alpine)
+ if(CLR_CMAKE_LINUX_ID STREQUAL ubuntu)
+ set(CLR_CMAKE_TARGET_UBUNTU_LINUX 1)
+ elseif(CLR_CMAKE_LINUX_ID STREQUAL tizen)
+ set(CLR_CMAKE_TARGET_TIZEN_LINUX 1)
+ elseif(CLR_CMAKE_LINUX_ID STREQUAL alpine)
set(CLR_CMAKE_PLATFORM_ALPINE_LINUX 1)
endif()
+ if(CLR_CMAKE_LINUX_ID STREQUAL ubuntu)
+ set(CLR_CMAKE_PLATFORM_UBUNTU_LINUX 1)
+ endif()
endif(DEFINED CLR_CMAKE_LINUX_ID)
endif(CMAKE_SYSTEM_NAME STREQUAL Linux)
@@ -308,10 +315,6 @@ if (WIN32)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /guard:cf")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /guard:cf")
- # Incremental linking with CFG is broken until next VS release.
- # This needs to be appended to the last for each build type to override the default flag.
- set(NO_INCREMENTAL_LINKER_FLAGS "/INCREMENTAL:NO")
-
# Linker flags
#
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /MANIFEST:NO") #Do not create Side-by-Side Assembly Manifest
@@ -325,10 +328,8 @@ if (WIN32)
endif ()
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /LARGEADDRESSAWARE") # can handle addresses larger than 2 gigabytes
- set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /RELEASE") #sets the checksum in the header
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /NXCOMPAT") #Compatible with Data Execution Prevention
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DYNAMICBASE") #Use address space layout randomization
- set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DEBUGTYPE:cv,fixup") #debugging format
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /PDBCOMPRESS") #shrink pdb size
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DEBUG")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /IGNORE:4197,4013,4254,4070,4221")
diff --git a/Documentation/botr/README.md b/Documentation/botr/README.md
index 99e4274802..3a91f8defa 100644
--- a/Documentation/botr/README.md
+++ b/Documentation/botr/README.md
@@ -26,6 +26,7 @@ Below is a table of contents.
- [What Every Dev needs to Know About Exceptions in the Runtime](exceptions.md)
- [ReadyToRun Overview](readytorun-overview.md)
- [CLR ABI](clr-abi.md)
+- [Cross-platform Minidumps](xplat-minidump-generation.md)
It may be possible that this table is not complete. You can get a complete list
diff --git a/Documentation/botr/clr-abi.md b/Documentation/botr/clr-abi.md
index 8a226ed590..a85bfa4c60 100644
--- a/Documentation/botr/clr-abi.md
+++ b/Documentation/botr/clr-abi.md
@@ -470,7 +470,7 @@ When the inner "throw new UserException4" is executed, the exception handling fi
## Filter GC semantics
-Filters are invoked in the 1st pass of EH processing and as such execution might resume back at the faulting address, or in the filter-handler, or someplace else. Because the VM must allow GC's to occur during and after a filter invocation, but before the EH subsystem knows where it will resume, we need to keep everything alive at both the faulting address **and** within the filter. This is accomplished by 3 means: (1) the VM's stackwalker and GCInfoDecoder report as live both the filter frame and its corresponding parent frame, (2) the JIT encodes all stack slots that are live within the filter as being pinned, and (3) the JIT reports as live (and possible zero-initializes) anything live-out of the filter. Because of (1) it is likely that a stack variable that is live within the filter and the try body will be double reported. During the mark phase of the GC double reporting is not a problem. The problem only arises if the object is relocated: if the same location is reported twice, the GC will try to relocate the address stored at that location twice. Thus we prevent the object from being relocated by pinning it, which leads us to why we must do (2). (3) is done so that after the filter returns, we can still safely incur a GC before executing the filter-handler or any outer handler within the same frame.
+Filters are invoked in the 1st pass of EH processing and as such execution might resume back at the faulting address, or in the filter-handler, or someplace else. Because the VM must allow GC's to occur during and after a filter invocation, but before the EH subsystem knows where it will resume, we need to keep everything alive at both the faulting address **and** within the filter. This is accomplished by 3 means: (1) the VM's stackwalker and GCInfoDecoder report as live both the filter frame and its corresponding parent frame, (2) the JIT encodes all stack slots that are live within the filter as being pinned, and (3) the JIT reports as live (and possible zero-initializes) anything live-out of the filter. Because of (1) it is likely that a stack variable that is live within the filter and the try body will be double reported. During the mark phase of the GC double reporting is not a problem. The problem only arises if the object is relocated: if the same location is reported twice, the GC will try to relocate the address stored at that location twice. Thus we prevent the object from being relocated by pinning it, which leads us to why we must do (2). (3) is done so that after the filter returns, we can still safely incur a GC before executing the filter-handler or any outer handler within the same frame. For the same reason, control must exit a filter region via its final block (in other words, a filter region must terminate with the instruction that leaves the filter region, and the program may not exit the filter region via other paths).
## Duplicated Clauses
diff --git a/Documentation/botr/xplat-minidump-generation.md b/Documentation/botr/xplat-minidump-generation.md
new file mode 100644
index 0000000000..78660b659c
--- /dev/null
+++ b/Documentation/botr/xplat-minidump-generation.md
@@ -0,0 +1,80 @@
+# Introduction #
+
+Core dump generation on Linux and other non-Windows platforms has several challenges. Dumps can be very large and the default name/location of a dump is not consistent across all our supported platforms. The size of a full core dumps can be controlled somewhat with the "coredump_filter" file/flags but even with the smallest settings may be still too large and may not contain all the managed state needed for debugging. By default, some platforms use _core_ as the name and place the core dump in the current directory from where the program is launched; others add the _pid_ to the name. Configuring the core name and location requires superuser permission. Requiring superuser to make this consistent is not a satisfactory option.
+
+Our goal is to generate core dumps that are on par with WER (Windows Error Reporting) crash dumps on any supported Linux platform. To the very least we want to enable the following:
+- automatic generation of minimal size minidumps. The quality and quantity of the information contained in the dump should be on par with the information contained in a traditional Windows mini-dump.
+- simple configurabilty by the user (not _su_!).
+
+Our solution at this time is to intercept any unhandled exception in the PAL layer of the runtime and have coreclr itself trigger and generate a "mini" core dump.
+
+# Design #
+
+We looked at the existing technologies like Breakpad and its derivatives (e.g.: an internal MS version called _msbreakpad_ from the SQL team....). Breakpad generates Windows minidumps but they are not compatible with existing tools like Windbg, etc. Msbreakpad even more so. There is a minidump to Linux core conversion utility but it seems like a wasted extra step. _Breakpad_ does allow the minidump to be generated in-process inside the signal handlers. It restricts the APIs to what was allowed in a "async" signal handler (like SIGSEGV) and has a small subset of the C++ runtime that was also similarly constrained. We also need to add the set of memory regions for the "managed" state which requires loading and using the _DAC_'s (*) enumerate memory interfaces. Loading modules is not allowed in an async signal handler but forking/execve is allowed so launching an utility that loads the _DAC_, enumerates the list of memory regions and writes the dump is the only reasonable option. It would also allow uploading the dump to a server too.
+
+\* The _DAC_ is a special build of parts of the coreclr runtime that allows inspection of the runtime's managed state (stacks, variables, GC state heaps) out of context. One of the many interfaces it provides is [ICLRDataEnumMemoryRegions](https://github.com/dotnet/coreclr/blob/master/src/debug/daccess/dacimpl.h) which enumerates all the managed state a minidump would require to enable a fuitful debugging experience.
+
+_Breakpad_ could have still been used out of context in the generation utility but there seemed no value to their Windows-like minidump format when it would have to be converted to the native Linux core format away because in most scenarios using the platform tools like _lldb_ is necessary. It also adds a coreclr build dependency on Google's _Breakpad_ or SQL's _msbreakpad_ source repo. The only advantage is that the breakpad minidumps may be a little smaller because minidumps memory regions are byte granule and Linux core memory regions need to be page granule.
+
+# Implementation Details #
+
+### Linux ###
+
+Core dump generation is triggered anytime coreclr is going to abort (via [PROCAbort()](https://github.com/dotnet/coreclr/blob/master/src/pal/src/include/pal/process.h)) the process because of an unhandled managed exception or an async signal like SIGSEGV, SIGILL, SIGFPE, etc. The _createdump_ utility is located in the same directory as libcoreclr.so and is launched with fork/execve. The child _createdump_ process is given permission to ptrace and access to the various special /proc files of the crashing process which waits until _createdump_ finishes.
+
+The _createdump_ utility starts by using ptrace to enumerate and suspend all the threads in the target process. The process and thread info (status, registers, etc.) is gathered. The auxv entries and _DSO_ info is enumerated. _DSO_ is the in memory data structures that described the shared modules loaded by the target. This memory is needed in the dump by gdb and lldb to enumerate the shared modules loaded and access their symbols. The module memory mappings are gathered from /proc/$pid/maps. None of the program or shared modules memory regions are explicitly added to dump's memory regions. The _DAC_ is loaded and the enumerate memory region interfaces are used to build the memory regions list just like on Windows. The threads stacks and one page of code around the IP are added. The byte sized regions are rounded up to pages and then combined into contagious regions.
+
+After all the process crash information has been gathered, the ELF core dump with written. The main ELF header created and written. The PT\_LOAD note section is written one entry for each memory region in the dump. The process info, auxv data and NT_FILE entries are written to core. The NT\_FILE entries are built from module memory mappings from /proc/$pid/maps. The threads state and registers are then written. Lastly all the memory regions gather above by the _DAC_, etc. are read from the target process and written to the core dump. All the threads in the target process are resumed and _createdump_ terminates.
+
+**Severe memory corruption**
+
+As long as control can making it to the signal/abort handler and the fork/execve of the utility succeeds then the _DAC_ memory enumeration interfaces can handle corruption to a point; the resulting dump just may not have enough managed state to be useful. We could investigate detecting this case and writing a full core dump.
+
+**Stack overflow exception**
+
+Like the severe memory corruption case, if the signal handler (`SIGSEGV`) gets control it can detect most stack overflow cases and does trigger a core dump. There are still many cases where this doesn't happen and the OS just terminates the process.
+
+### FreeBSD/OpenBSD/NetBSD ###
+
+There will be some differences gathering the crash information but these platforms still use ELF format core dumps so that part of the utility should be much different. The mechanism used for Linux to give _createdump_ permission to use ptrace and access the /proc doesn't exists on these platforms.
+
+### OS X ###
+
+Gathering the crash information on OS X will be quite a bit different than Linux and the core dump will be written in the Mach-O format instead of ELF. The OS X support currently has not been implemented.
+
+# Configuration/Policy #
+
+Any configuration or policy is set with environment variables which are passed as options to the _createdump_ utility.
+
+Environment variables supported:
+
+- `COMPlus_DbgEnableMiniDump`: if set to "1", enables this core dump generation. The default is NOT to generate a dump.
+- `COMPlus_DbgMiniDumpType`: if set to "1" generates _MiniDumpNormal_, "2" _MiniDumpWithPrivateReadWriteMemory_, "3" _MiniDumpFilterTriage_. Default is _MiniDumpNormal_.
+- `COMPlus_DbgMiniDumpName`: if set, use as the template to create the dump path and file name. The pid can be placed in the name with %d. The default is _/tmp/coredump.%d_.
+- `COMPlus_CreateDumpDiagnostics`: if set to "1", enables the _createdump_ utilities diagnostic messages (TRACE macro).
+
+(Please refer to MSDN for the meaning of the [minidump enum values](https://msdn.microsoft.com/en-us/library/windows/desktop/ms680519(v=vs.85).aspx) reported above)
+
+**Utility command line options**:
+
+ createdump [options] pid
+ -f, --name - dump path and file name. The pid can be placed in the name with %d. The default is "/tmp/coredump.%d"
+ -n, --normal - create minidump (default).
+ -h, --withheap - create minidump with heap.
+ -t, --triage - create triage minidump.
+ -d, --diag - enable diagnostic messages.
+
+# Testing #
+
+The test plan is to modify the SOS tests in the (still) private debuggertests repo to trigger and use the core minidumps generated. Debugging managed core dumps on Linux is not supported by _mdbg_ at this time until we have a ELF core dump reader so only the SOS tests (which use _lldb_ on Linux) will be modified.
+
+# Open Issues #
+
+- Do we need a full memory dump option? It would not use the _DAC_ to get the memory regions but all the readable memory from the shared module list. Do we include the shared modules' code?
+- May need more than just the pid for decorating dump names for docker containers because I think the _pid_ is always 1.
+- Do we need all the memory mappings from `/proc/$pid/maps` in the PT\_LOAD sections even though the memory is not actually in the dump? They have a file offset/size of 0. Full dumps generated by the system or _gdb_ do have these un-backed regions.
+- Don't know how to get the proper size/range of the non-main thread stacks. Currently uses 4 pages around the stack pointer. The main thread has a memory region in `/proc/$pid/maps`.
+- There is no way to get the signal number, etc. that causes the abort from the _createdump_ utility using _ptrace_ or a /proc file. It would have to be passed from CoreCLR on the command line.
+- Do we need the "dynamic" sections of each shared module in the core dump? It is part of the "link_map" entry enumerated when gathering the _DSO_ information.
+- There may be more versioning and/or build id information needed to be added to the dump.
+- It is unclear exactly what cases stack overflow does not get control in the signal handler and when the OS just aborts the process.
diff --git a/Documentation/building/linux-instructions.md b/Documentation/building/linux-instructions.md
index b14ab288ce..bacbe6d2f0 100644
--- a/Documentation/building/linux-instructions.md
+++ b/Documentation/building/linux-instructions.md
@@ -18,8 +18,8 @@ Toolchain Setup
Install the following packages for the toolchain:
- cmake
-- llvm-3.5
-- clang-3.5
+- llvm-3.5 (llvm-3.9 for ARM cross build)
+- clang-3.5 (clang-3.9 for ARM cross build)
- lldb-3.6
- lldb-3.6-dev
- libunwind8
@@ -39,6 +39,14 @@ ellismg@linux:~$ wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-
ellismg@linux:~$ sudo apt-get update
```
+If you are going to cross build for ARM, you need llvm-3.9 and clang-3.9 and please add below package source instead for Ubuntu 14.04.
+```
+hqueue@linux:~$ echo "deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-3.9 main" | sudo tee /etc/apt/sources.list.d/llvm.list
+hqueue@linux:~$ wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-key add -
+hqueue@linux:~$ sudo apt-get update
+```
+For other version of Debian/Ubuntu, please visit http://apt.llvm.org/.
+
Then install the packages you need:
```
@@ -120,6 +128,8 @@ index 1ed3dbf..c643032 100644
How to enable -O3 optimization level for ARM/Linux
==================================================
+If you are using clang-3.9, -O3 optimization is enabled as default and you can skip this section.
+If you are using older version of clang, please follow instructions in this section to enable -O3 optimization.
Currently, we can build coreclr with -O1 flag of clang in release build mode for Linux/ARM without any bugfix of llvm-3.6. This instruction is to enable -O3 optimization level of clang on Linux/ARM by fixing the bug of llvm.
First, download latest version from the clang-3.6/llvm-3.6 upstream:
diff --git a/Documentation/building/viewing-jit-dumps.md b/Documentation/building/viewing-jit-dumps.md
index 607c5e63a0..be5f4064a5 100644
--- a/Documentation/building/viewing-jit-dumps.md
+++ b/Documentation/building/viewing-jit-dumps.md
@@ -8,115 +8,105 @@ To make sense of the results, it is recommended you also read the [Reading a Jit
The first thing we want to do is setup the .NET Core app we want to dump. Here are the steps to do this, if you don't have one ready:
-* Perform a debug build of the CoreCLR repo
-* Install the [.NET CLI](http://microsoft.com/net/core), which we'll use to compile/publish our app
-* `cd` to where you want your app to be placed, and run `dotnet new`
-* Modify your `project.json` file so that it contains a RID (runtime ID) corresponding to the OS you're using in the `runtimes` section. For example, I have a Windows 10 x64 machine, so here's my project file:
-
-```json
-{
- "buildOptions": {
- "emitEntryPoint": true
- },
- "dependencies": {
- "Microsoft.NETCore.App": "1.0.0-*"
- },
- "frameworks": {
- "netcoreapp1.0": {
- "imports": [
- "dnxcore50",
- "portable-net45+win8"
- ]
- }
- },
- "runtimes": {
- "win10-x64": {}
- }
-}
-```
+* Perform a debug build of the CoreCLR repo.
+* Install the [.NET CLI 2.0 preview](https://github.com/dotnet/corefx/blob/master/Documentation/project-docs/dogfooding.md), which we'll use to compile/publish our app.
+* `cd` to where you want your app to be placed, and run `dotnet new console`.
+* Modify your `csproj` file so that it contains a RID (runtime ID) corresponding to the OS you're using in the `<RuntimeIdentifier>` tag. For example, for Windows 10 x64 machine, the project file is:
+
+ ```xml
+ <Project Sdk="Microsoft.NET.Sdk">
-You can find a list of RIDs and their corresponding OSes [here](https://docs.microsoft.com/en-us/dotnet/articles/core/rid-catalog).
+ <PropertyGroup>
+ <OutputType>Exe</OutputType>
+ <TargetFramework>netcoreapp2.0</TargetFramework>
+ <RuntimeIdentifier>win10-x64</RuntimeIdentifier>
+ </PropertyGroup>
+
+ </Project>
+ ```
+
+ You can find a list of RIDs and their corresponding OSes [here](https://docs.microsoft.com/en-us/dotnet/articles/core/rid-catalog).
* Edit `Program.cs`, and call the method(s) you want to dump in there. Make sure they are, directly or indirectly, called from `Main`. In this example, we'll be looking at the disassembly of our custom function `InefficientJoin`:
-```cs
-using System;
-using System.Collections.Generic;
-using System.Runtime.CompilerServices;
+ ```cs
+ using System;
+ using System.Collections.Generic;
+ using System.Runtime.CompilerServices;
-namespace ConsoleApplication
-{
- public class Program
+ namespace ConsoleApplication
{
- public static void Main(string[] args)
+ public class Program
{
- Console.WriteLine(InefficientJoin(args));
- }
-
- // Add NoInlining to prevent this from getting
- // mixed up with the rest of the code in Main
- [MethodImpl(MethodImplOptions.NoInlining)]
- private static string InefficientJoin(IEnumerable<string> args)
- {
- var result = string.Empty;
- foreach (var arg in args) result += (arg + ' ');
- return result.Substring(0, result.Length - 1);
+ public static void Main(string[] args)
+ {
+ Console.WriteLine(InefficientJoin(args));
+ }
+
+ // Add NoInlining to prevent this from getting
+ // mixed up with the rest of the code in Main
+ [MethodImpl(MethodImplOptions.NoInlining)]
+ private static string InefficientJoin(IEnumerable<string> args)
+ {
+ var result = string.Empty;
+ foreach (var arg in args) result += (arg + ' ');
+ return result.Substring(0, Math.Max(0, result.Length - 1));
+ }
}
}
-}
-```
+ ```
-* After you've finished editing the code, run `dotnet publish -c Release`. This should drop all of the binaries needed to run your app in `bin/Release/<configuration>/<rid>/publish`.
+* After you've finished editing the code, run `dotnet restore` and `dotnet publish -c Release`. This should drop all of the binaries needed to run your app in `bin/Release/<configuration>/<rid>/publish`.
* Overwrite the CLR dlls with the ones you've built locally. If you're a fan of the command line, here are some shell commands for doing this:
-```shell
-# Windows
-robocopy /e <coreclr path>\bin\Product\Windows_NT.<arch>.Debug <app root>\bin\Release\netcoreapp1.0\<rid>\publish > NUL
+ ```shell
+ # Windows
+ robocopy /e <coreclr path>\bin\Product\Windows_NT.<arch>.Debug <app root>\bin\Release\netcoreapp2.0\<rid>\publish > NUL
-# Unix
-cp -rT <coreclr path>/bin/Product/<OS>.<arch>.Debug <app root>/bin/Release/netcoreapp1.0/<rid>/publish
-```
+ # Unix
+ cp -rT <coreclr path>/bin/Product/<OS>.<arch>.Debug <app root>/bin/Release/netcoreapp2.0/<rid>/publish
+ ```
* Set the configuration knobs you need (see below) and run your published app. The info you want should be dumped to stdout.
-Here's some sample output on my machine showing the disassembly for `InefficientJoin`:
-
-```asm
-G_M2530_IG01:
- 55 push rbp
- 4883EC40 sub rsp, 64
- 488D6C2440 lea rbp, [rsp+40H]
- 33C0 xor rax, rax
- 488945F8 mov qword ptr [rbp-08H], rax
- 488965E0 mov qword ptr [rbp-20H], rsp
-
-G_M2530_IG02:
- 49BB60306927E5010000 mov r11, 0x1E527693060
- 4D8B1B mov r11, gword ptr [r11]
- 4C895DF8 mov gword ptr [rbp-08H], r11
- 49BB200058F7FD7F0000 mov r11, 0x7FFDF7580020
- 3909 cmp dword ptr [rcx], ecx
- 41FF13 call gword ptr [r11]System.Collections.Generic.IEnumerable`1[__Canon][System.__Canon]:GetEnumerator():ref:this
- 488945F0 mov gword ptr [rbp-10H], rax
-
-; ...
-```
+ Here's some sample output on my machine showing the disassembly for `InefficientJoin`:
+
+ ```asm
+ G_M2530_IG01:
+ 55 push rbp
+ 4883EC40 sub rsp, 64
+ 488D6C2440 lea rbp, [rsp+40H]
+ 33C0 xor rax, rax
+ 488945F8 mov qword ptr [rbp-08H], rax
+ 488965E0 mov qword ptr [rbp-20H], rsp
+
+ G_M2530_IG02:
+ 49BB60306927E5010000 mov r11, 0x1E527693060
+ 4D8B1B mov r11, gword ptr [r11]
+ 4C895DF8 mov gword ptr [rbp-08H], r11
+ 49BB200058F7FD7F0000 mov r11, 0x7FFDF7580020
+ 3909 cmp dword ptr [rcx], ecx
+ 41FF13 call gword ptr [r11]System.Collections.Generic.IEnumerable`1[__Canon][System.__Canon]:GetEnumerator():ref:this
+ 488945F0 mov gword ptr [rbp-10H], rax
+
+ ; ...
+ ```
## Setting configuration variables
-The behavior of the JIT can be controlled via a number of configuration variables. These are declared in [inc/clrconfigvalues.h](https://github.com/dotnet/coreclr/blob/master/src/inc/clrconfigvalues.h). When used as an environment variable, the string name generally has “COMPlus_” prepended. When used as a registry value name, the configuration name is used directly.
+The behavior of the JIT can be controlled via a number of configuration variables. These are declared in [inc/clrconfigvalues.h](https://github.com/dotnet/coreclr/blob/master/src/inc/clrconfigvalues.h). When used as an environment variable, the string name generally has `COMPlus_` prepended. When used as a registry value name, the configuration name is used directly.
These can be set in one of three ways:
-* Setting the environment variable `COMPlus_<flagname>`. For example, the following will set the `JitDump` flag so that the compilation of all methods named ‘Main’ will be dumped:
+* Setting the environment variable `COMPlus_<flagname>`. For example, the following will set the `JitDump` flag so that the compilation of all methods named `Main` will be dumped:
-```shell
-# Windows
-set COMPlus_JitDump=Main
+ ```shell
+ # Windows
+ set COMPlus_JitDump=Main
-# Unix
-export COMPlus_JitDump=Main
-```
+ # Unix
+ export COMPlus_JitDump=Main
+ ```
* *Windows-only:* Setting the registry key `HKCU\Software\Microsoft\.NETFramework`, Value `<flagName>`, type `REG_SZ` or `REG_DWORD` (depending on the flag).
* *Windows-only:* Setting the registry key `HKLM\Software\Microsoft\.NETFramework`, Value `<flagName>`, type `REG_SZ` or `REG_DWORD` (depending on the flag).
@@ -143,13 +133,13 @@ Main
will match all methods named Main from any class and any number of arguments.
-<types> is a comma separated list of type names. Note that presently only the number of arguments and not the types themselves are used to distinguish methods. Thus, `Main(Foo, Bar)` and `Main(int, int)` will both match any main method with two arguments.
+`<types>` is a comma separated list of type names. Note that presently only the number of arguments and not the types themselves are used to distinguish methods. Thus, `Main(Foo, Bar)` and `Main(int, int)` will both match any main method with two arguments.
-The wildcard character ‘*’ can be used for <ClassName> and <MethodName>. In particular * by itself indicates every method.
+The wildcard character `*` can be used for `<ClassName>` and `<MethodName>`. In particular `*` by itself indicates every method.
## Useful COMPlus variables
-Below are some of the most useful `COMPlus` variables. Where {method-list} is specified in the list below, you can supply a space-separated list of either fully-qualified or simple method names (the former is useful when running something that has many methods of the same name), or you can specific ‘*’ to mean all methods.
+Below are some of the most useful `COMPlus` variables. Where {method-list} is specified in the list below, you can supply a space-separated list of either fully-qualified or simple method names (the former is useful when running something that has many methods of the same name), or you can specify `*` to mean all methods.
* `COMPlus_JitDump`={method-list} – dump lots of useful information about what the JIT is doing. See [Reading a JitDump](../botr/ryujit-overview.md#reading-a-jitdump) for more on how to analyze this data.
* `COMPlus_JitDisasm`={method-list} – dump a disassembly listing of each method.
diff --git a/Documentation/building/windows-instructions.md b/Documentation/building/windows-instructions.md
index d0e63270c0..303bec8cc0 100644
--- a/Documentation/building/windows-instructions.md
+++ b/Documentation/building/windows-instructions.md
@@ -15,7 +15,7 @@ Visual Studio must be installed. Supported versions:
- [Visual Studio 2017](https://www.visualstudio.com/downloads/) (Community, Professional, Enterprise). The community version is completely free.
For Visual Studio 2015:
-* To debug managed code, ensure you have installed at least [Visual Studio 2015 Update 3](https://www.visualstudio.com/en-us/news/releasenotes/vs2015-update3-vs).
+* Ensure you have installed at least [Visual Studio 2015 Update 3](https://www.visualstudio.com/en-us/news/releasenotes/vs2015-update3-vs).
* Make sure that you install "VC++ Tools". By default, they will not be installed.
* To build for Arm32, Make sure that you have the Windows SDK for Windows 10 installed (or selected to be installed as part of VS installation). To explicitly install Windows SDK, download it from here: [Windows SDK for Windows 10](https://developer.microsoft.com/en-us/windows/downloads)
diff --git a/Documentation/project-docs/contributing-workflow.md b/Documentation/project-docs/contributing-workflow.md
index d88e098ebf..ff21143d7a 100644
--- a/Documentation/project-docs/contributing-workflow.md
+++ b/Documentation/project-docs/contributing-workflow.md
@@ -62,7 +62,7 @@ the PR.
PR - CI Process
===============
-The [dotnet continuous integration](http://dotnet-ci.cloudapp.net/) (CI) system will automatically perform the required builds and run tests (including the ones you are expected to run) for PRs. Builds and test runs must be clean.
+The [dotnet continuous integration](http://ci.dot.net/) (CI) system will automatically perform the required builds and run tests (including the ones you are expected to run) for PRs. Builds and test runs must be clean.
If the CI build fails for any reason, the PR issue will be updated with a link that can be used to determine the cause of the failure.
diff --git a/Linked b/Linked
new file mode 100644
index 0000000000..675a79bf12
--- /dev/null
+++ b/Linked
Binary files differ
diff --git a/README.md b/README.md
index 21dd9f7666..378ce5233b 100644
--- a/README.md
+++ b/README.md
@@ -9,7 +9,7 @@ that quickly points you to [.NET Core Tutorials](https://docs.microsoft.com/en-u
.NET Core is best thought of as 'agile .NET'. Generally speaking it is the same as
the [Desktop .NET Framework](https://en.wikipedia.org/wiki/.NET_Framework)
distributed as part of the Windows operating system, but it is a cross platform
-(Windows, Linux, OSX) and cross architecture (x86, x64, arm) subset that can be deployed
+(Windows, Linux, macOS) and cross architecture (x86, x64, arm) subset that can be deployed
as part of the application (if desired), and thus can be updated quickly to fix bugs or add features.
## If You Just Want to Use .NET Core
@@ -116,7 +116,7 @@ You have to be on the particular platform to build that platform.
* [Windows Build Instructions](Documentation/building/windows-instructions.md)
* [Linux Build Instructions](Documentation/building/linux-instructions.md)
- * [OSX Build Instructions](Documentation/building/osx-instructions.md)
+ * [macOS Build Instructions](Documentation/building/osx-instructions.md)
* [FreeBSD Build Instructions](Documentation/building/freebsd-instructions.md)
* [NetBSD Build Instructions](Documentation/building/netbsd-instructions.md)
diff --git a/Tools-Override/codeOptimization.targets b/Tools-Override/codeOptimization.targets
new file mode 100644
index 0000000000..4db340f15e
--- /dev/null
+++ b/Tools-Override/codeOptimization.targets
@@ -0,0 +1,118 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <UsingTask TaskName="ZipFileExtractToDirectory" AssemblyFile="$(BuildToolsTaskDir)Microsoft.DotNet.Build.Tasks.dll"/>
+
+ <PropertyGroup>
+ <OptimizationDataVersion Condition="'$(OptimizationDataVersion)'==''">2.0.0-rc-61101-16</OptimizationDataVersion>
+ <OptimizationDataPackageName Condition="'$(OptimizationDataPackageName)'==''">RoslynDependencies.OptimizationData</OptimizationDataPackageName>
+ <OptimizationDataDir Condition="'$(OptimizationDataDir)'==''">$(ToolsDir)OptimizationData/</OptimizationDataDir>
+ <RestoreDefaultOptimizationDataPackage Condition="'$(RestoreDefaultOptimizationDataPackage)'==''">true</RestoreDefaultOptimizationDataPackage>
+ <UsePartialNGENOptimization Condition="'$(UsePartialNGENOptimization)'==''">true</UsePartialNGENOptimization>
+ </PropertyGroup>
+
+ <!-- If IBC data hasn't been merged with the IL yet, preprocess it first -->
+ <Target Name="PreProcessIBCData"
+ BeforeTargets="OptimizeWithTrainingData"
+ DependsOnTargets="ResolveOptionalTools"
+ Condition="'$(OS)'=='Windows_NT' and '$(EnableProfileGuidedOptimization)'=='true' and Exists('$(OptimizationDataDir)$(AssemblyName).dll')">
+
+ <!-- Find IBCMerge as a resolved optional tool. -->
+ <PropertyGroup>
+ <IBCMergeToolPath Condition="'%(Filename)%(Extension)'=='ibcmerge.exe'">@(ResolvedOptionalToolReferences)</IBCMergeToolPath>
+ </PropertyGroup>
+
+ <!-- Enumerate the various files that need merging -->
+ <PropertyGroup>
+ <InputAssemblyFile>$(OptimizationDataDir)$(AssemblyName).dll</InputAssemblyFile>
+ <TargetOptimizationDataFile>$(OptimizationDataDir)$(AssemblyName).pgo</TargetOptimizationDataFile>
+ </PropertyGroup>
+ <ItemGroup>
+ <RawOptimizationDataFiles Include="$(OptimizationDataDir)$(AssemblyName)*.ibc" />
+ </ItemGroup>
+
+ <!-- Merge the optimization data into the source DLL -->
+ <Exec Command="$(IBCMergeToolPath) -q -f -delete -mo $(InputAssemblyFile) @(RawOptimizationDataFiles, ' ')" />
+
+ <!-- Verify that the optimization data has been merged -->
+ <Exec Command="$(IBCMergeToolPath) -mi $(InputAssemblyFile)" />
+
+ <!-- Save the module as *.pgo to match the convention expected in target OptimizeWithTrainingData -->
+ <Copy SourceFiles="$(InputAssemblyFile)" DestinationFiles="$(TargetOptimizationDataFile)" />
+ </Target>
+
+ <!-- We should only run this target on Windows and only if EnableProfileGuidedOptimization is set and we have training data -->
+ <Target Name="OptimizeWithTrainingData"
+ AfterTargets="AfterBuild"
+ BeforeTargets="CopyFilesToOutputDirectory"
+ DependsOnTargets="ResolveOptionalTools"
+ Condition="'$(OS)'=='Windows_NT' and '$(EnableProfileGuidedOptimization)'=='true' and Exists('$(OptimizationDataDir)$(AssemblyName).pgo')">
+
+ <!-- Find IBCMerge as a resolved optional tool. -->
+ <PropertyGroup>
+ <IBCMergeToolPath Condition="'%(Filename)%(Extension)'=='ibcmerge.exe'">@(ResolvedOptionalToolReferences)</IBCMergeToolPath>
+ </PropertyGroup>
+
+ <PropertyGroup>
+ <OptimizedAssemblyDir>$(IntermediateOutputPath)/OptimizedAssembly</OptimizedAssemblyDir>
+ <OptimizedAssemblyFile>$(OptimizedAssemblyDir)/$(AssemblyName).dll</OptimizedAssemblyFile>
+ </PropertyGroup>
+
+ <!-- Customize IBCMerge's arguments depending on input props -->
+ <PropertyGroup>
+ <IBCMergeArguments>-q -f -mo $(OptimizedAssemblyFile) -incremental $(OptimizationDataDir)$(AssemblyName).pgo</IBCMergeArguments>
+ <IBCMergeArguments Condition="$(UsePartialNGENOptimization)">$(IBCMergeArguments) -partialNGEN -minify</IBCMergeArguments>
+ </PropertyGroup>
+
+ <!-- Copy the compiled assembly into a folder for further processing -->
+ <MakeDir Directories="$(OptimizedAssemblyDir)" />
+ <Copy SourceFiles="@(IntermediateAssembly)" DestinationFolder="$(OptimizedAssemblyDir)" />
+
+ <!-- Apply optimization data to the compiled assembly -->
+ <Exec Command="$(IBCMergeToolPath) $(IBCMergeArguments)" />
+
+ <!-- Verify that the optimization data has been applied -->
+ <Exec Command="$(IBCMergeToolPath) -mi $(OptimizedAssemblyFile)" />
+
+ <!-- We need to make sure that the assembly that gets packaged is the one with the optimization data -->
+ <ItemGroup>
+ <IntermediateAssembly Remove="@(IntermediateAssembly)"/>
+ <IntermediateAssembly Include="$(OptimizedAssemblyDir)/$(AssemblyName).dll"/>
+ </ItemGroup>
+ </Target>
+
+ <!-- We need the OptimizationData package in order to be able to optimize the assembly -->
+ <Target Name="RestoreOptimizationDataPackage"
+ BeforeTargets="Sync"
+ Condition="'$(EnableProfileGuidedOptimization)'=='true' and '$(RestoreDefaultOptimizationDataPackage)'=='true' and !Exists('$(OptimizationDataDir)project.json')">
+
+ <!-- Dynamically create a project.json file used to restore the optimization data-->
+ <Message Text="Generating project.json for optimization data" Importance="low" />
+ <ItemGroup>
+ <_OptimizationDataJsonLine Include="{&quot;dependencies&quot;: {" />
+ <_OptimizationDataJsonLine Include="&quot;$(OptimizationDataPackageName)&quot; : &quot;$(OptimizationDataVersion)&quot; " />
+ <_OptimizationDataJsonLine Include="},&quot;frameworks&quot;: {&quot;netcoreapp1.0&quot;: {},&quot;net46&quot;: {}}}"/>
+ </ItemGroup>
+
+ <PropertyGroup>
+ <OptimizationDataProjectJson>$(OptimizationDataDir)project.json</OptimizationDataProjectJson>
+ <OptimizationDataNuGetFeed Condition="'$(OptimizationDataNuGetFeed)'==''">https:%2F%2Fdotnet.myget.org/F/roslyn/api/v3/index.json</OptimizationDataNuGetFeed>
+ </PropertyGroup>
+
+ <MakeDir Directories="$(OptimizationDataDir)" ContinueOnError="true" />
+ <WriteLinesToFile File="$(OptimizationDataProjectJson)" Lines="@(_OptimizationDataJsonLine)" Overwrite="true" />
+
+ <!-- Restore the OptimizationData package -->
+ <Exec Command="$(DnuRestoreCommand) $(OptimizationDataProjectJson) --source $(OptimizationDataNuGetFeed)"
+ StandardOutputImportance="Low"/>
+
+ <!-- Copy the restored files into a more accessible location -->
+ <ItemGroup>
+ <_OptimizationDataFiles Include="$(PackagesDir)/$(OptimizationDataPackageName)/$(OptimizationDataVersion)/content/OptimizationData/*.pgo" />
+ </ItemGroup>
+
+ <Copy SourceFiles="@(_OptimizationDataFiles)"
+ DestinationFiles="@(_OptimizationDataFiles->'$(OptimizationDataDir)%(Filename)%(Extension)')"
+ SkipUnchangedFiles="true"
+ ContinueOnError="true"/>
+ </Target>
+</Project> \ No newline at end of file
diff --git a/build-test.cmd b/build-test.cmd
index 785c3cbf05..514bb23971 100644
--- a/build-test.cmd
+++ b/build-test.cmd
@@ -57,6 +57,8 @@ set __RunArgs=
set __BuildAgainstPackagesArg=
set __RuntimeId=
set __ZipTests=
+set __TargetsWindows=1
+set __DoCrossgen=
:Arg_Loop
if "%1" == "" goto ArgsDone
@@ -79,7 +81,9 @@ if /i "%1" == "updateinvalidpackages" (set __UpdateInvalidPackagesArg=1&set proc
if /i "%1" == "toolset_dir" (set __ToolsetDir=%2&set __PassThroughArgs=%__PassThroughArgs% %2&set processedArgs=!processedArgs! %1 %2&shift&shift&goto Arg_Loop)
if /i "%1" == "buildagainstpackages" (set __ZipTests=1&set __BuildAgainstPackagesArg=-BuildTestsAgainstPackages&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
if /i "%1" == "ziptests" (set __ZipTests=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
+if /i "%1" == "crossgen" (set __DoCrossgen=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
if /i "%1" == "runtimeid" (set __RuntimeId=%2&set processedArgs=!processedArgs! %1 %2&shift&shift&goto Arg_Loop)
+if /i "%1" == "targetsNonWindows" (set __TargetsWindows=0&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
if /i "%1" == "Exclude" (set __Exclude=%2&set processedArgs=!processedArgs! %1 %2&shift&shift&goto Arg_Loop)
if [!processedArgs!]==[] (
@@ -90,6 +94,13 @@ if [!processedArgs!]==[] (
:ArgsDone
+if defined __BuildAgainstPackagesArg (
+ if not defined __RuntimeID (
+ echo %__MsgPrefix%Error: When building against packages, you must supply a target Runtime ID.
+ exit /b 1
+ )
+)
+
echo %__MsgPrefix%Using environment: "%__VSToolsRoot%\VsDevCmd.bat"
call "%__VSToolsRoot%\VsDevCmd.bat"
@@ -228,32 +239,17 @@ REM ============================================================================
if not defined XunitTestBinBase set XunitTestBinBase=%__TestWorkingDir%
set "CORE_ROOT=%XunitTestBinBase%\Tests\Core_Root"
-set "CORE_OVERLAY=%XunitTestBinBase%\Tests\Core_Root_%__RuntimeId%"
call "%__ProjectDir%\run.cmd" build -Project=%__ProjectDir%\tests\build.proj -UpdateDependencies -BatchRestorePackages -MsBuildLog=!__msbuildLog! -MsBuildWrn=!__msbuildWrn! -MsBuildErr=!__msbuildErr! %__RunArgs% %__BuildAgainstPackagesArg% %__unprocessedBuildArgs%
set __BuildLogRootName=Tests_GenerateRuntimeLayout
-call "%__ProjectDir%\run.cmd" build -Project=%__ProjectDir%\tests\runtest.proj -BinPlaceRef -BinPlaceProduct -CopyCrossgenToProduct -MsBuildLog=!__msbuildLog! -MsBuildWrn=!__msbuildWrn! -MsBuildErr=!__msbuildErr! %__RunArgs% %__BuildAgainstPackagesArg% %__unprocessedBuildArgs%
+call "%__ProjectDir%\run.cmd" build -Project=%__ProjectDir%\tests\runtest.proj -BinPlaceRef -BinPlaceProduct -CopyCrossgenToProduct -RuntimeId="%__RuntimeId%" -MsBuildLog=!__msbuildLog! -MsBuildWrn=!__msbuildWrn! -MsBuildErr=!__msbuildErr! %__RunArgs% %__BuildAgainstPackagesArg% %__unprocessedBuildArgs%
if errorlevel 1 (
echo BinPlace of mscorlib.dll failed
exit /b 1
)
-if defined __RuntimeId (
-
- if not exist %__PackagesDir%\TestNativeBins (
- echo %__MsgPrefix%Error: Ensure you have run sync.cmd -ab before building a non-Windows test overlay against packages
- exit /b 1
- )
-
- call "%__ProjectDir%\run.cmd" build -Project=%__ProjectDir%\tests\runtest.proj -CreateNonWindowsTestOverlay -RuntimeId="%__RuntimeId%" -MsBuildLog=!__msbuildLog! -MsBuildWrn=!__msbuildWrn! -MsBuildErr=!__msbuildErr! %__RunArgs% %__BuildAgainstPackagesArg% %__unprocessedBuildArgs%
- for /R %__PackagesDir%\TestNativeBins\%__RuntimeId%\%__BuildType% %%f in (*.so) do copy %%f %Core_Overlay%
- for /R %__PackagesDir%\TestNativeBins\%__RuntimeId%\%__BuildType% %%f in (*.dylib) do copy %%f %Core_Overlay%
-
- echo %__MsgPrefix% Created the runtime layout for %__RuntimeId% in %CORE_OVERLAY%
-)
-
echo %__MsgPrefix% Restored CoreCLR product from packages
:SkipRestoreProduct
@@ -301,18 +297,42 @@ REM Cleans up any lock folder used for synchronization from last run
powershell "Get-ChildItem -path %__TestWorkingDir% -Include 'lock' -Recurse -Force | where {$_.Attributes -eq 'Directory'}| Remove-Item -force -Recurse"
set CORE_ROOT=%__TestBinDir%\Tests\Core_Root
+set CORE_ROOT_STAGE=%__TestBinDir%\Tests\Core_Root_Stage
if exist "%CORE_ROOT%" rd /s /q "%CORE_ROOT%"
+if exist "%CORE_ROOT_STAGE%" rd /s /q "%CORE_ROOT_STAGE%"
md "%CORE_ROOT%"
-xcopy /s "%__BinDir%" "%CORE_ROOT%"
+md "%CORE_ROOT_STAGE%"
+xcopy /s "%__BinDir%" "%CORE_ROOT_STAGE%"
+
+
+if defined __BuildAgainstPackagesArg (
+ if "%__TargetsWindows%"=="0" (
+
+ if not exist %__PackagesDir%\TestNativeBins (
+ echo %__MsgPrefix%Error: Ensure you have run sync.cmd -ab before building a non-Windows test overlay against packages
+ exit /b 1
+ )
+
+ for /R %__PackagesDir%\TestNativeBins\%__RuntimeId%\%__BuildType% %%f in (*.so) do copy %%f %CORE_ROOT_STAGE%
+ for /R %__PackagesDir%\TestNativeBins\%__RuntimeId%\%__BuildType% %%f in (*.dylib) do copy %%f %CORE_ROOT_STAGE%
+ )
+)
echo %__MsgPrefix%Creating test wrappers...
set RuntimeIdArg=
+set TargetsWindowsArg=
if defined __RuntimeId (
set RuntimeIdArg=-RuntimeID="%__RuntimeId%"
)
+if "%__TargetsWindows%"=="1" (
+ set TargetsWindowsArg=-TargetsWindows=true
+) else if "%__TargetsWindows%"=="0" (
+ set TargetsWindowsArg=-TargetsWindows=false
+)
+
set __BuildLogRootName=Tests_XunitWrapper
set __BuildLog=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.log
set __BuildWrn=%__LogsDir%\%__BuildLogRootName%_%__BuildOS%__%__BuildArch%__%__BuildType%.wrn
@@ -321,7 +341,7 @@ set __msbuildLog=/flp:Verbosity=normal;LogFile="%__BuildLog%"
set __msbuildWrn=/flp1:WarningsOnly;LogFile="%__BuildWrn%"
set __msbuildErr=/flp2:ErrorsOnly;LogFile="%__BuildErr%"
-call %__ProjectDir%\run.cmd build -Project=%__ProjectDir%\tests\runtest.proj -BuildWrappers -MsBuildEventLogging=" " -MsBuildLog=!__msbuildLog! -MsBuildWrn=!__msbuildWrn! -MsBuildErr=!__msbuildErr! %__RunArgs% %__BuildAgainstPackagesArg% %__unprocessedBuildArgs% %RuntimeIdArg%
+call %__ProjectDir%\run.cmd build -Project=%__ProjectDir%\tests\runtest.proj -BuildWrappers -MsBuildEventLogging=" " -MsBuildLog=!__msbuildLog! -MsBuildWrn=!__msbuildWrn! -MsBuildErr=!__msbuildErr! %__RunArgs% %__BuildAgainstPackagesArg% %TargetsWindowsArg% %__unprocessedBuildArgs%
if errorlevel 1 (
echo Xunit Wrapper build failed
exit /b 1
@@ -337,7 +357,7 @@ set __msbuildLog=/flp:Verbosity=normal;LogFile="%__BuildLog%"
set __msbuildWrn=/flp1:WarningsOnly;LogFile="%__BuildWrn%"
set __msbuildErr=/flp2:ErrorsOnly;LogFile="%__BuildErr%"
-call %__ProjectDir%\run.cmd build -Project=%__ProjectDir%\tests\runtest.proj -testOverlay -MsBuildLog=!__msbuildLog! -MsBuildWrn=!__msbuildWrn! -MsBuildErr=!__msbuildErr! %__RunArgs% %__unprocessedBuildArgs%
+call %__ProjectDir%\run.cmd build -Project=%__ProjectDir%\tests\runtest.proj -testOverlay -MsBuildLog=!__msbuildLog! -MsBuildWrn=!__msbuildWrn! -MsBuildErr=!__msbuildErr! %__RunArgs% %RuntimeIdArg% %__unprocessedBuildArgs%
if errorlevel 1 (
echo %__MsgPrefix%Error: build failed. Refer to the build log files for details:
echo %__BuildLog%
@@ -346,6 +366,20 @@ if errorlevel 1 (
exit /b 1
)
+xcopy /s /y "%CORE_ROOT_STAGE%" "%CORE_ROOT%"
+
+set __CrossgenArg = ""
+if defined __DoCrossgen (
+ set __CrossgenArg="-Crossgen"
+ if "%__TargetsWindows%" == "1" (
+ call :PrecompileFX
+ ) else (
+ echo "%__MsgPrefix% Crossgen only supported on Windows, for now"
+ )
+)
+
+rd /s /q "%CORE_ROOT_STAGE%"
+
if not defined __ZipTests goto SkipPrepForPublish
set __BuildLogRootName=Helix_Prep
@@ -362,7 +396,7 @@ REM === Prep test binaries for Helix publishing
REM ===
REM =========================================================================================
-call %__ProjectDir%\run.cmd build -Project=%__ProjectDir%\tests\helixprep.proj -MsBuildLog=!__msbuildLog! -MsBuildWrn=!__msbuildWrn! -MsBuildErr=!__msbuildErr! %__RunArgs% %__BuildAgainstPackagesArg% %__unprocessedBuildArgs% %RuntimeIdArg%
+call %__ProjectDir%\run.cmd build -Project=%__ProjectDir%\tests\helixprep.proj -MsBuildLog=!__msbuildLog! -MsBuildWrn=!__msbuildWrn! -MsBuildErr=!__msbuildErr! %__RunArgs% %__BuildAgainstPackagesArg% %RuntimeIdArg% %TargetsWindowsArg% %__CrossgenArg% %__unprocessedBuildArgs%
echo %__MsgPrefix% Prepped test binaries for publishing
@@ -393,14 +427,18 @@ echo runtimeid ^<ID^>: Builds a test overlay for the specified OS (Only supporte
echo alpine.3.4.3-x64: Builds overlay for Alpine 3.4.3
echo debian.8-x64: Builds overlay for Debian 8
echo fedora.24-x64: Builds overlay for Fedora 24
-echo fedora.25-x64: Builds overlay for Fedora 25
+echo linux-x64: Builds overlay for portable linux
echo opensuse.42.1-x64: Builds overlay for OpenSUSE 42.1
echo osx.10.12-x64: Builds overlay for OSX 10.12
+echo osx-x64: Builds overlay for portable OSX
echo rhel.7-x64: Builds overlay for RHEL 7 or CentOS
echo ubuntu.14.04-x64: Builds overlay for Ubuntu 14.04
echo ubuntu.16.04-x64: Builds overlay for Ubuntu 16.04
echo ubuntu.16.10-x64: Builds overlay for Ubuntu 16.10
+echo win-x64: Builds overlay for portable Windows
+echo win7-x64: Builds overlay for Windows 7
echo ziptests: zips CoreCLR tests & Core_Root for a Helix run
+echo crossgen: Precompiles the framework managed assemblies
echo Exclude- Optional parameter - specify location of default exclusion file (defaults to tests\issues.targets if not specified)
echo Set to "" to disable default exclusion file.
echo -- ... : all arguments following this tag will be passed directly to msbuild.
@@ -435,6 +473,11 @@ if /i "%__ToolsetDir%" == "" (
exit /b 1
)
+if not exist "%__ToolsetDir%"\buildenv_arm64.cmd goto :Not_EWDK
+call "%__ToolsetDir%"\buildenv_arm64.cmd
+exit /b 0
+
+:Not_EWDK
set PATH=%__ToolsetDir%\VC_sdk\bin;%PATH%
set LIB=%__ToolsetDir%\VC_sdk\lib\arm64;%__ToolsetDir%\sdpublic\sdk\lib\arm64
set INCLUDE=^
@@ -449,3 +492,31 @@ set INCLUDE=^
%__ToolsetDir%\sdpublic\sdk\inc\clientcore;^
%__ToolsetDir%\diasdk\include
exit /b 0
+
+:PrecompileFX
+for %%F in (%CORE_ROOT%\*.dll) do call :PrecompileAssembly "%%F" %%~nF%%~xF
+exit /b 0
+
+REM Compile the managed assemblies in Core_ROOT before running the tests
+:PrecompileAssembly
+
+REM Skip mscorlib since it is already precompiled.
+if /I "%2" == "mscorlib.dll" exit /b 0
+if /I "%2" == "mscorlib.ni.dll" exit /b 0
+REM don't precompile anything from CoreCLR
+if /I exist %CORE_ROOT_STAGE%\%2 exit /b 0
+
+"%CORE_ROOT_STAGE%\crossgen.exe" /Platform_Assemblies_Paths "%CORE_ROOT%" "%1" >nul 2>nul
+set /a __exitCode = %errorlevel%
+if "%__exitCode%" == "-2146230517" (
+ echo %2 is not a managed assembly.
+ exit /b 0
+)
+
+if %__exitCode% neq 0 (
+ echo Unable to precompile %2
+ exit /b 0
+)
+
+echo Successfully precompiled %2
+exit /b 0
diff --git a/build.cmd b/build.cmd
index 904bb028b4..64945cc159 100644
--- a/build.cmd
+++ b/build.cmd
@@ -687,6 +687,11 @@ if /i "%__ToolsetDir%" == "" (
exit /b 1
)
+if not exist "%__ToolsetDir%"\buildenv_arm64.cmd goto :Not_EWDK
+call "%__ToolsetDir%"\buildenv_arm64.cmd
+exit /b 0
+
+:Not_EWDK
set PATH=%__ToolsetDir%\VC_sdk\bin;%PATH%
set LIB=%__ToolsetDir%\VC_sdk\lib\arm64;%__ToolsetDir%\sdpublic\sdk\lib\arm64
set INCLUDE=^
diff --git a/build.sh b/build.sh
index ae5e43672d..018cdf0439 100755
--- a/build.sh
+++ b/build.sh
@@ -118,6 +118,14 @@ check_prereqs()
# Check presence of CMake on the path
hash cmake 2>/dev/null || { echo >&2 "Please install cmake before running this script"; exit 1; }
+
+ # Minimum required version of clang is version 3.9 for arm/armel cross build
+ if [[ $__CrossBuild == 1 && ("$__BuildArch" == "arm" || "$__BuildArch" == "armel") ]]; then
+ if ! [[ "$__ClangMajorVersion" -gt "3" || ( $__ClangMajorVersion == 3 && $__ClangMinorVersion == 9 ) ]]; then
+ echo "Please install clang3.9 or latest for arm/armel cross build"; exit 1;
+ fi
+ fi
+
# Check for clang
hash clang-$__ClangMajorVersion.$__ClangMinorVersion 2>/dev/null || hash clang$__ClangMajorVersion$__ClangMinorVersion 2>/dev/null || hash clang 2>/dev/null || { echo >&2 "Please install clang-$__ClangMajorVersion.$__ClangMinorVersion before running this script"; exit 1; }
@@ -671,6 +679,11 @@ while :; do
__ClangMinorVersion=9
;;
+ clang4.0)
+ __ClangMajorVersion=4
+ __ClangMinorVersion=0
+ ;;
+
ninja)
__UseNinja=1
;;
@@ -732,7 +745,7 @@ while :; do
cmakeargs)
if [ -n "$2" ]; then
- __cmakeargs="$2"
+ __cmakeargs="$__cmakeargs $2"
shift
else
echo "ERROR: 'cmakeargs' requires a non-empty option argument"
@@ -780,8 +793,13 @@ fi
# Set default clang version
if [[ $__ClangMajorVersion == 0 && $__ClangMinorVersion == 0 ]]; then
if [ $__CrossBuild == 1 ]; then
- __ClangMajorVersion=3
- __ClangMinorVersion=6
+ if [[ "$__BuildArch" == "arm" || "$__BuildArch" == "armel" ]]; then
+ __ClangMajorVersion=3
+ __ClangMinorVersion=9
+ else
+ __ClangMajorVersion=3
+ __ClangMinorVersion=6
+ fi
else
__ClangMajorVersion=3
__ClangMinorVersion=5
diff --git a/buildpipeline/Dotnet-CoreClr-Trusted-BuildTests.json b/buildpipeline/Dotnet-CoreClr-Trusted-BuildTests.json
index f559d86ebd..3defd105e7 100644
--- a/buildpipeline/Dotnet-CoreClr-Trusted-BuildTests.json
+++ b/buildpipeline/Dotnet-CoreClr-Trusted-BuildTests.json
@@ -68,7 +68,7 @@
},
"inputs": {
"filename": "build-test.cmd",
- "arguments": "$(PB_BuildType) $(Architecture) buildagainstpackages $(RuntimeIDArg) -OfficialBuildId=$(OfficialBuildId) -Priority=$(Priority)",
+ "arguments": "$(PB_BuildType) $(Architecture) buildagainstpackages runtimeid $(Rid) $(TargetsNonWindowsArg)$(CrossgenArg)-OfficialBuildId=$(OfficialBuildId) -Priority=$(Priority)",
"workingFolder": "",
"failOnStandardError": "false"
}
@@ -86,7 +86,7 @@
},
"inputs": {
"filename": "msbuild",
- "arguments": "helixpublish.proj /p:CloudDropAccessToken=$(CloudDropAccessToken) /p:CloudDropAccountName=$(CloudDropAccountName) /p:ContainerName=$(PB_ContainerName) /p:Platform=$(Architecture) /p:BuildType=$(PB_BuildType) /p:CloudResultsAccountName=$(CloudResultsAccountName) /p:CloudResultsAccessToken=$(CloudResultsAccessToken) /p:TargetsWindows=$(TargetsWindows) /p:OverwriteOnUpload=true /p:Rid=$(Rid) /p:TargetQueues=\"$(TargetQueues)\" /p:TestProduct=$(TestProduct) /p:Branch=$(HelixBranch) /p:HelixApiAccessKey=$(HelixApiAccessKey) /p:HelixApiEndpoint=$(HelixApiEndpoint) /p:FilterToOSGroup=$(FilterToOSGroup) /p:FilterToTestTFM=$(FilterToTestTFM) /p:TimeoutInSeconds=3600 /fileloggerparameters:Verbosity=diag;LogFile=helix.log",
+ "arguments": "helixpublish.proj /p:CloudDropAccessToken=$(CloudDropAccessToken) /p:CloudDropAccountName=$(CloudDropAccountName) /p:ContainerName=$(PB_ContainerName) /p:Platform=$(Architecture) /p:BuildType=$(PB_BuildType) /p:CloudResultsAccountName=$(CloudResultsAccountName) /p:CloudResultsAccessToken=$(CloudResultsAccessToken) /p:TargetsWindows=$(TargetsWindows) /p:OverwriteOnUpload=true /p:Rid=$(Rid) /p:TargetQueues=\"$(TargetQueues)\" /p:TestProduct=$(TestProduct) /p:Branch=$(HelixBranch) /p:HelixApiAccessKey=$(HelixApiAccessKey) /p:HelixApiEndpoint=$(HelixApiEndpoint) /p:FilterToOSGroup=$(FilterToOSGroup) /p:FilterToTestTFM=$(FilterToTestTFM) /p:TimeoutInSeconds=1800 /p:HelixJobType=$(HelixJobType) /fileloggerparameters:Verbosity=diag;LogFile=helix.log",
"workingFolder": "tests",
"failOnStandardError": "false"
}
@@ -228,6 +228,12 @@
},
"RuntimeIDArg": {
"value": "runtimeid linux-x64"
+ },
+ "TargetsNonWindowsArg": {
+ "value": ""
+ },
+ "CrossgenArg": {
+ "value": ""
}
},
"retentionRules": [
diff --git a/buildpipeline/pipelines.json b/buildpipeline/pipelines.json
index a06f054c5a..5714717f1b 100644
--- a/buildpipeline/pipelines.json
+++ b/buildpipeline/pipelines.json
@@ -103,19 +103,6 @@
{
"Name": "DotNet-CoreClr-Trusted-Linux",
"Parameters": {
- "DockerTag": "alpine_prereqs",
- "Rid": "alpine.3.4.3"
- },
- "ReportingParameters": {
- "OperatingSystem": "Alpine 3.4.3",
- "Type": "build/product/",
- "Architecture": "x64",
- "PB_BuildType": null
- }
- },
- {
- "Name": "DotNet-CoreClr-Trusted-Linux",
- "Parameters": {
"DockerTag": "rhel7_prereqs_2",
"portableBuild": "-portable",
"Rid": "linux"
@@ -261,7 +248,7 @@
{
"Name": "DotNet-CoreClr-Trusted-Linux-Crossbuild",
"Parameters": {
- "DockerTag": "ubuntu1404_cross_prereqs_v2",
+ "DockerTag": "ubuntu-14.04-cross-0cd4667-20172211042239",
"Architecture": "arm",
"Rid": "ubuntu.14.04"
},
@@ -276,7 +263,7 @@
{
"Name": "DotNet-CoreClr-Trusted-Linux-Crossbuild",
"Parameters": {
- "DockerTag": "ubuntu1404_cross_prereqs_v2",
+ "DockerTag": "ubuntu-14.04-cross-0cd4667-20172211042239",
"Architecture": "arm",
"portableBuild": "-portable",
"Rid": "ubuntu.14.04"
@@ -292,7 +279,7 @@
{
"Name": "DotNet-CoreClr-Trusted-Linux-Crossbuild",
"Parameters": {
- "DockerTag": "ubuntu1604_cross_prereqs_v2",
+ "DockerTag": "ubuntu-16.04-cross-ef0ac75-20175511035548",
"Architecture": "arm",
"Rid": "ubuntu.16.04"
},
@@ -493,11 +480,11 @@
{
"Name": "Dotnet-CoreClr-Trusted-BuildTests",
"Parameters": {
+ "HelixJobType": "test/functional/cli/",
"TargetsWindows": "true",
- "Rid": "windows_nt-x64",
+ "Rid": "win-x64",
"TargetQueues": "windows.10.amd64",
- "TestContainerSuffix": "windows10",
- "RuntimeIDArg": " "
+ "TestContainerSuffix": "windows",
},
"ReportingParameters": {
"OperatingSystem": "Windows",
@@ -509,11 +496,29 @@
{
"Name": "Dotnet-CoreClr-Trusted-BuildTests",
"Parameters": {
+ "HelixJobType": "test/functional/r2r/cli/",
+ "TargetsWindows": "true",
+ "Rid": "win-x64",
+ "TargetQueues": "windows.10.amd64",
+ "TestContainerSuffix": "windows-r2r",
+ "CrossgenArg": "Crossgen "
+ },
+ "ReportingParameters": {
+ "OperatingSystem": "Windows",
+ "SubType": "Build-Tests-R2R",
+ "Type": "build/product/",
+ "PB_BuildType": "Release"
+ }
+ },
+ {
+ "Name": "Dotnet-CoreClr-Trusted-BuildTests",
+ "Parameters": {
+ "HelixJobType": "test/functional/cli/",
"TargetsWindows": "false",
- "Rid": "osx.10.12-x64",
+ "Rid": "osx-x64",
"TargetQueues": "osx.1012.amd64",
- "TestContainerSuffix": "osx1012",
- "RuntimeIDArg": "runtimeid osx.10.12-x64"
+ "TestContainerSuffix": "osx",
+ "TargetsNonWindowsArg": "TargetsNonWindows "
},
"ReportingParameters": {
"OperatingSystem": "OSX",
@@ -525,11 +530,30 @@
{
"Name": "Dotnet-CoreClr-Trusted-BuildTests",
"Parameters": {
+ "HelixJobType": "test/functional/r2r/cli/",
+ "TargetsWindows": "false",
+ "Rid": "osx-x64",
+ "TargetQueues": "osx.1012.amd64",
+ "TestContainerSuffix": "osx-r2r",
+ "CrossgenArg": "Crossgen ",
+ "TargetsNonWindowsArg": "TargetsNonWindows "
+ },
+ "ReportingParameters": {
+ "OperatingSystem": "OSX",
+ "SubType": "Build-Tests-R2R",
+ "Type": "build/product/",
+ "PB_BuildType": "Release"
+ }
+ },
+ {
+ "Name": "Dotnet-CoreClr-Trusted-BuildTests",
+ "Parameters": {
+ "HelixJobType": "test/functional/cli/",
"TargetsWindows": "false",
"Rid": "linux-x64",
"TargetQueues": "debian.82.amd64,fedora.25.amd64,redhat.72.amd64,ubuntu.1404.amd64,ubuntu.1604.amd64,ubuntu.1610.amd64",
"TestContainerSuffix": "linux",
- "RuntimeIDArg": "runtimeid linux-x64"
+ "TargetsNonWindowsArg": "TargetsNonWindows "
},
"ReportingParameters": {
"OperatingSystem": "RedHat 7",
@@ -537,6 +561,24 @@
"Type": "build/product/",
"PB_BuildType": "Release"
}
+ },
+ {
+ "Name": "Dotnet-CoreClr-Trusted-BuildTests",
+ "Parameters": {
+ "HelixJobType": "test/functional/r2r/cli/",
+ "TargetsWindows": "false",
+ "Rid": "linux-x64",
+ "TargetQueues": "debian.82.amd64,fedora.25.amd64,redhat.72.amd64,ubuntu.1404.amd64,ubuntu.1604.amd64,ubuntu.1610.amd64",
+ "TestContainerSuffix": "linux-r2r",
+ "CrossgenArg": "Crossgen ",
+ "TargetsNonWindowsArg": "TargetsNonWindows "
+ },
+ "ReportingParameters": {
+ "OperatingSystem": "RedHat 7",
+ "SubType": "Build-Tests-R2R",
+ "Type": "build/product/",
+ "PB_BuildType": "Release"
+ }
}
],
"DependsOn": [
diff --git a/clrdefinitions.cmake b/clrdefinitions.cmake
index c4bfb8ea39..838be56f62 100644
--- a/clrdefinitions.cmake
+++ b/clrdefinitions.cmake
@@ -4,12 +4,7 @@ else()
set(CLR_BUILD_JIT32 0)
endif()
-if (WIN32)
- set(FEATURE_EVENT_TRACE 1)
-endif()
-if(CLR_CMAKE_PLATFORM_LINUX AND CLR_CMAKE_TARGET_ARCH_AMD64)
- set(FEATURE_EVENT_TRACE 1)
-endif()
+include(clrfeatures.cmake)
if (CLR_CMAKE_TARGET_ARCH_AMD64)
if (CLR_CMAKE_PLATFORM_UNIX)
@@ -115,10 +110,10 @@ if (CLR_CMAKE_PLATFORM_UNIX)
endif(CLR_CMAKE_PLATFORM_UNIX)
add_definitions(-DFEATURE_CORESYSTEM)
add_definitions(-DFEATURE_CORRUPTING_EXCEPTIONS)
-if(CLR_CMAKE_PLATFORM_UNIX AND (NOT CLR_CMAKE_PLATFORM_ANDROID))
- add_definitions(-DFEATURE_DBGIPC_TRANSPORT_DI)
- add_definitions(-DFEATURE_DBGIPC_TRANSPORT_VM)
-endif(CLR_CMAKE_PLATFORM_UNIX AND (NOT CLR_CMAKE_PLATFORM_ANDROID))
+if(FEATURE_DBGIPC)
+ add_definitions(-DFEATURE_DBGIPC_TRANSPORT_DI)
+ add_definitions(-DFEATURE_DBGIPC_TRANSPORT_VM)
+endif(FEATURE_DBGIPC)
if(FEATURE_EVENT_TRACE)
add_definitions(-DFEATURE_EVENT_TRACE=1)
endif(FEATURE_EVENT_TRACE)
@@ -139,6 +134,9 @@ if (CLR_CMAKE_PLATFORM_UNIX OR CLR_CMAKE_TARGET_ARCH_ARM64)
add_definitions(-DFEATURE_IMPLICIT_TLS)
set(FEATURE_IMPLICIT_TLS 1)
endif(CLR_CMAKE_PLATFORM_UNIX OR CLR_CMAKE_TARGET_ARCH_ARM64)
+if(FEATURE_INTERPRETER)
+ add_definitions(-DFEATURE_INTERPRETER)
+endif(FEATURE_INTERPRETER)
add_definitions(-DFEATURE_ISYM_READER)
add_definitions(-DFEATURE_LOADER_OPTIMIZATION)
if (NOT CLR_CMAKE_PLATFORM_UNIX)
diff --git a/clrfeatures.cmake b/clrfeatures.cmake
new file mode 100644
index 0000000000..9991b60ed7
--- /dev/null
+++ b/clrfeatures.cmake
@@ -0,0 +1,27 @@
+if(CLR_CMAKE_TARGET_TIZEN_LINUX)
+ set(FEATURE_EVENT_TRACE 0)
+endif()
+
+if(NOT DEFINED FEATURE_EVENT_TRACE)
+ if (WIN32)
+ set(FEATURE_EVENT_TRACE 1)
+ endif()
+
+ if(CLR_CMAKE_PLATFORM_LINUX)
+ if(CLR_CMAKE_TARGET_ARCH_AMD64)
+ set(FEATURE_EVENT_TRACE 1)
+ elseif(CLR_CMAKE_TARGET_ARCH_ARM)
+ set(FEATURE_EVENT_TRACE 1)
+ endif()
+ endif(CLR_CMAKE_PLATFORM_LINUX)
+endif(NOT DEFINED FEATURE_EVENT_TRACE)
+
+if(NOT DEFINED FEATURE_DBGIPC)
+ if(CLR_CMAKE_PLATFORM_UNIX AND (NOT CLR_CMAKE_PLATFORM_ANDROID))
+ set(FEATURE_DBGIPC 1)
+ endif()
+endif(NOT DEFINED FEATURE_DBGIPC)
+
+if(NOT DEFINED FEATURE_INTERPRETER)
+ set(FEATURE_INTERPRETER 0)
+endif(NOT DEFINED FEATURE_INTERPRETER)
diff --git a/config.json b/config.json
index 64066cb124..c975171055 100644
--- a/config.json
+++ b/config.json
@@ -192,6 +192,18 @@
"values": [ true, false ],
"defaultValue": false
},
+ "RestoreDefaultOptimizationDataPackage": {
+ "description": "Instructs BuildTools to restore the default OptimizationData package.",
+ "valueType": "property",
+ "values": [ true, false ],
+ "defaultValue": true
+ },
+ "UsePartialNGENOptimization": {
+ "description": "Adds the `-partialNGEN -minify` arguments when invoking IBCMerge.",
+ "valueType": "property",
+ "values": [ true, false ],
+ "defaultValue": true
+ },
"OptimizationDataDir": {
"description": "Sets the path where the build should look for IBC profile data.",
"valueType": "property",
@@ -312,6 +324,12 @@
"values": [ true, false ],
"defaultValue": true
},
+ "TargetsWindows": {
+ "description": "Sets the property specifying if the tests we're building will target Windows",
+ "valueType": "property",
+ "values": [ true, false ],
+ "defaultValue": true
+ },
"PublishTestNativeBins": {
"description": "Publishes test native binaries to Azure on non-windows",
"valueType": "property",
@@ -324,6 +342,12 @@
"values": [ true, false ],
"defaultValue": true
},
+ "Crossgen": {
+ "description": "Determines if we're running Crossgen tests",
+ "valueType": "property",
+ "values": [ true, false ],
+ "defaultValue": true
+ },
"RuntimeId": {
"description": "Specifies the OS to build Core_Root for",
"valueType": "property",
@@ -469,7 +493,9 @@
"MsBuildLog": "default",
"MsBuildWrn": "default",
"MsBuildErr": "default",
- "MsBuildEventLogging": "default"
+ "MsBuildEventLogging": "default",
+ "RestoreDefaultOptimizationDataPackage": "false",
+ "UsePartialNGENOptimization": "false"
}
}
},
diff --git a/cross/x86/tryrun.cmake b/cross/x86/tryrun.cmake
index cfc52087c2..1bf3da935c 100644
--- a/cross/x86/tryrun.cmake
+++ b/cross/x86/tryrun.cmake
@@ -55,7 +55,7 @@ SET( HAVE_COMPATIBLE_ASIN_EXITCODE
CACHE STRING "Result from TRY_RUN" FORCE)
SET( HAVE_COMPATIBLE_POW_EXITCODE
- 1
+ 0
CACHE STRING "Result from TRY_RUN" FORCE)
SET( HAVE_VALID_NEGATIVE_INF_POW_EXITCODE
diff --git a/dependencies.props b/dependencies.props
index 0221036f72..c06c465d52 100644
--- a/dependencies.props
+++ b/dependencies.props
@@ -1,18 +1,18 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Source of truth for dependency tooling: the commit hash of the dotnet/versions master branch as of the last auto-upgrade. -->
<PropertyGroup>
- <CoreFxCurrentRef>e92f146e291cdddd764887db41dcdf95263300a8</CoreFxCurrentRef>
- <CoreClrCurrentRef>07f76bae460357bfea01929910911531ec50e15c</CoreClrCurrentRef>
+ <CoreFxCurrentRef>947e90b41c30a1f0a906f8d996443233c2ceedf4</CoreFxCurrentRef>
+ <CoreClrCurrentRef>947e90b41c30a1f0a906f8d996443233c2ceedf4</CoreClrCurrentRef>
</PropertyGroup>
<!-- Auto-upgraded properties for each build info dependency. -->
<PropertyGroup>
- <CoreFxExpectedPrerelease>preview1-25210-01</CoreFxExpectedPrerelease>
+ <CoreFxExpectedPrerelease>preview1-25221-01</CoreFxExpectedPrerelease>
</PropertyGroup>
<!-- Full package version strings that are used in other parts of the build. -->
<PropertyGroup>
- <CoreClrPackageVersion>2.0.0-preview1-25212-04</CoreClrPackageVersion>
+ <CoreClrPackageVersion>2.0.0-preview1-25221-01</CoreClrPackageVersion>
<XunitPackageVersion>2.2.0-beta2-build3300</XunitPackageVersion>
</PropertyGroup>
diff --git a/dir.props b/dir.props
index 46244857e7..496888476a 100644
--- a/dir.props
+++ b/dir.props
@@ -138,7 +138,7 @@
<!-- Packaging properties -->
<PropertyGroup>
- <PreReleaseLabel>preview1</PreReleaseLabel>
+ <PreReleaseLabel>preview2</PreReleaseLabel>
<PackageDescriptionFile>$(SourceDir).nuget/descriptions.json</PackageDescriptionFile>
<PackageLicenseFile>$(SourceDir).nuget/dotnet_library_license.txt</PackageLicenseFile>
<PackageThirdPartyNoticesFile>$(SourceDir).nuget/ThirdPartyNotices.txt</PackageThirdPartyNoticesFile>
diff --git a/netci.groovy b/netci.groovy
index 05e5d7fa7d..9e0339a366 100755
--- a/netci.groovy
+++ b/netci.groovy
@@ -1640,6 +1640,11 @@ def static calculateBuildCommands(def newJob, def scenario, def branch, def isPR
if (os != 'Tizen') {
buildCommands += "chmod a+x ./bin/CoreFxBinDir/corerun"
}
+ // Test environment emulation using docker and qemu has some problem to use lttng library.
+ // We should remove libcoreclrtraceptprovider.so to avoid test hang.
+ if (os == 'Ubuntu') {
+ buildCommands += "rm -f -v ./bin/CoreFxBinDir/libcoreclrtraceptprovider.so"
+ }
// Call the ARM CI script to cross build and test using docker
buildCommands += """./tests/scripts/arm32_ci_script.sh \\
@@ -2160,7 +2165,7 @@ combinedScenarios.each { scenario ->
if (testBuildScenario == 'coverage' || testBuildScenario == 'pri1r2r'|| testBuildScenario == 'gcstress15_pri1r2r') {
testBuildScenario = 'pri1'
}
- else if ( testBuildScenario == 'r2r' || isLongGc(testBuildScenario)) {
+ else if ( testBuildScenario == 'r2r' || Constants.r2rJitStressScenarios.indexOf(testBuildScenario) != -1 || isLongGc(testBuildScenario)) {
testBuildScenario = 'default'
}
def inputWindowTestsBuildName = ''
diff --git a/perf.groovy b/perf.groovy
index cb454b33e0..5a88ff13d2 100644
--- a/perf.groovy
+++ b/perf.groovy
@@ -69,7 +69,9 @@ def static getOSGroup(def os) {
//Do this here to remove the origin but at the front of the branch name as this is a problem for BenchView
//we have to do it all as one statement because cmd is called each time and we lose the set environment variable
batchFile("if [%GIT_BRANCH:~0,7%] == [origin/] (set GIT_BRANCH_WITHOUT_ORIGIN=%GIT_BRANCH:origin/=%) else (set GIT_BRANCH_WITHOUT_ORIGIN=%GIT_BRANCH%)\n" +
- "py \"%WORKSPACE%\\Microsoft.BenchView.JSONFormat\\tools\\submission-metadata.py\" --name \"${benchViewName}\" --user \"dotnet-bot@microsoft.com\"\n" +
+ "set BENCHVIEWNAME=${benchViewName}\n" +
+ "set BENCHVIEWNAME=%BENCHVIEWNAME:\"=%\n" +
+ "py \"%WORKSPACE%\\Microsoft.BenchView.JSONFormat\\tools\\submission-metadata.py\" --name \"%BENCHVIEWNAME%\" --user \"dotnet-bot@microsoft.com\"\n" +
"py \"%WORKSPACE%\\Microsoft.BenchView.JSONFormat\\tools\\build.py\" git --branch %GIT_BRANCH_WITHOUT_ORIGIN% --type ${runType}")
batchFile("py \"%WORKSPACE%\\Microsoft.BenchView.JSONFormat\\tools\\machinedata.py\"")
batchFile("set __TestIntermediateDir=int&&build.cmd ${configuration} ${architecture}")
@@ -162,6 +164,8 @@ def static getOSGroup(def os) {
//Do this here to remove the origin but at the front of the branch name as this is a problem for BenchView
//we have to do it all as one statement because cmd is called each time and we lose the set environment variable
batchFile("if [%GIT_BRANCH:~0,7%] == [origin/] (set GIT_BRANCH_WITHOUT_ORIGIN=%GIT_BRANCH:origin/=%) else (set GIT_BRANCH_WITHOUT_ORIGIN=%GIT_BRANCH%)\n" +
+ "set BENCHVIEWNAME=${benchViewName}\n" +
+ "set BENCHVIEWNAME=%BENCHVIEWNAME:\"=%\n" +
"py \"%WORKSPACE%\\Microsoft.BenchView.JSONFormat\\tools\\submission-metadata.py\" --name \"${benchViewName}\" --user \"dotnet-bot@microsoft.com\"\n" +
"py \"%WORKSPACE%\\Microsoft.BenchView.JSONFormat\\tools\\build.py\" git --branch %GIT_BRANCH_WITHOUT_ORIGIN% --type ${runType}")
batchFile("py \"%WORKSPACE%\\Microsoft.BenchView.JSONFormat\\tools\\machinedata.py\"")
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 db8b03173b..4ad2538826 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 d13e8f9a85..9598d0c36b 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 6b2061a577..a92b173569 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 8ba0ade1d8..ff5f86455c 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 ed811b6572..a8cc71228b 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 5ab2b311cc..517227c092 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 2b54b4f037..0d5d8c3b8b 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 4612acc299..6d0e79622c 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 247c70033b..f0c2176fe2 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 4ca7ce37f3..64d198cb5f 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 ea6a4a3e72..cc2244d870 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 a04969696b..442f2a4098 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 d2debdd90f..7026ff55a3 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 3f018b3a45..ffefd55d99 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 693366ef91..b3873b24e7 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 36620f11b2..a41e55d00b 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 26e55857bd..85674ff7d9 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 290cbdbac5..7a04abced6 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 32f4b0d661..4c0f295276 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 3fc8268f5f..2acd2b636d 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 129b8d8440..93e0854cdf 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 2837f0bf3e..f9cc69effa 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 c2ea880b52..dffb4b4373 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 bcc6d04e1d..68cc7affbf 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 feddbe1908..f156be198d 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 23b68da003..d46ad2b20b 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 e947fcf40c..d93b9ac1a5 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 9b1057769a..851ed9ce3e 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 d45ea15307..3dfded4fd8 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 c4acfd8769..c074fdd1f6 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 1d612426f3..222669dac0 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 eca5dc1b09..cd2ead0632 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 ab0cb98692..e4cbad841a 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 9b881cdcbf..a9425bd11c 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 994695da79..c595ecbf4e 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 473f452f96..137451944d 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 53a3a78d6f..8e74c257e6 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 8783b1a767..352ef04e93 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 9db77736a8..c7b62553ad 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 a99fbf0183..5fcf4ce6f5 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 7eea371191..aa4f48158a 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 240e228c1e..8fc944ac90 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 d848d60e20..683deed820 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 027929bec0..42b9df5335 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 f428d77795..f0978d0def 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 b15c51f28a..918d87ae5c 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 87853f4cd3..ebb1e7f512 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 0000000000..ca542fb234
--- /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 ad871db4ce..7131471c11 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 412bf97ba6..8c0cadd8b8 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 0e36562076..28d67c20d1 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 8bd09e5331..aac68421e7 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 0c5b269899..19feffab47 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 860f545fac..12e7100c2b 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 69c321bb39..bd7de08da1 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 a2c388ee3e..dbde4af3fc 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 511893fc96..b8141a57bd 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 93b2879569..dd5073bbc0 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 8638e0d825..e60ef83fc9 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;
+ pResult->exactContextNeedsRuntimeLookup = (BOOL)value.exactContextNeedsRuntimeLookup;
pResult->stubLookup.lookupKind.needsRuntimeLookup = value.stubLookup.lookupKind.needsRuntimeLookup != 0;
- pResult->stubLookup.lookupKind.runtimeLookupKind = (CORINFO_RUNTIME_LOOKUP_KIND)value.stubLookup.lookupKind.runtimeLookupKind;
+ pResult->stubLookup.lookupKind.runtimeLookupKind =
+ (CORINFO_RUNTIME_LOOKUP_KIND)value.stubLookup.lookupKind.runtimeLookupKind;
if (pResult->stubLookup.lookupKind.needsRuntimeLookup)
{
- pResult->stubLookup.runtimeLookup.signature = (LPVOID)value.stubLookup.runtimeLookup.signature; // needs to be a more flexible copy based on valuevalue.stubLookup.runtimeLookup.signature;
- pResult->stubLookup.runtimeLookup.helper = (CorInfoHelpFunc)value.stubLookup.runtimeLookup.helper;
+ pResult->stubLookup.runtimeLookup.signature =
+ (LPVOID)value.stubLookup.runtimeLookup.signature; // needs to be a more flexible copy based on
+ // valuevalue.stubLookup.runtimeLookup.signature;
+ pResult->stubLookup.runtimeLookup.helper = (CorInfoHelpFunc)value.stubLookup.runtimeLookup.helper;
pResult->stubLookup.runtimeLookup.indirections = (WORD)value.stubLookup.runtimeLookup.indirections;
- pResult->stubLookup.runtimeLookup.testForNull = value.stubLookup.runtimeLookup.testForNull != 0;
+ pResult->stubLookup.runtimeLookup.testForNull = value.stubLookup.runtimeLookup.testForNull != 0;
pResult->stubLookup.runtimeLookup.testForFixup = value.stubLookup.runtimeLookup.testForFixup != 0;
- for (int i = 0; i < CORINFO_MAXINDIRECTIONS; i++)
+ for (int i = 0; i < CORINFO_MAXINDIRECTIONS; i++)
pResult->stubLookup.runtimeLookup.offsets[i] = (SIZE_T)value.stubLookup.runtimeLookup.offsets[i];
}
else
{
pResult->stubLookup.constLookup.accessType = (InfoAccessType)value.stubLookup.constLookup.accessType;
- pResult->stubLookup.constLookup.handle = (CORINFO_GENERIC_HANDLE)value.stubLookup.constLookup.handle;
+ pResult->stubLookup.constLookup.handle = (CORINFO_GENERIC_HANDLE)value.stubLookup.constLookup.handle;
}
if (pResult->kind == CORINFO_VIRTUALCALL_STUB)
{
- cr->CallTargetTypes->Add((DWORDLONG)pResult->codePointerLookup.constLookup.addr, (DWORD)CORINFO_VIRTUALCALL_STUB);
+ cr->CallTargetTypes->Add((DWORDLONG)pResult->codePointerLookup.constLookup.addr,
+ (DWORD)CORINFO_VIRTUALCALL_STUB);
}
pResult->instParamLookup.accessType = (InfoAccessType)value.instParamLookup.accessType;
- pResult->instParamLookup.handle = (CORINFO_GENERIC_HANDLE)value.instParamLookup.handle;
- pResult->secureDelegateInvoke = (BOOL)value.secureDelegateInvoke;
- *exceptionCode = (DWORD)value.exceptionCode;
+ pResult->instParamLookup.handle = (CORINFO_GENERIC_HANDLE)value.instParamLookup.handle;
+ pResult->secureDelegateInvoke = (BOOL)value.secureDelegateInvoke;
+ *exceptionCode = (DWORD)value.exceptionCode;
DEBUG_REP(dmpGetCallInfo(key, value));
}
@@ -1727,24 +1794,24 @@ void MethodContext::repGetCallInfo(
// If this fails to find a recorded call to getCallInfo with the given method handle, this will throw an
// exception.
//
-void MethodContext::repGetCallInfoFromMethodHandle(CORINFO_METHOD_HANDLE methodHandle, CORINFO_CALL_INFO *pResult)
+void MethodContext::repGetCallInfoFromMethodHandle(CORINFO_METHOD_HANDLE methodHandle, CORINFO_CALL_INFO* pResult)
{
if (GetCallInfo != nullptr)
{
for (unsigned int i = 0; i < GetCallInfo->GetCount(); i++)
{
- Agnostic_GetCallInfo key = GetCallInfo->GetKey(i);
+ Agnostic_GetCallInfo key = GetCallInfo->GetKey(i);
Agnostic_CORINFO_CALL_INFO val = GetCallInfo->GetItem(i);
if ((CORINFO_METHOD_HANDLE)val.hMethod == methodHandle)
{
CORINFO_RESOLVED_TOKEN resolvedToken;
- DWORD exceptionCode;
+ DWORD exceptionCode;
resolvedToken.tokenContext = (CORINFO_CONTEXT_HANDLE)key.ResolvedToken.tokenContext;
- resolvedToken.tokenScope = (CORINFO_MODULE_HANDLE)key.ResolvedToken.tokenScope;
- resolvedToken.token = (mdToken)key.ResolvedToken.token;
- resolvedToken.tokenType = (CorInfoTokenKind)key.ResolvedToken.tokenType;
+ resolvedToken.tokenScope = (CORINFO_MODULE_HANDLE)key.ResolvedToken.tokenScope;
+ resolvedToken.token = (mdToken)key.ResolvedToken.token;
+ resolvedToken.tokenType = (CorInfoTokenKind)key.ResolvedToken.tokenType;
repResolveToken(&resolvedToken, &exceptionCode);
@@ -1752,27 +1819,24 @@ void MethodContext::repGetCallInfoFromMethodHandle(CORINFO_METHOD_HANDLE methodH
// then we won't be able to replay it. In that case, we'll need to pass a null pointer into
// repGetCallInfo for constrainedResolvedToken, instead of just passing the address of our
// local (but meaningless) constrainedResolvedToken struct.
- CORINFO_RESOLVED_TOKEN constrainedResolvedToken;
- CORINFO_RESOLVED_TOKEN *pConstrainedResolvedToken = nullptr;
+ CORINFO_RESOLVED_TOKEN constrainedResolvedToken;
+ CORINFO_RESOLVED_TOKEN* pConstrainedResolvedToken = nullptr;
- if (key.ConstrainedResolvedToken.tokenContext != 0 &&
- key.ConstrainedResolvedToken.tokenScope != 0)
+ if (key.ConstrainedResolvedToken.tokenContext != 0 && key.ConstrainedResolvedToken.tokenScope != 0)
{
- constrainedResolvedToken.tokenContext = (CORINFO_CONTEXT_HANDLE)key.ConstrainedResolvedToken.tokenContext;
- constrainedResolvedToken.tokenScope = (CORINFO_MODULE_HANDLE)key.ConstrainedResolvedToken.tokenScope;
- constrainedResolvedToken.token = (mdToken)key.ConstrainedResolvedToken.token;
+ constrainedResolvedToken.tokenContext =
+ (CORINFO_CONTEXT_HANDLE)key.ConstrainedResolvedToken.tokenContext;
+ constrainedResolvedToken.tokenScope =
+ (CORINFO_MODULE_HANDLE)key.ConstrainedResolvedToken.tokenScope;
+ constrainedResolvedToken.token = (mdToken)key.ConstrainedResolvedToken.token;
constrainedResolvedToken.tokenType = (CorInfoTokenKind)key.ConstrainedResolvedToken.tokenType;
- pConstrainedResolvedToken = &constrainedResolvedToken;
+ pConstrainedResolvedToken = &constrainedResolvedToken;
repResolveToken(pConstrainedResolvedToken, &exceptionCode);
}
- repGetCallInfo(&resolvedToken,
- pConstrainedResolvedToken,
- (CORINFO_METHOD_HANDLE)key.callerHandle,
- (CORINFO_CALLINFO_FLAGS)key.flags,
- pResult,
- &exceptionCode);
+ repGetCallInfo(&resolvedToken, pConstrainedResolvedToken, (CORINFO_METHOD_HANDLE)key.callerHandle,
+ (CORINFO_CALLINFO_FLAGS)key.flags, pResult, &exceptionCode);
return;
}
}
@@ -1782,14 +1846,13 @@ void MethodContext::repGetCallInfoFromMethodHandle(CORINFO_METHOD_HANDLE methodH
LogException(EXCEPTIONCODE_MC, "Didn't find key %016llX.", methodHandle);
}
-
void MethodContext::recGetIntrinsicID(CORINFO_METHOD_HANDLE method, bool* pMustExpand, CorInfoIntrinsics result)
{
if (GetIntrinsicID == nullptr)
GetIntrinsicID = new LightWeightMap<DWORDLONG, DD>();
DD value;
- value.A = (pMustExpand != nullptr) ? (DWORD) (*pMustExpand ? 1 : 0) : (DWORD)0;
+ value.A = (pMustExpand != nullptr) ? (DWORD)(*pMustExpand ? 1 : 0) : (DWORD)0;
value.B = (DWORD)result;
GetIntrinsicID->Add((DWORDLONG)method, value);
@@ -1802,7 +1865,8 @@ void MethodContext::dmpGetIntrinsicID(DWORDLONG key, DD value)
CorInfoIntrinsics MethodContext::repGetIntrinsicID(CORINFO_METHOD_HANDLE method, bool* pMustExpand)
{
AssertCodeMsg(GetIntrinsicID != nullptr, EXCEPTIONCODE_MC, "Didn't find anything for %016llX", (DWORDLONG)method);
- AssertCodeMsg(GetIntrinsicID->GetIndex((DWORDLONG)method) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX", (DWORDLONG)method);
+ AssertCodeMsg(GetIntrinsicID->GetIndex((DWORDLONG)method) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX",
+ (DWORDLONG)method);
DD value;
value = GetIntrinsicID->Get((DWORDLONG)method);
@@ -1831,7 +1895,8 @@ void MethodContext::dmpIsInSIMDModule(DWORDLONG key, DWORD value)
BOOL MethodContext::repIsInSIMDModule(CORINFO_CLASS_HANDLE cls)
{
AssertCodeMsg(IsInSIMDModule != nullptr, EXCEPTIONCODE_MC, "Didn't find anything for %016llX", (DWORDLONG)cls);
- AssertCodeMsg(IsInSIMDModule->GetIndex((DWORDLONG)cls) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX", (DWORDLONG)cls);
+ AssertCodeMsg(IsInSIMDModule->GetIndex((DWORDLONG)cls) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX",
+ (DWORDLONG)cls);
BOOL result = (BOOL)IsInSIMDModule->Get((DWORDLONG)cls);
DEBUG_REP(dmpIsInSIMDModule((DWORDLONG)cls, (DWORD)result));
return result;
@@ -1857,7 +1922,8 @@ CorInfoUnmanagedCallConv MethodContext::repGetUnmanagedCallConv(CORINFO_METHOD_H
LogDebug("Sparse - repGetUnmanagedCallConv returning CORINFO_UNMANAGED_CALLCONV_STDCALL");
return CORINFO_UNMANAGED_CALLCONV_STDCALL;
#else
- LogException(EXCEPTIONCODE_MC, "Found a null GetUnmanagedCallConv. Probably missing a fatTrigger for %016llX.", (DWORDLONG)method);
+ LogException(EXCEPTIONCODE_MC, "Found a null GetUnmanagedCallConv. Probably missing a fatTrigger for %016llX.",
+ (DWORDLONG)method);
#endif
}
CorInfoUnmanagedCallConv result = (CorInfoUnmanagedCallConv)GetUnmanagedCallConv->Get((DWORDLONG)method);
@@ -1865,7 +1931,8 @@ CorInfoUnmanagedCallConv MethodContext::repGetUnmanagedCallConv(CORINFO_METHOD_H
return result;
}
-void MethodContext::recIsInstantiationOfVerifiedGeneric(CORINFO_METHOD_HANDLE method, CorInfoInstantiationVerification result)
+void MethodContext::recIsInstantiationOfVerifiedGeneric(CORINFO_METHOD_HANDLE method,
+ CorInfoInstantiationVerification result)
{
if (IsInstantiationOfVerifiedGeneric == nullptr)
IsInstantiationOfVerifiedGeneric = new LightWeightMap<DWORDLONG, DWORD>();
@@ -1879,7 +1946,8 @@ void MethodContext::dmpIsInstantiationOfVerifiedGeneric(DWORDLONG key, DWORD val
}
CorInfoInstantiationVerification MethodContext::repIsInstantiationOfVerifiedGeneric(CORINFO_METHOD_HANDLE method)
{
- CorInfoInstantiationVerification result = (CorInfoInstantiationVerification)IsInstantiationOfVerifiedGeneric->Get((DWORDLONG)method);
+ CorInfoInstantiationVerification result =
+ (CorInfoInstantiationVerification)IsInstantiationOfVerifiedGeneric->Get((DWORDLONG)method);
DEBUG_REP(dmpIsInstantiationOfVerifiedGeneric((DWORDLONG)method, (DWORD)result));
return result;
}
@@ -1898,8 +1966,8 @@ void MethodContext::dmpAsCorInfoType(DWORDLONG key, DWORD value)
}
CorInfoType MethodContext::repAsCorInfoType(CORINFO_CLASS_HANDLE cls)
{
- AssertCodeMsg((AsCorInfoType != nullptr) && (AsCorInfoType->GetIndex((DWORDLONG)cls) != -1),
- EXCEPTIONCODE_MC, "Didn't find %016llX. Probable cached value in JIT issue", (DWORDLONG)cls);
+ AssertCodeMsg((AsCorInfoType != nullptr) && (AsCorInfoType->GetIndex((DWORDLONG)cls) != -1), EXCEPTIONCODE_MC,
+ "Didn't find %016llX. Probable cached value in JIT issue", (DWORDLONG)cls);
CorInfoType result = (CorInfoType)AsCorInfoType->Get((DWORDLONG)cls);
DEBUG_REP(dmpAsCorInfoType((DWORDLONG)cls, (DWORD)result));
return result;
@@ -1919,8 +1987,8 @@ void MethodContext::dmpIsValueClass(DWORDLONG key, DWORD value)
}
BOOL MethodContext::repIsValueClass(CORINFO_CLASS_HANDLE cls)
{
- AssertCodeMsg((IsValueClass != nullptr) && (IsValueClass->GetIndex((DWORDLONG)cls) != -1),
- EXCEPTIONCODE_MC, "Didn't find %016llX", (DWORDLONG)cls);
+ AssertCodeMsg((IsValueClass != nullptr) && (IsValueClass->GetIndex((DWORDLONG)cls) != -1), EXCEPTIONCODE_MC,
+ "Didn't find %016llX", (DWORDLONG)cls);
BOOL result = (BOOL)IsValueClass->Get((DWORDLONG)cls);
DEBUG_REP(dmpIsValueClass((DWORDLONG)cls, (DWORD)result));
@@ -1941,8 +2009,11 @@ void MethodContext::dmpIsStructRequiringStackAllocRetBuf(DWORDLONG key, DWORD va
}
BOOL MethodContext::repIsStructRequiringStackAllocRetBuf(CORINFO_CLASS_HANDLE cls)
{
- AssertCodeMsg(IsStructRequiringStackAllocRetBuf != nullptr, EXCEPTIONCODE_MC, "Found a null IsStructRequiringStackAllocRetBuf. Probably missing a fatTrigger for %016llX.", (DWORDLONG)cls);
- AssertCodeMsg(IsStructRequiringStackAllocRetBuf->GetIndex((DWORDLONG)cls) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX", (DWORDLONG)cls);
+ AssertCodeMsg(IsStructRequiringStackAllocRetBuf != nullptr, EXCEPTIONCODE_MC,
+ "Found a null IsStructRequiringStackAllocRetBuf. Probably missing a fatTrigger for %016llX.",
+ (DWORDLONG)cls);
+ AssertCodeMsg(IsStructRequiringStackAllocRetBuf->GetIndex((DWORDLONG)cls) != -1, EXCEPTIONCODE_MC,
+ "Didn't find %016llX", (DWORDLONG)cls);
BOOL result = (BOOL)IsStructRequiringStackAllocRetBuf->Get((DWORDLONG)cls);
DEBUG_REP(dmpIsStructRequiringStackAllocRetBuf((DWORDLONG)cls, (DWORD)result));
return result;
@@ -1963,7 +2034,8 @@ void MethodContext::dmpGetClassSize(DWORDLONG key, DWORD val)
unsigned MethodContext::repGetClassSize(CORINFO_CLASS_HANDLE cls)
{
AssertCodeMsg(GetClassSize != nullptr, EXCEPTIONCODE_MC, "Didn't find %016llX", (DWORDLONG)cls);
- AssertCodeMsg(GetClassSize->GetIndex((DWORDLONG)cls) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX", (DWORDLONG)cls);
+ AssertCodeMsg(GetClassSize->GetIndex((DWORDLONG)cls) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX",
+ (DWORDLONG)cls);
unsigned result = (unsigned)GetClassSize->Get((DWORDLONG)cls);
DEBUG_REP(dmpGetClassSize((DWORDLONG)cls, (DWORD)result));
return result;
@@ -1983,8 +2055,10 @@ void MethodContext::dmpGetClassNumInstanceFields(DWORDLONG key, DWORD value)
}
unsigned MethodContext::repGetClassNumInstanceFields(CORINFO_CLASS_HANDLE cls)
{
- AssertCodeMsg(GetClassNumInstanceFields != nullptr, EXCEPTIONCODE_MC, "Didn't find anything for %016llX", (DWORDLONG)cls);
- AssertCodeMsg(GetClassNumInstanceFields->GetIndex((DWORDLONG)cls) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX", (DWORDLONG)cls);
+ AssertCodeMsg(GetClassNumInstanceFields != nullptr, EXCEPTIONCODE_MC, "Didn't find anything for %016llX",
+ (DWORDLONG)cls);
+ AssertCodeMsg(GetClassNumInstanceFields->GetIndex((DWORDLONG)cls) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX",
+ (DWORDLONG)cls);
unsigned result = (unsigned)GetClassNumInstanceFields->Get((DWORDLONG)cls);
DEBUG_REP(dmpGetClassNumInstanceFields((DWORDLONG)cls, (DWORD)result));
@@ -2060,7 +2134,7 @@ void MethodContext::dmpGetTypeForBox(DWORDLONG key, DWORDLONG value)
{
printf("GetTypeForBox key cls-%016llX, value res-%016llX", key, value);
}
-CORINFO_CLASS_HANDLE MethodContext::repGetTypeForBox(CORINFO_CLASS_HANDLE cls)
+CORINFO_CLASS_HANDLE MethodContext::repGetTypeForBox(CORINFO_CLASS_HANDLE cls)
{
CORINFO_CLASS_HANDLE result = (CORINFO_CLASS_HANDLE)GetTypeForBox->Get((DWORDLONG)cls);
DEBUG_REP(dmpGetTypeForBox((DWORDLONG)cls, (DWORDLONG)result));
@@ -2086,7 +2160,7 @@ CorInfoHelpFunc MethodContext::repGetBoxHelper(CORINFO_CLASS_HANDLE cls)
return result;
}
-void MethodContext::recGetBuiltinClass(CorInfoClassId classId, CORINFO_CLASS_HANDLE result)
+void MethodContext::recGetBuiltinClass(CorInfoClassId classId, CORINFO_CLASS_HANDLE result)
{
if (GetBuiltinClass == nullptr)
GetBuiltinClass = new LightWeightMap<DWORD, DWORDLONG>();
@@ -2119,8 +2193,10 @@ void MethodContext::dmpGetTypeForPrimitiveValueClass(DWORDLONG key, DWORD value)
}
CorInfoType MethodContext::repGetTypeForPrimitiveValueClass(CORINFO_CLASS_HANDLE cls)
{
- AssertCodeMsg(GetTypeForPrimitiveValueClass != nullptr, EXCEPTIONCODE_MC, "Encountered an empty LWM while looking for %016llX", (DWORDLONG)cls);
- AssertCodeMsg(GetTypeForPrimitiveValueClass->GetIndex((DWORDLONG)cls) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX", (DWORDLONG)cls);
+ AssertCodeMsg(GetTypeForPrimitiveValueClass != nullptr, EXCEPTIONCODE_MC,
+ "Encountered an empty LWM while looking for %016llX", (DWORDLONG)cls);
+ AssertCodeMsg(GetTypeForPrimitiveValueClass->GetIndex((DWORDLONG)cls) != -1, EXCEPTIONCODE_MC,
+ "Didn't find %016llX", (DWORDLONG)cls);
CorInfoType result = (CorInfoType)GetTypeForPrimitiveValueClass->Get((DWORDLONG)cls);
DEBUG_REP(dmpGetTypeForPrimitiveValueClass((DWORDLONG)cls, (DWORD)result));
return result;
@@ -2132,7 +2208,6 @@ void MethodContext::recGetParentType(CORINFO_CLASS_HANDLE cls, CORINFO_CLASS_HAN
GetParentType = new LightWeightMap<DWORDLONG, DWORDLONG>();
GetParentType->Add((DWORDLONG)cls, (DWORDLONG)result);
-
}
void MethodContext::dmpGetParentType(DWORDLONG key, DWORDLONG value)
{
@@ -2180,7 +2255,8 @@ void MethodContext::dmpGetFieldClass(DWORDLONG key, DWORDLONG value)
CORINFO_CLASS_HANDLE MethodContext::repGetFieldClass(CORINFO_FIELD_HANDLE field)
{
AssertCodeMsg(GetFieldClass != nullptr, EXCEPTIONCODE_MC, "Didn't find anything for %016llX", (DWORDLONG)field);
- AssertCodeMsg(GetFieldClass->GetIndex((DWORDLONG)field) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX", (DWORDLONG)field);
+ AssertCodeMsg(GetFieldClass->GetIndex((DWORDLONG)field) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX",
+ (DWORDLONG)field);
CORINFO_CLASS_HANDLE temp = (CORINFO_CLASS_HANDLE)GetFieldClass->Get((DWORDLONG)field);
DEBUG_REP(dmpGetFieldClass((DWORDLONG)field, (DWORDLONG)temp));
return temp;
@@ -2200,8 +2276,8 @@ void MethodContext::dmpGetFieldOffset(DWORDLONG key, DWORD value)
}
unsigned MethodContext::repGetFieldOffset(CORINFO_FIELD_HANDLE field)
{
- AssertCodeMsg((GetFieldOffset != nullptr) && (GetFieldOffset->GetIndex((DWORDLONG)field) != -1),
- EXCEPTIONCODE_MC, "Didn't find %016llX", (DWORDLONG)field);
+ AssertCodeMsg((GetFieldOffset != nullptr) && (GetFieldOffset->GetIndex((DWORDLONG)field) != -1), EXCEPTIONCODE_MC,
+ "Didn't find %016llX", (DWORDLONG)field);
unsigned temp = (unsigned)GetFieldOffset->Get((DWORDLONG)field);
DEBUG_REP(dmpGetFieldOffset((DWORDLONG)field, (DWORD)temp));
@@ -2224,8 +2300,10 @@ void MethodContext::dmpGetLazyStringLiteralHelper(DWORDLONG key, DWORD value)
CorInfoHelpFunc MethodContext::repGetLazyStringLiteralHelper(CORINFO_MODULE_HANDLE handle)
{
- AssertCodeMsg(GetLazyStringLiteralHelper != nullptr, EXCEPTIONCODE_MC, "Didn't find anything for %016llX", (DWORDLONG)handle);
- AssertCodeMsg(GetLazyStringLiteralHelper->GetIndex((DWORDLONG)handle) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX", (DWORDLONG)handle);
+ AssertCodeMsg(GetLazyStringLiteralHelper != nullptr, EXCEPTIONCODE_MC, "Didn't find anything for %016llX",
+ (DWORDLONG)handle);
+ AssertCodeMsg(GetLazyStringLiteralHelper->GetIndex((DWORDLONG)handle) != -1, EXCEPTIONCODE_MC,
+ "Didn't find %016llX", (DWORDLONG)handle);
CorInfoHelpFunc temp = (CorInfoHelpFunc)GetLazyStringLiteralHelper->Get((DWORDLONG)handle);
DEBUG_REP(dmpGetLazyStringLiteralHelper((DWORDLONG)handle, temp));
return temp;
@@ -2248,13 +2326,11 @@ CorInfoHelpFunc MethodContext::repGetUnBoxHelper(CORINFO_CLASS_HANDLE cls)
return temp;
}
-void MethodContext::recGetReadyToRunHelper(
- CORINFO_RESOLVED_TOKEN * pResolvedToken,
- CORINFO_LOOKUP_KIND * pGenericLookupKind,
- CorInfoHelpFunc id,
- CORINFO_CONST_LOOKUP * pLookup,
- bool result
- )
+void MethodContext::recGetReadyToRunHelper(CORINFO_RESOLVED_TOKEN* pResolvedToken,
+ CORINFO_LOOKUP_KIND* pGenericLookupKind,
+ CorInfoHelpFunc id,
+ CORINFO_CONST_LOOKUP* pLookup,
+ bool result)
{
LogError("getReadyToRunHelper NYI");
@@ -2263,28 +2339,24 @@ void MethodContext::recGetReadyToRunHelper(
if (GetReadyToRunHelper == nullptr)
GetReadyToRunHelper = new LightWeightMap<DWORDLONG, DWORD>();
- //GetReadyToRunHelper->Add((DWORDLONG)cls, result);
+ // GetReadyToRunHelper->Add((DWORDLONG)cls, result);
}
void MethodContext::dmpGetReadyToRunHelper(DWORDLONG key, DWORD value)
{
LogError("getReadyToRunHelper NYI");
}
-bool MethodContext::repGetReadyToRunHelper(
- CORINFO_RESOLVED_TOKEN * pResolvedToken,
- CORINFO_LOOKUP_KIND * pGenericLookupKind,
- CorInfoHelpFunc id,
- CORINFO_CONST_LOOKUP * pLookup
- )
+bool MethodContext::repGetReadyToRunHelper(CORINFO_RESOLVED_TOKEN* pResolvedToken,
+ CORINFO_LOOKUP_KIND* pGenericLookupKind,
+ CorInfoHelpFunc id,
+ CORINFO_CONST_LOOKUP* pLookup)
{
LogError("getReadyToRunHelper NYI");
return false;
}
-void MethodContext::recGetReadyToRunDelegateCtorHelper(
- CORINFO_RESOLVED_TOKEN * pTargetMethod,
- CORINFO_CLASS_HANDLE delegateType,
- CORINFO_LOOKUP * pLookup
- )
+void MethodContext::recGetReadyToRunDelegateCtorHelper(CORINFO_RESOLVED_TOKEN* pTargetMethod,
+ CORINFO_CLASS_HANDLE delegateType,
+ CORINFO_LOOKUP* pLookup)
{
LogError("GetReadyToRunDelegateCtorHelper NYI");
@@ -2293,22 +2365,20 @@ void MethodContext::recGetReadyToRunDelegateCtorHelper(
if (GetReadyToRunDelegateCtorHelper == nullptr)
GetReadyToRunDelegateCtorHelper = new LightWeightMap<DWORDLONG, DWORD>();
- //GetReadyToRunDelegateCtorHelper->Add((DWORDLONG)delegateType, result);
+ // GetReadyToRunDelegateCtorHelper->Add((DWORDLONG)delegateType, result);
}
void MethodContext::dmpGetReadyToRunDelegateCtorHelper(DWORDLONG key, DWORD value)
{
LogError("getReadyToRunDelegateCtorHelper NYI");
}
-void MethodContext::repGetReadyToRunDelegateCtorHelper(
- CORINFO_RESOLVED_TOKEN * pTargetMethod,
- CORINFO_CLASS_HANDLE delegateType,
- CORINFO_LOOKUP * pLookup
- )
+void MethodContext::repGetReadyToRunDelegateCtorHelper(CORINFO_RESOLVED_TOKEN* pTargetMethod,
+ CORINFO_CLASS_HANDLE delegateType,
+ CORINFO_LOOKUP* pLookup)
{
LogError("getReadyToRunDelegateCtorHelper NYI");
}
-void MethodContext::recGetHelperFtn(CorInfoHelpFunc ftnNum, void **ppIndirection, void *result)
+void MethodContext::recGetHelperFtn(CorInfoHelpFunc ftnNum, void** ppIndirection, void* result)
{
if (GetHelperFtn == nullptr)
GetHelperFtn = new LightWeightMap<DWORD, DLDL>();
@@ -2324,7 +2394,7 @@ void MethodContext::dmpGetHelperFtn(DWORD key, DLDL value)
{
printf("GetHelperFtn key ftn-%u, value ppi-%016llX res-%016llX", key, value.A, value.B);
}
-void* MethodContext::repGetHelperFtn(CorInfoHelpFunc ftnNum, void **ppIndirection)
+void* MethodContext::repGetHelperFtn(CorInfoHelpFunc ftnNum, void** ppIndirection)
{
if ((GetHelperFtn == nullptr) || (GetHelperFtn->GetIndex((DWORD)ftnNum) == -1))
{
@@ -2337,10 +2407,10 @@ void* MethodContext::repGetHelperFtn(CorInfoHelpFunc ftnNum, void **ppIndirectio
#endif
}
- DLDL value = (DLDL)GetHelperFtn->Get((DWORD)ftnNum);
- *ppIndirection = (void *)value.A;
+ DLDL value = (DLDL)GetHelperFtn->Get((DWORD)ftnNum);
+ *ppIndirection = (void*)value.A;
DEBUG_REP(dmpGetHelperFtn((DWORD)ftnNum, value));
- return (void *)value.B;
+ return (void*)value.B;
}
//
@@ -2363,14 +2433,14 @@ void* MethodContext::repGetHelperFtn(CorInfoHelpFunc ftnNum, void **ppIndirectio
// lower 32 bits of the target address.
// - This might not work correctly with method contexts recorded via NGen compilation.
//
-bool MethodContext::fndGetHelperFtn(void *functionAddress, CorInfoHelpFunc *pResult)
+bool MethodContext::fndGetHelperFtn(void* functionAddress, CorInfoHelpFunc* pResult)
{
if (GetHelperFtn != nullptr)
{
for (unsigned int i = 0; i < GetHelperFtn->GetCount(); i++)
{
DWORD key = GetHelperFtn->GetKey(i);
- DLDL val = GetHelperFtn->GetItem(i);
+ DLDL val = GetHelperFtn->GetItem(i);
// TODO-Cleanup: this only compares the function addresses, and doesn't account for
// ppIndirection, which will break if the helper is a dynamic helper function.
@@ -2386,7 +2456,9 @@ bool MethodContext::fndGetHelperFtn(void *functionAddress, CorInfoHelpFunc *pRes
return false;
}
-void MethodContext::recGetJustMyCodeHandle(CORINFO_METHOD_HANDLE method, CORINFO_JUST_MY_CODE_HANDLE **ppIndirection, CORINFO_JUST_MY_CODE_HANDLE result)
+void MethodContext::recGetJustMyCodeHandle(CORINFO_METHOD_HANDLE method,
+ CORINFO_JUST_MY_CODE_HANDLE** ppIndirection,
+ CORINFO_JUST_MY_CODE_HANDLE result)
{
if (GetJustMyCodeHandle == nullptr)
GetJustMyCodeHandle = new LightWeightMap<DWORDLONG, DLDL>();
@@ -2400,26 +2472,30 @@ void MethodContext::dmpGetJustMyCodeHandle(DWORDLONG key, DLDL value)
{
printf("GetJustMyCodeHandle key ftn-%016llX, value pp-%016llX, res-%016llX", key, value.A, value.B);
}
-CORINFO_JUST_MY_CODE_HANDLE MethodContext::repGetJustMyCodeHandle(CORINFO_METHOD_HANDLE method, CORINFO_JUST_MY_CODE_HANDLE **ppIndirection)
+CORINFO_JUST_MY_CODE_HANDLE MethodContext::repGetJustMyCodeHandle(CORINFO_METHOD_HANDLE method,
+ CORINFO_JUST_MY_CODE_HANDLE** ppIndirection)
{
- DLDL temp = (DLDL)GetJustMyCodeHandle->Get((DWORDLONG)method);
- *ppIndirection = (CORINFO_JUST_MY_CODE_HANDLE *)temp.A;
+ DLDL temp = (DLDL)GetJustMyCodeHandle->Get((DWORDLONG)method);
+ *ppIndirection = (CORINFO_JUST_MY_CODE_HANDLE*)temp.A;
CORINFO_JUST_MY_CODE_HANDLE result = (CORINFO_JUST_MY_CODE_HANDLE)temp.B;
DEBUG_REP(dmpGetJustMyCodeHandle((DWORDLONG)method, temp));
return result;
}
-void MethodContext::recGetFunctionEntryPoint(CORINFO_METHOD_HANDLE ftn, CORINFO_CONST_LOOKUP *pResult, CORINFO_ACCESS_FLAGS accessFlags)
+void MethodContext::recGetFunctionEntryPoint(CORINFO_METHOD_HANDLE ftn,
+ CORINFO_CONST_LOOKUP* pResult,
+ CORINFO_ACCESS_FLAGS accessFlags)
{
if (GetFunctionEntryPoint == nullptr)
GetFunctionEntryPoint = new LightWeightMap<DLD, DLD>();
DLD key;
- ZeroMemory(&key, sizeof(DLD)); //We use the input structs as a key and use memcmp to compare.. so we need to zero out padding too
+ ZeroMemory(&key, sizeof(DLD)); // We use the input structs as a key and use memcmp to compare.. so we need to zero
+ // out padding too
DLD value;
- key.A = (DWORDLONG)ftn;
- key.B = (DWORD)accessFlags;
- value.A = (DWORDLONG)pResult->addr; //First union member
+ key.A = (DWORDLONG)ftn;
+ key.B = (DWORD)accessFlags;
+ value.A = (DWORDLONG)pResult->addr; // First union member
value.B = (DWORD)pResult->accessType;
GetFunctionEntryPoint->Add(key, value);
DEBUG_REC(dmpGetFunctionEntryPoint(key, value));
@@ -2428,10 +2504,13 @@ void MethodContext::dmpGetFunctionEntryPoint(DLD key, DLD value)
{
printf("GetFunctionEntryPoint key ftn-%016llX af-%08X, value add-%016llX at-%u", key.A, key.B, value.A, value.B);
}
-void MethodContext::repGetFunctionEntryPoint(CORINFO_METHOD_HANDLE ftn, CORINFO_CONST_LOOKUP *pResult, CORINFO_ACCESS_FLAGS accessFlags)
+void MethodContext::repGetFunctionEntryPoint(CORINFO_METHOD_HANDLE ftn,
+ CORINFO_CONST_LOOKUP* pResult,
+ CORINFO_ACCESS_FLAGS accessFlags)
{
DLD key;
- ZeroMemory(&key, sizeof(DLD)); //We use the input structs as a key and use memcmp to compare.. so we need to zero out padding too
+ ZeroMemory(&key, sizeof(DLD)); // We use the input structs as a key and use memcmp to compare.. so we need to zero
+ // out padding too
DLD value;
key.A = (DWORDLONG)ftn;
key.B = (DWORD)accessFlags;
@@ -2441,7 +2520,7 @@ void MethodContext::repGetFunctionEntryPoint(CORINFO_METHOD_HANDLE ftn, CORINFO_
#ifdef sparseMC
LogDebug("Sparse - repGetFunctionEntryPoint fabricated result for request.");
pResult->accessType = (InfoAccessType)IAT_PVALUE;
- pResult->addr = (void *)((DWORDLONG)ftn + 0x1c);
+ pResult->addr = (void*)((DWORDLONG)ftn + 0x1c);
return;
#else
LogException(EXCEPTIONCODE_MC, "Didn't find %016llX, %8x", (DWORDLONG)ftn, accessFlags);
@@ -2459,7 +2538,7 @@ void MethodContext::repGetFunctionEntryPoint(CORINFO_METHOD_HANDLE ftn, CORINFO_
{
LogDebug("Sparse - repGetFunctionEntryPoint fabricated result for request.");
pResult->accessType = (InfoAccessType)IAT_PVALUE;
- pResult->addr = (void *)((DWORDLONG)ftn + 0x1c);
+ pResult->addr = (void*)((DWORDLONG)ftn + 0x1c);
return;
}
#else
@@ -2469,7 +2548,7 @@ void MethodContext::repGetFunctionEntryPoint(CORINFO_METHOD_HANDLE ftn, CORINFO_
value = GetFunctionEntryPoint->Get(key);
pResult->accessType = (InfoAccessType)value.B;
- pResult->addr = (void *)value.A;
+ pResult->addr = (void*)value.A;
DEBUG_REP(dmpGetFunctionEntryPoint(key, value));
}
@@ -2503,7 +2582,7 @@ void MethodContext::repGetFunctionEntryPoint(CORINFO_METHOD_HANDLE ftn, CORINFO_
// are only 32-bit deltas, what you'll usually end up seeing is that, after SuperPMI has applied
// these fixups, the lower 32 bits of method addresses will match, but the upper 32 bits will differ.
//
-bool MethodContext::fndGetFunctionEntryPoint(DLD value, CORINFO_METHOD_HANDLE *pResult)
+bool MethodContext::fndGetFunctionEntryPoint(DLD value, CORINFO_METHOD_HANDLE* pResult)
{
if (GetFunctionEntryPoint != nullptr)
{
@@ -2525,15 +2604,19 @@ bool MethodContext::fndGetFunctionEntryPoint(DLD value, CORINFO_METHOD_HANDLE *p
return false;
}
-void MethodContext::recConstructStringLiteral(CORINFO_MODULE_HANDLE module, mdToken metaTok, void *pValue, InfoAccessType result)
+void MethodContext::recConstructStringLiteral(CORINFO_MODULE_HANDLE module,
+ mdToken metaTok,
+ void* pValue,
+ InfoAccessType result)
{
if (ConstructStringLiteral == nullptr)
ConstructStringLiteral = new LightWeightMap<DLD, DLD>();
DLD temp;
- ZeroMemory(&temp, sizeof(DLD)); //We use the input structs as a key and use memcmp to compare.. so we need to zero out padding too
+ ZeroMemory(&temp, sizeof(DLD)); // We use the input structs as a key and use memcmp to compare.. so we need to zero
+ // out padding too
DLD temp2;
- temp.A = (DWORDLONG)module;
- temp.B = (DWORD)metaTok;
+ temp.A = (DWORDLONG)module;
+ temp.B = (DWORD)metaTok;
temp2.A = (DWORDLONG)pValue;
temp2.B = (DWORD)result;
@@ -2544,22 +2627,25 @@ void MethodContext::dmpConstructStringLiteral(DLD key, DLD value)
{
printf("ConstructStringLiteral key mod-%016llX tok-%08X, value pp-%016llX iat-%u", key.A, key.B, value.A, value.B);
}
-InfoAccessType MethodContext::repConstructStringLiteral(CORINFO_MODULE_HANDLE module, mdToken metaTok, void **ppValue)
+InfoAccessType MethodContext::repConstructStringLiteral(CORINFO_MODULE_HANDLE module, mdToken metaTok, void** ppValue)
{
DLD temp;
- ZeroMemory(&temp, sizeof(DLD)); //We use the input structs as a key and use memcmp to compare.. so we need to zero out padding too
+ ZeroMemory(&temp, sizeof(DLD)); // We use the input structs as a key and use memcmp to compare.. so we need to zero
+ // out padding too
DLD temp2;
temp.A = (DWORDLONG)module;
temp.B = (DWORD)metaTok;
- AssertCodeMsg(ConstructStringLiteral != nullptr, EXCEPTIONCODE_MC, "Didn't find anything for %016llX", (DWORDLONG)module);
- AssertCodeMsg(ConstructStringLiteral->GetIndex(temp) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX", (DWORDLONG)module);
- temp2 = ConstructStringLiteral->Get(temp);
- *ppValue = (void *)temp2.A;
+ AssertCodeMsg(ConstructStringLiteral != nullptr, EXCEPTIONCODE_MC, "Didn't find anything for %016llX",
+ (DWORDLONG)module);
+ AssertCodeMsg(ConstructStringLiteral->GetIndex(temp) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX",
+ (DWORDLONG)module);
+ temp2 = ConstructStringLiteral->Get(temp);
+ *ppValue = (void*)temp2.A;
DEBUG_REP(dmpConstructStringLiteral(temp, temp2));
return (InfoAccessType)temp2.B;
}
-void MethodContext::recEmptyStringLiteral(void **pValue, InfoAccessType result)
+void MethodContext::recEmptyStringLiteral(void** pValue, InfoAccessType result)
{
if (EmptyStringLiteral == nullptr)
EmptyStringLiteral = new DenseLightWeightMap<DLD>();
@@ -2573,45 +2659,52 @@ void MethodContext::dmpEmptyStringLiteral(DWORD key, DLD value)
{
printf("EmptyStringLiteral key %u, value pVal-%016llX res-%u", key, value.A, value.B);
}
-InfoAccessType MethodContext::repEmptyStringLiteral(void **ppValue)
+InfoAccessType MethodContext::repEmptyStringLiteral(void** ppValue)
{
// TODO-Cleanup: sketchy if someone calls this twice
DLD temp2;
- temp2 = EmptyStringLiteral->Get((DWORD)0);
- *ppValue = (void *)temp2.A;
+ temp2 = EmptyStringLiteral->Get((DWORD)0);
+ *ppValue = (void*)temp2.A;
return (InfoAccessType)temp2.B;
}
-void MethodContext::recGetArgType(CORINFO_SIG_INFO *sig, CORINFO_ARG_LIST_HANDLE args, CORINFO_CLASS_HANDLE *vcTypeRet, CorInfoTypeWithMod result, DWORD exceptionCode)
+void MethodContext::recGetArgType(CORINFO_SIG_INFO* sig,
+ CORINFO_ARG_LIST_HANDLE args,
+ CORINFO_CLASS_HANDLE* vcTypeRet,
+ CorInfoTypeWithMod result,
+ DWORD exceptionCode)
{
if (GetArgType == nullptr)
GetArgType = new LightWeightMap<Agnostic_GetArgType, Agnostic_GetArgType_Value>();
Agnostic_GetArgType key;
- ZeroMemory(&key, sizeof(Agnostic_GetArgType)); //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_GetArgType)); // We use the input structs as a key and use memcmp to compare.. so
+ // we need to zero out padding too
Agnostic_GetArgType_Value value;
- //Only setting values for things the EE seems to pay attention to... this is necessary since some of the values
- //are unset and fail our precise comparisions...
- key.sig.callConv = (DWORD)0;
- key.sig.retTypeClass = (DWORDLONG)0;
- key.sig.retTypeSigClass = (DWORDLONG)0;
- key.sig.retType = (DWORD)0;
- key.sig.flags = (DWORD)sig->flags;
- key.sig.numArgs = (DWORD)sig->numArgs;
+ // Only setting values for things the EE seems to pay attention to... this is necessary since some of the values
+ //are unset and fail our precise comparisions...
+ key.sig.callConv = (DWORD)0;
+ key.sig.retTypeClass = (DWORDLONG)0;
+ key.sig.retTypeSigClass = (DWORDLONG)0;
+ key.sig.retType = (DWORD)0;
+ key.sig.flags = (DWORD)sig->flags;
+ key.sig.numArgs = (DWORD)sig->numArgs;
key.sig.sigInst_classInstCount = (DWORD)sig->sigInst.classInstCount;
- key.sig.sigInst_classInst_Index = (DWORD)GetArgType->AddBuffer((unsigned char*)sig->sigInst.classInst, sig->sigInst.classInstCount * 8);
+ key.sig.sigInst_classInst_Index =
+ (DWORD)GetArgType->AddBuffer((unsigned char*)sig->sigInst.classInst, sig->sigInst.classInstCount * 8);
key.sig.sigInst_methInstCount = (DWORD)sig->sigInst.methInstCount;
- key.sig.sigInst_methInst_Index = (DWORD)GetArgType->AddBuffer((unsigned char*)sig->sigInst.methInst, sig->sigInst.methInstCount * 8);
- key.sig.args = (DWORDLONG)0;
+ key.sig.sigInst_methInst_Index =
+ (DWORD)GetArgType->AddBuffer((unsigned char*)sig->sigInst.methInst, sig->sigInst.methInstCount * 8);
+ key.sig.args = (DWORDLONG)0;
key.sig.cbSig = (DWORD)0;
- key.sig.pSig = -1;
+ key.sig.pSig = -1;
key.sig.scope = (DWORDLONG)sig->scope;
key.sig.token = (DWORD)0;
- key.args = (DWORDLONG)args;
+ key.args = (DWORDLONG)args;
- value.vcTypeRet = (DWORDLONG)*vcTypeRet;
- value.result = (DWORD)result;
+ value.vcTypeRet = (DWORDLONG)*vcTypeRet;
+ value.result = (DWORD)result;
value.exceptionCode = (DWORD)exceptionCode;
GetArgType->Add(key, value);
@@ -2619,47 +2712,49 @@ void MethodContext::recGetArgType(CORINFO_SIG_INFO *sig, CORINFO_ARG_LIST_HANDLE
}
void MethodContext::dmpGetArgType(const Agnostic_GetArgType& key, const Agnostic_GetArgType_Value& value)
{
- printf("GetArgType key flg-%08X na-%u cc-%u ci-%u mc-%u mi-%u scp-%016llX arg-%016llX",
- key.sig.flags,
- key.sig.numArgs,
- key.sig.sigInst_classInstCount,
- key.sig.sigInst_classInst_Index,
- key.sig.sigInst_methInstCount,
- key.sig.sigInst_methInst_Index,
- key.sig.scope,
- key.args);
+ printf("GetArgType key flg-%08X na-%u cc-%u ci-%u mc-%u mi-%u scp-%016llX arg-%016llX", key.sig.flags,
+ key.sig.numArgs, key.sig.sigInst_classInstCount, key.sig.sigInst_classInst_Index,
+ key.sig.sigInst_methInstCount, key.sig.sigInst_methInst_Index, key.sig.scope, key.args);
printf(", value rt-%016llX ci-%u excp-%08X", value.vcTypeRet, value.result, value.exceptionCode);
}
-CorInfoTypeWithMod MethodContext::repGetArgType(CORINFO_SIG_INFO *sig, CORINFO_ARG_LIST_HANDLE args, CORINFO_CLASS_HANDLE *vcTypeRet, DWORD *exceptionCode)
+CorInfoTypeWithMod MethodContext::repGetArgType(CORINFO_SIG_INFO* sig,
+ CORINFO_ARG_LIST_HANDLE args,
+ CORINFO_CLASS_HANDLE* vcTypeRet,
+ DWORD* exceptionCode)
{
Agnostic_GetArgType key;
- ZeroMemory(&key, sizeof(Agnostic_GetArgType)); //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_GetArgType)); // We use the input structs as a key and use memcmp to compare.. so
+ // we need to zero out padding too
Agnostic_GetArgType_Value value;
- AssertCodeMsg(GetArgType != nullptr, EXCEPTIONCODE_MC, "Didn't find %016llx, %016llx. probably a missing exception in getArgType", key.sig.scope, key.args);
- key.sig.callConv = (DWORD)0;
- key.sig.retTypeClass = (DWORDLONG)0;
- key.sig.retTypeSigClass = (DWORDLONG)0;
- key.sig.retType = (DWORD)0;
- key.sig.flags = (DWORD)sig->flags;
- key.sig.numArgs = (DWORD)sig->numArgs;
+ AssertCodeMsg(GetArgType != nullptr, EXCEPTIONCODE_MC,
+ "Didn't find %016llx, %016llx. probably a missing exception in getArgType", key.sig.scope, key.args);
+ key.sig.callConv = (DWORD)0;
+ key.sig.retTypeClass = (DWORDLONG)0;
+ key.sig.retTypeSigClass = (DWORDLONG)0;
+ key.sig.retType = (DWORD)0;
+ key.sig.flags = (DWORD)sig->flags;
+ key.sig.numArgs = (DWORD)sig->numArgs;
key.sig.sigInst_classInstCount = (DWORD)sig->sigInst.classInstCount;
- key.sig.sigInst_classInst_Index = (DWORD)GetArgType->Contains((unsigned char*)sig->sigInst.classInst, sig->sigInst.classInstCount * 8);
+ key.sig.sigInst_classInst_Index =
+ (DWORD)GetArgType->Contains((unsigned char*)sig->sigInst.classInst, sig->sigInst.classInstCount * 8);
key.sig.sigInst_methInstCount = (DWORD)sig->sigInst.methInstCount;
- key.sig.sigInst_methInst_Index = (DWORD)GetArgType->Contains((unsigned char*)sig->sigInst.methInst, sig->sigInst.methInstCount * 8);
- key.sig.args = (DWORDLONG)0;
+ key.sig.sigInst_methInst_Index =
+ (DWORD)GetArgType->Contains((unsigned char*)sig->sigInst.methInst, sig->sigInst.methInstCount * 8);
+ key.sig.args = (DWORDLONG)0;
key.sig.cbSig = (DWORD)0;
- key.sig.pSig = -1;
+ key.sig.pSig = -1;
key.sig.scope = (DWORDLONG)sig->scope;
key.sig.token = (DWORD)0;
- key.args = (DWORDLONG)args;
+ key.args = (DWORDLONG)args;
- AssertCodeMsg(GetArgType->GetIndex(key) != -1, EXCEPTIONCODE_MC, "Didn't find %016llx, %016llx. probably a missing exception in getArgType", key.sig.scope, key.args);
+ AssertCodeMsg(GetArgType->GetIndex(key) != -1, EXCEPTIONCODE_MC,
+ "Didn't find %016llx, %016llx. probably a missing exception in getArgType", key.sig.scope, key.args);
- value = GetArgType->Get(key);
- *vcTypeRet = (CORINFO_CLASS_HANDLE)value.vcTypeRet;
+ value = GetArgType->Get(key);
+ *vcTypeRet = (CORINFO_CLASS_HANDLE)value.vcTypeRet;
CorInfoTypeWithMod temp = (CorInfoTypeWithMod)value.result;
- *exceptionCode = (DWORD)value.exceptionCode;
+ *exceptionCode = (DWORD)value.exceptionCode;
DEBUG_REP(dmpGetArgType(key, value));
return temp;
@@ -2683,31 +2778,34 @@ CORINFO_ARG_LIST_HANDLE MethodContext::repGetArgNext(CORINFO_ARG_LIST_HANDLE arg
DEBUG_REP(dmpGetArgNext((DWORDLONG)args, (DWORDLONG)temp));
return temp;
}
-void MethodContext::recGetMethodSig(CORINFO_METHOD_HANDLE ftn, CORINFO_SIG_INFO *sig, CORINFO_CLASS_HANDLE memberParent)
+void MethodContext::recGetMethodSig(CORINFO_METHOD_HANDLE ftn, CORINFO_SIG_INFO* sig, CORINFO_CLASS_HANDLE memberParent)
{
if (GetMethodSig == nullptr)
GetMethodSig = new LightWeightMap<DLDL, Agnostic_CORINFO_SIG_INFO>();
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_CORINFO_SIG_INFO value;
key.A = (DWORDLONG)ftn;
key.B = (DWORDLONG)memberParent;
- value.callConv = (DWORD)sig->callConv;
- value.retTypeClass = (DWORDLONG)sig->retTypeClass;
- value.retTypeSigClass = (DWORDLONG)sig->retTypeSigClass;
- value.retType = (DWORD)sig->retType;
- value.flags = (DWORD)sig->flags;
- value.numArgs = (DWORD)sig->numArgs;
- value.sigInst_classInstCount = (DWORD)sig->sigInst.classInstCount;
- value.sigInst_classInst_Index = GetMethodSig->AddBuffer((unsigned char*)sig->sigInst.classInst, sig->sigInst.classInstCount * 8); //porting issue
+ value.callConv = (DWORD)sig->callConv;
+ value.retTypeClass = (DWORDLONG)sig->retTypeClass;
+ value.retTypeSigClass = (DWORDLONG)sig->retTypeSigClass;
+ value.retType = (DWORD)sig->retType;
+ value.flags = (DWORD)sig->flags;
+ value.numArgs = (DWORD)sig->numArgs;
+ value.sigInst_classInstCount = (DWORD)sig->sigInst.classInstCount;
+ value.sigInst_classInst_Index = GetMethodSig->AddBuffer((unsigned char*)sig->sigInst.classInst,
+ sig->sigInst.classInstCount * 8); // porting issue
value.sigInst_methInstCount = (DWORD)sig->sigInst.methInstCount;
- value.sigInst_methInst_Index = GetMethodSig->AddBuffer((unsigned char*)sig->sigInst.methInst, sig->sigInst.methInstCount * 8); //porting issue
- value.args = (DWORDLONG)sig->args;
+ value.sigInst_methInst_Index =
+ GetMethodSig->AddBuffer((unsigned char*)sig->sigInst.methInst, sig->sigInst.methInstCount * 8); // porting issue
+ value.args = (DWORDLONG)sig->args;
value.cbSig = (DWORD)sig->cbSig;
- value.pSig = (DWORD)GetMethodSig->AddBuffer((unsigned char *)sig->pSig, sig->cbSig);
+ value.pSig = (DWORD)GetMethodSig->AddBuffer((unsigned char*)sig->pSig, sig->cbSig);
value.scope = (DWORDLONG)sig->scope;
value.token = (DWORD)sig->token;
@@ -2716,29 +2814,18 @@ void MethodContext::recGetMethodSig(CORINFO_METHOD_HANDLE ftn, CORINFO_SIG_INFO
}
void MethodContext::dmpGetMethodSig(DLDL key, const Agnostic_CORINFO_SIG_INFO& value)
{
- printf("GetMethodSig key ftn-%016llX prt-%016llX, value cc-%u rtc-%016llX rts-%016llX rt-%u(%s) flg-%08X na-%u cc-%u ci-%u mc-%u mi-%u args-%016llX sig-%u pSig-%u scp-%016llX tok-%08X",
- key.A, key.B,
- value.callConv,
- value.retTypeClass,
- value.retTypeSigClass,
- value.retType,
- toString((CorInfoType)value.retType),
- value.flags,
- value.numArgs,
- value.sigInst_classInstCount,
- value.sigInst_classInst_Index,
- value.sigInst_methInstCount,
- value.sigInst_methInst_Index,
- value.args,
- value.cbSig,
- value.pSig,
- value.scope,
- value.token);
-}
-void MethodContext::repGetMethodSig(CORINFO_METHOD_HANDLE ftn, CORINFO_SIG_INFO *sig, CORINFO_CLASS_HANDLE memberParent)
+ printf("GetMethodSig key ftn-%016llX prt-%016llX, value cc-%u rtc-%016llX rts-%016llX rt-%u(%s) flg-%08X na-%u "
+ "cc-%u ci-%u mc-%u mi-%u args-%016llX sig-%u pSig-%u scp-%016llX tok-%08X",
+ key.A, key.B, value.callConv, value.retTypeClass, value.retTypeSigClass, value.retType,
+ toString((CorInfoType)value.retType), value.flags, value.numArgs, value.sigInst_classInstCount,
+ value.sigInst_classInst_Index, value.sigInst_methInstCount, value.sigInst_methInst_Index, value.args,
+ value.cbSig, value.pSig, value.scope, value.token);
+}
+void MethodContext::repGetMethodSig(CORINFO_METHOD_HANDLE ftn, CORINFO_SIG_INFO* sig, CORINFO_CLASS_HANDLE memberParent)
{
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_CORINFO_SIG_INFO value;
key.A = (DWORDLONG)ftn;
@@ -2746,54 +2833,60 @@ void MethodContext::repGetMethodSig(CORINFO_METHOD_HANDLE ftn, CORINFO_SIG_INFO
value = GetMethodSig->Get(key);
- sig->callConv = (CorInfoCallConv)value.callConv;
- sig->retTypeClass = (CORINFO_CLASS_HANDLE)value.retTypeClass;
- sig->retTypeSigClass = (CORINFO_CLASS_HANDLE)value.retTypeSigClass;
- sig->retType = (CorInfoType)value.retType;
- sig->flags = (unsigned)value.flags;
- sig->numArgs = (unsigned)value.numArgs;
+ sig->callConv = (CorInfoCallConv)value.callConv;
+ sig->retTypeClass = (CORINFO_CLASS_HANDLE)value.retTypeClass;
+ sig->retTypeSigClass = (CORINFO_CLASS_HANDLE)value.retTypeSigClass;
+ sig->retType = (CorInfoType)value.retType;
+ sig->flags = (unsigned)value.flags;
+ sig->numArgs = (unsigned)value.numArgs;
sig->sigInst.classInstCount = (unsigned)value.sigInst_classInstCount;
- sig->sigInst.classInst = (CORINFO_CLASS_HANDLE*)GetMethodSig->GetBuffer(value.sigInst_classInst_Index);
- sig->sigInst.methInstCount = (unsigned)value.sigInst_methInstCount;
- sig->sigInst.methInst = (CORINFO_CLASS_HANDLE*)GetMethodSig->GetBuffer(value.sigInst_methInst_Index);
- sig->args = (CORINFO_ARG_LIST_HANDLE)value.args;
- sig->cbSig = (unsigned int)value.cbSig;
- sig->pSig = (PCCOR_SIGNATURE)GetMethodSig->GetBuffer(value.pSig);
- sig->scope = (CORINFO_MODULE_HANDLE)value.scope;
- sig->token = (mdToken)value.token;
+ sig->sigInst.classInst = (CORINFO_CLASS_HANDLE*)GetMethodSig->GetBuffer(value.sigInst_classInst_Index);
+ sig->sigInst.methInstCount = (unsigned)value.sigInst_methInstCount;
+ sig->sigInst.methInst = (CORINFO_CLASS_HANDLE*)GetMethodSig->GetBuffer(value.sigInst_methInst_Index);
+ sig->args = (CORINFO_ARG_LIST_HANDLE)value.args;
+ sig->cbSig = (unsigned int)value.cbSig;
+ sig->pSig = (PCCOR_SIGNATURE)GetMethodSig->GetBuffer(value.pSig);
+ sig->scope = (CORINFO_MODULE_HANDLE)value.scope;
+ sig->token = (mdToken)value.token;
DEBUG_REP(dmpGetMethodSig(key, value));
}
-void MethodContext::recGetArgClass(CORINFO_SIG_INFO* sig, CORINFO_ARG_LIST_HANDLE args, CORINFO_CLASS_HANDLE result, DWORD exceptionCode)
+void MethodContext::recGetArgClass(CORINFO_SIG_INFO* sig,
+ CORINFO_ARG_LIST_HANDLE args,
+ CORINFO_CLASS_HANDLE result,
+ DWORD exceptionCode)
{
if (GetArgClass == nullptr)
GetArgClass = new LightWeightMap<Agnostic_GetArgClass, Agnostic_GetArgClass_Value>();
Agnostic_GetArgClass key;
- ZeroMemory(&key, sizeof(Agnostic_GetArgClass)); //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_GetArgClass)); // We use the input structs as a key and use memcmp to compare.. so
+ // we need to zero out padding too
Agnostic_GetArgClass_Value value;
- //Only setting values for things the EE seems to pay attention to... this is necessary since some of the values
- //are unset and fail our precise comparisions...
- key.sig.callConv = (DWORD)0;
- key.sig.retTypeClass = (DWORDLONG)0;
- key.sig.retTypeSigClass = (DWORDLONG)0;
- key.sig.retType = (DWORD)0;
- key.sig.flags = (DWORD)0;
- key.sig.numArgs = (DWORD)0;
+ // Only setting values for things the EE seems to pay attention to... this is necessary since some of the values
+ //are unset and fail our precise comparisions...
+ key.sig.callConv = (DWORD)0;
+ key.sig.retTypeClass = (DWORDLONG)0;
+ key.sig.retTypeSigClass = (DWORDLONG)0;
+ key.sig.retType = (DWORD)0;
+ key.sig.flags = (DWORD)0;
+ key.sig.numArgs = (DWORD)0;
key.sig.sigInst_classInstCount = (DWORD)sig->sigInst.classInstCount;
- key.sig.sigInst_classInst_Index = (DWORD)GetArgClass->AddBuffer((unsigned char*)sig->sigInst.classInst, sig->sigInst.classInstCount * 8);
+ key.sig.sigInst_classInst_Index =
+ (DWORD)GetArgClass->AddBuffer((unsigned char*)sig->sigInst.classInst, sig->sigInst.classInstCount * 8);
key.sig.sigInst_methInstCount = (DWORD)sig->sigInst.methInstCount;
- key.sig.sigInst_methInst_Index = (DWORD)GetArgClass->AddBuffer((unsigned char*)sig->sigInst.methInst, sig->sigInst.methInstCount * 8);
- key.sig.args = (DWORDLONG)0;
+ key.sig.sigInst_methInst_Index =
+ (DWORD)GetArgClass->AddBuffer((unsigned char*)sig->sigInst.methInst, sig->sigInst.methInstCount * 8);
+ key.sig.args = (DWORDLONG)0;
key.sig.cbSig = (DWORD)0;
- key.sig.pSig = -1;
+ key.sig.pSig = -1;
key.sig.scope = (DWORDLONG)sig->scope;
key.sig.token = (DWORD)0;
- key.args = (DWORDLONG)args;
+ key.args = (DWORDLONG)args;
- value.result = (DWORDLONG)result;
+ value.result = (DWORDLONG)result;
value.exceptionCode = exceptionCode;
GetArgClass->Add(key, value);
@@ -2801,42 +2894,47 @@ void MethodContext::recGetArgClass(CORINFO_SIG_INFO* sig, CORINFO_ARG_LIST_HANDL
}
void MethodContext::dmpGetArgClass(const Agnostic_GetArgClass& key, const Agnostic_GetArgClass_Value& value)
{
- printf("GetArgClass key cc-%u ci-%u mc-%u mi-%u scp-%016llX args-%016llX",
- key.sig.sigInst_classInstCount,
- key.sig.sigInst_classInst_Index,
- key.sig.sigInst_methInstCount,
- key.sig.sigInst_methInst_Index,
- key.sig.scope,
- key.args);
+ printf("GetArgClass key cc-%u ci-%u mc-%u mi-%u scp-%016llX args-%016llX", key.sig.sigInst_classInstCount,
+ key.sig.sigInst_classInst_Index, key.sig.sigInst_methInstCount, key.sig.sigInst_methInst_Index,
+ key.sig.scope, key.args);
printf(", value %016llX excp-%08X", value.result, value.exceptionCode);
}
-CORINFO_CLASS_HANDLE MethodContext::repGetArgClass(CORINFO_SIG_INFO* sig, CORINFO_ARG_LIST_HANDLE args, DWORD *exceptionCode)
+CORINFO_CLASS_HANDLE MethodContext::repGetArgClass(CORINFO_SIG_INFO* sig,
+ CORINFO_ARG_LIST_HANDLE args,
+ DWORD* exceptionCode)
{
Agnostic_GetArgClass key;
- ZeroMemory(&key, sizeof(Agnostic_GetArgClass)); //We use the input structs as a key and use memcmp to compare.. so we need to zero out padding too
-
- AssertCodeMsg(GetArgClass != nullptr, EXCEPTIONCODE_MC, "Didn't find %016llx, %016llx. probably a missing exception in getArgClass", key.sig.scope, key.args);
- key.sig.callConv = (DWORD)0;
- key.sig.retTypeClass = (DWORDLONG)0;
- key.sig.retTypeSigClass = (DWORDLONG)0;
- key.sig.retType = (DWORD)0;
- key.sig.flags = (DWORD)0;
- key.sig.numArgs = (DWORD)0;
+ ZeroMemory(&key, sizeof(Agnostic_GetArgClass)); // We use the input structs as a key and use memcmp to compare.. so
+ // we need to zero out padding too
+
+ AssertCodeMsg(GetArgClass != nullptr, EXCEPTIONCODE_MC,
+ "Didn't find %016llx, %016llx. probably a missing exception in getArgClass", key.sig.scope,
+ key.args);
+ key.sig.callConv = (DWORD)0;
+ key.sig.retTypeClass = (DWORDLONG)0;
+ key.sig.retTypeSigClass = (DWORDLONG)0;
+ key.sig.retType = (DWORD)0;
+ key.sig.flags = (DWORD)0;
+ key.sig.numArgs = (DWORD)0;
key.sig.sigInst_classInstCount = (DWORD)sig->sigInst.classInstCount;
- key.sig.sigInst_classInst_Index = (DWORD)GetArgClass->Contains((unsigned char*)sig->sigInst.classInst, sig->sigInst.classInstCount * 8);
+ key.sig.sigInst_classInst_Index =
+ (DWORD)GetArgClass->Contains((unsigned char*)sig->sigInst.classInst, sig->sigInst.classInstCount * 8);
key.sig.sigInst_methInstCount = (DWORD)sig->sigInst.methInstCount;
- key.sig.sigInst_methInst_Index = (DWORD)GetArgClass->Contains((unsigned char*)sig->sigInst.methInst, sig->sigInst.methInstCount * 8);
- key.sig.args = (DWORDLONG)0;
+ key.sig.sigInst_methInst_Index =
+ (DWORD)GetArgClass->Contains((unsigned char*)sig->sigInst.methInst, sig->sigInst.methInstCount * 8);
+ key.sig.args = (DWORDLONG)0;
key.sig.cbSig = (DWORD)0;
- key.sig.pSig = -1;
+ key.sig.pSig = -1;
key.sig.scope = (DWORDLONG)sig->scope;
key.sig.token = (DWORD)0;
- key.args = (DWORDLONG)args;
+ key.args = (DWORDLONG)args;
- AssertCodeMsg(GetArgClass->GetIndex(key) != -1, EXCEPTIONCODE_MC, "Didn't find %016llx, %016llx. probably a missing exception in getArgClass", key.sig.scope, key.args);
+ AssertCodeMsg(GetArgClass->GetIndex(key) != -1, EXCEPTIONCODE_MC,
+ "Didn't find %016llx, %016llx. probably a missing exception in getArgClass", key.sig.scope,
+ key.args);
Agnostic_GetArgClass_Value value = GetArgClass->Get(key);
- *exceptionCode = value.exceptionCode;
+ *exceptionCode = value.exceptionCode;
DEBUG_REP(dmpGetArgClass(key, value));
return (CORINFO_CLASS_HANDLE)value.result;
@@ -2863,14 +2961,18 @@ CorInfoType MethodContext::repGetHFAType(CORINFO_CLASS_HANDLE clsHnd)
DWORD value;
AssertCodeMsg(GetHFAType != nullptr, EXCEPTIONCODE_MC, "Didn't find anything for %016llX", (DWORDLONG)clsHnd);
- AssertCodeMsg(GetHFAType->GetIndex((DWORDLONG)clsHnd) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX", (DWORDLONG)clsHnd);
+ AssertCodeMsg(GetHFAType->GetIndex((DWORDLONG)clsHnd) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX",
+ (DWORDLONG)clsHnd);
value = GetHFAType->Get((DWORDLONG)clsHnd);
DEBUG_REP(dmpGetHFAType((DWORDLONG)clsHnd, value));
return (CorInfoType)value;
}
-void MethodContext::recGetMethodInfo(CORINFO_METHOD_HANDLE ftn, CORINFO_METHOD_INFO *info, bool result, DWORD exceptionCode)
+void MethodContext::recGetMethodInfo(CORINFO_METHOD_HANDLE ftn,
+ CORINFO_METHOD_INFO* info,
+ bool result,
+ DWORD exceptionCode)
{
if (GetMethodInfo == nullptr)
GetMethodInfo = new LightWeightMap<DWORDLONG, Agnostic_GetMethodInfo>();
@@ -2880,46 +2982,54 @@ void MethodContext::recGetMethodInfo(CORINFO_METHOD_HANDLE ftn, CORINFO_METHOD_I
if (result)
{
- value.info.ftn = (DWORDLONG)info->ftn;
- value.info.scope = (DWORDLONG)info->scope;
- value.info.ILCode_offset = (DWORD)GetMethodInfo->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)GetMethodInfo->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 = (DWORD)GetMethodInfo->AddBuffer((unsigned char*)info->args.sigInst.classInst, info->args.sigInst.classInstCount * 8); //porting issue
+ value.info.args.sigInst_classInst_Index =
+ (DWORD)GetMethodInfo->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 = (DWORD)GetMethodInfo->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)GetMethodInfo->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.args.sigInst_methInst_Index =
+ (DWORD)GetMethodInfo->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)GetMethodInfo->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.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.sigInst_classInstCount = (DWORD)info->locals.sigInst.classInstCount;
- value.info.locals.sigInst_classInst_Index = (DWORD)GetMethodInfo->AddBuffer((unsigned char*)info->locals.sigInst.classInst, info->locals.sigInst.classInstCount * 8); //porting issue
+ value.info.locals.sigInst_classInst_Index =
+ (DWORD)GetMethodInfo->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 = (DWORD)GetMethodInfo->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 =
+ (DWORD)GetMethodInfo->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)GetMethodInfo->AddBuffer((unsigned char *)info->locals.pSig, info->locals.cbSig);
+ value.info.locals.pSig = (DWORD)GetMethodInfo->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.result = result;
+ value.result = result;
value.exceptionCode = (DWORD)exceptionCode;
GetMethodInfo->Add((DWORDLONG)ftn, value);
@@ -2929,329 +3039,319 @@ void MethodContext::dmpGetMethodInfo(DWORDLONG key, const Agnostic_GetMethodInfo
{
printf("GetMethodInfo key ftn-%016llX", key);
printf(", value res-%u ftn-%016llX scp-%016llX ilo-%u ils-%u ms-%u ehc-%u opt-%08X 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} "
"excp-%08X",
- value.result,
- 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.exceptionCode);
-}
-bool MethodContext::repGetMethodInfo(CORINFO_METHOD_HANDLE ftn, CORINFO_METHOD_INFO *info, DWORD *exceptionCode)
+ value.result, 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.exceptionCode);
+}
+bool MethodContext::repGetMethodInfo(CORINFO_METHOD_HANDLE ftn, CORINFO_METHOD_INFO* info, DWORD* exceptionCode)
{
Agnostic_GetMethodInfo value;
- AssertCodeMsg(GetMethodInfo != nullptr, EXCEPTIONCODE_MC, "Didn't find %016llx. probably a missing exception in getMethodInfo", (DWORDLONG)ftn);
- AssertCodeMsg(GetMethodInfo->GetIndex((DWORDLONG)ftn) != -1, EXCEPTIONCODE_MC, "Didn't find %016llx. probably a missing exception in getMethodInfo", (DWORDLONG)ftn);
+ AssertCodeMsg(GetMethodInfo != nullptr, EXCEPTIONCODE_MC,
+ "Didn't find %016llx. probably a missing exception in getMethodInfo", (DWORDLONG)ftn);
+ AssertCodeMsg(GetMethodInfo->GetIndex((DWORDLONG)ftn) != -1, EXCEPTIONCODE_MC,
+ "Didn't find %016llx. probably a missing exception in getMethodInfo", (DWORDLONG)ftn);
value = GetMethodInfo->Get((DWORDLONG)ftn);
if (value.result)
{
- info->ftn = (CORINFO_METHOD_HANDLE)value.info.ftn;
- info->scope = (CORINFO_MODULE_HANDLE)value.info.scope;
- info->ILCode = GetMethodInfo->GetBuffer(value.info.ILCode_offset);
- info->ILCodeSize = (unsigned)value.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->ftn = (CORINFO_METHOD_HANDLE)value.info.ftn;
+ info->scope = (CORINFO_MODULE_HANDLE)value.info.scope;
+ info->ILCode = GetMethodInfo->GetBuffer(value.info.ILCode_offset);
+ info->ILCodeSize = (unsigned)value.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*)GetMethodInfo->GetBuffer(value.info.args.sigInst_classInst_Index);
+ info->args.sigInst.classInst =
+ (CORINFO_CLASS_HANDLE*)GetMethodInfo->GetBuffer(value.info.args.sigInst_classInst_Index);
info->args.sigInst.methInstCount = (unsigned)value.info.args.sigInst_methInstCount;
- info->args.sigInst.methInst = (CORINFO_CLASS_HANDLE*)GetMethodInfo->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)GetMethodInfo->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*)GetMethodInfo->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)GetMethodInfo->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*)GetMethodInfo->GetBuffer(value.info.locals.sigInst_classInst_Index);
+ info->locals.sigInst.classInst =
+ (CORINFO_CLASS_HANDLE*)GetMethodInfo->GetBuffer(value.info.locals.sigInst_classInst_Index);
info->locals.sigInst.methInstCount = (unsigned)value.info.locals.sigInst_methInstCount;
- info->locals.sigInst.methInst = (CORINFO_CLASS_HANDLE*)GetMethodInfo->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*)GetMethodInfo->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)GetMethodInfo->GetBuffer(value.info.locals.pSig);
+ info->locals.pSig = (PCCOR_SIGNATURE)GetMethodInfo->GetBuffer(value.info.locals.pSig);
info->locals.scope = (CORINFO_MODULE_HANDLE)value.info.locals.scope;
info->locals.token = (mdToken)value.info.locals.token;
}
- bool result = (bool)value.result;
+ bool result = (bool)value.result;
*exceptionCode = (DWORD)value.exceptionCode;
DEBUG_REP(dmpGetMethodInfo((DWORDLONG)ftn, value));
return result;
}
-void MethodContext::recGetNewHelper(CORINFO_RESOLVED_TOKEN *pResolvedToken, CORINFO_METHOD_HANDLE callerHandle, CorInfoHelpFunc result)
+void MethodContext::recGetNewHelper(CORINFO_RESOLVED_TOKEN* pResolvedToken,
+ CORINFO_METHOD_HANDLE callerHandle,
+ CorInfoHelpFunc result)
{
if (GetNewHelper == nullptr)
GetNewHelper = new LightWeightMap<Agnostic_GetNewHelper, DWORD>();
Agnostic_GetNewHelper key;
- ZeroMemory(&key, sizeof(Agnostic_GetNewHelper)); //We use the input structs as a key and use memcmp to compare.. so we need to zero out padding too
-
- key.ResolvedToken.tokenContext = (DWORDLONG)0;
- key.ResolvedToken.tokenScope = (DWORDLONG)0;
- key.ResolvedToken.token = (DWORD)0;
- key.ResolvedToken.tokenType = (DWORD)0;
- key.ResolvedToken.hClass = (DWORDLONG)pResolvedToken->hClass;
- key.ResolvedToken.hMethod = (DWORDLONG)0;
- key.ResolvedToken.hField = (DWORDLONG)0;
- key.ResolvedToken.typeSpec_Index = (DWORD)0;
- key.ResolvedToken.cbTypeSpec = (DWORD)0;
+ ZeroMemory(&key, sizeof(Agnostic_GetNewHelper)); // We use the input structs as a key and use memcmp to compare.. so
+ // we need to zero out padding too
+
+ key.ResolvedToken.tokenContext = (DWORDLONG)0;
+ key.ResolvedToken.tokenScope = (DWORDLONG)0;
+ key.ResolvedToken.token = (DWORD)0;
+ key.ResolvedToken.tokenType = (DWORD)0;
+ key.ResolvedToken.hClass = (DWORDLONG)pResolvedToken->hClass;
+ key.ResolvedToken.hMethod = (DWORDLONG)0;
+ key.ResolvedToken.hField = (DWORDLONG)0;
+ key.ResolvedToken.typeSpec_Index = (DWORD)0;
+ key.ResolvedToken.cbTypeSpec = (DWORD)0;
key.ResolvedToken.methodSpec_Index = (DWORD)0;
- key.ResolvedToken.cbMethodSpec = (DWORD)0;
- key.callerHandle = (DWORDLONG)callerHandle;
+ key.ResolvedToken.cbMethodSpec = (DWORD)0;
+ key.callerHandle = (DWORDLONG)callerHandle;
GetNewHelper->Add(key, (DWORD)result);
DEBUG_REC(dmpGetNewHelper(key, (DWORD)result));
}
void MethodContext::dmpGetNewHelper(const Agnostic_GetNewHelper& key, DWORD value)
{
- printf("GetNewHelper key cls-%016llX chan-%016llX, value res-%u", key.ResolvedToken.hClass, key.callerHandle, value);
+ printf("GetNewHelper key cls-%016llX chan-%016llX, value res-%u", key.ResolvedToken.hClass, key.callerHandle,
+ value);
}
-CorInfoHelpFunc MethodContext::repGetNewHelper(CORINFO_RESOLVED_TOKEN *pResolvedToken, CORINFO_METHOD_HANDLE callerHandle)
+CorInfoHelpFunc MethodContext::repGetNewHelper(CORINFO_RESOLVED_TOKEN* pResolvedToken,
+ CORINFO_METHOD_HANDLE callerHandle)
{
Agnostic_GetNewHelper key;
- ZeroMemory(&key, sizeof(Agnostic_GetNewHelper)); //We use the input structs as a key and use memcmp to compare.. so we need to zero out padding too
-
- key.ResolvedToken.tokenContext = (DWORDLONG)0;
- key.ResolvedToken.tokenScope = (DWORDLONG)0;
- key.ResolvedToken.token = (DWORD)0;
- key.ResolvedToken.tokenType = (DWORD)0;
- key.ResolvedToken.hClass = (DWORDLONG)pResolvedToken->hClass;
- key.ResolvedToken.hMethod = (DWORDLONG)0;
- key.ResolvedToken.hField = (DWORDLONG)0;
- key.ResolvedToken.typeSpec_Index = (DWORD)0;
- key.ResolvedToken.cbTypeSpec = (DWORD)0;
+ ZeroMemory(&key, sizeof(Agnostic_GetNewHelper)); // We use the input structs as a key and use memcmp to compare.. so
+ // we need to zero out padding too
+
+ key.ResolvedToken.tokenContext = (DWORDLONG)0;
+ key.ResolvedToken.tokenScope = (DWORDLONG)0;
+ key.ResolvedToken.token = (DWORD)0;
+ key.ResolvedToken.tokenType = (DWORD)0;
+ key.ResolvedToken.hClass = (DWORDLONG)pResolvedToken->hClass;
+ key.ResolvedToken.hMethod = (DWORDLONG)0;
+ key.ResolvedToken.hField = (DWORDLONG)0;
+ key.ResolvedToken.typeSpec_Index = (DWORD)0;
+ key.ResolvedToken.cbTypeSpec = (DWORD)0;
key.ResolvedToken.methodSpec_Index = (DWORD)0;
- key.ResolvedToken.cbMethodSpec = (DWORD)0;
- key.callerHandle = (DWORDLONG)callerHandle;
+ key.ResolvedToken.cbMethodSpec = (DWORD)0;
+ key.callerHandle = (DWORDLONG)callerHandle;
- AssertCodeMsg(GetNewHelper != nullptr, EXCEPTIONCODE_MC, "Didn't find anything for %016llX", (DWORDLONG)key.ResolvedToken.hClass);
- AssertCodeMsg(GetNewHelper->GetIndex(key) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX", (DWORDLONG)key.ResolvedToken.hClass);
+ AssertCodeMsg(GetNewHelper != nullptr, EXCEPTIONCODE_MC, "Didn't find anything for %016llX",
+ (DWORDLONG)key.ResolvedToken.hClass);
+ AssertCodeMsg(GetNewHelper->GetIndex(key) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX",
+ (DWORDLONG)key.ResolvedToken.hClass);
CorInfoHelpFunc value = (CorInfoHelpFunc)GetNewHelper->Get(key);
DEBUG_REP(dmpGetNewHelper(key, value));
return value;
}
-void MethodContext::recEmbedGenericHandle(CORINFO_RESOLVED_TOKEN *pResolvedToken, BOOL fEmbedParent, CORINFO_GENERICHANDLE_RESULT *pResult)
+void MethodContext::recEmbedGenericHandle(CORINFO_RESOLVED_TOKEN* pResolvedToken,
+ BOOL fEmbedParent,
+ CORINFO_GENERICHANDLE_RESULT* pResult)
{
if (EmbedGenericHandle == nullptr)
EmbedGenericHandle = new LightWeightMap<Agnostic_EmbedGenericHandle, Agnostic_CORINFO_GENERICHANDLE_RESULT>();
Agnostic_EmbedGenericHandle key;
- ZeroMemory(&key, sizeof(Agnostic_EmbedGenericHandle)); //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_EmbedGenericHandle)); // We use the input structs as a key and use memcmp to
+ // compare.. so we need to zero out padding too
Agnostic_CORINFO_GENERICHANDLE_RESULT 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)EmbedGenericHandle->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)EmbedGenericHandle->AddBuffer((unsigned char*)pResolvedToken->pTypeSpec, pResolvedToken->cbTypeSpec);
key.ResolvedToken.cbTypeSpec = (DWORD)pResolvedToken->cbTypeSpec;
- key.ResolvedToken.methodSpec_Index = (DWORD)EmbedGenericHandle->AddBuffer((unsigned char*)pResolvedToken->pMethodSpec, pResolvedToken->cbMethodSpec);
+ key.ResolvedToken.methodSpec_Index =
+ (DWORD)EmbedGenericHandle->AddBuffer((unsigned char*)pResolvedToken->pMethodSpec, pResolvedToken->cbMethodSpec);
key.ResolvedToken.cbMethodSpec = (DWORD)pResolvedToken->cbMethodSpec;
- key.fEmbedParent = (DWORD)fEmbedParent;
+ key.fEmbedParent = (DWORD)fEmbedParent;
value.lookup.lookupKind.needsRuntimeLookup = (DWORD)pResult->lookup.lookupKind.needsRuntimeLookup;
- value.lookup.lookupKind.runtimeLookupKind = (DWORD)pResult->lookup.lookupKind.runtimeLookupKind;
+ value.lookup.lookupKind.runtimeLookupKind = (DWORD)pResult->lookup.lookupKind.runtimeLookupKind;
if (pResult->lookup.lookupKind.needsRuntimeLookup)
{
value.lookup.constLookup.accessType = (DWORD)0;
- value.lookup.constLookup.handle = (DWORDLONG)0;
- //copy the runtimeLookup view of the union
- value.lookup.runtimeLookup.signature = (DWORDLONG)pResult->lookup.runtimeLookup.signature;
- value.lookup.runtimeLookup.helper = (DWORD)pResult->lookup.runtimeLookup.helper;
+ value.lookup.constLookup.handle = (DWORDLONG)0;
+ // copy the runtimeLookup view of the union
+ value.lookup.runtimeLookup.signature = (DWORDLONG)pResult->lookup.runtimeLookup.signature;
+ value.lookup.runtimeLookup.helper = (DWORD)pResult->lookup.runtimeLookup.helper;
value.lookup.runtimeLookup.indirections = (DWORD)pResult->lookup.runtimeLookup.indirections;
- value.lookup.runtimeLookup.testForNull = (DWORD)pResult->lookup.runtimeLookup.testForNull;
+ value.lookup.runtimeLookup.testForNull = (DWORD)pResult->lookup.runtimeLookup.testForNull;
value.lookup.runtimeLookup.testForFixup = (DWORD)pResult->lookup.runtimeLookup.testForFixup;
- for (int i = 0; i < CORINFO_MAXINDIRECTIONS; i++)
+ for (int i = 0; i < CORINFO_MAXINDIRECTIONS; i++)
value.lookup.runtimeLookup.offsets[i] = (DWORDLONG)pResult->lookup.runtimeLookup.offsets[i];
}
else
{
- value.lookup.runtimeLookup.signature = (DWORDLONG)0;
- value.lookup.runtimeLookup.helper = (DWORD)0;
+ value.lookup.runtimeLookup.signature = (DWORDLONG)0;
+ value.lookup.runtimeLookup.helper = (DWORD)0;
value.lookup.runtimeLookup.indirections = (DWORD)0;
- value.lookup.runtimeLookup.testForNull = (DWORD)0;
+ value.lookup.runtimeLookup.testForNull = (DWORD)0;
value.lookup.runtimeLookup.testForFixup = (DWORD)0;
- for (int i = 0; i < CORINFO_MAXINDIRECTIONS; i++)
+ for (int i = 0; i < CORINFO_MAXINDIRECTIONS; i++)
value.lookup.runtimeLookup.offsets[i] = (DWORDLONG)0;
- //copy the constLookup view of the union
+ // copy the constLookup view of the union
value.lookup.constLookup.accessType = (DWORD)pResult->lookup.constLookup.accessType;
- value.lookup.constLookup.handle = (DWORDLONG)pResult->lookup.constLookup.handle;
+ value.lookup.constLookup.handle = (DWORDLONG)pResult->lookup.constLookup.handle;
}
value.compileTimeHandle = (DWORDLONG)pResult->compileTimeHandle;
- value.handleType = (DWORD)pResult->handleType;
+ value.handleType = (DWORD)pResult->handleType;
EmbedGenericHandle->Add(key, value);
DEBUG_REC(dmpEmbedGenericHandle(key, value));
}
-void MethodContext::dmpEmbedGenericHandle(const Agnostic_EmbedGenericHandle& key, const Agnostic_CORINFO_GENERICHANDLE_RESULT& value)
-{
- printf("EmbedGenericHandle key rt{tokCon-%016llX tokScp-%016llX tok-%08X tokTyp-%08X cls-%016llX ftn-%016llX fld-%016llX tsi-%u cbts-%u msi-%u cbms-%u} emb-%u",
- 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.fEmbedParent);
- printf(", value nrl-%u rlk-%u", value.lookup.lookupKind.needsRuntimeLookup, value.lookup.lookupKind.runtimeLookupKind);
+void MethodContext::dmpEmbedGenericHandle(const Agnostic_EmbedGenericHandle& key,
+ const Agnostic_CORINFO_GENERICHANDLE_RESULT& value)
+{
+ printf("EmbedGenericHandle key rt{tokCon-%016llX tokScp-%016llX tok-%08X tokTyp-%08X cls-%016llX ftn-%016llX "
+ "fld-%016llX tsi-%u cbts-%u msi-%u cbms-%u} emb-%u",
+ 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.fEmbedParent);
+ printf(", value nrl-%u rlk-%u", value.lookup.lookupKind.needsRuntimeLookup,
+ value.lookup.lookupKind.runtimeLookupKind);
if (value.lookup.lookupKind.needsRuntimeLookup)
{
- printf(" sig-%016llX hlp-%u ind-%u tfn-%u tff-%u { ",
- value.lookup.runtimeLookup.signature,
- value.lookup.runtimeLookup.helper,
- value.lookup.runtimeLookup.indirections,
- value.lookup.runtimeLookup.testForNull,
- value.lookup.runtimeLookup.testForFixup);
+ printf(" sig-%016llX hlp-%u ind-%u tfn-%u tff-%u { ", value.lookup.runtimeLookup.signature,
+ value.lookup.runtimeLookup.helper, value.lookup.runtimeLookup.indirections,
+ value.lookup.runtimeLookup.testForNull, value.lookup.runtimeLookup.testForFixup);
for (int i = 0; i < CORINFO_MAXINDIRECTIONS; i++)
printf("%016llX ", value.lookup.runtimeLookup.offsets[i]);
printf("}");
}
else
{
- printf(" at-%u han-%016llX",
- value.lookup.constLookup.accessType,
- value.lookup.constLookup.handle);
+ printf(" at-%u han-%016llX", value.lookup.constLookup.accessType, value.lookup.constLookup.handle);
}
printf(" cth-%016llX ht-%u", value.compileTimeHandle, value.handleType);
}
-void MethodContext::repEmbedGenericHandle(CORINFO_RESOLVED_TOKEN *pResolvedToken, BOOL fEmbedParent, CORINFO_GENERICHANDLE_RESULT *pResult)
+void MethodContext::repEmbedGenericHandle(CORINFO_RESOLVED_TOKEN* pResolvedToken,
+ BOOL fEmbedParent,
+ CORINFO_GENERICHANDLE_RESULT* pResult)
{
Agnostic_EmbedGenericHandle key;
- ZeroMemory(&key, sizeof(Agnostic_EmbedGenericHandle)); //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_EmbedGenericHandle)); // We use the input structs as a key and use memcmp to
+ // compare.. so we need to zero out padding too
Agnostic_CORINFO_GENERICHANDLE_RESULT value;
AssertCodeMsg(EmbedGenericHandle != nullptr, EXCEPTIONCODE_MC, "Encountered an empty LWM while looking for ...");
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)EmbedGenericHandle->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)EmbedGenericHandle->Contains((unsigned char*)pResolvedToken->pTypeSpec, pResolvedToken->cbTypeSpec);
key.ResolvedToken.cbTypeSpec = (DWORD)pResolvedToken->cbTypeSpec;
- key.ResolvedToken.methodSpec_Index = (DWORD)EmbedGenericHandle->Contains((unsigned char *)pResolvedToken->pMethodSpec, pResolvedToken->cbMethodSpec);
+ key.ResolvedToken.methodSpec_Index =
+ (DWORD)EmbedGenericHandle->Contains((unsigned char*)pResolvedToken->pMethodSpec, pResolvedToken->cbMethodSpec);
key.ResolvedToken.cbMethodSpec = (DWORD)pResolvedToken->cbMethodSpec;
- key.fEmbedParent = (DWORD)fEmbedParent;
+ key.fEmbedParent = (DWORD)fEmbedParent;
AssertCodeMsg(EmbedGenericHandle->GetIndex(key) != -1, EXCEPTIONCODE_MC, "Didn't find ...");
value = EmbedGenericHandle->Get(key);
pResult->lookup.lookupKind.needsRuntimeLookup = value.lookup.lookupKind.needsRuntimeLookup != 0;
- pResult->lookup.lookupKind.runtimeLookupKind = (CORINFO_RUNTIME_LOOKUP_KIND)value.lookup.lookupKind.runtimeLookupKind;
+ pResult->lookup.lookupKind.runtimeLookupKind =
+ (CORINFO_RUNTIME_LOOKUP_KIND)value.lookup.lookupKind.runtimeLookupKind;
if (pResult->lookup.lookupKind.needsRuntimeLookup)
{
- //copy the runtimeLookup view of the union
- pResult->lookup.runtimeLookup.signature = (LPVOID)value.lookup.runtimeLookup.signature;
- pResult->lookup.runtimeLookup.helper = (CorInfoHelpFunc)value.lookup.runtimeLookup.helper;
+ // copy the runtimeLookup view of the union
+ pResult->lookup.runtimeLookup.signature = (LPVOID)value.lookup.runtimeLookup.signature;
+ pResult->lookup.runtimeLookup.helper = (CorInfoHelpFunc)value.lookup.runtimeLookup.helper;
pResult->lookup.runtimeLookup.indirections = (WORD)value.lookup.runtimeLookup.indirections;
- pResult->lookup.runtimeLookup.testForNull = value.lookup.runtimeLookup.testForNull != 0;
+ pResult->lookup.runtimeLookup.testForNull = value.lookup.runtimeLookup.testForNull != 0;
pResult->lookup.runtimeLookup.testForFixup = value.lookup.runtimeLookup.testForFixup != 0;
- for (int i = 0; i < CORINFO_MAXINDIRECTIONS; i++)
+ for (int i = 0; i < CORINFO_MAXINDIRECTIONS; i++)
pResult->lookup.runtimeLookup.offsets[i] = (size_t)value.lookup.runtimeLookup.offsets[i];
}
else
{
pResult->lookup.constLookup.accessType = (InfoAccessType)value.lookup.constLookup.accessType;
- pResult->lookup.constLookup.handle = (CORINFO_GENERIC_HANDLE)value.lookup.constLookup.handle;
+ pResult->lookup.constLookup.handle = (CORINFO_GENERIC_HANDLE)value.lookup.constLookup.handle;
}
pResult->compileTimeHandle = (CORINFO_GENERIC_HANDLE)value.compileTimeHandle;
- pResult->handleType = (CorInfoGenericHandleType)value.handleType;
+ pResult->handleType = (CorInfoGenericHandleType)value.handleType;
DEBUG_REP(dmpEmbedGenericHandle(key, value));
}
-void MethodContext::recGetEHinfo(CORINFO_METHOD_HANDLE ftn, unsigned EHnumber, CORINFO_EH_CLAUSE *clause)
+void MethodContext::recGetEHinfo(CORINFO_METHOD_HANDLE ftn, unsigned EHnumber, CORINFO_EH_CLAUSE* clause)
{
if (GetEHinfo == nullptr)
GetEHinfo = new LightWeightMap<DLD, Agnostic_CORINFO_EH_CLAUSE>();
DLD key;
- ZeroMemory(&key, sizeof(DLD)); //We use the input structs as a key and use memcmp to compare.. so we need to zero out padding too
+ ZeroMemory(&key, sizeof(DLD)); // We use the input structs as a key and use memcmp to compare.. so we need to zero
+ // out padding too
Agnostic_CORINFO_EH_CLAUSE value;
key.A = (DWORDLONG)ftn;
key.B = (DWORD)EHnumber;
- 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;
GetEHinfo->Add(key, value);
DEBUG_REC(dmpGetEHinfo(key, value));
}
void MethodContext::dmpGetEHinfo(DLD key, const Agnostic_CORINFO_EH_CLAUSE& value)
{
- printf("GetEHinfo key ftn-%016llX ehn-%u, value flg-%u to-%u tl-%u ho-%u hl-%u ct-%u",
- key.A, key.B, value.Flags, value.TryOffset, value.TryLength, value.HandlerOffset, value.HandlerLength, value.ClassToken);
+ printf("GetEHinfo key ftn-%016llX ehn-%u, value flg-%u to-%u tl-%u ho-%u hl-%u ct-%u", key.A, key.B, value.Flags,
+ value.TryOffset, value.TryLength, value.HandlerOffset, value.HandlerLength, value.ClassToken);
}
-void MethodContext::repGetEHinfo(CORINFO_METHOD_HANDLE ftn, unsigned EHnumber, CORINFO_EH_CLAUSE *clause)
+void MethodContext::repGetEHinfo(CORINFO_METHOD_HANDLE ftn, unsigned EHnumber, CORINFO_EH_CLAUSE* clause)
{
DLD key;
- ZeroMemory(&key, sizeof(DLD)); //We use the input structs as a key and use memcmp to compare.. so we need to zero out padding too
+ ZeroMemory(&key, sizeof(DLD)); // We use the input structs as a key and use memcmp to compare.. so we need to zero
+ // out padding too
Agnostic_CORINFO_EH_CLAUSE value;
key.A = (DWORDLONG)ftn;
@@ -3259,16 +3359,18 @@ void MethodContext::repGetEHinfo(CORINFO_METHOD_HANDLE ftn, unsigned EHnumber, C
value = GetEHinfo->Get(key);
- clause->Flags = (CORINFO_EH_CLAUSE_FLAGS)value.Flags;
- clause->TryOffset = (DWORD)value.TryOffset;
- clause->TryLength = (DWORD)value.TryLength;
+ clause->Flags = (CORINFO_EH_CLAUSE_FLAGS)value.Flags;
+ clause->TryOffset = (DWORD)value.TryOffset;
+ clause->TryLength = (DWORD)value.TryLength;
clause->HandlerOffset = (DWORD)value.HandlerOffset;
clause->HandlerLength = (DWORD)value.HandlerLength;
- clause->ClassToken = (DWORD)value.ClassToken;
+ clause->ClassToken = (DWORD)value.ClassToken;
DEBUG_REP(dmpGetEHinfo(key, value));
}
-void MethodContext::recGetMethodVTableOffset(CORINFO_METHOD_HANDLE method, unsigned *offsetOfIndirection, unsigned* offsetAfterIndirection)
+void MethodContext::recGetMethodVTableOffset(CORINFO_METHOD_HANDLE method,
+ unsigned* offsetOfIndirection,
+ unsigned* offsetAfterIndirection)
{
if (GetMethodVTableOffset == nullptr)
GetMethodVTableOffset = new LightWeightMap<DWORDLONG, DD>();
@@ -3283,21 +3385,27 @@ void MethodContext::dmpGetMethodVTableOffset(DWORDLONG key, DD value)
{
printf("GetMethodVTableOffset key ftn-%016llX, value offi-%u, offa-%u", key, value.A, value.B);
}
-void MethodContext::repGetMethodVTableOffset(CORINFO_METHOD_HANDLE method, unsigned *offsetOfIndirection, unsigned* offsetAfterIndirection)
+void MethodContext::repGetMethodVTableOffset(CORINFO_METHOD_HANDLE method,
+ unsigned* offsetOfIndirection,
+ unsigned* offsetAfterIndirection)
{
DD value;
- AssertCodeMsg(GetMethodVTableOffset != nullptr, EXCEPTIONCODE_MC, "Didn't find anything for %016llX", (DWORDLONG)method);
- AssertCodeMsg(GetMethodVTableOffset->GetIndex((DWORDLONG)method) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX", (DWORDLONG)method);
+ AssertCodeMsg(GetMethodVTableOffset != nullptr, EXCEPTIONCODE_MC, "Didn't find anything for %016llX",
+ (DWORDLONG)method);
+ AssertCodeMsg(GetMethodVTableOffset->GetIndex((DWORDLONG)method) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX",
+ (DWORDLONG)method);
value = GetMethodVTableOffset->Get((DWORDLONG)method);
- *offsetOfIndirection = (unsigned)value.A;
+ *offsetOfIndirection = (unsigned)value.A;
*offsetAfterIndirection = (unsigned)value.B;
DEBUG_REP(dmpGetMethodVTableOffset((DWORDLONG)method, value));
}
-void MethodContext::recResolveVirtualMethod(CORINFO_METHOD_HANDLE virtMethod, CORINFO_CLASS_HANDLE implClass,
- CORINFO_CONTEXT_HANDLE ownerType, CORINFO_METHOD_HANDLE result)
+void MethodContext::recResolveVirtualMethod(CORINFO_METHOD_HANDLE virtMethod,
+ CORINFO_CLASS_HANDLE implClass,
+ CORINFO_CONTEXT_HANDLE ownerType,
+ CORINFO_METHOD_HANDLE result)
{
if (ResolveVirtualMethod == nullptr)
{
@@ -3305,31 +3413,33 @@ void MethodContext::recResolveVirtualMethod(CORINFO_METHOD_HANDLE virtMethod, CO
}
Agnostic_ResolveVirtualMethod key;
- key.virtualMethod = (DWORDLONG)virtMethod;
+ key.virtualMethod = (DWORDLONG)virtMethod;
key.implementingClass = (DWORDLONG)implClass;
- key.ownerType = (DWORDLONG)ownerType;
- ResolveVirtualMethod->Add(key, (DWORDLONG) result);
+ key.ownerType = (DWORDLONG)ownerType;
+ ResolveVirtualMethod->Add(key, (DWORDLONG)result);
DEBUG_REC(dmpResolveVirtualMethod(key, result));
}
void MethodContext::dmpResolveVirtualMethod(const Agnostic_ResolveVirtualMethod& key, DWORDLONG value)
{
printf("ResolveVirtualMethod virtMethod-%016llX, implClass-%016llX, ownerType--%01611X, result-%016llX",
- key.virtualMethod, key.implementingClass, key.ownerType, value);
+ key.virtualMethod, key.implementingClass, key.ownerType, value);
}
-CORINFO_METHOD_HANDLE MethodContext::repResolveVirtualMethod(CORINFO_METHOD_HANDLE virtMethod, CORINFO_CLASS_HANDLE implClass,
- CORINFO_CONTEXT_HANDLE ownerType)
+CORINFO_METHOD_HANDLE MethodContext::repResolveVirtualMethod(CORINFO_METHOD_HANDLE virtMethod,
+ CORINFO_CLASS_HANDLE implClass,
+ CORINFO_CONTEXT_HANDLE ownerType)
{
Agnostic_ResolveVirtualMethod key;
- key.virtualMethod = (DWORDLONG)virtMethod;
+ key.virtualMethod = (DWORDLONG)virtMethod;
key.implementingClass = (DWORDLONG)implClass;
- key.ownerType = (DWORDLONG)ownerType;
+ key.ownerType = (DWORDLONG)ownerType;
- AssertCodeMsg(ResolveVirtualMethod != nullptr, EXCEPTIONCODE_MC, "No ResolveVirtualMap map for %016llX-%016llX-%016llX",
- key.virtualMethod, key.implementingClass, key.ownerType);
+ AssertCodeMsg(ResolveVirtualMethod != nullptr, EXCEPTIONCODE_MC,
+ "No ResolveVirtualMap map for %016llX-%016llX-%016llX", key.virtualMethod, key.implementingClass,
+ key.ownerType);
AssertCodeMsg(ResolveVirtualMethod->GetIndex(key) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX-%016llx-%016llX",
- key.virtualMethod, key.implementingClass, key.ownerType);
+ key.virtualMethod, key.implementingClass, key.ownerType);
DWORDLONG result = ResolveVirtualMethod->Get(key);
DEBUG_REP(dmpResolveVirtualMethod(key, result));
@@ -3337,25 +3447,26 @@ CORINFO_METHOD_HANDLE MethodContext::repResolveVirtualMethod(CORINFO_METHOD_HAND
return (CORINFO_METHOD_HANDLE)result;
}
-void MethodContext::recGetTokenTypeAsHandle(CORINFO_RESOLVED_TOKEN * pResolvedToken, CORINFO_CLASS_HANDLE result)
+void MethodContext::recGetTokenTypeAsHandle(CORINFO_RESOLVED_TOKEN* pResolvedToken, CORINFO_CLASS_HANDLE result)
{
if (GetTokenTypeAsHandle == nullptr)
GetTokenTypeAsHandle = new LightWeightMap<Agnostic_CORINFO_RESOLVED_TOKEN, DWORDLONG>();
Agnostic_CORINFO_RESOLVED_TOKEN key;
- ZeroMemory(&key, sizeof(Agnostic_CORINFO_RESOLVED_TOKEN)); //We use the input structs as a key and use memcmp to compare.. so we need to zero out padding too
-
- key.tokenContext = (DWORDLONG)0;
- key.tokenScope = (DWORDLONG)0;
- key.token = (DWORD)0;
- key.tokenType = (DWORD)0;
- key.hClass = (DWORDLONG)0;
- key.hMethod = (DWORDLONG)pResolvedToken->hMethod;
- key.hField = (DWORDLONG)pResolvedToken->hField;
- key.typeSpec_Index = (DWORD)0;
- key.cbTypeSpec = (DWORD)0;
+ ZeroMemory(&key, sizeof(Agnostic_CORINFO_RESOLVED_TOKEN)); // We use the input structs as a key and use memcmp to
+ // compare.. so we need to zero out padding too
+
+ key.tokenContext = (DWORDLONG)0;
+ key.tokenScope = (DWORDLONG)0;
+ key.token = (DWORD)0;
+ key.tokenType = (DWORD)0;
+ key.hClass = (DWORDLONG)0;
+ key.hMethod = (DWORDLONG)pResolvedToken->hMethod;
+ key.hField = (DWORDLONG)pResolvedToken->hField;
+ key.typeSpec_Index = (DWORD)0;
+ key.cbTypeSpec = (DWORD)0;
key.methodSpec_Index = (DWORD)0;
- key.cbMethodSpec = (DWORD)0;
+ key.cbMethodSpec = (DWORD)0;
GetTokenTypeAsHandle->Add(key, (DWORDLONG)result);
}
@@ -3363,143 +3474,139 @@ void MethodContext::dmpGetTokenTypeAsHandle(const Agnostic_CORINFO_RESOLVED_TOKE
{
printf("GetTokenTypeAsHandle key ftn-%016llX fld-%016llX, value cls-%016llX", key.hMethod, key.hField, value);
}
-CORINFO_CLASS_HANDLE MethodContext::repGetTokenTypeAsHandle(CORINFO_RESOLVED_TOKEN * pResolvedToken)
+CORINFO_CLASS_HANDLE MethodContext::repGetTokenTypeAsHandle(CORINFO_RESOLVED_TOKEN* pResolvedToken)
{
Agnostic_CORINFO_RESOLVED_TOKEN key;
- ZeroMemory(&key, sizeof(Agnostic_CORINFO_RESOLVED_TOKEN)); //We use the input structs as a key and use memcmp to compare.. so we need to zero out padding too
-
- key.tokenContext = (DWORDLONG)0;
- key.tokenScope = (DWORDLONG)0;
- key.token = (DWORD)0;
- key.tokenType = (DWORD)0;
- key.hClass = (DWORDLONG)0;
- key.hMethod = (DWORDLONG)pResolvedToken->hMethod;
- key.hField = (DWORDLONG)pResolvedToken->hField;
- key.typeSpec_Index = (DWORD)0;
- key.cbTypeSpec = (DWORD)0;
+ ZeroMemory(&key, sizeof(Agnostic_CORINFO_RESOLVED_TOKEN)); // We use the input structs as a key and use memcmp to
+ // compare.. so we need to zero out padding too
+
+ key.tokenContext = (DWORDLONG)0;
+ key.tokenScope = (DWORDLONG)0;
+ key.token = (DWORD)0;
+ key.tokenType = (DWORD)0;
+ key.hClass = (DWORDLONG)0;
+ key.hMethod = (DWORDLONG)pResolvedToken->hMethod;
+ key.hField = (DWORDLONG)pResolvedToken->hField;
+ key.typeSpec_Index = (DWORD)0;
+ key.cbTypeSpec = (DWORD)0;
key.methodSpec_Index = (DWORD)0;
- key.cbMethodSpec = (DWORD)0;
+ key.cbMethodSpec = (DWORD)0;
CORINFO_CLASS_HANDLE value = (CORINFO_CLASS_HANDLE)GetTokenTypeAsHandle->Get(key);
return value;
}
-void MethodContext::recGetFieldInfo(CORINFO_RESOLVED_TOKEN *pResolvedToken, CORINFO_METHOD_HANDLE callerHandle, CORINFO_ACCESS_FLAGS flags,
- CORINFO_FIELD_INFO *pResult)
+void MethodContext::recGetFieldInfo(CORINFO_RESOLVED_TOKEN* pResolvedToken,
+ CORINFO_METHOD_HANDLE callerHandle,
+ CORINFO_ACCESS_FLAGS flags,
+ CORINFO_FIELD_INFO* pResult)
{
if (GetFieldInfo == nullptr)
GetFieldInfo = new LightWeightMap<Agnostic_GetFieldInfo, Agnostic_CORINFO_FIELD_INFO>();
Agnostic_GetFieldInfo key;
- ZeroMemory(&key, sizeof(Agnostic_GetFieldInfo)); //Since dd has nested structs, and we use memcmp to compare, we need to zero out the padding bytes too
+ ZeroMemory(&key, sizeof(Agnostic_GetFieldInfo)); // Since dd has nested structs, and we use memcmp to compare, we
+ // need to zero out the padding bytes too
Agnostic_CORINFO_FIELD_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)GetFieldInfo->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)GetFieldInfo->AddBuffer((unsigned char*)pResolvedToken->pTypeSpec, pResolvedToken->cbTypeSpec);
key.ResolvedToken.cbTypeSpec = (DWORD)pResolvedToken->cbTypeSpec;
- key.ResolvedToken.methodSpec_Index = (DWORD)GetFieldInfo->AddBuffer((unsigned char*)pResolvedToken->pMethodSpec, pResolvedToken->cbMethodSpec);
+ key.ResolvedToken.methodSpec_Index =
+ (DWORD)GetFieldInfo->AddBuffer((unsigned char*)pResolvedToken->pMethodSpec, pResolvedToken->cbMethodSpec);
key.ResolvedToken.cbMethodSpec = (DWORD)pResolvedToken->cbMethodSpec;
- key.callerHandle = (DWORDLONG)callerHandle;
- key.flags = (DWORD)flags;
-
- value.fieldAccessor = (DWORD)pResult->fieldAccessor;
- value.fieldFlags = (DWORD)pResult->fieldFlags;
- value.helper = (DWORD)pResult->helper;
- value.offset = (DWORD)pResult->offset;
- value.fieldType = (DWORD)pResult->fieldType;
- value.structType = (DWORDLONG)pResult->structType;
- value.accessAllowed = (DWORD)pResult->accessAllowed;
+ key.callerHandle = (DWORDLONG)callerHandle;
+ key.flags = (DWORD)flags;
+
+ value.fieldAccessor = (DWORD)pResult->fieldAccessor;
+ value.fieldFlags = (DWORD)pResult->fieldFlags;
+ value.helper = (DWORD)pResult->helper;
+ value.offset = (DWORD)pResult->offset;
+ value.fieldType = (DWORD)pResult->fieldType;
+ value.structType = (DWORDLONG)pResult->structType;
+ value.accessAllowed = (DWORD)pResult->accessAllowed;
value.accessCalloutHelper.helperNum = (DWORD)pResult->accessCalloutHelper.helperNum;
- value.accessCalloutHelper.numArgs = (DWORD)pResult->accessCalloutHelper.numArgs;
+ value.accessCalloutHelper.numArgs = (DWORD)pResult->accessCalloutHelper.numArgs;
for (int i = 0; i < CORINFO_ACCESS_ALLOWED_MAX_ARGS; i++)
{
value.accessCalloutHelper.args[i].constant = (DWORDLONG)pResult->accessCalloutHelper.args[i].constant;
- value.accessCalloutHelper.args[i].argType = (DWORD)pResult->accessCalloutHelper.args[i].argType;
+ value.accessCalloutHelper.args[i].argType = (DWORD)pResult->accessCalloutHelper.args[i].argType;
}
GetFieldInfo->Add(key, value);
DEBUG_REC(dmpGetFieldInfo(key, value));
}
void MethodContext::dmpGetFieldInfo(const Agnostic_GetFieldInfo& key, const Agnostic_CORINFO_FIELD_INFO& value)
{
- printf("GetFieldInfo key ch-%016llX flg-%08X rt{tc-%016llX ts-%016llX tok-%08X tt-%u cls-%016llX meth-%016llX fld-%016llX tsi-%u cbts-%u msi-%u cbms-%u}",
- 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);
-
- printf(", value fa-%u fflg-%08X hlp-%u off-%u fT-%u(%s) sT-%016llX aa-%u hnum-%u na-%u {",
- value.fieldAccessor,
- value.fieldFlags,
- value.helper,
- value.offset,
- value.fieldType,
- toString((CorInfoType)value.fieldType),
- value.structType,
- value.accessAllowed,
- value.accessCalloutHelper.helperNum,
- value.accessCalloutHelper.numArgs);
+ printf("GetFieldInfo key ch-%016llX flg-%08X rt{tc-%016llX ts-%016llX tok-%08X tt-%u cls-%016llX meth-%016llX "
+ "fld-%016llX tsi-%u cbts-%u msi-%u cbms-%u}",
+ 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);
+
+ printf(", value fa-%u fflg-%08X hlp-%u off-%u fT-%u(%s) sT-%016llX aa-%u hnum-%u na-%u {", value.fieldAccessor,
+ value.fieldFlags, value.helper, value.offset, value.fieldType, toString((CorInfoType)value.fieldType),
+ value.structType, value.accessAllowed, value.accessCalloutHelper.helperNum,
+ value.accessCalloutHelper.numArgs);
for (int i = 0; i < CORINFO_ACCESS_ALLOWED_MAX_ARGS; i++)
{
switch ((CorInfoAccessAllowedHelperArgType)value.accessCalloutHelper.args[i].argType)
{
- default:
- printf("{%u: illegal}", i);
- break;
- case CORINFO_HELPER_ARG_TYPE_Field:
- printf("{%u: fld-%016llX}", i, value.accessCalloutHelper.args[i].constant);
- break;
- case CORINFO_HELPER_ARG_TYPE_Method:
- printf("{%u: mth-%016llX}", i, value.accessCalloutHelper.args[i].constant);
- break;
- case CORINFO_HELPER_ARG_TYPE_Class:
- printf("{%u: cls-%016llX}", i, value.accessCalloutHelper.args[i].constant);
- break;
- case CORINFO_HELPER_ARG_TYPE_Module:
- printf("{%u: mod-%016llX}", i, value.accessCalloutHelper.args[i].constant);
- break;
- case CORINFO_HELPER_ARG_TYPE_Const:
- printf("{%u: const-%016llX}", i, value.accessCalloutHelper.args[i].constant);
- break;
+ default:
+ printf("{%u: illegal}", i);
+ break;
+ case CORINFO_HELPER_ARG_TYPE_Field:
+ printf("{%u: fld-%016llX}", i, value.accessCalloutHelper.args[i].constant);
+ break;
+ case CORINFO_HELPER_ARG_TYPE_Method:
+ printf("{%u: mth-%016llX}", i, value.accessCalloutHelper.args[i].constant);
+ break;
+ case CORINFO_HELPER_ARG_TYPE_Class:
+ printf("{%u: cls-%016llX}", i, value.accessCalloutHelper.args[i].constant);
+ break;
+ case CORINFO_HELPER_ARG_TYPE_Module:
+ printf("{%u: mod-%016llX}", i, value.accessCalloutHelper.args[i].constant);
+ break;
+ case CORINFO_HELPER_ARG_TYPE_Const:
+ printf("{%u: const-%016llX}", i, value.accessCalloutHelper.args[i].constant);
+ break;
}
}
printf("}");
}
-void MethodContext::repGetFieldInfo(CORINFO_RESOLVED_TOKEN *pResolvedToken, CORINFO_METHOD_HANDLE callerHandle, CORINFO_ACCESS_FLAGS flags,
- CORINFO_FIELD_INFO *pResult)
+void MethodContext::repGetFieldInfo(CORINFO_RESOLVED_TOKEN* pResolvedToken,
+ CORINFO_METHOD_HANDLE callerHandle,
+ CORINFO_ACCESS_FLAGS flags,
+ CORINFO_FIELD_INFO* pResult)
{
Agnostic_GetFieldInfo key;
- ZeroMemory(&key, sizeof(Agnostic_GetFieldInfo)); //Since dd has nested structs, and we use memcmp to compare, we need to zero out the padding bytes too
+ ZeroMemory(&key, sizeof(Agnostic_GetFieldInfo)); // Since dd has nested structs, and we use memcmp to compare, we
+ // need to zero out the padding bytes too
Agnostic_CORINFO_FIELD_INFO value;
AssertCodeMsg(GetFieldInfo != nullptr, EXCEPTIONCODE_MC, "Didn't find %x", pResolvedToken->token);
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)GetFieldInfo->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)GetFieldInfo->Contains((unsigned char*)pResolvedToken->pTypeSpec, pResolvedToken->cbTypeSpec);
key.ResolvedToken.cbTypeSpec = (DWORD)pResolvedToken->cbTypeSpec;
- key.ResolvedToken.methodSpec_Index = (DWORD)GetFieldInfo->Contains((unsigned char *)pResolvedToken->pMethodSpec, pResolvedToken->cbMethodSpec);
+ key.ResolvedToken.methodSpec_Index =
+ (DWORD)GetFieldInfo->Contains((unsigned char*)pResolvedToken->pMethodSpec, pResolvedToken->cbMethodSpec);
key.ResolvedToken.cbMethodSpec = (DWORD)pResolvedToken->cbMethodSpec;
- key.callerHandle = (DWORDLONG)callerHandle;
- key.flags = (DWORD)flags;
+ key.callerHandle = (DWORDLONG)callerHandle;
+ key.flags = (DWORD)flags;
DWORD origFlag = key.flags;
@@ -3516,7 +3623,8 @@ void MethodContext::repGetFieldInfo(CORINFO_RESOLVED_TOKEN *pResolvedToken, CORI
key.flags = origFlag ^ ((DWORD)CORINFO_ACCESS_THIS | (DWORD)CORINFO_ACCESS_UNWRAP);
if (GetFieldInfo->GetIndex(key) != -1)
{
- LogDebug("Sparse - repGetFieldInfo found value with inverted CORINFO_ACCESS_UNWRAP|CORINFO_ACCESS_THIS");
+ LogDebug(
+ "Sparse - repGetFieldInfo found value with inverted CORINFO_ACCESS_UNWRAP|CORINFO_ACCESS_THIS");
}
else
{
@@ -3538,24 +3646,27 @@ void MethodContext::repGetFieldInfo(CORINFO_RESOLVED_TOKEN *pResolvedToken, CORI
value = GetFieldInfo->Get(key);
- pResult->fieldAccessor = (CORINFO_FIELD_ACCESSOR)value.fieldAccessor;
- pResult->fieldFlags = (unsigned)value.fieldFlags;
- pResult->helper = (CorInfoHelpFunc)value.helper;
- pResult->offset = (DWORD)value.offset;
- pResult->fieldType = (CorInfoType)value.fieldType;
- pResult->structType = (CORINFO_CLASS_HANDLE)value.structType;
- pResult->accessAllowed = (CorInfoIsAccessAllowedResult)value.accessAllowed;
+ pResult->fieldAccessor = (CORINFO_FIELD_ACCESSOR)value.fieldAccessor;
+ pResult->fieldFlags = (unsigned)value.fieldFlags;
+ pResult->helper = (CorInfoHelpFunc)value.helper;
+ pResult->offset = (DWORD)value.offset;
+ pResult->fieldType = (CorInfoType)value.fieldType;
+ pResult->structType = (CORINFO_CLASS_HANDLE)value.structType;
+ pResult->accessAllowed = (CorInfoIsAccessAllowedResult)value.accessAllowed;
pResult->accessCalloutHelper.helperNum = (CorInfoHelpFunc)value.accessCalloutHelper.helperNum;
- pResult->accessCalloutHelper.numArgs = (unsigned)value.accessCalloutHelper.numArgs;
+ pResult->accessCalloutHelper.numArgs = (unsigned)value.accessCalloutHelper.numArgs;
for (int i = 0; i < CORINFO_ACCESS_ALLOWED_MAX_ARGS; i++)
{
pResult->accessCalloutHelper.args[i].constant = (size_t)value.accessCalloutHelper.args[i].constant;
- pResult->accessCalloutHelper.args[i].argType = (CorInfoAccessAllowedHelperArgType)value.accessCalloutHelper.args[i].argType;
+ pResult->accessCalloutHelper.args[i].argType =
+ (CorInfoAccessAllowedHelperArgType)value.accessCalloutHelper.args[i].argType;
}
DEBUG_REP(dmpGetFieldInfo(key, value));
}
-void MethodContext::recEmbedMethodHandle(CORINFO_METHOD_HANDLE handle, void **ppIndirection, CORINFO_METHOD_HANDLE result)
+void MethodContext::recEmbedMethodHandle(CORINFO_METHOD_HANDLE handle,
+ void** ppIndirection,
+ CORINFO_METHOD_HANDLE result)
{
if (EmbedMethodHandle == nullptr)
EmbedMethodHandle = new LightWeightMap<DWORDLONG, DLDL>();
@@ -3565,7 +3676,7 @@ void MethodContext::recEmbedMethodHandle(CORINFO_METHOD_HANDLE handle, void **pp
value.A = (DWORDLONG)0;
else
value.A = (DWORDLONG)*ppIndirection;
- value.B = (DWORDLONG)result;
+ value.B = (DWORDLONG)result;
EmbedMethodHandle->Add((DWORDLONG)handle, value);
DEBUG_REC(dmpEmbedMethodHandle((DWORDLONG)handle, value));
@@ -3574,21 +3685,23 @@ void MethodContext::dmpEmbedMethodHandle(DWORDLONG key, DLDL value)
{
printf("EmbedMethodHandle key ftn-%016llX, value pp-%016llX res-%016llX", key, value.A, value.B);
}
-CORINFO_METHOD_HANDLE MethodContext::repEmbedMethodHandle(CORINFO_METHOD_HANDLE handle, void **ppIndirection)
+CORINFO_METHOD_HANDLE MethodContext::repEmbedMethodHandle(CORINFO_METHOD_HANDLE handle, void** ppIndirection)
{
DLDL value;
- AssertCodeMsg(EmbedMethodHandle != nullptr, EXCEPTIONCODE_MC, "Didn't find anything for %016llX", (DWORDLONG)handle);
- AssertCodeMsg(EmbedMethodHandle->GetIndex((DWORDLONG)handle) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX", (DWORDLONG)handle);
+ AssertCodeMsg(EmbedMethodHandle != nullptr, EXCEPTIONCODE_MC, "Didn't find anything for %016llX",
+ (DWORDLONG)handle);
+ AssertCodeMsg(EmbedMethodHandle->GetIndex((DWORDLONG)handle) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX",
+ (DWORDLONG)handle);
value = EmbedMethodHandle->Get((DWORDLONG)handle);
if (ppIndirection != nullptr)
- *ppIndirection = (void *)value.A;
+ *ppIndirection = (void*)value.A;
DEBUG_REP(dmpEmbedMethodHandle((DWORDLONG)handle, value));
return (CORINFO_METHOD_HANDLE)value.B;
}
-void MethodContext::recGetFieldAddress(CORINFO_FIELD_HANDLE field, void **ppIndirection, void *result, CorInfoType cit)
+void MethodContext::recGetFieldAddress(CORINFO_FIELD_HANDLE field, void** ppIndirection, void* result, CorInfoType cit)
{
if (GetFieldAddress == nullptr)
GetFieldAddress = new LightWeightMap<DWORDLONG, Agnostic_GetFieldAddress>();
@@ -3598,44 +3711,55 @@ void MethodContext::recGetFieldAddress(CORINFO_FIELD_HANDLE field, void **ppIndi
value.ppIndirection = (DWORDLONG)0;
else
value.ppIndirection = (DWORDLONG)*ppIndirection;
- value.fieldAddress = (DWORDLONG)result;
+ value.fieldAddress = (DWORDLONG)result;
value.fieldValue = (DWORD)-1;
// Make an attempt at stashing a copy of the value
- if (result > (void*)0xffff) //TODO-Cleanup: sometimes there is a field offset?
+ if (result > (void*)0xffff) // TODO-Cleanup: sometimes there is a field offset?
{
DWORDLONG scratch = 0x4242424242424242;
switch (cit)
{
- case CORINFO_TYPE_BOOL:
- case CORINFO_TYPE_BYTE:
- case CORINFO_TYPE_UBYTE:
- value.fieldValue = (DWORD)GetFieldAddress->AddBuffer((unsigned char*)result, sizeof(BYTE), true);//important to not merge two fields into one address
- break;
- case CORINFO_TYPE_CHAR:
- case CORINFO_TYPE_SHORT:
- case CORINFO_TYPE_USHORT:
- value.fieldValue = (DWORD)GetFieldAddress->AddBuffer((unsigned char*)result, sizeof(WORD), true);//important to not merge two fields into one address
- break;
- case CORINFO_TYPE_INT:
- case CORINFO_TYPE_UINT:
- case CORINFO_TYPE_FLOAT:
- value.fieldValue = (DWORD)GetFieldAddress->AddBuffer((unsigned char*)result, sizeof(DWORD), true);//important to not merge two fields into one address
- break;
- case CORINFO_TYPE_LONG:
- case CORINFO_TYPE_ULONG:
- case CORINFO_TYPE_DOUBLE:
- value.fieldValue = (DWORD)GetFieldAddress->AddBuffer((unsigned char*)result, sizeof(DWORDLONG), true);//important to not merge two fields into one address
- break;
- case CORINFO_TYPE_NATIVEINT:
- case CORINFO_TYPE_NATIVEUINT:
- case CORINFO_TYPE_PTR:
- value.fieldValue = (DWORD)GetFieldAddress->AddBuffer((unsigned char*)result, sizeof(size_t), true);//important to not merge two fields into one address
- GetFieldAddress->AddBuffer((unsigned char*)&scratch, sizeof(DWORD)); //Padding out the data so we can read it back "safetly" on x64
- break;
- default:
- break;
+ case CORINFO_TYPE_BOOL:
+ case CORINFO_TYPE_BYTE:
+ case CORINFO_TYPE_UBYTE:
+ value.fieldValue =
+ (DWORD)GetFieldAddress->AddBuffer((unsigned char*)result, sizeof(BYTE),
+ true); // important to not merge two fields into one address
+ break;
+ case CORINFO_TYPE_CHAR:
+ case CORINFO_TYPE_SHORT:
+ case CORINFO_TYPE_USHORT:
+ value.fieldValue =
+ (DWORD)GetFieldAddress->AddBuffer((unsigned char*)result, sizeof(WORD),
+ true); // important to not merge two fields into one address
+ break;
+ case CORINFO_TYPE_INT:
+ case CORINFO_TYPE_UINT:
+ case CORINFO_TYPE_FLOAT:
+ value.fieldValue =
+ (DWORD)GetFieldAddress->AddBuffer((unsigned char*)result, sizeof(DWORD),
+ true); // important to not merge two fields into one address
+ break;
+ case CORINFO_TYPE_LONG:
+ case CORINFO_TYPE_ULONG:
+ case CORINFO_TYPE_DOUBLE:
+ value.fieldValue =
+ (DWORD)GetFieldAddress->AddBuffer((unsigned char*)result, sizeof(DWORDLONG),
+ true); // important to not merge two fields into one address
+ break;
+ case CORINFO_TYPE_NATIVEINT:
+ case CORINFO_TYPE_NATIVEUINT:
+ case CORINFO_TYPE_PTR:
+ value.fieldValue =
+ (DWORD)GetFieldAddress->AddBuffer((unsigned char*)result, sizeof(size_t),
+ true); // important to not merge two fields into one address
+ GetFieldAddress->AddBuffer((unsigned char*)&scratch, sizeof(DWORD)); // Padding out the data so we can
+ // read it back "safetly" on x64
+ break;
+ default:
+ break;
}
}
GetFieldAddress->Add((DWORDLONG)field, value);
@@ -3643,17 +3767,18 @@ void MethodContext::recGetFieldAddress(CORINFO_FIELD_HANDLE field, void **ppIndi
}
void MethodContext::dmpGetFieldAddress(DWORDLONG key, const Agnostic_GetFieldAddress& value)
{
- printf("GetFieldAddress key fld-%016llX, value ppi-%016llX addr-%016llX val-%u", key, value.ppIndirection, value.fieldAddress, value.fieldValue);
+ printf("GetFieldAddress key fld-%016llX, value ppi-%016llX addr-%016llX val-%u", key, value.ppIndirection,
+ value.fieldAddress, value.fieldValue);
}
-void* MethodContext::repGetFieldAddress(CORINFO_FIELD_HANDLE field, void **ppIndirection)
+void* MethodContext::repGetFieldAddress(CORINFO_FIELD_HANDLE field, void** ppIndirection)
{
Agnostic_GetFieldAddress value;
value = GetFieldAddress->Get((DWORDLONG)field);
if (ppIndirection != nullptr)
- *ppIndirection = (void *)value.ppIndirection;
- void *temp;
+ *ppIndirection = (void*)value.ppIndirection;
+ void* temp;
if (value.fieldValue != (DWORD)-1)
{
@@ -3667,16 +3792,16 @@ void* MethodContext::repGetFieldAddress(CORINFO_FIELD_HANDLE field, void **ppInd
return temp;
}
-void MethodContext::recGetClassGClayout(CORINFO_CLASS_HANDLE cls, BYTE *gcPtrs, unsigned len, unsigned result)
+void MethodContext::recGetClassGClayout(CORINFO_CLASS_HANDLE cls, BYTE* gcPtrs, unsigned len, unsigned result)
{
if (GetClassGClayout == nullptr)
GetClassGClayout = new LightWeightMap<DWORDLONG, Agnostic_GetClassGClayout>();
Agnostic_GetClassGClayout value;
- value.gcPtrs_Index = (DWORD)GetClassGClayout->AddBuffer((unsigned char*)gcPtrs, len*sizeof(BYTE));
- value.len = (DWORD)len;
- value.valCount = (DWORD)result;
+ value.gcPtrs_Index = (DWORD)GetClassGClayout->AddBuffer((unsigned char*)gcPtrs, len * sizeof(BYTE));
+ value.len = (DWORD)len;
+ value.valCount = (DWORD)result;
GetClassGClayout->Add((DWORDLONG)cls, value);
DEBUG_REC(dmpGetClassGClayout((DWORDLONG)cls, value));
@@ -3686,7 +3811,7 @@ void MethodContext::dmpGetClassGClayout(DWORDLONG key, const Agnostic_GetClassGC
printf("GetClassGCLayout key %016llX, value len %u cnt %u {", key, value.len, value.valCount);
if (value.gcPtrs_Index != -1)
{
- BYTE *ptr = (BYTE *)GetClassGClayout->GetBuffer(value.gcPtrs_Index);
+ BYTE* ptr = (BYTE*)GetClassGClayout->GetBuffer(value.gcPtrs_Index);
for (unsigned int i = 0; i < value.len; i++)
{
printf("0x%02x", ptr[i]);
@@ -3697,22 +3822,23 @@ void MethodContext::dmpGetClassGClayout(DWORDLONG key, const Agnostic_GetClassGC
}
printf("}");
}
-unsigned MethodContext::repGetClassGClayout(CORINFO_CLASS_HANDLE cls, BYTE *gcPtrs)
+unsigned MethodContext::repGetClassGClayout(CORINFO_CLASS_HANDLE cls, BYTE* gcPtrs)
{
Agnostic_GetClassGClayout value;
AssertCodeMsg(GetClassGClayout != nullptr, EXCEPTIONCODE_MC, "Didn't find anything for %016llX", (DWORDLONG)cls);
- AssertCodeMsg(GetClassGClayout->GetIndex((DWORDLONG)cls) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX", (DWORDLONG)cls);
+ AssertCodeMsg(GetClassGClayout->GetIndex((DWORDLONG)cls) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX",
+ (DWORDLONG)cls);
value = GetClassGClayout->Get((DWORDLONG)cls);
- unsigned int len = (unsigned int)value.len;
+ unsigned int len = (unsigned int)value.len;
unsigned int index = (unsigned int)value.gcPtrs_Index;
if (index != -1)
{
- BYTE *ptr = (BYTE *)GetClassGClayout->GetBuffer(index);
+ BYTE* ptr = (BYTE*)GetClassGClayout->GetBuffer(index);
for (unsigned int i = 0; i < len; i++)
- gcPtrs[i] = ptr[i];
+ gcPtrs[i] = ptr[i];
}
DEBUG_REP(dmpGetClassGClayout((DWORDLONG)cls, value));
return (unsigned)value.valCount;
@@ -3723,7 +3849,8 @@ void MethodContext::recGetClassAlignmentRequirement(CORINFO_CLASS_HANDLE cls, BO
if (GetClassAlignmentRequirement == nullptr)
GetClassAlignmentRequirement = new LightWeightMap<DLD, DWORD>();
DLD key;
- ZeroMemory(&key, sizeof(DLD)); //We use the input structs as a key and use memcmp to compare.. so we need to zero out padding too
+ ZeroMemory(&key, sizeof(DLD)); // We use the input structs as a key and use memcmp to compare.. so we need to zero
+ // out padding too
key.A = (DWORDLONG)cls;
key.B = (DWORD)fDoubleAlignHint;
@@ -3738,7 +3865,8 @@ void MethodContext::dmpGetClassAlignmentRequirement(DLD key, DWORD value)
unsigned MethodContext::repGetClassAlignmentRequirement(CORINFO_CLASS_HANDLE cls, BOOL fDoubleAlignHint)
{
DLD key;
- ZeroMemory(&key, sizeof(DLD)); //We use the input structs as a key and use memcmp to compare.. so we need to zero out padding too
+ ZeroMemory(&key, sizeof(DLD)); // We use the input structs as a key and use memcmp to compare.. so we need to zero
+ // out padding too
key.A = (DWORDLONG)cls;
key.B = (DWORD)fDoubleAlignHint;
@@ -3747,36 +3875,41 @@ unsigned MethodContext::repGetClassAlignmentRequirement(CORINFO_CLASS_HANDLE cls
return result;
}
-void MethodContext::recCanAccessClass(CORINFO_RESOLVED_TOKEN *pResolvedToken, CORINFO_METHOD_HANDLE callerHandle,
- CORINFO_HELPER_DESC *pAccessHelper, CorInfoIsAccessAllowedResult result)
+void MethodContext::recCanAccessClass(CORINFO_RESOLVED_TOKEN* pResolvedToken,
+ CORINFO_METHOD_HANDLE callerHandle,
+ CORINFO_HELPER_DESC* pAccessHelper,
+ CorInfoIsAccessAllowedResult result)
{
if (CanAccessClass == nullptr)
CanAccessClass = new LightWeightMap<Agnostic_CanAccessClassIn, Agnostic_CanAccessClassOut>();
Agnostic_CanAccessClassIn key;
- ZeroMemory(&key, sizeof(Agnostic_CanAccessClassIn)); //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_CanAccessClassIn)); // We use the input structs as a key and use memcmp to
+ // compare.. so we need to zero out padding too
Agnostic_CanAccessClassOut 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)CanAccessClass->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)CanAccessClass->AddBuffer((unsigned char*)pResolvedToken->pTypeSpec, pResolvedToken->cbTypeSpec);
key.ResolvedToken.cbTypeSpec = (DWORD)pResolvedToken->cbTypeSpec;
- key.ResolvedToken.methodSpec_Index = (DWORD)CanAccessClass->AddBuffer((unsigned char*)pResolvedToken->pMethodSpec, pResolvedToken->cbMethodSpec);
+ key.ResolvedToken.methodSpec_Index =
+ (DWORD)CanAccessClass->AddBuffer((unsigned char*)pResolvedToken->pMethodSpec, pResolvedToken->cbMethodSpec);
key.ResolvedToken.cbMethodSpec = (DWORD)pResolvedToken->cbMethodSpec;
- key.callerHandle = (DWORDLONG)callerHandle;
+ key.callerHandle = (DWORDLONG)callerHandle;
value.AccessHelper.helperNum = (DWORD)pAccessHelper->helperNum;
- value.AccessHelper.numArgs = (DWORD)pAccessHelper->numArgs;
+ value.AccessHelper.numArgs = (DWORD)pAccessHelper->numArgs;
for (int i = 0; i < CORINFO_ACCESS_ALLOWED_MAX_ARGS; i++)
{
value.AccessHelper.args[i].constant = (DWORDLONG)pAccessHelper->args[i].constant;
- value.AccessHelper.args[i].argType = (DWORD)pAccessHelper->args[i].argType;
+ value.AccessHelper.args[i].argType = (DWORD)pAccessHelper->args[i].argType;
}
value.result = (DWORD)result;
@@ -3785,85 +3918,82 @@ void MethodContext::recCanAccessClass(CORINFO_RESOLVED_TOKEN *pResolvedToken, CO
}
void MethodContext::dmpCanAccessClass(const Agnostic_CanAccessClassIn& key, const Agnostic_CanAccessClassOut& value)
{
- printf("CanAccessClass key tc-%016llX ts-%016llX tok-%08X tt-%u cls-%016llX meth-%016llX fld-%016llX ti-%u ts-%u mi-%u ms-%u",
- 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);
- printf(", value hnum-%u na-%u {",
- value.AccessHelper.helperNum,
- value.AccessHelper.numArgs);
+ printf("CanAccessClass key tc-%016llX ts-%016llX tok-%08X tt-%u cls-%016llX meth-%016llX fld-%016llX ti-%u ts-%u "
+ "mi-%u ms-%u",
+ 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);
+ printf(", value hnum-%u na-%u {", value.AccessHelper.helperNum, value.AccessHelper.numArgs);
for (int i = 0; i < CORINFO_ACCESS_ALLOWED_MAX_ARGS; i++)
{
- printf("{%016llX %u}",
- value.AccessHelper.args[i].constant,
- value.AccessHelper.args[i].argType);
+ printf("{%016llX %u}", value.AccessHelper.args[i].constant, value.AccessHelper.args[i].argType);
}
printf("} res-%u", value.result);
}
-CorInfoIsAccessAllowedResult MethodContext::repCanAccessClass(CORINFO_RESOLVED_TOKEN *pResolvedToken, CORINFO_METHOD_HANDLE callerHandle,
- CORINFO_HELPER_DESC *pAccessHelper)
+CorInfoIsAccessAllowedResult MethodContext::repCanAccessClass(CORINFO_RESOLVED_TOKEN* pResolvedToken,
+ CORINFO_METHOD_HANDLE callerHandle,
+ CORINFO_HELPER_DESC* pAccessHelper)
{
Agnostic_CanAccessClassIn key;
- ZeroMemory(&key, sizeof(Agnostic_CanAccessClassIn)); //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_CanAccessClassIn)); // We use the input structs as a key and use memcmp to
+ // compare.. so we need to zero out padding too
Agnostic_CanAccessClassOut value;
- AssertCodeMsg(CanAccessClass != nullptr, EXCEPTIONCODE_MC, "Didn't find anything for %016llX", (DWORDLONG)pResolvedToken->hClass);
+ AssertCodeMsg(CanAccessClass != nullptr, EXCEPTIONCODE_MC, "Didn't find anything for %016llX",
+ (DWORDLONG)pResolvedToken->hClass);
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)CanAccessClass->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)CanAccessClass->Contains((unsigned char*)pResolvedToken->pTypeSpec, pResolvedToken->cbTypeSpec);
key.ResolvedToken.cbTypeSpec = (DWORD)pResolvedToken->cbTypeSpec;
- key.ResolvedToken.methodSpec_Index = (DWORD)CanAccessClass->Contains((unsigned char *)pResolvedToken->pMethodSpec, pResolvedToken->cbMethodSpec);
+ key.ResolvedToken.methodSpec_Index =
+ (DWORD)CanAccessClass->Contains((unsigned char*)pResolvedToken->pMethodSpec, pResolvedToken->cbMethodSpec);
key.ResolvedToken.cbMethodSpec = (DWORD)pResolvedToken->cbMethodSpec;
- key.callerHandle = (DWORDLONG)callerHandle;
+ key.callerHandle = (DWORDLONG)callerHandle;
- AssertCodeMsg(CanAccessClass->GetIndex(key) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX", (DWORDLONG)pResolvedToken->hClass);
+ AssertCodeMsg(CanAccessClass->GetIndex(key) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX",
+ (DWORDLONG)pResolvedToken->hClass);
value = CanAccessClass->Get(key);
pAccessHelper->helperNum = (CorInfoHelpFunc)value.AccessHelper.helperNum;
- pAccessHelper->numArgs = (unsigned)value.AccessHelper.numArgs;
+ pAccessHelper->numArgs = (unsigned)value.AccessHelper.numArgs;
for (int i = 0; i < CORINFO_ACCESS_ALLOWED_MAX_ARGS; i++)
{
pAccessHelper->args[i].constant = (size_t)value.AccessHelper.args[i].constant;
- pAccessHelper->args[i].argType = (CorInfoAccessAllowedHelperArgType)value.AccessHelper.args[i].argType;
+ pAccessHelper->args[i].argType = (CorInfoAccessAllowedHelperArgType)value.AccessHelper.args[i].argType;
}
CorInfoIsAccessAllowedResult temp = (CorInfoIsAccessAllowedResult)value.result;
DEBUG_REP(dmpCanAccessClass(key, value));
return temp;
}
-void MethodContext::recGetCastingHelper(CORINFO_RESOLVED_TOKEN *pResolvedToken, bool fThrowing, CorInfoHelpFunc result)
+void MethodContext::recGetCastingHelper(CORINFO_RESOLVED_TOKEN* pResolvedToken, bool fThrowing, CorInfoHelpFunc result)
{
if (GetCastingHelper == nullptr)
GetCastingHelper = new LightWeightMap<Agnostic_GetCastingHelper, DWORD>();
Agnostic_GetCastingHelper key;
- ZeroMemory(&key, sizeof(Agnostic_GetCastingHelper)); //We use the input structs as a key and use memcmp to compare.. so we need to zero out padding too
-
- key.ResolvedToken.tokenContext = (DWORDLONG)0;
- key.ResolvedToken.tokenScope = (DWORDLONG)0;
- key.ResolvedToken.token = (DWORD)0;
- key.ResolvedToken.tokenType = (DWORD)0;
- key.ResolvedToken.hClass = (DWORDLONG)pResolvedToken->hClass;
- key.ResolvedToken.hMethod = (DWORDLONG)0;
- key.ResolvedToken.hField = (DWORDLONG)0;
- key.ResolvedToken.typeSpec_Index = (DWORD)0;
- key.ResolvedToken.cbTypeSpec = (DWORD)0;
+ ZeroMemory(&key, sizeof(Agnostic_GetCastingHelper)); // We use the input structs as a key and use memcmp to
+ // compare.. so we need to zero out padding too
+
+ key.ResolvedToken.tokenContext = (DWORDLONG)0;
+ key.ResolvedToken.tokenScope = (DWORDLONG)0;
+ key.ResolvedToken.token = (DWORD)0;
+ key.ResolvedToken.tokenType = (DWORD)0;
+ key.ResolvedToken.hClass = (DWORDLONG)pResolvedToken->hClass;
+ key.ResolvedToken.hMethod = (DWORDLONG)0;
+ key.ResolvedToken.hField = (DWORDLONG)0;
+ key.ResolvedToken.typeSpec_Index = (DWORD)0;
+ key.ResolvedToken.cbTypeSpec = (DWORD)0;
key.ResolvedToken.methodSpec_Index = (DWORD)0;
- key.ResolvedToken.cbMethodSpec = (DWORD)0;
- key.fThrowing = (DWORD)fThrowing;
+ key.ResolvedToken.cbMethodSpec = (DWORD)0;
+ key.fThrowing = (DWORD)fThrowing;
GetCastingHelper->Add(key, (DWORD)result);
}
@@ -3871,29 +4001,32 @@ void MethodContext::dmpGetCastingHelper(const Agnostic_GetCastingHelper& key, DW
{
printf("GetCastingHelper key cls-%016llX, thw-%u, value res-%u", key.ResolvedToken.hClass, key.fThrowing, value);
}
-CorInfoHelpFunc MethodContext::repGetCastingHelper(CORINFO_RESOLVED_TOKEN *pResolvedToken, bool fThrowing)
+CorInfoHelpFunc MethodContext::repGetCastingHelper(CORINFO_RESOLVED_TOKEN* pResolvedToken, bool fThrowing)
{
Agnostic_GetCastingHelper key;
- ZeroMemory(&key, sizeof(Agnostic_GetCastingHelper)); //We use the input structs as a key and use memcmp to compare.. so we need to zero out padding too
-
- key.ResolvedToken.tokenContext = (DWORDLONG)0;
- key.ResolvedToken.tokenScope = (DWORDLONG)0;
- key.ResolvedToken.token = (DWORD)0;
- key.ResolvedToken.tokenType = (DWORD)0;
- key.ResolvedToken.hClass = (DWORDLONG)pResolvedToken->hClass;
- key.ResolvedToken.hMethod = (DWORDLONG)0;
- key.ResolvedToken.hField = (DWORDLONG)0;
- key.ResolvedToken.typeSpec_Index = (DWORD)0;
- key.ResolvedToken.cbTypeSpec = (DWORD)0;
+ ZeroMemory(&key, sizeof(Agnostic_GetCastingHelper)); // We use the input structs as a key and use memcmp to
+ // compare.. so we need to zero out padding too
+
+ key.ResolvedToken.tokenContext = (DWORDLONG)0;
+ key.ResolvedToken.tokenScope = (DWORDLONG)0;
+ key.ResolvedToken.token = (DWORD)0;
+ key.ResolvedToken.tokenType = (DWORD)0;
+ key.ResolvedToken.hClass = (DWORDLONG)pResolvedToken->hClass;
+ key.ResolvedToken.hMethod = (DWORDLONG)0;
+ key.ResolvedToken.hField = (DWORDLONG)0;
+ key.ResolvedToken.typeSpec_Index = (DWORD)0;
+ key.ResolvedToken.cbTypeSpec = (DWORD)0;
key.ResolvedToken.methodSpec_Index = (DWORD)0;
- key.ResolvedToken.cbMethodSpec = (DWORD)0;
- key.fThrowing = (DWORD)fThrowing;
+ key.ResolvedToken.cbMethodSpec = (DWORD)0;
+ key.fThrowing = (DWORD)fThrowing;
CorInfoHelpFunc value = (CorInfoHelpFunc)GetCastingHelper->Get(key);
return value;
}
-void MethodContext::recEmbedModuleHandle(CORINFO_MODULE_HANDLE handle, void **ppIndirection, CORINFO_MODULE_HANDLE result)
+void MethodContext::recEmbedModuleHandle(CORINFO_MODULE_HANDLE handle,
+ void** ppIndirection,
+ CORINFO_MODULE_HANDLE result)
{
if (EmbedModuleHandle == nullptr)
EmbedModuleHandle = new LightWeightMap<DWORDLONG, DLDL>();
@@ -3903,7 +4036,7 @@ void MethodContext::recEmbedModuleHandle(CORINFO_MODULE_HANDLE handle, void **pp
value.A = (DWORDLONG)*ppIndirection;
else
value.A = (DWORDLONG)0;
- value.B = (DWORDLONG)result;
+ value.B = (DWORDLONG)result;
EmbedModuleHandle->Add((DWORDLONG)handle, value);
}
@@ -3911,7 +4044,7 @@ void MethodContext::dmpEmbedModuleHandle(DWORDLONG key, DLDL value)
{
printf("EmbedModuleHandle key mod-%016llX, value pp-%016llX res-%016llX", key, value.A, value.B);
}
-CORINFO_MODULE_HANDLE MethodContext::repEmbedModuleHandle(CORINFO_MODULE_HANDLE handle, void **ppIndirection)
+CORINFO_MODULE_HANDLE MethodContext::repEmbedModuleHandle(CORINFO_MODULE_HANDLE handle, void** ppIndirection)
{
DLDL value;
@@ -3919,10 +4052,9 @@ CORINFO_MODULE_HANDLE MethodContext::repEmbedModuleHandle(CORINFO_MODULE_HANDLE
if (ppIndirection != nullptr)
*ppIndirection = (void*)value.A;
return (CORINFO_MODULE_HANDLE)value.B;
-
}
-void MethodContext::recEmbedClassHandle(CORINFO_CLASS_HANDLE handle, void **ppIndirection, CORINFO_CLASS_HANDLE result)
+void MethodContext::recEmbedClassHandle(CORINFO_CLASS_HANDLE handle, void** ppIndirection, CORINFO_CLASS_HANDLE result)
{
if (EmbedClassHandle == nullptr)
EmbedClassHandle = new LightWeightMap<DWORDLONG, DLDL>();
@@ -3932,7 +4064,7 @@ void MethodContext::recEmbedClassHandle(CORINFO_CLASS_HANDLE handle, void **ppIn
value.A = (DWORDLONG)*ppIndirection;
else
value.A = (DWORDLONG)0;
- value.B = (DWORDLONG)result;
+ value.B = (DWORDLONG)result;
EmbedClassHandle->Add((DWORDLONG)handle, value);
DEBUG_REC(dmpEmbedClassHandle((DWORDLONG)handle, value));
@@ -3941,12 +4073,13 @@ void MethodContext::dmpEmbedClassHandle(DWORDLONG key, DLDL value)
{
printf("EmbedClassHandle key cls-%016llX, value pp-%016llX res-%016llX", key, value.A, value.B);
}
-CORINFO_CLASS_HANDLE MethodContext::repEmbedClassHandle(CORINFO_CLASS_HANDLE handle, void **ppIndirection)
+CORINFO_CLASS_HANDLE MethodContext::repEmbedClassHandle(CORINFO_CLASS_HANDLE handle, void** ppIndirection)
{
DLDL value;
AssertCodeMsg(EmbedClassHandle != nullptr, EXCEPTIONCODE_MC, "Didn't find anything for %016llX", (DWORDLONG)handle);
- AssertCodeMsg(EmbedClassHandle->GetIndex((DWORDLONG)handle) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX", (DWORDLONG)handle);
+ AssertCodeMsg(EmbedClassHandle->GetIndex((DWORDLONG)handle) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX",
+ (DWORDLONG)handle);
value = EmbedClassHandle->Get((DWORDLONG)handle);
if (ppIndirection != nullptr)
*ppIndirection = (void*)value.A;
@@ -3954,27 +4087,31 @@ CORINFO_CLASS_HANDLE MethodContext::repEmbedClassHandle(CORINFO_CLASS_HANDLE han
return (CORINFO_CLASS_HANDLE)value.B;
}
-void MethodContext::recPInvokeMarshalingRequired(CORINFO_METHOD_HANDLE method, CORINFO_SIG_INFO* callSiteSig, BOOL result)
+void MethodContext::recPInvokeMarshalingRequired(CORINFO_METHOD_HANDLE method,
+ CORINFO_SIG_INFO* callSiteSig,
+ BOOL result)
{
if (PInvokeMarshalingRequired == nullptr)
PInvokeMarshalingRequired = new LightWeightMap<Agnostic_PInvokeMarshalingRequired, DWORD>();
Agnostic_PInvokeMarshalingRequired key;
- ZeroMemory(&key, sizeof(Agnostic_PInvokeMarshalingRequired)); //We use the input structs as a key and use memcmp to compare.. so we need to zero out padding too
-
- key.method = (DWORDLONG)method;
- key.callSiteSig.callConv = (DWORD)0;
- key.callSiteSig.retTypeClass = (DWORDLONG)0;
- key.callSiteSig.retTypeSigClass = (DWORDLONG)0;
- key.callSiteSig.retType = (DWORD)0;
- key.callSiteSig.flags = (DWORD)0;
- key.callSiteSig.numArgs = (DWORD)0;
- key.callSiteSig.sigInst_classInstCount = (DWORD)0;
+ ZeroMemory(&key, sizeof(Agnostic_PInvokeMarshalingRequired)); // We use the input structs as a key and use memcmp to
+ // compare.. so we need to zero out padding too
+
+ key.method = (DWORDLONG)method;
+ key.callSiteSig.callConv = (DWORD)0;
+ key.callSiteSig.retTypeClass = (DWORDLONG)0;
+ key.callSiteSig.retTypeSigClass = (DWORDLONG)0;
+ key.callSiteSig.retType = (DWORD)0;
+ key.callSiteSig.flags = (DWORD)0;
+ key.callSiteSig.numArgs = (DWORD)0;
+ key.callSiteSig.sigInst_classInstCount = (DWORD)0;
key.callSiteSig.sigInst_classInst_Index = (DWORD)0;
- key.callSiteSig.sigInst_methInstCount = (DWORD)0;
- key.callSiteSig.sigInst_methInst_Index = (DWORD)0;
- key.callSiteSig.args = (DWORDLONG)0;
- key.callSiteSig.pSig = (DWORD)PInvokeMarshalingRequired->AddBuffer((unsigned char*)callSiteSig->pSig, callSiteSig->cbSig);
+ key.callSiteSig.sigInst_methInstCount = (DWORD)0;
+ key.callSiteSig.sigInst_methInst_Index = (DWORD)0;
+ key.callSiteSig.args = (DWORDLONG)0;
+ key.callSiteSig.pSig =
+ (DWORD)PInvokeMarshalingRequired->AddBuffer((unsigned char*)callSiteSig->pSig, callSiteSig->cbSig);
key.callSiteSig.cbSig = (DWORD)callSiteSig->cbSig;
key.callSiteSig.scope = (DWORDLONG)callSiteSig->scope;
key.callSiteSig.token = (DWORD)0;
@@ -3984,34 +4121,33 @@ void MethodContext::recPInvokeMarshalingRequired(CORINFO_METHOD_HANDLE method, C
}
void MethodContext::dmpPInvokeMarshalingRequired(const Agnostic_PInvokeMarshalingRequired& key, DWORD value)
{
- printf("PInvokeMarshalingRequired key mth-%016llX scp-%016llX sig-%u, value res-%u",
- key.method,
- key.callSiteSig.scope,
- key.callSiteSig.pSig,
- value);
+ printf("PInvokeMarshalingRequired key mth-%016llX scp-%016llX sig-%u, value res-%u", key.method,
+ key.callSiteSig.scope, key.callSiteSig.pSig, value);
}
-//Note the jit interface implementation seems to only care about scope and pSig from callSiteSig
+// Note the jit interface implementation seems to only care about scope and pSig from callSiteSig
BOOL MethodContext::repPInvokeMarshalingRequired(CORINFO_METHOD_HANDLE method, CORINFO_SIG_INFO* callSiteSig)
{
- if (PInvokeMarshalingRequired == nullptr)//so when we replay checked on free, we throw from lwm
- return TRUE; // TODO-Cleanup: hackish...
+ if (PInvokeMarshalingRequired == nullptr) // so when we replay checked on free, we throw from lwm
+ return TRUE; // TODO-Cleanup: hackish...
Agnostic_PInvokeMarshalingRequired key;
- ZeroMemory(&key, sizeof(Agnostic_PInvokeMarshalingRequired)); //We use the input structs as a key and use memcmp to compare.. so we need to zero out padding too
-
- key.method = (DWORDLONG)method;
- key.callSiteSig.callConv = (DWORD)0;
- key.callSiteSig.retTypeClass = (DWORDLONG)0;
- key.callSiteSig.retTypeSigClass = (DWORDLONG)0;
- key.callSiteSig.retType = (DWORD)0;
- key.callSiteSig.flags = (DWORD)0;
- key.callSiteSig.numArgs = (DWORD)0;
- key.callSiteSig.sigInst_classInstCount = (DWORD)0;
+ ZeroMemory(&key, sizeof(Agnostic_PInvokeMarshalingRequired)); // We use the input structs as a key and use memcmp to
+ // compare.. so we need to zero out padding too
+
+ key.method = (DWORDLONG)method;
+ key.callSiteSig.callConv = (DWORD)0;
+ key.callSiteSig.retTypeClass = (DWORDLONG)0;
+ key.callSiteSig.retTypeSigClass = (DWORDLONG)0;
+ key.callSiteSig.retType = (DWORD)0;
+ key.callSiteSig.flags = (DWORD)0;
+ key.callSiteSig.numArgs = (DWORD)0;
+ key.callSiteSig.sigInst_classInstCount = (DWORD)0;
key.callSiteSig.sigInst_classInst_Index = (DWORD)0;
- key.callSiteSig.sigInst_methInstCount = (DWORD)0;
- key.callSiteSig.sigInst_methInst_Index = (DWORD)0;
- key.callSiteSig.args = (DWORDLONG)0;
- key.callSiteSig.pSig = (DWORD)PInvokeMarshalingRequired->Contains((unsigned char*)callSiteSig->pSig, callSiteSig->cbSig);
+ key.callSiteSig.sigInst_methInstCount = (DWORD)0;
+ key.callSiteSig.sigInst_methInst_Index = (DWORD)0;
+ key.callSiteSig.args = (DWORDLONG)0;
+ key.callSiteSig.pSig =
+ (DWORD)PInvokeMarshalingRequired->Contains((unsigned char*)callSiteSig->pSig, callSiteSig->cbSig);
key.callSiteSig.cbSig = (DWORD)callSiteSig->cbSig;
key.callSiteSig.scope = (DWORDLONG)callSiteSig->scope;
key.callSiteSig.token = (DWORD)0;
@@ -4021,32 +4157,38 @@ BOOL MethodContext::repPInvokeMarshalingRequired(CORINFO_METHOD_HANDLE method, C
return value;
}
-void MethodContext::recFindSig(CORINFO_MODULE_HANDLE module, unsigned sigTOK, CORINFO_CONTEXT_HANDLE context, CORINFO_SIG_INFO *sig)
+void MethodContext::recFindSig(CORINFO_MODULE_HANDLE module,
+ unsigned sigTOK,
+ CORINFO_CONTEXT_HANDLE context,
+ CORINFO_SIG_INFO* sig)
{
if (FindSig == nullptr)
FindSig = new LightWeightMap<Agnostic_FindSig, Agnostic_CORINFO_SIG_INFO>();
Agnostic_FindSig key;
- ZeroMemory(&key, sizeof(Agnostic_FindSig)); //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_FindSig)); // We use the input structs as a key and use memcmp to compare.. so we
+ // need to zero out padding too
Agnostic_CORINFO_SIG_INFO value;
- key.module = (DWORDLONG)module;
- key.sigTOK = (DWORD)sigTOK;
+ key.module = (DWORDLONG)module;
+ key.sigTOK = (DWORD)sigTOK;
key.context = (DWORDLONG)context;
- value.callConv = (DWORD)sig->callConv;
- value.retTypeClass = (DWORDLONG)sig->retTypeClass;
- value.retTypeSigClass = (DWORDLONG)sig->retTypeSigClass;
- value.retType = (DWORD)sig->retType;
- value.flags = (DWORD)sig->flags;
- value.numArgs = (DWORD)sig->numArgs;
+ value.callConv = (DWORD)sig->callConv;
+ value.retTypeClass = (DWORDLONG)sig->retTypeClass;
+ value.retTypeSigClass = (DWORDLONG)sig->retTypeSigClass;
+ value.retType = (DWORD)sig->retType;
+ value.flags = (DWORD)sig->flags;
+ value.numArgs = (DWORD)sig->numArgs;
value.sigInst_classInstCount = (DWORD)sig->sigInst.classInstCount;
- value.sigInst_classInst_Index = FindSig->AddBuffer((unsigned char*)sig->sigInst.classInst, sig->sigInst.classInstCount * 8); //porting issue
+ value.sigInst_classInst_Index =
+ FindSig->AddBuffer((unsigned char*)sig->sigInst.classInst, sig->sigInst.classInstCount * 8); // porting issue
value.sigInst_methInstCount = (DWORD)sig->sigInst.methInstCount;
- value.sigInst_methInst_Index = FindSig->AddBuffer((unsigned char*)sig->sigInst.methInst, sig->sigInst.methInstCount * 8); //porting issue
- value.args = (DWORDLONG)sig->args;
+ value.sigInst_methInst_Index =
+ FindSig->AddBuffer((unsigned char*)sig->sigInst.methInst, sig->sigInst.methInstCount * 8); // porting issue
+ value.args = (DWORDLONG)sig->args;
value.cbSig = (DWORD)sig->cbSig;
- value.pSig = (DWORD)FindSig->AddBuffer((unsigned char *)sig->pSig, sig->cbSig);
+ value.pSig = (DWORD)FindSig->AddBuffer((unsigned char*)sig->pSig, sig->cbSig);
value.scope = (DWORDLONG)sig->scope;
value.token = (DWORD)sig->token;
@@ -4056,86 +4198,79 @@ void MethodContext::recFindSig(CORINFO_MODULE_HANDLE module, unsigned sigTOK, CO
void MethodContext::dmpFindSig(const Agnostic_FindSig& key, const Agnostic_CORINFO_SIG_INFO& value)
{
printf("FindSig key module-%016llX sigTOK-%08X context-%016llX", key.module, key.sigTOK, key.context);
- printf(", value callConv-%08X retTypeClass-%016llX retTypeSigClass-%016llX retType-%u(%s) flags-%08X numArgs-%08X classInstCount-%08X classInd-%08X "
+ printf(", value callConv-%08X retTypeClass-%016llX retTypeSigClass-%016llX retType-%u(%s) flags-%08X numArgs-%08X "
+ "classInstCount-%08X classInd-%08X "
"methInstCount-%08X methInd-%08X args-%016llX cbSig-%08X pSig-%08X scope-%016llX token-%08X",
- value.callConv,
- value.retTypeClass,
- value.retTypeSigClass,
- value.retType,
- toString((CorInfoType)value.retType),
- value.flags,
- value.numArgs,
- value.sigInst_classInstCount,
- value.sigInst_classInst_Index,
- value.sigInst_methInstCount,
- value.sigInst_methInst_Index,
- value.args,
- value.cbSig,
- value.pSig,
- value.scope,
- value.token);
-}
-void MethodContext::repFindSig(CORINFO_MODULE_HANDLE module, unsigned sigTOK, CORINFO_CONTEXT_HANDLE context, CORINFO_SIG_INFO *sig)
+ value.callConv, value.retTypeClass, value.retTypeSigClass, value.retType,
+ toString((CorInfoType)value.retType), value.flags, value.numArgs, value.sigInst_classInstCount,
+ value.sigInst_classInst_Index, value.sigInst_methInstCount, value.sigInst_methInst_Index, value.args,
+ value.cbSig, value.pSig, value.scope, value.token);
+}
+void MethodContext::repFindSig(CORINFO_MODULE_HANDLE module,
+ unsigned sigTOK,
+ CORINFO_CONTEXT_HANDLE context,
+ CORINFO_SIG_INFO* sig)
{
Agnostic_FindSig key;
- ZeroMemory(&key, sizeof(Agnostic_FindSig)); //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_FindSig)); // We use the input structs as a key and use memcmp to compare.. so we
+ // need to zero out padding too
Agnostic_CORINFO_SIG_INFO value;
- key.module = (DWORDLONG)module;
- key.sigTOK = (DWORD)sigTOK;
+ key.module = (DWORDLONG)module;
+ key.sigTOK = (DWORD)sigTOK;
key.context = (DWORDLONG)context;
value = FindSig->Get(key);
- sig->callConv = (CorInfoCallConv)value.callConv;
- sig->retTypeClass = (CORINFO_CLASS_HANDLE)value.retTypeClass;
- sig->retTypeSigClass = (CORINFO_CLASS_HANDLE)value.retTypeSigClass;
- sig->retType = (CorInfoType)value.retType;
- sig->flags = (unsigned)value.flags;
- sig->numArgs = (unsigned)value.numArgs;
+ sig->callConv = (CorInfoCallConv)value.callConv;
+ sig->retTypeClass = (CORINFO_CLASS_HANDLE)value.retTypeClass;
+ sig->retTypeSigClass = (CORINFO_CLASS_HANDLE)value.retTypeSigClass;
+ sig->retType = (CorInfoType)value.retType;
+ sig->flags = (unsigned)value.flags;
+ sig->numArgs = (unsigned)value.numArgs;
sig->sigInst.classInstCount = (unsigned)value.sigInst_classInstCount;
- sig->sigInst.classInst = (CORINFO_CLASS_HANDLE*)FindSig->GetBuffer(value.sigInst_classInst_Index);
- sig->sigInst.methInstCount = (unsigned)value.sigInst_methInstCount;
- sig->sigInst.methInst = (CORINFO_CLASS_HANDLE*)FindSig->GetBuffer(value.sigInst_methInst_Index);
- sig->args = (CORINFO_ARG_LIST_HANDLE)value.args;
- sig->cbSig = (unsigned int)value.cbSig;
- sig->pSig = (PCCOR_SIGNATURE)FindSig->GetBuffer(value.pSig);
- sig->scope = (CORINFO_MODULE_HANDLE)value.scope;
- sig->token = (mdToken)value.token;
+ sig->sigInst.classInst = (CORINFO_CLASS_HANDLE*)FindSig->GetBuffer(value.sigInst_classInst_Index);
+ sig->sigInst.methInstCount = (unsigned)value.sigInst_methInstCount;
+ sig->sigInst.methInst = (CORINFO_CLASS_HANDLE*)FindSig->GetBuffer(value.sigInst_methInst_Index);
+ sig->args = (CORINFO_ARG_LIST_HANDLE)value.args;
+ sig->cbSig = (unsigned int)value.cbSig;
+ sig->pSig = (PCCOR_SIGNATURE)FindSig->GetBuffer(value.pSig);
+ sig->scope = (CORINFO_MODULE_HANDLE)value.scope;
+ sig->token = (mdToken)value.token;
DEBUG_REP(dmpFindSig(key, value));
}
-void MethodContext::recGetEEInfo(CORINFO_EE_INFO *pEEInfoOut)
+void MethodContext::recGetEEInfo(CORINFO_EE_INFO* pEEInfoOut)
{
if (GetEEInfo == nullptr)
GetEEInfo = new LightWeightMap<DWORD, Agnostic_CORINFO_EE_INFO>();
Agnostic_CORINFO_EE_INFO value;
- value.inlinedCallFrameInfo.size = (DWORD)pEEInfoOut->inlinedCallFrameInfo.size;
- value.inlinedCallFrameInfo.offsetOfGSCookie = (DWORD)pEEInfoOut->inlinedCallFrameInfo.offsetOfGSCookie;
- value.inlinedCallFrameInfo.offsetOfFrameVptr = (DWORD)pEEInfoOut->inlinedCallFrameInfo.offsetOfFrameVptr;
- value.inlinedCallFrameInfo.offsetOfFrameLink = (DWORD)pEEInfoOut->inlinedCallFrameInfo.offsetOfFrameLink;
- value.inlinedCallFrameInfo.offsetOfCallSiteSP = (DWORD)pEEInfoOut->inlinedCallFrameInfo.offsetOfCallSiteSP;
+ value.inlinedCallFrameInfo.size = (DWORD)pEEInfoOut->inlinedCallFrameInfo.size;
+ value.inlinedCallFrameInfo.offsetOfGSCookie = (DWORD)pEEInfoOut->inlinedCallFrameInfo.offsetOfGSCookie;
+ value.inlinedCallFrameInfo.offsetOfFrameVptr = (DWORD)pEEInfoOut->inlinedCallFrameInfo.offsetOfFrameVptr;
+ value.inlinedCallFrameInfo.offsetOfFrameLink = (DWORD)pEEInfoOut->inlinedCallFrameInfo.offsetOfFrameLink;
+ value.inlinedCallFrameInfo.offsetOfCallSiteSP = (DWORD)pEEInfoOut->inlinedCallFrameInfo.offsetOfCallSiteSP;
value.inlinedCallFrameInfo.offsetOfCalleeSavedFP = (DWORD)pEEInfoOut->inlinedCallFrameInfo.offsetOfCalleeSavedFP;
- value.inlinedCallFrameInfo.offsetOfCallTarget = (DWORD)pEEInfoOut->inlinedCallFrameInfo.offsetOfCallTarget;
+ value.inlinedCallFrameInfo.offsetOfCallTarget = (DWORD)pEEInfoOut->inlinedCallFrameInfo.offsetOfCallTarget;
value.inlinedCallFrameInfo.offsetOfReturnAddress = (DWORD)pEEInfoOut->inlinedCallFrameInfo.offsetOfReturnAddress;
- value.offsetOfThreadFrame = (DWORD)pEEInfoOut->offsetOfThreadFrame;
- value.offsetOfGCState = (DWORD)pEEInfoOut->offsetOfGCState;
- value.offsetOfDelegateInstance = (DWORD)pEEInfoOut->offsetOfDelegateInstance;
- value.offsetOfDelegateFirstTarget = (DWORD)pEEInfoOut->offsetOfDelegateFirstTarget;
- value.offsetOfSecureDelegateIndirectCell = (DWORD)pEEInfoOut->offsetOfSecureDelegateIndirectCell;
- value.offsetOfTransparentProxyRP = (DWORD)pEEInfoOut->offsetOfTransparentProxyRP;
- value.offsetOfRealProxyServer = (DWORD)pEEInfoOut->offsetOfRealProxyServer;
- value.offsetOfObjArrayData = (DWORD)pEEInfoOut->offsetOfObjArrayData;
- value.sizeOfReversePInvokeFrame = (DWORD)pEEInfoOut->sizeOfReversePInvokeFrame;
- value.osPageSize = (DWORD)pEEInfoOut->osPageSize;
- value.maxUncheckedOffsetForNullObject = (DWORD)pEEInfoOut->maxUncheckedOffsetForNullObject;
- value.targetAbi = (DWORD)pEEInfoOut->targetAbi;
- value.osType = (DWORD)pEEInfoOut->osType;
- value.osMajor = (DWORD)pEEInfoOut->osMajor;
- value.osMinor = (DWORD)pEEInfoOut->osMinor;
- value.osBuild = (DWORD)pEEInfoOut->osBuild;
+ value.offsetOfThreadFrame = (DWORD)pEEInfoOut->offsetOfThreadFrame;
+ value.offsetOfGCState = (DWORD)pEEInfoOut->offsetOfGCState;
+ value.offsetOfDelegateInstance = (DWORD)pEEInfoOut->offsetOfDelegateInstance;
+ value.offsetOfDelegateFirstTarget = (DWORD)pEEInfoOut->offsetOfDelegateFirstTarget;
+ value.offsetOfSecureDelegateIndirectCell = (DWORD)pEEInfoOut->offsetOfSecureDelegateIndirectCell;
+ value.offsetOfTransparentProxyRP = (DWORD)pEEInfoOut->offsetOfTransparentProxyRP;
+ value.offsetOfRealProxyServer = (DWORD)pEEInfoOut->offsetOfRealProxyServer;
+ value.offsetOfObjArrayData = (DWORD)pEEInfoOut->offsetOfObjArrayData;
+ value.sizeOfReversePInvokeFrame = (DWORD)pEEInfoOut->sizeOfReversePInvokeFrame;
+ value.osPageSize = (DWORD)pEEInfoOut->osPageSize;
+ value.maxUncheckedOffsetForNullObject = (DWORD)pEEInfoOut->maxUncheckedOffsetForNullObject;
+ value.targetAbi = (DWORD)pEEInfoOut->targetAbi;
+ value.osType = (DWORD)pEEInfoOut->osType;
+ value.osMajor = (DWORD)pEEInfoOut->osMajor;
+ value.osMinor = (DWORD)pEEInfoOut->osMinor;
+ value.osBuild = (DWORD)pEEInfoOut->osBuild;
GetEEInfo->Add((DWORD)0, value);
DEBUG_REC(dmpGetEEInfo((DWORD)0, value));
@@ -4143,34 +4278,19 @@ void MethodContext::recGetEEInfo(CORINFO_EE_INFO *pEEInfoOut)
void MethodContext::dmpGetEEInfo(DWORD key, const Agnostic_CORINFO_EE_INFO& value)
{
printf("GetEEInfo key %u, value icfi{sz-%u ogs-%u ofv-%u ofl-%u ocsp-%u ocsfp-%u oct-%u ora-%u} "
- "otf-%u ogcs-%u odi-%u odft-%u osdic-%u otrp-%u orps-%u ooad-%u srpf-%u osps-%u muono-%u tabi-%u osType-%u osMajor-%u osMinor-%u osBuild-%u",
- key,
- value.inlinedCallFrameInfo.size,
- value.inlinedCallFrameInfo.offsetOfGSCookie,
- value.inlinedCallFrameInfo.offsetOfFrameVptr,
- value.inlinedCallFrameInfo.offsetOfFrameLink,
- value.inlinedCallFrameInfo.offsetOfCallSiteSP,
- value.inlinedCallFrameInfo.offsetOfCalleeSavedFP,
- value.inlinedCallFrameInfo.offsetOfCallTarget,
- value.inlinedCallFrameInfo.offsetOfReturnAddress,
- value.offsetOfThreadFrame,
- value.offsetOfGCState,
- value.offsetOfDelegateInstance,
- value.offsetOfDelegateFirstTarget,
- value.offsetOfSecureDelegateIndirectCell,
- value.offsetOfTransparentProxyRP,
- value.offsetOfRealProxyServer,
- value.offsetOfObjArrayData,
- value.sizeOfReversePInvokeFrame,
- value.osPageSize,
- value.maxUncheckedOffsetForNullObject,
- value.targetAbi,
- value.osType,
- value.osMajor,
- value.osMinor,
- value.osBuild);
-}
-void MethodContext::repGetEEInfo(CORINFO_EE_INFO *pEEInfoOut)
+ "otf-%u ogcs-%u odi-%u odft-%u osdic-%u otrp-%u orps-%u ooad-%u srpf-%u osps-%u muono-%u tabi-%u osType-%u "
+ "osMajor-%u osMinor-%u osBuild-%u",
+ key, value.inlinedCallFrameInfo.size, value.inlinedCallFrameInfo.offsetOfGSCookie,
+ value.inlinedCallFrameInfo.offsetOfFrameVptr, value.inlinedCallFrameInfo.offsetOfFrameLink,
+ value.inlinedCallFrameInfo.offsetOfCallSiteSP, value.inlinedCallFrameInfo.offsetOfCalleeSavedFP,
+ value.inlinedCallFrameInfo.offsetOfCallTarget, value.inlinedCallFrameInfo.offsetOfReturnAddress,
+ value.offsetOfThreadFrame, value.offsetOfGCState, value.offsetOfDelegateInstance,
+ value.offsetOfDelegateFirstTarget, value.offsetOfSecureDelegateIndirectCell,
+ value.offsetOfTransparentProxyRP, value.offsetOfRealProxyServer, value.offsetOfObjArrayData,
+ value.sizeOfReversePInvokeFrame, value.osPageSize, value.maxUncheckedOffsetForNullObject, value.targetAbi,
+ value.osType, value.osMajor, value.osMinor, value.osBuild);
+}
+void MethodContext::repGetEEInfo(CORINFO_EE_INFO* pEEInfoOut)
{
Agnostic_CORINFO_EE_INFO value;
@@ -4179,63 +4299,65 @@ void MethodContext::repGetEEInfo(CORINFO_EE_INFO *pEEInfoOut)
index = GetEEInfo->GetIndex((DWORD)0);
if (index >= 0)
{
- value = GetEEInfo->Get((DWORD)0);
- pEEInfoOut->inlinedCallFrameInfo.size = (unsigned)value.inlinedCallFrameInfo.size;
- pEEInfoOut->inlinedCallFrameInfo.offsetOfGSCookie = (unsigned)value.inlinedCallFrameInfo.offsetOfGSCookie;
- pEEInfoOut->inlinedCallFrameInfo.offsetOfFrameVptr = (unsigned)value.inlinedCallFrameInfo.offsetOfFrameVptr;
- pEEInfoOut->inlinedCallFrameInfo.offsetOfFrameLink = (unsigned)value.inlinedCallFrameInfo.offsetOfFrameLink;
+ value = GetEEInfo->Get((DWORD)0);
+ pEEInfoOut->inlinedCallFrameInfo.size = (unsigned)value.inlinedCallFrameInfo.size;
+ pEEInfoOut->inlinedCallFrameInfo.offsetOfGSCookie = (unsigned)value.inlinedCallFrameInfo.offsetOfGSCookie;
+ pEEInfoOut->inlinedCallFrameInfo.offsetOfFrameVptr = (unsigned)value.inlinedCallFrameInfo.offsetOfFrameVptr;
+ pEEInfoOut->inlinedCallFrameInfo.offsetOfFrameLink = (unsigned)value.inlinedCallFrameInfo.offsetOfFrameLink;
pEEInfoOut->inlinedCallFrameInfo.offsetOfCallSiteSP = (unsigned)value.inlinedCallFrameInfo.offsetOfCallSiteSP;
- pEEInfoOut->inlinedCallFrameInfo.offsetOfCalleeSavedFP = (unsigned)value.inlinedCallFrameInfo.offsetOfCalleeSavedFP;
+ pEEInfoOut->inlinedCallFrameInfo.offsetOfCalleeSavedFP =
+ (unsigned)value.inlinedCallFrameInfo.offsetOfCalleeSavedFP;
pEEInfoOut->inlinedCallFrameInfo.offsetOfCallTarget = (unsigned)value.inlinedCallFrameInfo.offsetOfCallTarget;
- pEEInfoOut->inlinedCallFrameInfo.offsetOfReturnAddress = (unsigned)value.inlinedCallFrameInfo.offsetOfReturnAddress;
- pEEInfoOut->offsetOfThreadFrame = (unsigned)value.offsetOfThreadFrame;
- pEEInfoOut->offsetOfGCState = (unsigned)value.offsetOfGCState;
- pEEInfoOut->offsetOfDelegateInstance = (unsigned)value.offsetOfDelegateInstance;
- pEEInfoOut->offsetOfDelegateFirstTarget = (unsigned)value.offsetOfDelegateFirstTarget;
+ pEEInfoOut->inlinedCallFrameInfo.offsetOfReturnAddress =
+ (unsigned)value.inlinedCallFrameInfo.offsetOfReturnAddress;
+ pEEInfoOut->offsetOfThreadFrame = (unsigned)value.offsetOfThreadFrame;
+ pEEInfoOut->offsetOfGCState = (unsigned)value.offsetOfGCState;
+ pEEInfoOut->offsetOfDelegateInstance = (unsigned)value.offsetOfDelegateInstance;
+ pEEInfoOut->offsetOfDelegateFirstTarget = (unsigned)value.offsetOfDelegateFirstTarget;
pEEInfoOut->offsetOfSecureDelegateIndirectCell = (unsigned)value.offsetOfSecureDelegateIndirectCell;
- pEEInfoOut->offsetOfTransparentProxyRP = (unsigned)value.offsetOfTransparentProxyRP;
- pEEInfoOut->offsetOfRealProxyServer = (unsigned)value.offsetOfRealProxyServer;
- pEEInfoOut->offsetOfObjArrayData = (unsigned)value.offsetOfObjArrayData;
- pEEInfoOut->sizeOfReversePInvokeFrame = (unsigned)value.sizeOfReversePInvokeFrame;
- pEEInfoOut->osPageSize = (size_t)value.osPageSize;
- pEEInfoOut->maxUncheckedOffsetForNullObject = (size_t)value.maxUncheckedOffsetForNullObject;
- pEEInfoOut->targetAbi = (CORINFO_RUNTIME_ABI)value.targetAbi;
- pEEInfoOut->osType = (CORINFO_OS)value.osType;
- pEEInfoOut->osMajor = (unsigned)value.osMajor;
- pEEInfoOut->osMinor = (unsigned)value.osMinor;
- pEEInfoOut->osBuild = (unsigned)value.osBuild;
+ pEEInfoOut->offsetOfTransparentProxyRP = (unsigned)value.offsetOfTransparentProxyRP;
+ pEEInfoOut->offsetOfRealProxyServer = (unsigned)value.offsetOfRealProxyServer;
+ pEEInfoOut->offsetOfObjArrayData = (unsigned)value.offsetOfObjArrayData;
+ pEEInfoOut->sizeOfReversePInvokeFrame = (unsigned)value.sizeOfReversePInvokeFrame;
+ pEEInfoOut->osPageSize = (size_t)value.osPageSize;
+ pEEInfoOut->maxUncheckedOffsetForNullObject = (size_t)value.maxUncheckedOffsetForNullObject;
+ pEEInfoOut->targetAbi = (CORINFO_RUNTIME_ABI)value.targetAbi;
+ pEEInfoOut->osType = (CORINFO_OS)value.osType;
+ pEEInfoOut->osMajor = (unsigned)value.osMajor;
+ pEEInfoOut->osMinor = (unsigned)value.osMinor;
+ pEEInfoOut->osBuild = (unsigned)value.osBuild;
DEBUG_REP(dmpGetEEInfo((DWORD)0, value));
}
else
{
- pEEInfoOut->inlinedCallFrameInfo.size = (unsigned)0x40;
- pEEInfoOut->inlinedCallFrameInfo.offsetOfGSCookie = (unsigned)0;
- pEEInfoOut->inlinedCallFrameInfo.offsetOfFrameVptr = (unsigned)0x8;
- pEEInfoOut->inlinedCallFrameInfo.offsetOfFrameLink = (unsigned)0x10;
- pEEInfoOut->inlinedCallFrameInfo.offsetOfCallSiteSP = (unsigned)0x28;
+ pEEInfoOut->inlinedCallFrameInfo.size = (unsigned)0x40;
+ pEEInfoOut->inlinedCallFrameInfo.offsetOfGSCookie = (unsigned)0;
+ pEEInfoOut->inlinedCallFrameInfo.offsetOfFrameVptr = (unsigned)0x8;
+ pEEInfoOut->inlinedCallFrameInfo.offsetOfFrameLink = (unsigned)0x10;
+ pEEInfoOut->inlinedCallFrameInfo.offsetOfCallSiteSP = (unsigned)0x28;
pEEInfoOut->inlinedCallFrameInfo.offsetOfCalleeSavedFP = (unsigned)0x38;
- pEEInfoOut->inlinedCallFrameInfo.offsetOfCallTarget = (unsigned)0x18;
+ pEEInfoOut->inlinedCallFrameInfo.offsetOfCallTarget = (unsigned)0x18;
pEEInfoOut->inlinedCallFrameInfo.offsetOfReturnAddress = (unsigned)0x30;
- pEEInfoOut->offsetOfThreadFrame = (unsigned)0x10;
- pEEInfoOut->offsetOfGCState = (unsigned)0xc;
- pEEInfoOut->offsetOfDelegateInstance = (unsigned)0x8;
- pEEInfoOut->offsetOfDelegateFirstTarget = (unsigned)0x18;
- pEEInfoOut->offsetOfSecureDelegateIndirectCell = (unsigned)0x40;
- pEEInfoOut->offsetOfTransparentProxyRP = (unsigned)0x8;
- pEEInfoOut->offsetOfRealProxyServer = (unsigned)0x18;
- pEEInfoOut->offsetOfObjArrayData = (unsigned)0x18;
- pEEInfoOut->sizeOfReversePInvokeFrame = (unsigned)0x8;
- pEEInfoOut->osPageSize = (size_t)0x1000;
- pEEInfoOut->maxUncheckedOffsetForNullObject = (size_t)((32*1024)-1);
- pEEInfoOut->targetAbi = CORINFO_DESKTOP_ABI;
- pEEInfoOut->osType = (CORINFO_OS)0;
- pEEInfoOut->osMajor = (unsigned)0;
- pEEInfoOut->osMinor = (unsigned)0;
- pEEInfoOut->osBuild = (unsigned)0;
+ pEEInfoOut->offsetOfThreadFrame = (unsigned)0x10;
+ pEEInfoOut->offsetOfGCState = (unsigned)0xc;
+ pEEInfoOut->offsetOfDelegateInstance = (unsigned)0x8;
+ pEEInfoOut->offsetOfDelegateFirstTarget = (unsigned)0x18;
+ pEEInfoOut->offsetOfSecureDelegateIndirectCell = (unsigned)0x40;
+ pEEInfoOut->offsetOfTransparentProxyRP = (unsigned)0x8;
+ pEEInfoOut->offsetOfRealProxyServer = (unsigned)0x18;
+ pEEInfoOut->offsetOfObjArrayData = (unsigned)0x18;
+ pEEInfoOut->sizeOfReversePInvokeFrame = (unsigned)0x8;
+ pEEInfoOut->osPageSize = (size_t)0x1000;
+ pEEInfoOut->maxUncheckedOffsetForNullObject = (size_t)((32 * 1024) - 1);
+ pEEInfoOut->targetAbi = CORINFO_DESKTOP_ABI;
+ pEEInfoOut->osType = (CORINFO_OS)0;
+ pEEInfoOut->osMajor = (unsigned)0;
+ pEEInfoOut->osMinor = (unsigned)0;
+ pEEInfoOut->osBuild = (unsigned)0;
}
}
-void MethodContext::recGetGSCookie(GSCookie *pCookieVal, GSCookie **ppCookieVal)
+void MethodContext::recGetGSCookie(GSCookie* pCookieVal, GSCookie** ppCookieVal)
{
if (GetGSCookie == nullptr)
GetGSCookie = new LightWeightMap<DWORD, DLDL>();
@@ -4257,7 +4379,7 @@ void MethodContext::dmpGetGSCookie(DWORD key, DLDL value)
{
printf("GetGSCookie key 0, value pCookieVal-%016llX ppCookieVal-%016llX", value.A, value.B);
}
-void MethodContext::repGetGSCookie(GSCookie *pCookieVal, GSCookie **ppCookieVal)
+void MethodContext::repGetGSCookie(GSCookie* pCookieVal, GSCookie** ppCookieVal)
{
DLDL value;
@@ -4269,7 +4391,10 @@ void MethodContext::repGetGSCookie(GSCookie *pCookieVal, GSCookie **ppCookieVal)
*ppCookieVal = (GSCookie*)value.B;
}
-void MethodContext::recGetClassModuleIdForStatics(CORINFO_CLASS_HANDLE cls, CORINFO_MODULE_HANDLE *pModule, void **ppIndirection, size_t result)
+void MethodContext::recGetClassModuleIdForStatics(CORINFO_CLASS_HANDLE cls,
+ CORINFO_MODULE_HANDLE* pModule,
+ void** ppIndirection,
+ size_t result)
{
if (GetClassModuleIdForStatics == nullptr)
GetClassModuleIdForStatics = new LightWeightMap<DWORDLONG, Agnostic_GetClassModuleIdForStatics>();
@@ -4284,14 +4409,17 @@ void MethodContext::recGetClassModuleIdForStatics(CORINFO_CLASS_HANDLE cls, CORI
value.pIndirection = (DWORDLONG)*ppIndirection;
else
value.pIndirection = (DWORDLONG)0;
- value.result = (DWORDLONG)result;
+ value.result = (DWORDLONG)result;
GetClassModuleIdForStatics->Add((DWORDLONG)cls, value);
}
void MethodContext::dmpGetClassModuleIdForStatics(DWORDLONG key, const Agnostic_GetClassModuleIdForStatics& value)
{
- printf("GetClassModuleIdForStatics key cls-%016llX, value mod-%016llX pp-%016llX res-%016llX", key, value.Module, value.pIndirection, value.result);
+ printf("GetClassModuleIdForStatics key cls-%016llX, value mod-%016llX pp-%016llX res-%016llX", key, value.Module,
+ value.pIndirection, value.result);
}
-size_t MethodContext::repGetClassModuleIdForStatics(CORINFO_CLASS_HANDLE cls, CORINFO_MODULE_HANDLE *pModule, void **ppIndirection)
+size_t MethodContext::repGetClassModuleIdForStatics(CORINFO_CLASS_HANDLE cls,
+ CORINFO_MODULE_HANDLE* pModule,
+ void** ppIndirection)
{
Agnostic_GetClassModuleIdForStatics value;
@@ -4305,7 +4433,7 @@ size_t MethodContext::repGetClassModuleIdForStatics(CORINFO_CLASS_HANDLE cls, CO
return (size_t)value.result;
}
-void MethodContext::recGetThreadTLSIndex(void **ppIndirection, DWORD result)
+void MethodContext::recGetThreadTLSIndex(void** ppIndirection, DWORD result)
{
if (GetThreadTLSIndex == nullptr)
GetThreadTLSIndex = new LightWeightMap<DWORD, DLD>();
@@ -4316,7 +4444,7 @@ void MethodContext::recGetThreadTLSIndex(void **ppIndirection, DWORD result)
value.A = (DWORDLONG)*ppIndirection;
else
value.A = (DWORDLONG)0;
- value.B = (DWORD)result;
+ value.B = (DWORD)result;
GetThreadTLSIndex->Add((DWORD)0, value);
}
@@ -4324,7 +4452,7 @@ void MethodContext::dmpGetThreadTLSIndex(DWORD key, DLD value)
{
printf("GetThreadTLSIndex key 0, value ppIndirection-%016llX result-%08X", value.A, value.B);
}
-DWORD MethodContext::repGetThreadTLSIndex(void **ppIndirection)
+DWORD MethodContext::repGetThreadTLSIndex(void** ppIndirection)
{
DLD value;
@@ -4335,7 +4463,7 @@ DWORD MethodContext::repGetThreadTLSIndex(void **ppIndirection)
return (DWORD)value.B;
}
-void MethodContext::recGetInlinedCallFrameVptr(void **ppIndirection, const void * result)
+void MethodContext::recGetInlinedCallFrameVptr(void** ppIndirection, const void* result)
{
if (GetInlinedCallFrameVptr == nullptr)
GetInlinedCallFrameVptr = new LightWeightMap<DWORD, DLDL>();
@@ -4346,7 +4474,7 @@ void MethodContext::recGetInlinedCallFrameVptr(void **ppIndirection, const void
value.A = (DWORDLONG)*ppIndirection;
else
value.A = (DWORDLONG)0;
- value.B = (DWORDLONG)result;
+ value.B = (DWORDLONG)result;
GetInlinedCallFrameVptr->Add((DWORD)0, value);
}
@@ -4354,7 +4482,7 @@ void MethodContext::dmpGetInlinedCallFrameVptr(DWORD key, DLDL value)
{
printf("GetInlinedCallFrameVptr key 0, value ppIndirection-%016llX result-%016llX\n", value.A, value.B);
}
-const void * MethodContext::repGetInlinedCallFrameVptr(void **ppIndirection)
+const void* MethodContext::repGetInlinedCallFrameVptr(void** ppIndirection)
{
DLDL value;
@@ -4362,10 +4490,10 @@ const void * MethodContext::repGetInlinedCallFrameVptr(void **ppIndirection)
if (ppIndirection != nullptr)
*ppIndirection = (void*)value.A;
- return (const void *)value.B;
+ return (const void*)value.B;
}
-void MethodContext::recGetAddrOfCaptureThreadGlobal(void **ppIndirection, LONG * result)
+void MethodContext::recGetAddrOfCaptureThreadGlobal(void** ppIndirection, LONG* result)
{
if (GetAddrOfCaptureThreadGlobal == nullptr)
GetAddrOfCaptureThreadGlobal = new LightWeightMap<DWORD, DLDL>();
@@ -4376,7 +4504,7 @@ void MethodContext::recGetAddrOfCaptureThreadGlobal(void **ppIndirection, LONG *
value.A = (DWORDLONG)*ppIndirection;
else
value.A = (DWORDLONG)0;
- value.B = (DWORDLONG)result;
+ value.B = (DWORDLONG)result;
GetAddrOfCaptureThreadGlobal->Add((DWORD)0, value);
DEBUG_REC(dmpGetAddrOfCaptureThreadGlobal((DWORD)0, value));
@@ -4385,7 +4513,7 @@ void MethodContext::dmpGetAddrOfCaptureThreadGlobal(DWORD key, DLDL value)
{
printf("GetAddrOfCaptureThreadGlobal key %u, value ppi-%016llX res-%016llX", key, value.A, value.B);
}
-LONG * MethodContext::repGetAddrOfCaptureThreadGlobal(void **ppIndirection)
+LONG* MethodContext::repGetAddrOfCaptureThreadGlobal(void** ppIndirection)
{
DLDL value;
@@ -4403,10 +4531,10 @@ LONG * MethodContext::repGetAddrOfCaptureThreadGlobal(void **ppIndirection)
if (ppIndirection != nullptr)
*ppIndirection = (void*)value.A;
DEBUG_REP(dmpGetAddrOfCaptureThreadGlobal((DWORD)0, value));
- return (LONG *)value.B;
+ return (LONG*)value.B;
}
-void MethodContext::recGetClassDomainID(CORINFO_CLASS_HANDLE cls, void **ppIndirection, unsigned result)
+void MethodContext::recGetClassDomainID(CORINFO_CLASS_HANDLE cls, void** ppIndirection, unsigned result)
{
if (GetClassDomainID == nullptr)
GetClassDomainID = new LightWeightMap<DWORDLONG, DLD>();
@@ -4417,7 +4545,7 @@ void MethodContext::recGetClassDomainID(CORINFO_CLASS_HANDLE cls, void **ppIndir
value.A = (DWORDLONG)*ppIndirection;
else
value.A = (DWORDLONG)0;
- value.B = (DWORD)result;
+ value.B = (DWORD)result;
GetClassDomainID->Add((DWORDLONG)cls, value);
DEBUG_REC(dmpGetClassDomainID((DWORDLONG)cls, value));
@@ -4426,12 +4554,13 @@ void MethodContext::dmpGetClassDomainID(DWORDLONG key, DLD value)
{
printf("GetClassDomainID key cls-%016llX, value pp-%016llX res-%u", key, value.A, value.B);
}
-unsigned MethodContext::repGetClassDomainID(CORINFO_CLASS_HANDLE cls, void **ppIndirection)
+unsigned MethodContext::repGetClassDomainID(CORINFO_CLASS_HANDLE cls, void** ppIndirection)
{
DLD value;
AssertCodeMsg(GetClassDomainID != nullptr, EXCEPTIONCODE_MC, "Didn't find anything for %016llX", (DWORDLONG)cls);
- AssertCodeMsg(GetClassDomainID->GetIndex((DWORDLONG)cls) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX", (DWORDLONG)cls);
+ AssertCodeMsg(GetClassDomainID->GetIndex((DWORDLONG)cls) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX",
+ (DWORDLONG)cls);
value = GetClassDomainID->Get((DWORDLONG)cls);
if (ppIndirection != nullptr)
*ppIndirection = (void*)value.A;
@@ -4439,7 +4568,7 @@ unsigned MethodContext::repGetClassDomainID(CORINFO_CLASS_HANDLE cls, void **ppI
return (unsigned)value.B;
}
-void MethodContext::recGetLocationOfThisType(CORINFO_METHOD_HANDLE context, CORINFO_LOOKUP_KIND *result)
+void MethodContext::recGetLocationOfThisType(CORINFO_METHOD_HANDLE context, CORINFO_LOOKUP_KIND* result)
{
if (GetLocationOfThisType == nullptr)
GetLocationOfThisType = new LightWeightMap<DWORDLONG, Agnostic_CORINFO_LOOKUP_KIND>();
@@ -4447,7 +4576,7 @@ void MethodContext::recGetLocationOfThisType(CORINFO_METHOD_HANDLE context, CORI
Agnostic_CORINFO_LOOKUP_KIND value;
value.needsRuntimeLookup = (DWORD)result->needsRuntimeLookup;
- value.runtimeLookupKind = (DWORD)result->runtimeLookupKind;
+ value.runtimeLookupKind = (DWORD)result->runtimeLookupKind;
value.runtimeLookupFlags = (WORD)result->runtimeLookupFlags;
// We don't store result->runtimeLookupArgs, which is opaque data. Ok?
@@ -4455,82 +4584,87 @@ void MethodContext::recGetLocationOfThisType(CORINFO_METHOD_HANDLE context, CORI
}
void MethodContext::dmpGetLocationOfThisType(DWORDLONG key, const Agnostic_CORINFO_LOOKUP_KIND& value)
{
- printf("GetLocationOfThisType key ftn-%016llX, value nrl-%u rlk-%u", key, value.needsRuntimeLookup, value.runtimeLookupKind);
+ printf("GetLocationOfThisType key ftn-%016llX, value nrl-%u rlk-%u", key, value.needsRuntimeLookup,
+ value.runtimeLookupKind);
}
CORINFO_LOOKUP_KIND MethodContext::repGetLocationOfThisType(CORINFO_METHOD_HANDLE context)
{
Agnostic_CORINFO_LOOKUP_KIND value1;
- CORINFO_LOOKUP_KIND value2;
+ CORINFO_LOOKUP_KIND value2;
value1 = GetLocationOfThisType->Get((DWORDLONG)context);
value2.needsRuntimeLookup = value1.needsRuntimeLookup != 0;
- value2.runtimeLookupKind = (CORINFO_RUNTIME_LOOKUP_KIND)value1.runtimeLookupKind;
+ value2.runtimeLookupKind = (CORINFO_RUNTIME_LOOKUP_KIND)value1.runtimeLookupKind;
value2.runtimeLookupFlags = (WORD)value1.runtimeLookupFlags;
- value2.runtimeLookupArgs = nullptr; // We don't store this opaque data. Ok?
+ value2.runtimeLookupArgs = nullptr; // We don't store this opaque data. Ok?
return value2;
}
-void MethodContext::recGetDelegateCtor(CORINFO_METHOD_HANDLE methHnd, CORINFO_CLASS_HANDLE clsHnd,
- CORINFO_METHOD_HANDLE targetMethodHnd, DelegateCtorArgs *pCtorData, CORINFO_METHOD_HANDLE result)
+void MethodContext::recGetDelegateCtor(CORINFO_METHOD_HANDLE methHnd,
+ CORINFO_CLASS_HANDLE clsHnd,
+ CORINFO_METHOD_HANDLE targetMethodHnd,
+ DelegateCtorArgs* pCtorData,
+ CORINFO_METHOD_HANDLE result)
{
if (GetDelegateCtor == nullptr)
GetDelegateCtor = new LightWeightMap<Agnostic_GetDelegateCtorIn, Agnostic_GetDelegateCtorOut>();
Agnostic_GetDelegateCtorIn key;
- ZeroMemory(&key, sizeof(Agnostic_GetDelegateCtorIn)); //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_GetDelegateCtorIn)); // We use the input structs as a key and use memcmp to
+ // compare.. so we need to zero out padding too
Agnostic_GetDelegateCtorOut value;
- key.methHnd = (DWORDLONG)methHnd;
- key.clsHnd = (DWORDLONG)clsHnd;
+ key.methHnd = (DWORDLONG)methHnd;
+ key.clsHnd = (DWORDLONG)clsHnd;
key.targetMethodHnd = (DWORDLONG)targetMethodHnd;
value.CtorData.pMethod = (DWORDLONG)pCtorData->pMethod;
- value.CtorData.pArg3 = (DWORDLONG)pCtorData->pArg3;
- value.CtorData.pArg4 = (DWORDLONG)pCtorData->pArg4;
- value.CtorData.pArg5 = (DWORDLONG)pCtorData->pArg5;
- value.result = (DWORDLONG)result;
+ value.CtorData.pArg3 = (DWORDLONG)pCtorData->pArg3;
+ value.CtorData.pArg4 = (DWORDLONG)pCtorData->pArg4;
+ value.CtorData.pArg5 = (DWORDLONG)pCtorData->pArg5;
+ value.result = (DWORDLONG)result;
GetDelegateCtor->Add(key, value);
DEBUG_REC(dmpGetDelegateCtor(key, value));
}
void MethodContext::dmpGetDelegateCtor(const Agnostic_GetDelegateCtorIn& key, const Agnostic_GetDelegateCtorOut& value)
{
- printf("GetDelegateCtor key ftn-%016llX cls-%016llX tftn-%016llX, value pm-%016llX a3-%016llX a4-%016llX a5-%016llX res-%016llX",
- key.methHnd,
- key.clsHnd,
- key.targetMethodHnd,
- value.CtorData.pMethod,
- value.CtorData.pArg3,
- value.CtorData.pArg4,
- value.CtorData.pArg5,
- value.result);
+ printf("GetDelegateCtor key ftn-%016llX cls-%016llX tftn-%016llX, value pm-%016llX a3-%016llX a4-%016llX "
+ "a5-%016llX res-%016llX",
+ key.methHnd, key.clsHnd, key.targetMethodHnd, value.CtorData.pMethod, value.CtorData.pArg3,
+ value.CtorData.pArg4, value.CtorData.pArg5, value.result);
}
-CORINFO_METHOD_HANDLE MethodContext::repGetDelegateCtor(CORINFO_METHOD_HANDLE methHnd, CORINFO_CLASS_HANDLE clsHnd,
- CORINFO_METHOD_HANDLE targetMethodHnd, DelegateCtorArgs *pCtorData)
+CORINFO_METHOD_HANDLE MethodContext::repGetDelegateCtor(CORINFO_METHOD_HANDLE methHnd,
+ CORINFO_CLASS_HANDLE clsHnd,
+ CORINFO_METHOD_HANDLE targetMethodHnd,
+ DelegateCtorArgs* pCtorData)
{
Agnostic_GetDelegateCtorIn key;
- ZeroMemory(&key, sizeof(Agnostic_GetDelegateCtorIn)); //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_GetDelegateCtorIn)); // We use the input structs as a key and use memcmp to
+ // compare.. so we need to zero out padding too
Agnostic_GetDelegateCtorOut value;
- key.methHnd = (DWORDLONG)methHnd;
- key.clsHnd = (DWORDLONG)clsHnd;
+ key.methHnd = (DWORDLONG)methHnd;
+ key.clsHnd = (DWORDLONG)clsHnd;
key.targetMethodHnd = (DWORDLONG)targetMethodHnd;
- AssertCodeMsg(GetDelegateCtor != nullptr, EXCEPTIONCODE_MC, "Didn't find anything for %016llX", (DWORDLONG)key.methHnd);
- AssertCodeMsg(GetDelegateCtor->GetIndex(key) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX", (DWORDLONG)key.methHnd);
+ AssertCodeMsg(GetDelegateCtor != nullptr, EXCEPTIONCODE_MC, "Didn't find anything for %016llX",
+ (DWORDLONG)key.methHnd);
+ AssertCodeMsg(GetDelegateCtor->GetIndex(key) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX",
+ (DWORDLONG)key.methHnd);
value = GetDelegateCtor->Get(key);
pCtorData->pMethod = (void*)value.CtorData.pMethod;
- pCtorData->pArg3 = (void*)value.CtorData.pArg3;
- pCtorData->pArg4 = (void*)value.CtorData.pArg4;
- pCtorData->pArg5 = (void*)value.CtorData.pArg5;
+ pCtorData->pArg3 = (void*)value.CtorData.pArg3;
+ pCtorData->pArg4 = (void*)value.CtorData.pArg4;
+ pCtorData->pArg5 = (void*)value.CtorData.pArg5;
DEBUG_REP(dmpGetDelegateCtor(key, value));
return (CORINFO_METHOD_HANDLE)value.result;
}
-void MethodContext::recGetFunctionFixedEntryPoint(CORINFO_METHOD_HANDLE ftn, CORINFO_CONST_LOOKUP *pResult)
+void MethodContext::recGetFunctionFixedEntryPoint(CORINFO_METHOD_HANDLE ftn, CORINFO_CONST_LOOKUP* pResult)
{
if (GetFunctionFixedEntryPoint == nullptr)
GetFunctionFixedEntryPoint = new LightWeightMap<DWORDLONG, Agnostic_CORINFO_CONST_LOOKUP>();
@@ -4538,7 +4672,7 @@ void MethodContext::recGetFunctionFixedEntryPoint(CORINFO_METHOD_HANDLE ftn, COR
Agnostic_CORINFO_CONST_LOOKUP value;
value.accessType = (DWORD)pResult->accessType;
- value.handle = (DWORDLONG)pResult->handle;
+ value.handle = (DWORDLONG)pResult->handle;
GetFunctionFixedEntryPoint->Add((DWORDLONG)ftn, value);
}
@@ -4546,14 +4680,14 @@ void MethodContext::dmpGetFunctionFixedEntryPoint(DWORDLONG key, const Agnostic_
{
printf("GetFunctionFixedEntryPoint key ftn-%016llX, value at-%u han-%016llX", key, value.accessType, value.handle);
}
-void MethodContext::repGetFunctionFixedEntryPoint(CORINFO_METHOD_HANDLE ftn, CORINFO_CONST_LOOKUP *pResult)
+void MethodContext::repGetFunctionFixedEntryPoint(CORINFO_METHOD_HANDLE ftn, CORINFO_CONST_LOOKUP* pResult)
{
Agnostic_CORINFO_CONST_LOOKUP value;
value = GetFunctionFixedEntryPoint->Get((DWORDLONG)ftn);
pResult->accessType = (InfoAccessType)value.accessType;
- pResult->handle = (CORINFO_GENERIC_HANDLE)value.handle;
+ pResult->handle = (CORINFO_GENERIC_HANDLE)value.handle;
}
void MethodContext::recGetFieldInClass(CORINFO_CLASS_HANDLE clsHnd, INT num, CORINFO_FIELD_HANDLE result)
@@ -4562,7 +4696,8 @@ void MethodContext::recGetFieldInClass(CORINFO_CLASS_HANDLE clsHnd, INT num, COR
GetFieldInClass = new LightWeightMap<DLD, DWORDLONG>();
DLD key;
- ZeroMemory(&key, sizeof(DLD)); //We use the input structs as a key and use memcmp to compare.. so we need to zero out padding too
+ ZeroMemory(&key, sizeof(DLD)); // We use the input structs as a key and use memcmp to compare.. so we need to zero
+ // out padding too
key.A = (DWORDLONG)clsHnd;
key.B = (DWORD)num;
@@ -4577,26 +4712,31 @@ void MethodContext::dmpGetFieldInClass(DLD key, DWORDLONG value)
CORINFO_FIELD_HANDLE MethodContext::repGetFieldInClass(CORINFO_CLASS_HANDLE clsHnd, INT num)
{
DLD key;
- ZeroMemory(&key, sizeof(DLD)); //We use the input structs as a key and use memcmp to compare.. so we need to zero out padding too
+ ZeroMemory(&key, sizeof(DLD)); // We use the input structs as a key and use memcmp to compare.. so we need to zero
+ // out padding too
key.A = (DWORDLONG)clsHnd;
key.B = (DWORD)num;
- AssertCodeMsg((GetFieldInClass != nullptr) && (GetFieldInClass->GetIndex(key) != -1),
- EXCEPTIONCODE_MC, "Didn't find %016llX", (DWORDLONG)key.A);
+ AssertCodeMsg((GetFieldInClass != nullptr) && (GetFieldInClass->GetIndex(key) != -1), EXCEPTIONCODE_MC,
+ "Didn't find %016llX", (DWORDLONG)key.A);
CORINFO_FIELD_HANDLE temp = (CORINFO_FIELD_HANDLE)GetFieldInClass->Get(key);
DEBUG_REP(dmpGetFieldInClass(key, (DWORDLONG)temp));
return temp;
}
-void MethodContext::recGetFieldType(CORINFO_FIELD_HANDLE field, CORINFO_CLASS_HANDLE *structType, CORINFO_CLASS_HANDLE memberParent, CorInfoType result)
+void MethodContext::recGetFieldType(CORINFO_FIELD_HANDLE field,
+ CORINFO_CLASS_HANDLE* structType,
+ CORINFO_CLASS_HANDLE memberParent,
+ CorInfoType result)
{
if (GetFieldType == nullptr)
GetFieldType = new LightWeightMap<DLDL, DLD>();
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
DLD value;
key.A = (DWORDLONG)field;
@@ -4610,12 +4750,16 @@ void MethodContext::recGetFieldType(CORINFO_FIELD_HANDLE field, CORINFO_CLASS_HA
}
void MethodContext::dmpGetFieldType(DLDL key, DLD value)
{
- printf("GetFieldType key fld-%016llX cls-%016llX, value ch-%016llX cit-%u(%s)", key.A, key.B, value.A, value.B, toString((CorInfoType)value.B));
+ printf("GetFieldType key fld-%016llX cls-%016llX, value ch-%016llX cit-%u(%s)", key.A, key.B, value.A, value.B,
+ toString((CorInfoType)value.B));
}
-CorInfoType MethodContext::repGetFieldType(CORINFO_FIELD_HANDLE field, CORINFO_CLASS_HANDLE *structType, CORINFO_CLASS_HANDLE memberParent)
+CorInfoType MethodContext::repGetFieldType(CORINFO_FIELD_HANDLE field,
+ CORINFO_CLASS_HANDLE* structType,
+ CORINFO_CLASS_HANDLE memberParent)
{
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
DLD value;
key.A = (DWORDLONG)field;
@@ -4625,7 +4769,6 @@ CorInfoType MethodContext::repGetFieldType(CORINFO_FIELD_HANDLE field, CORINFO_C
AssertCodeMsg(GetFieldType->GetIndex(key) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX", (DWORDLONG)key.A);
value = GetFieldType->Get(key);
-
if (structType != nullptr)
*structType = (CORINFO_CLASS_HANDLE)value.A;
@@ -4633,7 +4776,7 @@ CorInfoType MethodContext::repGetFieldType(CORINFO_FIELD_HANDLE field, CORINFO_C
return (CorInfoType)value.B;
}
-void MethodContext::recGetFieldName(CORINFO_FIELD_HANDLE ftn, const char **moduleName, const char* result)
+void MethodContext::recGetFieldName(CORINFO_FIELD_HANDLE ftn, const char** moduleName, const char* result)
{
if (GetFieldName == nullptr)
GetFieldName = new LightWeightMap<DWORDLONG, DD>();
@@ -4641,12 +4784,12 @@ void MethodContext::recGetFieldName(CORINFO_FIELD_HANDLE ftn, const char **modul
DD value;
if (result != nullptr)
- value.A = GetFieldName->AddBuffer((unsigned char *)result, (DWORD)strlen(result) + 1);
+ value.A = GetFieldName->AddBuffer((unsigned char*)result, (DWORD)strlen(result) + 1);
else
value.A = (DWORD)-1;
- if (moduleName != nullptr) //protect strlen
- value.B = (DWORD)GetFieldName->AddBuffer((unsigned char *)*moduleName, (DWORD)strlen(*moduleName) + 1);
+ if (moduleName != nullptr) // protect strlen
+ value.B = (DWORD)GetFieldName->AddBuffer((unsigned char*)*moduleName, (DWORD)strlen(*moduleName) + 1);
else
value.B = (DWORD)-1;
@@ -4654,12 +4797,12 @@ void MethodContext::recGetFieldName(CORINFO_FIELD_HANDLE ftn, const char **modul
}
void MethodContext::dmpGetFieldName(DWORDLONG key, DD value)
{
- unsigned char *fieldName = (unsigned char *)GetFieldName->GetBuffer(value.A);
- unsigned char *moduleName = (unsigned char *)GetFieldName->GetBuffer(value.B);
+ unsigned char* fieldName = (unsigned char*)GetFieldName->GetBuffer(value.A);
+ unsigned char* moduleName = (unsigned char*)GetFieldName->GetBuffer(value.B);
printf("GetFieldName key - ftn-%016llX, value fld-'%s', mod-'%s'", key, fieldName, moduleName);
GetFieldName->Unlock();
}
-const char* MethodContext::repGetFieldName(CORINFO_FIELD_HANDLE ftn, const char **moduleName)
+const char* MethodContext::repGetFieldName(CORINFO_FIELD_HANDLE ftn, const char** moduleName)
{
DD value;
if (GetFieldName == nullptr)
@@ -4670,8 +4813,8 @@ const char* MethodContext::repGetFieldName(CORINFO_FIELD_HANDLE ftn, const char
}
value = GetFieldName->Get((DWORDLONG)ftn);
if (moduleName != nullptr)
- *moduleName = (const char *)GetFieldName->GetBuffer(value.B);
- return (const char *)GetFieldName->GetBuffer(value.A);
+ *moduleName = (const char*)GetFieldName->GetBuffer(value.B);
+ return (const char*)GetFieldName->GetBuffer(value.A);
}
void MethodContext::recCanInlineTypeCheckWithObjectVTable(CORINFO_CLASS_HANDLE cls, BOOL result)
@@ -4690,13 +4833,16 @@ BOOL MethodContext::repCanInlineTypeCheckWithObjectVTable(CORINFO_CLASS_HANDLE c
return (BOOL)CanInlineTypeCheckWithObjectVTable->Get((DWORDLONG)cls);
}
-void MethodContext::recSatisfiesMethodConstraints(CORINFO_CLASS_HANDLE parent, CORINFO_METHOD_HANDLE method, BOOL result)
+void MethodContext::recSatisfiesMethodConstraints(CORINFO_CLASS_HANDLE parent,
+ CORINFO_METHOD_HANDLE method,
+ BOOL result)
{
if (SatisfiesMethodConstraints == nullptr)
SatisfiesMethodConstraints = new LightWeightMap<DLDL, DWORD>();
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
key.A = (DWORDLONG)parent;
key.B = (DWORDLONG)method;
@@ -4710,7 +4856,8 @@ void MethodContext::dmpSatisfiesMethodConstraints(DLDL key, DWORD value)
BOOL MethodContext::repSatisfiesMethodConstraints(CORINFO_CLASS_HANDLE parent, CORINFO_METHOD_HANDLE method)
{
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
key.A = (DWORDLONG)parent;
key.B = (DWORDLONG)method;
@@ -4719,8 +4866,9 @@ BOOL MethodContext::repSatisfiesMethodConstraints(CORINFO_CLASS_HANDLE parent, C
return value;
}
-void MethodContext::recInitConstraintsForVerification(CORINFO_METHOD_HANDLE method, BOOL *pfHasCircularClassConstraints,
- BOOL *pfHasCircularMethodConstraint)
+void MethodContext::recInitConstraintsForVerification(CORINFO_METHOD_HANDLE method,
+ BOOL* pfHasCircularClassConstraints,
+ BOOL* pfHasCircularMethodConstraint)
{
if (InitConstraintsForVerification == nullptr)
InitConstraintsForVerification = new LightWeightMap<DWORDLONG, DD>();
@@ -4736,8 +4884,9 @@ void MethodContext::dmpInitConstraintsForVerification(DWORDLONG key, DD value)
{
printf("InitConstraintsForVerification key ftn-%016llX, value circ-%u cirm-%u", key, value.A, value.B);
}
-void MethodContext::repInitConstraintsForVerification(CORINFO_METHOD_HANDLE method, BOOL *pfHasCircularClassConstraints,
- BOOL *pfHasCircularMethodConstraint)
+void MethodContext::repInitConstraintsForVerification(CORINFO_METHOD_HANDLE method,
+ BOOL* pfHasCircularClassConstraints,
+ BOOL* pfHasCircularMethodConstraint)
{
DD value;
@@ -4753,7 +4902,8 @@ void MethodContext::recIsValidStringRef(CORINFO_MODULE_HANDLE module, unsigned m
IsValidStringRef = new LightWeightMap<DLD, DWORD>();
DLD key;
- ZeroMemory(&key, sizeof(DLD)); //We use the input structs as a key and use memcmp to compare.. so we need to zero out padding too
+ ZeroMemory(&key, sizeof(DLD)); // We use the input structs as a key and use memcmp to compare.. so we need to zero
+ // out padding too
key.A = (DWORDLONG)module;
key.B = (DWORD)metaTOK;
@@ -4767,7 +4917,8 @@ void MethodContext::dmpIsValidStringRef(DLD key, DWORD value)
BOOL MethodContext::repIsValidStringRef(CORINFO_MODULE_HANDLE module, unsigned metaTOK)
{
DLD key;
- ZeroMemory(&key, sizeof(DLD)); //We use the input structs as a key and use memcmp to compare.. so we need to zero out padding too
+ ZeroMemory(&key, sizeof(DLD)); // We use the input structs as a key and use memcmp to compare.. so we need to zero
+ // out padding too
key.A = (DWORDLONG)module;
key.B = (DWORD)metaTOK;
@@ -4795,7 +4946,8 @@ void MethodContext::dmpGetHelperName(DWORD key, DWORD value)
}
const char* MethodContext::repGetHelperName(CorInfoHelpFunc funcNum)
{
- if (GetHelperName == nullptr) return "Yickish helper name";
+ if (GetHelperName == nullptr)
+ return "Yickish helper name";
int itemIndex = GetHelperName->GetIndex((DWORD)funcNum);
if (itemIndex < 0)
@@ -4810,14 +4962,14 @@ const char* MethodContext::repGetHelperName(CorInfoHelpFunc funcNum)
}
}
-
void MethodContext::recCanCast(CORINFO_CLASS_HANDLE child, CORINFO_CLASS_HANDLE parent, BOOL result)
{
if (CanCast == nullptr)
CanCast = new LightWeightMap<DLDL, DWORD>();
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
key.A = (DWORDLONG)child;
key.B = (DWORDLONG)parent;
@@ -4832,19 +4984,22 @@ void MethodContext::dmpCanCast(DLDL key, DWORD value)
BOOL MethodContext::repCanCast(CORINFO_CLASS_HANDLE child, CORINFO_CLASS_HANDLE parent)
{
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
key.A = (DWORDLONG)child;
key.B = (DWORDLONG)parent;
- AssertCodeMsg(CanCast != nullptr, EXCEPTIONCODE_MC, "Didn't find anything %016llX, %016llX in map", (DWORDLONG)child, (DWORDLONG)parent);
- AssertCodeMsg(CanCast->GetIndex(key) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX, %016llX %u in map", (DWORDLONG)child, (DWORDLONG)parent, CanCast->GetCount());
+ AssertCodeMsg(CanCast != nullptr, EXCEPTIONCODE_MC, "Didn't find anything %016llX, %016llX in map",
+ (DWORDLONG)child, (DWORDLONG)parent);
+ AssertCodeMsg(CanCast->GetIndex(key) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX, %016llX %u in map",
+ (DWORDLONG)child, (DWORDLONG)parent, CanCast->GetCount());
BOOL value = (BOOL)CanCast->Get(key);
DEBUG_REP(dmpCanCast(key, (DWORD)value));
return value;
}
-void MethodContext::recGetChildType(CORINFO_CLASS_HANDLE clsHnd, CORINFO_CLASS_HANDLE *clsRet, CorInfoType result)
+void MethodContext::recGetChildType(CORINFO_CLASS_HANDLE clsHnd, CORINFO_CLASS_HANDLE* clsRet, CorInfoType result)
{
if (GetChildType == nullptr)
GetChildType = new LightWeightMap<DWORDLONG, DLD>();
@@ -4859,14 +5014,16 @@ void MethodContext::recGetChildType(CORINFO_CLASS_HANDLE clsHnd, CORINFO_CLASS_H
}
void MethodContext::dmpGetChildType(DWORDLONG key, DLD value)
{
- printf("GetChildType key cls-%016llX, value clsr-%016llX cit-%u(%s)", key, value.A, value.B, toString((CorInfoType)value.B));
+ printf("GetChildType key cls-%016llX, value clsr-%016llX cit-%u(%s)", key, value.A, value.B,
+ toString((CorInfoType)value.B));
}
-CorInfoType MethodContext::repGetChildType(CORINFO_CLASS_HANDLE clsHnd, CORINFO_CLASS_HANDLE *clsRet)
+CorInfoType MethodContext::repGetChildType(CORINFO_CLASS_HANDLE clsHnd, CORINFO_CLASS_HANDLE* clsRet)
{
DLD value;
AssertCodeMsg(GetChildType != nullptr, EXCEPTIONCODE_MC, "Didn't find anything for %016llX", (DWORDLONG)clsHnd);
- AssertCodeMsg(GetChildType->GetIndex((DWORDLONG)clsHnd) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX", (DWORDLONG)clsHnd);
+ AssertCodeMsg(GetChildType->GetIndex((DWORDLONG)clsHnd) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX",
+ (DWORDLONG)clsHnd);
value = GetChildType->Get((DWORDLONG)clsHnd);
*clsRet = (CORINFO_CLASS_HANDLE)value.A;
@@ -4874,14 +5031,14 @@ CorInfoType MethodContext::repGetChildType(CORINFO_CLASS_HANDLE clsHnd, CORINFO_
return (CorInfoType)value.B;
}
-
-void MethodContext::recGetArrayInitializationData(CORINFO_FIELD_HANDLE field, DWORD size, void *result)
+void MethodContext::recGetArrayInitializationData(CORINFO_FIELD_HANDLE field, DWORD size, void* result)
{
if (GetArrayInitializationData == nullptr)
GetArrayInitializationData = new LightWeightMap<DLD, DWORDLONG>();
DLD key;
- ZeroMemory(&key, sizeof(DLD)); //We use the input structs as a key and use memcmp to compare.. so we need to zero out padding too
+ ZeroMemory(&key, sizeof(DLD)); // We use the input structs as a key and use memcmp to compare.. so we need to zero
+ // out padding too
key.A = (DWORDLONG)field;
key.B = (DWORD)size;
@@ -4892,19 +5049,20 @@ void MethodContext::dmpGetArrayInitializationData(DLD key, DWORDLONG value)
{
printf("GetArrayInitializationData key field-%016llX size-%08X, value result-%016llX", key.A, key.B, value);
}
-void *MethodContext::repGetArrayInitializationData(CORINFO_FIELD_HANDLE field, DWORD size)
+void* MethodContext::repGetArrayInitializationData(CORINFO_FIELD_HANDLE field, DWORD size)
{
DLD key;
- ZeroMemory(&key, sizeof(DLD)); //We use the input structs as a key and use memcmp to compare.. so we need to zero out padding too
+ ZeroMemory(&key, sizeof(DLD)); // We use the input structs as a key and use memcmp to compare.. so we need to zero
+ // out padding too
key.A = (DWORDLONG)field;
key.B = (DWORD)size;
- void *value = (void*)GetArrayInitializationData->Get(key);
+ void* value = (void*)GetArrayInitializationData->Get(key);
return value;
}
-void MethodContext::recFilterException(struct _EXCEPTION_POINTERS *pExceptionPointers, int result)
+void MethodContext::recFilterException(struct _EXCEPTION_POINTERS* pExceptionPointers, int result)
{
if (FilterException == nullptr)
FilterException = new LightWeightMap<DWORD, DWORD>();
@@ -4915,7 +5073,7 @@ void MethodContext::dmpFilterException(DWORD key, DWORD value)
{
printf("FilterException key %u, value %u", key, value);
}
-int MethodContext::repFilterException(struct _EXCEPTION_POINTERS *pExceptionPointers)
+int MethodContext::repFilterException(struct _EXCEPTION_POINTERS* pExceptionPointers)
{
if (FilterException == nullptr)
return EXCEPTION_CONTINUE_SEARCH;
@@ -4926,10 +5084,9 @@ int MethodContext::repFilterException(struct _EXCEPTION_POINTERS *pExceptionPoin
int result = FilterException->Get((DWORD)pExceptionPointers->ExceptionRecord->ExceptionCode);
return result;
}
-
}
-void MethodContext::recHandleException(struct _EXCEPTION_POINTERS *pExceptionPointers)
+void MethodContext::recHandleException(struct _EXCEPTION_POINTERS* pExceptionPointers)
{
if (HandleException == nullptr)
HandleException = new DenseLightWeightMap<DWORD>();
@@ -4941,7 +5098,7 @@ void MethodContext::dmpHandleException(DWORD key, DWORD value)
printf("HandleException key %u, value %u", key, value);
}
-void MethodContext::recGetAddressOfPInvokeFixup(CORINFO_METHOD_HANDLE method, void **ppIndirection, void* result)
+void MethodContext::recGetAddressOfPInvokeFixup(CORINFO_METHOD_HANDLE method, void** ppIndirection, void* result)
{
if (GetAddressOfPInvokeFixup == nullptr)
GetAddressOfPInvokeFixup = new LightWeightMap<DWORDLONG, DLDL>();
@@ -4952,7 +5109,7 @@ void MethodContext::recGetAddressOfPInvokeFixup(CORINFO_METHOD_HANDLE method, vo
value.A = (DWORDLONG)*ppIndirection;
else
value.A = (DWORDLONG)0;
- value.B = (DWORDLONG)result;
+ value.B = (DWORDLONG)result;
GetAddressOfPInvokeFixup->Add((DWORDLONG)method, value);
}
@@ -4960,17 +5117,17 @@ void MethodContext::dmpGetAddressOfPInvokeFixup(DWORDLONG key, DLDL value)
{
printf("GetAddressOfPInvokeFixup key ftn-%016llX, value pp-%016llX res-%016llX", key, value.A, value.B);
}
-void* MethodContext::repGetAddressOfPInvokeFixup(CORINFO_METHOD_HANDLE method, void **ppIndirection)
+void* MethodContext::repGetAddressOfPInvokeFixup(CORINFO_METHOD_HANDLE method, void** ppIndirection)
{
DLDL value;
value = GetAddressOfPInvokeFixup->Get((DWORDLONG)method);
if (ppIndirection != nullptr)
- *ppIndirection = (void *)value.A;
+ *ppIndirection = (void*)value.A;
return (void*)value.B;
}
-void MethodContext::recGetAddressOfPInvokeTarget(CORINFO_METHOD_HANDLE method, CORINFO_CONST_LOOKUP *pLookup)
+void MethodContext::recGetAddressOfPInvokeTarget(CORINFO_METHOD_HANDLE method, CORINFO_CONST_LOOKUP* pLookup)
{
if (GetAddressOfPInvokeTarget == nullptr)
GetAddressOfPInvokeTarget = new LightWeightMap<DWORDLONG, DLD>();
@@ -4986,15 +5143,14 @@ void MethodContext::dmpGetAddressOfPInvokeTarget(DWORDLONG key, DLD value)
{
printf("GetAddressOfPInvokeTarget key ftn-%016llX, value addr-%016llX at-%u", key, value.A, value.B);
}
-void MethodContext::repGetAddressOfPInvokeTarget(CORINFO_METHOD_HANDLE method, CORINFO_CONST_LOOKUP *pLookup)
+void MethodContext::repGetAddressOfPInvokeTarget(CORINFO_METHOD_HANDLE method, CORINFO_CONST_LOOKUP* pLookup)
{
DLD value = GetAddressOfPInvokeTarget->Get((DWORDLONG)method);
- pLookup->addr = (void *)value.A;
+ pLookup->addr = (void*)value.A;
pLookup->accessType = (InfoAccessType)value.B;
}
-
void MethodContext::recSatisfiesClassConstraints(CORINFO_CLASS_HANDLE cls, BOOL result)
{
if (SatisfiesClassConstraints == nullptr)
@@ -5017,7 +5173,7 @@ void MethodContext::recGetMethodHash(CORINFO_METHOD_HANDLE ftn, unsigned result)
GetMethodHash = new LightWeightMap<DWORDLONG, DWORD>();
GetMethodHash->Add((DWORDLONG)ftn, (DWORD)result);
- DEBUG_REC(dmpGetMethodHash((DWORDLONG)ftn, (DWORD) result));
+ DEBUG_REC(dmpGetMethodHash((DWORDLONG)ftn, (DWORD)result));
}
void MethodContext::dmpGetMethodHash(DWORDLONG key, DWORD value)
{
@@ -5027,69 +5183,78 @@ unsigned MethodContext::repGetMethodHash(CORINFO_METHOD_HANDLE ftn)
{
unsigned result = 0x43;
if (GetMethodHash != nullptr)
- if (GetMethodHash->GetIndex((DWORDLONG)ftn) >= 0)
- result = GetMethodHash->Get((DWORDLONG)ftn);
- DEBUG_REP(dmpGetMethodHash((DWORDLONG)ftn, (DWORD) result));
+ if (GetMethodHash->GetIndex((DWORDLONG)ftn) >= 0)
+ result = GetMethodHash->Get((DWORDLONG)ftn);
+ DEBUG_REP(dmpGetMethodHash((DWORDLONG)ftn, (DWORD)result));
return result;
}
-void MethodContext::recCanTailCall(CORINFO_METHOD_HANDLE callerHnd, CORINFO_METHOD_HANDLE declaredCalleeHnd,
- CORINFO_METHOD_HANDLE exactCalleeHnd, bool fIsTailPrefix, bool result)
+void MethodContext::recCanTailCall(CORINFO_METHOD_HANDLE callerHnd,
+ CORINFO_METHOD_HANDLE declaredCalleeHnd,
+ CORINFO_METHOD_HANDLE exactCalleeHnd,
+ bool fIsTailPrefix,
+ bool result)
{
if (CanTailCall == nullptr)
CanTailCall = new LightWeightMap<Agnostic_CanTailCall, DWORD>();
Agnostic_CanTailCall key;
- ZeroMemory(&key, sizeof(Agnostic_CanTailCall)); //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_CanTailCall)); // We use the input structs as a key and use memcmp to compare.. so
+ // we need to zero out padding too
- key.callerHnd = (DWORDLONG)callerHnd;
+ key.callerHnd = (DWORDLONG)callerHnd;
key.declaredCalleeHnd = (DWORDLONG)declaredCalleeHnd;
- key.exactCalleeHnd = (DWORDLONG)exactCalleeHnd;
- key.fIsTailPrefix = (DWORD)fIsTailPrefix;
+ key.exactCalleeHnd = (DWORDLONG)exactCalleeHnd;
+ key.fIsTailPrefix = (DWORD)fIsTailPrefix;
CanTailCall->Add(key, (DWORD)result);
- DEBUG_REC(dmpCanTailCall(key,(DWORD)result));
+ DEBUG_REC(dmpCanTailCall(key, (DWORD)result));
}
void MethodContext::dmpCanTailCall(const Agnostic_CanTailCall& key, DWORD value)
{
- printf("CanTailCall key clr-%016llX dcle-%016llX ecle-%016llX pfx-%u, value res-%u",
- key.callerHnd,
- key.declaredCalleeHnd,
- key.exactCalleeHnd,
- key.fIsTailPrefix,
- value);
+ printf("CanTailCall key clr-%016llX dcle-%016llX ecle-%016llX pfx-%u, value res-%u", key.callerHnd,
+ key.declaredCalleeHnd, key.exactCalleeHnd, key.fIsTailPrefix, value);
}
-bool MethodContext::repCanTailCall(CORINFO_METHOD_HANDLE callerHnd, CORINFO_METHOD_HANDLE declaredCalleeHnd, CORINFO_METHOD_HANDLE exactCalleeHnd,
- bool fIsTailPrefix)
+bool MethodContext::repCanTailCall(CORINFO_METHOD_HANDLE callerHnd,
+ CORINFO_METHOD_HANDLE declaredCalleeHnd,
+ CORINFO_METHOD_HANDLE exactCalleeHnd,
+ bool fIsTailPrefix)
{
Agnostic_CanTailCall key;
- ZeroMemory(&key, sizeof(Agnostic_CanTailCall)); //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_CanTailCall)); // We use the input structs as a key and use memcmp to compare.. so
+ // we need to zero out padding too
- key.callerHnd = (DWORDLONG)callerHnd;
+ key.callerHnd = (DWORDLONG)callerHnd;
key.declaredCalleeHnd = (DWORDLONG)declaredCalleeHnd;
- key.exactCalleeHnd = (DWORDLONG)exactCalleeHnd;
- key.fIsTailPrefix = (DWORD)fIsTailPrefix;
+ key.exactCalleeHnd = (DWORDLONG)exactCalleeHnd;
+ key.fIsTailPrefix = (DWORD)fIsTailPrefix;
- AssertCodeMsg(CanTailCall != nullptr, EXCEPTIONCODE_MC, "Didn't find anything for %016llX", (DWORDLONG)key.callerHnd);
+ AssertCodeMsg(CanTailCall != nullptr, EXCEPTIONCODE_MC, "Didn't find anything for %016llX",
+ (DWORDLONG)key.callerHnd);
AssertCodeMsg(CanTailCall->GetIndex(key) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX", (DWORDLONG)key.callerHnd);
bool temp = CanTailCall->Get(key) != 0;
- DEBUG_REP(dmpCanTailCall(key,(DWORD)temp));
+ DEBUG_REP(dmpCanTailCall(key, (DWORD)temp));
return temp;
}
-void MethodContext::recIsCompatibleDelegate(CORINFO_CLASS_HANDLE objCls, CORINFO_CLASS_HANDLE methodParentCls,
- CORINFO_METHOD_HANDLE method, CORINFO_CLASS_HANDLE delegateCls, BOOL *pfIsOpenDelegate, BOOL result)
+void MethodContext::recIsCompatibleDelegate(CORINFO_CLASS_HANDLE objCls,
+ CORINFO_CLASS_HANDLE methodParentCls,
+ CORINFO_METHOD_HANDLE method,
+ CORINFO_CLASS_HANDLE delegateCls,
+ BOOL* pfIsOpenDelegate,
+ BOOL result)
{
if (IsCompatibleDelegate == nullptr)
IsCompatibleDelegate = new LightWeightMap<Agnostic_IsCompatibleDelegate, DD>();
Agnostic_IsCompatibleDelegate key;
- ZeroMemory(&key, sizeof(Agnostic_IsCompatibleDelegate)); //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_IsCompatibleDelegate)); // We use the input structs as a key and use memcmp to
+ // compare.. so we need to zero out padding too
DD value;
- key.objCls = (DWORDLONG)objCls;
+ key.objCls = (DWORDLONG)objCls;
key.methodParentCls = (DWORDLONG)methodParentCls;
- key.method = (DWORDLONG)method;
- key.delegateCls = (DWORDLONG)delegateCls;
+ key.method = (DWORDLONG)method;
+ key.delegateCls = (DWORDLONG)delegateCls;
value.A = (DWORD)*pfIsOpenDelegate;
value.B = (DWORD)result;
@@ -5098,20 +5263,25 @@ void MethodContext::recIsCompatibleDelegate(CORINFO_CLASS_HANDLE objCls, CORINFO
}
void MethodContext::dmpIsCompatibleDelegate(const Agnostic_IsCompatibleDelegate& key, DD value)
{
- printf("IsCompatibleDelegate key objCls-%016llX methodParentCls-%016llX method-%016llX delegateCls-%016llX, value pfIsOpenDelegate-%08X result-%08X",
- key.objCls, key.methodParentCls, key.method, key.delegateCls, value.A, value.B);
+ printf("IsCompatibleDelegate key objCls-%016llX methodParentCls-%016llX method-%016llX delegateCls-%016llX, value "
+ "pfIsOpenDelegate-%08X result-%08X",
+ key.objCls, key.methodParentCls, key.method, key.delegateCls, value.A, value.B);
}
-BOOL MethodContext::repIsCompatibleDelegate(CORINFO_CLASS_HANDLE objCls, CORINFO_CLASS_HANDLE methodParentCls,
- CORINFO_METHOD_HANDLE method, CORINFO_CLASS_HANDLE delegateCls, BOOL *pfIsOpenDelegate)
+BOOL MethodContext::repIsCompatibleDelegate(CORINFO_CLASS_HANDLE objCls,
+ CORINFO_CLASS_HANDLE methodParentCls,
+ CORINFO_METHOD_HANDLE method,
+ CORINFO_CLASS_HANDLE delegateCls,
+ BOOL* pfIsOpenDelegate)
{
Agnostic_IsCompatibleDelegate key;
- ZeroMemory(&key, sizeof(Agnostic_IsCompatibleDelegate)); //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_IsCompatibleDelegate)); // We use the input structs as a key and use memcmp to
+ // compare.. so we need to zero out padding too
DD value;
- key.objCls = (DWORDLONG)objCls;
+ key.objCls = (DWORDLONG)objCls;
key.methodParentCls = (DWORDLONG)methodParentCls;
- key.method = (DWORDLONG)method;
- key.delegateCls = (DWORDLONG)delegateCls;
+ key.method = (DWORDLONG)method;
+ key.delegateCls = (DWORDLONG)delegateCls;
value = IsCompatibleDelegate->Get(key);
@@ -5119,7 +5289,9 @@ BOOL MethodContext::repIsCompatibleDelegate(CORINFO_CLASS_HANDLE objCls, CORINFO
return (BOOL)value.B;
}
-void MethodContext::recIsDelegateCreationAllowed(CORINFO_CLASS_HANDLE delegateHnd, CORINFO_METHOD_HANDLE calleeHnd, BOOL result)
+void MethodContext::recIsDelegateCreationAllowed(CORINFO_CLASS_HANDLE delegateHnd,
+ CORINFO_METHOD_HANDLE calleeHnd,
+ BOOL result)
{
if (IsDelegateCreationAllowed == nullptr)
IsDelegateCreationAllowed = new LightWeightMap<DLDL, DWORD>();
@@ -5137,8 +5309,7 @@ void MethodContext::recIsDelegateCreationAllowed(CORINFO_CLASS_HANDLE delegateHn
}
void MethodContext::dmpIsDelegateCreationAllowed(DLDL key, DWORD value)
{
- printf("IsDelegateCreationAllowed key delegateHnd-%016llX calleeHnd-%016llX result-%08X",
- key.A, key.B, value);
+ printf("IsDelegateCreationAllowed key delegateHnd-%016llX calleeHnd-%016llX result-%08X", key.A, key.B, value);
}
BOOL MethodContext::repIsDelegateCreationAllowed(CORINFO_CLASS_HANDLE delegateHnd, CORINFO_METHOD_HANDLE calleeHnd)
{
@@ -5154,19 +5325,22 @@ BOOL MethodContext::repIsDelegateCreationAllowed(CORINFO_CLASS_HANDLE delegateHn
return (BOOL)value;
}
-void MethodContext::recCanSkipMethodVerification(CORINFO_METHOD_HANDLE ftnHandle, BOOL skip, CorInfoCanSkipVerificationResult result)
+void MethodContext::recCanSkipMethodVerification(CORINFO_METHOD_HANDLE ftnHandle,
+ BOOL skip,
+ CorInfoCanSkipVerificationResult result)
{
if (CanSkipMethodVerification == nullptr)
CanSkipMethodVerification = new LightWeightMap<DLD, DWORD>();
DLD key;
- ZeroMemory(&key, sizeof(DLD)); //We use the input structs as a key and use memcmp to compare.. so we need to zero out padding too
+ ZeroMemory(&key, sizeof(DLD)); // We use the input structs as a key and use memcmp to compare.. so we need to zero
+ // out padding too
key.A = (DWORDLONG)ftnHandle;
key.B = (DWORD)skip;
CanSkipMethodVerification->Add(key, (DWORD)result);
- DEBUG_REC(dmpCanSkipMethodVerification(key,(DWORD)result));
+ DEBUG_REC(dmpCanSkipMethodVerification(key, (DWORD)result));
}
void MethodContext::dmpCanSkipMethodVerification(DLD key, DWORD value)
{
@@ -5175,80 +5349,82 @@ void MethodContext::dmpCanSkipMethodVerification(DLD key, DWORD value)
CorInfoCanSkipVerificationResult MethodContext::repCanSkipMethodVerification(CORINFO_METHOD_HANDLE ftnHandle, BOOL skip)
{
DLD key;
- ZeroMemory(&key, sizeof(DLD)); //We use the input structs as a key and use memcmp to compare.. so we need to zero out padding too
+ ZeroMemory(&key, sizeof(DLD)); // We use the input structs as a key and use memcmp to compare.. so we need to zero
+ // out padding too
key.A = (DWORDLONG)ftnHandle;
key.B = (DWORD)skip;
- AssertCodeMsg(CanSkipMethodVerification != nullptr, EXCEPTIONCODE_MC, "Didn't find anything for %016llX", (DWORDLONG)ftnHandle);
- AssertCodeMsg(CanSkipMethodVerification->GetIndex(key) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX", (DWORDLONG)ftnHandle);
+ AssertCodeMsg(CanSkipMethodVerification != nullptr, EXCEPTIONCODE_MC, "Didn't find anything for %016llX",
+ (DWORDLONG)ftnHandle);
+ AssertCodeMsg(CanSkipMethodVerification->GetIndex(key) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX",
+ (DWORDLONG)ftnHandle);
CorInfoCanSkipVerificationResult temp = (CorInfoCanSkipVerificationResult)CanSkipMethodVerification->Get(key);
- DEBUG_REP(dmpCanSkipMethodVerification(key,(DWORD)temp));
+ DEBUG_REP(dmpCanSkipMethodVerification(key, (DWORD)temp));
return temp;
}
-void MethodContext::recFindCallSiteSig(CORINFO_MODULE_HANDLE module, unsigned methTOK, CORINFO_CONTEXT_HANDLE context, CORINFO_SIG_INFO *sig)
+void MethodContext::recFindCallSiteSig(CORINFO_MODULE_HANDLE module,
+ unsigned methTOK,
+ CORINFO_CONTEXT_HANDLE context,
+ CORINFO_SIG_INFO* sig)
{
if (FindCallSiteSig == nullptr)
FindCallSiteSig = new LightWeightMap<Agnostic_FindCallSiteSig, Agnostic_CORINFO_SIG_INFO>();
Agnostic_FindCallSiteSig key;
- ZeroMemory(&key, sizeof(Agnostic_FindCallSiteSig)); //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_FindCallSiteSig)); // We use the input structs as a key and use memcmp to compare..
+ // so we need to zero out padding too
Agnostic_CORINFO_SIG_INFO value;
- key.module = (DWORDLONG)module;
+ key.module = (DWORDLONG)module;
key.methTok = (DWORD)methTOK;
key.context = (DWORDLONG)context;
- value.callConv = (DWORD)sig->callConv;
- value.retTypeClass = (DWORDLONG)sig->retTypeClass;
- value.retTypeSigClass = (DWORDLONG)sig->retTypeSigClass;
- value.retType = (DWORD)sig->retType;
- value.flags = (DWORD)sig->flags;
- value.numArgs = (DWORD)sig->numArgs;
- value.sigInst_classInstCount = (DWORD)sig->sigInst.classInstCount;
- value.sigInst_classInst_Index = FindCallSiteSig->AddBuffer((unsigned char*)sig->sigInst.classInst, sig->sigInst.classInstCount * 8); //porting issue
- value.sigInst_methInstCount = (DWORD)sig->sigInst.methInstCount;
- value.sigInst_methInst_Index = FindCallSiteSig->AddBuffer((unsigned char*)sig->sigInst.methInst, sig->sigInst.methInstCount * 8); //porting issue
- value.args = (DWORDLONG)sig->args;
+ value.callConv = (DWORD)sig->callConv;
+ value.retTypeClass = (DWORDLONG)sig->retTypeClass;
+ value.retTypeSigClass = (DWORDLONG)sig->retTypeSigClass;
+ value.retType = (DWORD)sig->retType;
+ value.flags = (DWORD)sig->flags;
+ value.numArgs = (DWORD)sig->numArgs;
+ value.sigInst_classInstCount = (DWORD)sig->sigInst.classInstCount;
+ value.sigInst_classInst_Index = FindCallSiteSig->AddBuffer((unsigned char*)sig->sigInst.classInst,
+ sig->sigInst.classInstCount * 8); // porting issue
+ value.sigInst_methInstCount = (DWORD)sig->sigInst.methInstCount;
+ value.sigInst_methInst_Index = FindCallSiteSig->AddBuffer((unsigned char*)sig->sigInst.methInst,
+ sig->sigInst.methInstCount * 8); // porting issue
+ value.args = (DWORDLONG)sig->args;
value.cbSig = (DWORD)sig->cbSig;
- value.pSig = (DWORD)FindCallSiteSig->AddBuffer((unsigned char *)sig->pSig, sig->cbSig);
+ value.pSig = (DWORD)FindCallSiteSig->AddBuffer((unsigned char*)sig->pSig, sig->cbSig);
value.scope = (DWORDLONG)sig->scope;
value.token = (DWORD)sig->token;
FindCallSiteSig->Add(key, value);
- DEBUG_REC(dmpFindCallSiteSig(key,value));
+ DEBUG_REC(dmpFindCallSiteSig(key, value));
}
void MethodContext::dmpFindCallSiteSig(const Agnostic_FindCallSiteSig& key, const Agnostic_CORINFO_SIG_INFO& value)
{
printf("dmpFindCallSiteSig key module-%016llX methTok-%08X context-%016llX", key.module, key.methTok, key.context);
- printf(", value callConv-%08X retTypeClass-%016llX retTypeSigClass-%016llX retType-%u(%s) flags-%08X numArgs-%08X classInstCount-%08X classInd-%08X "
+ printf(", value callConv-%08X retTypeClass-%016llX retTypeSigClass-%016llX retType-%u(%s) flags-%08X numArgs-%08X "
+ "classInstCount-%08X classInd-%08X "
"methInstCount-%08X methInd-%08X args-%016llX cbSig-%08X pSig-%08X scope-%016llX token-%08X",
- value.callConv,
- value.retTypeClass,
- value.retTypeSigClass,
- value.retType,
- toString((CorInfoType)value.retType),
- value.flags,
- value.numArgs,
- value.sigInst_classInstCount,
- value.sigInst_classInst_Index,
- value.sigInst_methInstCount,
- value.sigInst_methInst_Index,
- value.args,
- value.cbSig,
- value.pSig,
- value.scope,
- value.token);
-}
-void MethodContext::repFindCallSiteSig(CORINFO_MODULE_HANDLE module, unsigned methTOK, CORINFO_CONTEXT_HANDLE context, CORINFO_SIG_INFO *sig)
+ value.callConv, value.retTypeClass, value.retTypeSigClass, value.retType,
+ toString((CorInfoType)value.retType), value.flags, value.numArgs, value.sigInst_classInstCount,
+ value.sigInst_classInst_Index, value.sigInst_methInstCount, value.sigInst_methInst_Index, value.args,
+ value.cbSig, value.pSig, value.scope, value.token);
+}
+void MethodContext::repFindCallSiteSig(CORINFO_MODULE_HANDLE module,
+ unsigned methTOK,
+ CORINFO_CONTEXT_HANDLE context,
+ CORINFO_SIG_INFO* sig)
{
Agnostic_FindCallSiteSig key;
- ZeroMemory(&key, sizeof(Agnostic_FindCallSiteSig)); //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_FindCallSiteSig)); // We use the input structs as a key and use memcmp to compare..
+ // so we need to zero out padding too
Agnostic_CORINFO_SIG_INFO value;
- key.module = (DWORDLONG)module;
+ key.module = (DWORDLONG)module;
key.methTok = (DWORD)methTOK;
key.context = (DWORDLONG)context;
@@ -5256,22 +5432,22 @@ void MethodContext::repFindCallSiteSig(CORINFO_MODULE_HANDLE module, unsigned me
AssertCodeMsg(FindCallSiteSig->GetIndex(key) != -1, EXCEPTIONCODE_MC, "Didn't find %08X", (DWORD)key.methTok);
value = FindCallSiteSig->Get(key);
- sig->callConv = (CorInfoCallConv)value.callConv;
- sig->retTypeClass = (CORINFO_CLASS_HANDLE)value.retTypeClass;
- sig->retTypeSigClass = (CORINFO_CLASS_HANDLE)value.retTypeSigClass;
- sig->retType = (CorInfoType)value.retType;
- sig->flags = (unsigned)value.flags;
- sig->numArgs = (unsigned)value.numArgs;
+ sig->callConv = (CorInfoCallConv)value.callConv;
+ sig->retTypeClass = (CORINFO_CLASS_HANDLE)value.retTypeClass;
+ sig->retTypeSigClass = (CORINFO_CLASS_HANDLE)value.retTypeSigClass;
+ sig->retType = (CorInfoType)value.retType;
+ sig->flags = (unsigned)value.flags;
+ sig->numArgs = (unsigned)value.numArgs;
sig->sigInst.classInstCount = (unsigned)value.sigInst_classInstCount;
- sig->sigInst.classInst = (CORINFO_CLASS_HANDLE*)FindCallSiteSig->GetBuffer(value.sigInst_classInst_Index);
- sig->sigInst.methInstCount = (unsigned)value.sigInst_methInstCount;
- sig->sigInst.methInst = (CORINFO_CLASS_HANDLE*)FindCallSiteSig->GetBuffer(value.sigInst_methInst_Index);
- sig->args = (CORINFO_ARG_LIST_HANDLE)value.args;
- sig->cbSig = (unsigned int)value.cbSig;
- sig->pSig = (PCCOR_SIGNATURE)FindCallSiteSig->GetBuffer(value.pSig);
- sig->scope = (CORINFO_MODULE_HANDLE)value.scope;
- sig->token = (mdToken)value.token;
- DEBUG_REP(dmpFindCallSiteSig(key,value));
+ sig->sigInst.classInst = (CORINFO_CLASS_HANDLE*)FindCallSiteSig->GetBuffer(value.sigInst_classInst_Index);
+ sig->sigInst.methInstCount = (unsigned)value.sigInst_methInstCount;
+ sig->sigInst.methInst = (CORINFO_CLASS_HANDLE*)FindCallSiteSig->GetBuffer(value.sigInst_methInst_Index);
+ sig->args = (CORINFO_ARG_LIST_HANDLE)value.args;
+ sig->cbSig = (unsigned int)value.cbSig;
+ sig->pSig = (PCCOR_SIGNATURE)FindCallSiteSig->GetBuffer(value.pSig);
+ sig->scope = (CORINFO_MODULE_HANDLE)value.scope;
+ sig->token = (mdToken)value.token;
+ DEBUG_REP(dmpFindCallSiteSig(key, value));
}
void MethodContext::recShouldEnforceCallvirtRestriction(CORINFO_MODULE_HANDLE scope, BOOL result)
@@ -5287,14 +5463,16 @@ void MethodContext::dmpShouldEnforceCallvirtRestriction(DWORDLONG key, DWORD val
}
BOOL MethodContext::repShouldEnforceCallvirtRestriction(CORINFO_MODULE_HANDLE scope)
{
- AssertCodeMsg(ShouldEnforceCallvirtRestriction != nullptr, EXCEPTIONCODE_MC, "Didn't find anything for %016llX", (DWORDLONG)scope);
- AssertCodeMsg(ShouldEnforceCallvirtRestriction->GetIndex((DWORDLONG)scope) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX", (DWORDLONG)scope);
+ AssertCodeMsg(ShouldEnforceCallvirtRestriction != nullptr, EXCEPTIONCODE_MC, "Didn't find anything for %016llX",
+ (DWORDLONG)scope);
+ AssertCodeMsg(ShouldEnforceCallvirtRestriction->GetIndex((DWORDLONG)scope) != -1, EXCEPTIONCODE_MC,
+ "Didn't find %016llX", (DWORDLONG)scope);
BOOL temp = (BOOL)ShouldEnforceCallvirtRestriction->Get((DWORDLONG)scope);
DEBUG_REC(dmpShouldEnforceCallvirtRestriction((DWORDLONG)scope, (DWORD)temp));
return temp;
}
-void MethodContext::recGetMethodSync(CORINFO_METHOD_HANDLE ftn, void **ppIndirection, void* result)
+void MethodContext::recGetMethodSync(CORINFO_METHOD_HANDLE ftn, void** ppIndirection, void* result)
{
if (GetMethodSync == nullptr)
GetMethodSync = new LightWeightMap<DWORDLONG, DLDL>();
@@ -5303,7 +5481,7 @@ void MethodContext::recGetMethodSync(CORINFO_METHOD_HANDLE ftn, void **ppIndirec
value.A = (DWORDLONG)*ppIndirection;
else
value.A = (DWORDLONG)0;
- value.B = (DWORDLONG)result;
+ value.B = (DWORDLONG)result;
GetMethodSync->Add((DWORDLONG)ftn, value);
}
@@ -5311,113 +5489,113 @@ void MethodContext::dmpGetMethodSync(DWORDLONG key, DLDL value)
{
printf("GetMethodSync key %016llX, value pp-%016llX res-%016llX", key, value.A, value.B);
}
-void* MethodContext::repGetMethodSync(CORINFO_METHOD_HANDLE ftn, void **ppIndirection)
+void* MethodContext::repGetMethodSync(CORINFO_METHOD_HANDLE ftn, void** ppIndirection)
{
DLDL value;
value = (DLDL)GetMethodSync->Get((DWORDLONG)ftn);
if (ppIndirection != nullptr)
- *ppIndirection = (void *)value.A;
+ *ppIndirection = (void*)value.A;
return (void*)value.B;
}
-void MethodContext::recGetVarArgsHandle(CORINFO_SIG_INFO *pSig, void **ppIndirection, CORINFO_VARARGS_HANDLE result)
+void MethodContext::recGetVarArgsHandle(CORINFO_SIG_INFO* pSig, void** ppIndirection, CORINFO_VARARGS_HANDLE result)
{
if (GetVarArgsHandle == nullptr)
GetVarArgsHandle = new LightWeightMap<Agnostic_CORINFO_SIG_INFO, DLDL>();
Agnostic_CORINFO_SIG_INFO key;
- ZeroMemory(&key, sizeof(Agnostic_CORINFO_SIG_INFO)); //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_SIG_INFO)); // We use the input structs as a key and use memcmp to
+ // compare.. so we need to zero out padding too
DLDL value;
- key.callConv = (DWORD)0;
- key.retTypeClass = (DWORDLONG)0;
- key.retTypeSigClass = (DWORDLONG)0;
- key.retType = (DWORD)0;
- key.flags = (DWORD)0;
- key.numArgs = (DWORD)0;
- key.sigInst_classInstCount = (DWORD)0;
+ key.callConv = (DWORD)0;
+ key.retTypeClass = (DWORDLONG)0;
+ key.retTypeSigClass = (DWORDLONG)0;
+ key.retType = (DWORD)0;
+ key.flags = (DWORD)0;
+ key.numArgs = (DWORD)0;
+ key.sigInst_classInstCount = (DWORD)0;
key.sigInst_classInst_Index = (DWORD)0;
- key.sigInst_methInstCount = (DWORD)0;
- key.sigInst_methInst_Index = (DWORD)0;
- key.args = (DWORDLONG)0;
- key.cbSig = (DWORD)pSig->cbSig;
- key.pSig = (DWORD)GetVarArgsHandle->AddBuffer((unsigned char *)pSig->pSig, pSig->cbSig);
- key.scope = (DWORDLONG)pSig->scope;
- key.token = (DWORD)pSig->token;
+ key.sigInst_methInstCount = (DWORD)0;
+ key.sigInst_methInst_Index = (DWORD)0;
+ key.args = (DWORDLONG)0;
+ key.cbSig = (DWORD)pSig->cbSig;
+ key.pSig = (DWORD)GetVarArgsHandle->AddBuffer((unsigned char*)pSig->pSig, pSig->cbSig);
+ key.scope = (DWORDLONG)pSig->scope;
+ key.token = (DWORD)pSig->token;
if (ppIndirection != nullptr)
value.A = (DWORDLONG)*ppIndirection;
else
value.A = (DWORDLONG)0;
- value.B = (DWORDLONG)result;
+ value.B = (DWORDLONG)result;
GetVarArgsHandle->Add(key, value);
}
void MethodContext::dmpGetVarArgsHandle(const Agnostic_CORINFO_SIG_INFO& key, DLDL value)
{
- printf("GetVarArgsHandle key cbSig-%08X pSig-%08X scope-%016llX token-%08X",
- key.cbSig,
- key.pSig,
- key.scope,
- key.token);
+ printf("GetVarArgsHandle key cbSig-%08X pSig-%08X scope-%016llX token-%08X", key.cbSig, key.pSig, key.scope,
+ key.token);
printf(", value ppIndirection-%016llX result-%016llX", value.A, value.B);
}
-CORINFO_VARARGS_HANDLE MethodContext::repGetVarArgsHandle(CORINFO_SIG_INFO *pSig, void **ppIndirection)
+CORINFO_VARARGS_HANDLE MethodContext::repGetVarArgsHandle(CORINFO_SIG_INFO* pSig, void** ppIndirection)
{
Agnostic_CORINFO_SIG_INFO key;
- ZeroMemory(&key, sizeof(Agnostic_CORINFO_SIG_INFO)); //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_SIG_INFO)); // We use the input structs as a key and use memcmp to
+ // compare.. so we need to zero out padding too
DLDL value;
- key.callConv = (DWORD)0;
- key.retTypeClass = (DWORDLONG)0;
- key.retTypeSigClass = (DWORDLONG)0;
- key.retType = (DWORD)0;
- key.flags = (DWORD)0;
- key.numArgs = (DWORD)0;
- key.sigInst_classInstCount = (DWORD)0;
+ key.callConv = (DWORD)0;
+ key.retTypeClass = (DWORDLONG)0;
+ key.retTypeSigClass = (DWORDLONG)0;
+ key.retType = (DWORD)0;
+ key.flags = (DWORD)0;
+ key.numArgs = (DWORD)0;
+ key.sigInst_classInstCount = (DWORD)0;
key.sigInst_classInst_Index = (DWORD)0;
- key.sigInst_methInstCount = (DWORD)0;
- key.sigInst_methInst_Index = (DWORD)0;
- key.args = (DWORDLONG)0;
- key.cbSig = (DWORD)pSig->cbSig;
- key.pSig = (DWORD)GetVarArgsHandle->Contains((unsigned char *)pSig->pSig, pSig->cbSig);
- key.scope = (DWORDLONG)pSig->scope;
- key.token = (DWORD)pSig->token;
+ key.sigInst_methInstCount = (DWORD)0;
+ key.sigInst_methInst_Index = (DWORD)0;
+ key.args = (DWORDLONG)0;
+ key.cbSig = (DWORD)pSig->cbSig;
+ key.pSig = (DWORD)GetVarArgsHandle->Contains((unsigned char*)pSig->pSig, pSig->cbSig);
+ key.scope = (DWORDLONG)pSig->scope;
+ key.token = (DWORD)pSig->token;
value = (DLDL)GetVarArgsHandle->Get(key);
if (ppIndirection != nullptr)
- *ppIndirection = (void *)value.A;
+ *ppIndirection = (void*)value.A;
return (CORINFO_VARARGS_HANDLE)value.B;
}
-void MethodContext::recCanGetVarArgsHandle(CORINFO_SIG_INFO *pSig, bool result)
+void MethodContext::recCanGetVarArgsHandle(CORINFO_SIG_INFO* pSig, bool result)
{
if (CanGetVarArgsHandle == nullptr)
CanGetVarArgsHandle = new LightWeightMap<Agnostic_CORINFO_SIG_INFO, DWORD>();
Agnostic_CORINFO_SIG_INFO key;
- ZeroMemory(&key, sizeof(Agnostic_CORINFO_SIG_INFO)); //We use the input structs as a key and use memcmp to compare.. so we need to zero out padding too
-
- key.callConv = (DWORD)0;
- key.retTypeClass = (DWORDLONG)0;
- key.retTypeSigClass = (DWORDLONG)0;
- key.retType = (DWORD)0;
- key.flags = (DWORD)0;
- key.numArgs = (DWORD)0;
- key.sigInst_classInstCount = (DWORD)0;
+ ZeroMemory(&key, sizeof(Agnostic_CORINFO_SIG_INFO)); // We use the input structs as a key and use memcmp to
+ // compare.. so we need to zero out padding too
+
+ key.callConv = (DWORD)0;
+ key.retTypeClass = (DWORDLONG)0;
+ key.retTypeSigClass = (DWORDLONG)0;
+ key.retType = (DWORD)0;
+ key.flags = (DWORD)0;
+ key.numArgs = (DWORD)0;
+ key.sigInst_classInstCount = (DWORD)0;
key.sigInst_classInst_Index = (DWORD)0;
- key.sigInst_methInstCount = (DWORD)0;
- key.sigInst_methInst_Index = (DWORD)0;
- key.args = (DWORDLONG)0;
- key.cbSig = (DWORD)0;
- key.pSig = (DWORD)0;
- key.scope = (DWORDLONG)pSig->scope;
- key.token = (DWORD)pSig->token;
+ key.sigInst_methInstCount = (DWORD)0;
+ key.sigInst_methInst_Index = (DWORD)0;
+ key.args = (DWORDLONG)0;
+ key.cbSig = (DWORD)0;
+ key.pSig = (DWORD)0;
+ key.scope = (DWORDLONG)pSig->scope;
+ key.token = (DWORD)pSig->token;
CanGetVarArgsHandle->Add(key, (DWORD)result);
DEBUG_REC(dmpCanGetVarArgsHandle(key, (DWORD)result));
@@ -5426,38 +5604,42 @@ void MethodContext::dmpCanGetVarArgsHandle(const Agnostic_CORINFO_SIG_INFO& key,
{
printf("CanGetVarArgsHandle key scope-%016llX token-%08X, value result-%08X", key.scope, key.token, value);
}
-bool MethodContext::repCanGetVarArgsHandle(CORINFO_SIG_INFO *pSig)
+bool MethodContext::repCanGetVarArgsHandle(CORINFO_SIG_INFO* pSig)
{
Agnostic_CORINFO_SIG_INFO key;
- ZeroMemory(&key, sizeof(Agnostic_CORINFO_SIG_INFO)); //We use the input structs as a key and use memcmp to compare.. so we need to zero out padding too
-
- key.callConv = (DWORD)0;
- key.retTypeClass = (DWORDLONG)0;
- key.retTypeSigClass = (DWORDLONG)0;
- key.retType = (DWORD)0;
- key.flags = (DWORD)0;
- key.numArgs = (DWORD)0;
- key.sigInst_classInstCount = (DWORD)0;
+ ZeroMemory(&key, sizeof(Agnostic_CORINFO_SIG_INFO)); // We use the input structs as a key and use memcmp to
+ // compare.. so we need to zero out padding too
+
+ key.callConv = (DWORD)0;
+ key.retTypeClass = (DWORDLONG)0;
+ key.retTypeSigClass = (DWORDLONG)0;
+ key.retType = (DWORD)0;
+ key.flags = (DWORD)0;
+ key.numArgs = (DWORD)0;
+ key.sigInst_classInstCount = (DWORD)0;
key.sigInst_classInst_Index = (DWORD)0;
- key.sigInst_methInstCount = (DWORD)0;
- key.sigInst_methInst_Index = (DWORD)0;
- key.args = (DWORDLONG)0;
- key.cbSig = (DWORD)0;
- key.pSig = (DWORD)0;
- key.scope = (DWORDLONG)pSig->scope;
- key.token = (DWORD)pSig->token;
-
- AssertCodeMsg(CanGetVarArgsHandle != nullptr, EXCEPTIONCODE_MC, "Didn't find anything for %016llX", (DWORDLONG)key.token);
- AssertCodeMsg(CanGetVarArgsHandle->GetIndex(key) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX", (DWORDLONG)key.token);
+ key.sigInst_methInstCount = (DWORD)0;
+ key.sigInst_methInst_Index = (DWORD)0;
+ key.args = (DWORDLONG)0;
+ key.cbSig = (DWORD)0;
+ key.pSig = (DWORD)0;
+ key.scope = (DWORDLONG)pSig->scope;
+ key.token = (DWORD)pSig->token;
+
+ AssertCodeMsg(CanGetVarArgsHandle != nullptr, EXCEPTIONCODE_MC, "Didn't find anything for %016llX",
+ (DWORDLONG)key.token);
+ AssertCodeMsg(CanGetVarArgsHandle->GetIndex(key) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX",
+ (DWORDLONG)key.token);
bool value = CanGetVarArgsHandle->Get(key) != 0;
DEBUG_REP(dmpCanGetVarArgsHandle(key, (DWORD)value));
return value;
}
-void MethodContext::recGetFieldThreadLocalStoreID(CORINFO_FIELD_HANDLE field, void **ppIndirection, DWORD result)
+void MethodContext::recGetFieldThreadLocalStoreID(CORINFO_FIELD_HANDLE field, void** ppIndirection, DWORD result)
{
if (GetFieldThreadLocalStoreID == nullptr)
- GetFieldThreadLocalStoreID = new LightWeightMap<DWORDLONG, DLD>();;
+ GetFieldThreadLocalStoreID = new LightWeightMap<DWORDLONG, DLD>();
+ ;
DLD value;
@@ -5465,25 +5647,29 @@ void MethodContext::recGetFieldThreadLocalStoreID(CORINFO_FIELD_HANDLE field, vo
value.A = (DWORDLONG)*ppIndirection;
else
value.A = (DWORDLONG)0;
- value.B = (DWORD)result;
+ value.B = (DWORD)result;
GetFieldThreadLocalStoreID->Add((DWORDLONG)field, value);
}
void MethodContext::dmpGetFieldThreadLocalStoreID(DWORDLONG key, DLD value)
{
- printf("GetFieldThreadLocalStoreID key field-%016llX, value ppIndirection-%016llX result-%08X", key, value.A, value.B);
+ printf("GetFieldThreadLocalStoreID key field-%016llX, value ppIndirection-%016llX result-%08X", key, value.A,
+ value.B);
}
-DWORD MethodContext::repGetFieldThreadLocalStoreID(CORINFO_FIELD_HANDLE field, void **ppIndirection)
+DWORD MethodContext::repGetFieldThreadLocalStoreID(CORINFO_FIELD_HANDLE field, void** ppIndirection)
{
DLD value;
value = (DLD)GetFieldThreadLocalStoreID->Get((DWORDLONG)field);
if (ppIndirection != nullptr)
- *ppIndirection = (void *)value.A;
+ *ppIndirection = (void*)value.A;
return (DWORD)value.B;
}
-void MethodContext::recGetBBProfileData(CORINFO_METHOD_HANDLE ftnHnd, ULONG *count, ICorJitInfo::ProfileBuffer **profileBuffer,
- ULONG *numRuns, HRESULT result)
+void MethodContext::recGetBBProfileData(CORINFO_METHOD_HANDLE ftnHnd,
+ ULONG* count,
+ ICorJitInfo::ProfileBuffer** profileBuffer,
+ ULONG* numRuns,
+ HRESULT result)
{
if (GetBBProfileData == nullptr)
GetBBProfileData = new LightWeightMap<DWORDLONG, Agnostic_GetBBProfileData>();
@@ -5491,16 +5677,18 @@ void MethodContext::recGetBBProfileData(CORINFO_METHOD_HANDLE ftnHnd, ULONG *cou
Agnostic_GetBBProfileData value;
value.count = (DWORD)*count;
- value.profileBuffer_index = GetBBProfileData->AddBuffer((unsigned char*)*profileBuffer, sizeof(ICorJitInfo::ProfileBuffer)*(*count));
+ value.profileBuffer_index =
+ GetBBProfileData->AddBuffer((unsigned char*)*profileBuffer, sizeof(ICorJitInfo::ProfileBuffer) * (*count));
value.numRuns = (DWORD)*numRuns;
- value.result = (DWORD)result;
+ value.result = (DWORD)result;
GetBBProfileData->Add((DWORDLONG)ftnHnd, value);
}
void MethodContext::dmpGetBBProfileData(DWORDLONG key, const Agnostic_GetBBProfileData& value)
{
printf("GetBBProfileData key ftn-%016llX, value cnt-%u profileBuf-", key, value.count);
- ICorJitInfo::ProfileBuffer* pBuf = (ICorJitInfo::ProfileBuffer *)GetBBProfileData->GetBuffer(value.profileBuffer_index);
+ ICorJitInfo::ProfileBuffer* pBuf =
+ (ICorJitInfo::ProfileBuffer*)GetBBProfileData->GetBuffer(value.profileBuffer_index);
for (DWORD i = 0; i < value.count; i++, pBuf++)
{
printf("{il-%u,cnt-%u}", pBuf->ILOffset, pBuf->ExecutionCount);
@@ -5508,16 +5696,18 @@ void MethodContext::dmpGetBBProfileData(DWORDLONG key, const Agnostic_GetBBProfi
GetBBProfileData->Unlock();
printf(" numRuns-%u result-%u", value.numRuns, value.result);
}
-HRESULT MethodContext::repGetBBProfileData(CORINFO_METHOD_HANDLE ftnHnd, ULONG *count, ICorJitInfo::ProfileBuffer **profileBuffer,
- ULONG *numRuns)
+HRESULT MethodContext::repGetBBProfileData(CORINFO_METHOD_HANDLE ftnHnd,
+ ULONG* count,
+ ICorJitInfo::ProfileBuffer** profileBuffer,
+ ULONG* numRuns)
{
Agnostic_GetBBProfileData tempValue;
tempValue = GetBBProfileData->Get((DWORDLONG)ftnHnd);
- *count = (ULONG)tempValue.count;
- *profileBuffer = (ICorJitInfo::ProfileBuffer *)GetBBProfileData->GetBuffer(tempValue.profileBuffer_index);
- *numRuns = (ULONG)tempValue.numRuns;
+ *count = (ULONG)tempValue.count;
+ *profileBuffer = (ICorJitInfo::ProfileBuffer*)GetBBProfileData->GetBuffer(tempValue.profileBuffer_index);
+ *numRuns = (ULONG)tempValue.numRuns;
HRESULT result = (HRESULT)tempValue.result;
return result;
}
@@ -5527,7 +5717,8 @@ void MethodContext::recMergeClasses(CORINFO_CLASS_HANDLE cls1, CORINFO_CLASS_HAN
if (MergeClasses == nullptr)
MergeClasses = new LightWeightMap<DLDL, DWORDLONG>();
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
key.A = (DWORDLONG)cls1;
key.B = (DWORDLONG)cls2;
@@ -5541,41 +5732,43 @@ void MethodContext::dmpMergeClasses(DLDL key, DWORDLONG value)
CORINFO_CLASS_HANDLE MethodContext::repMergeClasses(CORINFO_CLASS_HANDLE cls1, CORINFO_CLASS_HANDLE cls2)
{
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
DWORDLONG value;
key.A = (DWORDLONG)cls1;
key.B = (DWORDLONG)cls2;
- AssertCodeMsg(MergeClasses->GetIndex(key) != -1, EXCEPTIONCODE_MC,
- "Didn't find %016llX %016llX", (DWORDLONG)cls1, (DWORDLONG)cls2);
+ AssertCodeMsg(MergeClasses->GetIndex(key) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX %016llX", (DWORDLONG)cls1,
+ (DWORDLONG)cls2);
value = MergeClasses->Get(key);
return (CORINFO_CLASS_HANDLE)value;
}
-void MethodContext::recGetCookieForPInvokeCalliSig(CORINFO_SIG_INFO* szMetaSig, void ** ppIndirection, LPVOID result)
+void MethodContext::recGetCookieForPInvokeCalliSig(CORINFO_SIG_INFO* szMetaSig, void** ppIndirection, LPVOID result)
{
if (GetCookieForPInvokeCalliSig == nullptr)
GetCookieForPInvokeCalliSig = new LightWeightMap<Agnostic_CORINFO_SIG_INFO, DLDL>();
Agnostic_CORINFO_SIG_INFO key;
- ZeroMemory(&key, sizeof(Agnostic_CORINFO_SIG_INFO)); //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_SIG_INFO)); // We use the input structs as a key and use memcmp to
+ // compare.. so we need to zero out padding too
DLDL value;
- key.callConv = (DWORD)0;
- key.retTypeClass = (DWORDLONG)0;
- key.retTypeSigClass = (DWORDLONG)0;
- key.retType = (DWORD)0;
- key.flags = (DWORD)0;
- key.numArgs = (DWORD)0;
- key.sigInst_classInstCount = (DWORD)0;
+ key.callConv = (DWORD)0;
+ key.retTypeClass = (DWORDLONG)0;
+ key.retTypeSigClass = (DWORDLONG)0;
+ key.retType = (DWORD)0;
+ key.flags = (DWORD)0;
+ key.numArgs = (DWORD)0;
+ key.sigInst_classInstCount = (DWORD)0;
key.sigInst_classInst_Index = (DWORD)0;
- key.sigInst_methInstCount = (DWORD)0;
- key.sigInst_methInst_Index = (DWORD)0;
- key.args = (DWORDLONG)0;
- key.cbSig = (DWORD)szMetaSig->cbSig;
- key.pSig = (DWORD)GetCookieForPInvokeCalliSig->AddBuffer((unsigned char *)szMetaSig->pSig, szMetaSig->cbSig);
+ key.sigInst_methInstCount = (DWORD)0;
+ key.sigInst_methInst_Index = (DWORD)0;
+ key.args = (DWORDLONG)0;
+ key.cbSig = (DWORD)szMetaSig->cbSig;
+ key.pSig = (DWORD)GetCookieForPInvokeCalliSig->AddBuffer((unsigned char*)szMetaSig->pSig, szMetaSig->cbSig);
key.scope = (DWORDLONG)szMetaSig->scope;
key.token = (DWORD)szMetaSig->token;
@@ -5583,7 +5776,7 @@ void MethodContext::recGetCookieForPInvokeCalliSig(CORINFO_SIG_INFO* szMetaSig,
value.A = (DWORDLONG)*ppIndirection;
else
value.A = (DWORDLONG)0;
- value.B = (DWORDLONG)result;
+ value.B = (DWORDLONG)result;
GetCookieForPInvokeCalliSig->Add(key, value);
}
@@ -5591,32 +5784,33 @@ void MethodContext::dmpGetCookieForPInvokeCalliSig(const Agnostic_CORINFO_SIG_IN
{
printf("GetCookieForPInvokeCalliSig NYI");
}
-LPVOID MethodContext::repGetCookieForPInvokeCalliSig(CORINFO_SIG_INFO* szMetaSig, void ** ppIndirection)
+LPVOID MethodContext::repGetCookieForPInvokeCalliSig(CORINFO_SIG_INFO* szMetaSig, void** ppIndirection)
{
Agnostic_CORINFO_SIG_INFO key;
- ZeroMemory(&key, sizeof(Agnostic_CORINFO_SIG_INFO)); //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_SIG_INFO)); // We use the input structs as a key and use memcmp to
+ // compare.. so we need to zero out padding too
DLDL value;
- key.callConv = (DWORD)0;
- key.retTypeClass = (DWORDLONG)0;
- key.retTypeSigClass = (DWORDLONG)0;
- key.retType = (DWORD)0;
- key.flags = (DWORD)0;
- key.numArgs = (DWORD)0;
- key.sigInst_classInstCount = (DWORD)0;
+ key.callConv = (DWORD)0;
+ key.retTypeClass = (DWORDLONG)0;
+ key.retTypeSigClass = (DWORDLONG)0;
+ key.retType = (DWORD)0;
+ key.flags = (DWORD)0;
+ key.numArgs = (DWORD)0;
+ key.sigInst_classInstCount = (DWORD)0;
key.sigInst_classInst_Index = (DWORD)0;
- key.sigInst_methInstCount = (DWORD)0;
- key.sigInst_methInst_Index = (DWORD)0;
- key.args = (DWORDLONG)0;
- key.cbSig = (DWORD)szMetaSig->cbSig;
- key.pSig = (DWORD)GetCookieForPInvokeCalliSig->Contains((unsigned char *)szMetaSig->pSig, szMetaSig->cbSig);
+ key.sigInst_methInstCount = (DWORD)0;
+ key.sigInst_methInst_Index = (DWORD)0;
+ key.args = (DWORDLONG)0;
+ key.cbSig = (DWORD)szMetaSig->cbSig;
+ key.pSig = (DWORD)GetCookieForPInvokeCalliSig->Contains((unsigned char*)szMetaSig->pSig, szMetaSig->cbSig);
key.scope = (DWORDLONG)szMetaSig->scope;
key.token = (DWORD)szMetaSig->token;
value = (DLDL)GetCookieForPInvokeCalliSig->Get(key);
if (ppIndirection != nullptr)
- *ppIndirection = (void *)value.A;
+ *ppIndirection = (void*)value.A;
return (CORINFO_VARARGS_HANDLE)value.B;
}
@@ -5627,50 +5821,53 @@ void MethodContext::recCanGetCookieForPInvokeCalliSig(CORINFO_SIG_INFO* szMetaSi
CanGetCookieForPInvokeCalliSig = new LightWeightMap<Agnostic_CORINFO_SIG_INFO, DWORD>();
Agnostic_CORINFO_SIG_INFO key;
- ZeroMemory(&key, sizeof(Agnostic_CORINFO_SIG_INFO)); //We use the input structs as a key and use memcmp to compare.. so we need to zero out padding too
-
- key.callConv = (DWORD)0;
- key.retTypeClass = (DWORDLONG)0;
- key.retTypeSigClass = (DWORDLONG)0;
- key.retType = (DWORD)0;
- key.flags = (DWORD)0;
- key.numArgs = (DWORD)0;
- key.sigInst_classInstCount = (DWORD)0;
+ ZeroMemory(&key, sizeof(Agnostic_CORINFO_SIG_INFO)); // We use the input structs as a key and use memcmp to
+ // compare.. so we need to zero out padding too
+
+ key.callConv = (DWORD)0;
+ key.retTypeClass = (DWORDLONG)0;
+ key.retTypeSigClass = (DWORDLONG)0;
+ key.retType = (DWORD)0;
+ key.flags = (DWORD)0;
+ key.numArgs = (DWORD)0;
+ key.sigInst_classInstCount = (DWORD)0;
key.sigInst_classInst_Index = (DWORD)0;
- key.sigInst_methInstCount = (DWORD)0;
- key.sigInst_methInst_Index = (DWORD)0;
- key.args = (DWORDLONG)0;
- key.cbSig = (DWORD)0;
- key.pSig = (DWORD)0;
- key.scope = (DWORDLONG)szMetaSig->scope;
- key.token = (DWORD)szMetaSig->token;
+ key.sigInst_methInstCount = (DWORD)0;
+ key.sigInst_methInst_Index = (DWORD)0;
+ key.args = (DWORDLONG)0;
+ key.cbSig = (DWORD)0;
+ key.pSig = (DWORD)0;
+ key.scope = (DWORDLONG)szMetaSig->scope;
+ key.token = (DWORD)szMetaSig->token;
CanGetCookieForPInvokeCalliSig->Add(key, (DWORD)result);
}
void MethodContext::dmpCanGetCookieForPInvokeCalliSig(const Agnostic_CORINFO_SIG_INFO& key, DWORD value)
{
- printf("CanGetCookieForPInvokeCalliSig key scope-%016llX token-%08X, value result-%08X", key.scope, key.token, value);
+ printf("CanGetCookieForPInvokeCalliSig key scope-%016llX token-%08X, value result-%08X", key.scope, key.token,
+ value);
}
bool MethodContext::repCanGetCookieForPInvokeCalliSig(CORINFO_SIG_INFO* szMetaSig)
{
Agnostic_CORINFO_SIG_INFO key;
- ZeroMemory(&key, sizeof(Agnostic_CORINFO_SIG_INFO)); //We use the input structs as a key and use memcmp to compare.. so we need to zero out padding too
-
- key.callConv = (DWORD)0;
- key.retTypeClass = (DWORDLONG)0;
- key.retTypeSigClass = (DWORDLONG)0;
- key.retType = (DWORD)0;
- key.flags = (DWORD)0;
- key.numArgs = (DWORD)0;
- key.sigInst_classInstCount = (DWORD)0;
+ ZeroMemory(&key, sizeof(Agnostic_CORINFO_SIG_INFO)); // We use the input structs as a key and use memcmp to
+ // compare.. so we need to zero out padding too
+
+ key.callConv = (DWORD)0;
+ key.retTypeClass = (DWORDLONG)0;
+ key.retTypeSigClass = (DWORDLONG)0;
+ key.retType = (DWORD)0;
+ key.flags = (DWORD)0;
+ key.numArgs = (DWORD)0;
+ key.sigInst_classInstCount = (DWORD)0;
key.sigInst_classInst_Index = (DWORD)0;
- key.sigInst_methInstCount = (DWORD)0;
- key.sigInst_methInst_Index = (DWORD)0;
- key.args = (DWORDLONG)0;
- key.cbSig = (DWORD)0;
- key.pSig = (DWORD)0;
- key.scope = (DWORDLONG)szMetaSig->scope;
- key.token = (DWORD)szMetaSig->token;
+ key.sigInst_methInstCount = (DWORD)0;
+ key.sigInst_methInst_Index = (DWORD)0;
+ key.args = (DWORDLONG)0;
+ key.cbSig = (DWORD)0;
+ key.pSig = (DWORD)0;
+ key.scope = (DWORDLONG)szMetaSig->scope;
+ key.token = (DWORD)szMetaSig->token;
DWORD temp = CanGetCookieForPInvokeCalliSig->Get(key);
return temp != 0;
@@ -5682,7 +5879,8 @@ void MethodContext::recCanAccessFamily(CORINFO_METHOD_HANDLE hCaller, CORINFO_CL
CanAccessFamily = new LightWeightMap<DLDL, DWORD>();
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
key.A = (DWORDLONG)hCaller;
key.B = (DWORDLONG)hInstanceType;
@@ -5696,7 +5894,8 @@ void MethodContext::dmpCanAccessFamily(DLDL key, DWORD value)
BOOL MethodContext::repCanAccessFamily(CORINFO_METHOD_HANDLE hCaller, CORINFO_CLASS_HANDLE hInstanceType)
{
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
key.A = (DWORDLONG)hCaller;
key.B = (DWORDLONG)hInstanceType;
@@ -5705,7 +5904,7 @@ BOOL MethodContext::repCanAccessFamily(CORINFO_METHOD_HANDLE hCaller, CORINFO_CL
return (BOOL)temp;
}
-void MethodContext::recErrorList(const char *error)
+void MethodContext::recErrorList(const char* error)
{
if (ErrorList == nullptr)
ErrorList = new DenseLightWeightMap<DWORD>();
@@ -5713,7 +5912,7 @@ void MethodContext::recErrorList(const char *error)
DWORD temp = (DWORD)-1;
if (error != nullptr)
- temp = (DWORD)ErrorList->AddBuffer((unsigned char *)error, (DWORD)strlen(error) + 1);
+ temp = (DWORD)ErrorList->AddBuffer((unsigned char*)error, (DWORD)strlen(error) + 1);
ErrorList->Append(temp);
}
@@ -5722,38 +5921,39 @@ void MethodContext::dmpErrorList(DWORD key, DWORD value)
printf("ErrorList NYI");
}
-void MethodContext::recGetProfilingHandle(BOOL *pbHookFunction, void **pProfilerHandle, BOOL *pbIndirectedHandles)
+void MethodContext::recGetProfilingHandle(BOOL* pbHookFunction, void** pProfilerHandle, BOOL* pbIndirectedHandles)
{
if (GetProfilingHandle == nullptr)
GetProfilingHandle = new LightWeightMap<DWORD, Agnostic_GetProfilingHandle>();
Agnostic_GetProfilingHandle value;
- ZeroMemory(&value, sizeof(Agnostic_GetProfilingHandle)); //We use the input structs as a value and use memcmp to compare.. so we need to zero out padding too
+ ZeroMemory(&value, sizeof(Agnostic_GetProfilingHandle)); // We use the input structs as a value and use memcmp to
+ // compare.. so we need to zero out padding too
- value.bHookFunction = (DWORD)*pbHookFunction;
- value.ProfilerHandle = (DWORDLONG)*pProfilerHandle;
+ value.bHookFunction = (DWORD)*pbHookFunction;
+ value.ProfilerHandle = (DWORDLONG)*pProfilerHandle;
value.bIndirectedHandles = (DWORD)*pbIndirectedHandles;
GetProfilingHandle->Add((DWORD)0, value);
DEBUG_REC(dmpGetProfilingHandle(0, value));
}
void MethodContext::dmpGetProfilingHandle(DWORD key, const Agnostic_GetProfilingHandle& value)
{
- printf("GetProfilingHandle key %u, value bHookFtn-%u profHnd-%016llX bIndHnd-%u",
- key, value.bHookFunction, value.ProfilerHandle, value.bIndirectedHandles);
+ printf("GetProfilingHandle key %u, value bHookFtn-%u profHnd-%016llX bIndHnd-%u", key, value.bHookFunction,
+ value.ProfilerHandle, value.bIndirectedHandles);
}
-void MethodContext::repGetProfilingHandle(BOOL *pbHookFunction, void **pProfilerHandle, BOOL *pbIndirectedHandles)
+void MethodContext::repGetProfilingHandle(BOOL* pbHookFunction, void** pProfilerHandle, BOOL* pbIndirectedHandles)
{
Agnostic_GetProfilingHandle value;
value = GetProfilingHandle->Get((DWORD)0);
- *pbHookFunction = (BOOL)value.bHookFunction;
- *pProfilerHandle = (void*)value.ProfilerHandle;
+ *pbHookFunction = (BOOL)value.bHookFunction;
+ *pProfilerHandle = (void*)value.ProfilerHandle;
*pbIndirectedHandles = (BOOL)value.bIndirectedHandles;
DEBUG_REP(dmpGetProfilingHandle(0, value));
}
-void MethodContext::recEmbedFieldHandle(CORINFO_FIELD_HANDLE handle, void **ppIndirection, CORINFO_FIELD_HANDLE result)
+void MethodContext::recEmbedFieldHandle(CORINFO_FIELD_HANDLE handle, void** ppIndirection, CORINFO_FIELD_HANDLE result)
{
if (EmbedFieldHandle == nullptr)
EmbedFieldHandle = new LightWeightMap<DWORDLONG, DLDL>();
@@ -5763,7 +5963,7 @@ void MethodContext::recEmbedFieldHandle(CORINFO_FIELD_HANDLE handle, void **ppIn
value.A = (DWORDLONG)*ppIndirection;
else
value.A = (DWORDLONG)0;
- value.B = (DWORDLONG)result;
+ value.B = (DWORDLONG)result;
EmbedFieldHandle->Add((DWORDLONG)handle, value);
}
@@ -5771,7 +5971,7 @@ void MethodContext::dmpEmbedFieldHandle(DWORDLONG key, DLDL value)
{
printf("EmbedFieldHandle NYI");
}
-CORINFO_FIELD_HANDLE MethodContext::repEmbedFieldHandle(CORINFO_FIELD_HANDLE handle, void **ppIndirection)
+CORINFO_FIELD_HANDLE MethodContext::repEmbedFieldHandle(CORINFO_FIELD_HANDLE handle, void** ppIndirection)
{
DLDL value;
@@ -5787,7 +5987,8 @@ void MethodContext::recAreTypesEquivalent(CORINFO_CLASS_HANDLE cls1, CORINFO_CLA
AreTypesEquivalent = new LightWeightMap<DLDL, DWORD>();
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
key.A = (DWORDLONG)cls1;
key.B = (DWORDLONG)cls2;
@@ -5801,24 +6002,27 @@ void MethodContext::dmpAreTypesEquivalent(DLDL key, DWORD value)
BOOL MethodContext::repAreTypesEquivalent(CORINFO_CLASS_HANDLE cls1, CORINFO_CLASS_HANDLE cls2)
{
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
key.A = (DWORDLONG)cls1;
key.B = (DWORDLONG)cls2;
- AssertCodeMsg(AreTypesEquivalent->GetIndex(key) != -1, EXCEPTIONCODE_MC,
- "Didn't find %016llX %016llX", (DWORDLONG)cls1, (DWORDLONG)cls2);
+ AssertCodeMsg(AreTypesEquivalent->GetIndex(key) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX %016llX",
+ (DWORDLONG)cls1, (DWORDLONG)cls2);
BOOL value = (BOOL)AreTypesEquivalent->Get(key);
return value;
}
-void MethodContext::recFindNameOfToken(CORINFO_MODULE_HANDLE module, mdToken metaTOK, char * szFQName, size_t FQNameCapacity, size_t result)
+void MethodContext::recFindNameOfToken(
+ CORINFO_MODULE_HANDLE module, mdToken metaTOK, char* szFQName, size_t FQNameCapacity, size_t result)
{
if (FindNameOfToken == nullptr)
FindNameOfToken = new LightWeightMap<DLD, DLD>();
DLD key;
- ZeroMemory(&key, sizeof(DLD)); //We use the input structs as a key and use memcmp to compare.. so we need to zero out padding too
+ ZeroMemory(&key, sizeof(DLD)); // We use the input structs as a key and use memcmp to compare.. so we need to zero
+ // out padding too
DLD value;
key.A = (DWORDLONG)module;
@@ -5832,18 +6036,22 @@ void MethodContext::recFindNameOfToken(CORINFO_MODULE_HANDLE module, mdToken met
}
void MethodContext::dmpFindNameOfToken(DLD key, DLD value)
{
- //practically the name of a token wont be bigger than 4gb...
- unsigned char *buff = new unsigned char[(unsigned int)value.A + 1];
+ // practically the name of a token wont be bigger than 4gb...
+ unsigned char* buff = new unsigned char[(unsigned int)value.A + 1];
ZeroMemory(buff, (unsigned int)value.A + 1);
memcpy(buff, FindNameOfToken->GetBuffer(value.B), (unsigned int)value.A);
FindNameOfToken->Unlock();
printf("FindNameOfToken key mod-%016llX tok-%08X, value '%s'", key.A, key.B, buff);
- delete[]buff;
+ delete[] buff;
}
-size_t MethodContext::repFindNameOfToken(CORINFO_MODULE_HANDLE module, mdToken metaTOK, char * szFQName, size_t FQNameCapacity)
+size_t MethodContext::repFindNameOfToken(CORINFO_MODULE_HANDLE module,
+ mdToken metaTOK,
+ char* szFQName,
+ size_t FQNameCapacity)
{
DLD key;
- ZeroMemory(&key, sizeof(DLD)); //We use the input structs as a key and use memcmp to compare.. so we need to zero out padding too
+ ZeroMemory(&key, sizeof(DLD)); // We use the input structs as a key and use memcmp to compare.. so we need to zero
+ // out padding too
DLD value;
key.A = (DWORDLONG)module;
@@ -5862,12 +6070,16 @@ size_t MethodContext::repFindNameOfToken(CORINFO_MODULE_HANDLE module, mdToken m
return (size_t)value.A;
}
-void MethodContext::recGetSystemVAmd64PassStructInRegisterDescriptor(CORINFO_CLASS_HANDLE structHnd, SYSTEMV_AMD64_CORINFO_STRUCT_REG_PASSING_DESCRIPTOR* structPassInRegDescPtr, bool result)
+void MethodContext::recGetSystemVAmd64PassStructInRegisterDescriptor(
+ CORINFO_CLASS_HANDLE structHnd,
+ SYSTEMV_AMD64_CORINFO_STRUCT_REG_PASSING_DESCRIPTOR* structPassInRegDescPtr,
+ bool result)
{
if (GetSystemVAmd64PassStructInRegisterDescriptor == nullptr)
- GetSystemVAmd64PassStructInRegisterDescriptor = new LightWeightMap<DWORDLONG, Agnostic_GetSystemVAmd64PassStructInRegisterDescriptor>();
+ GetSystemVAmd64PassStructInRegisterDescriptor =
+ new LightWeightMap<DWORDLONG, Agnostic_GetSystemVAmd64PassStructInRegisterDescriptor>();
- DWORDLONG key;
+ DWORDLONG key;
Agnostic_GetSystemVAmd64PassStructInRegisterDescriptor value;
key = (DWORDLONG)structHnd;
@@ -5885,21 +6097,22 @@ void MethodContext::recGetSystemVAmd64PassStructInRegisterDescriptor(CORINFO_CLA
GetSystemVAmd64PassStructInRegisterDescriptor->Add(key, value);
DEBUG_REC(dmpGetSystemVAmd64PassStructInRegisterDescriptor(key, value));
}
-void MethodContext::dmpGetSystemVAmd64PassStructInRegisterDescriptor(DWORDLONG key, const Agnostic_GetSystemVAmd64PassStructInRegisterDescriptor& value)
+void MethodContext::dmpGetSystemVAmd64PassStructInRegisterDescriptor(
+ DWORDLONG key, const Agnostic_GetSystemVAmd64PassStructInRegisterDescriptor& value)
{
- printf("GetSystemVAmd64PassStructInRegisterDescriptor key structHnd-%016llX, value passInReg-%u 8bCount-%u", key, value.passedInRegisters, value.eightByteCount);
+ printf("GetSystemVAmd64PassStructInRegisterDescriptor key structHnd-%016llX, value passInReg-%u 8bCount-%u", key,
+ value.passedInRegisters, value.eightByteCount);
for (int i = 0; i < CLR_SYSTEMV_MAX_EIGHTBYTES_COUNT_TO_PASS_IN_REGISTERS; i++)
{
- printf(" 8bClass[%u]-%u 8bSz[%u]-%u 8bOff[%u]-%u",
- i, value.eightByteClassifications[i],
- i, value.eightByteSizes[i],
- i, value.eightByteOffsets[i]);
+ printf(" 8bClass[%u]-%u 8bSz[%u]-%u 8bOff[%u]-%u", i, value.eightByteClassifications[i], i,
+ value.eightByteSizes[i], i, value.eightByteOffsets[i]);
}
printf(" result %u", value.result);
}
-bool MethodContext::repGetSystemVAmd64PassStructInRegisterDescriptor(CORINFO_CLASS_HANDLE structHnd, SYSTEMV_AMD64_CORINFO_STRUCT_REG_PASSING_DESCRIPTOR* structPassInRegDescPtr)
+bool MethodContext::repGetSystemVAmd64PassStructInRegisterDescriptor(
+ CORINFO_CLASS_HANDLE structHnd, SYSTEMV_AMD64_CORINFO_STRUCT_REG_PASSING_DESCRIPTOR* structPassInRegDescPtr)
{
- DWORDLONG key;
+ DWORDLONG key;
Agnostic_GetSystemVAmd64PassStructInRegisterDescriptor value;
key = (DWORDLONG)structHnd;
@@ -5910,16 +6123,17 @@ bool MethodContext::repGetSystemVAmd64PassStructInRegisterDescriptor(CORINFO_CLA
structPassInRegDescPtr->eightByteCount = (unsigned __int8)value.eightByteCount;
for (int i = 0; i < CLR_SYSTEMV_MAX_EIGHTBYTES_COUNT_TO_PASS_IN_REGISTERS; i++)
{
- structPassInRegDescPtr->eightByteClassifications[i] = (SystemVClassificationType)value.eightByteClassifications[i];
- structPassInRegDescPtr->eightByteSizes[i] = (unsigned __int8)value.eightByteSizes[i];
- structPassInRegDescPtr->eightByteOffsets[i] = (unsigned __int8)value.eightByteOffsets[i];
+ structPassInRegDescPtr->eightByteClassifications[i] =
+ (SystemVClassificationType)value.eightByteClassifications[i];
+ structPassInRegDescPtr->eightByteSizes[i] = (unsigned __int8)value.eightByteSizes[i];
+ structPassInRegDescPtr->eightByteOffsets[i] = (unsigned __int8)value.eightByteOffsets[i];
}
DEBUG_REP(dmpGetSystemVAmd64PassStructInRegisterDescriptor(key, value));
return value.result ? true : false;
}
-void MethodContext::recGetRelocTypeHint(void * target, WORD result)
+void MethodContext::recGetRelocTypeHint(void* target, WORD result)
{
if (GetRelocTypeHint == nullptr)
GetRelocTypeHint = new LightWeightMap<DWORDLONG, DWORD>();
@@ -5931,7 +6145,7 @@ void MethodContext::dmpGetRelocTypeHint(DWORDLONG key, DWORD value)
{
printf("GetRelocTypeHint key tgt-%016llX, value hint-%u", key, value);
}
-WORD MethodContext::repGetRelocTypeHint(void * target)
+WORD MethodContext::repGetRelocTypeHint(void* target)
{
if (GetRelocTypeHint == nullptr)
{
@@ -5944,7 +6158,7 @@ WORD MethodContext::repGetRelocTypeHint(void * target)
}
if (GetRelocTypeHint->GetIndex((DWORDLONG)target) == -1)
{
- void *origAddr = cr->repAddressMap((void *)target);
+ void* origAddr = cr->repAddressMap((void*)target);
if (origAddr != (void*)-1 && origAddr != nullptr)
{
if (GetRelocTypeHint->GetIndex((DWORDLONG)origAddr) == -1)
@@ -5961,11 +6175,11 @@ WORD MethodContext::repGetRelocTypeHint(void * target)
}
}
- int index = GetRelocTypeHint->GetIndex((DWORDLONG)target);
+ int index = GetRelocTypeHint->GetIndex((DWORDLONG)target);
WORD retVal = 0;
if (index == -1)
{
- void *subtarget = cr->searchAddressMap(target);
+ void* subtarget = cr->searchAddressMap(target);
int index2 = GetRelocTypeHint->GetIndex((DWORDLONG)subtarget);
if (index2 == -1)
@@ -5980,7 +6194,6 @@ WORD MethodContext::repGetRelocTypeHint(void * target)
retVal = (WORD)GetRelocTypeHint->Get((DWORDLONG)target);
DEBUG_REP(dmpGetRelocTypeHint((DWORDLONG)target, retVal));
return retVal;
-
}
void MethodContext::recIsWriteBarrierHelperRequired(CORINFO_FIELD_HANDLE field, bool result)
@@ -6008,7 +6221,8 @@ void MethodContext::recIsValidToken(CORINFO_MODULE_HANDLE module, unsigned metaT
IsValidToken = new LightWeightMap<DLD, DWORD>();
DLD key;
- ZeroMemory(&key, sizeof(DLD)); //We use the input structs as a key and use memcmp to compare.. so we need to zero out padding too
+ ZeroMemory(&key, sizeof(DLD)); // We use the input structs as a key and use memcmp to compare.. so we need to zero
+ // out padding too
key.A = (DWORDLONG)module;
key.B = (DWORD)metaTOK;
IsValidToken->Add(key, (DWORD)result);
@@ -6020,10 +6234,11 @@ void MethodContext::dmpIsValidToken(DLD key, DWORD value)
BOOL MethodContext::repIsValidToken(CORINFO_MODULE_HANDLE module, unsigned metaTOK)
{
DLD key;
- ZeroMemory(&key, sizeof(DLD)); //We use the input structs as a key and use memcmp to compare.. so we need to zero out padding too
+ ZeroMemory(&key, sizeof(DLD)); // We use the input structs as a key and use memcmp to compare.. so we need to zero
+ // out padding too
- key.A = (DWORDLONG)module;
- key.B = (DWORD)metaTOK;
+ key.A = (DWORDLONG)module;
+ key.B = (DWORD)metaTOK;
BOOL value = (BOOL)IsValidToken->Get(key);
return value;
}
@@ -6052,23 +6267,25 @@ const char* MethodContext::repGetClassName(CORINFO_CLASS_HANDLE cls)
int index = GetClassName->GetIndex((DWORDLONG)cls);
if (index == -1)
return "hackishClassName";
- int offset = GetClassName->Get((DWORDLONG)cls);
- const char* name = (const char*)GetClassName->GetBuffer(offset);
+ int offset = GetClassName->Get((DWORDLONG)cls);
+ const char* name = (const char*)GetClassName->GetBuffer(offset);
DEBUG_REC(dmpGetClassName((DWORDLONG)cls, (DWORD)offset));
return name;
}
-void MethodContext::recAppendClassName(CORINFO_CLASS_HANDLE cls, BOOL fNamespace, BOOL fFullInst, BOOL fAssembly, const WCHAR* result)
+void MethodContext::recAppendClassName(
+ CORINFO_CLASS_HANDLE cls, BOOL fNamespace, BOOL fFullInst, BOOL fAssembly, const WCHAR* result)
{
if (AppendClassName == nullptr)
AppendClassName = new LightWeightMap<Agnostic_AppendClassName, DWORD>();
Agnostic_AppendClassName key;
- ZeroMemory(&key, sizeof(Agnostic_AppendClassName)); //We use the input structs as a key and use memcmp to compare.. so we need to zero out padding too
- key.classHandle = (DWORDLONG) cls;
- key.fNamespace = fNamespace;
- key.fFullInst = fFullInst;
- key.fAssembly = fAssembly;
+ ZeroMemory(&key, sizeof(Agnostic_AppendClassName)); // We use the input structs as a key and use memcmp to compare..
+ // so we need to zero out padding too
+ key.classHandle = (DWORDLONG)cls;
+ key.fNamespace = fNamespace;
+ key.fFullInst = fFullInst;
+ key.fAssembly = fAssembly;
DWORD temp = (DWORD)-1;
if (result != nullptr)
@@ -6080,105 +6297,112 @@ void MethodContext::recAppendClassName(CORINFO_CLASS_HANDLE cls, BOOL fNamespace
void MethodContext::dmpAppendClassName(const Agnostic_AppendClassName& key, DWORD value)
{
- printf("AppendClassName key cls-%016llX ns-%u fi-%u as-%u, value %s",
- key.classHandle, key.fNamespace, key.fFullInst, key.fAssembly, AppendClassName->GetBuffer(value));
+ printf("AppendClassName key cls-%016llX ns-%u fi-%u as-%u, value %s", key.classHandle, key.fNamespace,
+ key.fFullInst, key.fAssembly, AppendClassName->GetBuffer(value));
AppendClassName->Unlock();
}
-const WCHAR* MethodContext::repAppendClassName(CORINFO_CLASS_HANDLE cls, BOOL fNamespace, BOOL fFullInst, BOOL fAssembly)
+const WCHAR* MethodContext::repAppendClassName(CORINFO_CLASS_HANDLE cls,
+ BOOL fNamespace,
+ BOOL fFullInst,
+ BOOL fAssembly)
{
if (AppendClassName == nullptr)
return W("hackishClassName");
Agnostic_AppendClassName key;
- ZeroMemory(&key, sizeof(Agnostic_AppendClassName)); //We use the input structs as a key and use memcmp to compare.. so we need to zero out padding too
- key.classHandle = (DWORDLONG) cls;
- key.fNamespace = fNamespace;
- key.fFullInst = fFullInst;
- key.fAssembly = fAssembly;
+ ZeroMemory(&key, sizeof(Agnostic_AppendClassName)); // We use the input structs as a key and use memcmp to compare..
+ // so we need to zero out padding too
+ key.classHandle = (DWORDLONG)cls;
+ key.fNamespace = fNamespace;
+ key.fFullInst = fFullInst;
+ key.fAssembly = fAssembly;
int index = AppendClassName->GetIndex(key);
if (index == -1)
return W("hackishClassName");
- int offset = AppendClassName->Get(key);
- const WCHAR* name = (const WCHAR*)AppendClassName->GetBuffer(offset);
+ int offset = AppendClassName->Get(key);
+ const WCHAR* name = (const WCHAR*)AppendClassName->GetBuffer(offset);
DEBUG_REC(dmpAppendClassName(key, (DWORD)offset));
return name;
}
-void MethodContext::recGetTailCallCopyArgsThunk(CORINFO_SIG_INFO *pSig, CorInfoHelperTailCallSpecialHandling flags, void* result)
+void MethodContext::recGetTailCallCopyArgsThunk(CORINFO_SIG_INFO* pSig,
+ CorInfoHelperTailCallSpecialHandling flags,
+ void* result)
{
if (GetTailCallCopyArgsThunk == nullptr)
GetTailCallCopyArgsThunk = new LightWeightMap<Agnostic_GetTailCallCopyArgsThunk, DWORDLONG>();
Agnostic_GetTailCallCopyArgsThunk key;
- ZeroMemory(&key, sizeof(Agnostic_GetTailCallCopyArgsThunk)); //We use the input structs as a key and use memcmp to compare.. so we need to zero out padding too
-
- key.Sig.callConv = (DWORD)pSig->callConv;
- key.Sig.retTypeClass = (DWORDLONG)pSig->retTypeClass;
- key.Sig.retTypeSigClass = (DWORDLONG)pSig->retTypeSigClass;
- key.Sig.retType = (DWORD)pSig->retType;
- key.Sig.flags = (DWORD)pSig->flags;
- key.Sig.numArgs = (DWORD)pSig->numArgs;
+ ZeroMemory(&key, sizeof(Agnostic_GetTailCallCopyArgsThunk)); // We use the input structs as a key and use memcmp to
+ // compare.. so we need to zero out padding too
+
+ key.Sig.callConv = (DWORD)pSig->callConv;
+ key.Sig.retTypeClass = (DWORDLONG)pSig->retTypeClass;
+ key.Sig.retTypeSigClass = (DWORDLONG)pSig->retTypeSigClass;
+ key.Sig.retType = (DWORD)pSig->retType;
+ key.Sig.flags = (DWORD)pSig->flags;
+ key.Sig.numArgs = (DWORD)pSig->numArgs;
key.Sig.sigInst_classInstCount = (DWORD)pSig->sigInst.classInstCount;
- key.Sig.sigInst_classInst_Index = (DWORD)GetTailCallCopyArgsThunk->AddBuffer((unsigned char*)pSig->sigInst.classInst, pSig->sigInst.classInstCount * 8); //porting issue
+ key.Sig.sigInst_classInst_Index =
+ (DWORD)GetTailCallCopyArgsThunk->AddBuffer((unsigned char*)pSig->sigInst.classInst,
+ pSig->sigInst.classInstCount * 8); // porting issue
key.Sig.sigInst_methInstCount = (DWORD)pSig->sigInst.methInstCount;
- key.Sig.sigInst_methInst_Index = (DWORD)GetTailCallCopyArgsThunk->AddBuffer((unsigned char*)pSig->sigInst.methInst, pSig->sigInst.methInstCount * 8); //porting issue
- key.Sig.args = (DWORDLONG)pSig->args;
+ key.Sig.sigInst_methInst_Index =
+ (DWORD)GetTailCallCopyArgsThunk->AddBuffer((unsigned char*)pSig->sigInst.methInst,
+ pSig->sigInst.methInstCount * 8); // porting issue
+ key.Sig.args = (DWORDLONG)pSig->args;
key.Sig.cbSig = (DWORD)pSig->cbSig;
- key.Sig.pSig = (DWORD)GetTailCallCopyArgsThunk->AddBuffer((unsigned char *)pSig->pSig, pSig->cbSig);
+ key.Sig.pSig = (DWORD)GetTailCallCopyArgsThunk->AddBuffer((unsigned char*)pSig->pSig, pSig->cbSig);
key.Sig.scope = (DWORDLONG)pSig->scope;
key.Sig.token = (DWORD)pSig->token;
- key.flags = (DWORD)flags;
+ key.flags = (DWORD)flags;
GetTailCallCopyArgsThunk->Add(key, (DWORDLONG)result);
DEBUG_REC(dmpGetTailCallCopyArgsThunk(key, (DWORDLONG)result));
}
void MethodContext::dmpGetTailCallCopyArgsThunk(const Agnostic_GetTailCallCopyArgsThunk& key, DWORDLONG value)
{
- printf("GetTailCallCopyArgsThunk key sig{cc-%u rtc-%016llX rts-%016llX rt-%u flg-%08X na-%u cc-%u ci-%u mc-%u mi-%u sig-%u pSig-%u scp-%016llX tok-%08X} flg-%08X",
- key.Sig.callConv,
- key.Sig.retTypeClass,
- key.Sig.retTypeSigClass,
- key.Sig.retType,
- key.Sig.flags,
- key.Sig.numArgs,
- key.Sig.sigInst_classInstCount,
- key.Sig.sigInst_classInst_Index,
- key.Sig.sigInst_methInstCount,
- key.Sig.sigInst_methInst_Index,
- key.Sig.cbSig,
- key.Sig.pSig,
- key.Sig.scope,
- key.Sig.token,
- key.flags);
+ printf("GetTailCallCopyArgsThunk key sig{cc-%u rtc-%016llX rts-%016llX rt-%u flg-%08X na-%u cc-%u ci-%u mc-%u "
+ "mi-%u sig-%u pSig-%u scp-%016llX tok-%08X} flg-%08X",
+ key.Sig.callConv, key.Sig.retTypeClass, key.Sig.retTypeSigClass, key.Sig.retType, key.Sig.flags,
+ key.Sig.numArgs, key.Sig.sigInst_classInstCount, key.Sig.sigInst_classInst_Index,
+ key.Sig.sigInst_methInstCount, key.Sig.sigInst_methInst_Index, key.Sig.cbSig, key.Sig.pSig, key.Sig.scope,
+ key.Sig.token, key.flags);
printf(", value res-%016llX", value);
}
-void* MethodContext::repGetTailCallCopyArgsThunk(CORINFO_SIG_INFO *pSig, CorInfoHelperTailCallSpecialHandling flags)
+void* MethodContext::repGetTailCallCopyArgsThunk(CORINFO_SIG_INFO* pSig, CorInfoHelperTailCallSpecialHandling flags)
{
Agnostic_GetTailCallCopyArgsThunk key;
- ZeroMemory(&key, sizeof(Agnostic_GetTailCallCopyArgsThunk)); //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_GetTailCallCopyArgsThunk)); // We use the input structs as a key and use memcmp to
+ // compare.. so we need to zero out padding too
AssertCodeMsg(GetTailCallCopyArgsThunk != nullptr, EXCEPTIONCODE_MC, "Didn't find anything for ...");
- key.Sig.callConv = (DWORD)pSig->callConv;
- key.Sig.retTypeClass = (DWORDLONG)pSig->retTypeClass;
- key.Sig.retTypeSigClass = (DWORDLONG)pSig->retTypeSigClass;
- key.Sig.retType = (DWORD)pSig->retType;
- key.Sig.flags = (DWORD)pSig->flags;
- key.Sig.numArgs = (DWORD)pSig->numArgs;
+ key.Sig.callConv = (DWORD)pSig->callConv;
+ key.Sig.retTypeClass = (DWORDLONG)pSig->retTypeClass;
+ key.Sig.retTypeSigClass = (DWORDLONG)pSig->retTypeSigClass;
+ key.Sig.retType = (DWORD)pSig->retType;
+ key.Sig.flags = (DWORD)pSig->flags;
+ key.Sig.numArgs = (DWORD)pSig->numArgs;
key.Sig.sigInst_classInstCount = (DWORD)pSig->sigInst.classInstCount;
- key.Sig.sigInst_classInst_Index = (DWORD)GetTailCallCopyArgsThunk->Contains((unsigned char*)pSig->sigInst.classInst, pSig->sigInst.classInstCount * 8); //porting issue
+ key.Sig.sigInst_classInst_Index =
+ (DWORD)GetTailCallCopyArgsThunk->Contains((unsigned char*)pSig->sigInst.classInst,
+ pSig->sigInst.classInstCount * 8); // porting issue
key.Sig.sigInst_methInstCount = (DWORD)pSig->sigInst.methInstCount;
- key.Sig.sigInst_methInst_Index = (DWORD)GetTailCallCopyArgsThunk->Contains((unsigned char*)pSig->sigInst.methInst, pSig->sigInst.methInstCount * 8); //porting issue
- key.Sig.args = (DWORDLONG)pSig->args;
+ key.Sig.sigInst_methInst_Index =
+ (DWORD)GetTailCallCopyArgsThunk->Contains((unsigned char*)pSig->sigInst.methInst,
+ pSig->sigInst.methInstCount * 8); // porting issue
+ key.Sig.args = (DWORDLONG)pSig->args;
key.Sig.cbSig = (DWORD)pSig->cbSig;
- key.Sig.pSig = (DWORD)GetTailCallCopyArgsThunk->Contains((unsigned char *)pSig->pSig, pSig->cbSig);
+ key.Sig.pSig = (DWORD)GetTailCallCopyArgsThunk->Contains((unsigned char*)pSig->pSig, pSig->cbSig);
key.Sig.scope = (DWORDLONG)pSig->scope;
key.Sig.token = (DWORD)pSig->token;
- key.flags = (DWORD)flags;
+ key.flags = (DWORD)flags;
- AssertCodeMsg(GetTailCallCopyArgsThunk->GetIndex(key) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX", (DWORDLONG)key.Sig.retTypeClass);
- void *result = (void*)GetTailCallCopyArgsThunk->Get(key);
+ AssertCodeMsg(GetTailCallCopyArgsThunk->GetIndex(key) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX",
+ (DWORDLONG)key.Sig.retTypeClass);
+ void* result = (void*)GetTailCallCopyArgsThunk->Get(key);
cr->recAddressMap((void*)0x424242, (void*)result, 1);
DEBUG_REP(dmpGetTailCallCopyArgsThunk(key, (DWORDLONG)result));
return result;
@@ -6214,12 +6438,15 @@ void MethodContext::recCheckMethodModifier(CORINFO_METHOD_HANDLE hMethod, LPCSTR
CheckMethodModifier = new LightWeightMap<Agnostic_CheckMethodModifier, DWORD>();
Agnostic_CheckMethodModifier key;
- ZeroMemory(&key, sizeof(Agnostic_CheckMethodModifier)); //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_CheckMethodModifier)); // We use the input structs as a key and use memcmp to
+ // compare.. so we need to zero out padding too
key.hMethod = (DWORDLONG)hMethod;
- //If the input matches something already in the buffer, just re-use that slot.. easier than searching for a soft key on rep.
+ // If the input matches something already in the buffer, just re-use that slot.. easier than searching for a soft
+ // key on rep.
if (modifier != nullptr)
- key.modifier = (DWORD)CheckMethodModifier->AddBuffer((unsigned char*)modifier, (unsigned int)strlen(modifier) + 1);
+ key.modifier =
+ (DWORD)CheckMethodModifier->AddBuffer((unsigned char*)modifier, (unsigned int)strlen(modifier) + 1);
else
key.modifier = (DWORD)-1;
@@ -6230,17 +6457,19 @@ void MethodContext::recCheckMethodModifier(CORINFO_METHOD_HANDLE hMethod, LPCSTR
void MethodContext::dmpCheckMethodModifier(const Agnostic_CheckMethodModifier& key, DWORD value)
{
printf("CheckMethodModifier key, ftn-%016llX mod-'%s' opt-%u, value res-%u", key.hMethod,
- (unsigned char *)CheckMethodModifier->GetBuffer(key.modifier), key.fOptional, value);
+ (unsigned char*)CheckMethodModifier->GetBuffer(key.modifier), key.fOptional, value);
CheckMethodModifier->Unlock();
}
BOOL MethodContext::repCheckMethodModifier(CORINFO_METHOD_HANDLE hMethod, LPCSTR modifier, BOOL fOptional)
{
Agnostic_CheckMethodModifier key;
- ZeroMemory(&key, sizeof(Agnostic_CheckMethodModifier)); //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_CheckMethodModifier)); // We use the input structs as a key and use memcmp to
+ // compare.. so we need to zero out padding too
key.hMethod = (DWORDLONG)hMethod;
if (modifier != nullptr)
- key.modifier = (DWORD)CheckMethodModifier->Contains((unsigned char *)modifier, (unsigned int)strlen(modifier) + 1);
+ key.modifier =
+ (DWORD)CheckMethodModifier->Contains((unsigned char*)modifier, (unsigned int)strlen(modifier) + 1);
else
key.modifier = (DWORD)-1;
@@ -6250,7 +6479,7 @@ BOOL MethodContext::repCheckMethodModifier(CORINFO_METHOD_HANDLE hMethod, LPCSTR
return value;
}
-void MethodContext::recGetPInvokeUnmanagedTarget(CORINFO_METHOD_HANDLE method, void **ppIndirection, void* result)
+void MethodContext::recGetPInvokeUnmanagedTarget(CORINFO_METHOD_HANDLE method, void** ppIndirection, void* result)
{
if (GetPInvokeUnmanagedTarget == nullptr)
GetPInvokeUnmanagedTarget = new LightWeightMap<DWORDLONG, DLDL>();
@@ -6265,13 +6494,13 @@ void MethodContext::dmpGetPInvokeUnmanagedTarget(DWORDLONG key, DLDL value)
{
printf("GetPInvokeUnmanagedTarget key ftn-%016llX, value pp-%016llX res-%016llX", key, value.A, value.B);
}
-void* MethodContext::repGetPInvokeUnmanagedTarget(CORINFO_METHOD_HANDLE method, void **ppIndirection)
+void* MethodContext::repGetPInvokeUnmanagedTarget(CORINFO_METHOD_HANDLE method, void** ppIndirection)
{
- DLDL temp = (DLDL)GetPInvokeUnmanagedTarget->Get((DWORDLONG)method);
- *ppIndirection = (void *)temp.A;
+ DLDL temp = (DLDL)GetPInvokeUnmanagedTarget->Get((DWORDLONG)method);
+ *ppIndirection = (void*)temp.A;
DEBUG_REP(dmpGetPInvokeUnmanagedTarget((DWORDLONG)method, temp));
- return (void *)temp.B;
+ return (void*)temp.B;
}
void MethodContext::recGetArrayRank(CORINFO_CLASS_HANDLE cls, unsigned result)
@@ -6305,13 +6534,14 @@ void MethodContext::dmpIsFieldStatic(DWORDLONG key, DWORD value)
bool MethodContext::repIsFieldStatic(CORINFO_FIELD_HANDLE fhld)
{
AssertCodeMsg(IsFieldStatic != nullptr, EXCEPTIONCODE_MC, "Didn't find anything for %016llX", (DWORDLONG)fhld);
- AssertCodeMsg(IsFieldStatic->GetIndex((DWORDLONG)fhld) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX", (DWORDLONG)fhld);
+ AssertCodeMsg(IsFieldStatic->GetIndex((DWORDLONG)fhld) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX",
+ (DWORDLONG)fhld);
bool result = (bool)(IsFieldStatic->Get((DWORDLONG)fhld) != 0);
DEBUG_REP(dmpIsFieldStatic((DWORDLONG)fhld, (DWORD)result));
return result;
}
-void MethodContext::recGetIntConfigValue(const wchar_t *name, int defaultValue, int result)
+void MethodContext::recGetIntConfigValue(const wchar_t* name, int defaultValue, int result)
{
if (GetIntConfigValue == nullptr)
GetIntConfigValue = new LightWeightMap<Agnostic_ConfigIntInfo, DWORD>();
@@ -6321,9 +6551,10 @@ void MethodContext::recGetIntConfigValue(const wchar_t *name, int defaultValue,
Agnostic_ConfigIntInfo key;
ZeroMemory(&key, sizeof(Agnostic_ConfigIntInfo));
- DWORD index = (DWORD)GetIntConfigValue->AddBuffer((unsigned char*)name, sizeof(wchar_t) * ((unsigned int)wcslen(name) + 1));
+ DWORD index =
+ (DWORD)GetIntConfigValue->AddBuffer((unsigned char*)name, sizeof(wchar_t) * ((unsigned int)wcslen(name) + 1));
- key.nameIndex = index;
+ key.nameIndex = index;
key.defaultValue = defaultValue;
GetIntConfigValue->Add(key, result);
@@ -6332,13 +6563,12 @@ void MethodContext::recGetIntConfigValue(const wchar_t *name, int defaultValue,
void MethodContext::dmpGetIntConfigValue(const Agnostic_ConfigIntInfo& key, int value)
{
- const wchar_t *name = (const wchar_t*)GetIntConfigValue->GetBuffer(key.nameIndex);
- printf("GetIntConfigValue name %S, default value %d, value %d",
- name, key.defaultValue, value);
+ const wchar_t* name = (const wchar_t*)GetIntConfigValue->GetBuffer(key.nameIndex);
+ printf("GetIntConfigValue name %S, default value %d, value %d", name, key.defaultValue, value);
GetIntConfigValue->Unlock();
}
-int MethodContext::repGetIntConfigValue(const wchar_t *name, int defaultValue)
+int MethodContext::repGetIntConfigValue(const wchar_t* name, int defaultValue)
{
if (GetIntConfigValue == nullptr)
return defaultValue;
@@ -6349,11 +6579,11 @@ int MethodContext::repGetIntConfigValue(const wchar_t *name, int defaultValue)
ZeroMemory(&key, sizeof(Agnostic_ConfigIntInfo));
size_t nameLenInBytes = sizeof(wchar_t) * (wcslen(name) + 1);
- int nameIndex = GetIntConfigValue->Contains((unsigned char *)name, (unsigned int)nameLenInBytes);
- if (nameIndex == -1) // config name not in map
+ int nameIndex = GetIntConfigValue->Contains((unsigned char*)name, (unsigned int)nameLenInBytes);
+ if (nameIndex == -1) // config name not in map
return defaultValue;
- key.nameIndex = (DWORD)nameIndex;
+ key.nameIndex = (DWORD)nameIndex;
key.defaultValue = defaultValue;
DWORD result = GetIntConfigValue->Get(key);
@@ -6361,18 +6591,20 @@ int MethodContext::repGetIntConfigValue(const wchar_t *name, int defaultValue)
return (int)result;
}
-void MethodContext::recGetStringConfigValue(const wchar_t *name, const wchar_t *result)
+void MethodContext::recGetStringConfigValue(const wchar_t* name, const wchar_t* result)
{
if (GetStringConfigValue == nullptr)
GetStringConfigValue = new LightWeightMap<DWORD, DWORD>();
AssertCodeMsg(name != nullptr, EXCEPTIONCODE_MC, "Name can not be nullptr");
- DWORD nameIndex = (DWORD)GetStringConfigValue->AddBuffer((unsigned char*)name, sizeof(wchar_t) * ((unsigned int)wcslen(name) + 1));
+ DWORD nameIndex = (DWORD)GetStringConfigValue->AddBuffer((unsigned char*)name,
+ sizeof(wchar_t) * ((unsigned int)wcslen(name) + 1));
DWORD resultIndex = (DWORD)-1;
if (result != nullptr)
- resultIndex = (DWORD)GetStringConfigValue->AddBuffer((unsigned char*)result, sizeof(wchar_t) * ((unsigned int)wcslen(result) + 1));
+ resultIndex = (DWORD)GetStringConfigValue->AddBuffer((unsigned char*)result,
+ sizeof(wchar_t) * ((unsigned int)wcslen(result) + 1));
GetStringConfigValue->Add(nameIndex, resultIndex);
DEBUG_REC(dmpGetStringConfigValue(nameIndex, resultIndex));
@@ -6380,13 +6612,13 @@ void MethodContext::recGetStringConfigValue(const wchar_t *name, const wchar_t *
void MethodContext::dmpGetStringConfigValue(DWORD nameIndex, DWORD resultIndex)
{
- const wchar_t *name = (const wchar_t*)GetStringConfigValue->GetBuffer(nameIndex);
- const wchar_t *result = (const wchar_t*)GetStringConfigValue->GetBuffer(resultIndex);
+ const wchar_t* name = (const wchar_t*)GetStringConfigValue->GetBuffer(nameIndex);
+ const wchar_t* result = (const wchar_t*)GetStringConfigValue->GetBuffer(resultIndex);
printf("GetStringConfigValue name %S, result %S", name, result);
GetStringConfigValue->Unlock();
}
-const wchar_t *MethodContext::repGetStringConfigValue(const wchar_t *name)
+const wchar_t* MethodContext::repGetStringConfigValue(const wchar_t* name)
{
if (GetStringConfigValue == nullptr)
return nullptr;
@@ -6394,12 +6626,12 @@ const wchar_t *MethodContext::repGetStringConfigValue(const wchar_t *name)
AssertCodeMsg(name != nullptr, EXCEPTIONCODE_MC, "Name can not be nullptr");
size_t nameLenInBytes = sizeof(wchar_t) * (wcslen(name) + 1);
- int nameIndex = GetStringConfigValue->Contains((unsigned char *)name, (unsigned int)nameLenInBytes);
- if (nameIndex == -1) // config name not in map
+ int nameIndex = GetStringConfigValue->Contains((unsigned char*)name, (unsigned int)nameLenInBytes);
+ if (nameIndex == -1) // config name not in map
return nullptr;
- int resultIndex = GetStringConfigValue->Get(nameIndex);
- const wchar_t *value = (const wchar_t *)GetStringConfigValue->GetBuffer(resultIndex);
+ int resultIndex = GetStringConfigValue->Get(nameIndex);
+ const wchar_t* value = (const wchar_t*)GetStringConfigValue->GetBuffer(resultIndex);
DEBUG_REP(dmpGetStringConfigValue(nameIndex, resultIndex));
@@ -6408,70 +6640,70 @@ const wchar_t *MethodContext::repGetStringConfigValue(const wchar_t *name)
struct EnvironmentVariable
{
- char *name;
+ char* name;
DWORD val_index;
};
-int __cdecl compareEnvironmentVariable(const void *arg1, const void *arg2)
+int __cdecl compareEnvironmentVariable(const void* arg1, const void* arg2)
{
- return _stricmp(((EnvironmentVariable *)arg1)->name, ((EnvironmentVariable *)arg2)->name);
+ return _stricmp(((EnvironmentVariable*)arg1)->name, ((EnvironmentVariable*)arg2)->name);
}
-int MethodContext::dumpMethodIdentityInfoToBuffer(char *buff, int len)
+int MethodContext::dumpMethodIdentityInfoToBuffer(char* buff, int len)
{
- char *obuff = buff;
+ char* obuff = buff;
if (len < METHOD_IDENTITY_INFO_SIZE)
return -1;
- //Obtain the Method Info structure for this method
+ // Obtain the Method Info structure for this method
CORINFO_METHOD_INFO info;
- unsigned flags = 0;
+ unsigned flags = 0;
repCompileMethod(&info, &flags);
- //Add the Method Signature
+ // Add the Method Signature
int t = sprintf_s(buff, len, "%s -- ", CallUtils::GetMethodFullName(this, info.ftn, info.args));
buff += t;
len -= t;
- //Add Calling convention information, CorInfoOptions and CorInfoRegionKind
- t = sprintf_s(buff, len, "CallingConvention: %d, CorInfoOptions: %d, CorInfoRegionKind: %d ",
- info.args.callConv, info.options, info.regionKind);
+ // Add Calling convention information, CorInfoOptions and CorInfoRegionKind
+ t = sprintf_s(buff, len, "CallingConvention: %d, CorInfoOptions: %d, CorInfoRegionKind: %d ", info.args.callConv,
+ info.options, info.regionKind);
buff += t;
len -= t;
- //Add COMPLUS_* & dbflag environment variables to method Identity
- //except complus_version and complus_defaultversion
- //since they change the compilation behaviour of JIT
- //we also need to sort them to ensure we don't produce a different
- //hash based on the order of these variables
+ // Add COMPLUS_* & dbflag environment variables to method Identity
+ //except complus_version and complus_defaultversion
+ //since they change the compilation behaviour of JIT
+ //we also need to sort them to ensure we don't produce a different
+ //hash based on the order of these variables
if (Environment != nullptr)
{
Agnostic_Environment val;
- EnvironmentVariable *envValues = new EnvironmentVariable[Environment->GetCount()];
- int envValCount = 0;
+ EnvironmentVariable* envValues = new EnvironmentVariable[Environment->GetCount()];
+ int envValCount = 0;
for (unsigned int i = 0; i < Environment->GetCount(); i++)
{
- val = Environment->Get((DWORD)i);
- char *envVariable = (char *)Environment->GetBuffer(val.name_index);
+ val = Environment->Get((DWORD)i);
+ char* envVariable = (char*)Environment->GetBuffer(val.name_index);
if ((_strnicmp(envVariable, "complus_", 8) == 0 || _strnicmp(envVariable, "dbflag", 6) == 0) &&
(_stricmp(envVariable, "complus_version") != 0) &&
(_stricmp(envVariable, "complus_defaultversion") != 0))
{
- envValues[envValCount].name = envVariable;
+ envValues[envValCount].name = envVariable;
envValues[envValCount++].val_index = val.val_index;
}
}
- //Do a quick sort on envValues if needed
+ // Do a quick sort on envValues if needed
if (envValCount > 1)
qsort(envValues, envValCount, sizeof(EnvironmentVariable), compareEnvironmentVariable);
- //Append these values to the IdentityInfobuffer
+ // Append these values to the IdentityInfobuffer
for (int i = 0; i < envValCount; i++)
{
t = sprintf_s(buff, len, "%s=%s ", _strlwr(envValues[i].name),
- _strlwr((char *)Environment->GetBuffer(envValues[i].val_index)));
+ _strlwr((char*)Environment->GetBuffer(envValues[i].val_index)));
buff += t;
len -= t;
}
@@ -6479,7 +6711,7 @@ int MethodContext::dumpMethodIdentityInfoToBuffer(char *buff, int len)
delete[] envValues;
}
- //Hash the IL Code for this method and append it to the ID info
+ // Hash the IL Code for this method and append it to the ID info
char ilHash[MD5_HASH_BUFFER_SIZE];
dumpMD5HashToBuffer(info.ILCode, info.ILCodeSize, ilHash, MD5_HASH_BUFFER_SIZE);
t = sprintf_s(buff, len, "ILCode Hash: %s", ilHash);
@@ -6488,7 +6720,7 @@ int MethodContext::dumpMethodIdentityInfoToBuffer(char *buff, int len)
return (int)(buff - obuff);
}
-int MethodContext::dumpMethodMD5HashToBuffer(char *buff, int len)
+int MethodContext::dumpMethodMD5HashToBuffer(char* buff, int len)
{
char bufferIdentityInfo[METHOD_IDENTITY_INFO_SIZE];
@@ -6497,17 +6729,17 @@ int MethodContext::dumpMethodMD5HashToBuffer(char *buff, int len)
if (cbLen < 0)
return cbLen;
- cbLen = dumpMD5HashToBuffer((BYTE *)bufferIdentityInfo, cbLen, buff, len);
+ cbLen = dumpMD5HashToBuffer((BYTE*)bufferIdentityInfo, cbLen, buff, len);
return cbLen;
}
-int MethodContext::dumpMD5HashToBuffer(BYTE *pBuffer, int bufLen, char *hash, int hashLen)
+int MethodContext::dumpMD5HashToBuffer(BYTE* pBuffer, int bufLen, char* hash, int hashLen)
{
#ifdef FEATURE_PAL
MD5HASHDATA md5_hashdata;
- MD5 md5_hasher;
+ MD5 md5_hasher;
if (hashLen < MD5_HASH_BUFFER_SIZE)
return -1;
@@ -6522,14 +6754,14 @@ int MethodContext::dumpMD5HashToBuffer(BYTE *pBuffer, int bufLen, char *hash, in
sprintf_s(hash + i * 2, hashLen - i * 2, "%02X", md5_hashdata.rgb[i]);
}
- return MD5_HASH_BUFFER_SIZE; //if we had success we wrote MD5_HASH_BUFFER_SIZE bytes to the buffer
+ return MD5_HASH_BUFFER_SIZE; // if we had success we wrote MD5_HASH_BUFFER_SIZE bytes to the buffer
#else // !FEATURE_PAL
- HCRYPTPROV hProv = NULL; //CryptoProvider
+ HCRYPTPROV hProv = NULL; // CryptoProvider
HCRYPTHASH hHash = NULL;
- BYTE bHash[MD5_HASH_BYTE_SIZE];
- DWORD cbHash = MD5_HASH_BYTE_SIZE;
+ BYTE bHash[MD5_HASH_BYTE_SIZE];
+ DWORD cbHash = MD5_HASH_BYTE_SIZE;
if (hashLen < MD5_HASH_BUFFER_SIZE)
return -1;
@@ -6560,7 +6792,7 @@ int MethodContext::dumpMD5HashToBuffer(BYTE *pBuffer, int bufLen, char *hash, in
if (hProv != NULL)
CryptReleaseContext(hProv, 0);
- return MD5_HASH_BUFFER_SIZE; //if we had success we wrote MD5_HASH_BUFFER_SIZE bytes to the buffer
+ return MD5_HASH_BUFFER_SIZE; // if we had success we wrote MD5_HASH_BUFFER_SIZE bytes to the buffer
OnError:
AssertMsg(false, "Failed to create a hash using the Crypto API (Error %X)", GetLastError());
diff --git a/src/ToolBox/superpmi/superpmi-shared/methodcontext.h b/src/ToolBox/superpmi/superpmi-shared/methodcontext.h
index b2224d91ae..f7c0e164ca 100644
--- a/src/ToolBox/superpmi/superpmi-shared/methodcontext.h
+++ b/src/ToolBox/superpmi/superpmi-shared/methodcontext.h
@@ -15,10 +15,10 @@
#include "lightweightmap.h"
#include "errorhandling.h"
-#define METHOD_IDENTITY_INFO_SIZE 0x10000 //We assume that the METHOD_IDENTITY_INFO_SIZE will not exceed 64KB
+#define METHOD_IDENTITY_INFO_SIZE 0x10000 // We assume that the METHOD_IDENTITY_INFO_SIZE will not exceed 64KB
-#define MD5_HASH_BYTE_SIZE 16 //MD5 is 128-bit, so we need 16 bytes to store it
-#define MD5_HASH_BUFFER_SIZE 33 //MD5 is 128-bit, so we need 32 chars + 1 char to store null-terminator
+#define MD5_HASH_BYTE_SIZE 16 // MD5 is 128-bit, so we need 16 bytes to store it
+#define MD5_HASH_BUFFER_SIZE 33 // MD5 is 128-bit, so we need 32 chars + 1 char to store null-terminator
class MethodContext
{
@@ -26,46 +26,46 @@ public:
#pragma pack(push, 1)
struct Agnostic_CORINFO_SIG_INFO
{
- 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_CORINFO_METHOD_INFO
{
- DWORDLONG ftn;
- DWORDLONG scope;
- DWORD ILCode_offset;
- DWORD ILCodeSize;
- DWORD maxStack;
- DWORD EHcount;
- DWORD options;
- DWORD regionKind;
+ DWORDLONG ftn;
+ DWORDLONG scope;
+ DWORD ILCode_offset;
+ DWORD ILCodeSize;
+ DWORD maxStack;
+ DWORD EHcount;
+ DWORD options;
+ DWORD regionKind;
Agnostic_CORINFO_SIG_INFO args;
Agnostic_CORINFO_SIG_INFO locals;
};
struct Agnostic_CompileMethod
{
Agnostic_CORINFO_METHOD_INFO info;
- DWORD flags;
+ DWORD flags;
};
struct Agnostic_InitClass
{
DWORDLONG field;
DWORDLONG method;
DWORDLONG context;
- DWORD speculative;
+ DWORD speculative;
};
struct DLDL
{
@@ -87,35 +87,35 @@ public:
struct DLD
{
DWORDLONG A;
- DWORD B;
+ DWORD B;
};
struct Agnostic_CORINFO_RESOLVED_TOKENin
{
DWORDLONG tokenContext;
DWORDLONG tokenScope;
- DWORD token;
- DWORD tokenType;
+ DWORD token;
+ DWORD tokenType;
};
struct Agnostic_CORINFO_RESOLVED_TOKENout
{
DWORDLONG hClass;
DWORDLONG hMethod;
DWORDLONG hField;
- DWORD pTypeSpec_Index;
- DWORD cbTypeSpec;
- DWORD pMethodSpec_Index;
- DWORD cbMethodSpec;
- DWORD exceptionCode;
+ DWORD pTypeSpec_Index;
+ DWORD cbTypeSpec;
+ DWORD pMethodSpec_Index;
+ DWORD cbMethodSpec;
+ DWORD exceptionCode;
};
struct Agnostic_GetArgType
{
Agnostic_CORINFO_SIG_INFO sig;
- DWORDLONG args;
+ DWORDLONG args;
};
struct Agnostic_GetArgClass
{
Agnostic_CORINFO_SIG_INFO sig;
- DWORDLONG args;
+ DWORDLONG args;
};
struct Agnostic_GetBoundaries
{
@@ -135,8 +135,7 @@ public:
DWORD offsetOfCalleeSavedFP;
DWORD offsetOfCallTarget;
DWORD offsetOfReturnAddress;
- }
- inlinedCallFrameInfo;
+ } inlinedCallFrameInfo;
DWORD offsetOfThreadFrame;
DWORD offsetOfGCState;
DWORD offsetOfDelegateInstance;
@@ -158,48 +157,48 @@ public:
{
DWORDLONG ppIndirection;
DWORDLONG fieldAddress;
- DWORD fieldValue;
+ DWORD fieldValue;
};
struct Agnostic_CORINFO_RESOLVED_TOKEN
{
DWORDLONG tokenContext;
DWORDLONG tokenScope;
- DWORD token;
- DWORD tokenType;
+ DWORD token;
+ DWORD tokenType;
DWORDLONG hClass;
DWORDLONG hMethod;
DWORDLONG hField;
- DWORD typeSpec_Index;
- DWORD cbTypeSpec;
- DWORD methodSpec_Index;
- DWORD cbMethodSpec;
+ DWORD typeSpec_Index;
+ DWORD cbTypeSpec;
+ DWORD methodSpec_Index;
+ DWORD cbMethodSpec;
};
struct Agnostic_GetFieldInfo
{
Agnostic_CORINFO_RESOLVED_TOKEN ResolvedToken;
- DWORDLONG callerHandle;
- DWORD flags;
+ DWORDLONG callerHandle;
+ DWORD flags;
};
struct Agnostic_CORINFO_HELPER_ARG
{
- DWORDLONG constant; //one view of a large union of ptr size
- DWORD argType;
+ DWORDLONG constant; // one view of a large union of ptr size
+ DWORD argType;
};
struct Agnostic_CORINFO_HELPER_DESC
{
- DWORD helperNum;
- DWORD numArgs;
+ DWORD helperNum;
+ DWORD numArgs;
Agnostic_CORINFO_HELPER_ARG args[CORINFO_ACCESS_ALLOWED_MAX_ARGS];
};
struct Agnostic_CORINFO_FIELD_INFO
{
- DWORD fieldAccessor;
- DWORD fieldFlags;
- DWORD helper;
- DWORD offset;
- DWORD fieldType;
- DWORDLONG structType;
- DWORD accessAllowed;
+ DWORD fieldAccessor;
+ DWORD fieldFlags;
+ DWORD helper;
+ DWORD offset;
+ DWORD fieldType;
+ DWORDLONG structType;
+ DWORD accessAllowed;
Agnostic_CORINFO_HELPER_DESC accessCalloutHelper;
};
struct DD
@@ -212,81 +211,83 @@ public:
DWORDLONG callerHnd;
DWORDLONG declaredCalleeHnd;
DWORDLONG exactCalleeHnd;
- WORD fIsTailPrefix;
+ WORD fIsTailPrefix;
};
struct Agnostic_Environment
{
- DWORD name_index;;
+ DWORD name_index;
+ ;
DWORD val_index;
};
struct Agnostic_GetCallInfo
{
Agnostic_CORINFO_RESOLVED_TOKEN ResolvedToken;
Agnostic_CORINFO_RESOLVED_TOKEN ConstrainedResolvedToken;
- DWORDLONG callerHandle;
- DWORD flags;
+ DWORDLONG callerHandle;
+ DWORD flags;
};
struct Agnostic_CORINFO_LOOKUP_KIND
{
DWORD needsRuntimeLookup;
DWORD runtimeLookupKind;
- WORD runtimeLookupFlags;
+ WORD runtimeLookupFlags;
};
struct Agnostic_CORINFO_RUNTIME_LOOKUP
{
DWORDLONG signature;
- DWORD helper;
- DWORD indirections;
- DWORD testForNull;
- DWORD testForFixup;
+ DWORD helper;
+ DWORD indirections;
+ DWORD testForNull;
+ DWORD testForFixup;
DWORDLONG offsets[CORINFO_MAXINDIRECTIONS];
};
struct Agnostic_CORINFO_CONST_LOOKUP
{
- DWORD accessType;
- DWORDLONG handle; // actually a union of two pointer sized things
+ DWORD accessType;
+ DWORDLONG handle; // actually a union of two pointer sized things
};
struct Agnostic_CORINFO_LOOKUP
{
- Agnostic_CORINFO_LOOKUP_KIND lookupKind;
- Agnostic_CORINFO_RUNTIME_LOOKUP runtimeLookup; //This and constLookup actually a union, but with different layouts.. :-| copy the right one based on lookupKinds value
- Agnostic_CORINFO_CONST_LOOKUP constLookup;
+ Agnostic_CORINFO_LOOKUP_KIND lookupKind;
+ Agnostic_CORINFO_RUNTIME_LOOKUP runtimeLookup; // This and constLookup actually a union, but with different
+ // layouts.. :-| copy the right one based on lookupKinds value
+ Agnostic_CORINFO_CONST_LOOKUP constLookup;
};
struct Agnostic_CORINFO_CALL_INFO
{
- DWORDLONG hMethod;
- DWORD methodFlags;
- DWORD classFlags;
- Agnostic_CORINFO_SIG_INFO sig;
- DWORD verMethodFlags;
- Agnostic_CORINFO_SIG_INFO verSig;
- DWORD accessAllowed;
- Agnostic_CORINFO_HELPER_DESC callsiteCalloutHelper;
- DWORD thisTransform;
- DWORD kind;
- DWORD nullInstanceCheck;
- DWORDLONG contextHandle;
- DWORD exactContextNeedsRuntimeLookup;
- Agnostic_CORINFO_LOOKUP stubLookup;//first view of union. others are matching or subordinate
+ DWORDLONG hMethod;
+ DWORD methodFlags;
+ DWORD classFlags;
+ Agnostic_CORINFO_SIG_INFO sig;
+ DWORD verMethodFlags;
+ Agnostic_CORINFO_SIG_INFO verSig;
+ DWORD accessAllowed;
+ Agnostic_CORINFO_HELPER_DESC callsiteCalloutHelper;
+ DWORD thisTransform;
+ DWORD kind;
+ DWORD nullInstanceCheck;
+ DWORDLONG contextHandle;
+ DWORD exactContextNeedsRuntimeLookup;
+ Agnostic_CORINFO_LOOKUP stubLookup; // first view of union. others are matching or subordinate
Agnostic_CORINFO_CONST_LOOKUP instParamLookup;
- DWORD secureDelegateInvoke;
- DWORD exceptionCode;
+ DWORD secureDelegateInvoke;
+ DWORD exceptionCode;
};
struct Agnostic_GetMethodInfo
{
Agnostic_CORINFO_METHOD_INFO info;
- bool result;
- DWORD exceptionCode;
+ bool result;
+ DWORD exceptionCode;
};
struct Agnostic_FindSig
{
DWORDLONG module;
- DWORD sigTOK;
+ DWORD sigTOK;
DWORDLONG context;
};
struct Agnostic_PInvokeMarshalingRequired
{
- DWORDLONG method;
+ DWORDLONG method;
Agnostic_CORINFO_SIG_INFO callSiteSig;
};
struct Agnostic_CORINFO_EH_CLAUSE
@@ -296,7 +297,7 @@ public:
DWORD TryLength;
DWORD HandlerOffset;
DWORD HandlerLength;
- DWORD ClassToken;//first view of a two dword union
+ DWORD ClassToken; // first view of a two dword union
};
struct Agnostic_GetVars
{
@@ -307,12 +308,12 @@ public:
struct Agnostic_CanAccessClassIn
{
Agnostic_CORINFO_RESOLVED_TOKEN ResolvedToken;
- DWORDLONG callerHandle;
+ DWORDLONG callerHandle;
};
struct Agnostic_CanAccessClassOut
{
Agnostic_CORINFO_HELPER_DESC AccessHelper;
- DWORD result;
+ DWORD result;
};
struct Agnostic_AppendClassName
{
@@ -324,20 +325,20 @@ public:
struct Agnostic_CheckMethodModifier
{
DWORDLONG hMethod;
- DWORD modifier;
- DWORD fOptional;
+ DWORD modifier;
+ DWORD fOptional;
};
struct Agnostic_EmbedGenericHandle
{
Agnostic_CORINFO_RESOLVED_TOKEN ResolvedToken;
- DWORD fEmbedParent;
+ DWORD fEmbedParent;
};
struct Agnostic_CORINFO_GENERICHANDLE_RESULT
{
Agnostic_CORINFO_LOOKUP lookup;
- DWORDLONG compileTimeHandle;
- DWORD handleType;
+ DWORDLONG compileTimeHandle;
+ DWORD handleType;
};
struct Agnostic_GetDelegateCtorIn
{
@@ -355,23 +356,23 @@ public:
struct Agnostic_GetDelegateCtorOut
{
Agnostic_DelegateCtorArgs CtorData;
- DWORDLONG result;
+ DWORDLONG result;
};
struct Agnostic_FindCallSiteSig
{
DWORDLONG module;
- DWORD methTok;
+ DWORD methTok;
DWORDLONG context;
};
struct Agnostic_GetNewHelper
{
Agnostic_CORINFO_RESOLVED_TOKEN ResolvedToken;
- DWORDLONG callerHandle;
+ DWORDLONG callerHandle;
};
struct Agnostic_GetCastingHelper
{
Agnostic_CORINFO_RESOLVED_TOKEN ResolvedToken;
- DWORD fThrowing;
+ DWORD fThrowing;
};
struct Agnostic_GetClassModuleIdForStatics
{
@@ -395,25 +396,25 @@ public:
};
struct Agnostic_GetProfilingHandle
{
- DWORD bHookFunction;
+ DWORD bHookFunction;
DWORDLONG ProfilerHandle;
- DWORD bIndirectedHandles;
+ DWORD bIndirectedHandles;
};
struct Agnostic_GetTailCallCopyArgsThunk
{
Agnostic_CORINFO_SIG_INFO Sig;
- DWORD flags;
+ DWORD flags;
};
struct Agnostic_GetArgClass_Value
{
DWORDLONG result;
- DWORD exceptionCode;
+ DWORD exceptionCode;
};
struct Agnostic_GetArgType_Value
{
DWORDLONG vcTypeRet;
- DWORD result;
- DWORD exceptionCode;
+ DWORD result;
+ DWORD exceptionCode;
};
// Agnostic_ConfigIntInfo combines as a single key the name
@@ -428,12 +429,17 @@ public:
// SYSTEMV_AMD64_CORINFO_STRUCT_REG_PASSING_DESCRIPTOR
struct Agnostic_GetSystemVAmd64PassStructInRegisterDescriptor
{
- DWORD passedInRegisters; // Whether the struct is passable/passed (this includes struct returning) in registers.
- DWORD eightByteCount; // Number of eightbytes for this struct.
- DWORD eightByteClassifications[CLR_SYSTEMV_MAX_EIGHTBYTES_COUNT_TO_PASS_IN_REGISTERS]; // The eightbytes type classification.
- DWORD eightByteSizes[CLR_SYSTEMV_MAX_EIGHTBYTES_COUNT_TO_PASS_IN_REGISTERS]; // The size of the eightbytes (an eightbyte could include padding. This represents the no padding size of the eightbyte).
- DWORD eightByteOffsets[CLR_SYSTEMV_MAX_EIGHTBYTES_COUNT_TO_PASS_IN_REGISTERS]; // The start offset of the eightbytes (in bytes).
- DWORD result;
+ DWORD passedInRegisters; // Whether the struct is passable/passed (this includes struct returning) in registers.
+ DWORD eightByteCount; // Number of eightbytes for this struct.
+ DWORD eightByteClassifications[CLR_SYSTEMV_MAX_EIGHTBYTES_COUNT_TO_PASS_IN_REGISTERS]; // The eightbytes type
+ // classification.
+ DWORD eightByteSizes[CLR_SYSTEMV_MAX_EIGHTBYTES_COUNT_TO_PASS_IN_REGISTERS]; // The size of the eightbytes (an
+ // eightbyte could include padding.
+ // This represents the no padding
+ // size of the eightbyte).
+ DWORD eightByteOffsets[CLR_SYSTEMV_MAX_EIGHTBYTES_COUNT_TO_PASS_IN_REGISTERS]; // The start offset of the
+ // eightbytes (in bytes).
+ DWORD result;
};
struct Agnostic_ResolveVirtualMethod
@@ -448,36 +454,35 @@ public:
MethodContext();
private:
-
MethodContext(HANDLE hFile);
- MethodContext(unsigned char *buff, unsigned int totalLen);
+ MethodContext(unsigned char* buff, unsigned int totalLen);
- void MethodInitHelper(unsigned char *buff, unsigned int totalLen);
+ void MethodInitHelper(unsigned char* buff, unsigned int totalLen);
void MethodInitHelperFile(HANDLE hFile);
bool Initialize(int loadedCount, unsigned char* buff, DWORD size);
bool Initialize(int loadedCount, HANDLE hFile);
- int dumpMD5HashToBuffer(BYTE *pBuffer, int bufLen, char *buff, int len);
+ int dumpMD5HashToBuffer(BYTE* pBuffer, int bufLen, char* buff, int len);
public:
-
static bool Initialize(int loadedCount, unsigned char* buff, DWORD size, /* OUT */ MethodContext** ppmc);
static bool Initialize(int loadedCount, HANDLE hFile, /* OUT */ MethodContext** ppmc);
~MethodContext();
void Destroy();
- bool Equal(MethodContext *other);
+ bool Equal(MethodContext* other);
unsigned int saveToFile(HANDLE hFile);
unsigned int calculateFileSize();
unsigned int calculateRawFileSize();
- void dumpToConsole(int mcNumber = -1); // if mcNumber is not -1, display the method context number before the dumped info
- int dumpStatToBuffer(char *buff, int len);
- static int dumpStatTitleToBuffer(char *buff, int len);
+ void dumpToConsole(int mcNumber = -1); // if mcNumber is not -1, display the method context number before the dumped
+ // info
+ int dumpStatToBuffer(char* buff, int len);
+ static int dumpStatTitleToBuffer(char* buff, int len);
int methodSize;
- int dumpMethodIdentityInfoToBuffer(char *buff, int len);
- int dumpMethodMD5HashToBuffer(char *buff, int len);
+ int dumpMethodIdentityInfoToBuffer(char* buff, int len);
+ int dumpMethodMD5HashToBuffer(char* buff, int len);
void recGlobalContext(const MethodContext& other);
@@ -485,12 +490,12 @@ public:
void dmpEnvironment(DWORD key, const Agnostic_Environment& value);
void repEnvironmentSet();
void repEnvironmentUnset();
- int repEnvironmentGetCount();
- int repGetTestID();
+ int repEnvironmentGetCount();
+ int repGetTestID();
- void recCompileMethod(CORINFO_METHOD_INFO *info, unsigned flags);
+ void recCompileMethod(CORINFO_METHOD_INFO* info, unsigned flags);
void dmpCompileMethod(DWORD key, const Agnostic_CompileMethod& value);
- void repCompileMethod(CORINFO_METHOD_INFO *info, unsigned *flags);
+ void repCompileMethod(CORINFO_METHOD_INFO* info, unsigned* flags);
void recGetMethodClass(CORINFO_METHOD_HANDLE methodHandle, CORINFO_CLASS_HANDLE classHandle);
void dmpGetMethodClass(DWORDLONG key, DWORDLONG value);
@@ -504,48 +509,77 @@ public:
void dmpGetMethodAttribs(DWORDLONG key, DWORD value);
DWORD repGetMethodAttribs(CORINFO_METHOD_HANDLE methodHandle);
- void recGetVars(CORINFO_METHOD_HANDLE ftn, ULONG32 *cVars, ICorDebugInfo::ILVarInfo **vars, bool *extendOthers);
+ void recGetVars(CORINFO_METHOD_HANDLE ftn, ULONG32* cVars, ICorDebugInfo::ILVarInfo** vars, bool* extendOthers);
void dmpGetVars(DWORDLONG key, const Agnostic_GetVars& value);
- void repGetVars(CORINFO_METHOD_HANDLE ftn, ULONG32 *cVars, ICorDebugInfo::ILVarInfo **vars, bool *extendOthers);
+ void repGetVars(CORINFO_METHOD_HANDLE ftn, ULONG32* cVars, ICorDebugInfo::ILVarInfo** vars, bool* extendOthers);
- void recGetBoundaries(CORINFO_METHOD_HANDLE ftn, unsigned int *cILOffsets, DWORD **pILOffsets, ICorDebugInfo::BoundaryTypes *implictBoundaries);
+ void recGetBoundaries(CORINFO_METHOD_HANDLE ftn,
+ unsigned int* cILOffsets,
+ DWORD** pILOffsets,
+ ICorDebugInfo::BoundaryTypes* implictBoundaries);
void dmpGetBoundaries(DWORDLONG key, const Agnostic_GetBoundaries& value);
- void repGetBoundaries(CORINFO_METHOD_HANDLE ftn, unsigned int *cILOffsets, DWORD **pILOffsets, ICorDebugInfo::BoundaryTypes *implictBoundaries);
-
- void recInitClass(CORINFO_FIELD_HANDLE field, CORINFO_METHOD_HANDLE method, CORINFO_CONTEXT_HANDLE context, BOOL speculative, CorInfoInitClassResult result);
+ void repGetBoundaries(CORINFO_METHOD_HANDLE ftn,
+ unsigned int* cILOffsets,
+ DWORD** pILOffsets,
+ ICorDebugInfo::BoundaryTypes* implictBoundaries);
+
+ void recInitClass(CORINFO_FIELD_HANDLE field,
+ CORINFO_METHOD_HANDLE method,
+ CORINFO_CONTEXT_HANDLE context,
+ BOOL speculative,
+ CorInfoInitClassResult result);
void dmpInitClass(const Agnostic_InitClass& key, DWORD value);
- CorInfoInitClassResult repInitClass(CORINFO_FIELD_HANDLE field, CORINFO_METHOD_HANDLE method, CORINFO_CONTEXT_HANDLE context, BOOL speculative);
+ CorInfoInitClassResult repInitClass(CORINFO_FIELD_HANDLE field,
+ CORINFO_METHOD_HANDLE method,
+ CORINFO_CONTEXT_HANDLE context,
+ BOOL speculative);
- void recGetMethodName(CORINFO_METHOD_HANDLE ftn, char *methodname, const char **moduleName);
+ void recGetMethodName(CORINFO_METHOD_HANDLE ftn, char* methodname, const char** moduleName);
void dmpGetMethodName(DLD key, DD value);
- const char *repGetMethodName(CORINFO_METHOD_HANDLE ftn, const char **moduleName);
+ const char* repGetMethodName(CORINFO_METHOD_HANDLE ftn, const char** moduleName);
- void recGetJitFlags(CORJIT_FLAGS *jitFlags, DWORD sizeInBytes, DWORD result);
+ void recGetJitFlags(CORJIT_FLAGS* jitFlags, DWORD sizeInBytes, DWORD result);
void dmpGetJitFlags(DWORD key, DD value);
- DWORD repGetJitFlags(CORJIT_FLAGS *jitFlags, DWORD sizeInBytes);
+ DWORD repGetJitFlags(CORJIT_FLAGS* jitFlags, DWORD sizeInBytes);
void recGetJitTimeLogFilename(LPCWSTR tempFileName);
void dmpGetJitTimeLogFilename(DWORD key, DWORD value);
LPCWSTR repGetJitTimeLogFilename();
- void recCanInline(CORINFO_METHOD_HANDLE callerHnd, CORINFO_METHOD_HANDLE calleeHnd, DWORD *pRestrictions, CorInfoInline response, DWORD exceptionCode);
+ void recCanInline(CORINFO_METHOD_HANDLE callerHnd,
+ CORINFO_METHOD_HANDLE calleeHnd,
+ DWORD* pRestrictions,
+ CorInfoInline response,
+ DWORD exceptionCode);
void dmpCanInline(DLDL key, const Agnostic_CanInline& value);
- CorInfoInline repCanInline(CORINFO_METHOD_HANDLE callerHnd, CORINFO_METHOD_HANDLE calleeHnd, DWORD* pRestrictions, DWORD *exceptionCode);
+ CorInfoInline repCanInline(CORINFO_METHOD_HANDLE callerHnd,
+ CORINFO_METHOD_HANDLE calleeHnd,
+ DWORD* pRestrictions,
+ DWORD* exceptionCode);
- void recResolveToken(CORINFO_RESOLVED_TOKEN * pResolvedToken, DWORD exceptionCode);
+ void recResolveToken(CORINFO_RESOLVED_TOKEN* pResolvedToken, DWORD exceptionCode);
void dmpResolveToken(const Agnostic_CORINFO_RESOLVED_TOKENin& key, const Agnostic_CORINFO_RESOLVED_TOKENout& value);
- void repResolveToken(CORINFO_RESOLVED_TOKEN * pResolvedToken, DWORD *exceptionCode);
-
- void recTryResolveToken(CORINFO_RESOLVED_TOKEN * pResolvedToken, bool success);
- void dmpTryResolveToken(const Agnostic_CORINFO_RESOLVED_TOKENin& key, const Agnostic_CORINFO_RESOLVED_TOKENout& value);
- bool repTryResolveToken(CORINFO_RESOLVED_TOKEN * pResolvedToken);
-
- void recGetCallInfo(CORINFO_RESOLVED_TOKEN *pResolvedToken, CORINFO_RESOLVED_TOKEN *pConstrainedResolvedToken,
- CORINFO_METHOD_HANDLE callerHandle, CORINFO_CALLINFO_FLAGS flags, CORINFO_CALL_INFO *pResult, DWORD exceptionCode);
+ void repResolveToken(CORINFO_RESOLVED_TOKEN* pResolvedToken, DWORD* exceptionCode);
+
+ void recTryResolveToken(CORINFO_RESOLVED_TOKEN* pResolvedToken, bool success);
+ void dmpTryResolveToken(const Agnostic_CORINFO_RESOLVED_TOKENin& key,
+ const Agnostic_CORINFO_RESOLVED_TOKENout& value);
+ bool repTryResolveToken(CORINFO_RESOLVED_TOKEN* pResolvedToken);
+
+ void recGetCallInfo(CORINFO_RESOLVED_TOKEN* pResolvedToken,
+ CORINFO_RESOLVED_TOKEN* pConstrainedResolvedToken,
+ CORINFO_METHOD_HANDLE callerHandle,
+ CORINFO_CALLINFO_FLAGS flags,
+ CORINFO_CALL_INFO* pResult,
+ DWORD exceptionCode);
void dmpGetCallInfo(const Agnostic_GetCallInfo& key, const Agnostic_CORINFO_CALL_INFO& value);
- void repGetCallInfo(CORINFO_RESOLVED_TOKEN *pResolvedToken, CORINFO_RESOLVED_TOKEN *pConstrainedResolvedToken,
- CORINFO_METHOD_HANDLE callerHandle, CORINFO_CALLINFO_FLAGS flags, CORINFO_CALL_INFO *pResult, DWORD *exceptionCode);
- void repGetCallInfoFromMethodHandle(CORINFO_METHOD_HANDLE methodHandle, CORINFO_CALL_INFO *pResult);
+ void repGetCallInfo(CORINFO_RESOLVED_TOKEN* pResolvedToken,
+ CORINFO_RESOLVED_TOKEN* pConstrainedResolvedToken,
+ CORINFO_METHOD_HANDLE callerHandle,
+ CORINFO_CALLINFO_FLAGS flags,
+ CORINFO_CALL_INFO* pResult,
+ DWORD* exceptionCode);
+ void repGetCallInfoFromMethodHandle(CORINFO_METHOD_HANDLE methodHandle, CORINFO_CALL_INFO* pResult);
void recGetIntrinsicID(CORINFO_METHOD_HANDLE method, bool* pMustExpand, CorInfoIntrinsics result);
void dmpGetIntrinsicID(DWORDLONG key, DD value);
@@ -593,7 +627,7 @@ public:
void recGetTypeForBox(CORINFO_CLASS_HANDLE cls, CORINFO_CLASS_HANDLE result);
void dmpGetTypeForBox(DWORDLONG key, DWORDLONG value);
- CORINFO_CLASS_HANDLE repGetTypeForBox(CORINFO_CLASS_HANDLE cls);
+ CORINFO_CLASS_HANDLE repGetTypeForBox(CORINFO_CLASS_HANDLE cls);
void recGetBoxHelper(CORINFO_CLASS_HANDLE cls, CorInfoHelpFunc result);
void dmpGetBoxHelper(DWORDLONG key, DWORD value);
@@ -635,187 +669,257 @@ public:
void dmpGetUnBoxHelper(DWORDLONG key, DWORD value);
CorInfoHelpFunc repGetUnBoxHelper(CORINFO_CLASS_HANDLE cls);
- void recGetReadyToRunHelper(CORINFO_RESOLVED_TOKEN* pResolvedToken, CORINFO_LOOKUP_KIND* pGenericLookupKind, CorInfoHelpFunc id, CORINFO_CONST_LOOKUP* pLookup, bool result);
+ void recGetReadyToRunHelper(CORINFO_RESOLVED_TOKEN* pResolvedToken,
+ CORINFO_LOOKUP_KIND* pGenericLookupKind,
+ CorInfoHelpFunc id,
+ CORINFO_CONST_LOOKUP* pLookup,
+ bool result);
void dmpGetReadyToRunHelper(DWORDLONG key, DWORD value);
- bool repGetReadyToRunHelper(CORINFO_RESOLVED_TOKEN* pResolvedToken, CORINFO_LOOKUP_KIND* pGenericLookupKind, CorInfoHelpFunc id, CORINFO_CONST_LOOKUP* pLookup);
-
- void recGetReadyToRunDelegateCtorHelper(CORINFO_RESOLVED_TOKEN* pTargetMethod, CORINFO_CLASS_HANDLE delegateType, CORINFO_LOOKUP* pLookup);
+ bool repGetReadyToRunHelper(CORINFO_RESOLVED_TOKEN* pResolvedToken,
+ CORINFO_LOOKUP_KIND* pGenericLookupKind,
+ CorInfoHelpFunc id,
+ CORINFO_CONST_LOOKUP* pLookup);
+
+ void recGetReadyToRunDelegateCtorHelper(CORINFO_RESOLVED_TOKEN* pTargetMethod,
+ CORINFO_CLASS_HANDLE delegateType,
+ CORINFO_LOOKUP* pLookup);
void dmpGetReadyToRunDelegateCtorHelper(DWORDLONG key, DWORD value);
- void repGetReadyToRunDelegateCtorHelper(CORINFO_RESOLVED_TOKEN* pTargetMethod, CORINFO_CLASS_HANDLE delegateType, CORINFO_LOOKUP* pLookup);
+ void repGetReadyToRunDelegateCtorHelper(CORINFO_RESOLVED_TOKEN* pTargetMethod,
+ CORINFO_CLASS_HANDLE delegateType,
+ CORINFO_LOOKUP* pLookup);
- void recGetHelperFtn(CorInfoHelpFunc ftnNum, void **ppIndirection, void *result);
+ void recGetHelperFtn(CorInfoHelpFunc ftnNum, void** ppIndirection, void* result);
void dmpGetHelperFtn(DWORD key, DLDL value);
- void* repGetHelperFtn(CorInfoHelpFunc ftnNum, void **ppIndirection);
- bool fndGetHelperFtn(void *functionAddress, CorInfoHelpFunc *pResult);
+ void* repGetHelperFtn(CorInfoHelpFunc ftnNum, void** ppIndirection);
+ bool fndGetHelperFtn(void* functionAddress, CorInfoHelpFunc* pResult);
- void recGetJustMyCodeHandle(CORINFO_METHOD_HANDLE method, CORINFO_JUST_MY_CODE_HANDLE **ppIndirection, CORINFO_JUST_MY_CODE_HANDLE result);
+ void recGetJustMyCodeHandle(CORINFO_METHOD_HANDLE method,
+ CORINFO_JUST_MY_CODE_HANDLE** ppIndirection,
+ CORINFO_JUST_MY_CODE_HANDLE result);
void dmpGetJustMyCodeHandle(DWORDLONG key, DLDL value);
- CORINFO_JUST_MY_CODE_HANDLE repGetJustMyCodeHandle(CORINFO_METHOD_HANDLE method, CORINFO_JUST_MY_CODE_HANDLE **ppIndirection);
+ CORINFO_JUST_MY_CODE_HANDLE repGetJustMyCodeHandle(CORINFO_METHOD_HANDLE method,
+ CORINFO_JUST_MY_CODE_HANDLE** ppIndirection);
- void recGetFunctionEntryPoint(CORINFO_METHOD_HANDLE ftn, CORINFO_CONST_LOOKUP *pResult, CORINFO_ACCESS_FLAGS accessFlags);
+ void recGetFunctionEntryPoint(CORINFO_METHOD_HANDLE ftn,
+ CORINFO_CONST_LOOKUP* pResult,
+ CORINFO_ACCESS_FLAGS accessFlags);
void dmpGetFunctionEntryPoint(DLD key, DLD value);
- void repGetFunctionEntryPoint(CORINFO_METHOD_HANDLE ftn, CORINFO_CONST_LOOKUP *pResult, CORINFO_ACCESS_FLAGS accessFlags);
- bool fndGetFunctionEntryPoint(DLD value, CORINFO_METHOD_HANDLE *pResult);
+ void repGetFunctionEntryPoint(CORINFO_METHOD_HANDLE ftn,
+ CORINFO_CONST_LOOKUP* pResult,
+ CORINFO_ACCESS_FLAGS accessFlags);
+ bool fndGetFunctionEntryPoint(DLD value, CORINFO_METHOD_HANDLE* pResult);
- void recConstructStringLiteral(CORINFO_MODULE_HANDLE module, mdToken metaTok, void *ppValue, InfoAccessType result);
+ void recConstructStringLiteral(CORINFO_MODULE_HANDLE module, mdToken metaTok, void* ppValue, InfoAccessType result);
void dmpConstructStringLiteral(DLD key, DLD value);
- InfoAccessType repConstructStringLiteral(CORINFO_MODULE_HANDLE module, mdToken metaTok, void **ppValue);
+ InfoAccessType repConstructStringLiteral(CORINFO_MODULE_HANDLE module, mdToken metaTok, void** ppValue);
- void recEmptyStringLiteral(void **ppValue, InfoAccessType result);
+ void recEmptyStringLiteral(void** ppValue, InfoAccessType result);
void dmpEmptyStringLiteral(DWORD key, DLD value);
- InfoAccessType repEmptyStringLiteral(void **ppValue);
+ InfoAccessType repEmptyStringLiteral(void** ppValue);
- void recGetArgType(CORINFO_SIG_INFO* sig, CORINFO_ARG_LIST_HANDLE args, CORINFO_CLASS_HANDLE *vcTypeRet, CorInfoTypeWithMod result, DWORD exception);
+ void recGetArgType(CORINFO_SIG_INFO* sig,
+ CORINFO_ARG_LIST_HANDLE args,
+ CORINFO_CLASS_HANDLE* vcTypeRet,
+ CorInfoTypeWithMod result,
+ DWORD exception);
void dmpGetArgType(const Agnostic_GetArgType& key, const Agnostic_GetArgType_Value& value);
- CorInfoTypeWithMod repGetArgType(CORINFO_SIG_INFO* sig, CORINFO_ARG_LIST_HANDLE args, CORINFO_CLASS_HANDLE *vcTypeRet, DWORD *exception);
+ CorInfoTypeWithMod repGetArgType(CORINFO_SIG_INFO* sig,
+ CORINFO_ARG_LIST_HANDLE args,
+ CORINFO_CLASS_HANDLE* vcTypeRet,
+ DWORD* exception);
void recGetArgNext(CORINFO_ARG_LIST_HANDLE args, CORINFO_ARG_LIST_HANDLE result);
void dmpGetArgNext(DWORDLONG key, DWORDLONG value);
CORINFO_ARG_LIST_HANDLE repGetArgNext(CORINFO_ARG_LIST_HANDLE args);
- void recGetMethodSig(CORINFO_METHOD_HANDLE ftn, CORINFO_SIG_INFO *sig, CORINFO_CLASS_HANDLE memberParent);
+ void recGetMethodSig(CORINFO_METHOD_HANDLE ftn, CORINFO_SIG_INFO* sig, CORINFO_CLASS_HANDLE memberParent);
void dmpGetMethodSig(DLDL key, const Agnostic_CORINFO_SIG_INFO& value);
- void repGetMethodSig(CORINFO_METHOD_HANDLE ftn, CORINFO_SIG_INFO *sig, CORINFO_CLASS_HANDLE memberParent);
+ void repGetMethodSig(CORINFO_METHOD_HANDLE ftn, CORINFO_SIG_INFO* sig, CORINFO_CLASS_HANDLE memberParent);
- void recGetArgClass(CORINFO_SIG_INFO* sig, CORINFO_ARG_LIST_HANDLE args, CORINFO_CLASS_HANDLE result, DWORD exceptionCode);
+ void recGetArgClass(CORINFO_SIG_INFO* sig,
+ CORINFO_ARG_LIST_HANDLE args,
+ CORINFO_CLASS_HANDLE result,
+ DWORD exceptionCode);
void dmpGetArgClass(const Agnostic_GetArgClass& key, const Agnostic_GetArgClass_Value& value);
- CORINFO_CLASS_HANDLE repGetArgClass(CORINFO_SIG_INFO* sig, CORINFO_ARG_LIST_HANDLE args, DWORD *exceptionCode);
+ CORINFO_CLASS_HANDLE repGetArgClass(CORINFO_SIG_INFO* sig, CORINFO_ARG_LIST_HANDLE args, DWORD* exceptionCode);
void recGetHFAType(CORINFO_CLASS_HANDLE clsHnd, CorInfoType result);
void dmpGetHFAType(DWORDLONG key, DWORD value);
CorInfoType repGetHFAType(CORINFO_CLASS_HANDLE clsHnd);
- void recGetMethodInfo(CORINFO_METHOD_HANDLE ftn, CORINFO_METHOD_INFO *info, bool result, DWORD exceptionCode);
+ void recGetMethodInfo(CORINFO_METHOD_HANDLE ftn, CORINFO_METHOD_INFO* info, bool result, DWORD exceptionCode);
void dmpGetMethodInfo(DWORDLONG key, const Agnostic_GetMethodInfo& value);
- bool repGetMethodInfo(CORINFO_METHOD_HANDLE ftn, CORINFO_METHOD_INFO *info, DWORD *exceptionCode);
+ bool repGetMethodInfo(CORINFO_METHOD_HANDLE ftn, CORINFO_METHOD_INFO* info, DWORD* exceptionCode);
- void recGetNewHelper(CORINFO_RESOLVED_TOKEN *pResolvedToken, CORINFO_METHOD_HANDLE callerHandle, CorInfoHelpFunc result);
+ void recGetNewHelper(CORINFO_RESOLVED_TOKEN* pResolvedToken,
+ CORINFO_METHOD_HANDLE callerHandle,
+ CorInfoHelpFunc result);
void dmpGetNewHelper(const Agnostic_GetNewHelper& key, DWORD value);
- CorInfoHelpFunc repGetNewHelper(CORINFO_RESOLVED_TOKEN *pResolvedToken, CORINFO_METHOD_HANDLE callerHandle);
-
- void recEmbedGenericHandle(CORINFO_RESOLVED_TOKEN *pResolvedToken, BOOL fEmbedParent, CORINFO_GENERICHANDLE_RESULT *pResult);
- void dmpEmbedGenericHandle(const Agnostic_EmbedGenericHandle& key, const Agnostic_CORINFO_GENERICHANDLE_RESULT& value);
- void repEmbedGenericHandle(CORINFO_RESOLVED_TOKEN *pResolvedToken, BOOL fEmbedParent, CORINFO_GENERICHANDLE_RESULT *pResult);
-
- void recGetEHinfo(CORINFO_METHOD_HANDLE ftn, unsigned EHnumber, CORINFO_EH_CLAUSE *clause);
+ CorInfoHelpFunc repGetNewHelper(CORINFO_RESOLVED_TOKEN* pResolvedToken, CORINFO_METHOD_HANDLE callerHandle);
+
+ void recEmbedGenericHandle(CORINFO_RESOLVED_TOKEN* pResolvedToken,
+ BOOL fEmbedParent,
+ CORINFO_GENERICHANDLE_RESULT* pResult);
+ void dmpEmbedGenericHandle(const Agnostic_EmbedGenericHandle& key,
+ const Agnostic_CORINFO_GENERICHANDLE_RESULT& value);
+ void repEmbedGenericHandle(CORINFO_RESOLVED_TOKEN* pResolvedToken,
+ BOOL fEmbedParent,
+ CORINFO_GENERICHANDLE_RESULT* pResult);
+
+ void recGetEHinfo(CORINFO_METHOD_HANDLE ftn, unsigned EHnumber, CORINFO_EH_CLAUSE* clause);
void dmpGetEHinfo(DLD key, const Agnostic_CORINFO_EH_CLAUSE& value);
- void repGetEHinfo(CORINFO_METHOD_HANDLE ftn, unsigned EHnumber, CORINFO_EH_CLAUSE *clause);
+ void repGetEHinfo(CORINFO_METHOD_HANDLE ftn, unsigned EHnumber, CORINFO_EH_CLAUSE* clause);
- void recGetMethodVTableOffset(CORINFO_METHOD_HANDLE method, unsigned *offsetOfIndirection, unsigned* offsetAfterIndirection);
+ void recGetMethodVTableOffset(CORINFO_METHOD_HANDLE method,
+ unsigned* offsetOfIndirection,
+ unsigned* offsetAfterIndirection);
void dmpGetMethodVTableOffset(DWORDLONG key, DD value);
- void repGetMethodVTableOffset(CORINFO_METHOD_HANDLE method, unsigned *offsetOfIndirection, unsigned* offsetAfterIndirection);
-
- void recResolveVirtualMethod(CORINFO_METHOD_HANDLE virtMethod, CORINFO_CLASS_HANDLE implClass,
- CORINFO_CONTEXT_HANDLE ownerType, CORINFO_METHOD_HANDLE result);
+ void repGetMethodVTableOffset(CORINFO_METHOD_HANDLE method,
+ unsigned* offsetOfIndirection,
+ unsigned* offsetAfterIndirection);
+
+ void recResolveVirtualMethod(CORINFO_METHOD_HANDLE virtMethod,
+ CORINFO_CLASS_HANDLE implClass,
+ CORINFO_CONTEXT_HANDLE ownerType,
+ CORINFO_METHOD_HANDLE result);
void dmpResolveVirtualMethod(const Agnostic_ResolveVirtualMethod& key, DWORDLONG value);
- CORINFO_METHOD_HANDLE repResolveVirtualMethod(CORINFO_METHOD_HANDLE virtMethod, CORINFO_CLASS_HANDLE implClass,
- CORINFO_CONTEXT_HANDLE ownerType);
+ CORINFO_METHOD_HANDLE repResolveVirtualMethod(CORINFO_METHOD_HANDLE virtMethod,
+ CORINFO_CLASS_HANDLE implClass,
+ CORINFO_CONTEXT_HANDLE ownerType);
- void recGetTokenTypeAsHandle(CORINFO_RESOLVED_TOKEN * pResolvedToken, CORINFO_CLASS_HANDLE result);
+ void recGetTokenTypeAsHandle(CORINFO_RESOLVED_TOKEN* pResolvedToken, CORINFO_CLASS_HANDLE result);
void dmpGetTokenTypeAsHandle(const Agnostic_CORINFO_RESOLVED_TOKEN& key, DWORDLONG value);
- CORINFO_CLASS_HANDLE repGetTokenTypeAsHandle(CORINFO_RESOLVED_TOKEN * pResolvedToken);
+ CORINFO_CLASS_HANDLE repGetTokenTypeAsHandle(CORINFO_RESOLVED_TOKEN* pResolvedToken);
- void recGetFieldInfo(CORINFO_RESOLVED_TOKEN *pResolvedToken, CORINFO_METHOD_HANDLE callerHandle, CORINFO_ACCESS_FLAGS flags,
- CORINFO_FIELD_INFO *pResult);
+ void recGetFieldInfo(CORINFO_RESOLVED_TOKEN* pResolvedToken,
+ CORINFO_METHOD_HANDLE callerHandle,
+ CORINFO_ACCESS_FLAGS flags,
+ CORINFO_FIELD_INFO* pResult);
void dmpGetFieldInfo(const Agnostic_GetFieldInfo& key, const Agnostic_CORINFO_FIELD_INFO& value);
- void repGetFieldInfo(CORINFO_RESOLVED_TOKEN *pResolvedToken, CORINFO_METHOD_HANDLE callerHandle, CORINFO_ACCESS_FLAGS flags,
- CORINFO_FIELD_INFO *pResult);
+ void repGetFieldInfo(CORINFO_RESOLVED_TOKEN* pResolvedToken,
+ CORINFO_METHOD_HANDLE callerHandle,
+ CORINFO_ACCESS_FLAGS flags,
+ CORINFO_FIELD_INFO* pResult);
- void recEmbedMethodHandle(CORINFO_METHOD_HANDLE handle, void **ppIndirection, CORINFO_METHOD_HANDLE result);
+ void recEmbedMethodHandle(CORINFO_METHOD_HANDLE handle, void** ppIndirection, CORINFO_METHOD_HANDLE result);
void dmpEmbedMethodHandle(DWORDLONG key, DLDL value);
- CORINFO_METHOD_HANDLE repEmbedMethodHandle(CORINFO_METHOD_HANDLE handle, void **ppIndirection);
+ CORINFO_METHOD_HANDLE repEmbedMethodHandle(CORINFO_METHOD_HANDLE handle, void** ppIndirection);
- void recGetFieldAddress(CORINFO_FIELD_HANDLE field, void **ppIndirection, void *result, CorInfoType cit);
+ void recGetFieldAddress(CORINFO_FIELD_HANDLE field, void** ppIndirection, void* result, CorInfoType cit);
void dmpGetFieldAddress(DWORDLONG key, const Agnostic_GetFieldAddress& value);
- void* repGetFieldAddress(CORINFO_FIELD_HANDLE field, void **ppIndirection);
+ void* repGetFieldAddress(CORINFO_FIELD_HANDLE field, void** ppIndirection);
- void recGetClassGClayout(CORINFO_CLASS_HANDLE cls, BYTE *gcPtrs, unsigned len, unsigned result);
+ void recGetClassGClayout(CORINFO_CLASS_HANDLE cls, BYTE* gcPtrs, unsigned len, unsigned result);
void dmpGetClassGClayout(DWORDLONG key, const Agnostic_GetClassGClayout& value);
- unsigned repGetClassGClayout(CORINFO_CLASS_HANDLE cls, BYTE *gcPtrs);
+ unsigned repGetClassGClayout(CORINFO_CLASS_HANDLE cls, BYTE* gcPtrs);
void recGetClassAlignmentRequirement(CORINFO_CLASS_HANDLE cls, BOOL fDoubleAlignHint, unsigned result);
void dmpGetClassAlignmentRequirement(DLD key, DWORD value);
unsigned repGetClassAlignmentRequirement(CORINFO_CLASS_HANDLE cls, BOOL fDoubleAlignHint);
- void recCanAccessClass(CORINFO_RESOLVED_TOKEN *pResolvedToken, CORINFO_METHOD_HANDLE callerHandle,
- CORINFO_HELPER_DESC *pAccessHelper, CorInfoIsAccessAllowedResult result);
+ void recCanAccessClass(CORINFO_RESOLVED_TOKEN* pResolvedToken,
+ CORINFO_METHOD_HANDLE callerHandle,
+ CORINFO_HELPER_DESC* pAccessHelper,
+ CorInfoIsAccessAllowedResult result);
void dmpCanAccessClass(const Agnostic_CanAccessClassIn& key, const Agnostic_CanAccessClassOut& value);
- CorInfoIsAccessAllowedResult repCanAccessClass(CORINFO_RESOLVED_TOKEN *pResolvedToken, CORINFO_METHOD_HANDLE callerHandle,
- CORINFO_HELPER_DESC *pAccessHelper);
+ CorInfoIsAccessAllowedResult repCanAccessClass(CORINFO_RESOLVED_TOKEN* pResolvedToken,
+ CORINFO_METHOD_HANDLE callerHandle,
+ CORINFO_HELPER_DESC* pAccessHelper);
- void recGetCastingHelper(CORINFO_RESOLVED_TOKEN *pResolvedToken, bool fThrowing, CorInfoHelpFunc result);
+ void recGetCastingHelper(CORINFO_RESOLVED_TOKEN* pResolvedToken, bool fThrowing, CorInfoHelpFunc result);
void dmpGetCastingHelper(const Agnostic_GetCastingHelper& key, DWORD value);
- CorInfoHelpFunc repGetCastingHelper(CORINFO_RESOLVED_TOKEN *pResolvedToken, bool fThrowing);
+ CorInfoHelpFunc repGetCastingHelper(CORINFO_RESOLVED_TOKEN* pResolvedToken, bool fThrowing);
- void recEmbedModuleHandle(CORINFO_MODULE_HANDLE handle, void **ppIndirection, CORINFO_MODULE_HANDLE result);
+ void recEmbedModuleHandle(CORINFO_MODULE_HANDLE handle, void** ppIndirection, CORINFO_MODULE_HANDLE result);
void dmpEmbedModuleHandle(DWORDLONG key, DLDL value);
- CORINFO_MODULE_HANDLE repEmbedModuleHandle(CORINFO_MODULE_HANDLE handle, void **ppIndirection);
+ CORINFO_MODULE_HANDLE repEmbedModuleHandle(CORINFO_MODULE_HANDLE handle, void** ppIndirection);
- void recEmbedClassHandle(CORINFO_CLASS_HANDLE handle, void **ppIndirection, CORINFO_CLASS_HANDLE result);
+ void recEmbedClassHandle(CORINFO_CLASS_HANDLE handle, void** ppIndirection, CORINFO_CLASS_HANDLE result);
void dmpEmbedClassHandle(DWORDLONG key, DLDL value);
- CORINFO_CLASS_HANDLE repEmbedClassHandle(CORINFO_CLASS_HANDLE handle, void **ppIndirection);
+ CORINFO_CLASS_HANDLE repEmbedClassHandle(CORINFO_CLASS_HANDLE handle, void** ppIndirection);
void recPInvokeMarshalingRequired(CORINFO_METHOD_HANDLE method, CORINFO_SIG_INFO* callSiteSig, BOOL result);
void dmpPInvokeMarshalingRequired(const Agnostic_PInvokeMarshalingRequired& key, DWORD value);
BOOL repPInvokeMarshalingRequired(CORINFO_METHOD_HANDLE method, CORINFO_SIG_INFO* callSiteSig);
- void recFindSig(CORINFO_MODULE_HANDLE module, unsigned sigTOK, CORINFO_CONTEXT_HANDLE context, CORINFO_SIG_INFO *sig);
+ void recFindSig(CORINFO_MODULE_HANDLE module,
+ unsigned sigTOK,
+ CORINFO_CONTEXT_HANDLE context,
+ CORINFO_SIG_INFO* sig);
void dmpFindSig(const Agnostic_FindSig& key, const Agnostic_CORINFO_SIG_INFO& value);
- void repFindSig(CORINFO_MODULE_HANDLE module, unsigned sigTOK, CORINFO_CONTEXT_HANDLE context, CORINFO_SIG_INFO *sig);
+ void repFindSig(CORINFO_MODULE_HANDLE module,
+ unsigned sigTOK,
+ CORINFO_CONTEXT_HANDLE context,
+ CORINFO_SIG_INFO* sig);
- void recGetEEInfo(CORINFO_EE_INFO *pEEInfoOut);
+ void recGetEEInfo(CORINFO_EE_INFO* pEEInfoOut);
void dmpGetEEInfo(DWORD key, const Agnostic_CORINFO_EE_INFO& value);
- void repGetEEInfo(CORINFO_EE_INFO *pEEInfoOut);
+ void repGetEEInfo(CORINFO_EE_INFO* pEEInfoOut);
- void recGetGSCookie(GSCookie *pCookieVal, GSCookie **ppCookieVal);
+ void recGetGSCookie(GSCookie* pCookieVal, GSCookie** ppCookieVal);
void dmpGetGSCookie(DWORD key, DLDL value);
- void repGetGSCookie(GSCookie *pCookieVal, GSCookie **ppCookieVal);
+ void repGetGSCookie(GSCookie* pCookieVal, GSCookie** ppCookieVal);
- void recGetClassModuleIdForStatics(CORINFO_CLASS_HANDLE cls, CORINFO_MODULE_HANDLE *pModule, void **ppIndirection, size_t result);
+ void recGetClassModuleIdForStatics(CORINFO_CLASS_HANDLE cls,
+ CORINFO_MODULE_HANDLE* pModule,
+ void** ppIndirection,
+ size_t result);
void dmpGetClassModuleIdForStatics(DWORDLONG key, const Agnostic_GetClassModuleIdForStatics& value);
- size_t repGetClassModuleIdForStatics(CORINFO_CLASS_HANDLE cls, CORINFO_MODULE_HANDLE *pModule, void **ppIndirection);
+ size_t repGetClassModuleIdForStatics(CORINFO_CLASS_HANDLE cls,
+ CORINFO_MODULE_HANDLE* pModule,
+ void** ppIndirection);
- void recGetThreadTLSIndex(void **ppIndirection, DWORD result);
+ void recGetThreadTLSIndex(void** ppIndirection, DWORD result);
void dmpGetThreadTLSIndex(DWORD key, DLD value);
- DWORD repGetThreadTLSIndex(void **ppIndirection);
+ DWORD repGetThreadTLSIndex(void** ppIndirection);
- void recGetInlinedCallFrameVptr(void **ppIndirection, const void * result);
+ void recGetInlinedCallFrameVptr(void** ppIndirection, const void* result);
void dmpGetInlinedCallFrameVptr(DWORD key, DLDL value);
- const void * repGetInlinedCallFrameVptr(void **ppIndirection);
+ const void* repGetInlinedCallFrameVptr(void** ppIndirection);
- void recGetAddrOfCaptureThreadGlobal(void **ppIndirection, LONG * result);
+ void recGetAddrOfCaptureThreadGlobal(void** ppIndirection, LONG* result);
void dmpGetAddrOfCaptureThreadGlobal(DWORD key, DLDL value);
- LONG * repGetAddrOfCaptureThreadGlobal(void **ppIndirection);
+ LONG* repGetAddrOfCaptureThreadGlobal(void** ppIndirection);
- void recGetClassDomainID(CORINFO_CLASS_HANDLE cls, void **ppIndirection, unsigned result);
+ void recGetClassDomainID(CORINFO_CLASS_HANDLE cls, void** ppIndirection, unsigned result);
void dmpGetClassDomainID(DWORDLONG key, DLD value);
- unsigned repGetClassDomainID(CORINFO_CLASS_HANDLE cls, void **ppIndirection);
+ unsigned repGetClassDomainID(CORINFO_CLASS_HANDLE cls, void** ppIndirection);
- void recGetLocationOfThisType(CORINFO_METHOD_HANDLE context, CORINFO_LOOKUP_KIND *result);
+ void recGetLocationOfThisType(CORINFO_METHOD_HANDLE context, CORINFO_LOOKUP_KIND* result);
void dmpGetLocationOfThisType(DWORDLONG key, const Agnostic_CORINFO_LOOKUP_KIND& value);
CORINFO_LOOKUP_KIND repGetLocationOfThisType(CORINFO_METHOD_HANDLE context);
- void recGetDelegateCtor(CORINFO_METHOD_HANDLE methHnd, CORINFO_CLASS_HANDLE clsHnd,
- CORINFO_METHOD_HANDLE targetMethodHnd, DelegateCtorArgs *pCtorData, CORINFO_METHOD_HANDLE result);
+ void recGetDelegateCtor(CORINFO_METHOD_HANDLE methHnd,
+ CORINFO_CLASS_HANDLE clsHnd,
+ CORINFO_METHOD_HANDLE targetMethodHnd,
+ DelegateCtorArgs* pCtorData,
+ CORINFO_METHOD_HANDLE result);
void dmpGetDelegateCtor(const Agnostic_GetDelegateCtorIn& key, const Agnostic_GetDelegateCtorOut& value);
- CORINFO_METHOD_HANDLE repGetDelegateCtor(CORINFO_METHOD_HANDLE methHnd, CORINFO_CLASS_HANDLE clsHnd,
- CORINFO_METHOD_HANDLE targetMethodHnd, DelegateCtorArgs *pCtorData);
+ CORINFO_METHOD_HANDLE repGetDelegateCtor(CORINFO_METHOD_HANDLE methHnd,
+ CORINFO_CLASS_HANDLE clsHnd,
+ CORINFO_METHOD_HANDLE targetMethodHnd,
+ DelegateCtorArgs* pCtorData);
- void recGetFunctionFixedEntryPoint(CORINFO_METHOD_HANDLE ftn, CORINFO_CONST_LOOKUP *pResult);
+ void recGetFunctionFixedEntryPoint(CORINFO_METHOD_HANDLE ftn, CORINFO_CONST_LOOKUP* pResult);
void dmpGetFunctionFixedEntryPoint(DWORDLONG key, const Agnostic_CORINFO_CONST_LOOKUP& value);
- void repGetFunctionFixedEntryPoint(CORINFO_METHOD_HANDLE ftn, CORINFO_CONST_LOOKUP *pResult);
+ void repGetFunctionFixedEntryPoint(CORINFO_METHOD_HANDLE ftn, CORINFO_CONST_LOOKUP* pResult);
void recGetFieldInClass(CORINFO_CLASS_HANDLE clsHnd, INT num, CORINFO_FIELD_HANDLE result);
void dmpGetFieldInClass(DLD key, DWORDLONG value);
CORINFO_FIELD_HANDLE repGetFieldInClass(CORINFO_CLASS_HANDLE clsHnd, INT num);
- void recGetFieldType(CORINFO_FIELD_HANDLE field, CORINFO_CLASS_HANDLE *structType, CORINFO_CLASS_HANDLE memberParent, CorInfoType result);
+ void recGetFieldType(CORINFO_FIELD_HANDLE field,
+ CORINFO_CLASS_HANDLE* structType,
+ CORINFO_CLASS_HANDLE memberParent,
+ CorInfoType result);
void dmpGetFieldType(DLDL key, DLD value);
- CorInfoType repGetFieldType(CORINFO_FIELD_HANDLE field, CORINFO_CLASS_HANDLE *structType, CORINFO_CLASS_HANDLE memberParent);
+ CorInfoType repGetFieldType(CORINFO_FIELD_HANDLE field,
+ CORINFO_CLASS_HANDLE* structType,
+ CORINFO_CLASS_HANDLE memberParent);
- void recGetFieldName(CORINFO_FIELD_HANDLE ftn, const char **moduleName, const char* result);
+ void recGetFieldName(CORINFO_FIELD_HANDLE ftn, const char** moduleName, const char* result);
void dmpGetFieldName(DWORDLONG key, DD value);
- const char* repGetFieldName(CORINFO_FIELD_HANDLE ftn, const char **moduleName);
+ const char* repGetFieldName(CORINFO_FIELD_HANDLE ftn, const char** moduleName);
void recCanInlineTypeCheckWithObjectVTable(CORINFO_CLASS_HANDLE cls, BOOL result);
void dmpCanInlineTypeCheckWithObjectVTable(DWORDLONG key, DWORD value);
@@ -825,11 +929,13 @@ public:
void dmpSatisfiesMethodConstraints(DLDL key, DWORD value);
BOOL repSatisfiesMethodConstraints(CORINFO_CLASS_HANDLE parent, CORINFO_METHOD_HANDLE method);
- void recInitConstraintsForVerification(CORINFO_METHOD_HANDLE method, BOOL *pfHasCircularClassConstraints,
- BOOL *pfHasCircularMethodConstraint);
+ void recInitConstraintsForVerification(CORINFO_METHOD_HANDLE method,
+ BOOL* pfHasCircularClassConstraints,
+ BOOL* pfHasCircularMethodConstraint);
void dmpInitConstraintsForVerification(DWORDLONG key, DD value);
- void repInitConstraintsForVerification(CORINFO_METHOD_HANDLE method, BOOL *pfHasCircularClassConstraints,
- BOOL *pfHasCircularMethodConstraint);
+ void repInitConstraintsForVerification(CORINFO_METHOD_HANDLE method,
+ BOOL* pfHasCircularClassConstraints,
+ BOOL* pfHasCircularMethodConstraint);
void recIsValidStringRef(CORINFO_MODULE_HANDLE module, unsigned metaTOK, BOOL result);
void dmpIsValidStringRef(DLD key, DWORD value);
@@ -843,28 +949,28 @@ public:
void dmpCanCast(DLDL key, DWORD value);
BOOL repCanCast(CORINFO_CLASS_HANDLE child, CORINFO_CLASS_HANDLE parent);
- void recGetChildType(CORINFO_CLASS_HANDLE clsHnd, CORINFO_CLASS_HANDLE *clsRet, CorInfoType result);
+ void recGetChildType(CORINFO_CLASS_HANDLE clsHnd, CORINFO_CLASS_HANDLE* clsRet, CorInfoType result);
void dmpGetChildType(DWORDLONG key, DLD value);
- CorInfoType repGetChildType(CORINFO_CLASS_HANDLE clsHnd, CORINFO_CLASS_HANDLE *clsRet);
+ CorInfoType repGetChildType(CORINFO_CLASS_HANDLE clsHnd, CORINFO_CLASS_HANDLE* clsRet);
- void recGetArrayInitializationData(CORINFO_FIELD_HANDLE field, DWORD size, void *result);
+ void recGetArrayInitializationData(CORINFO_FIELD_HANDLE field, DWORD size, void* result);
void dmpGetArrayInitializationData(DLD key, DWORDLONG value);
- void *repGetArrayInitializationData(CORINFO_FIELD_HANDLE field, DWORD size);
+ void* repGetArrayInitializationData(CORINFO_FIELD_HANDLE field, DWORD size);
- void recFilterException(struct _EXCEPTION_POINTERS *pExceptionPointers, int result);
+ void recFilterException(struct _EXCEPTION_POINTERS* pExceptionPointers, int result);
void dmpFilterException(DWORD key, DWORD value);
- int repFilterException(struct _EXCEPTION_POINTERS *pExceptionPointers);
+ int repFilterException(struct _EXCEPTION_POINTERS* pExceptionPointers);
- void recHandleException(struct _EXCEPTION_POINTERS *pExceptionPointers);
+ void recHandleException(struct _EXCEPTION_POINTERS* pExceptionPointers);
void dmpHandleException(DWORD key, DWORD value);
- void recGetAddressOfPInvokeFixup(CORINFO_METHOD_HANDLE method, void **ppIndirection, void* result);
+ void recGetAddressOfPInvokeFixup(CORINFO_METHOD_HANDLE method, void** ppIndirection, void* result);
void dmpGetAddressOfPInvokeFixup(DWORDLONG key, DLDL value);
- void* repGetAddressOfPInvokeFixup(CORINFO_METHOD_HANDLE method, void **ppIndirection);
+ void* repGetAddressOfPInvokeFixup(CORINFO_METHOD_HANDLE method, void** ppIndirection);
- void recGetAddressOfPInvokeTarget(CORINFO_METHOD_HANDLE method, CORINFO_CONST_LOOKUP *pLookup);
+ void recGetAddressOfPInvokeTarget(CORINFO_METHOD_HANDLE method, CORINFO_CONST_LOOKUP* pLookup);
void dmpGetAddressOfPInvokeTarget(DWORDLONG key, DLD value);
- void repGetAddressOfPInvokeTarget(CORINFO_METHOD_HANDLE method, CORINFO_CONST_LOOKUP *pLookup);
+ void repGetAddressOfPInvokeTarget(CORINFO_METHOD_HANDLE method, CORINFO_CONST_LOOKUP* pLookup);
void recSatisfiesClassConstraints(CORINFO_CLASS_HANDLE cls, BOOL result);
void dmpSatisfiesClassConstraints(DWORDLONG key, DWORD value);
@@ -874,63 +980,88 @@ public:
void dmpGetMethodHash(DWORDLONG key, DWORD value);
unsigned repGetMethodHash(CORINFO_METHOD_HANDLE ftn);
- void recCanTailCall(CORINFO_METHOD_HANDLE callerHnd, CORINFO_METHOD_HANDLE declaredCalleeHnd, CORINFO_METHOD_HANDLE exactCalleeHnd,
- bool fIsTailPrefix, bool result);
+ void recCanTailCall(CORINFO_METHOD_HANDLE callerHnd,
+ CORINFO_METHOD_HANDLE declaredCalleeHnd,
+ CORINFO_METHOD_HANDLE exactCalleeHnd,
+ bool fIsTailPrefix,
+ bool result);
void dmpCanTailCall(const Agnostic_CanTailCall& key, DWORD value);
- bool repCanTailCall(CORINFO_METHOD_HANDLE callerHnd, CORINFO_METHOD_HANDLE declaredCalleeHnd, CORINFO_METHOD_HANDLE exactCalleeHnd,
- bool fIsTailPrefix);
-
- void recIsCompatibleDelegate(CORINFO_CLASS_HANDLE objCls, CORINFO_CLASS_HANDLE methodParentCls,
- CORINFO_METHOD_HANDLE method, CORINFO_CLASS_HANDLE delegateCls, BOOL *pfIsOpenDelegate, BOOL result);
+ bool repCanTailCall(CORINFO_METHOD_HANDLE callerHnd,
+ CORINFO_METHOD_HANDLE declaredCalleeHnd,
+ CORINFO_METHOD_HANDLE exactCalleeHnd,
+ bool fIsTailPrefix);
+
+ void recIsCompatibleDelegate(CORINFO_CLASS_HANDLE objCls,
+ CORINFO_CLASS_HANDLE methodParentCls,
+ CORINFO_METHOD_HANDLE method,
+ CORINFO_CLASS_HANDLE delegateCls,
+ BOOL* pfIsOpenDelegate,
+ BOOL result);
void dmpIsCompatibleDelegate(const Agnostic_IsCompatibleDelegate& key, DD value);
- BOOL repIsCompatibleDelegate(CORINFO_CLASS_HANDLE objCls, CORINFO_CLASS_HANDLE methodParentCls,
- CORINFO_METHOD_HANDLE method, CORINFO_CLASS_HANDLE delegateCls, BOOL *pfIsOpenDelegate);
+ BOOL repIsCompatibleDelegate(CORINFO_CLASS_HANDLE objCls,
+ CORINFO_CLASS_HANDLE methodParentCls,
+ CORINFO_METHOD_HANDLE method,
+ CORINFO_CLASS_HANDLE delegateCls,
+ BOOL* pfIsOpenDelegate);
void recIsDelegateCreationAllowed(CORINFO_CLASS_HANDLE delegateHnd, CORINFO_METHOD_HANDLE calleeHnd, BOOL result);
void dmpIsDelegateCreationAllowed(DLDL key, DWORD value);
BOOL repIsDelegateCreationAllowed(CORINFO_CLASS_HANDLE delegateHnd, CORINFO_METHOD_HANDLE calleeHnd);
- void recCanSkipMethodVerification(CORINFO_METHOD_HANDLE ftnHandle, BOOL skip, CorInfoCanSkipVerificationResult result);
+ void recCanSkipMethodVerification(CORINFO_METHOD_HANDLE ftnHandle,
+ BOOL skip,
+ CorInfoCanSkipVerificationResult result);
void dmpCanSkipMethodVerification(DLD key, DWORD value);
CorInfoCanSkipVerificationResult repCanSkipMethodVerification(CORINFO_METHOD_HANDLE ftnHandle, BOOL skip);
- void recFindCallSiteSig(CORINFO_MODULE_HANDLE module, unsigned methTOK, CORINFO_CONTEXT_HANDLE context, CORINFO_SIG_INFO *sig);
+ void recFindCallSiteSig(CORINFO_MODULE_HANDLE module,
+ unsigned methTOK,
+ CORINFO_CONTEXT_HANDLE context,
+ CORINFO_SIG_INFO* sig);
void dmpFindCallSiteSig(const Agnostic_FindCallSiteSig& key, const Agnostic_CORINFO_SIG_INFO& value);
- void repFindCallSiteSig(CORINFO_MODULE_HANDLE module, unsigned methTOK, CORINFO_CONTEXT_HANDLE context, CORINFO_SIG_INFO *sig);
+ void repFindCallSiteSig(CORINFO_MODULE_HANDLE module,
+ unsigned methTOK,
+ CORINFO_CONTEXT_HANDLE context,
+ CORINFO_SIG_INFO* sig);
void recShouldEnforceCallvirtRestriction(CORINFO_MODULE_HANDLE scope, BOOL result);
void dmpShouldEnforceCallvirtRestriction(DWORDLONG key, DWORD value);
BOOL repShouldEnforceCallvirtRestriction(CORINFO_MODULE_HANDLE scope);
- void recGetMethodSync(CORINFO_METHOD_HANDLE ftn, void **ppIndirection, void* result);
+ void recGetMethodSync(CORINFO_METHOD_HANDLE ftn, void** ppIndirection, void* result);
void dmpGetMethodSync(DWORDLONG key, DLDL value);
- void* repGetMethodSync(CORINFO_METHOD_HANDLE ftn, void **ppIndirection);
+ void* repGetMethodSync(CORINFO_METHOD_HANDLE ftn, void** ppIndirection);
- void recGetVarArgsHandle(CORINFO_SIG_INFO *pSig, void **ppIndirection, CORINFO_VARARGS_HANDLE result);
+ void recGetVarArgsHandle(CORINFO_SIG_INFO* pSig, void** ppIndirection, CORINFO_VARARGS_HANDLE result);
void dmpGetVarArgsHandle(const Agnostic_CORINFO_SIG_INFO& key, DLDL value);
- CORINFO_VARARGS_HANDLE repGetVarArgsHandle(CORINFO_SIG_INFO *pSig, void **ppIndirection);
+ CORINFO_VARARGS_HANDLE repGetVarArgsHandle(CORINFO_SIG_INFO* pSig, void** ppIndirection);
- void recCanGetVarArgsHandle(CORINFO_SIG_INFO *pSig, bool result);
+ void recCanGetVarArgsHandle(CORINFO_SIG_INFO* pSig, bool result);
void dmpCanGetVarArgsHandle(const Agnostic_CORINFO_SIG_INFO& key, DWORD value);
- bool repCanGetVarArgsHandle(CORINFO_SIG_INFO *pSig);
+ bool repCanGetVarArgsHandle(CORINFO_SIG_INFO* pSig);
- void recGetFieldThreadLocalStoreID(CORINFO_FIELD_HANDLE field, void **ppIndirection, DWORD result);
+ void recGetFieldThreadLocalStoreID(CORINFO_FIELD_HANDLE field, void** ppIndirection, DWORD result);
void dmpGetFieldThreadLocalStoreID(DWORDLONG key, DLD value);
- DWORD repGetFieldThreadLocalStoreID(CORINFO_FIELD_HANDLE field, void **ppIndirection);
+ DWORD repGetFieldThreadLocalStoreID(CORINFO_FIELD_HANDLE field, void** ppIndirection);
- void recGetBBProfileData(CORINFO_METHOD_HANDLE ftnHnd, ULONG *count, ICorJitInfo::ProfileBuffer **profileBuffer,
- ULONG *numRuns, HRESULT result);
+ void recGetBBProfileData(CORINFO_METHOD_HANDLE ftnHnd,
+ ULONG* count,
+ ICorJitInfo::ProfileBuffer** profileBuffer,
+ ULONG* numRuns,
+ HRESULT result);
void dmpGetBBProfileData(DWORDLONG key, const Agnostic_GetBBProfileData& value);
- HRESULT repGetBBProfileData(CORINFO_METHOD_HANDLE ftnHnd, ULONG *count, ICorJitInfo::ProfileBuffer **profileBuffer,
- ULONG *numRuns);
+ HRESULT repGetBBProfileData(CORINFO_METHOD_HANDLE ftnHnd,
+ ULONG* count,
+ ICorJitInfo::ProfileBuffer** profileBuffer,
+ ULONG* numRuns);
void recMergeClasses(CORINFO_CLASS_HANDLE cls1, CORINFO_CLASS_HANDLE cls2, CORINFO_CLASS_HANDLE result);
void dmpMergeClasses(DLDL key, DWORDLONG value);
CORINFO_CLASS_HANDLE repMergeClasses(CORINFO_CLASS_HANDLE cls1, CORINFO_CLASS_HANDLE cls2);
- void recGetCookieForPInvokeCalliSig(CORINFO_SIG_INFO* szMetaSig, void ** ppIndirection, LPVOID result);
+ void recGetCookieForPInvokeCalliSig(CORINFO_SIG_INFO* szMetaSig, void** ppIndirection, LPVOID result);
void dmpGetCookieForPInvokeCalliSig(const Agnostic_CORINFO_SIG_INFO& key, DLDL value);
- LPVOID repGetCookieForPInvokeCalliSig(CORINFO_SIG_INFO* szMetaSig, void ** ppIndirection);
+ LPVOID repGetCookieForPInvokeCalliSig(CORINFO_SIG_INFO* szMetaSig, void** ppIndirection);
void recCanGetCookieForPInvokeCalliSig(CORINFO_SIG_INFO* szMetaSig, bool result);
void dmpCanGetCookieForPInvokeCalliSig(const Agnostic_CORINFO_SIG_INFO& key, DWORD value);
@@ -940,32 +1071,38 @@ public:
void dmpCanAccessFamily(DLDL key, DWORD value);
BOOL repCanAccessFamily(CORINFO_METHOD_HANDLE hCaller, CORINFO_CLASS_HANDLE hInstanceType);
- void recErrorList(const char *error);
+ void recErrorList(const char* error);
void dmpErrorList(DWORD key, DWORD value);
- void recGetProfilingHandle(BOOL *pbHookFunction, void **pProfilerHandle, BOOL *pbIndirectedHandles);
+ void recGetProfilingHandle(BOOL* pbHookFunction, void** pProfilerHandle, BOOL* pbIndirectedHandles);
void dmpGetProfilingHandle(DWORD key, const Agnostic_GetProfilingHandle& value);
- void repGetProfilingHandle(BOOL *pbHookFunction, void **pProfilerHandle, BOOL *pbIndirectedHandles);
+ void repGetProfilingHandle(BOOL* pbHookFunction, void** pProfilerHandle, BOOL* pbIndirectedHandles);
- void recEmbedFieldHandle(CORINFO_FIELD_HANDLE handle, void **ppIndirection, CORINFO_FIELD_HANDLE result);
+ void recEmbedFieldHandle(CORINFO_FIELD_HANDLE handle, void** ppIndirection, CORINFO_FIELD_HANDLE result);
void dmpEmbedFieldHandle(DWORDLONG key, DLDL value);
- CORINFO_FIELD_HANDLE repEmbedFieldHandle(CORINFO_FIELD_HANDLE handle, void **ppIndirection);
+ CORINFO_FIELD_HANDLE repEmbedFieldHandle(CORINFO_FIELD_HANDLE handle, void** ppIndirection);
void recAreTypesEquivalent(CORINFO_CLASS_HANDLE cls1, CORINFO_CLASS_HANDLE cls2, BOOL result);
void dmpAreTypesEquivalent(DLDL key, DWORD value);
BOOL repAreTypesEquivalent(CORINFO_CLASS_HANDLE cls1, CORINFO_CLASS_HANDLE cls2);
- void recFindNameOfToken(CORINFO_MODULE_HANDLE module, mdToken metaTOK, char * szFQName, size_t FQNameCapacity, size_t result);
+ void recFindNameOfToken(
+ CORINFO_MODULE_HANDLE module, mdToken metaTOK, char* szFQName, size_t FQNameCapacity, size_t result);
void dmpFindNameOfToken(DLD key, DLD value);
- size_t repFindNameOfToken(CORINFO_MODULE_HANDLE module, mdToken metaTOK, char * szFQName, size_t FQNameCapacity);
-
- void recGetSystemVAmd64PassStructInRegisterDescriptor(CORINFO_CLASS_HANDLE structHnd, SYSTEMV_AMD64_CORINFO_STRUCT_REG_PASSING_DESCRIPTOR* structPassInRegDescPtr, bool result);
- void dmpGetSystemVAmd64PassStructInRegisterDescriptor(DWORDLONG key, const Agnostic_GetSystemVAmd64PassStructInRegisterDescriptor& value);
- bool repGetSystemVAmd64PassStructInRegisterDescriptor(CORINFO_CLASS_HANDLE structHnd, SYSTEMV_AMD64_CORINFO_STRUCT_REG_PASSING_DESCRIPTOR* structPassInRegDescPtr);
-
- void recGetRelocTypeHint(void * target, WORD result);
+ size_t repFindNameOfToken(CORINFO_MODULE_HANDLE module, mdToken metaTOK, char* szFQName, size_t FQNameCapacity);
+
+ void recGetSystemVAmd64PassStructInRegisterDescriptor(
+ CORINFO_CLASS_HANDLE structHnd,
+ SYSTEMV_AMD64_CORINFO_STRUCT_REG_PASSING_DESCRIPTOR* structPassInRegDescPtr,
+ bool result);
+ void dmpGetSystemVAmd64PassStructInRegisterDescriptor(
+ DWORDLONG key, const Agnostic_GetSystemVAmd64PassStructInRegisterDescriptor& value);
+ bool repGetSystemVAmd64PassStructInRegisterDescriptor(
+ CORINFO_CLASS_HANDLE structHnd, SYSTEMV_AMD64_CORINFO_STRUCT_REG_PASSING_DESCRIPTOR* structPassInRegDescPtr);
+
+ void recGetRelocTypeHint(void* target, WORD result);
void dmpGetRelocTypeHint(DWORDLONG key, DWORD value);
- WORD repGetRelocTypeHint(void * target);
+ WORD repGetRelocTypeHint(void* target);
void recIsWriteBarrierHelperRequired(CORINFO_FIELD_HANDLE field, bool result);
void dmpIsWriteBarrierHelperRequired(DWORDLONG key, DWORD value);
@@ -979,13 +1116,14 @@ public:
void dmpGetClassName(DWORDLONG key, DWORD value);
const char* repGetClassName(CORINFO_CLASS_HANDLE cls);
- void recAppendClassName(CORINFO_CLASS_HANDLE cls, BOOL fNamespace, BOOL fFullInst, BOOL fAssembly, const WCHAR* result);
+ void recAppendClassName(
+ CORINFO_CLASS_HANDLE cls, BOOL fNamespace, BOOL fFullInst, BOOL fAssembly, const WCHAR* result);
void dmpAppendClassName(const Agnostic_AppendClassName& key, DWORD value);
const WCHAR* repAppendClassName(CORINFO_CLASS_HANDLE cls, BOOL fNamespace, BOOL fFullInst, BOOL fAssembly);
- void recGetTailCallCopyArgsThunk(CORINFO_SIG_INFO *pSig, CorInfoHelperTailCallSpecialHandling flags, void* result);
+ void recGetTailCallCopyArgsThunk(CORINFO_SIG_INFO* pSig, CorInfoHelperTailCallSpecialHandling flags, void* result);
void dmpGetTailCallCopyArgsThunk(const Agnostic_GetTailCallCopyArgsThunk& key, DWORDLONG value);
- void* repGetTailCallCopyArgsThunk(CORINFO_SIG_INFO *pSig, CorInfoHelperTailCallSpecialHandling flags);
+ void* repGetTailCallCopyArgsThunk(CORINFO_SIG_INFO* pSig, CorInfoHelperTailCallSpecialHandling flags);
void recGetMethodDefFromMethod(CORINFO_METHOD_HANDLE hMethod, mdMethodDef result);
void dmpGetMethodDefFromMethod(DWORDLONG key, DWORD value);
@@ -995,9 +1133,9 @@ public:
void dmpCheckMethodModifier(const Agnostic_CheckMethodModifier& key, DWORD value);
BOOL repCheckMethodModifier(CORINFO_METHOD_HANDLE hMethod, LPCSTR modifier, BOOL fOptional);
- void recGetPInvokeUnmanagedTarget(CORINFO_METHOD_HANDLE method, void **ppIndirection, void* result);
+ void recGetPInvokeUnmanagedTarget(CORINFO_METHOD_HANDLE method, void** ppIndirection, void* result);
void dmpGetPInvokeUnmanagedTarget(DWORDLONG key, DLDL value);
- void* repGetPInvokeUnmanagedTarget(CORINFO_METHOD_HANDLE method, void **ppIndirection);
+ void* repGetPInvokeUnmanagedTarget(CORINFO_METHOD_HANDLE method, void** ppIndirection);
void recGetArrayRank(CORINFO_CLASS_HANDLE cls, unsigned result);
void dmpGetArrayRank(DWORDLONG key, DWORD value);
@@ -1007,192 +1145,189 @@ public:
void dmpIsFieldStatic(DWORDLONG key, DWORD value);
bool repIsFieldStatic(CORINFO_FIELD_HANDLE fhld);
- void recGetIntConfigValue(const wchar_t *name, int defaultValue, int result);
+ void recGetIntConfigValue(const wchar_t* name, int defaultValue, int result);
void dmpGetIntConfigValue(const Agnostic_ConfigIntInfo& key, int value);
- int repGetIntConfigValue(const wchar_t *name, int defaultValue);
+ int repGetIntConfigValue(const wchar_t* name, int defaultValue);
- void recGetStringConfigValue(const wchar_t *name, const wchar_t *result);
+ void recGetStringConfigValue(const wchar_t* name, const wchar_t* result);
void dmpGetStringConfigValue(DWORD nameIndex, DWORD result);
- const wchar_t *repGetStringConfigValue(const wchar_t *name);
+ const wchar_t* repGetStringConfigValue(const wchar_t* name);
- CompileResult *cr;
- CompileResult *originalCR;
- int index;
+ CompileResult* cr;
+ CompileResult* originalCR;
+ int index;
private:
-
- #define LWM(map,key,value) LightWeightMap<key, value>* map;
- #define DENSELWM(map,value) DenseLightWeightMap<value>* map;
- #include "lwmlist.h"
-
+#define LWM(map, key, value) LightWeightMap<key, value>* map;
+#define DENSELWM(map, value) DenseLightWeightMap<value>* map;
+#include "lwmlist.h"
};
-
// ********************* Please keep this up-to-date to ease adding more ***************
// Highest packet number: 160
// *************************************************************************************
enum mcPackets
{
- Packet_AppendClassName = 149, // Added 8/6/2014 - needed for SIMD
- Packet_AreTypesEquivalent = 1,
- Packet_AsCorInfoType = 2,
- Packet_CanAccessClass = 3,
- Packet_CanAccessFamily = 4,
- Packet_CanCast = 5,
- Retired8 = 6,
- Packet_GetLazyStringLiteralHelper = 147, //Added 12/20/2013 - as a replacement for CanEmbedModuleHandleForHelper
- Packet_CanGetCookieForPInvokeCalliSig = 7,
- Packet_CanGetVarArgsHandle = 8,
- Packet_CanInline = 9,
+ Packet_AppendClassName = 149, // Added 8/6/2014 - needed for SIMD
+ Packet_AreTypesEquivalent = 1,
+ Packet_AsCorInfoType = 2,
+ Packet_CanAccessClass = 3,
+ Packet_CanAccessFamily = 4,
+ Packet_CanCast = 5,
+ Retired8 = 6,
+ Packet_GetLazyStringLiteralHelper = 147, // Added 12/20/2013 - as a replacement for CanEmbedModuleHandleForHelper
+ Packet_CanGetCookieForPInvokeCalliSig = 7,
+ Packet_CanGetVarArgsHandle = 8,
+ Packet_CanInline = 9,
Packet_CanInlineTypeCheckWithObjectVTable = 10,
- Packet_CanSkipMethodVerification = 11,
- Packet_CanTailCall = 12,
- Retired4 = 13,
- Packet_CheckMethodModifier = 142, //retired as 13 on 2013/07/04
- Retired3 = 14,
- Retired5 = 141, //retired as 14 on 2013/07/03
- Packet_CompileMethod = 143, //retired as 141 on 2013/07/09
- Packet_ConstructStringLiteral = 15,
- Packet_EmbedClassHandle = 16,
- Packet_EmbedFieldHandle = 17,
- Packet_EmbedGenericHandle = 18,
- Packet_EmbedMethodHandle = 19,
- Packet_EmbedModuleHandle = 20,
- Packet_EmptyStringLiteral = 21,
- Packet_Environment = 136, //Added 4/3/2013
- Packet_ErrorList = 22,
- Packet_FilterException = 134,
- Packet_FindCallSiteSig = 23,
- Retired7 = 24,
- Packet_FindNameOfToken = 145,//Added 7/19/2013 - adjusted members to proper types
- Packet_GetSystemVAmd64PassStructInRegisterDescriptor = 156, //Added 2/17/2016
- Packet_FindSig = 25,
- Packet_GetAddressOfPInvokeFixup = 26,
- Packet_GetAddressOfPInvokeTarget = 153, //Added 2/3/2016
- Packet_GetAddrOfCaptureThreadGlobal = 27,
- Retired1 = 28,
- Packet_GetArgClass = 139, //retired as 28 on 2013/07/03
- Packet_GetHFAType = 159,
- Packet_GetArgNext = 29,
- Retired2 = 30,
- Packet_GetArgType = 140, //retired as 30 on 2013/07/03
- Packet_GetArrayInitializationData = 31,
- Packet_GetArrayRank = 32,
- Packet_GetBBProfileData = 33,
- Packet_GetBoundaries = 34,
- Packet_GetBoxHelper = 35,
- Packet_GetBuiltinClass = 36,
- Packet_GetCallInfo = 37,
- Packet_GetCastingHelper = 38,
- Packet_GetChildType = 39,
- Packet_GetClassAlignmentRequirement = 40,
- Packet_GetClassAttribs = 41,
- Packet_GetClassDomainID = 42,
- Packet_GetClassGClayout = 43,
- Packet_GetClassModuleIdForStatics = 44,
- Packet_GetClassName = 45,
- Packet_GetClassNumInstanceFields = 46,
- Packet_GetClassSize = 47,
- Packet_GetIntConfigValue = 151, //Added 2/12/2015
- Packet_GetStringConfigValue = 152, // Added 2/12/2015
- Packet_GetCookieForPInvokeCalliSig = 48,
- Packet_GetDelegateCtor = 49,
- Packet_GetEEInfo = 50,
- Packet_GetEHinfo = 51,
- Packet_GetFieldAddress = 52,
- Packet_GetFieldClass = 53,
- Packet_GetFieldInClass = 54,
- Packet_GetFieldInfo = 55,
- Packet_GetFieldName = 56,
- Packet_GetFieldOffset = 57,
- Packet_GetFieldThreadLocalStoreID = 58,
- Packet_GetFieldType = 59,
- Packet_GetFunctionEntryPoint = 60,
- Packet_GetFunctionFixedEntryPoint = 61,
- Packet_GetGSCookie = 62,
- Packet_GetHelperFtn = 63,
- Packet_GetHelperName = 64,
- Packet_GetInlinedCallFrameVptr = 65,
- Packet_GetIntrinsicID = 66,
- Packet_GetJitFlags = 154, //Added 2/3/2016
- Packet_GetJitTimeLogFilename = 67,
- Packet_GetJustMyCodeHandle = 68,
- Packet_GetLocationOfThisType = 69,
- Packet_GetMethodAttribs = 70,
- Packet_GetMethodClass = 71,
- Packet_GetMethodDefFromMethod = 72,
- Packet_GetMethodHash = 73,
- Packet_GetMethodInfo = 74,
- Packet_GetMethodName = 75,
- Packet_GetMethodSig = 76,
- Packet_GetMethodSync = 77,
- Packet_GetMethodVTableOffset = 78,
- Packet_GetNewArrHelper = 79,
- Packet_GetNewHelper = 80,
- Packet_GetParentType = 81,
- Packet_GetPInvokeUnmanagedTarget = 82,
- Packet_GetProfilingHandle = 83,
- Packet_GetRelocTypeHint = 84,
- Packet_GetSecurityPrologHelper = 85,
- Packet_GetSharedCCtorHelper = 86,
- Packet_GetTailCallCopyArgsThunk = 87,
- Packet_GetThreadTLSIndex = 88,
- Packet_GetTokenTypeAsHandle = 89,
- Packet_GetTypeForBox = 90,
- Packet_GetTypeForPrimitiveValueClass = 91,
- Packet_GetUnBoxHelper = 92,
- Packet_GetReadyToRunHelper = 150, //Added 10/10/2014
- Packet_GetReadyToRunDelegateCtorHelper = 157, //Added 3/30/2016
- Packet_GetUnmanagedCallConv = 94,
- Packet_GetVarArgsHandle = 95,
- Packet_GetVars = 96,
- Packet_HandleException = 135,
- Packet_InitClass = 97,
- Packet_InitConstraintsForVerification = 98,
- Packet_IsCompatibleDelegate = 99,
- Packet_IsDelegateCreationAllowed = 155,
- Packet_IsFieldStatic = 137,//Added 4/9/2013 - needed for 4.5.1
- Packet_IsInSIMDModule = 148,// Added 6/18/2014 - SIMD support
- Packet_IsInstantiationOfVerifiedGeneric = 100,
- Packet_IsSDArray = 101,
+ Packet_CanSkipMethodVerification = 11,
+ Packet_CanTailCall = 12,
+ Retired4 = 13,
+ Packet_CheckMethodModifier = 142, // retired as 13 on 2013/07/04
+ Retired3 = 14,
+ Retired5 = 141, // retired as 14 on 2013/07/03
+ Packet_CompileMethod = 143, // retired as 141 on 2013/07/09
+ Packet_ConstructStringLiteral = 15,
+ Packet_EmbedClassHandle = 16,
+ Packet_EmbedFieldHandle = 17,
+ Packet_EmbedGenericHandle = 18,
+ Packet_EmbedMethodHandle = 19,
+ Packet_EmbedModuleHandle = 20,
+ Packet_EmptyStringLiteral = 21,
+ Packet_Environment = 136, // Added 4/3/2013
+ Packet_ErrorList = 22,
+ Packet_FilterException = 134,
+ Packet_FindCallSiteSig = 23,
+ Retired7 = 24,
+ Packet_FindNameOfToken = 145, // Added 7/19/2013 - adjusted members to proper types
+ Packet_GetSystemVAmd64PassStructInRegisterDescriptor = 156, // Added 2/17/2016
+ Packet_FindSig = 25,
+ Packet_GetAddressOfPInvokeFixup = 26,
+ Packet_GetAddressOfPInvokeTarget = 153, // Added 2/3/2016
+ Packet_GetAddrOfCaptureThreadGlobal = 27,
+ Retired1 = 28,
+ Packet_GetArgClass = 139, // retired as 28 on 2013/07/03
+ Packet_GetHFAType = 159,
+ Packet_GetArgNext = 29,
+ Retired2 = 30,
+ Packet_GetArgType = 140, // retired as 30 on 2013/07/03
+ Packet_GetArrayInitializationData = 31,
+ Packet_GetArrayRank = 32,
+ Packet_GetBBProfileData = 33,
+ Packet_GetBoundaries = 34,
+ Packet_GetBoxHelper = 35,
+ Packet_GetBuiltinClass = 36,
+ Packet_GetCallInfo = 37,
+ Packet_GetCastingHelper = 38,
+ Packet_GetChildType = 39,
+ Packet_GetClassAlignmentRequirement = 40,
+ Packet_GetClassAttribs = 41,
+ Packet_GetClassDomainID = 42,
+ Packet_GetClassGClayout = 43,
+ Packet_GetClassModuleIdForStatics = 44,
+ Packet_GetClassName = 45,
+ Packet_GetClassNumInstanceFields = 46,
+ Packet_GetClassSize = 47,
+ Packet_GetIntConfigValue = 151, // Added 2/12/2015
+ Packet_GetStringConfigValue = 152, // Added 2/12/2015
+ Packet_GetCookieForPInvokeCalliSig = 48,
+ Packet_GetDelegateCtor = 49,
+ Packet_GetEEInfo = 50,
+ Packet_GetEHinfo = 51,
+ Packet_GetFieldAddress = 52,
+ Packet_GetFieldClass = 53,
+ Packet_GetFieldInClass = 54,
+ Packet_GetFieldInfo = 55,
+ Packet_GetFieldName = 56,
+ Packet_GetFieldOffset = 57,
+ Packet_GetFieldThreadLocalStoreID = 58,
+ Packet_GetFieldType = 59,
+ Packet_GetFunctionEntryPoint = 60,
+ Packet_GetFunctionFixedEntryPoint = 61,
+ Packet_GetGSCookie = 62,
+ Packet_GetHelperFtn = 63,
+ Packet_GetHelperName = 64,
+ Packet_GetInlinedCallFrameVptr = 65,
+ Packet_GetIntrinsicID = 66,
+ Packet_GetJitFlags = 154, // Added 2/3/2016
+ Packet_GetJitTimeLogFilename = 67,
+ Packet_GetJustMyCodeHandle = 68,
+ Packet_GetLocationOfThisType = 69,
+ Packet_GetMethodAttribs = 70,
+ Packet_GetMethodClass = 71,
+ Packet_GetMethodDefFromMethod = 72,
+ Packet_GetMethodHash = 73,
+ Packet_GetMethodInfo = 74,
+ Packet_GetMethodName = 75,
+ Packet_GetMethodSig = 76,
+ Packet_GetMethodSync = 77,
+ Packet_GetMethodVTableOffset = 78,
+ Packet_GetNewArrHelper = 79,
+ Packet_GetNewHelper = 80,
+ Packet_GetParentType = 81,
+ Packet_GetPInvokeUnmanagedTarget = 82,
+ Packet_GetProfilingHandle = 83,
+ Packet_GetRelocTypeHint = 84,
+ Packet_GetSecurityPrologHelper = 85,
+ Packet_GetSharedCCtorHelper = 86,
+ Packet_GetTailCallCopyArgsThunk = 87,
+ Packet_GetThreadTLSIndex = 88,
+ Packet_GetTokenTypeAsHandle = 89,
+ Packet_GetTypeForBox = 90,
+ Packet_GetTypeForPrimitiveValueClass = 91,
+ Packet_GetUnBoxHelper = 92,
+ Packet_GetReadyToRunHelper = 150, // Added 10/10/2014
+ Packet_GetReadyToRunDelegateCtorHelper = 157, // Added 3/30/2016
+ Packet_GetUnmanagedCallConv = 94,
+ Packet_GetVarArgsHandle = 95,
+ Packet_GetVars = 96,
+ Packet_HandleException = 135,
+ Packet_InitClass = 97,
+ Packet_InitConstraintsForVerification = 98,
+ Packet_IsCompatibleDelegate = 99,
+ Packet_IsDelegateCreationAllowed = 155,
+ Packet_IsFieldStatic = 137, // Added 4/9/2013 - needed for 4.5.1
+ Packet_IsInSIMDModule = 148, // Added 6/18/2014 - SIMD support
+ Packet_IsInstantiationOfVerifiedGeneric = 100,
+ Packet_IsSDArray = 101,
Packet_IsStructRequiringStackAllocRetBuf = 102,
- Packet_IsValidStringRef = 103,
- Retired6 = 104,
- Packet_IsValidToken = 144,//Added 7/19/2013 - adjusted members to proper types
- Packet_IsValueClass = 105,
- Packet_IsWriteBarrierHelperRequired = 106,
- Packet_MergeClasses = 107,
- Packet_PInvokeMarshalingRequired = 108,
- Packet_ResolveToken = 109,
- Packet_ResolveVirtualMethod = 160, // Added 2/13/17
- Packet_TryResolveToken = 158, //Added 4/26/2016
- Packet_SatisfiesClassConstraints = 110,
- Packet_SatisfiesMethodConstraints = 111,
+ Packet_IsValidStringRef = 103,
+ Retired6 = 104,
+ Packet_IsValidToken = 144, // Added 7/19/2013 - adjusted members to proper types
+ Packet_IsValueClass = 105,
+ Packet_IsWriteBarrierHelperRequired = 106,
+ Packet_MergeClasses = 107,
+ Packet_PInvokeMarshalingRequired = 108,
+ Packet_ResolveToken = 109,
+ Packet_ResolveVirtualMethod = 160, // Added 2/13/17
+ Packet_TryResolveToken = 158, // Added 4/26/2016
+ Packet_SatisfiesClassConstraints = 110,
+ Packet_SatisfiesMethodConstraints = 111,
Packet_ShouldEnforceCallvirtRestriction = 112,
- PacketCR_AddressMap = 113,
+ PacketCR_AddressMap = 113,
PacketCR_AllocBBProfileBuffer = 131,
- PacketCR_AllocGCInfo = 114,
- PacketCR_AllocMem = 115,
- PacketCR_AllocUnwindInfo = 132,
- PacketCR_AssertLog = 138, //Added 6/10/2013 - added to nicely support ilgen
- PacketCR_CallLog = 116,
- PacketCR_ClassMustBeLoadedBeforeCodeIsRun = 117,
- PacketCR_CompileMethod = 118,
- PacketCR_MessageLog = 119,
+ PacketCR_AllocGCInfo = 114,
+ PacketCR_AllocMem = 115,
+ PacketCR_AllocUnwindInfo = 132,
+ PacketCR_AssertLog = 138, // Added 6/10/2013 - added to nicely support ilgen
+ PacketCR_CallLog = 116,
+ PacketCR_ClassMustBeLoadedBeforeCodeIsRun = 117,
+ PacketCR_CompileMethod = 118,
+ PacketCR_MessageLog = 119,
PacketCR_MethodMustBeLoadedBeforeCodeIsRun = 120,
- PacketCR_ProcessName = 121,
- PacketCR_RecordRelocation = 122,
- PacketCR_ReportFatalError = 123,
- PacketCR_ReportInliningDecision = 124,
- PacketCR_ReportTailCallDecision = 125,
- PacketCR_ReserveUnwindInfo = 133,
- PacketCR_SetBoundaries = 126,
- PacketCR_SetEHcount = 127,
- PacketCR_SetEHinfo = 128,
- PacketCR_SetMethodAttribs = 129,
- PacketCR_SetVars = 130,
- PacketCR_RecordCallSite = 146, //Added 10/28/2013 - to support indirect calls
+ PacketCR_ProcessName = 121,
+ PacketCR_RecordRelocation = 122,
+ PacketCR_ReportFatalError = 123,
+ PacketCR_ReportInliningDecision = 124,
+ PacketCR_ReportTailCallDecision = 125,
+ PacketCR_ReserveUnwindInfo = 133,
+ PacketCR_SetBoundaries = 126,
+ PacketCR_SetEHcount = 127,
+ PacketCR_SetEHinfo = 128,
+ PacketCR_SetMethodAttribs = 129,
+ PacketCR_SetVars = 130,
+ PacketCR_RecordCallSite = 146, // Added 10/28/2013 - to support indirect calls
};
#endif
diff --git a/src/ToolBox/superpmi/superpmi-shared/methodcontextiterator.cpp b/src/ToolBox/superpmi/superpmi-shared/methodcontextiterator.cpp
index 55f8045938..0483ac18b3 100644
--- a/src/ToolBox/superpmi/superpmi-shared/methodcontextiterator.cpp
+++ b/src/ToolBox/superpmi/superpmi-shared/methodcontextiterator.cpp
@@ -7,10 +7,10 @@
#include "methodcontext.h"
#include "methodcontextiterator.h"
-
bool MethodContextIterator::Initialize(const char* fileName)
{
- m_hFile = CreateFileA(fileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL|FILE_FLAG_SEQUENTIAL_SCAN, NULL);
+ m_hFile = CreateFileA(fileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING,
+ FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
if (m_hFile == INVALID_HANDLE_VALUE)
{
LogError("Failed to open file '%s'. GetLastError()=%u", fileName, GetLastError());
@@ -18,7 +18,7 @@ bool MethodContextIterator::Initialize(const char* fileName)
}
LARGE_INTEGER DataTemp;
- if (GetFileSizeEx(m_hFile, &DataTemp)==0)
+ if (GetFileSizeEx(m_hFile, &DataTemp) == 0)
{
LogError("GetFileSizeEx failed. GetLastError()=%u", GetLastError());
CloseHandle(m_hFile);
@@ -53,8 +53,8 @@ bool MethodContextIterator::Destroy()
if (m_index < m_indexCount)
{
- LogWarning("Didn't use all of index count input: %d < %d (i.e., didn't see MC #%d)",
- m_index, m_indexCount, m_indexes[m_index]);
+ LogWarning("Didn't use all of index count input: %d < %d (i.e., didn't see MC #%d)", m_index, m_indexCount,
+ m_indexes[m_index]);
}
delete m_timer;
@@ -95,7 +95,8 @@ bool MethodContextIterator::MoveNext()
if (m_methodContextNumber % 500 == 0)
{
m_timer->Stop();
- LogVerbose("Loaded %d at %d per second", m_methodContextNumber, (int)((double)500 / m_timer->GetSeconds()));
+ LogVerbose("Loaded %d at %d per second", m_methodContextNumber,
+ (int)((double)500 / m_timer->GetSeconds()));
m_timer->Start();
}
}
diff --git a/src/ToolBox/superpmi/superpmi-shared/methodcontextiterator.h b/src/ToolBox/superpmi/superpmi-shared/methodcontextiterator.h
index d6002ba852..857f268072 100644
--- a/src/ToolBox/superpmi/superpmi-shared/methodcontextiterator.h
+++ b/src/ToolBox/superpmi/superpmi-shared/methodcontextiterator.h
@@ -10,7 +10,6 @@
class MethodContextIterator
{
public:
-
MethodContextIterator(bool progressReport = false)
: m_hFile(INVALID_HANDLE_VALUE)
, m_fileSize(0)
@@ -67,7 +66,7 @@ public:
MethodContext* CurrentTakeOwnership()
{
MethodContext* ret = m_mc;
- m_mc = nullptr;
+ m_mc = nullptr;
return ret;
}
@@ -83,22 +82,21 @@ public:
}
private:
-
- HANDLE m_hFile;
- int64_t m_fileSize;
- int m_methodContextNumber;
- MethodContext* m_mc;
- LARGE_INTEGER m_pos;
+ HANDLE m_hFile;
+ int64_t m_fileSize;
+ int m_methodContextNumber;
+ MethodContext* m_mc;
+ LARGE_INTEGER m_pos;
// If m_indexCount==-1, use all method contexts. Otherwise, m_indexCount is the number of elements in the
// m_indexes array, which contains a sorted set of method context indexes to return. In this case, m_index
// is the index of the current element in m_indexes.
- const int m_indexCount;
- int m_index;
- const int* m_indexes;
+ const int m_indexCount;
+ int m_index;
+ const int* m_indexes;
// Should we log a progress report as we are loading the method contexts?
// The timer is only used when m_progressReport==true.
- bool m_progressReport;
- SimpleTimer* m_timer;
+ bool m_progressReport;
+ SimpleTimer* m_timer;
}; \ No newline at end of file
diff --git a/src/ToolBox/superpmi/superpmi-shared/methodcontextreader.cpp b/src/ToolBox/superpmi/superpmi-shared/methodcontextreader.cpp
index 1e375e0d6a..6b40839a63 100644
--- a/src/ToolBox/superpmi/superpmi-shared/methodcontextreader.cpp
+++ b/src/ToolBox/superpmi/superpmi-shared/methodcontextreader.cpp
@@ -16,9 +16,10 @@
#include "runtimedetails.h"
// Just a helper...
-HANDLE MethodContextReader::OpenFile(const char *inputFile, DWORD flags)
+HANDLE MethodContextReader::OpenFile(const char* inputFile, DWORD flags)
{
- HANDLE fileHandle = CreateFileA(inputFile, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | flags, NULL);
+ HANDLE fileHandle =
+ CreateFileA(inputFile, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | flags, NULL);
if (fileHandle == INVALID_HANDLE_VALUE)
{
LogError("Failed to open file '%s'. GetLastError()=%u", inputFile, GetLastError());
@@ -26,7 +27,7 @@ HANDLE MethodContextReader::OpenFile(const char *inputFile, DWORD flags)
return fileHandle;
}
-static std::string to_lower(const std::string &input)
+static std::string to_lower(const std::string& input)
{
std::string res = input;
std::transform(input.cbegin(), input.cend(), res.begin(), tolower);
@@ -37,15 +38,16 @@ static std::string to_lower(const std::string &input)
// but only if foo.origSuffix exists.
//
// Note: filename extensions must be lower-case, even on case-sensitive file systems!
-std::string MethodContextReader::CheckForPairedFile(const std::string &fileName, const std::string &origSuffix, const std::string &newSuffix)
+std::string MethodContextReader::CheckForPairedFile(const std::string& fileName,
+ const std::string& origSuffix,
+ const std::string& newSuffix)
{
std::string tmp = to_lower(origSuffix);
// First, check to see if foo.origSuffix exists
size_t suffix_offset = fileName.find_last_of('.');
- if ((SSIZE_T)suffix_offset <= 0
- || (tmp != to_lower(fileName.substr(suffix_offset)))
- || (GetFileAttributesA(fileName.c_str()) == INVALID_FILE_ATTRIBUTES))
+ if ((SSIZE_T)suffix_offset <= 0 || (tmp != to_lower(fileName.substr(suffix_offset))) ||
+ (GetFileAttributesA(fileName.c_str()) == INVALID_FILE_ATTRIBUTES))
return std::string();
// next, check foo.orig.new from foo.orig
@@ -66,8 +68,8 @@ std::string MethodContextReader::CheckForPairedFile(const std::string &fileName,
return std::string();
}
-
-MethodContextReader::MethodContextReader(const char *inputFileName, const int *indexes, int indexCount, char *hash, int offset, int increment)
+MethodContextReader::MethodContextReader(
+ const char* inputFileName, const int* indexes, int indexCount, char* hash, int offset, int increment)
: fileHandle(INVALID_HANDLE_VALUE)
, fileSize(0)
, curMCIndex(0)
@@ -108,10 +110,12 @@ MethodContextReader::MethodContextReader(const char *inputFileName, const int *i
this->tocFile.LoadToc(tocFileName.c_str());
// we'll get here even if we don't have a valid index file
- this->fileHandle = OpenFile(mchFile.c_str(), (this->hasTOC() && this->hasIndex()) ? FILE_ATTRIBUTE_NORMAL : FILE_FLAG_SEQUENTIAL_SCAN);
+ this->fileHandle =
+ OpenFile(mchFile.c_str(),
+ (this->hasTOC() && this->hasIndex()) ? FILE_ATTRIBUTE_NORMAL : FILE_FLAG_SEQUENTIAL_SCAN);
if (this->fileHandle != INVALID_HANDLE_VALUE)
{
- GetFileSizeEx(this->fileHandle, (PLARGE_INTEGER)&this->fileSize);
+ GetFileSizeEx(this->fileHandle, (PLARGE_INTEGER) & this->fileSize);
}
}
@@ -139,14 +143,15 @@ void MethodContextReader::ReleaseLock()
bool MethodContextReader::atEof()
{
__int64 pos = 0;
- SetFilePointerEx(this->fileHandle, *(PLARGE_INTEGER)&pos, (PLARGE_INTEGER)&pos, FILE_CURRENT); // LARGE_INTEGER is a crime against humanity
+ SetFilePointerEx(this->fileHandle, *(PLARGE_INTEGER)&pos, (PLARGE_INTEGER)&pos,
+ FILE_CURRENT); // LARGE_INTEGER is a crime against humanity
return pos == this->fileSize;
}
MethodContextBuffer MethodContextReader::ReadMethodContextNoLock(bool justSkip)
{
- DWORD bytesRead;
- char buff[512];
+ DWORD bytesRead;
+ char buff[512];
unsigned int totalLen = 0;
if (atEof())
{
@@ -159,19 +164,20 @@ MethodContextBuffer MethodContextReader::ReadMethodContextNoLock(bool justSkip)
{
__int64 pos = totalLen + 2;
// Just move the file pointer ahead the correct number of bytes
- AssertMsg(SetFilePointerEx(this->fileHandle, *(PLARGE_INTEGER)&pos, (PLARGE_INTEGER)&pos, FILE_CURRENT) == TRUE, "SetFilePointerEx failed (Error %X)", GetLastError());
+ AssertMsg(SetFilePointerEx(this->fileHandle, *(PLARGE_INTEGER)&pos, (PLARGE_INTEGER)&pos, FILE_CURRENT) == TRUE,
+ "SetFilePointerEx failed (Error %X)", GetLastError());
- //Increment curMCIndex as we advanced the file pointer by another MC
+ // Increment curMCIndex as we advanced the file pointer by another MC
++curMCIndex;
return MethodContextBuffer(0);
}
else
{
- unsigned char *buff2 = new unsigned char[totalLen + 2]; //total + End Canary
+ unsigned char* buff2 = new unsigned char[totalLen + 2]; // total + End Canary
Assert(ReadFile(this->fileHandle, buff2, totalLen + 2, &bytesRead, NULL) == TRUE);
- //Increment curMCIndex as we read another MC
+ // Increment curMCIndex as we read another MC
++curMCIndex;
return MethodContextBuffer(buff2, totalLen);
@@ -186,13 +192,14 @@ MethodContextBuffer MethodContextReader::ReadMethodContext(bool acquireLock, boo
return MethodContextBuffer(-1);
}
- struct Param {
+ struct Param
+ {
MethodContextReader* pThis;
- MethodContextBuffer ret;
- bool justSkip;
+ MethodContextBuffer ret;
+ bool justSkip;
} param;
- param.pThis = this;
- param.ret = MethodContextBuffer(-2);
+ param.pThis = this;
+ param.ret = MethodContextBuffer(-2);
param.justSkip = justSkip;
PAL_TRY(Param*, pParam, &param)
@@ -214,8 +221,8 @@ MethodContextBuffer MethodContextReader::GetNextMethodContext()
{
struct Param : FilterSuperPMIExceptionsParam_CaptureException
{
- MethodContextReader* pThis;
- MethodContextBuffer mcb;
+ MethodContextReader* pThis;
+ MethodContextBuffer mcb;
} param;
param.pThis = this;
@@ -235,34 +242,34 @@ MethodContextBuffer MethodContextReader::GetNextMethodContext()
MethodContextBuffer MethodContextReader::GetNextMethodContextHelper()
{
- //If we have an offset/increment combo
+ // If we have an offset/increment combo
if (this->Offset > 0 && this->Increment > 0)
return GetNextMethodContextFromOffsetIncrement();
- //If we have an index
+ // If we have an index
if (this->hasIndex())
{
if (this->curIndexPos < this->IndexCount)
{
- //If we are not done with all of them
+ // If we are not done with all of them
return GetNextMethodContextFromIndexes();
}
- else //We are done with all of them, return
+ else // We are done with all of them, return
return MethodContextBuffer();
}
- //If we have a hash
+ // If we have a hash
if (this->Hash != nullptr)
return GetNextMethodContextFromHash();
- //If we don't have any of these options return all MCs one by one
+ // If we don't have any of these options return all MCs one by one
return this->ReadMethodContext(true);
}
// Read a method context buffer from the ContextCollection using Indexes
MethodContextBuffer MethodContextReader::GetNextMethodContextFromIndexes()
{
- //Assert if we don't have an Index or we are done with all the indexes
+ // Assert if we don't have an Index or we are done with all the indexes
Assert(this->hasIndex() && this->curIndexPos < this->IndexCount);
if (this->hasTOC())
@@ -291,29 +298,29 @@ MethodContextBuffer MethodContextReader::GetNextMethodContextFromIndexes()
// Read a method context buffer from the ContextCollection using Hash
MethodContextBuffer MethodContextReader::GetNextMethodContextFromHash()
{
- //Assert if we don't have a valid hash
+ // Assert if we don't have a valid hash
Assert(this->Hash != nullptr);
if (this->hasTOC())
{
- //We have a TOC so lets go through the TOCElements
- //one-by-one till we find a matching hash
+ // We have a TOC so lets go through the TOCElements
+ //one-by-one till we find a matching hash
for (; curTOCIndex < (int)this->tocFile.GetTocCount(); curTOCIndex++)
{
if (_strnicmp(this->Hash, this->tocFile.GetElementPtr(curTOCIndex)->Hash, MD5_HASH_BUFFER_SIZE) == 0)
{
- //We found a match, return this specific method
+ // We found a match, return this specific method
return this->GetSpecificMethodContext(this->tocFile.GetElementPtr(curTOCIndex++)->Number);
}
}
- //No more matches in the TOC for our hash value
+ // No more matches in the TOC for our hash value
return MethodContextBuffer();
}
else
{
// Keep reading all MCs until we hit a match
- //or we reach the end or hit an error
+ //or we reach the end or hit an error
while (true)
{
// Read a method context
@@ -324,12 +331,12 @@ MethodContextBuffer MethodContextReader::GetNextMethodContextFromHash()
char mcHash[MD5_HASH_BUFFER_SIZE];
- //Create a temporary copy of mcb.buff plus ending 2-byte canary
- //this will get freed up by MethodContext constructor
- unsigned char *buff = new unsigned char[mcb.size + 2];
+ // Create a temporary copy of mcb.buff plus ending 2-byte canary
+ //this will get freed up by MethodContext constructor
+ unsigned char* buff = new unsigned char[mcb.size + 2];
memcpy(buff, mcb.buff, mcb.size + 2);
- MethodContext *mc;
+ MethodContext* mc;
if (!MethodContext::Initialize(-1, buff, mcb.size, &mc))
return MethodContextBuffer(-1);
@@ -339,13 +346,13 @@ MethodContextBuffer MethodContextReader::GetNextMethodContextFromHash()
if (_strnicmp(this->Hash, mcHash, MD5_HASH_BUFFER_SIZE) == 0)
{
- //We found a match, return this specific method
+ // We found a match, return this specific method
return mcb;
}
}
}
- //We should never get here under normal conditions
+ // We should never get here under normal conditions
AssertMsg(true, "Unexpected condition hit while reading input file.");
return MethodContextBuffer(-1);
}
@@ -353,17 +360,17 @@ MethodContextBuffer MethodContextReader::GetNextMethodContextFromHash()
// Read a method context buffer from the ContextCollection using offset/increment
MethodContextBuffer MethodContextReader::GetNextMethodContextFromOffsetIncrement()
{
- //Assert if we don't have a valid increment/offset combo
+ // Assert if we don't have a valid increment/offset combo
Assert(this->Offset > 0 && this->Increment > 0);
int methodNumber = this->curMCIndex > 0 ? this->curMCIndex + this->Increment : this->Offset;
if (this->hasTOC())
{
- //Check if we are within the TOC
+ // Check if we are within the TOC
if ((int)this->tocFile.GetTocCount() >= methodNumber)
{
- //We have a TOC so we can request a specific method context
+ // We have a TOC so we can request a specific method context
return this->GetSpecificMethodContext(methodNumber);
}
else
@@ -374,7 +381,7 @@ MethodContextBuffer MethodContextReader::GetNextMethodContextFromOffsetIncrement
// Keep skipping MCs until we get to the one we need to return
while (this->curMCIndex + 1 < methodNumber)
{
- //skip over a method
+ // skip over a method
MethodContextBuffer mcb = this->ReadMethodContext(true, true);
if (mcb.allDone() || mcb.Error())
return mcb;
@@ -421,10 +428,10 @@ __int64 MethodContextReader::GetOffset(unsigned int methodNumber)
if (!this->hasTOC())
return -2;
size_t high = this->tocFile.GetTocCount() - 1;
- size_t low = 0;
+ size_t low = 0;
while (low <= high)
{
- size_t pos = (high + low) / 2;
+ size_t pos = (high + low) / 2;
unsigned int num = this->tocFile.GetElementPtr(pos)->Number;
if (num == methodNumber)
return this->tocFile.GetElementPtr(pos)->Offset;
@@ -454,8 +461,8 @@ MethodContextBuffer MethodContextReader::GetSpecificMethodContext(unsigned int m
// ReadMethodContext will release the lock, but we already acquired it
MethodContextBuffer mcb = this->ReadMethodContext(false);
- //The curMCIndex value updated by ReadMethodContext() is incorrect
- //since we are repositioning the file pointer we need to update it
+ // The curMCIndex value updated by ReadMethodContext() is incorrect
+ //since we are repositioning the file pointer we need to update it
curMCIndex = methodNumber;
return mcb;
diff --git a/src/ToolBox/superpmi/superpmi-shared/methodcontextreader.h b/src/ToolBox/superpmi/superpmi-shared/methodcontextreader.h
index 0068fa231f..e9ee451115 100644
--- a/src/ToolBox/superpmi/superpmi-shared/methodcontextreader.h
+++ b/src/ToolBox/superpmi/superpmi-shared/methodcontextreader.h
@@ -17,16 +17,29 @@ struct MethodContextBuffer
{
private:
static const int Completed = 0x1234abcd;
+
public:
- unsigned char *buff;
- DWORD size;
+ unsigned char* buff;
+ DWORD size;
- MethodContextBuffer() : buff(nullptr), size(Completed) {}
- MethodContextBuffer(DWORD error) : buff(nullptr), size(error) {}
- MethodContextBuffer(unsigned char *b, DWORD e) : buff(b), size(e) {}
+ MethodContextBuffer() : buff(nullptr), size(Completed)
+ {
+ }
+ MethodContextBuffer(DWORD error) : buff(nullptr), size(error)
+ {
+ }
+ MethodContextBuffer(unsigned char* b, DWORD e) : buff(b), size(e)
+ {
+ }
- bool allDone() { return size == Completed && buff == nullptr; }
- bool Error() { return size != 0 && size != Completed && buff == nullptr; }
+ bool allDone()
+ {
+ return size == Completed && buff == nullptr;
+ }
+ bool Error()
+ {
+ return size != 0 && size != Completed && buff == nullptr;
+ }
};
// The pack(4) directive is so that each entry is 12 bytes, intead of 16
@@ -35,7 +48,6 @@ public:
class MethodContextReader
{
private:
-
// The MC/MCH file
HANDLE fileHandle;
@@ -47,23 +59,23 @@ private:
// The synchronization mutex
HANDLE mutex;
- bool AcquireLock();
- void ReleaseLock();
+ bool AcquireLock();
+ void ReleaseLock();
TOCFile tocFile;
// Method ranges to process
// If you have an index file, these things get processed
// much faster, now
- const int *Indexes;
- int IndexCount;
- int curIndexPos;
+ const int* Indexes;
+ int IndexCount;
+ int curIndexPos;
// Method hash to process
// If you have an index file, these things get processed
// much faster, now
- char *Hash;
- int curTOCIndex;
+ char* Hash;
+ int curTOCIndex;
// Offset/increment if running in parallel mode
// If you have an index file, these things get processed
@@ -76,7 +88,7 @@ private:
__int64 GetOffset(unsigned int methodNumber);
// Just a helper...
- static HANDLE OpenFile(const char *inputFile, DWORD flags = FILE_ATTRIBUTE_NORMAL);
+ static HANDLE OpenFile(const char* inputFile, DWORD flags = FILE_ATTRIBUTE_NORMAL);
MethodContextBuffer ReadMethodContextNoLock(bool justSkip = false);
MethodContextBuffer ReadMethodContext(bool acquireLock, bool justSkip = false);
@@ -89,7 +101,9 @@ private:
// Looks for a file named foo.origSuffix.newSuffix or foo.newSuffix
// but only if foo.origSuffix exists
- static std::string CheckForPairedFile(const std::string &fileName, const std::string &origSuffix, const std::string &newSuffix);
+ static std::string CheckForPairedFile(const std::string& fileName,
+ const std::string& origSuffix,
+ const std::string& newSuffix);
// are we're at the end of the file...
bool atEof();
@@ -101,18 +115,22 @@ private:
bool hasIndex();
public:
-
- MethodContextReader(const char *inputFileName, const int *indexes = nullptr, int indexCount = -1, char *hash = nullptr, int offset = -1, int increment = -1);
+ MethodContextReader(const char* inputFileName,
+ const int* indexes = nullptr,
+ int indexCount = -1,
+ char* hash = nullptr,
+ int offset = -1,
+ int increment = -1);
~MethodContextReader();
// Read a method context buffer from the ContextCollection
// (either a hive [single] or an index)
MethodContextBuffer GetNextMethodContext();
// No C++ exceptions, so the constructor has to always succeed...
- bool isValid();
+ bool isValid();
double PercentComplete();
- //Returns the index of the last MethodContext read by GetNextMethodContext
+ // Returns the index of the last MethodContext read by GetNextMethodContext
inline int GetMethodContextIndex()
{
return curMCIndex;
diff --git a/src/ToolBox/superpmi/superpmi-shared/registertablexarch.h b/src/ToolBox/superpmi/superpmi-shared/registertablexarch.h
index 4704881082..f6c177cd04 100644
--- a/src/ToolBox/superpmi/superpmi-shared/registertablexarch.h
+++ b/src/ToolBox/superpmi/superpmi-shared/registertablexarch.h
@@ -8,7 +8,7 @@
//----------------------------------------------------------
#ifndef REGDEF
-#error Must define REGDEF macro before including this file
+#error Must define REGDEF macro before including this file
#endif
/*
@@ -16,104 +16,104 @@ REGDEF(msdisID, name)
*/
// 32 bit general purpose registers
-REGDEF(DISX86::REGA::regaEax, "eax")
-REGDEF(DISX86::REGA::regaEcx, "ecx")
-REGDEF(DISX86::REGA::regaEdx, "edx")
-REGDEF(DISX86::REGA::regaEbx, "ebx")
-REGDEF(DISX86::REGA::regaEsp, "esp")
-REGDEF(DISX86::REGA::regaEbp, "ebp")
-REGDEF(DISX86::REGA::regaEsi, "esi")
-REGDEF(DISX86::REGA::regaEdi, "edi")
-REGDEF(DISX86::REGA::regaR8d, "r8d")
-REGDEF(DISX86::REGA::regaR9d, "r9d")
-REGDEF(DISX86::REGA::regaR10d, "r10d")
-REGDEF(DISX86::REGA::regaR11d, "r11d")
-REGDEF(DISX86::REGA::regaR12d, "r12d")
-REGDEF(DISX86::REGA::regaR13d, "r13d")
-REGDEF(DISX86::REGA::regaR14d, "r14d")
-REGDEF(DISX86::REGA::regaR15d, "r15d")
+REGDEF(DISX86::REGA::regaEax, "eax")
+REGDEF(DISX86::REGA::regaEcx, "ecx")
+REGDEF(DISX86::REGA::regaEdx, "edx")
+REGDEF(DISX86::REGA::regaEbx, "ebx")
+REGDEF(DISX86::REGA::regaEsp, "esp")
+REGDEF(DISX86::REGA::regaEbp, "ebp")
+REGDEF(DISX86::REGA::regaEsi, "esi")
+REGDEF(DISX86::REGA::regaEdi, "edi")
+REGDEF(DISX86::REGA::regaR8d, "r8d")
+REGDEF(DISX86::REGA::regaR9d, "r9d")
+REGDEF(DISX86::REGA::regaR10d, "r10d")
+REGDEF(DISX86::REGA::regaR11d, "r11d")
+REGDEF(DISX86::REGA::regaR12d, "r12d")
+REGDEF(DISX86::REGA::regaR13d, "r13d")
+REGDEF(DISX86::REGA::regaR14d, "r14d")
+REGDEF(DISX86::REGA::regaR15d, "r15d")
// 64 bit general purpose registers
-REGDEF(DISX86::REGA::regaRax, "rax")
-REGDEF(DISX86::REGA::regaRcx, "rcx")
-REGDEF(DISX86::REGA::regaRdx, "rdx")
-REGDEF(DISX86::REGA::regaRbx, "rbx")
-REGDEF(DISX86::REGA::regaRsp, "rsp")
-REGDEF(DISX86::REGA::regaRbp, "rbp")
-REGDEF(DISX86::REGA::regaRsi, "rsi")
-REGDEF(DISX86::REGA::regaRdi, "rdi")
-REGDEF(DISX86::REGA::regaR8, "r8")
-REGDEF(DISX86::REGA::regaR9, "r9")
-REGDEF(DISX86::REGA::regaR10, "r10")
-REGDEF(DISX86::REGA::regaR11, "r11")
-REGDEF(DISX86::REGA::regaR12, "r12")
-REGDEF(DISX86::REGA::regaR13, "r13")
-REGDEF(DISX86::REGA::regaR14, "r14")
-REGDEF(DISX86::REGA::regaR15, "r15")
+REGDEF(DISX86::REGA::regaRax, "rax")
+REGDEF(DISX86::REGA::regaRcx, "rcx")
+REGDEF(DISX86::REGA::regaRdx, "rdx")
+REGDEF(DISX86::REGA::regaRbx, "rbx")
+REGDEF(DISX86::REGA::regaRsp, "rsp")
+REGDEF(DISX86::REGA::regaRbp, "rbp")
+REGDEF(DISX86::REGA::regaRsi, "rsi")
+REGDEF(DISX86::REGA::regaRdi, "rdi")
+REGDEF(DISX86::REGA::regaR8, "r8")
+REGDEF(DISX86::REGA::regaR9, "r9")
+REGDEF(DISX86::REGA::regaR10, "r10")
+REGDEF(DISX86::REGA::regaR11, "r11")
+REGDEF(DISX86::REGA::regaR12, "r12")
+REGDEF(DISX86::REGA::regaR13, "r13")
+REGDEF(DISX86::REGA::regaR14, "r14")
+REGDEF(DISX86::REGA::regaR15, "r15")
// 16 bit general purpose registers
-REGDEF(DISX86::REGA::regaAx, "ax")
-REGDEF(DISX86::REGA::regaCx, "cx")
-REGDEF(DISX86::REGA::regaDx, "dx")
-REGDEF(DISX86::REGA::regaBx, "bx")
-REGDEF(DISX86::REGA::regaSp, "sp")
-REGDEF(DISX86::REGA::regaBp, "bp")
-REGDEF(DISX86::REGA::regaSi, "si")
-REGDEF(DISX86::REGA::regaDi, "di")
-REGDEF(DISX86::REGA::regaR8w, "r8w")
-REGDEF(DISX86::REGA::regaR9w, "r9w")
-REGDEF(DISX86::REGA::regaR10w, "r10w")
-REGDEF(DISX86::REGA::regaR11w, "r11w")
-REGDEF(DISX86::REGA::regaR12w, "r12w")
-REGDEF(DISX86::REGA::regaR13w, "r13w")
-REGDEF(DISX86::REGA::regaR14w, "r14w")
-REGDEF(DISX86::REGA::regaR15w, "r15w")
+REGDEF(DISX86::REGA::regaAx, "ax")
+REGDEF(DISX86::REGA::regaCx, "cx")
+REGDEF(DISX86::REGA::regaDx, "dx")
+REGDEF(DISX86::REGA::regaBx, "bx")
+REGDEF(DISX86::REGA::regaSp, "sp")
+REGDEF(DISX86::REGA::regaBp, "bp")
+REGDEF(DISX86::REGA::regaSi, "si")
+REGDEF(DISX86::REGA::regaDi, "di")
+REGDEF(DISX86::REGA::regaR8w, "r8w")
+REGDEF(DISX86::REGA::regaR9w, "r9w")
+REGDEF(DISX86::REGA::regaR10w, "r10w")
+REGDEF(DISX86::REGA::regaR11w, "r11w")
+REGDEF(DISX86::REGA::regaR12w, "r12w")
+REGDEF(DISX86::REGA::regaR13w, "r13w")
+REGDEF(DISX86::REGA::regaR14w, "r14w")
+REGDEF(DISX86::REGA::regaR15w, "r15w")
// 8 bit general purpose registers
-REGDEF(DISX86::REGA::regaAl, "al")
-REGDEF(DISX86::REGA::regaCl, "cl")
-REGDEF(DISX86::REGA::regaDl, "dl")
-REGDEF(DISX86::REGA::regaBl, "bl")
-REGDEF(DISX86::REGA::regaSpl, "spl")
-REGDEF(DISX86::REGA::regaBpl, "bpl")
-REGDEF(DISX86::REGA::regaSil, "sil")
-REGDEF(DISX86::REGA::regaDil, "dil")
-REGDEF(DISX86::REGA::regaR8b, "r8b")
-REGDEF(DISX86::REGA::regaR9b, "r9b")
-REGDEF(DISX86::REGA::regaR10b, "r10b")
-REGDEF(DISX86::REGA::regaR11b, "r11b")
-REGDEF(DISX86::REGA::regaR12b, "r12b")
-REGDEF(DISX86::REGA::regaR13b, "r13b")
-REGDEF(DISX86::REGA::regaR14b, "r14b")
-REGDEF(DISX86::REGA::regaR15b, "r15b")
+REGDEF(DISX86::REGA::regaAl, "al")
+REGDEF(DISX86::REGA::regaCl, "cl")
+REGDEF(DISX86::REGA::regaDl, "dl")
+REGDEF(DISX86::REGA::regaBl, "bl")
+REGDEF(DISX86::REGA::regaSpl, "spl")
+REGDEF(DISX86::REGA::regaBpl, "bpl")
+REGDEF(DISX86::REGA::regaSil, "sil")
+REGDEF(DISX86::REGA::regaDil, "dil")
+REGDEF(DISX86::REGA::regaR8b, "r8b")
+REGDEF(DISX86::REGA::regaR9b, "r9b")
+REGDEF(DISX86::REGA::regaR10b, "r10b")
+REGDEF(DISX86::REGA::regaR11b, "r11b")
+REGDEF(DISX86::REGA::regaR12b, "r12b")
+REGDEF(DISX86::REGA::regaR13b, "r13b")
+REGDEF(DISX86::REGA::regaR14b, "r14b")
+REGDEF(DISX86::REGA::regaR15b, "r15b")
// 8 bit general purpose registers
-REGDEF(DISX86::REGA::regaAh, "ah")
-REGDEF(DISX86::REGA::regaCh, "ch")
-REGDEF(DISX86::REGA::regaDh, "dh")
-REGDEF(DISX86::REGA::regaBh, "bh")
+REGDEF(DISX86::REGA::regaAh, "ah")
+REGDEF(DISX86::REGA::regaCh, "ch")
+REGDEF(DISX86::REGA::regaDh, "dh")
+REGDEF(DISX86::REGA::regaBh, "bh")
// x87 floating point stack
-REGDEF(DISX86::REGA::regaSt0, "st0")
-REGDEF(DISX86::REGA::regaSt1, "st1")
-REGDEF(DISX86::REGA::regaSt2, "st2")
-REGDEF(DISX86::REGA::regaSt3, "st3")
-REGDEF(DISX86::REGA::regaSt4, "st4")
-REGDEF(DISX86::REGA::regaSt5, "st5")
-REGDEF(DISX86::REGA::regaSt6, "st6")
-REGDEF(DISX86::REGA::regaSt7, "st7")
+REGDEF(DISX86::REGA::regaSt0, "st0")
+REGDEF(DISX86::REGA::regaSt1, "st1")
+REGDEF(DISX86::REGA::regaSt2, "st2")
+REGDEF(DISX86::REGA::regaSt3, "st3")
+REGDEF(DISX86::REGA::regaSt4, "st4")
+REGDEF(DISX86::REGA::regaSt5, "st5")
+REGDEF(DISX86::REGA::regaSt6, "st6")
+REGDEF(DISX86::REGA::regaSt7, "st7")
// XMM registers
-REGDEF(DISX86::REGA::regaXmm0, "xmm0")
-REGDEF(DISX86::REGA::regaXmm1, "xmm1")
-REGDEF(DISX86::REGA::regaXmm2, "xmm2")
-REGDEF(DISX86::REGA::regaXmm3, "xmm3")
-REGDEF(DISX86::REGA::regaXmm4, "xmm4")
-REGDEF(DISX86::REGA::regaXmm5, "xmm5")
-REGDEF(DISX86::REGA::regaXmm6, "xmm6")
-REGDEF(DISX86::REGA::regaXmm7, "xmm7")
-REGDEF(DISX86::REGA::regaXmm8, "xmm8")
-REGDEF(DISX86::REGA::regaXmm9, "xmm9")
+REGDEF(DISX86::REGA::regaXmm0, "xmm0")
+REGDEF(DISX86::REGA::regaXmm1, "xmm1")
+REGDEF(DISX86::REGA::regaXmm2, "xmm2")
+REGDEF(DISX86::REGA::regaXmm3, "xmm3")
+REGDEF(DISX86::REGA::regaXmm4, "xmm4")
+REGDEF(DISX86::REGA::regaXmm5, "xmm5")
+REGDEF(DISX86::REGA::regaXmm6, "xmm6")
+REGDEF(DISX86::REGA::regaXmm7, "xmm7")
+REGDEF(DISX86::REGA::regaXmm8, "xmm8")
+REGDEF(DISX86::REGA::regaXmm9, "xmm9")
REGDEF(DISX86::REGA::regaXmm10, "xmm10")
REGDEF(DISX86::REGA::regaXmm11, "xmm11")
REGDEF(DISX86::REGA::regaXmm12, "xmm12")
diff --git a/src/ToolBox/superpmi/superpmi-shared/runtimedetails.h b/src/ToolBox/superpmi/superpmi-shared/runtimedetails.h
index 4677299e3a..019c2d1841 100644
--- a/src/ToolBox/superpmi/superpmi-shared/runtimedetails.h
+++ b/src/ToolBox/superpmi/superpmi-shared/runtimedetails.h
@@ -9,7 +9,7 @@
#ifndef _RuntimeDetails
#define _RuntimeDetails
-//Our little collection of enough of the CLR data to get the JIT up and working...
+// Our little collection of enough of the CLR data to get the JIT up and working...
#define FEATURE_CLRSQM
#if !defined(_TARGET_AMD64_) && !defined(_TARGET_X86_) && !defined(_TARGET_ARM64_) && !defined(_TARGET_ARM_)
@@ -20,13 +20,13 @@
#endif
#endif // _TARGET_* not previously defined
-#define __EXCEPTION_RECORD_CLR //trick out clrntexception.h to not include another exception record....
+#define __EXCEPTION_RECORD_CLR // trick out clrntexception.h to not include another exception record....
#include <mscoree.h>
#include <corjit.h>
#include <utilcode.h>
-///Turn back on direct access to a few OS level things...
+/// Turn back on direct access to a few OS level things...
#undef HeapCreate
#undef HeapAlloc
#undef HeapFree
@@ -35,9 +35,9 @@
#undef TlsGetValue
#undef TlsSetValue
-//Jit Exports
-typedef ICorJitCompiler* (__stdcall *PgetJit)();
-typedef void (__stdcall *PjitStartup)(ICorJitHost* host);
-typedef void (__stdcall *PsxsJitStartup)(CoreClrCallbacks const & cccallbacks);
+// Jit Exports
+typedef ICorJitCompiler*(__stdcall* PgetJit)();
+typedef void(__stdcall* PjitStartup)(ICorJitHost* host);
+typedef void(__stdcall* PsxsJitStartup)(CoreClrCallbacks const& cccallbacks);
#endif
diff --git a/src/ToolBox/superpmi/superpmi-shared/simpletimer.cpp b/src/ToolBox/superpmi/superpmi-shared/simpletimer.cpp
index e9c76339bc..6fa1f8ea89 100644
--- a/src/ToolBox/superpmi/superpmi-shared/simpletimer.cpp
+++ b/src/ToolBox/superpmi/superpmi-shared/simpletimer.cpp
@@ -10,10 +10,10 @@
SimpleTimer::SimpleTimer()
{
start.QuadPart = 0;
- stop.QuadPart = 0;
+ stop.QuadPart = 0;
BOOL retVal = ::QueryPerformanceFrequency(&proc_freq);
- if(retVal == FALSE)
+ if (retVal == FALSE)
{
LogDebug("SimpleTimer::SimpleTimer unable to QPF. error was 0x%08x", ::GetLastError());
::__debugbreak();
@@ -27,7 +27,7 @@ SimpleTimer::~SimpleTimer()
void SimpleTimer::Start()
{
BOOL retVal = ::QueryPerformanceCounter(&start);
- if(retVal == FALSE)
+ if (retVal == FALSE)
{
LogDebug("SimpleTimer::Start unable to QPC. error was 0x%08x", ::GetLastError());
::__debugbreak();
@@ -37,7 +37,7 @@ void SimpleTimer::Start()
void SimpleTimer::Stop()
{
BOOL retVal = ::QueryPerformanceCounter(&stop);
- if(retVal == FALSE)
+ if (retVal == FALSE)
{
LogDebug("SimpleTimer::Stop unable to QPC. error was 0x%08x", ::GetLastError());
::__debugbreak();
@@ -46,11 +46,10 @@ void SimpleTimer::Stop()
double SimpleTimer::GetMilliseconds()
{
- return GetSeconds()*1000.0;
+ return GetSeconds() * 1000.0;
}
double SimpleTimer::GetSeconds()
{
return ((stop.QuadPart - start.QuadPart) / (double)proc_freq.QuadPart);
}
-
diff --git a/src/ToolBox/superpmi/superpmi-shared/simpletimer.h b/src/ToolBox/superpmi/superpmi-shared/simpletimer.h
index b5edd7c65e..5ada33c991 100644
--- a/src/ToolBox/superpmi/superpmi-shared/simpletimer.h
+++ b/src/ToolBox/superpmi/superpmi-shared/simpletimer.h
@@ -12,8 +12,8 @@ public:
SimpleTimer();
~SimpleTimer();
- void Start();
- void Stop();
+ void Start();
+ void Stop();
double GetMilliseconds();
double GetSeconds();
diff --git a/src/ToolBox/superpmi/superpmi-shared/spmiutil.cpp b/src/ToolBox/superpmi/superpmi-shared/spmiutil.cpp
index e99e6f4ae2..8f609847f7 100644
--- a/src/ToolBox/superpmi/superpmi-shared/spmiutil.cpp
+++ b/src/ToolBox/superpmi/superpmi-shared/spmiutil.cpp
@@ -21,7 +21,7 @@ void DebugBreakorAV(int val)
__debugbreak();
if (breakOnDebugBreakorAV)
__debugbreak();
- }
+ }
int exception_code = EXCEPTIONCODE_DebugBreakorAV + val;
// assert((EXCEPTIONCODE_DebugBreakorAV <= exception_code) && (exception_code < EXCEPTIONCODE_DebugBreakorAV_MAX))
@@ -37,13 +37,13 @@ char* GetEnvironmentVariableWithDefaultA(const char* envVarName, const char* def
if (dwRetVal != 0)
{
retString = new char[dwRetVal];
- dwRetVal = ::GetEnvironmentVariableA(envVarName, retString, dwRetVal);
+ dwRetVal = ::GetEnvironmentVariableA(envVarName, retString, dwRetVal);
}
else
{
if (defaultValue != nullptr)
{
- dwRetVal = (DWORD)strlen(defaultValue) + 1; // add one for null terminator
+ dwRetVal = (DWORD)strlen(defaultValue) + 1; // add one for null terminator
retString = new char[dwRetVal];
memcpy_s(retString, dwRetVal, defaultValue, dwRetVal);
}
@@ -61,13 +61,13 @@ WCHAR* GetEnvironmentVariableWithDefaultW(const WCHAR* envVarName, const WCHAR*
if (dwRetVal != 0)
{
retString = new WCHAR[dwRetVal];
- dwRetVal = ::GetEnvironmentVariableW(envVarName, retString, dwRetVal);
+ dwRetVal = ::GetEnvironmentVariableW(envVarName, retString, dwRetVal);
}
else
{
if (defaultValue != nullptr)
{
- dwRetVal = (DWORD)wcslen(defaultValue) + 1; // add one for null terminator
+ dwRetVal = (DWORD)wcslen(defaultValue) + 1; // add one for null terminator
retString = new WCHAR[dwRetVal];
memcpy_s(retString, dwRetVal * sizeof(WCHAR), defaultValue, dwRetVal * sizeof(WCHAR));
}
@@ -80,7 +80,7 @@ WCHAR* GetEnvironmentVariableWithDefaultW(const WCHAR* envVarName, const WCHAR*
// For some reason, the PAL doesn't have GetCommandLineA(). So write it.
LPSTR GetCommandLineA()
{
- LPSTR pCmdLine = nullptr;
+ LPSTR pCmdLine = nullptr;
LPWSTR pwCmdLine = GetCommandLineW();
if (pwCmdLine != nullptr)
diff --git a/src/ToolBox/superpmi/superpmi-shared/spmiutil.h b/src/ToolBox/superpmi/superpmi-shared/spmiutil.h
index 6c8db3948a..7565122839 100644
--- a/src/ToolBox/superpmi/superpmi-shared/spmiutil.h
+++ b/src/ToolBox/superpmi/superpmi-shared/spmiutil.h
@@ -12,7 +12,7 @@
extern bool breakOnDebugBreakorAV;
-extern void DebugBreakorAV(int val); //Global(ish) error handler
+extern void DebugBreakorAV(int val); // Global(ish) error handler
extern char* GetEnvironmentVariableWithDefaultA(const char* envVarName, const char* defaultValue = nullptr);
diff --git a/src/ToolBox/superpmi/superpmi-shared/standardpch.h b/src/ToolBox/superpmi/superpmi-shared/standardpch.h
index 4164244085..f1ad24898d 100644
--- a/src/ToolBox/superpmi/superpmi-shared/standardpch.h
+++ b/src/ToolBox/superpmi/superpmi-shared/standardpch.h
@@ -23,7 +23,7 @@
#endif // INTERNAL_BUILD
#ifdef _MSC_VER
-#pragma warning(disable: 4996) // The compiler encountered a deprecated declaration.
+#pragma warning(disable : 4996) // The compiler encountered a deprecated declaration.
// On Windows, we build against PAL macros that convert to Windows SEH. But we don't want all the
// Contract stuff that normally gets pulled it. Defining JIT_BUILD prevents this, just as it does
@@ -32,7 +32,8 @@
// Defining this prevents:
// error C2338 : / RTCc rejects conformant code, so it isn't supported by the C++ Standard Library.
-// Either remove this compiler option, or define _ALLOW_RTCc_IN_STL to acknowledge that you have received this warning.
+// Either remove this compiler option, or define _ALLOW_RTCc_IN_STL to acknowledge that you have received this
+// warning.
#ifndef _ALLOW_RTCc_IN_STL
#define _ALLOW_RTCc_IN_STL
#endif
@@ -90,9 +91,9 @@
#ifndef W
#ifdef PLATFORM_UNIX
-#define W(str) u##str
+#define W(str) u##str
#else // PLATFORM_UNIX
-#define W(str) L##str
+#define W(str) L##str
#endif // PLATFORM_UNIX
#endif // !W
diff --git a/src/ToolBox/superpmi/superpmi-shared/tocfile.cpp b/src/ToolBox/superpmi/superpmi-shared/tocfile.cpp
index c91ca89c93..f0979fc5c3 100644
--- a/src/ToolBox/superpmi/superpmi-shared/tocfile.cpp
+++ b/src/ToolBox/superpmi/superpmi-shared/tocfile.cpp
@@ -12,9 +12,10 @@
#include "logging.h"
// Tries to load a Table of Contents
-void TOCFile::LoadToc(const char *inputFileName, bool validate)
+void TOCFile::LoadToc(const char* inputFileName, bool validate)
{
- HANDLE hIndex = CreateFileA(inputFileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
+ HANDLE hIndex = CreateFileA(inputFileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING,
+ FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
if (hIndex == INVALID_HANDLE_VALUE)
{
LogError("Failed to open file '%s'. GetLastError()=%u", inputFileName, GetLastError());
@@ -23,9 +24,8 @@ void TOCFile::LoadToc(const char *inputFileName, bool validate)
// Now read the index file
LARGE_INTEGER val; // I'm abusing LARGE_INTEGER here...
- DWORD read;
- if (!ReadFile(hIndex, &val, sizeof(val), &read, nullptr) ||
- (val.u.LowPart != *(DWORD *)("INDX")))
+ DWORD read;
+ if (!ReadFile(hIndex, &val, sizeof(val), &read, nullptr) || (val.u.LowPart != *(DWORD*)("INDX")))
{
CloseHandle(hIndex);
LogWarning("The index file %s is invalid: it seems to be missing the starting sentinel/length", inputFileName);
@@ -46,8 +46,7 @@ void TOCFile::LoadToc(const char *inputFileName, bool validate)
}
// Get the last 4 byte token (more abuse of LARGE_INTEGER)
- if (!ReadFile(hIndex, &val.u.HighPart, sizeof(DWORD), &read, nullptr) ||
- (read != sizeof(DWORD)) ||
+ if (!ReadFile(hIndex, &val.u.HighPart, sizeof(DWORD), &read, nullptr) || (read != sizeof(DWORD)) ||
(val.u.LowPart != val.u.HighPart))
{
CloseHandle(hIndex);
diff --git a/src/ToolBox/superpmi/superpmi-shared/tocfile.h b/src/ToolBox/superpmi/superpmi-shared/tocfile.h
index a0e7bde146..7bafc39140 100644
--- a/src/ToolBox/superpmi/superpmi-shared/tocfile.h
+++ b/src/ToolBox/superpmi/superpmi-shared/tocfile.h
@@ -16,16 +16,14 @@ class TOCElement
{
public:
__int64 Offset;
- int Number;
- char Hash[MD5_HASH_BUFFER_SIZE];
+ int Number;
+ char Hash[MD5_HASH_BUFFER_SIZE];
TOCElement()
{
}
- TOCElement(int number, __int64 offset)
- : Offset(offset)
- , Number(number)
+ TOCElement(int number, __int64 offset) : Offset(offset), Number(number)
{
}
};
@@ -33,15 +31,11 @@ public:
class TOCFile
{
private:
-
TOCElement* m_tocArray;
size_t m_tocCount;
public:
-
- TOCFile()
- : m_tocArray(nullptr)
- , m_tocCount(0)
+ TOCFile() : m_tocArray(nullptr), m_tocCount(0)
{
}
@@ -57,7 +51,7 @@ public:
m_tocCount = 0;
}
- void LoadToc(const char *inputFileName, bool validate = true);
+ void LoadToc(const char* inputFileName, bool validate = true);
size_t GetTocCount()
{
diff --git a/src/ToolBox/superpmi/superpmi-shared/typeutils.cpp b/src/ToolBox/superpmi/superpmi-shared/typeutils.cpp
index 0b2eee6b4a..9b3ad4c88a 100644
--- a/src/ToolBox/superpmi/superpmi-shared/typeutils.cpp
+++ b/src/ToolBox/superpmi/superpmi-shared/typeutils.cpp
@@ -13,78 +13,78 @@
// Returns a string representation of the given CorInfoType. The naming scheme is based on JITtype2varType
// in src/jit/ee_il_dll.hpp.
-const char *TypeUtils::GetCorInfoTypeName(CorInfoType type)
+const char* TypeUtils::GetCorInfoTypeName(CorInfoType type)
{
switch (type)
{
- case CORINFO_TYPE_VOID:
- return "void";
+ case CORINFO_TYPE_VOID:
+ return "void";
- case CORINFO_TYPE_BOOL:
- return "bool";
+ case CORINFO_TYPE_BOOL:
+ return "bool";
- case CORINFO_TYPE_CHAR:
- return "char";
+ case CORINFO_TYPE_CHAR:
+ return "char";
- case CORINFO_TYPE_BYTE:
- return "byte";
+ case CORINFO_TYPE_BYTE:
+ return "byte";
- case CORINFO_TYPE_UBYTE:
- return "ubyte";
+ case CORINFO_TYPE_UBYTE:
+ return "ubyte";
- case CORINFO_TYPE_SHORT:
- return "short";
+ case CORINFO_TYPE_SHORT:
+ return "short";
- case CORINFO_TYPE_USHORT:
- return "ushort";
+ case CORINFO_TYPE_USHORT:
+ return "ushort";
- case CORINFO_TYPE_INT:
- return "int";
+ case CORINFO_TYPE_INT:
+ return "int";
- case CORINFO_TYPE_UINT:
- return "uint";
+ case CORINFO_TYPE_UINT:
+ return "uint";
- case CORINFO_TYPE_LONG:
- return "long";
+ case CORINFO_TYPE_LONG:
+ return "long";
- case CORINFO_TYPE_ULONG:
- return "ulong";
+ case CORINFO_TYPE_ULONG:
+ return "ulong";
- case CORINFO_TYPE_FLOAT:
- return "float";
+ case CORINFO_TYPE_FLOAT:
+ return "float";
- case CORINFO_TYPE_DOUBLE:
- return "double";
+ case CORINFO_TYPE_DOUBLE:
+ return "double";
- case CORINFO_TYPE_BYREF:
- return "byref";
+ case CORINFO_TYPE_BYREF:
+ return "byref";
- case CORINFO_TYPE_VALUECLASS:
- case CORINFO_TYPE_REFANY:
- return "struct";
+ case CORINFO_TYPE_VALUECLASS:
+ case CORINFO_TYPE_REFANY:
+ return "struct";
- case CORINFO_TYPE_STRING:
- case CORINFO_TYPE_CLASS:
- case CORINFO_TYPE_VAR:
- return "ref";
+ case CORINFO_TYPE_STRING:
+ case CORINFO_TYPE_CLASS:
+ case CORINFO_TYPE_VAR:
+ return "ref";
- case CORINFO_TYPE_NATIVEINT:
- case CORINFO_TYPE_NATIVEUINT:
- // Emulates the JIT's concept of TYP_I_IMPL
+ case CORINFO_TYPE_NATIVEINT:
+ case CORINFO_TYPE_NATIVEUINT:
+// Emulates the JIT's concept of TYP_I_IMPL
#if defined(_TARGET_AMD64_) // TODO: should be _TARGET_64BIT_
- return "long";
+ return "long";
#else
- return "int";
+ return "int";
#endif
- case CORINFO_TYPE_PTR:
- // The JIT just treats this as a TYP_I_IMPL because this isn't a GC root,
- // but we don't care about GC-ness: we care about pointer-sized.
- return "ptr";
+ case CORINFO_TYPE_PTR:
+ // The JIT just treats this as a TYP_I_IMPL because this isn't a GC root,
+ // but we don't care about GC-ness: we care about pointer-sized.
+ return "ptr";
- default:
- LogException(EXCEPTIONCODE_TYPEUTILS, "Unknown type passed into GetCorInfoTypeName (0x%x)", type);
- return "UNKNOWN";
+ default:
+ LogException(EXCEPTIONCODE_TYPEUTILS, "Unknown type passed into GetCorInfoTypeName (0x%x)", type);
+ return "UNKNOWN";
}
}
@@ -95,8 +95,8 @@ bool TypeUtils::IsFloatingPoint(CorInfoType type)
bool TypeUtils::IsPointer(CorInfoType type)
{
- return (type == CORINFO_TYPE_STRING || type == CORINFO_TYPE_PTR ||
- type == CORINFO_TYPE_BYREF || type == CORINFO_TYPE_CLASS);
+ return (type == CORINFO_TYPE_STRING || type == CORINFO_TYPE_PTR || type == CORINFO_TYPE_BYREF ||
+ type == CORINFO_TYPE_CLASS);
}
bool TypeUtils::IsValueClass(CorInfoType type)
@@ -106,11 +106,11 @@ bool TypeUtils::IsValueClass(CorInfoType type)
// Determines if a value class, represented by the given class handle, is required to be passed
// by reference (i.e. it cannot be stuffed as-is into a register or stack slot).
-bool TypeUtils::ValueClassRequiresByref(MethodContext *mc, CORINFO_CLASS_HANDLE clsHnd)
+bool TypeUtils::ValueClassRequiresByref(MethodContext* mc, CORINFO_CLASS_HANDLE clsHnd)
{
#if defined(_TARGET_AMD64_)
size_t size = mc->repGetClassSize(clsHnd);
- return ((size > sizeof(void *)) || ((size & (size - 1)) != 0));
+ return ((size > sizeof(void*)) || ((size & (size - 1)) != 0));
#else
LogException(EXCEPTIONCODE_TYPEUTILS, "unsupported architecture", "");
return false;
@@ -129,7 +129,7 @@ size_t TypeUtils::SizeOfCorInfoType(CorInfoType type)
case CORINFO_TYPE_BOOL:
return sizeof(BYTE);
- case CORINFO_TYPE_CHAR: // 2 bytes for Unicode
+ case CORINFO_TYPE_CHAR: // 2 bytes for Unicode
case CORINFO_TYPE_SHORT:
case CORINFO_TYPE_USHORT:
return sizeof(WORD);
@@ -150,14 +150,14 @@ size_t TypeUtils::SizeOfCorInfoType(CorInfoType type)
case CORINFO_TYPE_PTR:
case CORINFO_TYPE_BYREF:
case CORINFO_TYPE_CLASS:
- return sizeof(void *);
+ return sizeof(void*);
// This should be obtained via repGetClassSize
case CORINFO_TYPE_VALUECLASS:
case CORINFO_TYPE_REFANY:
LogException(EXCEPTIONCODE_TYPEUTILS,
"SizeOfCorInfoType does not support value types; use repGetClassSize instead (type: 0x%x)",
- type);
+ type);
return 0;
case CORINFO_TYPE_UNDEF:
diff --git a/src/ToolBox/superpmi/superpmi-shared/typeutils.h b/src/ToolBox/superpmi/superpmi-shared/typeutils.h
index 31cb478020..c511618b74 100644
--- a/src/ToolBox/superpmi/superpmi-shared/typeutils.h
+++ b/src/ToolBox/superpmi/superpmi-shared/typeutils.h
@@ -14,11 +14,11 @@
class TypeUtils
{
public:
- static const char *GetCorInfoTypeName(CorInfoType type);
+ static const char* GetCorInfoTypeName(CorInfoType type);
static bool IsFloatingPoint(CorInfoType type);
static bool IsPointer(CorInfoType type);
static bool IsValueClass(CorInfoType type);
- static bool ValueClassRequiresByref(MethodContext *mc, CORINFO_CLASS_HANDLE clsHnd);
+ static bool ValueClassRequiresByref(MethodContext* mc, CORINFO_CLASS_HANDLE clsHnd);
static size_t SizeOfCorInfoType(CorInfoType type);
};
diff --git a/src/ToolBox/superpmi/superpmi-shim-collector/coreclrcallbacks.cpp b/src/ToolBox/superpmi/superpmi-shim-collector/coreclrcallbacks.cpp
index 5b764f2fa5..14a55b5d79 100644
--- a/src/ToolBox/superpmi/superpmi-shim-collector/coreclrcallbacks.cpp
+++ b/src/ToolBox/superpmi/superpmi-shim-collector/coreclrcallbacks.cpp
@@ -7,17 +7,14 @@
#include "coreclrcallbacks.h"
#include "iexecutionengine.h"
-typedef LPVOID (__stdcall * pfnEEHeapAllocInProcessHeap)(DWORD dwFlags, SIZE_T dwBytes);
-typedef BOOL (__stdcall * pfnEEHeapFreeInProcessHeap)(DWORD dwFlags, LPVOID lpMem);
-
-CoreClrCallbacks *original_CoreClrCallbacks = nullptr;
+CoreClrCallbacks* original_CoreClrCallbacks = nullptr;
pfnEEHeapAllocInProcessHeap original_EEHeapAllocInProcessHeap = nullptr;
-pfnEEHeapFreeInProcessHeap original_EEHeapFreeInProcessHeap = nullptr;
+pfnEEHeapFreeInProcessHeap original_EEHeapFreeInProcessHeap = nullptr;
-IExecutionEngine* STDMETHODCALLTYPE IEE_t()
+IExecutionEngine* IEE_t()
{
- interceptor_IEE *iee = new interceptor_IEE();
- iee->original_IEE = original_CoreClrCallbacks->m_pfnIEE();
+ interceptor_IEE* iee = new interceptor_IEE();
+ iee->original_IEE = original_CoreClrCallbacks->m_pfnIEE();
return iee;
}
@@ -29,29 +26,29 @@ HRESULT STDMETHODCALLTYPE GetCORSystemDirectory(LPWSTR pbuffer, DWORD cchBuffer,
}
*/
-LPVOID STDMETHODCALLTYPE EEHeapAllocInProcessHeap (DWORD dwFlags, SIZE_T dwBytes)
+LPVOID EEHeapAllocInProcessHeap(DWORD dwFlags, SIZE_T dwBytes)
{
- if(original_EEHeapAllocInProcessHeap == nullptr)
+ if (original_EEHeapAllocInProcessHeap == nullptr)
__debugbreak();
return original_EEHeapAllocInProcessHeap(dwFlags, dwBytes);
}
-BOOL STDMETHODCALLTYPE EEHeapFreeInProcessHeap (DWORD dwFlags, LPVOID lpMem)
+BOOL EEHeapFreeInProcessHeap(DWORD dwFlags, LPVOID lpMem)
{
- if(original_EEHeapFreeInProcessHeap == nullptr)
+ if (original_EEHeapFreeInProcessHeap == nullptr)
__debugbreak();
return original_EEHeapFreeInProcessHeap(dwFlags, lpMem);
}
-void* STDMETHODCALLTYPE GetCLRFunction(LPCSTR functionName)
+void* GetCLRFunction(LPCSTR functionName)
{
- if(strcmp(functionName, "EEHeapAllocInProcessHeap")==0)
+ if (strcmp(functionName, "EEHeapAllocInProcessHeap") == 0)
{
original_EEHeapAllocInProcessHeap =
(pfnEEHeapAllocInProcessHeap)original_CoreClrCallbacks->m_pfnGetCLRFunction("EEHeapAllocInProcessHeap");
return (void*)EEHeapAllocInProcessHeap;
}
- if(strcmp(functionName, "EEHeapFreeInProcessHeap")==0)
+ if (strcmp(functionName, "EEHeapFreeInProcessHeap") == 0)
{
original_EEHeapFreeInProcessHeap =
(pfnEEHeapFreeInProcessHeap)original_CoreClrCallbacks->m_pfnGetCLRFunction("EEHeapFreeInProcessHeap");
@@ -59,4 +56,3 @@ void* STDMETHODCALLTYPE GetCLRFunction(LPCSTR functionName)
}
return original_CoreClrCallbacks->m_pfnGetCLRFunction(functionName);
}
-
diff --git a/src/ToolBox/superpmi/superpmi-shim-collector/coreclrcallbacks.h b/src/ToolBox/superpmi/superpmi-shim-collector/coreclrcallbacks.h
index c8c3e27c66..a5257422cd 100644
--- a/src/ToolBox/superpmi/superpmi-shim-collector/coreclrcallbacks.h
+++ b/src/ToolBox/superpmi/superpmi-shim-collector/coreclrcallbacks.h
@@ -6,14 +6,8 @@
#ifndef _CoreClrCallbacks
#define _CoreClrCallbacks
-#include "runtimedetails.h"
+#include "coreclrcommoncallbacks.h"
-IExecutionEngine* STDMETHODCALLTYPE IEE_t();
-HRESULT STDMETHODCALLTYPE GetCORSystemDirectory(LPWSTR pbuffer, DWORD cchBuffer, DWORD* pdwlength);
-LPVOID STDMETHODCALLTYPE EEHeapAllocInProcessHeap (DWORD dwFlags, SIZE_T dwBytes);
-BOOL STDMETHODCALLTYPE EEHeapFreeInProcessHeap (DWORD dwFlags, LPVOID lpMem);
-void* STDMETHODCALLTYPE GetCLRFunction(LPCSTR functionName);
+extern CoreClrCallbacks* original_CoreClrCallbacks;
-extern CoreClrCallbacks *original_CoreClrCallbacks;
-
-#endif \ No newline at end of file
+#endif
diff --git a/src/ToolBox/superpmi/superpmi-shim-collector/icorjitcompiler.cpp b/src/ToolBox/superpmi/superpmi-shim-collector/icorjitcompiler.cpp
index c5f6d8aac1..eaa6b8cfb7 100644
--- a/src/ToolBox/superpmi/superpmi-shim-collector/icorjitcompiler.cpp
+++ b/src/ToolBox/superpmi/superpmi-shim-collector/icorjitcompiler.cpp
@@ -10,21 +10,20 @@
#include "jithost.h"
#include "superpmi-shim-collector.h"
-#define fatMC //this is nice to have on so ildump works...
-interceptor_IEEMM *current_IEEMM = nullptr; //we want this to live beyond the scope of a single compileMethodCall
-
-CorJitResult __stdcall interceptor_ICJC::compileMethod (
- ICorJitInfo *comp, /* IN */
- struct CORINFO_METHOD_INFO *info, /* IN */
- unsigned /* code:CorJitFlag */ flags, /* IN */
- BYTE **nativeEntry, /* OUT */
- ULONG *nativeSizeOfCode /* OUT */
- )
+#define fatMC // this is nice to have on so ildump works...
+interceptor_IEEMM* current_IEEMM = nullptr; // we want this to live beyond the scope of a single compileMethodCall
+
+CorJitResult __stdcall interceptor_ICJC::compileMethod(ICorJitInfo* comp, /* IN */
+ struct CORINFO_METHOD_INFO* info, /* IN */
+ unsigned /* code:CorJitFlag */ flags, /* IN */
+ BYTE** nativeEntry, /* OUT */
+ ULONG* nativeSizeOfCode /* OUT */
+ )
{
interceptor_ICJI our_ICorJitInfo;
our_ICorJitInfo.original_ICorJitInfo = comp;
- if(current_IEEMM == nullptr)
+ if (current_IEEMM == nullptr)
current_IEEMM = new interceptor_IEEMM();
auto* mc = new MethodContext();
@@ -38,8 +37,8 @@ CorJitResult __stdcall interceptor_ICJC::compileMethod (
our_ICorJitInfo.mc->recCompileMethod(info, flags);
-//force some extra data into our tables..
- //data probably not needed with RyuJIT, but needed in 4.5 and 4.5.1 to help with catching cached values
+ // force some extra data into our tables..
+ //data probably not needed with RyuJIT, but needed in 4.5 and 4.5.1 to help with catching cached values
our_ICorJitInfo.getBuiltinClass(CLASSID_SYSTEM_OBJECT);
our_ICorJitInfo.getBuiltinClass(CLASSID_TYPED_BYREF);
our_ICorJitInfo.getBuiltinClass(CLASSID_TYPE_HANDLE);
@@ -50,7 +49,7 @@ CorJitResult __stdcall interceptor_ICJC::compileMethod (
our_ICorJitInfo.getBuiltinClass(CLASSID_RUNTIME_TYPE);
#ifdef fatMC
- //to build up a fat mc
+ // to build up a fat mc
CORINFO_CLASS_HANDLE ourClass = our_ICorJitInfo.getMethodClass(info->ftn);
our_ICorJitInfo.getClassAttribs(ourClass);
our_ICorJitInfo.getClassName(ourClass);
@@ -64,19 +63,20 @@ CorJitResult __stdcall interceptor_ICJC::compileMethod (
our_ICorJitInfo.mc->recGlobalContext(*g_globalContext);
}
- //Record a simple view of the environment
+ // Record a simple view of the environment
our_ICorJitInfo.mc->recEnvironment();
- CorJitResult temp = original_ICorJitCompiler->compileMethod(&our_ICorJitInfo, info, flags, nativeEntry, nativeSizeOfCode);
+ CorJitResult temp =
+ original_ICorJitCompiler->compileMethod(&our_ICorJitInfo, info, flags, nativeEntry, nativeSizeOfCode);
- if(temp == CORJIT_OK)
+ if (temp == CORJIT_OK)
{
- //capture the results of compilation
- our_ICorJitInfo.mc->cr->recCompileMethod(nativeEntry, nativeSizeOfCode, temp);
+ // capture the results of compilation
+ our_ICorJitInfo.mc->cr->recCompileMethod(nativeEntry, nativeSizeOfCode, temp);
- our_ICorJitInfo.mc->cr->recAllocMemCapture();
- our_ICorJitInfo.mc->cr->recAllocGCInfoCapture();
- our_ICorJitInfo.mc->saveToFile(hFile);
+ our_ICorJitInfo.mc->cr->recAllocMemCapture();
+ our_ICorJitInfo.mc->cr->recAllocGCInfoCapture();
+ our_ICorJitInfo.mc->saveToFile(hFile);
}
delete mc;
diff --git a/src/ToolBox/superpmi/superpmi-shim-collector/icorjitcompiler.h b/src/ToolBox/superpmi/superpmi-shim-collector/icorjitcompiler.h
index 97dbebd9a9..c1f35adc87 100644
--- a/src/ToolBox/superpmi/superpmi-shim-collector/icorjitcompiler.h
+++ b/src/ToolBox/superpmi/superpmi-shim-collector/icorjitcompiler.h
@@ -16,10 +16,10 @@ class interceptor_ICJC : public ICorJitCompiler
public:
// Added to help us track the original icjc and be able to easily indirect to it.
- ICorJitCompiler *original_ICorJitCompiler;
- HANDLE hFile;
+ ICorJitCompiler* original_ICorJitCompiler;
+ HANDLE hFile;
};
-extern interceptor_IEEMM *current_IEEMM; //we want this to live beyond the scope of a single compileMethodCall
+extern interceptor_IEEMM* current_IEEMM; // we want this to live beyond the scope of a single compileMethodCall
#endif
diff --git a/src/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.cpp b/src/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.cpp
index 6d64442a21..4741cf1354 100644
--- a/src/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.cpp
+++ b/src/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.cpp
@@ -12,16 +12,16 @@
#include "errorhandling.h"
#include "logging.h"
-#define fatMC //this is nice to have on so ildump works...
+#define fatMC // this is nice to have on so ildump works...
-//Stuff on ICorStaticInfo
+// Stuff on ICorStaticInfo
/**********************************************************************************/
//
// ICorMethodInfo
//
/**********************************************************************************/
// return flags (defined above, CORINFO_FLG_PUBLIC ...)
-DWORD interceptor_ICJI::getMethodAttribs (CORINFO_METHOD_HANDLE ftn /* IN */)
+DWORD interceptor_ICJI::getMethodAttribs(CORINFO_METHOD_HANDLE ftn /* IN */)
{
mc->cr->AddCall("getMethodAttribs");
DWORD temp = original_ICorJitInfo->getMethodAttribs(ftn);
@@ -30,8 +30,8 @@ DWORD interceptor_ICJI::getMethodAttribs (CORINFO_METHOD_HANDLE ftn /* IN */)
}
// sets private JIT flags, which can be, retrieved using getAttrib.
-void interceptor_ICJI::setMethodAttribs (CORINFO_METHOD_HANDLE ftn,/* IN */
- CorInfoMethodRuntimeFlags attribs/* IN */)
+void interceptor_ICJI::setMethodAttribs(CORINFO_METHOD_HANDLE ftn, /* IN */
+ CorInfoMethodRuntimeFlags attribs /* IN */)
{
mc->cr->AddCall("setMethodAttribs");
original_ICorJitInfo->setMethodAttribs(ftn, attribs);
@@ -42,61 +42,57 @@ void interceptor_ICJI::setMethodAttribs (CORINFO_METHOD_HANDLE ftn,/* IN */
//
// 'memberParent' is typically only set when verifying. It should be the
// result of calling getMemberParent.
-void interceptor_ICJI::getMethodSig (
- CORINFO_METHOD_HANDLE ftn, /* IN */
- CORINFO_SIG_INFO *sig, /* OUT */
- CORINFO_CLASS_HANDLE memberParent/* IN */
- )
+void interceptor_ICJI::getMethodSig(CORINFO_METHOD_HANDLE ftn, /* IN */
+ CORINFO_SIG_INFO* sig, /* OUT */
+ CORINFO_CLASS_HANDLE memberParent /* IN */
+ )
{
mc->cr->AddCall("getMethodSig");
original_ICorJitInfo->getMethodSig(ftn, sig, memberParent);
mc->recGetMethodSig(ftn, sig, memberParent);
}
- /*********************************************************************
- * 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 interceptor_ICJI::getMethodInfo (
- CORINFO_METHOD_HANDLE ftn, /* IN */
- CORINFO_METHOD_INFO* info /* OUT */
- )
-{
- struct Param : FilterSuperPMIExceptionsParam_CaptureException {
- interceptor_ICJI* pThis;
- CORINFO_METHOD_HANDLE ftn;
- CORINFO_METHOD_INFO* info;
- bool temp;
+/*********************************************************************
+* 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 interceptor_ICJI::getMethodInfo(CORINFO_METHOD_HANDLE ftn, /* IN */
+ CORINFO_METHOD_INFO* info /* OUT */
+ )
+{
+ struct Param : FilterSuperPMIExceptionsParam_CaptureException
+ {
+ interceptor_ICJI* pThis;
+ CORINFO_METHOD_HANDLE ftn;
+ CORINFO_METHOD_INFO* info;
+ bool temp;
} param;
param.pThis = this;
- param.ftn = ftn;
- param.info = info;
- param.temp = false;
+ param.ftn = ftn;
+ param.info = info;
+ param.temp = false;
- PAL_TRY(Param*, pOuterParam, &param)
- {
- PAL_TRY(Param*, pParam, pOuterParam)
- {
- pParam->pThis->mc->cr->AddCall("getMethodInfo");
- pParam->temp = pParam->pThis->original_ICorJitInfo->getMethodInfo(pParam->ftn, pParam->info);
- }
- PAL_EXCEPT_FILTER(FilterSuperPMIExceptions_CaptureExceptionAndContinue)
- {
- }
- PAL_ENDTRY
- }
- PAL_FINALLY
- {
- this->mc->recGetMethodInfo(ftn, info, param.temp, param.exceptionCode);
- }
- PAL_ENDTRY
+ PAL_TRY(Param*, pOuterParam,
+ &param){PAL_TRY(Param*, pParam, pOuterParam){pParam->pThis->mc->cr->AddCall("getMethodInfo");
+ pParam->temp = pParam->pThis->original_ICorJitInfo->getMethodInfo(pParam->ftn, pParam->info);
+}
+PAL_EXCEPT_FILTER(FilterSuperPMIExceptions_CaptureExceptionAndContinue)
+{
+}
+PAL_ENDTRY
+}
+PAL_FINALLY
+{
+ this->mc->recGetMethodInfo(ftn, info, param.temp, param.exceptionCode);
+}
+PAL_ENDTRY
- return param.temp;
- }
+return param.temp;
+}
// 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
@@ -107,69 +103,65 @@ void interceptor_ICJI::getMethodSig (
//
// The inlined method need not be verified
-CorInfoInline interceptor_ICJI::canInline (
- CORINFO_METHOD_HANDLE callerHnd, /* IN */
- CORINFO_METHOD_HANDLE calleeHnd, /* IN */
- DWORD* pRestrictions /* OUT */
- )
+CorInfoInline interceptor_ICJI::canInline(CORINFO_METHOD_HANDLE callerHnd, /* IN */
+ CORINFO_METHOD_HANDLE calleeHnd, /* IN */
+ DWORD* pRestrictions /* OUT */
+ )
{
- struct Param : FilterSuperPMIExceptionsParam_CaptureException {
- interceptor_ICJI* pThis;
- CORINFO_METHOD_HANDLE callerHnd;
- CORINFO_METHOD_HANDLE calleeHnd;
- DWORD* pRestrictions;
- CorInfoInline temp;
+ struct Param : FilterSuperPMIExceptionsParam_CaptureException
+ {
+ interceptor_ICJI* pThis;
+ CORINFO_METHOD_HANDLE callerHnd;
+ CORINFO_METHOD_HANDLE calleeHnd;
+ DWORD* pRestrictions;
+ CorInfoInline temp;
} param;
- param.pThis = this;
- param.callerHnd = callerHnd;
- param.calleeHnd = calleeHnd;
+ param.pThis = this;
+ param.callerHnd = callerHnd;
+ param.calleeHnd = calleeHnd;
param.pRestrictions = pRestrictions;
- param.temp = INLINE_NEVER;
+ param.temp = INLINE_NEVER;
- PAL_TRY(Param*, pOuterParam, &param)
- {
- PAL_TRY(Param*, pParam, pOuterParam)
- {
- pParam->pThis->mc->cr->AddCall("canInline");
- pParam->temp = pParam->pThis->original_ICorJitInfo->canInline(pParam->callerHnd, pParam->calleeHnd, pParam->pRestrictions);
- }
- PAL_EXCEPT_FILTER(FilterSuperPMIExceptions_CaptureExceptionAndContinue)
- {
- }
- PAL_ENDTRY
- }
- PAL_FINALLY
- {
- this->mc->recCanInline(callerHnd, calleeHnd, pRestrictions, param.temp, param.exceptionCode);
- }
- PAL_ENDTRY
+ PAL_TRY(Param*, pOuterParam,
+ &param){PAL_TRY(Param*, pParam, pOuterParam){pParam->pThis->mc->cr->AddCall("canInline");
+ pParam->temp =
+ pParam->pThis->original_ICorJitInfo->canInline(pParam->callerHnd, pParam->calleeHnd, pParam->pRestrictions);
+}
+PAL_EXCEPT_FILTER(FilterSuperPMIExceptions_CaptureExceptionAndContinue)
+{
+}
+PAL_ENDTRY
+}
+PAL_FINALLY
+{
+ this->mc->recCanInline(callerHnd, calleeHnd, pRestrictions, param.temp, param.exceptionCode);
+}
+PAL_ENDTRY
- return param.temp;
- }
+return param.temp;
+}
// 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 interceptor_ICJI::reportInliningDecision (CORINFO_METHOD_HANDLE inlinerHnd,
- CORINFO_METHOD_HANDLE inlineeHnd,
- CorInfoInline inlineResult,
- const char * reason)
+void interceptor_ICJI::reportInliningDecision(CORINFO_METHOD_HANDLE inlinerHnd,
+ CORINFO_METHOD_HANDLE inlineeHnd,
+ CorInfoInline inlineResult,
+ const char* reason)
{
mc->cr->AddCall("reportInliningDecision");
original_ICorJitInfo->reportInliningDecision(inlinerHnd, inlineeHnd, inlineResult, reason);
mc->cr->recReportInliningDecision(inlinerHnd, inlineeHnd, inlineResult, 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 interceptor_ICJI::canTailCall (
- CORINFO_METHOD_HANDLE callerHnd, /* IN */
- CORINFO_METHOD_HANDLE declaredCalleeHnd, /* IN */
- CORINFO_METHOD_HANDLE exactCalleeHnd, /* IN */
- bool fIsTailPrefix /* IN */
- )
+bool interceptor_ICJI::canTailCall(CORINFO_METHOD_HANDLE callerHnd, /* IN */
+ CORINFO_METHOD_HANDLE declaredCalleeHnd, /* IN */
+ CORINFO_METHOD_HANDLE exactCalleeHnd, /* IN */
+ bool fIsTailPrefix /* IN */
+ )
{
mc->cr->AddCall("canTailCall");
bool temp = original_ICorJitInfo->canTailCall(callerHnd, declaredCalleeHnd, exactCalleeHnd, fIsTailPrefix);
@@ -180,11 +172,11 @@ bool interceptor_ICJI::canTailCall (
// 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 interceptor_ICJI::reportTailCallDecision (CORINFO_METHOD_HANDLE callerHnd,
- CORINFO_METHOD_HANDLE calleeHnd,
- bool fIsTailPrefix,
- CorInfoTailCall tailCallResult,
- const char * reason)
+void interceptor_ICJI::reportTailCallDecision(CORINFO_METHOD_HANDLE callerHnd,
+ CORINFO_METHOD_HANDLE calleeHnd,
+ bool fIsTailPrefix,
+ CorInfoTailCall tailCallResult,
+ const char* reason)
{
mc->cr->AddCall("reportTailCallDecision");
original_ICorJitInfo->reportTailCallDecision(callerHnd, calleeHnd, fIsTailPrefix, tailCallResult, reason);
@@ -192,11 +184,10 @@ void interceptor_ICJI::reportTailCallDecision (CORINFO_METHOD_HANDLE callerHnd,
}
// get individual exception handler
-void interceptor_ICJI::getEHinfo(
- CORINFO_METHOD_HANDLE ftn, /* IN */
- unsigned EHnumber, /* IN */
- CORINFO_EH_CLAUSE* clause /* OUT */
- )
+void interceptor_ICJI::getEHinfo(CORINFO_METHOD_HANDLE ftn, /* IN */
+ unsigned EHnumber, /* IN */
+ CORINFO_EH_CLAUSE* clause /* OUT */
+ )
{
mc->cr->AddCall("getEHinfo");
original_ICorJitInfo->getEHinfo(ftn, EHnumber, clause);
@@ -204,9 +195,7 @@ void interceptor_ICJI::getEHinfo(
}
// return class it belongs to
-CORINFO_CLASS_HANDLE interceptor_ICJI::getMethodClass (
- CORINFO_METHOD_HANDLE method
- )
+CORINFO_CLASS_HANDLE interceptor_ICJI::getMethodClass(CORINFO_METHOD_HANDLE method)
{
mc->cr->AddCall("getMethodClass");
CORINFO_CLASS_HANDLE temp = original_ICorJitInfo->getMethodClass(method);
@@ -215,9 +204,7 @@ CORINFO_CLASS_HANDLE interceptor_ICJI::getMethodClass (
}
// return module it belongs to
-CORINFO_MODULE_HANDLE interceptor_ICJI::getMethodModule (
- CORINFO_METHOD_HANDLE method
- )
+CORINFO_MODULE_HANDLE interceptor_ICJI::getMethodModule(CORINFO_METHOD_HANDLE method)
{
mc->cr->AddCall("getMethodModule");
return original_ICorJitInfo->getMethodModule(method);
@@ -225,11 +212,10 @@ CORINFO_MODULE_HANDLE interceptor_ICJI::getMethodModule (
// This function returns the offset of the specified method in the
// vtable of it's owning class or interface.
-void interceptor_ICJI::getMethodVTableOffset (
- CORINFO_METHOD_HANDLE method, /* IN */
- unsigned* offsetOfIndirection, /* OUT */
- unsigned* offsetAfterIndirection /* OUT */
- )
+void interceptor_ICJI::getMethodVTableOffset(CORINFO_METHOD_HANDLE method, /* IN */
+ unsigned* offsetOfIndirection, /* OUT */
+ unsigned* offsetAfterIndirection /* OUT */
+ )
{
mc->cr->AddCall("getMethodVTableOffset");
original_ICorJitInfo->getMethodVTableOffset(method, offsetOfIndirection, offsetAfterIndirection);
@@ -238,24 +224,21 @@ void interceptor_ICJI::getMethodVTableOffset (
// Find the virtual method in implementingClass that overrides virtualMethod.
// Return null if devirtualization is not possible.
-CORINFO_METHOD_HANDLE interceptor_ICJI::resolveVirtualMethod(
- CORINFO_METHOD_HANDLE virtualMethod,
- CORINFO_CLASS_HANDLE implementingClass,
- CORINFO_CONTEXT_HANDLE ownerType
- )
+CORINFO_METHOD_HANDLE interceptor_ICJI::resolveVirtualMethod(CORINFO_METHOD_HANDLE virtualMethod,
+ CORINFO_CLASS_HANDLE implementingClass,
+ CORINFO_CONTEXT_HANDLE ownerType)
{
mc->cr->AddCall("resolveVirtualMethod");
- CORINFO_METHOD_HANDLE result = original_ICorJitInfo->resolveVirtualMethod(virtualMethod, implementingClass, ownerType);
+ CORINFO_METHOD_HANDLE result =
+ original_ICorJitInfo->resolveVirtualMethod(virtualMethod, implementingClass, ownerType);
mc->recResolveVirtualMethod(virtualMethod, implementingClass, ownerType, result);
return result;
}
// If a method's attributes have (getMethodAttribs) CORINFO_FLG_INTRINSIC set,
// getIntrinsicID() returns the intrinsic ID.
-CorInfoIntrinsics interceptor_ICJI::getIntrinsicID(
- CORINFO_METHOD_HANDLE method,
- bool* pMustExpand /* OUT */
- )
+CorInfoIntrinsics interceptor_ICJI::getIntrinsicID(CORINFO_METHOD_HANDLE method, bool* pMustExpand /* OUT */
+ )
{
mc->cr->AddCall("getIntrinsicID");
CorInfoIntrinsics temp = original_ICorJitInfo->getIntrinsicID(method, pMustExpand);
@@ -264,9 +247,7 @@ CorInfoIntrinsics interceptor_ICJI::getIntrinsicID(
}
// Is the given module the System.Numerics.Vectors module?
-bool interceptor_ICJI::isInSIMDModule(
- CORINFO_CLASS_HANDLE classHnd
- )
+bool interceptor_ICJI::isInSIMDModule(CORINFO_CLASS_HANDLE classHnd)
{
mc->cr->AddCall("isInSIMDModule");
bool temp = original_ICorJitInfo->isInSIMDModule(classHnd);
@@ -275,9 +256,7 @@ bool interceptor_ICJI::isInSIMDModule(
}
// return the unmanaged calling convention for a PInvoke
-CorInfoUnmanagedCallConv interceptor_ICJI::getUnmanagedCallConv(
- CORINFO_METHOD_HANDLE method
- )
+CorInfoUnmanagedCallConv interceptor_ICJI::getUnmanagedCallConv(CORINFO_METHOD_HANDLE method)
{
mc->cr->AddCall("getUnmanagedCallConv");
CorInfoUnmanagedCallConv temp = original_ICorJitInfo->getUnmanagedCallConv(method);
@@ -287,10 +266,7 @@ CorInfoUnmanagedCallConv interceptor_ICJI::getUnmanagedCallConv(
// 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 interceptor_ICJI::pInvokeMarshalingRequired(
- CORINFO_METHOD_HANDLE method,
- CORINFO_SIG_INFO* callSiteSig
- )
+BOOL interceptor_ICJI::pInvokeMarshalingRequired(CORINFO_METHOD_HANDLE method, CORINFO_SIG_INFO* callSiteSig)
{
mc->cr->AddCall("pInvokeMarshalingRequired");
BOOL temp = original_ICorJitInfo->pInvokeMarshalingRequired(method, callSiteSig);
@@ -300,10 +276,8 @@ BOOL interceptor_ICJI::pInvokeMarshalingRequired(
// Check constraints on method type arguments (only).
// The parent class should be checked separately using satisfiesClassConstraints(parent).
-BOOL interceptor_ICJI::satisfiesMethodConstraints(
- CORINFO_CLASS_HANDLE parent, // the exact parent of the method
- CORINFO_METHOD_HANDLE method
- )
+BOOL interceptor_ICJI::satisfiesMethodConstraints(CORINFO_CLASS_HANDLE parent, // the exact parent of the method
+ CORINFO_METHOD_HANDLE method)
{
mc->cr->AddCall("satisfiesMethodConstraints");
BOOL temp = original_ICorJitInfo->satisfiesMethodConstraints(parent, method);
@@ -315,24 +289,22 @@ BOOL interceptor_ICJI::satisfiesMethodConstraints(
// 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 interceptor_ICJI::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 */
- )
+ 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 */
+ )
{
mc->cr->AddCall("isCompatibleDelegate");
- BOOL temp = original_ICorJitInfo->isCompatibleDelegate(objCls, methodParentCls, method, delegateCls, pfIsOpenDelegate);
+ BOOL temp =
+ original_ICorJitInfo->isCompatibleDelegate(objCls, methodParentCls, method, delegateCls, pfIsOpenDelegate);
mc->recIsCompatibleDelegate(objCls, methodParentCls, method, delegateCls, pfIsOpenDelegate, temp);
return temp;
}
// Determines whether the delegate creation obeys security transparency rules
-BOOL interceptor_ICJI::isDelegateCreationAllowed (
- CORINFO_CLASS_HANDLE delegateHnd,
- CORINFO_METHOD_HANDLE calleeHnd
- )
+BOOL interceptor_ICJI::isDelegateCreationAllowed(CORINFO_CLASS_HANDLE delegateHnd, CORINFO_METHOD_HANDLE calleeHnd)
{
mc->cr->AddCall("isDelegateCreationAllowed");
BOOL temp = original_ICorJitInfo->isDelegateCreationAllowed(delegateHnd, calleeHnd);
@@ -340,12 +312,11 @@ BOOL interceptor_ICJI::isDelegateCreationAllowed (
return temp;
}
-
// Indicates if the method is an instance of the generic
// method that passes (or has passed) verification
-CorInfoInstantiationVerification interceptor_ICJI::isInstantiationOfVerifiedGeneric (
- CORINFO_METHOD_HANDLE method /* IN */
- )
+CorInfoInstantiationVerification interceptor_ICJI::isInstantiationOfVerifiedGeneric(CORINFO_METHOD_HANDLE method /* IN
+ */
+ )
{
mc->cr->AddCall("isInstantiationOfVerifiedGeneric");
CorInfoInstantiationVerification temp = original_ICorJitInfo->isInstantiationOfVerifiedGeneric(method);
@@ -355,22 +326,20 @@ CorInfoInstantiationVerification interceptor_ICJI::isInstantiationOfVerifiedGene
// Loads the constraints on a typical method definition, detecting cycles;
// for use in verification.
-void interceptor_ICJI::initConstraintsForVerification(
- CORINFO_METHOD_HANDLE method, /* IN */
- BOOL *pfHasCircularClassConstraints, /* OUT */
- BOOL *pfHasCircularMethodConstraint /* OUT */
- )
+void interceptor_ICJI::initConstraintsForVerification(CORINFO_METHOD_HANDLE method, /* IN */
+ BOOL* pfHasCircularClassConstraints, /* OUT */
+ BOOL* pfHasCircularMethodConstraint /* OUT */
+ )
{
mc->cr->AddCall("initConstraintsForVerification");
- original_ICorJitInfo->initConstraintsForVerification(method, pfHasCircularClassConstraints, pfHasCircularMethodConstraint);
+ original_ICorJitInfo->initConstraintsForVerification(method, pfHasCircularClassConstraints,
+ pfHasCircularMethodConstraint);
mc->recInitConstraintsForVerification(method, pfHasCircularClassConstraints, pfHasCircularMethodConstraint);
}
// Returns enum whether the method does not require verification
// Also see ICorModuleInfo::canSkipVerification
-CorInfoCanSkipVerificationResult interceptor_ICJI::canSkipMethodVerification (
- CORINFO_METHOD_HANDLE ftnHandle
- )
+CorInfoCanSkipVerificationResult interceptor_ICJI::canSkipMethodVerification(CORINFO_METHOD_HANDLE ftnHandle)
{
mc->cr->AddCall("canSkipMethodVerification");
CorInfoCanSkipVerificationResult temp = original_ICorJitInfo->canSkipMethodVerification(ftnHandle);
@@ -379,18 +348,14 @@ CorInfoCanSkipVerificationResult interceptor_ICJI::canSkipMethodVerification (
}
// load and restore the method
-void interceptor_ICJI::methodMustBeLoadedBeforeCodeIsRun(
- CORINFO_METHOD_HANDLE method
- )
+void interceptor_ICJI::methodMustBeLoadedBeforeCodeIsRun(CORINFO_METHOD_HANDLE method)
{
mc->cr->AddCall("methodMustBeLoadedBeforeCodeIsRun");
original_ICorJitInfo->methodMustBeLoadedBeforeCodeIsRun(method);
mc->cr->recMethodMustBeLoadedBeforeCodeIsRun(method);
}
-CORINFO_METHOD_HANDLE interceptor_ICJI::mapMethodDeclToMethodImpl(
- CORINFO_METHOD_HANDLE method
- )
+CORINFO_METHOD_HANDLE interceptor_ICJI::mapMethodDeclToMethodImpl(CORINFO_METHOD_HANDLE method)
{
mc->cr->AddCall("mapMethodDeclToMethodImpl");
return original_ICorJitInfo->mapMethodDeclToMethodImpl(method);
@@ -398,10 +363,9 @@ CORINFO_METHOD_HANDLE interceptor_ICJI::mapMethodDeclToMethodImpl(
// 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 interceptor_ICJI::getGSCookie(
- GSCookie * pCookieVal, // OUT
- GSCookie ** ppCookieVal // OUT
- )
+void interceptor_ICJI::getGSCookie(GSCookie* pCookieVal, // OUT
+ GSCookie** ppCookieVal // OUT
+ )
{
mc->cr->AddCall("getGSCookie");
original_ICorJitInfo->getGSCookie(pCookieVal, ppCookieVal);
@@ -414,35 +378,33 @@ void interceptor_ICJI::getGSCookie(
//
/**********************************************************************************/
// Resolve metadata token into runtime method handles.
-void interceptor_ICJI::resolveToken(/* IN, OUT */ CORINFO_RESOLVED_TOKEN * pResolvedToken)
+void interceptor_ICJI::resolveToken(/* IN, OUT */ CORINFO_RESOLVED_TOKEN* pResolvedToken)
{
- struct Param : FilterSuperPMIExceptionsParam_CaptureException {
+ struct Param : FilterSuperPMIExceptionsParam_CaptureException
+ {
interceptor_ICJI* pThis;
CORINFO_RESOLVED_TOKEN* pResolvedToken;
} param;
- param.pThis = this;
+ param.pThis = this;
param.pResolvedToken = pResolvedToken;
- PAL_TRY(Param*, pOuterParam, &param)
- {
- PAL_TRY(Param*, pParam, pOuterParam)
- {
- pParam->pThis->mc->cr->AddCall("resolveToken");
- pParam->pThis->original_ICorJitInfo->resolveToken(pParam->pResolvedToken);
- }
- PAL_EXCEPT_FILTER(FilterSuperPMIExceptions_CaptureExceptionAndContinue)
- {
- }
- PAL_ENDTRY
- }
- PAL_FINALLY
- {
- this->mc->recResolveToken(param.pResolvedToken, param.exceptionCode);
- }
- PAL_ENDTRY
+ PAL_TRY(Param*, pOuterParam,
+ &param){PAL_TRY(Param*, pParam, pOuterParam){pParam->pThis->mc->cr->AddCall("resolveToken");
+ pParam->pThis->original_ICorJitInfo->resolveToken(pParam->pResolvedToken);
+}
+PAL_EXCEPT_FILTER(FilterSuperPMIExceptions_CaptureExceptionAndContinue)
+{
+}
+PAL_ENDTRY
+}
+PAL_FINALLY
+{
+ this->mc->recResolveToken(param.pResolvedToken, param.exceptionCode);
+}
+PAL_ENDTRY
}
-bool interceptor_ICJI::tryResolveToken(/* IN, OUT */ CORINFO_RESOLVED_TOKEN * pResolvedToken)
+bool interceptor_ICJI::tryResolveToken(/* IN, OUT */ CORINFO_RESOLVED_TOKEN* pResolvedToken)
{
mc->cr->AddCall("tryResolveToken");
bool success = original_ICorJitInfo->tryResolveToken(pResolvedToken);
@@ -451,12 +413,11 @@ bool interceptor_ICJI::tryResolveToken(/* IN, OUT */ CORINFO_RESOLVED_TOKEN * pR
}
// Signature information about the call sig
-void interceptor_ICJI::findSig (
- CORINFO_MODULE_HANDLE module, /* IN */
- unsigned sigTOK, /* IN */
- CORINFO_CONTEXT_HANDLE context, /* IN */
- CORINFO_SIG_INFO *sig /* OUT */
- )
+void interceptor_ICJI::findSig(CORINFO_MODULE_HANDLE module, /* IN */
+ unsigned sigTOK, /* IN */
+ CORINFO_CONTEXT_HANDLE context, /* IN */
+ CORINFO_SIG_INFO* sig /* OUT */
+ )
{
mc->cr->AddCall("findSig");
original_ICorJitInfo->findSig(module, sigTOK, context, sig);
@@ -466,20 +427,18 @@ void interceptor_ICJI::findSig (
// 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 interceptor_ICJI::findCallSiteSig (
- CORINFO_MODULE_HANDLE module, /* IN */
- unsigned methTOK, /* IN */
- CORINFO_CONTEXT_HANDLE context, /* IN */
- CORINFO_SIG_INFO *sig /* OUT */
- )
+void interceptor_ICJI::findCallSiteSig(CORINFO_MODULE_HANDLE module, /* IN */
+ unsigned methTOK, /* IN */
+ CORINFO_CONTEXT_HANDLE context, /* IN */
+ CORINFO_SIG_INFO* sig /* OUT */
+ )
{
mc->cr->AddCall("findCallSiteSig");
original_ICorJitInfo->findCallSiteSig(module, methTOK, context, sig);
mc->recFindCallSiteSig(module, methTOK, context, sig);
}
-CORINFO_CLASS_HANDLE interceptor_ICJI::getTokenTypeAsHandle (
- CORINFO_RESOLVED_TOKEN * pResolvedToken /* IN */)
+CORINFO_CLASS_HANDLE interceptor_ICJI::getTokenTypeAsHandle(CORINFO_RESOLVED_TOKEN* pResolvedToken /* IN */)
{
mc->cr->AddCall("getTokenTypeAsHandle");
CORINFO_CLASS_HANDLE temp = original_ICorJitInfo->getTokenTypeAsHandle(pResolvedToken);
@@ -497,19 +456,17 @@ CORINFO_CLASS_HANDLE interceptor_ICJI::getTokenTypeAsHandle (
//
// Returns enum whether the module does not require verification
// Also see ICorMethodInfo::canSkipMethodVerification();
-CorInfoCanSkipVerificationResult interceptor_ICJI::canSkipVerification (
- CORINFO_MODULE_HANDLE module /* IN */
- )
+CorInfoCanSkipVerificationResult interceptor_ICJI::canSkipVerification(CORINFO_MODULE_HANDLE module /* IN */
+ )
{
mc->cr->AddCall("canSkipVerification");
return original_ICorJitInfo->canSkipVerification(module);
}
// Checks if the given metadata token is valid
-BOOL interceptor_ICJI::isValidToken (
- CORINFO_MODULE_HANDLE module, /* IN */
- unsigned metaTOK /* IN */
- )
+BOOL interceptor_ICJI::isValidToken(CORINFO_MODULE_HANDLE module, /* IN */
+ unsigned metaTOK /* IN */
+ )
{
mc->cr->AddCall("isValidToken");
BOOL result = original_ICorJitInfo->isValidToken(module, metaTOK);
@@ -518,10 +475,9 @@ BOOL interceptor_ICJI::isValidToken (
}
// Checks if the given metadata token is valid StringRef
-BOOL interceptor_ICJI::isValidStringRef (
- CORINFO_MODULE_HANDLE module, /* IN */
- unsigned metaTOK /* IN */
- )
+BOOL interceptor_ICJI::isValidStringRef(CORINFO_MODULE_HANDLE module, /* IN */
+ unsigned metaTOK /* IN */
+ )
{
mc->cr->AddCall("isValidStringRef");
BOOL temp = original_ICorJitInfo->isValidStringRef(module, metaTOK);
@@ -529,9 +485,7 @@ BOOL interceptor_ICJI::isValidStringRef (
return temp;
}
-BOOL interceptor_ICJI::shouldEnforceCallvirtRestriction(
- CORINFO_MODULE_HANDLE scope
- )
+BOOL interceptor_ICJI::shouldEnforceCallvirtRestriction(CORINFO_MODULE_HANDLE scope)
{
mc->cr->AddCall("shouldEnforceCallvirtRestriction");
BOOL temp = original_ICorJitInfo->shouldEnforceCallvirtRestriction(scope);
@@ -547,9 +501,7 @@ BOOL interceptor_ICJI::shouldEnforceCallvirtRestriction(
// If the value class 'cls' is isomorphic to a primitive type it will
// return that type, otherwise it will return CORINFO_TYPE_VALUECLASS
-CorInfoType interceptor_ICJI::asCorInfoType (
- CORINFO_CLASS_HANDLE cls
- )
+CorInfoType interceptor_ICJI::asCorInfoType(CORINFO_CLASS_HANDLE cls)
{
mc->cr->AddCall("asCorInfoType");
CorInfoType temp = original_ICorJitInfo->asCorInfoType(cls);
@@ -558,9 +510,7 @@ CorInfoType interceptor_ICJI::asCorInfoType (
}
// for completeness
-const char* interceptor_ICJI::getClassName (
- CORINFO_CLASS_HANDLE cls
- )
+const char* interceptor_ICJI::getClassName(CORINFO_CLASS_HANDLE cls)
{
mc->cr->AddCall("getClassName");
const char* result = original_ICorJitInfo->getClassName(cls);
@@ -573,23 +523,22 @@ const char* interceptor_ICJI::getClassName (
// 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 interceptor_ICJI::appendClassName(
- __deref_inout_ecount(*pnBufLen) WCHAR** ppBuf,
- int* pnBufLen,
- CORINFO_CLASS_HANDLE cls,
- BOOL fNamespace,
- BOOL fFullInst,
- BOOL fAssembly
- )
+int interceptor_ICJI::appendClassName(__deref_inout_ecount(*pnBufLen) WCHAR** ppBuf,
+ int* pnBufLen,
+ CORINFO_CLASS_HANDLE cls,
+ BOOL fNamespace,
+ BOOL fFullInst,
+ BOOL fAssembly)
{
mc->cr->AddCall("appendClassName");
WCHAR* pBuf = *ppBuf;
- int nLen = original_ICorJitInfo->appendClassName(ppBuf, pnBufLen, cls, fNamespace, fFullInst, fAssembly);
+ int nLen = original_ICorJitInfo->appendClassName(ppBuf, pnBufLen, cls, fNamespace, fFullInst, fAssembly);
mc->recAppendClassName(cls, fNamespace, fFullInst, fAssembly, pBuf);
return nLen;
}
-// Quick check whether the type is a value class. Returns the same value as getClassAttribs(cls) & CORINFO_FLG_VALUECLASS, except faster.
+// Quick check whether the type is a value class. Returns the same value as getClassAttribs(cls) &
+// CORINFO_FLG_VALUECLASS, except faster.
BOOL interceptor_ICJI::isValueClass(CORINFO_CLASS_HANDLE cls)
{
mc->cr->AddCall("isValueClass");
@@ -609,9 +558,7 @@ BOOL interceptor_ICJI::canInlineTypeCheckWithObjectVTable(CORINFO_CLASS_HANDLE c
}
// return flags (defined above, CORINFO_FLG_PUBLIC ...)
-DWORD interceptor_ICJI::getClassAttribs (
- CORINFO_CLASS_HANDLE cls
- )
+DWORD interceptor_ICJI::getClassAttribs(CORINFO_CLASS_HANDLE cls)
{
mc->cr->AddCall("getClassAttribs");
DWORD temp = original_ICorJitInfo->getClassAttribs(cls);
@@ -633,27 +580,21 @@ BOOL interceptor_ICJI::isStructRequiringStackAllocRetBuf(CORINFO_CLASS_HANDLE cl
return temp;
}
-CORINFO_MODULE_HANDLE interceptor_ICJI::getClassModule (
- CORINFO_CLASS_HANDLE cls
- )
+CORINFO_MODULE_HANDLE interceptor_ICJI::getClassModule(CORINFO_CLASS_HANDLE cls)
{
mc->cr->AddCall("getClassModule");
return original_ICorJitInfo->getClassModule(cls);
}
// Returns the assembly that contains the module "mod".
-CORINFO_ASSEMBLY_HANDLE interceptor_ICJI::getModuleAssembly (
- CORINFO_MODULE_HANDLE mod
- )
+CORINFO_ASSEMBLY_HANDLE interceptor_ICJI::getModuleAssembly(CORINFO_MODULE_HANDLE mod)
{
mc->cr->AddCall("getModuleAssembly");
return original_ICorJitInfo->getModuleAssembly(mod);
}
// Returns the name of the assembly "assem".
-const char* interceptor_ICJI::getAssemblyName (
- CORINFO_ASSEMBLY_HANDLE assem
- )
+const char* interceptor_ICJI::getAssemblyName(CORINFO_ASSEMBLY_HANDLE assem)
{
mc->cr->AddCall("getAssemblyName");
return original_ICorJitInfo->getAssemblyName(assem);
@@ -675,11 +616,9 @@ void interceptor_ICJI::LongLifetimeFree(void* obj)
original_ICorJitInfo->LongLifetimeFree(obj);
}
-size_t interceptor_ICJI::getClassModuleIdForStatics (
- CORINFO_CLASS_HANDLE cls,
- CORINFO_MODULE_HANDLE *pModule,
- void **ppIndirection
- )
+size_t interceptor_ICJI::getClassModuleIdForStatics(CORINFO_CLASS_HANDLE cls,
+ CORINFO_MODULE_HANDLE* pModule,
+ void** ppIndirection)
{
mc->cr->AddCall("getClassModuleIdForStatics");
size_t temp = original_ICorJitInfo->getClassModuleIdForStatics(cls, pModule, ppIndirection);
@@ -688,9 +627,7 @@ size_t interceptor_ICJI::getClassModuleIdForStatics (
}
// return the number of bytes needed by an instance of the class
-unsigned interceptor_ICJI::getClassSize (
- CORINFO_CLASS_HANDLE cls
- )
+unsigned interceptor_ICJI::getClassSize(CORINFO_CLASS_HANDLE cls)
{
mc->cr->AddCall("getClassSize");
unsigned temp = original_ICorJitInfo->getClassSize(cls);
@@ -698,10 +635,7 @@ unsigned interceptor_ICJI::getClassSize (
return temp;
}
-unsigned interceptor_ICJI::getClassAlignmentRequirement (
- CORINFO_CLASS_HANDLE cls,
- BOOL fDoubleAlignHint
- )
+unsigned interceptor_ICJI::getClassAlignmentRequirement(CORINFO_CLASS_HANDLE cls, BOOL fDoubleAlignHint)
{
mc->cr->AddCall("getClassAlignmentRequirement");
unsigned temp = original_ICorJitInfo->getClassAlignmentRequirement(cls, fDoubleAlignHint);
@@ -718,22 +652,20 @@ unsigned interceptor_ICJI::getClassAlignmentRequirement (
// 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 interceptor_ICJI::getClassGClayout (
- CORINFO_CLASS_HANDLE cls, /* IN */
- BYTE *gcPtrs /* OUT */
- )
+unsigned interceptor_ICJI::getClassGClayout(CORINFO_CLASS_HANDLE cls, /* IN */
+ BYTE* gcPtrs /* OUT */
+ )
{
mc->cr->AddCall("getClassGClayout");
unsigned temp = original_ICorJitInfo->getClassGClayout(cls, gcPtrs);
- unsigned len = (getClassSize(cls) + sizeof(void *) - 1)/sizeof(void*);
+ unsigned len = (getClassSize(cls) + sizeof(void*) - 1) / sizeof(void*);
mc->recGetClassGClayout(cls, gcPtrs, len, temp);
return temp;
}
// returns the number of instance fields in a class
-unsigned interceptor_ICJI::getClassNumInstanceFields (
- CORINFO_CLASS_HANDLE cls /* IN */
- )
+unsigned interceptor_ICJI::getClassNumInstanceFields(CORINFO_CLASS_HANDLE cls /* IN */
+ )
{
mc->cr->AddCall("getClassNumInstanceFields");
unsigned temp = original_ICorJitInfo->getClassNumInstanceFields(cls);
@@ -741,10 +673,7 @@ unsigned interceptor_ICJI::getClassNumInstanceFields (
return temp;
}
-CORINFO_FIELD_HANDLE interceptor_ICJI::getFieldInClass(
- CORINFO_CLASS_HANDLE clsHnd,
- INT num
- )
+CORINFO_FIELD_HANDLE interceptor_ICJI::getFieldInClass(CORINFO_CLASS_HANDLE clsHnd, INT num)
{
mc->cr->AddCall("getFieldInClass");
CORINFO_FIELD_HANDLE temp = original_ICorJitInfo->getFieldInClass(clsHnd, num);
@@ -752,11 +681,7 @@ CORINFO_FIELD_HANDLE interceptor_ICJI::getFieldInClass(
return temp;
}
-BOOL interceptor_ICJI::checkMethodModifier(
- CORINFO_METHOD_HANDLE hMethod,
- LPCSTR modifier,
- BOOL fOptional
- )
+BOOL interceptor_ICJI::checkMethodModifier(CORINFO_METHOD_HANDLE hMethod, LPCSTR modifier, BOOL fOptional)
{
mc->cr->AddCall("checkMethodModifier");
BOOL result = original_ICorJitInfo->checkMethodModifier(hMethod, modifier, fOptional);
@@ -765,10 +690,8 @@ BOOL interceptor_ICJI::checkMethodModifier(
}
// returns the "NEW" helper optimized for "newCls."
-CorInfoHelpFunc interceptor_ICJI::getNewHelper(
- CORINFO_RESOLVED_TOKEN * pResolvedToken,
- CORINFO_METHOD_HANDLE callerHandle
- )
+CorInfoHelpFunc interceptor_ICJI::getNewHelper(CORINFO_RESOLVED_TOKEN* pResolvedToken,
+ CORINFO_METHOD_HANDLE callerHandle)
{
mc->cr->AddCall("getNewHelper");
CorInfoHelpFunc temp = original_ICorJitInfo->getNewHelper(pResolvedToken, callerHandle);
@@ -777,9 +700,7 @@ CorInfoHelpFunc interceptor_ICJI::getNewHelper(
}
// returns the newArr (1-Dim array) helper optimized for "arrayCls."
-CorInfoHelpFunc interceptor_ICJI::getNewArrHelper(
- CORINFO_CLASS_HANDLE arrayCls
- )
+CorInfoHelpFunc interceptor_ICJI::getNewArrHelper(CORINFO_CLASS_HANDLE arrayCls)
{
mc->cr->AddCall("getNewArrHelper");
CorInfoHelpFunc temp = original_ICorJitInfo->getNewArrHelper(arrayCls);
@@ -788,10 +709,7 @@ CorInfoHelpFunc interceptor_ICJI::getNewArrHelper(
}
// returns the optimized "IsInstanceOf" or "ChkCast" helper
-CorInfoHelpFunc interceptor_ICJI::getCastingHelper(
- CORINFO_RESOLVED_TOKEN * pResolvedToken,
- bool fThrowing
- )
+CorInfoHelpFunc interceptor_ICJI::getCastingHelper(CORINFO_RESOLVED_TOKEN* pResolvedToken, bool fThrowing)
{
mc->cr->AddCall("getCastingHelper");
CorInfoHelpFunc temp = original_ICorJitInfo->getCastingHelper(pResolvedToken, fThrowing);
@@ -800,9 +718,7 @@ CorInfoHelpFunc interceptor_ICJI::getCastingHelper(
}
// returns helper to trigger static constructor
-CorInfoHelpFunc interceptor_ICJI::getSharedCCtorHelper(
- CORINFO_CLASS_HANDLE clsHnd
- )
+CorInfoHelpFunc interceptor_ICJI::getSharedCCtorHelper(CORINFO_CLASS_HANDLE clsHnd)
{
mc->cr->AddCall("getSharedCCtorHelper");
CorInfoHelpFunc temp = original_ICorJitInfo->getSharedCCtorHelper(clsHnd);
@@ -810,9 +726,7 @@ CorInfoHelpFunc interceptor_ICJI::getSharedCCtorHelper(
return temp;
}
-CorInfoHelpFunc interceptor_ICJI::getSecurityPrologHelper(
- CORINFO_METHOD_HANDLE ftn
- )
+CorInfoHelpFunc interceptor_ICJI::getSecurityPrologHelper(CORINFO_METHOD_HANDLE ftn)
{
mc->cr->AddCall("getSecurityPrologHelper");
CorInfoHelpFunc temp = original_ICorJitInfo->getSecurityPrologHelper(ftn);
@@ -824,9 +738,7 @@ CorInfoHelpFunc interceptor_ICJI::getSecurityPrologHelper(
// 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 interceptor_ICJI::getTypeForBox(
- CORINFO_CLASS_HANDLE cls
- )
+CORINFO_CLASS_HANDLE interceptor_ICJI::getTypeForBox(CORINFO_CLASS_HANDLE cls)
{
mc->cr->AddCall("getTypeForBox");
CORINFO_CLASS_HANDLE temp = original_ICorJitInfo->getTypeForBox(cls);
@@ -837,9 +749,7 @@ CORINFO_CLASS_HANDLE interceptor_ICJI::getTypeForBox(
// 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 interceptor_ICJI::getBoxHelper(
- CORINFO_CLASS_HANDLE cls
- )
+CorInfoHelpFunc interceptor_ICJI::getBoxHelper(CORINFO_CLASS_HANDLE cls)
{
mc->cr->AddCall("getBoxHelper");
CorInfoHelpFunc temp = original_ICorJitInfo->getBoxHelper(cls);
@@ -858,9 +768,7 @@ CorInfoHelpFunc interceptor_ICJI::getBoxHelper(
// (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 interceptor_ICJI::getUnBoxHelper(
- CORINFO_CLASS_HANDLE cls
- )
+CorInfoHelpFunc interceptor_ICJI::getUnBoxHelper(CORINFO_CLASS_HANDLE cls)
{
mc->cr->AddCall("getUnBoxHelper");
CorInfoHelpFunc temp = original_ICorJitInfo->getUnBoxHelper(cls);
@@ -868,12 +776,10 @@ CorInfoHelpFunc interceptor_ICJI::getUnBoxHelper(
return temp;
}
-bool interceptor_ICJI::getReadyToRunHelper(
- CORINFO_RESOLVED_TOKEN * pResolvedToken,
- CORINFO_LOOKUP_KIND * pGenericLookupKind,
- CorInfoHelpFunc id,
- CORINFO_CONST_LOOKUP * pLookup
- )
+bool interceptor_ICJI::getReadyToRunHelper(CORINFO_RESOLVED_TOKEN* pResolvedToken,
+ CORINFO_LOOKUP_KIND* pGenericLookupKind,
+ CorInfoHelpFunc id,
+ CORINFO_CONST_LOOKUP* pLookup)
{
mc->cr->AddCall("getReadyToRunHelper");
bool result = original_ICorJitInfo->getReadyToRunHelper(pResolvedToken, pGenericLookupKind, id, pLookup);
@@ -881,20 +787,16 @@ bool interceptor_ICJI::getReadyToRunHelper(
return result;
}
-void interceptor_ICJI::getReadyToRunDelegateCtorHelper(
- CORINFO_RESOLVED_TOKEN * pTargetMethod,
- CORINFO_CLASS_HANDLE delegateType,
- CORINFO_LOOKUP * pLookup
- )
+void interceptor_ICJI::getReadyToRunDelegateCtorHelper(CORINFO_RESOLVED_TOKEN* pTargetMethod,
+ CORINFO_CLASS_HANDLE delegateType,
+ CORINFO_LOOKUP* pLookup)
{
mc->cr->AddCall("getReadyToRunDelegateCtorHelper");
original_ICorJitInfo->getReadyToRunDelegateCtorHelper(pTargetMethod, delegateType, pLookup);
mc->recGetReadyToRunDelegateCtorHelper(pTargetMethod, delegateType, pLookup);
}
-const char* interceptor_ICJI::getHelperName(
- CorInfoHelpFunc funcNum
- )
+const char* interceptor_ICJI::getHelperName(CorInfoHelpFunc funcNum)
{
mc->cr->AddCall("getHelperName");
const char* temp = original_ICorJitInfo->getHelperName(funcNum);
@@ -908,12 +810,12 @@ const char* interceptor_ICJI::getHelperName(
//
// See code:ICorClassInfo#ClassConstruction.
CorInfoInitClassResult interceptor_ICJI::initClass(
- CORINFO_FIELD_HANDLE field, // Non-nullptr - inquire about cctor trigger before static field access
- // nullptr - 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 // TRUE means don't actually run it
- )
+ CORINFO_FIELD_HANDLE field, // Non-nullptr - inquire about cctor trigger before static field access
+ // nullptr - 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 // TRUE means don't actually run it
+ )
{
mc->cr->AddCall("initClass");
CorInfoInitClassResult temp = original_ICorJitInfo->initClass(field, method, context, speculative);
@@ -931,9 +833,7 @@ CorInfoInitClassResult interceptor_ICJI::initClass(
// 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 interceptor_ICJI::classMustBeLoadedBeforeCodeIsRun(
- CORINFO_CLASS_HANDLE cls
- )
+void interceptor_ICJI::classMustBeLoadedBeforeCodeIsRun(CORINFO_CLASS_HANDLE cls)
{
mc->cr->AddCall("classMustBeLoadedBeforeCodeIsRun");
original_ICorJitInfo->classMustBeLoadedBeforeCodeIsRun(cls);
@@ -941,9 +841,7 @@ void interceptor_ICJI::classMustBeLoadedBeforeCodeIsRun(
}
// returns the class handle for the special builtin classes
-CORINFO_CLASS_HANDLE interceptor_ICJI::getBuiltinClass (
- CorInfoClassId classId
- )
+CORINFO_CLASS_HANDLE interceptor_ICJI::getBuiltinClass(CorInfoClassId classId)
{
mc->cr->AddCall("getBuiltinClass");
CORINFO_CLASS_HANDLE temp = original_ICorJitInfo->getBuiltinClass(classId);
@@ -952,9 +850,7 @@ CORINFO_CLASS_HANDLE interceptor_ICJI::getBuiltinClass (
}
// "System.Int32" ==> CORINFO_TYPE_INT..
-CorInfoType interceptor_ICJI::getTypeForPrimitiveValueClass(
- CORINFO_CLASS_HANDLE cls
- )
+CorInfoType interceptor_ICJI::getTypeForPrimitiveValueClass(CORINFO_CLASS_HANDLE cls)
{
mc->cr->AddCall("getTypeForPrimitiveValueClass");
CorInfoType temp = original_ICorJitInfo->getTypeForPrimitiveValueClass(cls);
@@ -964,10 +860,9 @@ CorInfoType interceptor_ICJI::getTypeForPrimitiveValueClass(
// TRUE if child is a subtype of parent
// if parent is an interface, then does child implement / extend parent
-BOOL interceptor_ICJI::canCast(
- CORINFO_CLASS_HANDLE child, // subtype (extends parent)
- CORINFO_CLASS_HANDLE parent // base type
- )
+BOOL interceptor_ICJI::canCast(CORINFO_CLASS_HANDLE child, // subtype (extends parent)
+ CORINFO_CLASS_HANDLE parent // base type
+ )
{
mc->cr->AddCall("canCast");
BOOL temp = original_ICorJitInfo->canCast(child, parent);
@@ -976,10 +871,7 @@ BOOL interceptor_ICJI::canCast(
}
// TRUE if cls1 and cls2 are considered equivalent types.
-BOOL interceptor_ICJI::areTypesEquivalent(
- CORINFO_CLASS_HANDLE cls1,
- CORINFO_CLASS_HANDLE cls2
- )
+BOOL interceptor_ICJI::areTypesEquivalent(CORINFO_CLASS_HANDLE cls1, CORINFO_CLASS_HANDLE cls2)
{
mc->cr->AddCall("areTypesEquivalent");
BOOL temp = original_ICorJitInfo->areTypesEquivalent(cls1, cls2);
@@ -988,10 +880,7 @@ BOOL interceptor_ICJI::areTypesEquivalent(
}
// returns is the intersection of cls1 and cls2.
-CORINFO_CLASS_HANDLE interceptor_ICJI::mergeClasses(
- CORINFO_CLASS_HANDLE cls1,
- CORINFO_CLASS_HANDLE cls2
- )
+CORINFO_CLASS_HANDLE interceptor_ICJI::mergeClasses(CORINFO_CLASS_HANDLE cls1, CORINFO_CLASS_HANDLE cls2)
{
mc->cr->AddCall("mergeClasses");
CORINFO_CLASS_HANDLE temp = original_ICorJitInfo->mergeClasses(cls1, cls2);
@@ -1002,9 +891,7 @@ CORINFO_CLASS_HANDLE interceptor_ICJI::mergeClasses(
// 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 interceptor_ICJI::getParentType (
- CORINFO_CLASS_HANDLE cls
- )
+CORINFO_CLASS_HANDLE interceptor_ICJI::getParentType(CORINFO_CLASS_HANDLE cls)
{
mc->cr->AddCall("getParentType");
CORINFO_CLASS_HANDLE temp = original_ICorJitInfo->getParentType(cls);
@@ -1016,10 +903,7 @@ CORINFO_CLASS_HANDLE interceptor_ICJI::getParentType (
// not a primitive type, *clsRet will be set.
// Given an Array of Type Foo, returns Foo.
// Given BYREF Foo, returns Foo
-CorInfoType interceptor_ICJI::getChildType (
- CORINFO_CLASS_HANDLE clsHnd,
- CORINFO_CLASS_HANDLE *clsRet
- )
+CorInfoType interceptor_ICJI::getChildType(CORINFO_CLASS_HANDLE clsHnd, CORINFO_CLASS_HANDLE* clsRet)
{
mc->cr->AddCall("getChildType");
CorInfoType temp = original_ICorJitInfo->getChildType(clsHnd, clsRet);
@@ -1028,21 +912,16 @@ CorInfoType interceptor_ICJI::getChildType (
}
// Check constraints on type arguments of this class and parent classes
-BOOL interceptor_ICJI::satisfiesClassConstraints(
- CORINFO_CLASS_HANDLE cls
- )
+BOOL interceptor_ICJI::satisfiesClassConstraints(CORINFO_CLASS_HANDLE cls)
{
mc->cr->AddCall("satisfiesClassConstraints");
BOOL temp = original_ICorJitInfo->satisfiesClassConstraints(cls);
mc->recSatisfiesClassConstraints(cls, temp);
return temp;
-
}
// Check if this is a single dimensional array type
-BOOL interceptor_ICJI::isSDArray(
- CORINFO_CLASS_HANDLE cls
- )
+BOOL interceptor_ICJI::isSDArray(CORINFO_CLASS_HANDLE cls)
{
mc->cr->AddCall("isSDArray");
BOOL temp = original_ICorJitInfo->isSDArray(cls);
@@ -1051,9 +930,7 @@ BOOL interceptor_ICJI::isSDArray(
}
// Get the numbmer of dimensions in an array
-unsigned interceptor_ICJI::getArrayRank(
- CORINFO_CLASS_HANDLE cls
- )
+unsigned interceptor_ICJI::getArrayRank(CORINFO_CLASS_HANDLE cls)
{
mc->cr->AddCall("getArrayRank");
unsigned result = original_ICorJitInfo->getArrayRank(cls);
@@ -1062,27 +939,25 @@ unsigned interceptor_ICJI::getArrayRank(
}
// Get static field data for an array
-void * interceptor_ICJI::getArrayInitializationData(
- CORINFO_FIELD_HANDLE field,
- DWORD size
- )
+void* interceptor_ICJI::getArrayInitializationData(CORINFO_FIELD_HANDLE field, DWORD size)
{
mc->cr->AddCall("getArrayInitializationData");
- void *temp = original_ICorJitInfo->getArrayInitializationData(field, size);
+ void* temp = original_ICorJitInfo->getArrayInitializationData(field, size);
mc->recGetArrayInitializationData(field, size, temp);
return temp;
}
// Check Visibility rules.
CorInfoIsAccessAllowedResult interceptor_ICJI::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. */
- )
+ CORINFO_RESOLVED_TOKEN* pResolvedToken,
+ CORINFO_METHOD_HANDLE callerHandle,
+ CORINFO_HELPER_DESC* pAccessHelper /* If canAccessMethod returns something other
+ than ALLOWED, then this is filled in. */
+ )
{
mc->cr->AddCall("canAccessClass");
- CorInfoIsAccessAllowedResult temp = original_ICorJitInfo->canAccessClass(pResolvedToken, callerHandle, pAccessHelper);
+ CorInfoIsAccessAllowedResult temp =
+ original_ICorJitInfo->canAccessClass(pResolvedToken, callerHandle, pAccessHelper);
mc->recCanAccessClass(pResolvedToken, callerHandle, pAccessHelper, temp);
return temp;
}
@@ -1095,10 +970,9 @@ CorInfoIsAccessAllowedResult interceptor_ICJI::canAccessClass(
// 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* interceptor_ICJI::getFieldName (
- CORINFO_FIELD_HANDLE ftn, /* IN */
- const char **moduleName /* OUT */
- )
+const char* interceptor_ICJI::getFieldName(CORINFO_FIELD_HANDLE ftn, /* IN */
+ const char** moduleName /* OUT */
+ )
{
mc->cr->AddCall("getFieldName");
const char* temp = original_ICorJitInfo->getFieldName(ftn, moduleName);
@@ -1107,9 +981,7 @@ const char* interceptor_ICJI::getFieldName (
}
// return class it belongs to
-CORINFO_CLASS_HANDLE interceptor_ICJI::getFieldClass (
- CORINFO_FIELD_HANDLE field
- )
+CORINFO_CLASS_HANDLE interceptor_ICJI::getFieldClass(CORINFO_FIELD_HANDLE field)
{
mc->cr->AddCall("getFieldClass");
CORINFO_CLASS_HANDLE temp = original_ICorJitInfo->getFieldClass(field);
@@ -1123,11 +995,10 @@ CORINFO_CLASS_HANDLE interceptor_ICJI::getFieldClass (
//
// 'memberParent' is typically only set when verifying. It should be the
// result of calling getMemberParent.
-CorInfoType interceptor_ICJI::getFieldType(
- CORINFO_FIELD_HANDLE field,
- CORINFO_CLASS_HANDLE *structType,
- CORINFO_CLASS_HANDLE memberParent/* IN */
- )
+CorInfoType interceptor_ICJI::getFieldType(CORINFO_FIELD_HANDLE field,
+ CORINFO_CLASS_HANDLE* structType,
+ CORINFO_CLASS_HANDLE memberParent /* IN */
+ )
{
mc->cr->AddCall("getFieldType");
CorInfoType temp = original_ICorJitInfo->getFieldType(field, structType, memberParent);
@@ -1136,9 +1007,7 @@ CorInfoType interceptor_ICJI::getFieldType(
}
// return the data member's instance offset
-unsigned interceptor_ICJI::getFieldOffset(
- CORINFO_FIELD_HANDLE field
- )
+unsigned interceptor_ICJI::getFieldOffset(CORINFO_FIELD_HANDLE field)
{
mc->cr->AddCall("getFieldOffset");
unsigned temp = original_ICorJitInfo->getFieldOffset(field);
@@ -1149,8 +1018,7 @@ unsigned interceptor_ICJI::getFieldOffset(
// 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 interceptor_ICJI::isWriteBarrierHelperRequired(
- CORINFO_FIELD_HANDLE field)
+bool interceptor_ICJI::isWriteBarrierHelperRequired(CORINFO_FIELD_HANDLE field)
{
mc->cr->AddCall("isWriteBarrierHelperRequired");
bool result = original_ICorJitInfo->isWriteBarrierHelperRequired(field);
@@ -1158,11 +1026,10 @@ bool interceptor_ICJI::isWriteBarrierHelperRequired(
return result;
}
-void interceptor_ICJI::getFieldInfo (CORINFO_RESOLVED_TOKEN * pResolvedToken,
- CORINFO_METHOD_HANDLE callerHandle,
- CORINFO_ACCESS_FLAGS flags,
- CORINFO_FIELD_INFO *pResult
- )
+void interceptor_ICJI::getFieldInfo(CORINFO_RESOLVED_TOKEN* pResolvedToken,
+ CORINFO_METHOD_HANDLE callerHandle,
+ CORINFO_ACCESS_FLAGS flags,
+ CORINFO_FIELD_INFO* pResult)
{
mc->cr->AddCall("getFieldInfo");
original_ICorJitInfo->getFieldInfo(pResolvedToken, callerHandle, flags, pResult);
@@ -1190,13 +1057,13 @@ bool interceptor_ICJI::isFieldStatic(CORINFO_FIELD_HANDLE fldHnd)
// 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 interceptor_ICJI::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
- )
+void interceptor_ICJI::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
+ )
{
mc->cr->AddCall("getBoundaries");
original_ICorJitInfo->getBoundaries(ftn, cILOffsets, pILOffsets, implictBoundaries);
@@ -1210,16 +1077,16 @@ void interceptor_ICJI::getBoundaries(
// 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.
-//Note - Ownership of pMap is transfered with this call. We need to record it before its passed on to the EE.
-void interceptor_ICJI::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
- )
+ //Note - Ownership of pMap is transfered with this call. We need to record it before its passed on to the EE.
+void interceptor_ICJI::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
+ )
{
mc->cr->AddCall("setBoundaries");
- mc->cr->recSetBoundaries(ftn, cMap, pMap); //Since the EE frees, we've gotta record before its sent to the EE.
+ mc->cr->recSetBoundaries(ftn, cMap, pMap); // Since the EE frees, we've gotta record before its sent to the EE.
original_ICorJitInfo->setBoundaries(ftn, cMap, pMap);
}
@@ -1231,14 +1098,13 @@ void interceptor_ICJI::setBoundaries(
// 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 interceptor_ICJI::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
- )
+void interceptor_ICJI::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
+ )
{
mc->cr->AddCall("getVars");
original_ICorJitInfo->getVars(ftn, cVars, vars, extendOthers);
@@ -1248,16 +1114,16 @@ void interceptor_ICJI::getVars(
// Report back to the EE the location of every variable.
// note that the JIT might split lifetimes into different
// locations etc.
-//Note - Ownership of vars is transfered with this call. We need to record it before its passed on to the EE.
-void interceptor_ICJI::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
- )
+ //Note - Ownership of vars is transfered with this call. We need to record it before its passed on to the EE.
+void interceptor_ICJI::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
+ )
{
mc->cr->AddCall("setVars");
- mc->cr->recSetVars(ftn, cVars, vars); //Since the EE frees, we've gotta record before its sent to the EE.
+ mc->cr->recSetVars(ftn, cVars, vars); // Since the EE frees, we've gotta record before its sent to the EE.
original_ICorJitInfo->setVars(ftn, cVars, vars);
}
@@ -1265,9 +1131,7 @@ void interceptor_ICJI::setVars(
// 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 * interceptor_ICJI::allocateArray(
- ULONG cBytes
- )
+void* interceptor_ICJI::allocateArray(ULONG cBytes)
{
mc->cr->AddCall("allocateArray");
return original_ICorJitInfo->allocateArray(cBytes);
@@ -1277,9 +1141,7 @@ void * interceptor_ICJI::allocateArray(
// For eg, The EE returns memory in getVars() and getBoundaries()
// to the JitCompiler, which the JitCompiler should release using
// freeArray()
-void interceptor_ICJI::freeArray(
- void *array
- )
+void interceptor_ICJI::freeArray(void* array)
{
mc->cr->AddCall("freeArray");
original_ICorJitInfo->freeArray(array);
@@ -1292,9 +1154,8 @@ void interceptor_ICJI::freeArray(
/*********************************************************************************/
// advance the pointer to the argument list.
// a ptr of 0, is special and always means the first argument
-CORINFO_ARG_LIST_HANDLE interceptor_ICJI::getArgNext (
- CORINFO_ARG_LIST_HANDLE args /* IN */
- )
+CORINFO_ARG_LIST_HANDLE interceptor_ICJI::getArgNext(CORINFO_ARG_LIST_HANDLE args /* IN */
+ )
{
mc->cr->AddCall("getArgNext");
CORINFO_ARG_LIST_HANDLE temp = original_ICorJitInfo->getArgNext(args);
@@ -1311,95 +1172,87 @@ CORINFO_ARG_LIST_HANDLE interceptor_ICJI::getArgNext (
// 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 interceptor_ICJI::getArgType (
- CORINFO_SIG_INFO* sig, /* IN */
- CORINFO_ARG_LIST_HANDLE args, /* IN */
- CORINFO_CLASS_HANDLE *vcTypeRet /* OUT */
- )
+CorInfoTypeWithMod interceptor_ICJI::getArgType(CORINFO_SIG_INFO* sig, /* IN */
+ CORINFO_ARG_LIST_HANDLE args, /* IN */
+ CORINFO_CLASS_HANDLE* vcTypeRet /* OUT */
+ )
{
- struct Param : FilterSuperPMIExceptionsParam_CaptureException {
+ struct Param : FilterSuperPMIExceptionsParam_CaptureException
+ {
interceptor_ICJI* pThis;
CORINFO_SIG_INFO* sig;
CORINFO_ARG_LIST_HANDLE args;
CORINFO_CLASS_HANDLE* vcTypeRet;
CorInfoTypeWithMod temp;
} param;
- param.pThis = this;
- param.sig = sig;
- param.args = args;
+ param.pThis = this;
+ param.sig = sig;
+ param.args = args;
param.vcTypeRet = vcTypeRet;
- param.temp = (CorInfoTypeWithMod)CORINFO_TYPE_UNDEF;
+ param.temp = (CorInfoTypeWithMod)CORINFO_TYPE_UNDEF;
- PAL_TRY(Param*, pOuterParam, &param)
- {
- PAL_TRY(Param*, pParam, pOuterParam)
- {
- pParam->pThis->mc->cr->AddCall("getArgType");
- pParam->temp = pParam->pThis->original_ICorJitInfo->getArgType(pParam->sig, pParam->args, pParam->vcTypeRet);
+ PAL_TRY(Param*, pOuterParam,
+ &param){PAL_TRY(Param*, pParam, pOuterParam){pParam->pThis->mc->cr->AddCall("getArgType");
+ pParam->temp = pParam->pThis->original_ICorJitInfo->getArgType(pParam->sig, pParam->args, pParam->vcTypeRet);
#ifdef fatMC
- CORINFO_CLASS_HANDLE temp3 = pParam->pThis->getArgClass(pParam->sig, pParam->args);
+ CORINFO_CLASS_HANDLE temp3 = pParam->pThis->getArgClass(pParam->sig, pParam->args);
#endif
- }
- PAL_EXCEPT_FILTER(FilterSuperPMIExceptions_CaptureExceptionAndContinue)
- {
- }
- PAL_ENDTRY
- }
- PAL_FINALLY
- {
- this->mc->recGetArgType(sig, args, vcTypeRet, param.temp, param.exceptionCode);
- }
- PAL_ENDTRY
+}
+PAL_EXCEPT_FILTER(FilterSuperPMIExceptions_CaptureExceptionAndContinue)
+{
+}
+PAL_ENDTRY
+}
+PAL_FINALLY
+{
+ this->mc->recGetArgType(sig, args, vcTypeRet, param.temp, param.exceptionCode);
+}
+PAL_ENDTRY
- return param.temp;
- }
+return param.temp;
+}
// If the Arg is a CORINFO_TYPE_CLASS fetch the class handle associated with it
-CORINFO_CLASS_HANDLE interceptor_ICJI::getArgClass (
- CORINFO_SIG_INFO* sig, /* IN */
- CORINFO_ARG_LIST_HANDLE args /* IN */
- )
+CORINFO_CLASS_HANDLE interceptor_ICJI::getArgClass(CORINFO_SIG_INFO* sig, /* IN */
+ CORINFO_ARG_LIST_HANDLE args /* IN */
+ )
{
- struct Param : FilterSuperPMIExceptionsParam_CaptureException {
+ struct Param : FilterSuperPMIExceptionsParam_CaptureException
+ {
interceptor_ICJI* pThis;
CORINFO_SIG_INFO* sig;
CORINFO_ARG_LIST_HANDLE args;
CORINFO_CLASS_HANDLE temp;
} param;
param.pThis = this;
- param.sig = sig;
- param.args = args;
- param.temp = 0;
+ param.sig = sig;
+ param.args = args;
+ param.temp = 0;
- PAL_TRY(Param*, pOuterParam, &param)
- {
- PAL_TRY(Param*, pParam, pOuterParam)
- {
- pParam->pThis->mc->cr->AddCall("getArgClass");
- pParam->temp = pParam->pThis->original_ICorJitInfo->getArgClass(pParam->sig, pParam->args);
- }
- PAL_EXCEPT_FILTER(FilterSuperPMIExceptions_CaptureExceptionAndContinue)
- {
- }
- PAL_ENDTRY
- }
- PAL_FINALLY
- {
- this->mc->recGetArgClass(sig, args, param.temp, param.exceptionCode);
+ PAL_TRY(Param*, pOuterParam,
+ &param){PAL_TRY(Param*, pParam, pOuterParam){pParam->pThis->mc->cr->AddCall("getArgClass");
+ pParam->temp = pParam->pThis->original_ICorJitInfo->getArgClass(pParam->sig, pParam->args);
+}
+PAL_EXCEPT_FILTER(FilterSuperPMIExceptions_CaptureExceptionAndContinue)
+{
+}
+PAL_ENDTRY
+}
+PAL_FINALLY
+{
+ this->mc->recGetArgClass(sig, args, param.temp, param.exceptionCode);
- //to build up a fat mc
- getClassName(param.temp);
- }
- PAL_ENDTRY
+ // to build up a fat mc
+ getClassName(param.temp);
+}
+PAL_ENDTRY
- return param.temp;
- }
+return param.temp;
+}
// Returns type of HFA for valuetype
-CorInfoType interceptor_ICJI::getHFAType (
- CORINFO_CLASS_HANDLE hClass
- )
+CorInfoType interceptor_ICJI::getHFAType(CORINFO_CLASS_HANDLE hClass)
{
mc->cr->AddCall("getHFAType");
CorInfoType temp = original_ICorJitInfo->getHFAType(hClass);
@@ -1413,9 +1266,7 @@ CorInfoType interceptor_ICJI::getHFAType (
* with code EXCEPTION_COMPLUS is caught.
*****************************************************************************/
// Returns the HRESULT of the current exception
-HRESULT interceptor_ICJI::GetErrorHRESULT(
- struct _EXCEPTION_POINTERS *pExceptionPointers
- )
+HRESULT interceptor_ICJI::GetErrorHRESULT(struct _EXCEPTION_POINTERS* pExceptionPointers)
{
mc->cr->AddCall("GetErrorHRESULT");
return original_ICorJitInfo->GetErrorHRESULT(pExceptionPointers);
@@ -1424,10 +1275,7 @@ HRESULT interceptor_ICJI::GetErrorHRESULT(
// 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 interceptor_ICJI::GetErrorMessage(
- __inout_ecount(bufferLength) LPWSTR buffer,
- ULONG bufferLength
- )
+ULONG interceptor_ICJI::GetErrorMessage(__inout_ecount(bufferLength) LPWSTR buffer, ULONG bufferLength)
{
mc->cr->AddCall("GetErrorMessage");
return original_ICorJitInfo->GetErrorMessage(buffer, bufferLength);
@@ -1438,9 +1286,7 @@ ULONG interceptor_ICJI::GetErrorMessage(
// 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 interceptor_ICJI::FilterException(
- struct _EXCEPTION_POINTERS *pExceptionPointers
- )
+int interceptor_ICJI::FilterException(struct _EXCEPTION_POINTERS* pExceptionPointers)
{
mc->cr->AddCall("FilterException");
int temp = original_ICorJitInfo->FilterException(pExceptionPointers);
@@ -1449,26 +1295,22 @@ int interceptor_ICJI::FilterException(
}
// Cleans up internal EE tracking when an exception is caught.
-void interceptor_ICJI::HandleException(
- struct _EXCEPTION_POINTERS *pExceptionPointers
- )
+void interceptor_ICJI::HandleException(struct _EXCEPTION_POINTERS* pExceptionPointers)
{
- //bswHack?
+ // bswHack?
mc->cr->AddCall("HandleException");
original_ICorJitInfo->HandleException(pExceptionPointers);
mc->recHandleException(pExceptionPointers);
}
-void interceptor_ICJI::ThrowExceptionForJitResult(
- HRESULT result)
+void interceptor_ICJI::ThrowExceptionForJitResult(HRESULT result)
{
mc->cr->AddCall("ThrowExceptionForJitResult");
original_ICorJitInfo->ThrowExceptionForJitResult(result);
}
-//Throws an exception defined by the given throw helper.
-void interceptor_ICJI::ThrowExceptionForHelper(
- const CORINFO_HELPER_DESC * throwHelper)
+// Throws an exception defined by the given throw helper.
+void interceptor_ICJI::ThrowExceptionForHelper(const CORINFO_HELPER_DESC* throwHelper)
{
mc->cr->AddCall("ThrowExceptionForHelper");
original_ICorJitInfo->ThrowExceptionForHelper(throwHelper);
@@ -1481,9 +1323,7 @@ void interceptor_ICJI::ThrowExceptionForHelper(
* assuming that all code versions are identical each time.)
*****************************************************************************/
// Return details about EE internal data structures
-void interceptor_ICJI::getEEInfo(
- CORINFO_EE_INFO *pEEInfoOut
- )
+void interceptor_ICJI::getEEInfo(CORINFO_EE_INFO* pEEInfoOut)
{
mc->cr->AddCall("getEEInfo");
original_ICorJitInfo->getEEInfo(pEEInfoOut);
@@ -1493,10 +1333,10 @@ void interceptor_ICJI::getEEInfo(
// Returns name of the JIT timer log
LPCWSTR interceptor_ICJI::getJitTimeLogFilename()
{
- mc->cr->AddCall("getJitTimeLogFilename");
- LPCWSTR temp = original_ICorJitInfo->getJitTimeLogFilename();
- mc->recGetJitTimeLogFilename(temp);
- return temp;
+ mc->cr->AddCall("getJitTimeLogFilename");
+ LPCWSTR temp = original_ICorJitInfo->getJitTimeLogFilename();
+ mc->recGetJitTimeLogFilename(temp);
+ return temp;
}
/*********************************************************************************/
@@ -1506,37 +1346,32 @@ LPCWSTR interceptor_ICJI::getJitTimeLogFilename()
/*********************************************************************************/
// this function is for debugging only. Returns method token.
// Returns mdMethodDefNil for dynamic methods.
-mdMethodDef interceptor_ICJI::getMethodDefFromMethod(
- CORINFO_METHOD_HANDLE hMethod
- )
+mdMethodDef interceptor_ICJI::getMethodDefFromMethod(CORINFO_METHOD_HANDLE hMethod)
{
mc->cr->AddCall("getMethodDefFromMethod");
mdMethodDef result = original_ICorJitInfo->getMethodDefFromMethod(hMethod);
mc->recGetMethodDefFromMethod(hMethod, result);
return result;
-
}
// 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* interceptor_ICJI::getMethodName (
- CORINFO_METHOD_HANDLE ftn, /* IN */
- const char **moduleName /* OUT */
- )
+const char* interceptor_ICJI::getMethodName(CORINFO_METHOD_HANDLE ftn, /* IN */
+ const char** moduleName /* OUT */
+ )
{
mc->cr->AddCall("getMethodName");
const char* temp = original_ICorJitInfo->getMethodName(ftn, moduleName);
- mc->recGetMethodName(ftn, (char *)temp, moduleName);
+ mc->recGetMethodName(ftn, (char*)temp, moduleName);
return temp;
}
// 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 interceptor_ICJI::getMethodHash (
- CORINFO_METHOD_HANDLE ftn /* IN */
- )
+unsigned interceptor_ICJI::getMethodHash(CORINFO_METHOD_HANDLE ftn /* IN */
+ )
{
mc->cr->AddCall("getMethodHash");
unsigned temp = original_ICorJitInfo->getMethodHash(ftn);
@@ -1545,12 +1380,11 @@ unsigned interceptor_ICJI::getMethodHash (
}
// this function is for debugging only.
-size_t interceptor_ICJI::findNameOfToken (
- CORINFO_MODULE_HANDLE module, /* IN */
- mdToken metaTOK, /* IN */
- __out_ecount (FQNameCapacity) char * szFQName, /* OUT */
- size_t FQNameCapacity /* IN */
- )
+size_t interceptor_ICJI::findNameOfToken(CORINFO_MODULE_HANDLE module, /* IN */
+ mdToken metaTOK, /* IN */
+ __out_ecount(FQNameCapacity) char* szFQName, /* OUT */
+ size_t FQNameCapacity /* IN */
+ )
{
mc->cr->AddCall("findNameOfToken");
size_t result = original_ICorJitInfo->findNameOfToken(module, metaTOK, szFQName, FQNameCapacity);
@@ -1559,20 +1393,18 @@ size_t interceptor_ICJI::findNameOfToken (
}
bool interceptor_ICJI::getSystemVAmd64PassStructInRegisterDescriptor(
- /* IN */ CORINFO_CLASS_HANDLE structHnd,
- /* OUT */ SYSTEMV_AMD64_CORINFO_STRUCT_REG_PASSING_DESCRIPTOR* structPassInRegDescPtr
- )
+ /* IN */ CORINFO_CLASS_HANDLE structHnd,
+ /* OUT */ SYSTEMV_AMD64_CORINFO_STRUCT_REG_PASSING_DESCRIPTOR* structPassInRegDescPtr)
{
mc->cr->AddCall("getSystemVAmd64PassStructInRegisterDescriptor");
- bool result = original_ICorJitInfo->getSystemVAmd64PassStructInRegisterDescriptor(structHnd, structPassInRegDescPtr);
+ bool result =
+ original_ICorJitInfo->getSystemVAmd64PassStructInRegisterDescriptor(structHnd, structPassInRegDescPtr);
mc->recGetSystemVAmd64PassStructInRegisterDescriptor(structHnd, structPassInRegDescPtr, result);
return result;
}
-//Stuff on ICorDynamicInfo
-DWORD interceptor_ICJI::getThreadTLSIndex(
- void **ppIndirection
- )
+// Stuff on ICorDynamicInfo
+DWORD interceptor_ICJI::getThreadTLSIndex(void** ppIndirection)
{
mc->cr->AddCall("getThreadTLSIndex");
DWORD temp = original_ICorJitInfo->getThreadTLSIndex(ppIndirection);
@@ -1580,9 +1412,7 @@ DWORD interceptor_ICJI::getThreadTLSIndex(
return temp;
}
-const void * interceptor_ICJI::getInlinedCallFrameVptr(
- void **ppIndirection
- )
+const void* interceptor_ICJI::getInlinedCallFrameVptr(void** ppIndirection)
{
mc->cr->AddCall("getInlinedCallFrameVptr");
const void* temp = original_ICorJitInfo->getInlinedCallFrameVptr(ppIndirection);
@@ -1590,30 +1420,25 @@ const void * interceptor_ICJI::getInlinedCallFrameVptr(
return temp;
}
-LONG * interceptor_ICJI::getAddrOfCaptureThreadGlobal(
- void **ppIndirection
- )
+LONG* interceptor_ICJI::getAddrOfCaptureThreadGlobal(void** ppIndirection)
{
mc->cr->AddCall("getAddrOfCaptureThreadGlobal");
- LONG * temp = original_ICorJitInfo->getAddrOfCaptureThreadGlobal(ppIndirection);
+ LONG* temp = original_ICorJitInfo->getAddrOfCaptureThreadGlobal(ppIndirection);
mc->recGetAddrOfCaptureThreadGlobal(ppIndirection, temp);
return temp;
}
-SIZE_T* interceptor_ICJI::getAddrModuleDomainID(CORINFO_MODULE_HANDLE module)
+SIZE_T* interceptor_ICJI::getAddrModuleDomainID(CORINFO_MODULE_HANDLE module)
{
mc->cr->AddCall("getAddrModuleDomainID");
return original_ICorJitInfo->getAddrModuleDomainID(module);
}
// return the native entry point to an EE helper (see CorInfoHelpFunc)
-void* interceptor_ICJI::getHelperFtn (
- CorInfoHelpFunc ftnNum,
- void **ppIndirection
- )
+void* interceptor_ICJI::getHelperFtn(CorInfoHelpFunc ftnNum, void** ppIndirection)
{
mc->cr->AddCall("getHelperFtn");
- void *temp = original_ICorJitInfo->getHelperFtn(ftnNum, ppIndirection);
+ void* temp = original_ICorJitInfo->getHelperFtn(ftnNum, ppIndirection);
mc->recGetHelperFtn(ftnNum, ppIndirection, temp);
return temp;
}
@@ -1621,10 +1446,9 @@ void* interceptor_ICJI::getHelperFtn (
// 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 interceptor_ICJI::getFunctionEntryPoint(
- CORINFO_METHOD_HANDLE ftn, /* IN */
- CORINFO_CONST_LOOKUP * pResult, /* OUT */
- CORINFO_ACCESS_FLAGS accessFlags)
+void interceptor_ICJI::getFunctionEntryPoint(CORINFO_METHOD_HANDLE ftn, /* IN */
+ CORINFO_CONST_LOOKUP* pResult, /* OUT */
+ CORINFO_ACCESS_FLAGS accessFlags)
{
mc->cr->AddCall("getFunctionEntryPoint");
original_ICorJitInfo->getFunctionEntryPoint(ftn, pResult, accessFlags);
@@ -1634,9 +1458,7 @@ void interceptor_ICJI::getFunctionEntryPoint(
// 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 interceptor_ICJI::getFunctionFixedEntryPoint(
- CORINFO_METHOD_HANDLE ftn,
- CORINFO_CONST_LOOKUP * pResult)
+void interceptor_ICJI::getFunctionFixedEntryPoint(CORINFO_METHOD_HANDLE ftn, CORINFO_CONST_LOOKUP* pResult)
{
mc->cr->AddCall("getFunctionFixedEntryPoint");
original_ICorJitInfo->getFunctionFixedEntryPoint(ftn, pResult);
@@ -1644,13 +1466,10 @@ void interceptor_ICJI::getFunctionFixedEntryPoint(
}
// get the synchronization handle that is passed to monXstatic function
-void* interceptor_ICJI::getMethodSync(
- CORINFO_METHOD_HANDLE ftn,
- void **ppIndirection
- )
+void* interceptor_ICJI::getMethodSync(CORINFO_METHOD_HANDLE ftn, void** ppIndirection)
{
mc->cr->AddCall("getMethodSync");
- void *temp = original_ICorJitInfo->getMethodSync(ftn, ppIndirection);
+ void* temp = original_ICorJitInfo->getMethodSync(ftn, ppIndirection);
mc->recGetMethodSync(ftn, ppIndirection, temp);
return temp;
}
@@ -1661,9 +1480,7 @@ void* interceptor_ICJI::getMethodSync(
// get slow lazy string literal helper to use (CORINFO_HELP_STRCNS*).
// Returns CORINFO_HELP_UNDEF if lazy string literal helper cannot be used.
-CorInfoHelpFunc interceptor_ICJI::getLazyStringLiteralHelper(
- CORINFO_MODULE_HANDLE handle
- )
+CorInfoHelpFunc interceptor_ICJI::getLazyStringLiteralHelper(CORINFO_MODULE_HANDLE handle)
{
mc->cr->AddCall("getLazyStringLiteralHelper");
CorInfoHelpFunc temp = original_ICorJitInfo->getLazyStringLiteralHelper(handle);
@@ -1671,10 +1488,7 @@ CorInfoHelpFunc interceptor_ICJI::getLazyStringLiteralHelper(
return temp;
}
-CORINFO_MODULE_HANDLE interceptor_ICJI::embedModuleHandle(
- CORINFO_MODULE_HANDLE handle,
- void **ppIndirection
- )
+CORINFO_MODULE_HANDLE interceptor_ICJI::embedModuleHandle(CORINFO_MODULE_HANDLE handle, void** ppIndirection)
{
mc->cr->AddCall("embedModuleHandle");
CORINFO_MODULE_HANDLE temp = original_ICorJitInfo->embedModuleHandle(handle, ppIndirection);
@@ -1682,10 +1496,7 @@ CORINFO_MODULE_HANDLE interceptor_ICJI::embedModuleHandle(
return temp;
}
-CORINFO_CLASS_HANDLE interceptor_ICJI::embedClassHandle(
- CORINFO_CLASS_HANDLE handle,
- void **ppIndirection
- )
+CORINFO_CLASS_HANDLE interceptor_ICJI::embedClassHandle(CORINFO_CLASS_HANDLE handle, void** ppIndirection)
{
mc->cr->AddCall("embedClassHandle");
CORINFO_CLASS_HANDLE temp = original_ICorJitInfo->embedClassHandle(handle, ppIndirection);
@@ -1693,10 +1504,7 @@ CORINFO_CLASS_HANDLE interceptor_ICJI::embedClassHandle(
return temp;
}
-CORINFO_METHOD_HANDLE interceptor_ICJI::embedMethodHandle(
- CORINFO_METHOD_HANDLE handle,
- void **ppIndirection
- )
+CORINFO_METHOD_HANDLE interceptor_ICJI::embedMethodHandle(CORINFO_METHOD_HANDLE handle, void** ppIndirection)
{
mc->cr->AddCall("embedMethodHandle");
CORINFO_METHOD_HANDLE temp = original_ICorJitInfo->embedMethodHandle(handle, ppIndirection);
@@ -1704,10 +1512,7 @@ CORINFO_METHOD_HANDLE interceptor_ICJI::embedMethodHandle(
return temp;
}
-CORINFO_FIELD_HANDLE interceptor_ICJI::embedFieldHandle(
- CORINFO_FIELD_HANDLE handle,
- void **ppIndirection
- )
+CORINFO_FIELD_HANDLE interceptor_ICJI::embedFieldHandle(CORINFO_FIELD_HANDLE handle, void** ppIndirection)
{
mc->cr->AddCall("embedFieldHandle");
CORINFO_FIELD_HANDLE temp = original_ICorJitInfo->embedFieldHandle(handle, ppIndirection);
@@ -1722,10 +1527,10 @@ CORINFO_FIELD_HANDLE interceptor_ICJI::embedFieldHandle(
// code is shared and the token contains generic parameters)
// then indicate how the handle should be looked up at run-time.
//
-void interceptor_ICJI::embedGenericHandle(
- CORINFO_RESOLVED_TOKEN * pResolvedToken,
- BOOL fEmbedParent, // TRUE - embeds parent type handle of the field/method handle
- CORINFO_GENERICHANDLE_RESULT * pResult)
+void interceptor_ICJI::embedGenericHandle(CORINFO_RESOLVED_TOKEN* pResolvedToken,
+ BOOL fEmbedParent, // TRUE - embeds parent type handle of the field/method
+ // handle
+ CORINFO_GENERICHANDLE_RESULT* pResult)
{
mc->cr->AddCall("embedGenericHandle");
original_ICorJitInfo->embedGenericHandle(pResolvedToken, fEmbedParent, pResult);
@@ -1739,9 +1544,7 @@ void interceptor_ICJI::embedGenericHandle(
// 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 interceptor_ICJI::getLocationOfThisType(
- CORINFO_METHOD_HANDLE context
- )
+CORINFO_LOOKUP_KIND interceptor_ICJI::getLocationOfThisType(CORINFO_METHOD_HANDLE context)
{
mc->cr->AddCall("getLocationOfThisType");
CORINFO_LOOKUP_KIND temp = original_ICorJitInfo->getLocationOfThisType(context);
@@ -1750,34 +1553,25 @@ CORINFO_LOOKUP_KIND interceptor_ICJI::getLocationOfThisType(
}
// return the unmanaged target *if method has already been prelinked.*
-void* interceptor_ICJI::getPInvokeUnmanagedTarget(
- CORINFO_METHOD_HANDLE method,
- void **ppIndirection
- )
+void* interceptor_ICJI::getPInvokeUnmanagedTarget(CORINFO_METHOD_HANDLE method, void** ppIndirection)
{
mc->cr->AddCall("getPInvokeUnmanagedTarget");
- void *result = original_ICorJitInfo->getPInvokeUnmanagedTarget(method, ppIndirection);
+ void* result = original_ICorJitInfo->getPInvokeUnmanagedTarget(method, ppIndirection);
mc->recGetPInvokeUnmanagedTarget(method, ppIndirection, result);
return result;
}
// return address of fixup area for late-bound PInvoke calls.
-void* interceptor_ICJI::getAddressOfPInvokeFixup(
- CORINFO_METHOD_HANDLE method,
- void **ppIndirection
- )
+void* interceptor_ICJI::getAddressOfPInvokeFixup(CORINFO_METHOD_HANDLE method, void** ppIndirection)
{
mc->cr->AddCall("getAddressOfPInvokeFixup");
- void *temp = original_ICorJitInfo->getAddressOfPInvokeFixup(method, ppIndirection);
+ void* temp = original_ICorJitInfo->getAddressOfPInvokeFixup(method, ppIndirection);
mc->recGetAddressOfPInvokeFixup(method, ppIndirection, temp);
return temp;
}
// return address of fixup area for late-bound PInvoke calls.
-void interceptor_ICJI::getAddressOfPInvokeTarget(
- CORINFO_METHOD_HANDLE method,
- CORINFO_CONST_LOOKUP *pLookup
- )
+void interceptor_ICJI::getAddressOfPInvokeTarget(CORINFO_METHOD_HANDLE method, CORINFO_CONST_LOOKUP* pLookup)
{
mc->cr->AddCall("getAddressOfPInvokeTarget");
original_ICorJitInfo->getAddressOfPInvokeTarget(method, pLookup);
@@ -1786,10 +1580,7 @@ void interceptor_ICJI::getAddressOfPInvokeTarget(
// Generate a cookie based on the signature that would needs to be passed
// to CORINFO_HELP_PINVOKE_CALLI
-LPVOID interceptor_ICJI::GetCookieForPInvokeCalliSig(
- CORINFO_SIG_INFO* szMetaSig,
- void ** ppIndirection
- )
+LPVOID interceptor_ICJI::GetCookieForPInvokeCalliSig(CORINFO_SIG_INFO* szMetaSig, void** ppIndirection)
{
mc->cr->AddCall("GetCookieForPInvokeCalliSig");
LPVOID temp = original_ICorJitInfo->GetCookieForPInvokeCalliSig(szMetaSig, ppIndirection);
@@ -1799,9 +1590,7 @@ LPVOID interceptor_ICJI::GetCookieForPInvokeCalliSig(
// 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 interceptor_ICJI::canGetCookieForPInvokeCalliSig(
- CORINFO_SIG_INFO* szMetaSig
- )
+bool interceptor_ICJI::canGetCookieForPInvokeCalliSig(CORINFO_SIG_INFO* szMetaSig)
{
mc->cr->AddCall("canGetCookieForPInvokeCalliSig");
bool temp = original_ICorJitInfo->canGetCookieForPInvokeCalliSig(szMetaSig);
@@ -1811,10 +1600,8 @@ bool interceptor_ICJI::canGetCookieForPInvokeCalliSig(
// Gets a handle that is checked to see if the current method is
// included in "JustMyCode"
-CORINFO_JUST_MY_CODE_HANDLE interceptor_ICJI::getJustMyCodeHandle(
- CORINFO_METHOD_HANDLE method,
- CORINFO_JUST_MY_CODE_HANDLE**ppIndirection
- )
+CORINFO_JUST_MY_CODE_HANDLE interceptor_ICJI::getJustMyCodeHandle(CORINFO_METHOD_HANDLE method,
+ CORINFO_JUST_MY_CODE_HANDLE** ppIndirection)
{
mc->cr->AddCall("getJustMyCodeHandle");
CORINFO_JUST_MY_CODE_HANDLE temp = original_ICorJitInfo->getJustMyCodeHandle(method, ppIndirection);
@@ -1825,11 +1612,7 @@ CORINFO_JUST_MY_CODE_HANDLE interceptor_ICJI::getJustMyCodeHandle(
// 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 interceptor_ICJI::GetProfilingHandle(
- BOOL *pbHookFunction,
- void **pProfilerHandle,
- BOOL *pbIndirectedHandles
- )
+void interceptor_ICJI::GetProfilingHandle(BOOL* pbHookFunction, void** pProfilerHandle, BOOL* pbIndirectedHandles)
{
mc->cr->AddCall("GetProfilingHandle");
original_ICorJitInfo->GetProfilingHandle(pbHookFunction, pProfilerHandle, pbIndirectedHandles);
@@ -1838,19 +1621,19 @@ void interceptor_ICJI::GetProfilingHandle(
// Returns instructions on how to make the call. See code:CORINFO_CALL_INFO for possible return values.
void interceptor_ICJI::getCallInfo(
- // Token info
- CORINFO_RESOLVED_TOKEN * pResolvedToken,
- //Generics info
- CORINFO_RESOLVED_TOKEN * pConstrainedResolvedToken,
- //Security info
- CORINFO_METHOD_HANDLE callerHandle,
- //Jit info
- CORINFO_CALLINFO_FLAGS flags,
- //out params
- CORINFO_CALL_INFO *pResult
- )
-{
- struct Param : FilterSuperPMIExceptionsParam_CaptureException {
+ // Token info
+ CORINFO_RESOLVED_TOKEN* pResolvedToken,
+ // Generics info
+ CORINFO_RESOLVED_TOKEN* pConstrainedResolvedToken,
+ // Security info
+ CORINFO_METHOD_HANDLE callerHandle,
+ // Jit info
+ CORINFO_CALLINFO_FLAGS flags,
+ // out params
+ CORINFO_CALL_INFO* pResult)
+{
+ struct Param : FilterSuperPMIExceptionsParam_CaptureException
+ {
interceptor_ICJI* pThis;
CORINFO_RESOLVED_TOKEN* pResolvedToken;
CORINFO_RESOLVED_TOKEN* pConstrainedResolvedToken;
@@ -1858,34 +1641,32 @@ void interceptor_ICJI::getCallInfo(
CORINFO_CALLINFO_FLAGS flags;
CORINFO_CALL_INFO* pResult;
} param;
- param.pThis = this;
- param.pResolvedToken = pResolvedToken;
+ param.pThis = this;
+ param.pResolvedToken = pResolvedToken;
param.pConstrainedResolvedToken = pConstrainedResolvedToken;
- param.callerHandle = callerHandle;
- param.flags = flags;
- param.pResult = pResult;
+ param.callerHandle = callerHandle;
+ param.flags = flags;
+ param.pResult = pResult;
- PAL_TRY(Param*, pOuterParam, &param)
- {
- PAL_TRY(Param*, pParam, pOuterParam)
- {
- pParam->pThis->mc->cr->AddCall("getCallInfo");
- pParam->pThis->original_ICorJitInfo->getCallInfo(pParam->pResolvedToken, pParam->pConstrainedResolvedToken, pParam->callerHandle, pParam->flags, pParam->pResult);
- }
- PAL_EXCEPT_FILTER(FilterSuperPMIExceptions_CaptureExceptionAndContinue)
- {
- }
- PAL_ENDTRY
- }
- PAL_FINALLY
- {
- this->mc->recGetCallInfo(pResolvedToken, pConstrainedResolvedToken, callerHandle, flags, pResult, param.exceptionCode);
- }
- PAL_ENDTRY
- }
+ PAL_TRY(Param*, pOuterParam,
+ &param){PAL_TRY(Param*, pParam, pOuterParam){pParam->pThis->mc->cr->AddCall("getCallInfo");
+ pParam->pThis->original_ICorJitInfo->getCallInfo(pParam->pResolvedToken, pParam->pConstrainedResolvedToken,
+ pParam->callerHandle, pParam->flags, pParam->pResult);
+}
+PAL_EXCEPT_FILTER(FilterSuperPMIExceptions_CaptureExceptionAndContinue)
+{
+}
+PAL_ENDTRY
+}
+PAL_FINALLY
+{
+ this->mc->recGetCallInfo(pResolvedToken, pConstrainedResolvedToken, callerHandle, flags, pResult,
+ param.exceptionCode);
+}
+PAL_ENDTRY
+}
-BOOL interceptor_ICJI::canAccessFamily(CORINFO_METHOD_HANDLE hCaller,
- CORINFO_CLASS_HANDLE hInstanceType)
+BOOL interceptor_ICJI::canAccessFamily(CORINFO_METHOD_HANDLE hCaller, CORINFO_CLASS_HANDLE hInstanceType)
{
mc->cr->AddCall("canAccessFamily");
BOOL temp = original_ICorJitInfo->canAccessFamily(hCaller, hInstanceType);
@@ -1902,10 +1683,7 @@ BOOL interceptor_ICJI::isRIDClassDomainID(CORINFO_CLASS_HANDLE cls)
}
// returns the class's domain ID for accessing shared statics
-unsigned interceptor_ICJI::getClassDomainID (
- CORINFO_CLASS_HANDLE cls,
- void **ppIndirection
- )
+unsigned interceptor_ICJI::getClassDomainID(CORINFO_CLASS_HANDLE cls, void** ppIndirection)
{
mc->cr->AddCall("getClassDomainID");
unsigned temp = original_ICorJitInfo->getClassDomainID(cls, ppIndirection);
@@ -1914,26 +1692,20 @@ unsigned interceptor_ICJI::getClassDomainID (
}
// return the data's address (for static fields only)
-void* interceptor_ICJI::getFieldAddress(
- CORINFO_FIELD_HANDLE field,
- void **ppIndirection
- )
+void* interceptor_ICJI::getFieldAddress(CORINFO_FIELD_HANDLE field, void** ppIndirection)
{
mc->cr->AddCall("getFieldAddress");
- void *temp = original_ICorJitInfo->getFieldAddress(field, ppIndirection);
+ void* temp = original_ICorJitInfo->getFieldAddress(field, ppIndirection);
- //Figure out the element type so we know how much we can load
+ // Figure out the element type so we know how much we can load
CORINFO_CLASS_HANDLE cch;
- CorInfoType cit = getFieldType(field, &cch, NULL);
+ CorInfoType cit = getFieldType(field, &cch, NULL);
mc->recGetFieldAddress(field, ppIndirection, temp, cit);
return temp;
}
// registers a vararg sig & returns a VM cookie for it (which can contain other stuff)
-CORINFO_VARARGS_HANDLE interceptor_ICJI::getVarArgsHandle(
- CORINFO_SIG_INFO *pSig,
- void **ppIndirection
- )
+CORINFO_VARARGS_HANDLE interceptor_ICJI::getVarArgsHandle(CORINFO_SIG_INFO* pSig, void** ppIndirection)
{
mc->cr->AddCall("getVarArgsHandle");
CORINFO_VARARGS_HANDLE temp = original_ICorJitInfo->getVarArgsHandle(pSig, ppIndirection);
@@ -1943,9 +1715,7 @@ CORINFO_VARARGS_HANDLE interceptor_ICJI::getVarArgsHandle(
// 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 interceptor_ICJI::canGetVarArgsHandle(
- CORINFO_SIG_INFO *pSig
- )
+bool interceptor_ICJI::canGetVarArgsHandle(CORINFO_SIG_INFO* pSig)
{
mc->cr->AddCall("canGetVarArgsHandle");
bool temp = original_ICorJitInfo->canGetVarArgsHandle(pSig);
@@ -1954,11 +1724,7 @@ bool interceptor_ICJI::canGetVarArgsHandle(
}
// Allocate a string literal on the heap and return a handle to it
-InfoAccessType interceptor_ICJI::constructStringLiteral(
- CORINFO_MODULE_HANDLE module,
- mdToken metaTok,
- void **ppValue
- )
+InfoAccessType interceptor_ICJI::constructStringLiteral(CORINFO_MODULE_HANDLE module, mdToken metaTok, void** ppValue)
{
mc->cr->AddCall("constructStringLiteral");
InfoAccessType temp = original_ICorJitInfo->constructStringLiteral(module, metaTok, ppValue);
@@ -1966,7 +1732,7 @@ InfoAccessType interceptor_ICJI::constructStringLiteral(
return temp;
}
-InfoAccessType interceptor_ICJI::emptyStringLiteral(void **ppValue)
+InfoAccessType interceptor_ICJI::emptyStringLiteral(void** ppValue)
{
mc->cr->AddCall("emptyStringLiteral");
InfoAccessType temp = original_ICorJitInfo->emptyStringLiteral(ppValue);
@@ -1977,10 +1743,7 @@ InfoAccessType interceptor_ICJI::emptyStringLiteral(void **ppValue)
// (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 interceptor_ICJI::getFieldThreadLocalStoreID (
- CORINFO_FIELD_HANDLE field,
- void **ppIndirection
- )
+DWORD interceptor_ICJI::getFieldThreadLocalStoreID(CORINFO_FIELD_HANDLE field, void** ppIndirection)
{
mc->cr->AddCall("getFieldThreadLocalStoreID");
DWORD temp = original_ICorJitInfo->getFieldThreadLocalStoreID(field, ppIndirection);
@@ -1989,10 +1752,7 @@ DWORD interceptor_ICJI::getFieldThreadLocalStoreID (
}
// Sets another object to intercept calls to "self" and current method being compiled
-void interceptor_ICJI::setOverride(
- ICorDynamicInfo *pOverride,
- CORINFO_METHOD_HANDLE currentMethod
- )
+void interceptor_ICJI::setOverride(ICorDynamicInfo* pOverride, CORINFO_METHOD_HANDLE currentMethod)
{
mc->cr->AddCall("setOverride");
original_ICorJitInfo->setOverride(pOverride, currentMethod);
@@ -2000,21 +1760,16 @@ void interceptor_ICJI::setOverride(
// 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 interceptor_ICJI::addActiveDependency(
- CORINFO_MODULE_HANDLE moduleFrom,
- CORINFO_MODULE_HANDLE moduleTo
- )
+void interceptor_ICJI::addActiveDependency(CORINFO_MODULE_HANDLE moduleFrom, CORINFO_MODULE_HANDLE moduleTo)
{
mc->cr->AddCall("addActiveDependency");
original_ICorJitInfo->addActiveDependency(moduleFrom, moduleTo);
}
-CORINFO_METHOD_HANDLE interceptor_ICJI::GetDelegateCtor(
- CORINFO_METHOD_HANDLE methHnd,
- CORINFO_CLASS_HANDLE clsHnd,
- CORINFO_METHOD_HANDLE targetMethodHnd,
- DelegateCtorArgs * pCtorData
- )
+CORINFO_METHOD_HANDLE interceptor_ICJI::GetDelegateCtor(CORINFO_METHOD_HANDLE methHnd,
+ CORINFO_CLASS_HANDLE clsHnd,
+ CORINFO_METHOD_HANDLE targetMethodHnd,
+ DelegateCtorArgs* pCtorData)
{
mc->cr->AddCall("GetDelegateCtor");
CORINFO_METHOD_HANDLE temp = original_ICorJitInfo->GetDelegateCtor(methHnd, clsHnd, targetMethodHnd, pCtorData);
@@ -2022,30 +1777,25 @@ CORINFO_METHOD_HANDLE interceptor_ICJI::GetDelegateCtor(
return temp;
}
-void interceptor_ICJI::MethodCompileComplete(
- CORINFO_METHOD_HANDLE methHnd
- )
+void interceptor_ICJI::MethodCompileComplete(CORINFO_METHOD_HANDLE methHnd)
{
mc->cr->AddCall("MethodCompileComplete");
original_ICorJitInfo->MethodCompileComplete(methHnd);
}
// return a thunk that will copy the arguments for the given signature.
-void* interceptor_ICJI::getTailCallCopyArgsThunk (
- CORINFO_SIG_INFO *pSig,
- CorInfoHelperTailCallSpecialHandling flags
- )
+void* interceptor_ICJI::getTailCallCopyArgsThunk(CORINFO_SIG_INFO* pSig, CorInfoHelperTailCallSpecialHandling flags)
{
mc->cr->AddCall("getTailCallCopyArgsThunk");
- void *result = original_ICorJitInfo->getTailCallCopyArgsThunk(pSig, flags);
+ void* result = original_ICorJitInfo->getTailCallCopyArgsThunk(pSig, flags);
mc->recGetTailCallCopyArgsThunk(pSig, flags, result);
return result;
}
-//Stuff directly on ICorJitInfo
+// Stuff directly on ICorJitInfo
// Returns extended flags for a particular compilation instance.
-DWORD interceptor_ICJI::getJitFlags(CORJIT_FLAGS *jitFlags, DWORD sizeInBytes)
+DWORD interceptor_ICJI::getJitFlags(CORJIT_FLAGS* jitFlags, DWORD sizeInBytes)
{
mc->cr->AddCall("getJitFlags");
DWORD result = original_ICorJitInfo->getJitFlags(jitFlags, sizeInBytes);
@@ -2058,7 +1808,7 @@ DWORD interceptor_ICJI::getJitFlags(CORJIT_FLAGS *jitFlags, DWORD sizeInBytes)
// record the results of the call: when this call gets played back,
// its result will depend on whether or not `function` calls something
// that throws at playback time rather than at capture time.
-bool interceptor_ICJI::runWithErrorTrap(void (*function)(void*), void *param)
+bool interceptor_ICJI::runWithErrorTrap(void (*function)(void*), void* param)
{
mc->cr->AddCall("runWithErrorTrap");
return original_ICorJitInfo->runWithErrorTrap(function, param);
@@ -2068,26 +1818,27 @@ bool interceptor_ICJI::runWithErrorTrap(void (*function)(void*), void *param)
IEEMemoryManager* interceptor_ICJI::getMemoryManager()
{
mc->cr->AddCall("getMemoryManager");
- if(current_IEEMM->original_IEEMM == nullptr)
+ if (current_IEEMM->original_IEEMM == nullptr)
current_IEEMM->original_IEEMM = original_ICorJitInfo->getMemoryManager();
return current_IEEMM;
}
// get a block of memory for the code, readonly data, and read-write data
-void interceptor_ICJI::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 */
- )
+void interceptor_ICJI::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 */
+ )
{
mc->cr->AddCall("allocMem");
- original_ICorJitInfo->allocMem(hotCodeSize, coldCodeSize, roDataSize, xcptnsCount, flag, hotCodeBlock, coldCodeBlock, roDataBlock);
- mc->cr->recAllocMem(hotCodeSize, coldCodeSize, roDataSize, xcptnsCount, flag, hotCodeBlock, coldCodeBlock, roDataBlock);
+ original_ICorJitInfo->allocMem(hotCodeSize, coldCodeSize, roDataSize, xcptnsCount, flag, hotCodeBlock,
+ coldCodeBlock, roDataBlock);
+ mc->cr->recAllocMem(hotCodeSize, coldCodeSize, roDataSize, xcptnsCount, flag, hotCodeBlock, coldCodeBlock,
+ roDataBlock);
}
// Reserve memory for the method/funclet's unwind information.
@@ -2101,11 +1852,10 @@ void interceptor_ICJI::allocMem (
// For prejitted code we split up the unwinding information into
// separate sections .rdata and .pdata.
//
-void interceptor_ICJI::reserveUnwindInfo (
- BOOL isFunclet, /* IN */
- BOOL isColdCode, /* IN */
- ULONG unwindSize /* IN */
- )
+void interceptor_ICJI::reserveUnwindInfo(BOOL isFunclet, /* IN */
+ BOOL isColdCode, /* IN */
+ ULONG unwindSize /* IN */
+ )
{
mc->cr->AddCall("reserveUnwindInfo");
original_ICorJitInfo->reserveUnwindInfo(isFunclet, isColdCode, unwindSize);
@@ -2129,18 +1879,18 @@ void interceptor_ICJI::reserveUnwindInfo (
// pUnwindBlock pointer to unwind info
// funcKind type of funclet (main method code, handler, filter)
//
-void interceptor_ICJI::allocUnwindInfo(
- BYTE * pHotCode, /* IN */
- BYTE * pColdCode, /* IN */
- ULONG startOffset, /* IN */
- ULONG endOffset, /* IN */
- ULONG unwindSize, /* IN */
- BYTE * pUnwindBlock, /* IN */
- CorJitFuncKind funcKind /* IN */
- )
+void interceptor_ICJI::allocUnwindInfo(BYTE* pHotCode, /* IN */
+ BYTE* pColdCode, /* IN */
+ ULONG startOffset, /* IN */
+ ULONG endOffset, /* IN */
+ ULONG unwindSize, /* IN */
+ BYTE* pUnwindBlock, /* IN */
+ CorJitFuncKind funcKind /* IN */
+ )
{
mc->cr->AddCall("allocUnwindInfo");
- original_ICorJitInfo->allocUnwindInfo(pHotCode, pColdCode, startOffset, endOffset, unwindSize, pUnwindBlock, funcKind);
+ original_ICorJitInfo->allocUnwindInfo(pHotCode, pColdCode, startOffset, endOffset, unwindSize, pUnwindBlock,
+ funcKind);
mc->cr->recAllocUnwindInfo(pHotCode, pColdCode, startOffset, endOffset, unwindSize, pUnwindBlock, funcKind);
}
@@ -2148,25 +1898,25 @@ void interceptor_ICJI::allocUnwindInfo(
// (the info for enumerating the GC pointers while crawling the
// stack frame).
// Note that allocMem must be called first
-void *interceptor_ICJI::allocGCInfo(size_t size /* IN */)
+void* interceptor_ICJI::allocGCInfo(size_t size /* IN */)
{
mc->cr->AddCall("allocGCInfo");
- void *temp = original_ICorJitInfo->allocGCInfo(size);
+ void* temp = original_ICorJitInfo->allocGCInfo(size);
mc->cr->recAllocGCInfo(size, temp);
return temp;
}
-//only used on x64
+// only used on x64
void interceptor_ICJI::yieldExecution()
{
- mc->cr->AddCall("yieldExecution"); //Nothing to record
+ mc->cr->AddCall("yieldExecution"); // Nothing to record
original_ICorJitInfo->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 interceptor_ICJI::setEHcount (unsigned cEH /* IN */)
+void interceptor_ICJI::setEHcount(unsigned cEH /* IN */)
{
mc->cr->AddCall("setEHcount");
original_ICorJitInfo->setEHcount(cEH);
@@ -2177,10 +1927,9 @@ void interceptor_ICJI::setEHcount (unsigned cEH /* IN */)
// Handler regions should be lexically contiguous.
// This is because FinallyIsUnwinding() uses lexicality to
// determine if a "finally" clause is executing.
-void interceptor_ICJI::setEHinfo (
- unsigned EHnumber, /* IN */
- const CORINFO_EH_CLAUSE *clause /* IN */
- )
+void interceptor_ICJI::setEHinfo(unsigned EHnumber, /* IN */
+ const CORINFO_EH_CLAUSE* clause /* IN */
+ )
{
mc->cr->AddCall("setEHinfo");
original_ICorJitInfo->setEHinfo(EHnumber, clause);
@@ -2213,10 +1962,8 @@ void interceptor_ICJI::reportFatalError(CorJitResult result)
// allocate a basic block profile buffer where execution counts will be stored
// for jitted basic blocks.
-HRESULT interceptor_ICJI::allocBBProfileBuffer (
- ULONG count, // The number of basic blocks that we have
- ProfileBuffer **profileBuffer
- )
+HRESULT interceptor_ICJI::allocBBProfileBuffer(ULONG count, // The number of basic blocks that we have
+ ProfileBuffer** profileBuffer)
{
mc->cr->AddCall("allocBBProfileBuffer");
HRESULT result = original_ICorJitInfo->allocBBProfileBuffer(count, profileBuffer);
@@ -2226,12 +1973,10 @@ HRESULT interceptor_ICJI::allocBBProfileBuffer (
// 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 interceptor_ICJI::getBBProfileData(
- CORINFO_METHOD_HANDLE ftnHnd,
- ULONG *count, // The number of basic blocks that we have
- ProfileBuffer **profileBuffer,
- ULONG *numRuns
- )
+HRESULT interceptor_ICJI::getBBProfileData(CORINFO_METHOD_HANDLE ftnHnd,
+ ULONG* count, // The number of basic blocks that we have
+ ProfileBuffer** profileBuffer,
+ ULONG* numRuns)
{
mc->cr->AddCall("getBBProfileData");
HRESULT temp = original_ICorJitInfo->getBBProfileData(ftnHnd, count, profileBuffer, numRuns);
@@ -2243,11 +1988,10 @@ HRESULT interceptor_ICJI::getBBProfileData(
// 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 interceptor_ICJI::recordCallSite(
- ULONG instrOffset, /* IN */
- CORINFO_SIG_INFO * callSig, /* IN */
- CORINFO_METHOD_HANDLE methodHandle /* IN */
- )
+void interceptor_ICJI::recordCallSite(ULONG instrOffset, /* IN */
+ CORINFO_SIG_INFO* callSig, /* IN */
+ CORINFO_METHOD_HANDLE methodHandle /* IN */
+ )
{
mc->cr->AddCall("recordCallSite");
original_ICorJitInfo->recordCallSite(instrOffset, callSig, methodHandle);
@@ -2256,20 +2000,19 @@ void interceptor_ICJI::recordCallSite(
// A relocation is recorded if we are pre-jitting.
// A jump thunk may be inserted if we are jitting
-void interceptor_ICJI::recordRelocation(
- void *location, /* IN */
- void *target, /* IN */
- WORD fRelocType, /* IN */
- WORD slotNum, /* IN */
- INT32 addlDelta /* IN */
- )
+void interceptor_ICJI::recordRelocation(void* location, /* IN */
+ void* target, /* IN */
+ WORD fRelocType, /* IN */
+ WORD slotNum, /* IN */
+ INT32 addlDelta /* IN */
+ )
{
mc->cr->AddCall("recordRelocation");
original_ICorJitInfo->recordRelocation(location, target, fRelocType, slotNum, addlDelta);
mc->cr->recRecordRelocation(location, target, fRelocType, slotNum, addlDelta);
}
-WORD interceptor_ICJI::getRelocTypeHint(void *target)
+WORD interceptor_ICJI::getRelocTypeHint(void* target)
{
mc->cr->AddCall("getRelocTypeHint");
WORD result = original_ICorJitInfo->getRelocTypeHint(target);
@@ -2280,10 +2023,9 @@ WORD interceptor_ICJI::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 interceptor_ICJI::getModuleNativeEntryPointRange(
- void **pStart, /* OUT */
- void **pEnd /* OUT */
- )
+void interceptor_ICJI::getModuleNativeEntryPointRange(void** pStart, /* OUT */
+ void** pEnd /* OUT */
+ )
{
mc->cr->AddCall("getModuleNativeEntryPointRange");
original_ICorJitInfo->getModuleNativeEntryPointRange(pStart, pEnd);
diff --git a/src/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.h b/src/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.h
index 08d7643613..b582866a89 100644
--- a/src/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.h
+++ b/src/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.h
@@ -16,15 +16,13 @@ class interceptor_ICJI : public ICorJitInfo
#include "icorjitinfoimpl.h"
private:
-
void makeFatMC_ClassHandle(CORINFO_CLASS_HANDLE cls, bool getAttribs);
public:
-
- //Added to help us track the original icji and be able to easily indirect
- //to it. And a simple way to keep one memory manager instance per instance.
- ICorJitInfo *original_ICorJitInfo;
- MethodContext *mc;
+ // Added to help us track the original icji and be able to easily indirect
+ //to it. And a simple way to keep one memory manager instance per instance.
+ ICorJitInfo* original_ICorJitInfo;
+ MethodContext* mc;
};
#endif
diff --git a/src/ToolBox/superpmi/superpmi-shim-collector/ieememorymanager.cpp b/src/ToolBox/superpmi/superpmi-shim-collector/ieememorymanager.cpp
index e0021244cd..3bd9e7e5d4 100644
--- a/src/ToolBox/superpmi/superpmi-shim-collector/ieememorymanager.cpp
+++ b/src/ToolBox/superpmi/superpmi-shim-collector/ieememorymanager.cpp
@@ -10,7 +10,7 @@
//***************************************************************************
// IUnknown methods
//***************************************************************************
-HRESULT STDMETHODCALLTYPE interceptor_IEEMM::QueryInterface(REFIID id, void **pInterface)
+HRESULT STDMETHODCALLTYPE interceptor_IEEMM::QueryInterface(REFIID id, void** pInterface)
{
return original_IEEMM->QueryInterface(id, pInterface);
}
@@ -26,7 +26,10 @@ ULONG STDMETHODCALLTYPE interceptor_IEEMM::Release()
//***************************************************************************
// IEEMemoryManager methods for locking
//***************************************************************************
-LPVOID STDMETHODCALLTYPE interceptor_IEEMM::ClrVirtualAlloc(LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect)
+LPVOID STDMETHODCALLTYPE interceptor_IEEMM::ClrVirtualAlloc(LPVOID lpAddress,
+ SIZE_T dwSize,
+ DWORD flAllocationType,
+ DWORD flProtect)
{
return original_IEEMM->ClrVirtualAlloc(lpAddress, dwSize, flAllocationType, flProtect);
}
@@ -34,11 +37,16 @@ BOOL STDMETHODCALLTYPE interceptor_IEEMM::ClrVirtualFree(LPVOID lpAddress, SIZE_
{
return original_IEEMM->ClrVirtualFree(lpAddress, dwSize, dwFreeType);
}
-SIZE_T STDMETHODCALLTYPE interceptor_IEEMM::ClrVirtualQuery(LPCVOID lpAddress, PMEMORY_BASIC_INFORMATION lpBuffer, SIZE_T dwLength)
+SIZE_T STDMETHODCALLTYPE interceptor_IEEMM::ClrVirtualQuery(LPCVOID lpAddress,
+ PMEMORY_BASIC_INFORMATION lpBuffer,
+ SIZE_T dwLength)
{
return original_IEEMM->ClrVirtualQuery(lpAddress, lpBuffer, dwLength);
}
-BOOL STDMETHODCALLTYPE interceptor_IEEMM::ClrVirtualProtect(LPVOID lpAddress, SIZE_T dwSize, DWORD flNewProtect, PDWORD lpflOldProtect)
+BOOL STDMETHODCALLTYPE interceptor_IEEMM::ClrVirtualProtect(LPVOID lpAddress,
+ SIZE_T dwSize,
+ DWORD flNewProtect,
+ PDWORD lpflOldProtect)
{
return original_IEEMM->ClrVirtualProtect(lpAddress, dwSize, flNewProtect, lpflOldProtect);
}
diff --git a/src/ToolBox/superpmi/superpmi-shim-collector/ieememorymanager.h b/src/ToolBox/superpmi/superpmi-shim-collector/ieememorymanager.h
index 4855d383b5..55fb3733a4 100644
--- a/src/ToolBox/superpmi/superpmi-shim-collector/ieememorymanager.h
+++ b/src/ToolBox/superpmi/superpmi-shim-collector/ieememorymanager.h
@@ -11,14 +11,15 @@
class interceptor_IEEMM : public IEEMemoryManager
{
public:
- interceptor_IEEMM()
- : original_IEEMM(nullptr)
- { }
+ interceptor_IEEMM() : original_IEEMM(nullptr)
+ {
+ }
+
private:
//***************************************************************************
// IUnknown methods
//***************************************************************************
- HRESULT STDMETHODCALLTYPE QueryInterface(REFIID id, void **pInterface);
+ HRESULT STDMETHODCALLTYPE QueryInterface(REFIID id, void** pInterface);
ULONG STDMETHODCALLTYPE AddRef();
ULONG STDMETHODCALLTYPE Release();
@@ -28,7 +29,10 @@ private:
LPVOID STDMETHODCALLTYPE ClrVirtualAlloc(LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect);
BOOL STDMETHODCALLTYPE ClrVirtualFree(LPVOID lpAddress, SIZE_T dwSize, DWORD dwFreeType);
SIZE_T STDMETHODCALLTYPE ClrVirtualQuery(LPCVOID lpAddress, PMEMORY_BASIC_INFORMATION lpBuffer, SIZE_T dwLength);
- BOOL STDMETHODCALLTYPE ClrVirtualProtect(LPVOID lpAddress, SIZE_T dwSize, DWORD flNewProtect, PDWORD lpflOldProtect);
+ BOOL STDMETHODCALLTYPE ClrVirtualProtect(LPVOID lpAddress,
+ SIZE_T dwSize,
+ DWORD flNewProtect,
+ PDWORD lpflOldProtect);
HANDLE STDMETHODCALLTYPE ClrGetProcessHeap();
HANDLE STDMETHODCALLTYPE ClrHeapCreate(DWORD flOptions, SIZE_T dwInitialSize, SIZE_T dwMaximumSize);
BOOL STDMETHODCALLTYPE ClrHeapDestroy(HANDLE hHeap);
@@ -38,6 +42,6 @@ private:
HANDLE STDMETHODCALLTYPE ClrGetProcessExecutableHeap();
public:
- IEEMemoryManager *original_IEEMM;
+ IEEMemoryManager* original_IEEMM;
};
#endif
diff --git a/src/ToolBox/superpmi/superpmi-shim-collector/iexecutionengine.cpp b/src/ToolBox/superpmi/superpmi-shim-collector/iexecutionengine.cpp
index 6bdde6ec8b..6409e4f24f 100644
--- a/src/ToolBox/superpmi/superpmi-shim-collector/iexecutionengine.cpp
+++ b/src/ToolBox/superpmi/superpmi-shim-collector/iexecutionengine.cpp
@@ -14,7 +14,7 @@
//***************************************************************************
// IUnknown methods
//***************************************************************************
-HRESULT STDMETHODCALLTYPE interceptor_IEE::QueryInterface(REFIID id, void **pInterface)
+HRESULT STDMETHODCALLTYPE interceptor_IEE::QueryInterface(REFIID id, void** pInterface)
{
return original_IEE->QueryInterface(id, pInterface);
}
@@ -31,7 +31,7 @@ ULONG STDMETHODCALLTYPE interceptor_IEE::Release()
// IExecutionEngine methods for TLS
//***************************************************************************
// Associate a callback for cleanup with a TLS slot
-VOID STDMETHODCALLTYPE interceptor_IEE::TLS_AssociateCallback(DWORD slot, PTLS_CALLBACK_FUNCTION callback)
+VOID STDMETHODCALLTYPE interceptor_IEE::TLS_AssociateCallback(DWORD slot, PTLS_CALLBACK_FUNCTION callback)
{
original_IEE->TLS_AssociateCallback(slot, callback);
}
@@ -46,7 +46,7 @@ LPVOID STDMETHODCALLTYPE interceptor_IEE::TLS_GetValue(DWORD slot)
return original_IEE->TLS_GetValue(slot);
}
// Get the value at a slot, return FALSE if TLS info block doesn't exist
-BOOL STDMETHODCALLTYPE interceptor_IEE::TLS_CheckValue(DWORD slot, LPVOID *pValue)
+BOOL STDMETHODCALLTYPE interceptor_IEE::TLS_CheckValue(DWORD slot, LPVOID* pValue)
{
return original_IEE->TLS_CheckValue(slot, pValue);
}
@@ -116,15 +116,21 @@ void STDMETHODCALLTYPE interceptor_IEE::ClrCloseSemaphore(SEMAPHORE_COOKIE semap
{
original_IEE->ClrCloseSemaphore(semaphore);
}
-DWORD STDMETHODCALLTYPE interceptor_IEE::ClrWaitForSemaphore(SEMAPHORE_COOKIE semaphore, DWORD dwMilliseconds, BOOL bAlertable)
+DWORD STDMETHODCALLTYPE interceptor_IEE::ClrWaitForSemaphore(SEMAPHORE_COOKIE semaphore,
+ DWORD dwMilliseconds,
+ BOOL bAlertable)
{
return original_IEE->ClrWaitForSemaphore(semaphore, dwMilliseconds, bAlertable);
}
-BOOL STDMETHODCALLTYPE interceptor_IEE::ClrReleaseSemaphore(SEMAPHORE_COOKIE semaphore, LONG lReleaseCount, LONG *lpPreviousCount)
+BOOL STDMETHODCALLTYPE interceptor_IEE::ClrReleaseSemaphore(SEMAPHORE_COOKIE semaphore,
+ LONG lReleaseCount,
+ LONG* lpPreviousCount)
{
return original_IEE->ClrReleaseSemaphore(semaphore, lReleaseCount, lpPreviousCount);
}
-MUTEX_COOKIE STDMETHODCALLTYPE interceptor_IEE::ClrCreateMutex(LPSECURITY_ATTRIBUTES lpMutexAttributes, BOOL bInitialOwner, LPCTSTR lpName)
+MUTEX_COOKIE STDMETHODCALLTYPE interceptor_IEE::ClrCreateMutex(LPSECURITY_ATTRIBUTES lpMutexAttributes,
+ BOOL bInitialOwner,
+ LPCTSTR lpName)
{
return original_IEE->ClrCreateMutex(lpMutexAttributes, bInitialOwner, lpName);
}
@@ -148,7 +154,7 @@ BOOL STDMETHODCALLTYPE interceptor_IEE::ClrAllocationDisallowed()
{
return original_IEE->ClrAllocationDisallowed();
}
-void STDMETHODCALLTYPE interceptor_IEE::GetLastThrownObjectExceptionFromThread(void **ppvException)
+void STDMETHODCALLTYPE interceptor_IEE::GetLastThrownObjectExceptionFromThread(void** ppvException)
{
original_IEE->GetLastThrownObjectExceptionFromThread(ppvException);
}
diff --git a/src/ToolBox/superpmi/superpmi-shim-collector/iexecutionengine.h b/src/ToolBox/superpmi/superpmi-shim-collector/iexecutionengine.h
index 49c247ff99..69f9679af4 100644
--- a/src/ToolBox/superpmi/superpmi-shim-collector/iexecutionengine.h
+++ b/src/ToolBox/superpmi/superpmi-shim-collector/iexecutionengine.h
@@ -17,7 +17,7 @@ private:
//***************************************************************************
// IUnknown methods
//***************************************************************************
- HRESULT STDMETHODCALLTYPE QueryInterface(REFIID id, void **pInterface);
+ HRESULT STDMETHODCALLTYPE QueryInterface(REFIID id, void** pInterface);
ULONG STDMETHODCALLTYPE AddRef();
ULONG STDMETHODCALLTYPE Release();
@@ -25,13 +25,13 @@ private:
// IExecutionEngine methods for TLS
//***************************************************************************
// Associate a callback for cleanup with a TLS slot
- VOID STDMETHODCALLTYPE TLS_AssociateCallback(DWORD slot, PTLS_CALLBACK_FUNCTION callback);
+ VOID STDMETHODCALLTYPE TLS_AssociateCallback(DWORD slot, PTLS_CALLBACK_FUNCTION callback);
// Get the TLS block for fast Get/Set operations
LPVOID* STDMETHODCALLTYPE TLS_GetDataBlock();
// Get the value at a slot
LPVOID STDMETHODCALLTYPE TLS_GetValue(DWORD slot);
// Get the value at a slot, return FALSE if TLS info block doesn't exist
- BOOL STDMETHODCALLTYPE TLS_CheckValue(DWORD slot, LPVOID *pValue);
+ BOOL STDMETHODCALLTYPE TLS_CheckValue(DWORD slot, LPVOID* pValue);
// Set the value at a slot
VOID STDMETHODCALLTYPE TLS_SetValue(DWORD slot, LPVOID pData);
// Free TLS memory block and make callback
@@ -54,17 +54,20 @@ private:
SEMAPHORE_COOKIE STDMETHODCALLTYPE ClrCreateSemaphore(DWORD dwInitial, DWORD dwMax);
void STDMETHODCALLTYPE ClrCloseSemaphore(SEMAPHORE_COOKIE semaphore);
DWORD STDMETHODCALLTYPE ClrWaitForSemaphore(SEMAPHORE_COOKIE semaphore, DWORD dwMilliseconds, BOOL bAlertable);
- BOOL STDMETHODCALLTYPE ClrReleaseSemaphore(SEMAPHORE_COOKIE semaphore, LONG lReleaseCount, LONG *lpPreviousCount);
- MUTEX_COOKIE STDMETHODCALLTYPE ClrCreateMutex(LPSECURITY_ATTRIBUTES lpMutexAttributes, BOOL bInitialOwner, LPCTSTR lpName);
+ BOOL STDMETHODCALLTYPE ClrReleaseSemaphore(SEMAPHORE_COOKIE semaphore, LONG lReleaseCount, LONG* lpPreviousCount);
+ MUTEX_COOKIE STDMETHODCALLTYPE ClrCreateMutex(LPSECURITY_ATTRIBUTES lpMutexAttributes,
+ BOOL bInitialOwner,
+ LPCTSTR lpName);
void STDMETHODCALLTYPE ClrCloseMutex(MUTEX_COOKIE mutex);
BOOL STDMETHODCALLTYPE ClrReleaseMutex(MUTEX_COOKIE mutex);
DWORD STDMETHODCALLTYPE ClrWaitForMutex(MUTEX_COOKIE mutex, DWORD dwMilliseconds, BOOL bAlertable);
DWORD STDMETHODCALLTYPE ClrSleepEx(DWORD dwMilliseconds, BOOL bAlertable);
BOOL STDMETHODCALLTYPE ClrAllocationDisallowed();
- void STDMETHODCALLTYPE GetLastThrownObjectExceptionFromThread(void **ppvException);
+ void STDMETHODCALLTYPE GetLastThrownObjectExceptionFromThread(void** ppvException);
public:
- IExecutionEngine *original_IEE; //Our extra value that holds a pointer to the original IEE we'll pass calls along to
+ IExecutionEngine* original_IEE; // Our extra value that holds a pointer to the original IEE we'll pass calls along
+ // to
};
#endif \ No newline at end of file
diff --git a/src/ToolBox/superpmi/superpmi-shim-collector/jithost.cpp b/src/ToolBox/superpmi/superpmi-shim-collector/jithost.cpp
index 5e63a76be7..fd5c46aeee 100644
--- a/src/ToolBox/superpmi/superpmi-shim-collector/jithost.cpp
+++ b/src/ToolBox/superpmi/superpmi-shim-collector/jithost.cpp
@@ -47,7 +47,7 @@ int JitHost::getIntConfigValue(const wchar_t* key, int defaultValue)
const wchar_t* JitHost::getStringConfigValue(const wchar_t* key)
{
mc->cr->AddCall("getStringConfigValue");
- const wchar_t *result = wrappedHost->getStringConfigValue(key);
+ const wchar_t* result = wrappedHost->getStringConfigValue(key);
// Don't store null returns, which is the default
if (result != nullptr)
diff --git a/src/ToolBox/superpmi/superpmi-shim-collector/jithost.h b/src/ToolBox/superpmi/superpmi-shim-collector/jithost.h
index 2950a55682..426520ddf1 100644
--- a/src/ToolBox/superpmi/superpmi-shim-collector/jithost.h
+++ b/src/ToolBox/superpmi/superpmi-shim-collector/jithost.h
@@ -16,7 +16,7 @@ public:
#include "icorjithostimpl.h"
private:
- ICorJitHost* wrappedHost;
+ ICorJitHost* wrappedHost;
MethodContext* mc;
};
diff --git a/src/ToolBox/superpmi/superpmi-shim-collector/superpmi-shim-collector.cpp b/src/ToolBox/superpmi/superpmi-shim-collector/superpmi-shim-collector.cpp
index 1a6d73da0a..c8af7a0c26 100644
--- a/src/ToolBox/superpmi/superpmi-shim-collector/superpmi-shim-collector.cpp
+++ b/src/ToolBox/superpmi/superpmi-shim-collector/superpmi-shim-collector.cpp
@@ -16,18 +16,18 @@
#include "spmiutil.h"
#include "jithost.h"
-//Assumptions:
+// Assumptions:
// -We'll never be unloaded - we leak memory and have no facility to unload libraries
// -printf output to console is okay
-HMODULE g_hRealJit = 0; //We leak this currently (could do the proper shutdown in process_detach)
-WCHAR* g_realJitPath = nullptr; //We leak this (could do the proper shutdown in process_detach)
-WCHAR* g_logPath = nullptr; //Again, we leak this one too...
-WCHAR* g_dataFileName = nullptr; //We leak this
-char* g_logFilePath = nullptr; //We *don't* leak this, hooray!
-WCHAR* g_HomeDirectory = nullptr;
-WCHAR* g_DefaultRealJitPath = nullptr;
-MethodContext* g_globalContext = nullptr;
+HMODULE g_hRealJit = 0; // We leak this currently (could do the proper shutdown in process_detach)
+WCHAR* g_realJitPath = nullptr; // We leak this (could do the proper shutdown in process_detach)
+WCHAR* g_logPath = nullptr; // Again, we leak this one too...
+WCHAR* g_dataFileName = nullptr; // We leak this
+char* g_logFilePath = nullptr; // We *don't* leak this, hooray!
+WCHAR* g_HomeDirectory = nullptr;
+WCHAR* g_DefaultRealJitPath = nullptr;
+MethodContext* g_globalContext = nullptr;
void SetDefaultPaths()
{
@@ -38,7 +38,7 @@ void SetDefaultPaths()
if (g_DefaultRealJitPath == nullptr)
{
- size_t len = wcslen(g_HomeDirectory) + 1 + wcslen(DEFAULT_REAL_JIT_NAME_W) + 1;
+ size_t len = wcslen(g_HomeDirectory) + 1 + wcslen(DEFAULT_REAL_JIT_NAME_W) + 1;
g_DefaultRealJitPath = new WCHAR[len];
wcscpy_s(g_DefaultRealJitPath, len, g_HomeDirectory);
wcscat_s(g_DefaultRealJitPath, len, DIRECTORY_SEPARATOR_STR_W);
@@ -64,30 +64,33 @@ void SetLogPath()
void SetLogPathName()
{
- // NOTE: under PAL, we don't get the comand line, so we depend on the random number generator to give us a unique filename.
- WCHAR *OriginalExecutableName = GetCommandLineW();//TODO-Cleanup: not cool to write to the process view of commandline....
- size_t len = wcslen(OriginalExecutableName);
- WCHAR *ExecutableName = new WCHAR[len+1];
- wcscpy_s(ExecutableName, len+1, OriginalExecutableName);
+ // NOTE: under PAL, we don't get the comand line, so we depend on the random number generator to give us a unique
+ // filename.
+ WCHAR* OriginalExecutableName =
+ GetCommandLineW(); // TODO-Cleanup: not cool to write to the process view of commandline....
+ size_t len = wcslen(OriginalExecutableName);
+ WCHAR* ExecutableName = new WCHAR[len + 1];
+ wcscpy_s(ExecutableName, len + 1, OriginalExecutableName);
ExecutableName[len] = W('\0');
- WCHAR *quote1 = NULL;
+ WCHAR* quote1 = NULL;
- //if there are any quotes in filename convert them to spaces.
+ // if there are any quotes in filename convert them to spaces.
while ((quote1 = wcsstr(ExecutableName, W("\""))) != NULL)
*quote1 = W(' ');
- //remove any illegal or annoying characters from file name by converting them to underscores
+ // remove any illegal or annoying characters from file name by converting them to underscores
while ((quote1 = wcspbrk(ExecutableName, W("=<>:\"/\\|?! *.,"))) != NULL)
*quote1 = W('_');
- const WCHAR *DataFileExtension = W(".mc");
- size_t ExecutableNameLength = wcslen(ExecutableName);
- size_t DataFileExtensionLength = wcslen(DataFileExtension);
- size_t logPathLength = wcslen(g_logPath);
+ const WCHAR* DataFileExtension = W(".mc");
+ size_t ExecutableNameLength = wcslen(ExecutableName);
+ size_t DataFileExtensionLength = wcslen(DataFileExtension);
+ size_t logPathLength = wcslen(g_logPath);
size_t dataFileNameLength = logPathLength + 1 + ExecutableNameLength + 1 + DataFileExtensionLength + 1;
- const size_t MaxAcceptablePathLength = MAX_PATH - 20; // subtract 20 to leave buffer, for possible random number addition
+ const size_t MaxAcceptablePathLength =
+ MAX_PATH - 20; // subtract 20 to leave buffer, for possible random number addition
if (dataFileNameLength >= MaxAcceptablePathLength)
{
// The path name is too long; creating the file will fail. This can happen because we use the command line,
@@ -99,17 +102,17 @@ void SetLogPathName()
dataFileNameLength = MaxAcceptablePathLength;
}
- // Always add a random number, just in case the above doesn't give us a unique filename.
+// Always add a random number, just in case the above doesn't give us a unique filename.
#ifdef FEATURE_PAL
- unsigned __int64 randNumber = 0;
- const size_t RandNumberLength = sizeof(randNumber) * 2 + 1; // 16 hex digits + null
- WCHAR RandNumberString[RandNumberLength];
+ unsigned __int64 randNumber = 0;
+ const size_t RandNumberLength = sizeof(randNumber) * 2 + 1; // 16 hex digits + null
+ WCHAR RandNumberString[RandNumberLength];
PAL_Random(/* bStrong */ FALSE, &randNumber, sizeof(randNumber));
swprintf_s(RandNumberString, RandNumberLength, W("%016llX"), randNumber);
-#else // !FEATURE_PAL
- unsigned int randNumber = 0;
+#else // !FEATURE_PAL
+ unsigned int randNumber = 0;
const size_t RandNumberLength = sizeof(randNumber) * 2 + 1; // 8 hex digits + null
- WCHAR RandNumberString[RandNumberLength];
+ WCHAR RandNumberString[RandNumberLength];
rand_s(&randNumber);
swprintf_s(RandNumberString, RandNumberLength, W("%08X"), randNumber);
#endif // !FEATURE_PAL
@@ -117,7 +120,7 @@ void SetLogPathName()
dataFileNameLength += RandNumberLength - 1;
// Construct the full pathname we're going to use.
- g_dataFileName = new WCHAR[dataFileNameLength];
+ g_dataFileName = new WCHAR[dataFileNameLength];
g_dataFileName[0] = 0;
wcsncat_s(g_dataFileName, dataFileNameLength, g_logPath, logPathLength);
wcsncat_s(g_dataFileName, dataFileNameLength, DIRECTORY_SEPARATOR_STR_W, 1);
@@ -141,52 +144,50 @@ void SetLogFilePath()
}
}
-extern "C"
-BOOL
+extern "C" BOOL
#ifndef FEATURE_PAL
-APIENTRY
+ APIENTRY
#endif // !FEATURE_PAL
-DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
+ DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
switch (ul_reason_for_call)
{
- case DLL_PROCESS_ATTACH:
+ case DLL_PROCESS_ATTACH:
#ifdef FEATURE_PAL
- if (0 != PAL_InitializeDLL())
- {
- fprintf(stderr, "Error: Fail to PAL_InitializeDLL\n");
- exit(1);
- }
+ if (0 != PAL_InitializeDLL())
+ {
+ fprintf(stderr, "Error: Fail to PAL_InitializeDLL\n");
+ exit(1);
+ }
#endif // FEATURE_PAL
- Logger::Initialize();
- SetLogFilePath();
- Logger::OpenLogFile(g_logFilePath);
- break;
+ Logger::Initialize();
+ SetLogFilePath();
+ Logger::OpenLogFile(g_logFilePath);
+ break;
- case DLL_PROCESS_DETACH:
- Logger::Shutdown();
+ case DLL_PROCESS_DETACH:
+ Logger::Shutdown();
- delete[] g_logFilePath;
- g_logFilePath = nullptr;
+ delete[] g_logFilePath;
+ g_logFilePath = nullptr;
- break;
+ break;
- case DLL_THREAD_ATTACH:
- case DLL_THREAD_DETACH:
- break;
+ case DLL_THREAD_ATTACH:
+ case DLL_THREAD_DETACH:
+ break;
}
return TRUE;
}
// Exported via def file
-extern "C"
-void __stdcall jitStartup(ICorJitHost* host)
+extern "C" void __stdcall jitStartup(ICorJitHost* host)
{
SetDefaultPaths();
SetLibName();
- //Load Library
+ // Load Library
if (g_hRealJit == 0)
{
g_hRealJit = ::LoadLibraryW(g_realJitPath);
@@ -206,55 +207,55 @@ void __stdcall jitStartup(ICorJitHost* host)
}
g_globalContext = new MethodContext();
- g_ourJitHost = new JitHost(host, g_globalContext);
+ g_ourJitHost = new JitHost(host, g_globalContext);
pnjitStartup(g_ourJitHost);
}
-//Exported via def file
-extern "C"
-ICorJitCompiler* __stdcall getJit()
+// Exported via def file
+extern "C" ICorJitCompiler* __stdcall getJit()
{
- DWORD dwRetVal = 0;
- PgetJit pngetJit;
- interceptor_ICJC *pJitInstance = nullptr;
- ICorJitCompiler *tICJI = nullptr;
+ DWORD dwRetVal = 0;
+ PgetJit pngetJit;
+ interceptor_ICJC* pJitInstance = nullptr;
+ ICorJitCompiler* tICJI = nullptr;
SetDefaultPaths();
SetLibName();
SetLogPath();
SetLogPathName();
- //Load Library
- if(g_hRealJit == 0)
+ // Load Library
+ if (g_hRealJit == 0)
{
g_hRealJit = ::LoadLibraryW(g_realJitPath);
- if(g_hRealJit == 0)
+ if (g_hRealJit == 0)
{
LogError("getJit() - LoadLibrary failed to load '%ws' (0x%08x)", g_realJitPath, ::GetLastError());
return nullptr;
}
}
- //get the required entrypoints
+ // get the required entrypoints
pngetJit = (PgetJit)::GetProcAddress(g_hRealJit, "getJit");
- if(pngetJit == 0)
+ if (pngetJit == 0)
{
LogError("getJit() - GetProcAddress 'getJit' failed (0x%08x)", ::GetLastError());
return nullptr;
}
tICJI = pngetJit();
- if(tICJI == nullptr)
+ if (tICJI == nullptr)
{
LogError("getJit() - pngetJit gave us null");
return nullptr;
}
- pJitInstance = new interceptor_ICJC();
+ pJitInstance = new interceptor_ICJC();
pJitInstance->original_ICorJitCompiler = tICJI;
- //create our datafile
- pJitInstance->hFile = CreateFileW(g_dataFileName, GENERIC_READ|GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL|FILE_FLAG_SEQUENTIAL_SCAN, NULL);
+ // create our datafile
+ pJitInstance->hFile = CreateFileW(g_dataFileName, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
+ FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
if (pJitInstance->hFile == INVALID_HANDLE_VALUE)
{
LogError("Couldn't open file '%ws': error %d", g_dataFileName, GetLastError());
@@ -263,42 +264,41 @@ ICorJitCompiler* __stdcall getJit()
return pJitInstance;
}
-//Exported via def file
-extern "C"
-void __stdcall sxsJitStartup(CoreClrCallbacks const & original_cccallbacks)
+// Exported via def file
+extern "C" void __stdcall sxsJitStartup(CoreClrCallbacks const& original_cccallbacks)
{
PsxsJitStartup pnsxsJitStartup;
SetDefaultPaths();
SetLibName();
- //Load Library
- if(g_hRealJit == 0)
+ // Load Library
+ if (g_hRealJit == 0)
{
g_hRealJit = ::LoadLibraryW(g_realJitPath);
- if(g_hRealJit == 0)
+ if (g_hRealJit == 0)
{
LogError("sxsJitStartup() - LoadLibrary failed to load '%ws' (0x%08x)", g_realJitPath, ::GetLastError());
return;
}
}
- //get entry point
+ // get entry point
pnsxsJitStartup = (PsxsJitStartup)::GetProcAddress(g_hRealJit, "sxsJitStartup");
- if(pnsxsJitStartup == 0)
+ if (pnsxsJitStartup == 0)
{
LogError("sxsJitStartup() - GetProcAddress 'sxsJitStartup' failed (0x%08x)", ::GetLastError());
return;
}
- //Setup CoreClrCallbacks and call sxsJitStartup
- original_CoreClrCallbacks = new CoreClrCallbacks();
+ // Setup CoreClrCallbacks and call sxsJitStartup
+ original_CoreClrCallbacks = new CoreClrCallbacks();
original_CoreClrCallbacks->m_hmodCoreCLR = original_cccallbacks.m_hmodCoreCLR;
original_CoreClrCallbacks->m_pfnIEE = original_cccallbacks.m_pfnIEE;
original_CoreClrCallbacks->m_pfnGetCORSystemDirectory = original_cccallbacks.m_pfnGetCORSystemDirectory;
original_CoreClrCallbacks->m_pfnGetCLRFunction = original_cccallbacks.m_pfnGetCLRFunction;
- CoreClrCallbacks *temp = new CoreClrCallbacks();
+ CoreClrCallbacks* temp = new CoreClrCallbacks();
temp->m_hmodCoreCLR = original_cccallbacks.m_hmodCoreCLR;
temp->m_pfnIEE = IEE_t;
diff --git a/src/ToolBox/superpmi/superpmi-shim-counter/coreclrcallbacks.cpp b/src/ToolBox/superpmi/superpmi-shim-counter/coreclrcallbacks.cpp
index 5b764f2fa5..14a55b5d79 100644
--- a/src/ToolBox/superpmi/superpmi-shim-counter/coreclrcallbacks.cpp
+++ b/src/ToolBox/superpmi/superpmi-shim-counter/coreclrcallbacks.cpp
@@ -7,17 +7,14 @@
#include "coreclrcallbacks.h"
#include "iexecutionengine.h"
-typedef LPVOID (__stdcall * pfnEEHeapAllocInProcessHeap)(DWORD dwFlags, SIZE_T dwBytes);
-typedef BOOL (__stdcall * pfnEEHeapFreeInProcessHeap)(DWORD dwFlags, LPVOID lpMem);
-
-CoreClrCallbacks *original_CoreClrCallbacks = nullptr;
+CoreClrCallbacks* original_CoreClrCallbacks = nullptr;
pfnEEHeapAllocInProcessHeap original_EEHeapAllocInProcessHeap = nullptr;
-pfnEEHeapFreeInProcessHeap original_EEHeapFreeInProcessHeap = nullptr;
+pfnEEHeapFreeInProcessHeap original_EEHeapFreeInProcessHeap = nullptr;
-IExecutionEngine* STDMETHODCALLTYPE IEE_t()
+IExecutionEngine* IEE_t()
{
- interceptor_IEE *iee = new interceptor_IEE();
- iee->original_IEE = original_CoreClrCallbacks->m_pfnIEE();
+ interceptor_IEE* iee = new interceptor_IEE();
+ iee->original_IEE = original_CoreClrCallbacks->m_pfnIEE();
return iee;
}
@@ -29,29 +26,29 @@ HRESULT STDMETHODCALLTYPE GetCORSystemDirectory(LPWSTR pbuffer, DWORD cchBuffer,
}
*/
-LPVOID STDMETHODCALLTYPE EEHeapAllocInProcessHeap (DWORD dwFlags, SIZE_T dwBytes)
+LPVOID EEHeapAllocInProcessHeap(DWORD dwFlags, SIZE_T dwBytes)
{
- if(original_EEHeapAllocInProcessHeap == nullptr)
+ if (original_EEHeapAllocInProcessHeap == nullptr)
__debugbreak();
return original_EEHeapAllocInProcessHeap(dwFlags, dwBytes);
}
-BOOL STDMETHODCALLTYPE EEHeapFreeInProcessHeap (DWORD dwFlags, LPVOID lpMem)
+BOOL EEHeapFreeInProcessHeap(DWORD dwFlags, LPVOID lpMem)
{
- if(original_EEHeapFreeInProcessHeap == nullptr)
+ if (original_EEHeapFreeInProcessHeap == nullptr)
__debugbreak();
return original_EEHeapFreeInProcessHeap(dwFlags, lpMem);
}
-void* STDMETHODCALLTYPE GetCLRFunction(LPCSTR functionName)
+void* GetCLRFunction(LPCSTR functionName)
{
- if(strcmp(functionName, "EEHeapAllocInProcessHeap")==0)
+ if (strcmp(functionName, "EEHeapAllocInProcessHeap") == 0)
{
original_EEHeapAllocInProcessHeap =
(pfnEEHeapAllocInProcessHeap)original_CoreClrCallbacks->m_pfnGetCLRFunction("EEHeapAllocInProcessHeap");
return (void*)EEHeapAllocInProcessHeap;
}
- if(strcmp(functionName, "EEHeapFreeInProcessHeap")==0)
+ if (strcmp(functionName, "EEHeapFreeInProcessHeap") == 0)
{
original_EEHeapFreeInProcessHeap =
(pfnEEHeapFreeInProcessHeap)original_CoreClrCallbacks->m_pfnGetCLRFunction("EEHeapFreeInProcessHeap");
@@ -59,4 +56,3 @@ void* STDMETHODCALLTYPE GetCLRFunction(LPCSTR functionName)
}
return original_CoreClrCallbacks->m_pfnGetCLRFunction(functionName);
}
-
diff --git a/src/ToolBox/superpmi/superpmi-shim-counter/coreclrcallbacks.h b/src/ToolBox/superpmi/superpmi-shim-counter/coreclrcallbacks.h
index c8c3e27c66..a5257422cd 100644
--- a/src/ToolBox/superpmi/superpmi-shim-counter/coreclrcallbacks.h
+++ b/src/ToolBox/superpmi/superpmi-shim-counter/coreclrcallbacks.h
@@ -6,14 +6,8 @@
#ifndef _CoreClrCallbacks
#define _CoreClrCallbacks
-#include "runtimedetails.h"
+#include "coreclrcommoncallbacks.h"
-IExecutionEngine* STDMETHODCALLTYPE IEE_t();
-HRESULT STDMETHODCALLTYPE GetCORSystemDirectory(LPWSTR pbuffer, DWORD cchBuffer, DWORD* pdwlength);
-LPVOID STDMETHODCALLTYPE EEHeapAllocInProcessHeap (DWORD dwFlags, SIZE_T dwBytes);
-BOOL STDMETHODCALLTYPE EEHeapFreeInProcessHeap (DWORD dwFlags, LPVOID lpMem);
-void* STDMETHODCALLTYPE GetCLRFunction(LPCSTR functionName);
+extern CoreClrCallbacks* original_CoreClrCallbacks;
-extern CoreClrCallbacks *original_CoreClrCallbacks;
-
-#endif \ No newline at end of file
+#endif
diff --git a/src/ToolBox/superpmi/superpmi-shim-counter/icorjitcompiler.cpp b/src/ToolBox/superpmi/superpmi-shim-counter/icorjitcompiler.cpp
index 2e088d438c..e0121c34e9 100644
--- a/src/ToolBox/superpmi/superpmi-shim-counter/icorjitcompiler.cpp
+++ b/src/ToolBox/superpmi/superpmi-shim-counter/icorjitcompiler.cpp
@@ -7,25 +7,25 @@
#include "icorjitcompiler.h"
#include "icorjitinfo.h"
-interceptor_IEEMM *current_IEEMM = nullptr; //we want this to live beyond the scope of a single compileMethodCall
+interceptor_IEEMM* current_IEEMM = nullptr; // we want this to live beyond the scope of a single compileMethodCall
-CorJitResult __stdcall interceptor_ICJC::compileMethod (
- ICorJitInfo *comp, /* IN */
- struct CORINFO_METHOD_INFO *info, /* IN */
- unsigned /* code:CorJitFlag */ flags, /* IN */
- BYTE **nativeEntry, /* OUT */
- ULONG *nativeSizeOfCode /* OUT */
- )
+CorJitResult __stdcall interceptor_ICJC::compileMethod(ICorJitInfo* comp, /* IN */
+ struct CORINFO_METHOD_INFO* info, /* IN */
+ unsigned /* code:CorJitFlag */ flags, /* IN */
+ BYTE** nativeEntry, /* OUT */
+ ULONG* nativeSizeOfCode /* OUT */
+ )
{
interceptor_ICJI our_ICorJitInfo;
our_ICorJitInfo.original_ICorJitInfo = comp;
- if(current_IEEMM == nullptr)
- current_IEEMM = new interceptor_IEEMM();
+ if (current_IEEMM == nullptr)
+ current_IEEMM = new interceptor_IEEMM();
our_ICorJitInfo.mcs = mcs;
mcs->AddCall("compileMethod");
- CorJitResult temp = original_ICorJitCompiler->compileMethod(&our_ICorJitInfo, info, flags, nativeEntry, nativeSizeOfCode);
+ CorJitResult temp =
+ original_ICorJitCompiler->compileMethod(&our_ICorJitInfo, info, flags, nativeEntry, nativeSizeOfCode);
mcs->SaveTextFile();
return temp;
diff --git a/src/ToolBox/superpmi/superpmi-shim-counter/icorjitcompiler.h b/src/ToolBox/superpmi/superpmi-shim-counter/icorjitcompiler.h
index 1abcd0a77b..5ce4e6324f 100644
--- a/src/ToolBox/superpmi/superpmi-shim-counter/icorjitcompiler.h
+++ b/src/ToolBox/superpmi/superpmi-shim-counter/icorjitcompiler.h
@@ -17,10 +17,10 @@ class interceptor_ICJC : public ICorJitCompiler
public:
// Added to help us track the original icjc and be able to easily indirect to it.
- ICorJitCompiler *original_ICorJitCompiler;
- MethodCallSummarizer *mcs;
+ ICorJitCompiler* original_ICorJitCompiler;
+ MethodCallSummarizer* mcs;
};
-extern interceptor_IEEMM *current_IEEMM; //we want this to live beyond the scope of a single compileMethodCall
+extern interceptor_IEEMM* current_IEEMM; // we want this to live beyond the scope of a single compileMethodCall
#endif
diff --git a/src/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.cpp b/src/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.cpp
index 492d08908d..1d45229655 100644
--- a/src/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.cpp
+++ b/src/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.cpp
@@ -10,56 +10,52 @@
#include "icorjitcompiler.h"
#include "spmiutil.h"
-//Stuff on ICorStaticInfo
+// Stuff on ICorStaticInfo
/**********************************************************************************/
//
// ICorMethodInfo
//
/**********************************************************************************/
// return flags (defined above, CORINFO_FLG_PUBLIC ...)
-DWORD interceptor_ICJI::getMethodAttribs (CORINFO_METHOD_HANDLE ftn /* IN */)
+DWORD interceptor_ICJI::getMethodAttribs(CORINFO_METHOD_HANDLE ftn /* IN */)
{
mcs->AddCall("getMethodAttribs");
return original_ICorJitInfo->getMethodAttribs(ftn);
}
// sets private JIT flags, which can be, retrieved using getAttrib.
-void interceptor_ICJI::setMethodAttribs (CORINFO_METHOD_HANDLE ftn,/* IN */
- CorInfoMethodRuntimeFlags attribs/* IN */)
+void interceptor_ICJI::setMethodAttribs(CORINFO_METHOD_HANDLE ftn, /* IN */
+ CorInfoMethodRuntimeFlags attribs /* IN */)
{
mcs->AddCall("setMethodAttribs");
original_ICorJitInfo->setMethodAttribs(ftn, attribs);
}
-
// 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 interceptor_ICJI::getMethodSig (
- CORINFO_METHOD_HANDLE ftn, /* IN */
- CORINFO_SIG_INFO *sig, /* OUT */
- CORINFO_CLASS_HANDLE memberParent/* IN */
- )
+void interceptor_ICJI::getMethodSig(CORINFO_METHOD_HANDLE ftn, /* IN */
+ CORINFO_SIG_INFO* sig, /* OUT */
+ CORINFO_CLASS_HANDLE memberParent /* IN */
+ )
{
mcs->AddCall("getMethodSig");
original_ICorJitInfo->getMethodSig(ftn, sig, memberParent);
}
+/*********************************************************************
+* 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
+*********************************************************************/
- /*********************************************************************
- * 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 interceptor_ICJI::getMethodInfo (
- CORINFO_METHOD_HANDLE ftn, /* IN */
- CORINFO_METHOD_INFO* info /* OUT */
- )
+// 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 interceptor_ICJI::getMethodInfo(CORINFO_METHOD_HANDLE ftn, /* IN */
+ CORINFO_METHOD_INFO* info /* OUT */
+ )
{
mcs->AddCall("getMethodInfo");
return original_ICorJitInfo->getMethodInfo(ftn, info);
@@ -74,11 +70,10 @@ void interceptor_ICJI::getMethodSig (
//
// The inlined method need not be verified
-CorInfoInline interceptor_ICJI::canInline (
- CORINFO_METHOD_HANDLE callerHnd, /* IN */
- CORINFO_METHOD_HANDLE calleeHnd, /* IN */
- DWORD* pRestrictions /* OUT */
- )
+CorInfoInline interceptor_ICJI::canInline(CORINFO_METHOD_HANDLE callerHnd, /* IN */
+ CORINFO_METHOD_HANDLE calleeHnd, /* IN */
+ DWORD* pRestrictions /* OUT */
+ )
{
mcs->AddCall("canInline");
return original_ICorJitInfo->canInline(callerHnd, calleeHnd, pRestrictions);
@@ -87,25 +82,23 @@ CorInfoInline interceptor_ICJI::canInline (
// 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 interceptor_ICJI::reportInliningDecision (CORINFO_METHOD_HANDLE inlinerHnd,
- CORINFO_METHOD_HANDLE inlineeHnd,
- CorInfoInline inlineResult,
- const char * reason)
+void interceptor_ICJI::reportInliningDecision(CORINFO_METHOD_HANDLE inlinerHnd,
+ CORINFO_METHOD_HANDLE inlineeHnd,
+ CorInfoInline inlineResult,
+ const char* reason)
{
mcs->AddCall("reportInliningDecision");
original_ICorJitInfo->reportInliningDecision(inlinerHnd, inlineeHnd, inlineResult, 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 interceptor_ICJI::canTailCall (
- CORINFO_METHOD_HANDLE callerHnd, /* IN */
- CORINFO_METHOD_HANDLE declaredCalleeHnd, /* IN */
- CORINFO_METHOD_HANDLE exactCalleeHnd, /* IN */
- bool fIsTailPrefix /* IN */
- )
+bool interceptor_ICJI::canTailCall(CORINFO_METHOD_HANDLE callerHnd, /* IN */
+ CORINFO_METHOD_HANDLE declaredCalleeHnd, /* IN */
+ CORINFO_METHOD_HANDLE exactCalleeHnd, /* IN */
+ bool fIsTailPrefix /* IN */
+ )
{
mcs->AddCall("canTailCall");
return original_ICorJitInfo->canTailCall(callerHnd, declaredCalleeHnd, exactCalleeHnd, fIsTailPrefix);
@@ -114,40 +107,35 @@ bool interceptor_ICJI::canTailCall (
// 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 interceptor_ICJI::reportTailCallDecision (CORINFO_METHOD_HANDLE callerHnd,
- CORINFO_METHOD_HANDLE calleeHnd,
- bool fIsTailPrefix,
- CorInfoTailCall tailCallResult,
- const char * reason)
+void interceptor_ICJI::reportTailCallDecision(CORINFO_METHOD_HANDLE callerHnd,
+ CORINFO_METHOD_HANDLE calleeHnd,
+ bool fIsTailPrefix,
+ CorInfoTailCall tailCallResult,
+ const char* reason)
{
mcs->AddCall("reportTailCallDecision");
original_ICorJitInfo->reportTailCallDecision(callerHnd, calleeHnd, fIsTailPrefix, tailCallResult, reason);
}
// get individual exception handler
-void interceptor_ICJI::getEHinfo(
- CORINFO_METHOD_HANDLE ftn, /* IN */
- unsigned EHnumber, /* IN */
- CORINFO_EH_CLAUSE* clause /* OUT */
- )
+void interceptor_ICJI::getEHinfo(CORINFO_METHOD_HANDLE ftn, /* IN */
+ unsigned EHnumber, /* IN */
+ CORINFO_EH_CLAUSE* clause /* OUT */
+ )
{
mcs->AddCall("getEHinfo");
original_ICorJitInfo->getEHinfo(ftn, EHnumber, clause);
}
// return class it belongs to
-CORINFO_CLASS_HANDLE interceptor_ICJI::getMethodClass (
- CORINFO_METHOD_HANDLE method
- )
+CORINFO_CLASS_HANDLE interceptor_ICJI::getMethodClass(CORINFO_METHOD_HANDLE method)
{
mcs->AddCall("getMethodClass");
return original_ICorJitInfo->getMethodClass(method);
}
// return module it belongs to
-CORINFO_MODULE_HANDLE interceptor_ICJI::getMethodModule (
- CORINFO_METHOD_HANDLE method
- )
+CORINFO_MODULE_HANDLE interceptor_ICJI::getMethodModule(CORINFO_METHOD_HANDLE method)
{
mcs->AddCall("getMethodModule");
return original_ICorJitInfo->getMethodModule(method);
@@ -155,11 +143,10 @@ CORINFO_MODULE_HANDLE interceptor_ICJI::getMethodModule (
// This function returns the offset of the specified method in the
// vtable of it's owning class or interface.
-void interceptor_ICJI::getMethodVTableOffset (
- CORINFO_METHOD_HANDLE method, /* IN */
- unsigned* offsetOfIndirection, /* OUT */
- unsigned* offsetAfterIndirection /* OUT */
- )
+void interceptor_ICJI::getMethodVTableOffset(CORINFO_METHOD_HANDLE method, /* IN */
+ unsigned* offsetOfIndirection, /* OUT */
+ unsigned* offsetAfterIndirection /* OUT */
+ )
{
mcs->AddCall("getMethodVTableOffset");
original_ICorJitInfo->getMethodVTableOffset(method, offsetOfIndirection, offsetAfterIndirection);
@@ -167,11 +154,9 @@ void interceptor_ICJI::getMethodVTableOffset (
// Find the virtual method in implementingClass that overrides virtualMethod.
// Return null if devirtualization is not possible.
-CORINFO_METHOD_HANDLE interceptor_ICJI::resolveVirtualMethod(
- CORINFO_METHOD_HANDLE virtualMethod,
- CORINFO_CLASS_HANDLE implementingClass,
- CORINFO_CONTEXT_HANDLE ownerType
- )
+CORINFO_METHOD_HANDLE interceptor_ICJI::resolveVirtualMethod(CORINFO_METHOD_HANDLE virtualMethod,
+ CORINFO_CLASS_HANDLE implementingClass,
+ CORINFO_CONTEXT_HANDLE ownerType)
{
mcs->AddCall("resolveVirtualMethod");
return original_ICorJitInfo->resolveVirtualMethod(virtualMethod, implementingClass, ownerType);
@@ -179,28 +164,22 @@ CORINFO_METHOD_HANDLE interceptor_ICJI::resolveVirtualMethod(
// If a method's attributes have (getMethodAttribs) CORINFO_FLG_INTRINSIC set,
// getIntrinsicID() returns the intrinsic ID.
-CorInfoIntrinsics interceptor_ICJI::getIntrinsicID(
- CORINFO_METHOD_HANDLE method,
- bool* pMustExpand /* OUT */
- )
+CorInfoIntrinsics interceptor_ICJI::getIntrinsicID(CORINFO_METHOD_HANDLE method, bool* pMustExpand /* OUT */
+ )
{
mcs->AddCall("getIntrinsicID");
return original_ICorJitInfo->getIntrinsicID(method, pMustExpand);
}
// Is the given module the System.Numerics.Vectors module?
-bool interceptor_ICJI::isInSIMDModule(
- CORINFO_CLASS_HANDLE classHnd
- )
+bool interceptor_ICJI::isInSIMDModule(CORINFO_CLASS_HANDLE classHnd)
{
mcs->AddCall("isInSIMDModule");
return original_ICorJitInfo->isInSIMDModule(classHnd);
}
// return the unmanaged calling convention for a PInvoke
-CorInfoUnmanagedCallConv interceptor_ICJI::getUnmanagedCallConv(
- CORINFO_METHOD_HANDLE method
- )
+CorInfoUnmanagedCallConv interceptor_ICJI::getUnmanagedCallConv(CORINFO_METHOD_HANDLE method)
{
mcs->AddCall("getUnmanagedCallConv");
return original_ICorJitInfo->getUnmanagedCallConv(method);
@@ -208,10 +187,7 @@ CorInfoUnmanagedCallConv interceptor_ICJI::getUnmanagedCallConv(
// 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 interceptor_ICJI::pInvokeMarshalingRequired(
- CORINFO_METHOD_HANDLE method,
- CORINFO_SIG_INFO* callSiteSig
- )
+BOOL interceptor_ICJI::pInvokeMarshalingRequired(CORINFO_METHOD_HANDLE method, CORINFO_SIG_INFO* callSiteSig)
{
mcs->AddCall("pInvokeMarshalingRequired");
return original_ICorJitInfo->pInvokeMarshalingRequired(method, callSiteSig);
@@ -219,10 +195,8 @@ BOOL interceptor_ICJI::pInvokeMarshalingRequired(
// Check constraints on method type arguments (only).
// The parent class should be checked separately using satisfiesClassConstraints(parent).
-BOOL interceptor_ICJI::satisfiesMethodConstraints(
- CORINFO_CLASS_HANDLE parent, // the exact parent of the method
- CORINFO_METHOD_HANDLE method
- )
+BOOL interceptor_ICJI::satisfiesMethodConstraints(CORINFO_CLASS_HANDLE parent, // the exact parent of the method
+ CORINFO_METHOD_HANDLE method)
{
mcs->AddCall("satisfiesMethodConstraints");
return original_ICorJitInfo->satisfiesMethodConstraints(parent, method);
@@ -232,33 +206,29 @@ BOOL interceptor_ICJI::satisfiesMethodConstraints(
// 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 interceptor_ICJI::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 */
- )
+ 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 */
+ )
{
mcs->AddCall("isCompatibleDelegate");
return original_ICorJitInfo->isCompatibleDelegate(objCls, methodParentCls, method, delegateCls, pfIsOpenDelegate);
}
// Determines whether the delegate creation obeys security transparency rules
-BOOL interceptor_ICJI::isDelegateCreationAllowed (
- CORINFO_CLASS_HANDLE delegateHnd,
- CORINFO_METHOD_HANDLE calleeHnd
- )
+BOOL interceptor_ICJI::isDelegateCreationAllowed(CORINFO_CLASS_HANDLE delegateHnd, CORINFO_METHOD_HANDLE calleeHnd)
{
mcs->AddCall("isDelegateCreationAllowed");
return original_ICorJitInfo->isDelegateCreationAllowed(delegateHnd, calleeHnd);
}
-
// Indicates if the method is an instance of the generic
// method that passes (or has passed) verification
-CorInfoInstantiationVerification interceptor_ICJI::isInstantiationOfVerifiedGeneric (
- CORINFO_METHOD_HANDLE method /* IN */
- )
+CorInfoInstantiationVerification interceptor_ICJI::isInstantiationOfVerifiedGeneric(CORINFO_METHOD_HANDLE method /* IN
+ */
+ )
{
mcs->AddCall("isInstantiationOfVerifiedGeneric");
return original_ICorJitInfo->isInstantiationOfVerifiedGeneric(method);
@@ -266,38 +236,32 @@ CorInfoInstantiationVerification interceptor_ICJI::isInstantiationOfVerifiedGene
// Loads the constraints on a typical method definition, detecting cycles;
// for use in verification.
-void interceptor_ICJI::initConstraintsForVerification(
- CORINFO_METHOD_HANDLE method, /* IN */
- BOOL *pfHasCircularClassConstraints, /* OUT */
- BOOL *pfHasCircularMethodConstraint /* OUT */
- )
+void interceptor_ICJI::initConstraintsForVerification(CORINFO_METHOD_HANDLE method, /* IN */
+ BOOL* pfHasCircularClassConstraints, /* OUT */
+ BOOL* pfHasCircularMethodConstraint /* OUT */
+ )
{
mcs->AddCall("initConstraintsForVerification");
- original_ICorJitInfo->initConstraintsForVerification(method, pfHasCircularClassConstraints, pfHasCircularMethodConstraint);
+ original_ICorJitInfo->initConstraintsForVerification(method, pfHasCircularClassConstraints,
+ pfHasCircularMethodConstraint);
}
// Returns enum whether the method does not require verification
// Also see ICorModuleInfo::canSkipVerification
-CorInfoCanSkipVerificationResult interceptor_ICJI::canSkipMethodVerification (
- CORINFO_METHOD_HANDLE ftnHandle
- )
+CorInfoCanSkipVerificationResult interceptor_ICJI::canSkipMethodVerification(CORINFO_METHOD_HANDLE ftnHandle)
{
mcs->AddCall("canSkipMethodVerification");
return original_ICorJitInfo->canSkipMethodVerification(ftnHandle);
}
// load and restore the method
-void interceptor_ICJI::methodMustBeLoadedBeforeCodeIsRun(
- CORINFO_METHOD_HANDLE method
- )
+void interceptor_ICJI::methodMustBeLoadedBeforeCodeIsRun(CORINFO_METHOD_HANDLE method)
{
mcs->AddCall("methodMustBeLoadedBeforeCodeIsRun");
original_ICorJitInfo->methodMustBeLoadedBeforeCodeIsRun(method);
}
-CORINFO_METHOD_HANDLE interceptor_ICJI::mapMethodDeclToMethodImpl(
- CORINFO_METHOD_HANDLE method
- )
+CORINFO_METHOD_HANDLE interceptor_ICJI::mapMethodDeclToMethodImpl(CORINFO_METHOD_HANDLE method)
{
mcs->AddCall("mapMethodDeclToMethodImpl");
return original_ICorJitInfo->mapMethodDeclToMethodImpl(method);
@@ -305,10 +269,9 @@ CORINFO_METHOD_HANDLE interceptor_ICJI::mapMethodDeclToMethodImpl(
// 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 interceptor_ICJI::getGSCookie(
- GSCookie * pCookieVal, // OUT
- GSCookie ** ppCookieVal // OUT
- )
+void interceptor_ICJI::getGSCookie(GSCookie* pCookieVal, // OUT
+ GSCookie** ppCookieVal // OUT
+ )
{
mcs->AddCall("getGSCookie");
original_ICorJitInfo->getGSCookie(pCookieVal, ppCookieVal);
@@ -321,25 +284,24 @@ void interceptor_ICJI::getGSCookie(
/**********************************************************************************/
// Resolve metadata token into runtime method handles.
-void interceptor_ICJI::resolveToken(/* IN, OUT */ CORINFO_RESOLVED_TOKEN * pResolvedToken)
+void interceptor_ICJI::resolveToken(/* IN, OUT */ CORINFO_RESOLVED_TOKEN* pResolvedToken)
{
mcs->AddCall("resolveToken");
original_ICorJitInfo->resolveToken(pResolvedToken);
}
-bool interceptor_ICJI::tryResolveToken(/* IN, OUT */ CORINFO_RESOLVED_TOKEN * pResolvedToken)
+bool interceptor_ICJI::tryResolveToken(/* IN, OUT */ CORINFO_RESOLVED_TOKEN* pResolvedToken)
{
mcs->AddCall("tryResolveToken");
return original_ICorJitInfo->tryResolveToken(pResolvedToken);
}
// Signature information about the call sig
-void interceptor_ICJI::findSig (
- CORINFO_MODULE_HANDLE module, /* IN */
- unsigned sigTOK, /* IN */
- CORINFO_CONTEXT_HANDLE context, /* IN */
- CORINFO_SIG_INFO *sig /* OUT */
- )
+void interceptor_ICJI::findSig(CORINFO_MODULE_HANDLE module, /* IN */
+ unsigned sigTOK, /* IN */
+ CORINFO_CONTEXT_HANDLE context, /* IN */
+ CORINFO_SIG_INFO* sig /* OUT */
+ )
{
mcs->AddCall("findSig");
original_ICorJitInfo->findSig(module, sigTOK, context, sig);
@@ -348,19 +310,17 @@ void interceptor_ICJI::findSig (
// 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 interceptor_ICJI::findCallSiteSig (
- CORINFO_MODULE_HANDLE module, /* IN */
- unsigned methTOK, /* IN */
- CORINFO_CONTEXT_HANDLE context, /* IN */
- CORINFO_SIG_INFO *sig /* OUT */
- )
+void interceptor_ICJI::findCallSiteSig(CORINFO_MODULE_HANDLE module, /* IN */
+ unsigned methTOK, /* IN */
+ CORINFO_CONTEXT_HANDLE context, /* IN */
+ CORINFO_SIG_INFO* sig /* OUT */
+ )
{
mcs->AddCall("findCallSiteSig");
original_ICorJitInfo->findCallSiteSig(module, methTOK, context, sig);
}
-CORINFO_CLASS_HANDLE interceptor_ICJI::getTokenTypeAsHandle (
- CORINFO_RESOLVED_TOKEN * pResolvedToken /* IN */)
+CORINFO_CLASS_HANDLE interceptor_ICJI::getTokenTypeAsHandle(CORINFO_RESOLVED_TOKEN* pResolvedToken /* IN */)
{
mcs->AddCall("getTokenTypeAsHandle");
return original_ICorJitInfo->getTokenTypeAsHandle(pResolvedToken);
@@ -377,37 +337,32 @@ CORINFO_CLASS_HANDLE interceptor_ICJI::getTokenTypeAsHandle (
// Returns enum whether the module does not require verification
// Also see ICorMethodInfo::canSkipMethodVerification();
-CorInfoCanSkipVerificationResult interceptor_ICJI::canSkipVerification (
- CORINFO_MODULE_HANDLE module /* IN */
- )
+CorInfoCanSkipVerificationResult interceptor_ICJI::canSkipVerification(CORINFO_MODULE_HANDLE module /* IN */
+ )
{
mcs->AddCall("canSkipVerification");
return original_ICorJitInfo->canSkipVerification(module);
}
// Checks if the given metadata token is valid
-BOOL interceptor_ICJI::isValidToken (
- CORINFO_MODULE_HANDLE module, /* IN */
- unsigned metaTOK /* IN */
- )
+BOOL interceptor_ICJI::isValidToken(CORINFO_MODULE_HANDLE module, /* IN */
+ unsigned metaTOK /* IN */
+ )
{
mcs->AddCall("isValidToken");
return original_ICorJitInfo->isValidToken(module, metaTOK);
}
// Checks if the given metadata token is valid StringRef
-BOOL interceptor_ICJI::isValidStringRef (
- CORINFO_MODULE_HANDLE module, /* IN */
- unsigned metaTOK /* IN */
- )
+BOOL interceptor_ICJI::isValidStringRef(CORINFO_MODULE_HANDLE module, /* IN */
+ unsigned metaTOK /* IN */
+ )
{
mcs->AddCall("isValidStringRef");
return original_ICorJitInfo->isValidStringRef(module, metaTOK);
}
-BOOL interceptor_ICJI::shouldEnforceCallvirtRestriction(
- CORINFO_MODULE_HANDLE scope
- )
+BOOL interceptor_ICJI::shouldEnforceCallvirtRestriction(CORINFO_MODULE_HANDLE scope)
{
mcs->AddCall("shouldEnforceCallvirtRestriction");
return original_ICorJitInfo->shouldEnforceCallvirtRestriction(scope);
@@ -421,43 +376,37 @@ BOOL interceptor_ICJI::shouldEnforceCallvirtRestriction(
// If the value class 'cls' is isomorphic to a primitive type it will
// return that type, otherwise it will return CORINFO_TYPE_VALUECLASS
-CorInfoType interceptor_ICJI::asCorInfoType (
- CORINFO_CLASS_HANDLE cls
- )
+CorInfoType interceptor_ICJI::asCorInfoType(CORINFO_CLASS_HANDLE cls)
{
mcs->AddCall("asCorInfoType");
return original_ICorJitInfo->asCorInfoType(cls);
}
// for completeness
-const char* interceptor_ICJI::getClassName (
- CORINFO_CLASS_HANDLE cls
- )
+const char* interceptor_ICJI::getClassName(CORINFO_CLASS_HANDLE cls)
{
mcs->AddCall("getClassName");
return original_ICorJitInfo->getClassName(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 interceptor_ICJI::appendClassName(
- __deref_inout_ecount(*pnBufLen) WCHAR** ppBuf,
- int* pnBufLen,
- CORINFO_CLASS_HANDLE cls,
- BOOL fNamespace,
- BOOL fFullInst,
- BOOL fAssembly
- )
+int interceptor_ICJI::appendClassName(__deref_inout_ecount(*pnBufLen) WCHAR** ppBuf,
+ int* pnBufLen,
+ CORINFO_CLASS_HANDLE cls,
+ BOOL fNamespace,
+ BOOL fFullInst,
+ BOOL fAssembly)
{
mcs->AddCall("appendClassName");
return original_ICorJitInfo->appendClassName(ppBuf, pnBufLen, cls, fNamespace, fFullInst, fAssembly);
}
-// Quick check whether the type is a value class. Returns the same value as getClassAttribs(cls) & CORINFO_FLG_VALUECLASS, except faster.
+// Quick check whether the type is a value class. Returns the same value as getClassAttribs(cls) &
+// CORINFO_FLG_VALUECLASS, except faster.
BOOL interceptor_ICJI::isValueClass(CORINFO_CLASS_HANDLE cls)
{
mcs->AddCall("isValueClass");
@@ -473,9 +422,7 @@ BOOL interceptor_ICJI::canInlineTypeCheckWithObjectVTable(CORINFO_CLASS_HANDLE c
}
// return flags (defined above, CORINFO_FLG_PUBLIC ...)
-DWORD interceptor_ICJI::getClassAttribs (
- CORINFO_CLASS_HANDLE cls
- )
+DWORD interceptor_ICJI::getClassAttribs(CORINFO_CLASS_HANDLE cls)
{
mcs->AddCall("getClassAttribs");
return original_ICorJitInfo->getClassAttribs(cls);
@@ -493,27 +440,21 @@ BOOL interceptor_ICJI::isStructRequiringStackAllocRetBuf(CORINFO_CLASS_HANDLE cl
return original_ICorJitInfo->isStructRequiringStackAllocRetBuf(cls);
}
-CORINFO_MODULE_HANDLE interceptor_ICJI::getClassModule (
- CORINFO_CLASS_HANDLE cls
- )
+CORINFO_MODULE_HANDLE interceptor_ICJI::getClassModule(CORINFO_CLASS_HANDLE cls)
{
mcs->AddCall("getClassModule");
return original_ICorJitInfo->getClassModule(cls);
}
// Returns the assembly that contains the module "mod".
-CORINFO_ASSEMBLY_HANDLE interceptor_ICJI::getModuleAssembly (
- CORINFO_MODULE_HANDLE mod
- )
+CORINFO_ASSEMBLY_HANDLE interceptor_ICJI::getModuleAssembly(CORINFO_MODULE_HANDLE mod)
{
mcs->AddCall("getModuleAssembly");
return original_ICorJitInfo->getModuleAssembly(mod);
}
// Returns the name of the assembly "assem".
-const char* interceptor_ICJI::getAssemblyName (
- CORINFO_ASSEMBLY_HANDLE assem
- )
+const char* interceptor_ICJI::getAssemblyName(CORINFO_ASSEMBLY_HANDLE assem)
{
mcs->AddCall("getAssemblyName");
return original_ICorJitInfo->getAssemblyName(assem);
@@ -535,29 +476,22 @@ void interceptor_ICJI::LongLifetimeFree(void* obj)
original_ICorJitInfo->LongLifetimeFree(obj);
}
-size_t interceptor_ICJI::getClassModuleIdForStatics (
- CORINFO_CLASS_HANDLE cls,
- CORINFO_MODULE_HANDLE *pModule,
- void **ppIndirection
- )
+size_t interceptor_ICJI::getClassModuleIdForStatics(CORINFO_CLASS_HANDLE cls,
+ CORINFO_MODULE_HANDLE* pModule,
+ void** ppIndirection)
{
mcs->AddCall("getClassModuleIdForStatics");
return original_ICorJitInfo->getClassModuleIdForStatics(cls, pModule, ppIndirection);
}
// return the number of bytes needed by an instance of the class
-unsigned interceptor_ICJI::getClassSize (
- CORINFO_CLASS_HANDLE cls
- )
+unsigned interceptor_ICJI::getClassSize(CORINFO_CLASS_HANDLE cls)
{
mcs->AddCall("getClassSize");
return original_ICorJitInfo->getClassSize(cls);
}
-unsigned interceptor_ICJI::getClassAlignmentRequirement (
- CORINFO_CLASS_HANDLE cls,
- BOOL fDoubleAlignHint
- )
+unsigned interceptor_ICJI::getClassAlignmentRequirement(CORINFO_CLASS_HANDLE cls, BOOL fDoubleAlignHint)
{
mcs->AddCall("getClassAlignmentRequirement");
return original_ICorJitInfo->getClassAlignmentRequirement(cls, fDoubleAlignHint);
@@ -572,84 +506,64 @@ unsigned interceptor_ICJI::getClassAlignmentRequirement (
// 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 interceptor_ICJI::getClassGClayout (
- CORINFO_CLASS_HANDLE cls, /* IN */
- BYTE *gcPtrs /* OUT */
- )
+unsigned interceptor_ICJI::getClassGClayout(CORINFO_CLASS_HANDLE cls, /* IN */
+ BYTE* gcPtrs /* OUT */
+ )
{
mcs->AddCall("getClassGClayout");
return original_ICorJitInfo->getClassGClayout(cls, gcPtrs);
}
// returns the number of instance fields in a class
-unsigned interceptor_ICJI::getClassNumInstanceFields (
- CORINFO_CLASS_HANDLE cls /* IN */
- )
+unsigned interceptor_ICJI::getClassNumInstanceFields(CORINFO_CLASS_HANDLE cls /* IN */
+ )
{
mcs->AddCall("getClassNumInstanceFields");
return original_ICorJitInfo->getClassNumInstanceFields(cls);
}
-CORINFO_FIELD_HANDLE interceptor_ICJI::getFieldInClass(
- CORINFO_CLASS_HANDLE clsHnd,
- INT num
- )
+CORINFO_FIELD_HANDLE interceptor_ICJI::getFieldInClass(CORINFO_CLASS_HANDLE clsHnd, INT num)
{
mcs->AddCall("getFieldInClass");
return original_ICorJitInfo->getFieldInClass(clsHnd, num);
}
-BOOL interceptor_ICJI::checkMethodModifier(
- CORINFO_METHOD_HANDLE hMethod,
- LPCSTR modifier,
- BOOL fOptional
- )
+BOOL interceptor_ICJI::checkMethodModifier(CORINFO_METHOD_HANDLE hMethod, LPCSTR modifier, BOOL fOptional)
{
mcs->AddCall("checkMethodModifier");
return original_ICorJitInfo->checkMethodModifier(hMethod, modifier, fOptional);
}
// returns the "NEW" helper optimized for "newCls."
-CorInfoHelpFunc interceptor_ICJI::getNewHelper(
- CORINFO_RESOLVED_TOKEN * pResolvedToken,
- CORINFO_METHOD_HANDLE callerHandle
- )
+CorInfoHelpFunc interceptor_ICJI::getNewHelper(CORINFO_RESOLVED_TOKEN* pResolvedToken,
+ CORINFO_METHOD_HANDLE callerHandle)
{
mcs->AddCall("getNewHelper");
return original_ICorJitInfo->getNewHelper(pResolvedToken, callerHandle);
}
// returns the newArr (1-Dim array) helper optimized for "arrayCls."
-CorInfoHelpFunc interceptor_ICJI::getNewArrHelper(
- CORINFO_CLASS_HANDLE arrayCls
- )
+CorInfoHelpFunc interceptor_ICJI::getNewArrHelper(CORINFO_CLASS_HANDLE arrayCls)
{
mcs->AddCall("getNewArrHelper");
return original_ICorJitInfo->getNewArrHelper(arrayCls);
}
// returns the optimized "IsInstanceOf" or "ChkCast" helper
-CorInfoHelpFunc interceptor_ICJI::getCastingHelper(
- CORINFO_RESOLVED_TOKEN * pResolvedToken,
- bool fThrowing
- )
+CorInfoHelpFunc interceptor_ICJI::getCastingHelper(CORINFO_RESOLVED_TOKEN* pResolvedToken, bool fThrowing)
{
mcs->AddCall("getCastingHelper");
return original_ICorJitInfo->getCastingHelper(pResolvedToken, fThrowing);
}
// returns helper to trigger static constructor
-CorInfoHelpFunc interceptor_ICJI::getSharedCCtorHelper(
- CORINFO_CLASS_HANDLE clsHnd
- )
+CorInfoHelpFunc interceptor_ICJI::getSharedCCtorHelper(CORINFO_CLASS_HANDLE clsHnd)
{
mcs->AddCall("getSharedCCtorHelper");
return original_ICorJitInfo->getSharedCCtorHelper(clsHnd);
}
-CorInfoHelpFunc interceptor_ICJI::getSecurityPrologHelper(
- CORINFO_METHOD_HANDLE ftn
- )
+CorInfoHelpFunc interceptor_ICJI::getSecurityPrologHelper(CORINFO_METHOD_HANDLE ftn)
{
mcs->AddCall("getSecurityPrologHelper");
return original_ICorJitInfo->getSecurityPrologHelper(ftn);
@@ -659,9 +573,7 @@ CorInfoHelpFunc interceptor_ICJI::getSecurityPrologHelper(
// 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 interceptor_ICJI::getTypeForBox(
- CORINFO_CLASS_HANDLE cls
- )
+CORINFO_CLASS_HANDLE interceptor_ICJI::getTypeForBox(CORINFO_CLASS_HANDLE cls)
{
mcs->AddCall("getTypeForBox");
return original_ICorJitInfo->getTypeForBox(cls);
@@ -670,9 +582,7 @@ CORINFO_CLASS_HANDLE interceptor_ICJI::getTypeForBox(
// 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 interceptor_ICJI::getBoxHelper(
- CORINFO_CLASS_HANDLE cls
- )
+CorInfoHelpFunc interceptor_ICJI::getBoxHelper(CORINFO_CLASS_HANDLE cls)
{
mcs->AddCall("getBoxHelper");
return original_ICorJitInfo->getBoxHelper(cls);
@@ -690,38 +600,30 @@ CorInfoHelpFunc interceptor_ICJI::getBoxHelper(
// The EE set 'helperCopies' on return to indicate what kind of
// helper has been created.
-CorInfoHelpFunc interceptor_ICJI::getUnBoxHelper(
- CORINFO_CLASS_HANDLE cls
- )
+CorInfoHelpFunc interceptor_ICJI::getUnBoxHelper(CORINFO_CLASS_HANDLE cls)
{
mcs->AddCall("getUnBoxHelper");
return original_ICorJitInfo->getUnBoxHelper(cls);
}
-bool interceptor_ICJI::getReadyToRunHelper(
- CORINFO_RESOLVED_TOKEN * pResolvedToken,
- CORINFO_LOOKUP_KIND * pGenericLookupKind,
- CorInfoHelpFunc id,
- CORINFO_CONST_LOOKUP * pLookup
- )
+bool interceptor_ICJI::getReadyToRunHelper(CORINFO_RESOLVED_TOKEN* pResolvedToken,
+ CORINFO_LOOKUP_KIND* pGenericLookupKind,
+ CorInfoHelpFunc id,
+ CORINFO_CONST_LOOKUP* pLookup)
{
mcs->AddCall("getReadyToRunHelper");
return original_ICorJitInfo->getReadyToRunHelper(pResolvedToken, pGenericLookupKind, id, pLookup);
}
-void interceptor_ICJI::getReadyToRunDelegateCtorHelper(
- CORINFO_RESOLVED_TOKEN * pTargetMethod,
- CORINFO_CLASS_HANDLE delegateType,
- CORINFO_LOOKUP * pLookup
- )
+void interceptor_ICJI::getReadyToRunDelegateCtorHelper(CORINFO_RESOLVED_TOKEN* pTargetMethod,
+ CORINFO_CLASS_HANDLE delegateType,
+ CORINFO_LOOKUP* pLookup)
{
mcs->AddCall("getReadyToRunDelegateCtorHelper");
original_ICorJitInfo->getReadyToRunDelegateCtorHelper(pTargetMethod, delegateType, pLookup);
}
-const char* interceptor_ICJI::getHelperName(
- CorInfoHelpFunc funcNum
- )
+const char* interceptor_ICJI::getHelperName(CorInfoHelpFunc funcNum)
{
mcs->AddCall("getHelperName");
return original_ICorJitInfo->getHelperName(funcNum);
@@ -733,12 +635,12 @@ const char* interceptor_ICJI::getHelperName(
//
// See code:ICorClassInfo#ClassConstruction.
CorInfoInitClassResult interceptor_ICJI::initClass(
- CORINFO_FIELD_HANDLE field, // Non-nullptr - inquire about cctor trigger before static field access
- // nullptr - 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 // TRUE means don't actually run it
- )
+ CORINFO_FIELD_HANDLE field, // Non-nullptr - inquire about cctor trigger before static field access
+ // nullptr - 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 // TRUE means don't actually run it
+ )
{
mcs->AddCall("initClass");
return original_ICorJitInfo->initClass(field, method, context, speculative);
@@ -754,27 +656,21 @@ CorInfoInitClassResult interceptor_ICJI::initClass(
// 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 interceptor_ICJI::classMustBeLoadedBeforeCodeIsRun(
- CORINFO_CLASS_HANDLE cls
- )
+void interceptor_ICJI::classMustBeLoadedBeforeCodeIsRun(CORINFO_CLASS_HANDLE cls)
{
mcs->AddCall("classMustBeLoadedBeforeCodeIsRun");
original_ICorJitInfo->classMustBeLoadedBeforeCodeIsRun(cls);
}
// returns the class handle for the special builtin classes
-CORINFO_CLASS_HANDLE interceptor_ICJI::getBuiltinClass (
- CorInfoClassId classId
- )
+CORINFO_CLASS_HANDLE interceptor_ICJI::getBuiltinClass(CorInfoClassId classId)
{
mcs->AddCall("getBuiltinClass");
return original_ICorJitInfo->getBuiltinClass(classId);
}
// "System.Int32" ==> CORINFO_TYPE_INT..
-CorInfoType interceptor_ICJI::getTypeForPrimitiveValueClass(
- CORINFO_CLASS_HANDLE cls
- )
+CorInfoType interceptor_ICJI::getTypeForPrimitiveValueClass(CORINFO_CLASS_HANDLE cls)
{
mcs->AddCall("getTypeForPrimitiveValueClass");
return original_ICorJitInfo->getTypeForPrimitiveValueClass(cls);
@@ -782,30 +678,23 @@ CorInfoType interceptor_ICJI::getTypeForPrimitiveValueClass(
// TRUE if child is a subtype of parent
// if parent is an interface, then does child implement / extend parent
-BOOL interceptor_ICJI::canCast(
- CORINFO_CLASS_HANDLE child, // subtype (extends parent)
- CORINFO_CLASS_HANDLE parent // base type
- )
+BOOL interceptor_ICJI::canCast(CORINFO_CLASS_HANDLE child, // subtype (extends parent)
+ CORINFO_CLASS_HANDLE parent // base type
+ )
{
mcs->AddCall("canCast");
return original_ICorJitInfo->canCast(child, parent);
}
// TRUE if cls1 and cls2 are considered equivalent types.
-BOOL interceptor_ICJI::areTypesEquivalent(
- CORINFO_CLASS_HANDLE cls1,
- CORINFO_CLASS_HANDLE cls2
- )
+BOOL interceptor_ICJI::areTypesEquivalent(CORINFO_CLASS_HANDLE cls1, CORINFO_CLASS_HANDLE cls2)
{
mcs->AddCall("areTypesEquivalent");
return original_ICorJitInfo->areTypesEquivalent(cls1, cls2);
}
// returns is the intersection of cls1 and cls2.
-CORINFO_CLASS_HANDLE interceptor_ICJI::mergeClasses(
- CORINFO_CLASS_HANDLE cls1,
- CORINFO_CLASS_HANDLE cls2
- )
+CORINFO_CLASS_HANDLE interceptor_ICJI::mergeClasses(CORINFO_CLASS_HANDLE cls1, CORINFO_CLASS_HANDLE cls2)
{
mcs->AddCall("mergeClasses");
return original_ICorJitInfo->mergeClasses(cls1, cls2);
@@ -814,9 +703,7 @@ CORINFO_CLASS_HANDLE interceptor_ICJI::mergeClasses(
// 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 interceptor_ICJI::getParentType (
- CORINFO_CLASS_HANDLE cls
- )
+CORINFO_CLASS_HANDLE interceptor_ICJI::getParentType(CORINFO_CLASS_HANDLE cls)
{
mcs->AddCall("getParentType");
return original_ICorJitInfo->getParentType(cls);
@@ -826,47 +713,35 @@ CORINFO_CLASS_HANDLE interceptor_ICJI::getParentType (
// not a primitive type, *clsRet will be set.
// Given an Array of Type Foo, returns Foo.
// Given BYREF Foo, returns Foo
-CorInfoType interceptor_ICJI::getChildType (
- CORINFO_CLASS_HANDLE clsHnd,
- CORINFO_CLASS_HANDLE *clsRet
- )
+CorInfoType interceptor_ICJI::getChildType(CORINFO_CLASS_HANDLE clsHnd, CORINFO_CLASS_HANDLE* clsRet)
{
mcs->AddCall("getChildType");
return original_ICorJitInfo->getChildType(clsHnd, clsRet);
}
// Check constraints on type arguments of this class and parent classes
-BOOL interceptor_ICJI::satisfiesClassConstraints(
- CORINFO_CLASS_HANDLE cls
- )
+BOOL interceptor_ICJI::satisfiesClassConstraints(CORINFO_CLASS_HANDLE cls)
{
mcs->AddCall("satisfiesClassConstraints");
return original_ICorJitInfo->satisfiesClassConstraints(cls);
}
// Check if this is a single dimensional array type
-BOOL interceptor_ICJI::isSDArray(
- CORINFO_CLASS_HANDLE cls
- )
+BOOL interceptor_ICJI::isSDArray(CORINFO_CLASS_HANDLE cls)
{
mcs->AddCall("isSDArray");
return original_ICorJitInfo->isSDArray(cls);
}
// Get the numbmer of dimensions in an array
-unsigned interceptor_ICJI::getArrayRank(
- CORINFO_CLASS_HANDLE cls
- )
+unsigned interceptor_ICJI::getArrayRank(CORINFO_CLASS_HANDLE cls)
{
mcs->AddCall("getArrayRank");
return original_ICorJitInfo->getArrayRank(cls);
}
// Get static field data for an array
-void * interceptor_ICJI::getArrayInitializationData(
- CORINFO_FIELD_HANDLE field,
- DWORD size
- )
+void* interceptor_ICJI::getArrayInitializationData(CORINFO_FIELD_HANDLE field, DWORD size)
{
mcs->AddCall("getArrayInitializationData");
return original_ICorJitInfo->getArrayInitializationData(field, size);
@@ -874,11 +749,11 @@ void * interceptor_ICJI::getArrayInitializationData(
// Check Visibility rules.
CorInfoIsAccessAllowedResult interceptor_ICJI::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. */
- )
+ CORINFO_RESOLVED_TOKEN* pResolvedToken,
+ CORINFO_METHOD_HANDLE callerHandle,
+ CORINFO_HELPER_DESC* pAccessHelper /* If canAccessMethod returns something other
+ than ALLOWED, then this is filled in. */
+ )
{
mcs->AddCall("canAccessClass");
return original_ICorJitInfo->canAccessClass(pResolvedToken, callerHandle, pAccessHelper);
@@ -893,19 +768,16 @@ CorInfoIsAccessAllowedResult interceptor_ICJI::canAccessClass(
// 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* interceptor_ICJI::getFieldName (
- CORINFO_FIELD_HANDLE ftn, /* IN */
- const char **moduleName /* OUT */
- )
+const char* interceptor_ICJI::getFieldName(CORINFO_FIELD_HANDLE ftn, /* IN */
+ const char** moduleName /* OUT */
+ )
{
mcs->AddCall("getFieldName");
return original_ICorJitInfo->getFieldName(ftn, moduleName);
}
// return class it belongs to
-CORINFO_CLASS_HANDLE interceptor_ICJI::getFieldClass (
- CORINFO_FIELD_HANDLE field
- )
+CORINFO_CLASS_HANDLE interceptor_ICJI::getFieldClass(CORINFO_FIELD_HANDLE field)
{
mcs->AddCall("getFieldClass");
return original_ICorJitInfo->getFieldClass(field);
@@ -917,20 +789,17 @@ CORINFO_CLASS_HANDLE interceptor_ICJI::getFieldClass (
//
// 'memberParent' is typically only set when verifying. It should be the
// result of calling getMemberParent.
-CorInfoType interceptor_ICJI::getFieldType(
- CORINFO_FIELD_HANDLE field,
- CORINFO_CLASS_HANDLE *structType,
- CORINFO_CLASS_HANDLE memberParent/* IN */
- )
+CorInfoType interceptor_ICJI::getFieldType(CORINFO_FIELD_HANDLE field,
+ CORINFO_CLASS_HANDLE* structType,
+ CORINFO_CLASS_HANDLE memberParent /* IN */
+ )
{
mcs->AddCall("getFieldType");
return original_ICorJitInfo->getFieldType(field, structType, memberParent);
}
// return the data member's instance offset
-unsigned interceptor_ICJI::getFieldOffset(
- CORINFO_FIELD_HANDLE field
- )
+unsigned interceptor_ICJI::getFieldOffset(CORINFO_FIELD_HANDLE field)
{
mcs->AddCall("getFieldOffset");
return original_ICorJitInfo->getFieldOffset(field);
@@ -939,18 +808,16 @@ unsigned interceptor_ICJI::getFieldOffset(
// 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 interceptor_ICJI::isWriteBarrierHelperRequired(
- CORINFO_FIELD_HANDLE field)
+bool interceptor_ICJI::isWriteBarrierHelperRequired(CORINFO_FIELD_HANDLE field)
{
mcs->AddCall("isWriteBarrierHelperRequired");
return original_ICorJitInfo->isWriteBarrierHelperRequired(field);
}
-void interceptor_ICJI::getFieldInfo (CORINFO_RESOLVED_TOKEN * pResolvedToken,
- CORINFO_METHOD_HANDLE callerHandle,
- CORINFO_ACCESS_FLAGS flags,
- CORINFO_FIELD_INFO *pResult
- )
+void interceptor_ICJI::getFieldInfo(CORINFO_RESOLVED_TOKEN* pResolvedToken,
+ CORINFO_METHOD_HANDLE callerHandle,
+ CORINFO_ACCESS_FLAGS flags,
+ CORINFO_FIELD_INFO* pResult)
{
mcs->AddCall("getFieldInfo");
original_ICorJitInfo->getFieldInfo(pResolvedToken, callerHandle, flags, pResult);
@@ -976,13 +843,13 @@ bool interceptor_ICJI::isFieldStatic(CORINFO_FIELD_HANDLE fldHnd)
// 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 interceptor_ICJI::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
- )
+void interceptor_ICJI::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
+ )
{
mcs->AddCall("getBoundaries");
original_ICorJitInfo->getBoundaries(ftn, cILOffsets, pILOffsets, implictBoundaries);
@@ -995,12 +862,12 @@ void interceptor_ICJI::getBoundaries(
// 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 interceptor_ICJI::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
- )
+void interceptor_ICJI::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
+ )
{
mcs->AddCall("setBoundaries");
original_ICorJitInfo->setBoundaries(ftn, cMap, pMap);
@@ -1014,14 +881,13 @@ void interceptor_ICJI::setBoundaries(
// 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 interceptor_ICJI::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
- )
+void interceptor_ICJI::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
+ )
{
mcs->AddCall("getVars");
original_ICorJitInfo->getVars(ftn, cVars, vars, extendOthers);
@@ -1031,12 +897,12 @@ void interceptor_ICJI::getVars(
// note that the JIT might split lifetimes into different
// locations etc.
-void interceptor_ICJI::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
- )
+void interceptor_ICJI::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
+ )
{
mcs->AddCall("setVars");
original_ICorJitInfo->setVars(ftn, cVars, vars);
@@ -1047,9 +913,7 @@ void interceptor_ICJI::setVars(
// 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 * interceptor_ICJI::allocateArray(
- ULONG cBytes
- )
+void* interceptor_ICJI::allocateArray(ULONG cBytes)
{
mcs->AddCall("allocateArray");
return original_ICorJitInfo->allocateArray(cBytes);
@@ -1059,9 +923,7 @@ void * interceptor_ICJI::allocateArray(
// For eg, The EE returns memory in getVars() and getBoundaries()
// to the JitCompiler, which the JitCompiler should release using
// freeArray()
-void interceptor_ICJI::freeArray(
- void *array
- )
+void interceptor_ICJI::freeArray(void* array)
{
mcs->AddCall("freeArray");
original_ICorJitInfo->freeArray(array);
@@ -1075,9 +937,8 @@ void interceptor_ICJI::freeArray(
// advance the pointer to the argument list.
// a ptr of 0, is special and always means the first argument
-CORINFO_ARG_LIST_HANDLE interceptor_ICJI::getArgNext (
- CORINFO_ARG_LIST_HANDLE args /* IN */
- )
+CORINFO_ARG_LIST_HANDLE interceptor_ICJI::getArgNext(CORINFO_ARG_LIST_HANDLE args /* IN */
+ )
{
mcs->AddCall("getArgNext");
return original_ICorJitInfo->getArgNext(args);
@@ -1092,30 +953,26 @@ CORINFO_ARG_LIST_HANDLE interceptor_ICJI::getArgNext (
// 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 interceptor_ICJI::getArgType (
- CORINFO_SIG_INFO* sig, /* IN */
- CORINFO_ARG_LIST_HANDLE args, /* IN */
- CORINFO_CLASS_HANDLE *vcTypeRet /* OUT */
- )
+CorInfoTypeWithMod interceptor_ICJI::getArgType(CORINFO_SIG_INFO* sig, /* IN */
+ CORINFO_ARG_LIST_HANDLE args, /* IN */
+ CORINFO_CLASS_HANDLE* vcTypeRet /* OUT */
+ )
{
mcs->AddCall("getArgType");
return original_ICorJitInfo->getArgType(sig, args, vcTypeRet);
}
// If the Arg is a CORINFO_TYPE_CLASS fetch the class handle associated with it
-CORINFO_CLASS_HANDLE interceptor_ICJI::getArgClass (
- CORINFO_SIG_INFO* sig, /* IN */
- CORINFO_ARG_LIST_HANDLE args /* IN */
- )
+CORINFO_CLASS_HANDLE interceptor_ICJI::getArgClass(CORINFO_SIG_INFO* sig, /* IN */
+ CORINFO_ARG_LIST_HANDLE args /* IN */
+ )
{
mcs->AddCall("getArgClass");
return original_ICorJitInfo->getArgClass(sig, args);
}
// Returns type of HFA for valuetype
-CorInfoType interceptor_ICJI::getHFAType (
- CORINFO_CLASS_HANDLE hClass
- )
+CorInfoType interceptor_ICJI::getHFAType(CORINFO_CLASS_HANDLE hClass)
{
mcs->AddCall("getHFAType");
return original_ICorJitInfo->getHFAType(hClass);
@@ -1128,9 +985,7 @@ CorInfoType interceptor_ICJI::getHFAType (
*****************************************************************************/
// Returns the HRESULT of the current exception
-HRESULT interceptor_ICJI::GetErrorHRESULT(
- struct _EXCEPTION_POINTERS *pExceptionPointers
- )
+HRESULT interceptor_ICJI::GetErrorHRESULT(struct _EXCEPTION_POINTERS* pExceptionPointers)
{
mcs->AddCall("GetErrorHRESULT");
return original_ICorJitInfo->GetErrorHRESULT(pExceptionPointers);
@@ -1139,10 +994,7 @@ HRESULT interceptor_ICJI::GetErrorHRESULT(
// 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 interceptor_ICJI::GetErrorMessage(
- __inout_ecount(bufferLength) LPWSTR buffer,
- ULONG bufferLength
- )
+ULONG interceptor_ICJI::GetErrorMessage(__inout_ecount(bufferLength) LPWSTR buffer, ULONG bufferLength)
{
mcs->AddCall("GetErrorMessage");
return original_ICorJitInfo->GetErrorMessage(buffer, bufferLength);
@@ -1154,33 +1006,27 @@ ULONG interceptor_ICJI::GetErrorMessage(
// things like ThreadStoppedException ...
// returns EXCEPTION_CONTINUE_EXECUTION if exception is fixed up by the EE
-int interceptor_ICJI::FilterException(
- struct _EXCEPTION_POINTERS *pExceptionPointers
- )
+int interceptor_ICJI::FilterException(struct _EXCEPTION_POINTERS* pExceptionPointers)
{
mcs->AddCall("FilterException");
return original_ICorJitInfo->FilterException(pExceptionPointers);
}
// Cleans up internal EE tracking when an exception is caught.
-void interceptor_ICJI::HandleException(
- struct _EXCEPTION_POINTERS *pExceptionPointers
- )
+void interceptor_ICJI::HandleException(struct _EXCEPTION_POINTERS* pExceptionPointers)
{
mcs->AddCall("HandleException");
original_ICorJitInfo->HandleException(pExceptionPointers);
}
-void interceptor_ICJI::ThrowExceptionForJitResult(
- HRESULT result)
+void interceptor_ICJI::ThrowExceptionForJitResult(HRESULT result)
{
mcs->AddCall("ThrowExceptionForJitResult");
original_ICorJitInfo->ThrowExceptionForJitResult(result);
}
-//Throws an exception defined by the given throw helper.
-void interceptor_ICJI::ThrowExceptionForHelper(
- const CORINFO_HELPER_DESC * throwHelper)
+// Throws an exception defined by the given throw helper.
+void interceptor_ICJI::ThrowExceptionForHelper(const CORINFO_HELPER_DESC* throwHelper)
{
mcs->AddCall("ThrowExceptionForHelper");
original_ICorJitInfo->ThrowExceptionForHelper(throwHelper);
@@ -1194,9 +1040,7 @@ void interceptor_ICJI::ThrowExceptionForHelper(
*****************************************************************************/
// Return details about EE internal data structures
-void interceptor_ICJI::getEEInfo(
- CORINFO_EE_INFO *pEEInfoOut
- )
+void interceptor_ICJI::getEEInfo(CORINFO_EE_INFO* pEEInfoOut)
{
mcs->AddCall("getEEInfo");
original_ICorJitInfo->getEEInfo(pEEInfoOut);
@@ -1206,20 +1050,18 @@ void interceptor_ICJI::getEEInfo(
LPCWSTR interceptor_ICJI::getJitTimeLogFilename()
{
mcs->AddCall("getJitTimeLogFilename");
- return original_ICorJitInfo->getJitTimeLogFilename();
+ return original_ICorJitInfo->getJitTimeLogFilename();
}
- /*********************************************************************************/
- //
- // Diagnostic methods
- //
- /*********************************************************************************/
+/*********************************************************************************/
+//
+// Diagnostic methods
+//
+/*********************************************************************************/
// this function is for debugging only. Returns method token.
// Returns mdMethodDefNil for dynamic methods.
-mdMethodDef interceptor_ICJI::getMethodDefFromMethod(
- CORINFO_METHOD_HANDLE hMethod
- )
+mdMethodDef interceptor_ICJI::getMethodDefFromMethod(CORINFO_METHOD_HANDLE hMethod)
{
mcs->AddCall("getMethodDefFromMethod");
return original_ICorJitInfo->getMethodDefFromMethod(hMethod);
@@ -1228,10 +1070,9 @@ mdMethodDef interceptor_ICJI::getMethodDefFromMethod(
// 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* interceptor_ICJI::getMethodName (
- CORINFO_METHOD_HANDLE ftn, /* IN */
- const char **moduleName /* OUT */
- )
+const char* interceptor_ICJI::getMethodName(CORINFO_METHOD_HANDLE ftn, /* IN */
+ const char** moduleName /* OUT */
+ )
{
mcs->AddCall("getMethodName");
return original_ICorJitInfo->getMethodName(ftn, moduleName);
@@ -1240,71 +1081,59 @@ const char* interceptor_ICJI::getMethodName (
// 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 interceptor_ICJI::getMethodHash (
- CORINFO_METHOD_HANDLE ftn /* IN */
- )
+unsigned interceptor_ICJI::getMethodHash(CORINFO_METHOD_HANDLE ftn /* IN */
+ )
{
mcs->AddCall("getMethodHash");
return original_ICorJitInfo->getMethodHash(ftn);
}
// this function is for debugging only.
-size_t interceptor_ICJI::findNameOfToken (
- CORINFO_MODULE_HANDLE module, /* IN */
- mdToken metaTOK, /* IN */
- __out_ecount (FQNameCapacity) char * szFQName, /* OUT */
- size_t FQNameCapacity /* IN */
- )
+size_t interceptor_ICJI::findNameOfToken(CORINFO_MODULE_HANDLE module, /* IN */
+ mdToken metaTOK, /* IN */
+ __out_ecount(FQNameCapacity) char* szFQName, /* OUT */
+ size_t FQNameCapacity /* IN */
+ )
{
mcs->AddCall("findNameOfToken");
return original_ICorJitInfo->findNameOfToken(module, metaTOK, szFQName, FQNameCapacity);
}
bool interceptor_ICJI::getSystemVAmd64PassStructInRegisterDescriptor(
- /* IN */ CORINFO_CLASS_HANDLE structHnd,
- /* OUT */ SYSTEMV_AMD64_CORINFO_STRUCT_REG_PASSING_DESCRIPTOR* structPassInRegDescPtr
- )
+ /* IN */ CORINFO_CLASS_HANDLE structHnd,
+ /* OUT */ SYSTEMV_AMD64_CORINFO_STRUCT_REG_PASSING_DESCRIPTOR* structPassInRegDescPtr)
{
mcs->AddCall("getSystemVAmd64PassStructInRegisterDescriptor");
return original_ICorJitInfo->getSystemVAmd64PassStructInRegisterDescriptor(structHnd, structPassInRegDescPtr);
}
-//Stuff on ICorDynamicInfo
-DWORD interceptor_ICJI::getThreadTLSIndex(
- void **ppIndirection
- )
+// Stuff on ICorDynamicInfo
+DWORD interceptor_ICJI::getThreadTLSIndex(void** ppIndirection)
{
mcs->AddCall("getThreadTLSIndex");
return original_ICorJitInfo->getThreadTLSIndex(ppIndirection);
}
-const void * interceptor_ICJI::getInlinedCallFrameVptr(
- void **ppIndirection
- )
+const void* interceptor_ICJI::getInlinedCallFrameVptr(void** ppIndirection)
{
mcs->AddCall("getInlinedCallFrameVptr");
return original_ICorJitInfo->getInlinedCallFrameVptr(ppIndirection);
}
-LONG * interceptor_ICJI::getAddrOfCaptureThreadGlobal(
- void **ppIndirection
- )
+LONG* interceptor_ICJI::getAddrOfCaptureThreadGlobal(void** ppIndirection)
{
mcs->AddCall("getAddrOfCaptureThreadGlobal");
return original_ICorJitInfo->getAddrOfCaptureThreadGlobal(ppIndirection);
}
-SIZE_T* interceptor_ICJI::getAddrModuleDomainID(CORINFO_MODULE_HANDLE module)
+SIZE_T* interceptor_ICJI::getAddrModuleDomainID(CORINFO_MODULE_HANDLE module)
{
mcs->AddCall("getAddrModuleDomainID");
return original_ICorJitInfo->getAddrModuleDomainID(module);
}
// return the native entry point to an EE helper (see CorInfoHelpFunc)
-void* interceptor_ICJI::getHelperFtn (
- CorInfoHelpFunc ftnNum,
- void **ppIndirection
- )
+void* interceptor_ICJI::getHelperFtn(CorInfoHelpFunc ftnNum, void** ppIndirection)
{
mcs->AddCall("getHelperFtn");
return original_ICorJitInfo->getHelperFtn(ftnNum, ppIndirection);
@@ -1313,10 +1142,9 @@ void* interceptor_ICJI::getHelperFtn (
// 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 interceptor_ICJI::getFunctionEntryPoint(
- CORINFO_METHOD_HANDLE ftn, /* IN */
- CORINFO_CONST_LOOKUP * pResult, /* OUT */
- CORINFO_ACCESS_FLAGS accessFlags)
+void interceptor_ICJI::getFunctionEntryPoint(CORINFO_METHOD_HANDLE ftn, /* IN */
+ CORINFO_CONST_LOOKUP* pResult, /* OUT */
+ CORINFO_ACCESS_FLAGS accessFlags)
{
mcs->AddCall("getFunctionEntryPoint");
original_ICorJitInfo->getFunctionEntryPoint(ftn, pResult, accessFlags);
@@ -1325,19 +1153,14 @@ void interceptor_ICJI::getFunctionEntryPoint(
// 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 interceptor_ICJI::getFunctionFixedEntryPoint(
- CORINFO_METHOD_HANDLE ftn,
- CORINFO_CONST_LOOKUP * pResult)
+void interceptor_ICJI::getFunctionFixedEntryPoint(CORINFO_METHOD_HANDLE ftn, CORINFO_CONST_LOOKUP* pResult)
{
mcs->AddCall("getFunctionFixedEntryPoint");
original_ICorJitInfo->getFunctionFixedEntryPoint(ftn, pResult);
}
// get the synchronization handle that is passed to monXstatic function
-void* interceptor_ICJI::getMethodSync(
- CORINFO_METHOD_HANDLE ftn,
- void **ppIndirection
- )
+void* interceptor_ICJI::getMethodSync(CORINFO_METHOD_HANDLE ftn, void** ppIndirection)
{
mcs->AddCall("getMethodSync");
return original_ICorJitInfo->getMethodSync(ftn, ppIndirection);
@@ -1349,45 +1172,31 @@ void* interceptor_ICJI::getMethodSync(
// get slow lazy string literal helper to use (CORINFO_HELP_STRCNS*).
// Returns CORINFO_HELP_UNDEF if lazy string literal helper cannot be used.
-CorInfoHelpFunc interceptor_ICJI::getLazyStringLiteralHelper(
- CORINFO_MODULE_HANDLE handle
- )
+CorInfoHelpFunc interceptor_ICJI::getLazyStringLiteralHelper(CORINFO_MODULE_HANDLE handle)
{
mcs->AddCall("getLazyStringLiteralHelper");
return original_ICorJitInfo->getLazyStringLiteralHelper(handle);
}
-CORINFO_MODULE_HANDLE interceptor_ICJI::embedModuleHandle(
- CORINFO_MODULE_HANDLE handle,
- void **ppIndirection
- )
+CORINFO_MODULE_HANDLE interceptor_ICJI::embedModuleHandle(CORINFO_MODULE_HANDLE handle, void** ppIndirection)
{
mcs->AddCall("embedModuleHandle");
return original_ICorJitInfo->embedModuleHandle(handle, ppIndirection);
}
-CORINFO_CLASS_HANDLE interceptor_ICJI::embedClassHandle(
- CORINFO_CLASS_HANDLE handle,
- void **ppIndirection
- )
+CORINFO_CLASS_HANDLE interceptor_ICJI::embedClassHandle(CORINFO_CLASS_HANDLE handle, void** ppIndirection)
{
mcs->AddCall("embedClassHandle");
return original_ICorJitInfo->embedClassHandle(handle, ppIndirection);
}
-CORINFO_METHOD_HANDLE interceptor_ICJI::embedMethodHandle(
- CORINFO_METHOD_HANDLE handle,
- void **ppIndirection
- )
+CORINFO_METHOD_HANDLE interceptor_ICJI::embedMethodHandle(CORINFO_METHOD_HANDLE handle, void** ppIndirection)
{
mcs->AddCall("embedMethodHandle");
return original_ICorJitInfo->embedMethodHandle(handle, ppIndirection);
}
-CORINFO_FIELD_HANDLE interceptor_ICJI::embedFieldHandle(
- CORINFO_FIELD_HANDLE handle,
- void **ppIndirection
- )
+CORINFO_FIELD_HANDLE interceptor_ICJI::embedFieldHandle(CORINFO_FIELD_HANDLE handle, void** ppIndirection)
{
mcs->AddCall("embedFieldHandle");
return original_ICorJitInfo->embedFieldHandle(handle, ppIndirection);
@@ -1400,10 +1209,10 @@ CORINFO_FIELD_HANDLE interceptor_ICJI::embedFieldHandle(
// code is shared and the token contains generic parameters)
// then indicate how the handle should be looked up at run-time.
//
-void interceptor_ICJI::embedGenericHandle(
- CORINFO_RESOLVED_TOKEN * pResolvedToken,
- BOOL fEmbedParent, // TRUE - embeds parent type handle of the field/method handle
- CORINFO_GENERICHANDLE_RESULT * pResult)
+void interceptor_ICJI::embedGenericHandle(CORINFO_RESOLVED_TOKEN* pResolvedToken,
+ BOOL fEmbedParent, // TRUE - embeds parent type handle of the field/method
+ // handle
+ CORINFO_GENERICHANDLE_RESULT* pResult)
{
mcs->AddCall("embedGenericHandle");
original_ICorJitInfo->embedGenericHandle(pResolvedToken, fEmbedParent, pResult);
@@ -1416,39 +1225,28 @@ void interceptor_ICJI::embedGenericHandle(
// 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 interceptor_ICJI::getLocationOfThisType(
- CORINFO_METHOD_HANDLE context
- )
+CORINFO_LOOKUP_KIND interceptor_ICJI::getLocationOfThisType(CORINFO_METHOD_HANDLE context)
{
mcs->AddCall("getLocationOfThisType");
return original_ICorJitInfo->getLocationOfThisType(context);
}
// return the unmanaged target *if method has already been prelinked.*
-void* interceptor_ICJI::getPInvokeUnmanagedTarget(
- CORINFO_METHOD_HANDLE method,
- void **ppIndirection
- )
+void* interceptor_ICJI::getPInvokeUnmanagedTarget(CORINFO_METHOD_HANDLE method, void** ppIndirection)
{
mcs->AddCall("getPInvokeUnmanagedTarget");
return original_ICorJitInfo->getPInvokeUnmanagedTarget(method, ppIndirection);
}
// return address of fixup area for late-bound PInvoke calls.
-void* interceptor_ICJI::getAddressOfPInvokeFixup(
- CORINFO_METHOD_HANDLE method,
- void **ppIndirection
- )
+void* interceptor_ICJI::getAddressOfPInvokeFixup(CORINFO_METHOD_HANDLE method, void** ppIndirection)
{
mcs->AddCall("getAddressOfPInvokeFixup");
return original_ICorJitInfo->getAddressOfPInvokeFixup(method, ppIndirection);
}
// return address of fixup area for late-bound PInvoke calls.
-void interceptor_ICJI::getAddressOfPInvokeTarget(
- CORINFO_METHOD_HANDLE method,
- CORINFO_CONST_LOOKUP *pLookup
- )
+void interceptor_ICJI::getAddressOfPInvokeTarget(CORINFO_METHOD_HANDLE method, CORINFO_CONST_LOOKUP* pLookup)
{
mcs->AddCall("getAddressOfPInvokeTarget");
original_ICorJitInfo->getAddressOfPInvokeTarget(method, pLookup);
@@ -1456,10 +1254,7 @@ void interceptor_ICJI::getAddressOfPInvokeTarget(
// Generate a cookie based on the signature that would needs to be passed
// to CORINFO_HELP_PINVOKE_CALLI
-LPVOID interceptor_ICJI::GetCookieForPInvokeCalliSig(
- CORINFO_SIG_INFO* szMetaSig,
- void ** ppIndirection
- )
+LPVOID interceptor_ICJI::GetCookieForPInvokeCalliSig(CORINFO_SIG_INFO* szMetaSig, void** ppIndirection)
{
mcs->AddCall("GetCookieForPInvokeCalliSig");
return original_ICorJitInfo->GetCookieForPInvokeCalliSig(szMetaSig, ppIndirection);
@@ -1467,9 +1262,7 @@ LPVOID interceptor_ICJI::GetCookieForPInvokeCalliSig(
// 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 interceptor_ICJI::canGetCookieForPInvokeCalliSig(
- CORINFO_SIG_INFO* szMetaSig
- )
+bool interceptor_ICJI::canGetCookieForPInvokeCalliSig(CORINFO_SIG_INFO* szMetaSig)
{
mcs->AddCall("canGetCookieForPInvokeCalliSig");
return original_ICorJitInfo->canGetCookieForPInvokeCalliSig(szMetaSig);
@@ -1477,10 +1270,8 @@ bool interceptor_ICJI::canGetCookieForPInvokeCalliSig(
// Gets a handle that is checked to see if the current method is
// included in "JustMyCode"
-CORINFO_JUST_MY_CODE_HANDLE interceptor_ICJI::getJustMyCodeHandle(
- CORINFO_METHOD_HANDLE method,
- CORINFO_JUST_MY_CODE_HANDLE**ppIndirection
- )
+CORINFO_JUST_MY_CODE_HANDLE interceptor_ICJI::getJustMyCodeHandle(CORINFO_METHOD_HANDLE method,
+ CORINFO_JUST_MY_CODE_HANDLE** ppIndirection)
{
mcs->AddCall("getJustMyCodeHandle");
return original_ICorJitInfo->getJustMyCodeHandle(method, ppIndirection);
@@ -1489,11 +1280,7 @@ CORINFO_JUST_MY_CODE_HANDLE interceptor_ICJI::getJustMyCodeHandle(
// 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 interceptor_ICJI::GetProfilingHandle(
- BOOL *pbHookFunction,
- void **pProfilerHandle,
- BOOL *pbIndirectedHandles
- )
+void interceptor_ICJI::GetProfilingHandle(BOOL* pbHookFunction, void** pProfilerHandle, BOOL* pbIndirectedHandles)
{
mcs->AddCall("GetProfilingHandle");
original_ICorJitInfo->GetProfilingHandle(pbHookFunction, pProfilerHandle, pbIndirectedHandles);
@@ -1501,28 +1288,26 @@ void interceptor_ICJI::GetProfilingHandle(
// Returns instructions on how to make the call. See code:CORINFO_CALL_INFO for possible return values.
void interceptor_ICJI::getCallInfo(
- // Token info
- CORINFO_RESOLVED_TOKEN * pResolvedToken,
+ // Token info
+ CORINFO_RESOLVED_TOKEN* pResolvedToken,
- //Generics info
- CORINFO_RESOLVED_TOKEN * pConstrainedResolvedToken,
+ // Generics info
+ CORINFO_RESOLVED_TOKEN* pConstrainedResolvedToken,
- //Security info
- CORINFO_METHOD_HANDLE callerHandle,
+ // Security info
+ CORINFO_METHOD_HANDLE callerHandle,
- //Jit info
- CORINFO_CALLINFO_FLAGS flags,
+ // Jit info
+ CORINFO_CALLINFO_FLAGS flags,
- //out params
- CORINFO_CALL_INFO *pResult
- )
+ // out params
+ CORINFO_CALL_INFO* pResult)
{
mcs->AddCall("getCallInfo");
original_ICorJitInfo->getCallInfo(pResolvedToken, pConstrainedResolvedToken, callerHandle, flags, pResult);
}
-BOOL interceptor_ICJI::canAccessFamily(CORINFO_METHOD_HANDLE hCaller,
- CORINFO_CLASS_HANDLE hInstanceType)
+BOOL interceptor_ICJI::canAccessFamily(CORINFO_METHOD_HANDLE hCaller, CORINFO_CLASS_HANDLE hInstanceType)
{
mcs->AddCall("canAccessFamily");
@@ -1537,31 +1322,21 @@ BOOL interceptor_ICJI::isRIDClassDomainID(CORINFO_CLASS_HANDLE cls)
}
// returns the class's domain ID for accessing shared statics
-unsigned interceptor_ICJI::getClassDomainID (
- CORINFO_CLASS_HANDLE cls,
- void **ppIndirection
- )
+unsigned interceptor_ICJI::getClassDomainID(CORINFO_CLASS_HANDLE cls, void** ppIndirection)
{
mcs->AddCall("getClassDomainID");
return original_ICorJitInfo->getClassDomainID(cls, ppIndirection);
}
-
// return the data's address (for static fields only)
-void* interceptor_ICJI::getFieldAddress(
- CORINFO_FIELD_HANDLE field,
- void **ppIndirection
- )
+void* interceptor_ICJI::getFieldAddress(CORINFO_FIELD_HANDLE field, void** ppIndirection)
{
mcs->AddCall("getFieldAddress");
return original_ICorJitInfo->getFieldAddress(field, ppIndirection);
}
// registers a vararg sig & returns a VM cookie for it (which can contain other stuff)
-CORINFO_VARARGS_HANDLE interceptor_ICJI::getVarArgsHandle(
- CORINFO_SIG_INFO *pSig,
- void **ppIndirection
- )
+CORINFO_VARARGS_HANDLE interceptor_ICJI::getVarArgsHandle(CORINFO_SIG_INFO* pSig, void** ppIndirection)
{
mcs->AddCall("getVarArgsHandle");
return original_ICorJitInfo->getVarArgsHandle(pSig, ppIndirection);
@@ -1569,28 +1344,20 @@ CORINFO_VARARGS_HANDLE interceptor_ICJI::getVarArgsHandle(
// 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 interceptor_ICJI::canGetVarArgsHandle(
- CORINFO_SIG_INFO *pSig
- )
+bool interceptor_ICJI::canGetVarArgsHandle(CORINFO_SIG_INFO* pSig)
{
mcs->AddCall("canGetVarArgsHandle");
return original_ICorJitInfo->canGetVarArgsHandle(pSig);
}
// Allocate a string literal on the heap and return a handle to it
-InfoAccessType interceptor_ICJI::constructStringLiteral(
- CORINFO_MODULE_HANDLE module,
- mdToken metaTok,
- void **ppValue
- )
+InfoAccessType interceptor_ICJI::constructStringLiteral(CORINFO_MODULE_HANDLE module, mdToken metaTok, void** ppValue)
{
mcs->AddCall("constructStringLiteral");
return original_ICorJitInfo->constructStringLiteral(module, metaTok, ppValue);
}
-InfoAccessType interceptor_ICJI::emptyStringLiteral(
- void **ppValue
- )
+InfoAccessType interceptor_ICJI::emptyStringLiteral(void** ppValue)
{
mcs->AddCall("emptyStringLiteral");
return original_ICorJitInfo->emptyStringLiteral(ppValue);
@@ -1599,20 +1366,14 @@ InfoAccessType interceptor_ICJI::emptyStringLiteral(
// (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 interceptor_ICJI::getFieldThreadLocalStoreID (
- CORINFO_FIELD_HANDLE field,
- void **ppIndirection
- )
+DWORD interceptor_ICJI::getFieldThreadLocalStoreID(CORINFO_FIELD_HANDLE field, void** ppIndirection)
{
mcs->AddCall("getFieldThreadLocalStoreID");
return original_ICorJitInfo->getFieldThreadLocalStoreID(field, ppIndirection);
}
// Sets another object to intercept calls to "self" and current method being compiled
-void interceptor_ICJI::setOverride(
- ICorDynamicInfo *pOverride,
- CORINFO_METHOD_HANDLE currentMethod
- )
+void interceptor_ICJI::setOverride(ICorDynamicInfo* pOverride, CORINFO_METHOD_HANDLE currentMethod)
{
mcs->AddCall("setOverride");
original_ICorJitInfo->setOverride(pOverride, currentMethod);
@@ -1620,45 +1381,35 @@ void interceptor_ICJI::setOverride(
// 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 interceptor_ICJI::addActiveDependency(
- CORINFO_MODULE_HANDLE moduleFrom,
- CORINFO_MODULE_HANDLE moduleTo
- )
+void interceptor_ICJI::addActiveDependency(CORINFO_MODULE_HANDLE moduleFrom, CORINFO_MODULE_HANDLE moduleTo)
{
mcs->AddCall("addActiveDependency");
original_ICorJitInfo->addActiveDependency(moduleFrom, moduleTo);
}
-CORINFO_METHOD_HANDLE interceptor_ICJI::GetDelegateCtor(
- CORINFO_METHOD_HANDLE methHnd,
- CORINFO_CLASS_HANDLE clsHnd,
- CORINFO_METHOD_HANDLE targetMethodHnd,
- DelegateCtorArgs * pCtorData
- )
+CORINFO_METHOD_HANDLE interceptor_ICJI::GetDelegateCtor(CORINFO_METHOD_HANDLE methHnd,
+ CORINFO_CLASS_HANDLE clsHnd,
+ CORINFO_METHOD_HANDLE targetMethodHnd,
+ DelegateCtorArgs* pCtorData)
{
mcs->AddCall("GetDelegateCtor");
return original_ICorJitInfo->GetDelegateCtor(methHnd, clsHnd, targetMethodHnd, pCtorData);
}
-void interceptor_ICJI::MethodCompileComplete(
- CORINFO_METHOD_HANDLE methHnd
- )
+void interceptor_ICJI::MethodCompileComplete(CORINFO_METHOD_HANDLE methHnd)
{
mcs->AddCall("MethodCompileComplete");
original_ICorJitInfo->MethodCompileComplete(methHnd);
}
// return a thunk that will copy the arguments for the given signature.
-void* interceptor_ICJI::getTailCallCopyArgsThunk (
- CORINFO_SIG_INFO *pSig,
- CorInfoHelperTailCallSpecialHandling flags
- )
+void* interceptor_ICJI::getTailCallCopyArgsThunk(CORINFO_SIG_INFO* pSig, CorInfoHelperTailCallSpecialHandling flags)
{
mcs->AddCall("getTailCallCopyArgsThunk");
return original_ICorJitInfo->getTailCallCopyArgsThunk(pSig, flags);
}
-//Stuff directly on ICorJitInfo
+// Stuff directly on ICorJitInfo
// Returns extended flags for a particular compilation instance.
DWORD interceptor_ICJI::getJitFlags(CORJIT_FLAGS* jitFlags, DWORD sizeInBytes)
@@ -1672,7 +1423,7 @@ DWORD interceptor_ICJI::getJitFlags(CORJIT_FLAGS* jitFlags, DWORD sizeInBytes)
// record the results of the call: when this call gets played back,
// its result will depend on whether or not `function` calls something
// that throws at playback time rather than at capture time.
-bool interceptor_ICJI::runWithErrorTrap(void (*function)(void*), void *param)
+bool interceptor_ICJI::runWithErrorTrap(void (*function)(void*), void* param)
{
mcs->AddCall("runWithErrorTrap");
return original_ICorJitInfo->runWithErrorTrap(function, param);
@@ -1682,26 +1433,26 @@ bool interceptor_ICJI::runWithErrorTrap(void (*function)(void*), void *param)
IEEMemoryManager* interceptor_ICJI::getMemoryManager()
{
mcs->AddCall("getMemoryManager");
- if(current_IEEMM->original_IEEMM == nullptr)
+ if (current_IEEMM->original_IEEMM == nullptr)
current_IEEMM->original_IEEMM = original_ICorJitInfo->getMemoryManager();
return current_IEEMM;
}
// get a block of memory for the code, readonly data, and read-write data
-void interceptor_ICJI::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 */
- )
+void interceptor_ICJI::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 */
+ )
{
mcs->AddCall("allocMem");
- return original_ICorJitInfo->allocMem(hotCodeSize, coldCodeSize, roDataSize, xcptnsCount, flag, hotCodeBlock, coldCodeBlock, roDataBlock);
+ return original_ICorJitInfo->allocMem(hotCodeSize, coldCodeSize, roDataSize, xcptnsCount, flag, hotCodeBlock,
+ coldCodeBlock, roDataBlock);
}
// Reserve memory for the method/funclet's unwind information.
@@ -1715,11 +1466,10 @@ void interceptor_ICJI::allocMem (
// For prejitted code we split up the unwinding information into
// separate sections .rdata and .pdata.
//
-void interceptor_ICJI::reserveUnwindInfo (
- BOOL isFunclet, /* IN */
- BOOL isColdCode, /* IN */
- ULONG unwindSize /* IN */
- )
+void interceptor_ICJI::reserveUnwindInfo(BOOL isFunclet, /* IN */
+ BOOL isColdCode, /* IN */
+ ULONG unwindSize /* IN */
+ )
{
mcs->AddCall("reserveUnwindInfo");
original_ICorJitInfo->reserveUnwindInfo(isFunclet, isColdCode, unwindSize);
@@ -1742,33 +1492,32 @@ void interceptor_ICJI::reserveUnwindInfo (
// pUnwindBlock pointer to unwind info
// funcKind type of funclet (main method code, handler, filter)
//
-void interceptor_ICJI::allocUnwindInfo (
- BYTE * pHotCode, /* IN */
- BYTE * pColdCode, /* IN */
- ULONG startOffset, /* IN */
- ULONG endOffset, /* IN */
- ULONG unwindSize, /* IN */
- BYTE * pUnwindBlock, /* IN */
- CorJitFuncKind funcKind /* IN */
- )
+void interceptor_ICJI::allocUnwindInfo(BYTE* pHotCode, /* IN */
+ BYTE* pColdCode, /* IN */
+ ULONG startOffset, /* IN */
+ ULONG endOffset, /* IN */
+ ULONG unwindSize, /* IN */
+ BYTE* pUnwindBlock, /* IN */
+ CorJitFuncKind funcKind /* IN */
+ )
{
mcs->AddCall("allocUnwindInfo");
- original_ICorJitInfo->allocUnwindInfo(pHotCode, pColdCode, startOffset, endOffset, unwindSize, pUnwindBlock, funcKind);
+ original_ICorJitInfo->allocUnwindInfo(pHotCode, pColdCode, startOffset, endOffset, unwindSize, pUnwindBlock,
+ funcKind);
}
// 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 * interceptor_ICJI::allocGCInfo (
- size_t size /* IN */
- )
+void* interceptor_ICJI::allocGCInfo(size_t size /* IN */
+ )
{
mcs->AddCall("allocGCInfo");
return original_ICorJitInfo->allocGCInfo(size);
}
-//only used on x64
+// only used on x64
void interceptor_ICJI::yieldExecution()
{
mcs->AddCall("yieldExecution");
@@ -1778,9 +1527,8 @@ void interceptor_ICJI::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 interceptor_ICJI::setEHcount (
- unsigned cEH /* IN */
- )
+void interceptor_ICJI::setEHcount(unsigned cEH /* IN */
+ )
{
mcs->AddCall("setEHcount");
original_ICorJitInfo->setEHcount(cEH);
@@ -1791,10 +1539,9 @@ void interceptor_ICJI::setEHcount (
// Handler regions should be lexically contiguous.
// This is because FinallyIsUnwinding() uses lexicality to
// determine if a "finally" clause is executing.
-void interceptor_ICJI::setEHinfo (
- unsigned EHnumber, /* IN */
- const CORINFO_EH_CLAUSE *clause /* IN */
- )
+void interceptor_ICJI::setEHinfo(unsigned EHnumber, /* IN */
+ const CORINFO_EH_CLAUSE* clause /* IN */
+ )
{
mcs->AddCall("setEHinfo");
original_ICorJitInfo->setEHinfo(EHnumber, clause);
@@ -1833,10 +1580,8 @@ struct ProfileBuffer // Also defined here: code:CORBBTPROF_BLOCK_DATA
// allocate a basic block profile buffer where execution counts will be stored
// for jitted basic blocks.
-HRESULT interceptor_ICJI::allocBBProfileBuffer (
- ULONG count, // The number of basic blocks that we have
- ProfileBuffer ** profileBuffer
- )
+HRESULT interceptor_ICJI::allocBBProfileBuffer(ULONG count, // The number of basic blocks that we have
+ ProfileBuffer** profileBuffer)
{
mcs->AddCall("allocBBProfileBuffer");
return original_ICorJitInfo->allocBBProfileBuffer(count, profileBuffer);
@@ -1844,12 +1589,10 @@ HRESULT interceptor_ICJI::allocBBProfileBuffer (
// 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 interceptor_ICJI::getBBProfileData(
- CORINFO_METHOD_HANDLE ftnHnd,
- ULONG * count, // The number of basic blocks that we have
- ProfileBuffer ** profileBuffer,
- ULONG * numRuns
- )
+HRESULT interceptor_ICJI::getBBProfileData(CORINFO_METHOD_HANDLE ftnHnd,
+ ULONG* count, // The number of basic blocks that we have
+ ProfileBuffer** profileBuffer,
+ ULONG* numRuns)
{
mcs->AddCall("getBBProfileData");
return original_ICorJitInfo->getBBProfileData(ftnHnd, count, profileBuffer, numRuns);
@@ -1859,11 +1602,10 @@ HRESULT interceptor_ICJI::getBBProfileData(
// 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 interceptor_ICJI::recordCallSite(
- ULONG instrOffset, /* IN */
- CORINFO_SIG_INFO * callSig, /* IN */
- CORINFO_METHOD_HANDLE methodHandle /* IN */
- )
+void interceptor_ICJI::recordCallSite(ULONG instrOffset, /* IN */
+ CORINFO_SIG_INFO* callSig, /* IN */
+ CORINFO_METHOD_HANDLE methodHandle /* IN */
+ )
{
mcs->AddCall("recordCallSite");
return original_ICorJitInfo->recordCallSite(instrOffset, callSig, methodHandle);
@@ -1871,19 +1613,18 @@ void interceptor_ICJI::recordCallSite(
// A relocation is recorded if we are pre-jitting.
// A jump thunk may be inserted if we are jitting
-void interceptor_ICJI::recordRelocation(
- void * location, /* IN */
- void * target, /* IN */
- WORD fRelocType, /* IN */
- WORD slotNum, /* IN */
- INT32 addlDelta /* IN */
- )
+void interceptor_ICJI::recordRelocation(void* location, /* IN */
+ void* target, /* IN */
+ WORD fRelocType, /* IN */
+ WORD slotNum, /* IN */
+ INT32 addlDelta /* IN */
+ )
{
mcs->AddCall("recordRelocation");
original_ICorJitInfo->recordRelocation(location, target, fRelocType, slotNum, addlDelta);
}
-WORD interceptor_ICJI::getRelocTypeHint(void * target)
+WORD interceptor_ICJI::getRelocTypeHint(void* target)
{
mcs->AddCall("getRelocTypeHint");
return original_ICorJitInfo->getRelocTypeHint(target);
@@ -1892,10 +1633,9 @@ WORD interceptor_ICJI::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 interceptor_ICJI::getModuleNativeEntryPointRange(
- void ** pStart, /* OUT */
- void ** pEnd /* OUT */
- )
+void interceptor_ICJI::getModuleNativeEntryPointRange(void** pStart, /* OUT */
+ void** pEnd /* OUT */
+ )
{
mcs->AddCall("getModuleNativeEntryPointRange");
original_ICorJitInfo->getModuleNativeEntryPointRange(pStart, pEnd);
diff --git a/src/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.h b/src/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.h
index ab90cfc646..ce269cc06c 100644
--- a/src/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.h
+++ b/src/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.h
@@ -16,11 +16,10 @@ class interceptor_ICJI : public ICorJitInfo
#include "icorjitinfoimpl.h"
public:
-
- //Added to help us track the original icji and be able to easily indirect
- //to it. And a simple way to keep one memory manager instance per instance.
- ICorJitInfo *original_ICorJitInfo;
- MethodCallSummarizer *mcs;
+ // Added to help us track the original icji and be able to easily indirect
+ //to it. And a simple way to keep one memory manager instance per instance.
+ ICorJitInfo* original_ICorJitInfo;
+ MethodCallSummarizer* mcs;
};
#endif
diff --git a/src/ToolBox/superpmi/superpmi-shim-counter/ieememorymanager.cpp b/src/ToolBox/superpmi/superpmi-shim-counter/ieememorymanager.cpp
index 863d542202..24efbce4f4 100644
--- a/src/ToolBox/superpmi/superpmi-shim-counter/ieememorymanager.cpp
+++ b/src/ToolBox/superpmi/superpmi-shim-counter/ieememorymanager.cpp
@@ -10,7 +10,7 @@
//***************************************************************************
// IUnknown methods
//***************************************************************************
-HRESULT STDMETHODCALLTYPE interceptor_IEEMM::QueryInterface(REFIID id, void **pInterface)
+HRESULT STDMETHODCALLTYPE interceptor_IEEMM::QueryInterface(REFIID id, void** pInterface)
{
return original_IEEMM->QueryInterface(id, pInterface);
}
@@ -26,7 +26,10 @@ ULONG STDMETHODCALLTYPE interceptor_IEEMM::Release()
//***************************************************************************
// IEEMemoryManager methods for locking
//***************************************************************************
-LPVOID STDMETHODCALLTYPE interceptor_IEEMM::ClrVirtualAlloc(LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect)
+LPVOID STDMETHODCALLTYPE interceptor_IEEMM::ClrVirtualAlloc(LPVOID lpAddress,
+ SIZE_T dwSize,
+ DWORD flAllocationType,
+ DWORD flProtect)
{
return original_IEEMM->ClrVirtualAlloc(lpAddress, dwSize, flAllocationType, flProtect);
}
@@ -34,11 +37,16 @@ BOOL STDMETHODCALLTYPE interceptor_IEEMM::ClrVirtualFree(LPVOID lpAddress, SIZE_
{
return original_IEEMM->ClrVirtualFree(lpAddress, dwSize, dwFreeType);
}
-SIZE_T STDMETHODCALLTYPE interceptor_IEEMM::ClrVirtualQuery(LPCVOID lpAddress, PMEMORY_BASIC_INFORMATION lpBuffer, SIZE_T dwLength)
+SIZE_T STDMETHODCALLTYPE interceptor_IEEMM::ClrVirtualQuery(LPCVOID lpAddress,
+ PMEMORY_BASIC_INFORMATION lpBuffer,
+ SIZE_T dwLength)
{
return original_IEEMM->ClrVirtualQuery(lpAddress, lpBuffer, dwLength);
}
-BOOL STDMETHODCALLTYPE interceptor_IEEMM::ClrVirtualProtect(LPVOID lpAddress, SIZE_T dwSize, DWORD flNewProtect, PDWORD lpflOldProtect)
+BOOL STDMETHODCALLTYPE interceptor_IEEMM::ClrVirtualProtect(LPVOID lpAddress,
+ SIZE_T dwSize,
+ DWORD flNewProtect,
+ PDWORD lpflOldProtect)
{
return original_IEEMM->ClrVirtualProtect(lpAddress, dwSize, flNewProtect, lpflOldProtect);
}
diff --git a/src/ToolBox/superpmi/superpmi-shim-counter/ieememorymanager.h b/src/ToolBox/superpmi/superpmi-shim-counter/ieememorymanager.h
index 4a72e809ee..28e8539591 100644
--- a/src/ToolBox/superpmi/superpmi-shim-counter/ieememorymanager.h
+++ b/src/ToolBox/superpmi/superpmi-shim-counter/ieememorymanager.h
@@ -76,12 +76,11 @@ interface IEEMemoryManager : IUnknown
class interceptor_IEEMM : public IEEMemoryManager
{
private:
-
//***************************************************************************
// IUnknown methods
//***************************************************************************
- HRESULT STDMETHODCALLTYPE QueryInterface(REFIID id, void **pInterface);
+ HRESULT STDMETHODCALLTYPE QueryInterface(REFIID id, void** pInterface);
ULONG STDMETHODCALLTYPE AddRef();
ULONG STDMETHODCALLTYPE Release();
@@ -91,7 +90,10 @@ private:
LPVOID STDMETHODCALLTYPE ClrVirtualAlloc(LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect);
BOOL STDMETHODCALLTYPE ClrVirtualFree(LPVOID lpAddress, SIZE_T dwSize, DWORD dwFreeType);
SIZE_T STDMETHODCALLTYPE ClrVirtualQuery(LPCVOID lpAddress, PMEMORY_BASIC_INFORMATION lpBuffer, SIZE_T dwLength);
- BOOL STDMETHODCALLTYPE ClrVirtualProtect(LPVOID lpAddress, SIZE_T dwSize, DWORD flNewProtect, PDWORD lpflOldProtect);
+ BOOL STDMETHODCALLTYPE ClrVirtualProtect(LPVOID lpAddress,
+ SIZE_T dwSize,
+ DWORD flNewProtect,
+ PDWORD lpflOldProtect);
HANDLE STDMETHODCALLTYPE ClrGetProcessHeap();
HANDLE STDMETHODCALLTYPE ClrHeapCreate(DWORD flOptions, SIZE_T dwInitialSize, SIZE_T dwMaximumSize);
BOOL STDMETHODCALLTYPE ClrHeapDestroy(HANDLE hHeap);
@@ -101,7 +103,7 @@ private:
HANDLE STDMETHODCALLTYPE ClrGetProcessExecutableHeap();
public:
- IEEMemoryManager *original_IEEMM;
+ IEEMemoryManager* original_IEEMM;
};
#endif
diff --git a/src/ToolBox/superpmi/superpmi-shim-counter/iexecutionengine.cpp b/src/ToolBox/superpmi/superpmi-shim-counter/iexecutionengine.cpp
index 0e2a311ed3..7e882bb396 100644
--- a/src/ToolBox/superpmi/superpmi-shim-counter/iexecutionengine.cpp
+++ b/src/ToolBox/superpmi/superpmi-shim-counter/iexecutionengine.cpp
@@ -10,7 +10,7 @@
//***************************************************************************
// IUnknown methods
//***************************************************************************
-HRESULT STDMETHODCALLTYPE interceptor_IEE::QueryInterface(REFIID id, void **pInterface)
+HRESULT STDMETHODCALLTYPE interceptor_IEE::QueryInterface(REFIID id, void** pInterface)
{
return original_IEE->QueryInterface(id, pInterface);
}
@@ -27,7 +27,7 @@ ULONG STDMETHODCALLTYPE interceptor_IEE::Release()
// IExecutionEngine methods for TLS
//***************************************************************************
// Associate a callback for cleanup with a TLS slot
-VOID STDMETHODCALLTYPE interceptor_IEE::TLS_AssociateCallback(DWORD slot, PTLS_CALLBACK_FUNCTION callback)
+VOID STDMETHODCALLTYPE interceptor_IEE::TLS_AssociateCallback(DWORD slot, PTLS_CALLBACK_FUNCTION callback)
{
original_IEE->TLS_AssociateCallback(slot, callback);
}
@@ -43,7 +43,7 @@ LPVOID STDMETHODCALLTYPE interceptor_IEE::TLS_GetValue(DWORD slot)
}
// Get the value at a slot, return FALSE if TLS info block doesn't exist
-BOOL STDMETHODCALLTYPE interceptor_IEE::TLS_CheckValue(DWORD slot, LPVOID * pValue)
+BOOL STDMETHODCALLTYPE interceptor_IEE::TLS_CheckValue(DWORD slot, LPVOID* pValue)
{
return original_IEE->TLS_CheckValue(slot, pValue);
}
@@ -114,17 +114,21 @@ void STDMETHODCALLTYPE interceptor_IEE::ClrCloseSemaphore(SEMAPHORE_COOKIE semap
{
original_IEE->ClrCloseSemaphore(semaphore);
}
-DWORD STDMETHODCALLTYPE interceptor_IEE::ClrWaitForSemaphore(SEMAPHORE_COOKIE semaphore, DWORD dwMilliseconds, BOOL bAlertable)
+DWORD STDMETHODCALLTYPE interceptor_IEE::ClrWaitForSemaphore(SEMAPHORE_COOKIE semaphore,
+ DWORD dwMilliseconds,
+ BOOL bAlertable)
{
return original_IEE->ClrWaitForSemaphore(semaphore, dwMilliseconds, bAlertable);
}
-BOOL STDMETHODCALLTYPE interceptor_IEE::ClrReleaseSemaphore(SEMAPHORE_COOKIE semaphore, LONG lReleaseCount, LONG *lpPreviousCount)
+BOOL STDMETHODCALLTYPE interceptor_IEE::ClrReleaseSemaphore(SEMAPHORE_COOKIE semaphore,
+ LONG lReleaseCount,
+ LONG* lpPreviousCount)
{
return original_IEE->ClrReleaseSemaphore(semaphore, lReleaseCount, lpPreviousCount);
}
MUTEX_COOKIE STDMETHODCALLTYPE interceptor_IEE::ClrCreateMutex(LPSECURITY_ATTRIBUTES lpMutexAttributes,
- BOOL bInitialOwner,
- LPCTSTR lpName)
+ BOOL bInitialOwner,
+ LPCTSTR lpName)
{
return original_IEE->ClrCreateMutex(lpMutexAttributes, bInitialOwner, lpName);
}
@@ -136,9 +140,7 @@ BOOL STDMETHODCALLTYPE interceptor_IEE::ClrReleaseMutex(MUTEX_COOKIE mutex)
{
return original_IEE->ClrReleaseMutex(mutex);
}
-DWORD STDMETHODCALLTYPE interceptor_IEE::ClrWaitForMutex(MUTEX_COOKIE mutex,
- DWORD dwMilliseconds,
- BOOL bAlertable)
+DWORD STDMETHODCALLTYPE interceptor_IEE::ClrWaitForMutex(MUTEX_COOKIE mutex, DWORD dwMilliseconds, BOOL bAlertable)
{
return original_IEE->ClrWaitForMutex(mutex, dwMilliseconds, bAlertable);
}
@@ -151,7 +153,7 @@ BOOL STDMETHODCALLTYPE interceptor_IEE::ClrAllocationDisallowed()
{
return original_IEE->ClrAllocationDisallowed();
}
-void STDMETHODCALLTYPE interceptor_IEE::GetLastThrownObjectExceptionFromThread(void **ppvException)
+void STDMETHODCALLTYPE interceptor_IEE::GetLastThrownObjectExceptionFromThread(void** ppvException)
{
original_IEE->GetLastThrownObjectExceptionFromThread(ppvException);
}
diff --git a/src/ToolBox/superpmi/superpmi-shim-counter/iexecutionengine.h b/src/ToolBox/superpmi/superpmi-shim-counter/iexecutionengine.h
index 642c145374..e3706b4196 100644
--- a/src/ToolBox/superpmi/superpmi-shim-counter/iexecutionengine.h
+++ b/src/ToolBox/superpmi/superpmi-shim-counter/iexecutionengine.h
@@ -88,11 +88,10 @@ interface IExecutionEngine : IUnknown
class interceptor_IEE : public IExecutionEngine
{
private:
-
//***************************************************************************
// IUnknown methods
//***************************************************************************
- HRESULT STDMETHODCALLTYPE QueryInterface(REFIID id, void **pInterface);
+ HRESULT STDMETHODCALLTYPE QueryInterface(REFIID id, void** pInterface);
ULONG STDMETHODCALLTYPE AddRef();
ULONG STDMETHODCALLTYPE Release();
@@ -100,13 +99,13 @@ private:
// IExecutionEngine methods for TLS
//***************************************************************************
// Associate a callback for cleanup with a TLS slot
- VOID STDMETHODCALLTYPE TLS_AssociateCallback(DWORD slot, PTLS_CALLBACK_FUNCTION callback);
+ VOID STDMETHODCALLTYPE TLS_AssociateCallback(DWORD slot, PTLS_CALLBACK_FUNCTION callback);
// Get the TLS block for fast Get/Set operations
LPVOID* STDMETHODCALLTYPE TLS_GetDataBlock();
// Get the value at a slot
LPVOID STDMETHODCALLTYPE TLS_GetValue(DWORD slot);
// Get the value at a slot, return FALSE if TLS info block doesn't exist
- BOOL STDMETHODCALLTYPE TLS_CheckValue(DWORD slot, LPVOID * pValue);
+ BOOL STDMETHODCALLTYPE TLS_CheckValue(DWORD slot, LPVOID* pValue);
// Set the value at a slot
VOID STDMETHODCALLTYPE TLS_SetValue(DWORD slot, LPVOID pData);
// Free TLS memory block and make callback
@@ -129,21 +128,19 @@ private:
SEMAPHORE_COOKIE STDMETHODCALLTYPE ClrCreateSemaphore(DWORD dwInitial, DWORD dwMax);
void STDMETHODCALLTYPE ClrCloseSemaphore(SEMAPHORE_COOKIE semaphore);
DWORD STDMETHODCALLTYPE ClrWaitForSemaphore(SEMAPHORE_COOKIE semaphore, DWORD dwMilliseconds, BOOL bAlertable);
- BOOL STDMETHODCALLTYPE ClrReleaseSemaphore(SEMAPHORE_COOKIE semaphore, LONG lReleaseCount, LONG *lpPreviousCount);
+ BOOL STDMETHODCALLTYPE ClrReleaseSemaphore(SEMAPHORE_COOKIE semaphore, LONG lReleaseCount, LONG* lpPreviousCount);
MUTEX_COOKIE STDMETHODCALLTYPE ClrCreateMutex(LPSECURITY_ATTRIBUTES lpMutexAttributes,
- BOOL bInitialOwner,
- LPCTSTR lpName);
+ BOOL bInitialOwner,
+ LPCTSTR lpName);
void STDMETHODCALLTYPE ClrCloseMutex(MUTEX_COOKIE mutex);
BOOL STDMETHODCALLTYPE ClrReleaseMutex(MUTEX_COOKIE mutex);
- DWORD STDMETHODCALLTYPE ClrWaitForMutex(MUTEX_COOKIE mutex,
- DWORD dwMilliseconds,
- BOOL bAlertable);
+ DWORD STDMETHODCALLTYPE ClrWaitForMutex(MUTEX_COOKIE mutex, DWORD dwMilliseconds, BOOL bAlertable);
DWORD STDMETHODCALLTYPE ClrSleepEx(DWORD dwMilliseconds, BOOL bAlertable);
BOOL STDMETHODCALLTYPE ClrAllocationDisallowed();
- void STDMETHODCALLTYPE GetLastThrownObjectExceptionFromThread(void **ppvException);
+ void STDMETHODCALLTYPE GetLastThrownObjectExceptionFromThread(void** ppvException);
public:
- IExecutionEngine *original_IEE;
+ IExecutionEngine* original_IEE;
};
#endif \ No newline at end of file
diff --git a/src/ToolBox/superpmi/superpmi-shim-counter/jithost.h b/src/ToolBox/superpmi/superpmi-shim-counter/jithost.h
index 06acf8bf91..fb8ca2649a 100644
--- a/src/ToolBox/superpmi/superpmi-shim-counter/jithost.h
+++ b/src/ToolBox/superpmi/superpmi-shim-counter/jithost.h
@@ -16,7 +16,7 @@ public:
#include "icorjithostimpl.h"
private:
- ICorJitHost* wrappedHost;
+ ICorJitHost* wrappedHost;
MethodCallSummarizer* mcs;
};
diff --git a/src/ToolBox/superpmi/superpmi-shim-counter/methodcallsummarizer.cpp b/src/ToolBox/superpmi/superpmi-shim-counter/methodcallsummarizer.cpp
index 61f31e4237..e22c060271 100644
--- a/src/ToolBox/superpmi/superpmi-shim-counter/methodcallsummarizer.cpp
+++ b/src/ToolBox/superpmi/superpmi-shim-counter/methodcallsummarizer.cpp
@@ -6,36 +6,38 @@
#include "standardpch.h"
#include "methodcallsummarizer.h"
-MethodCallSummarizer::MethodCallSummarizer(WCHAR *logPath)
+MethodCallSummarizer::MethodCallSummarizer(WCHAR* logPath)
{
numNames = 0;
- names = nullptr;
- counts = nullptr;
+ names = nullptr;
+ counts = nullptr;
- WCHAR *ExecutableName = GetCommandLineW();
- WCHAR *quote1 = NULL;
+ WCHAR* ExecutableName = GetCommandLineW();
+ WCHAR* quote1 = NULL;
- //if there are any quotes in filename convert them to spaces.
+ // if there are any quotes in filename convert them to spaces.
while ((quote1 = wcsstr(ExecutableName, W("\""))) != NULL)
*quote1 = W(' ');
- //remove any illegal or annoying characters from file name by converting them to underscores
+ // remove any illegal or annoying characters from file name by converting them to underscores
while ((quote1 = wcspbrk(ExecutableName, W("=<>:\"/\\|?! *.,"))) != NULL)
*quote1 = W('_');
- const WCHAR *DataFileExtension = W(".csv");
- size_t ExecutableNameLength = wcslen(ExecutableName);
- size_t DataFileExtensionLength = wcslen(DataFileExtension);
- size_t logPathLength = wcslen(logPath);
+ const WCHAR* DataFileExtension = W(".csv");
+ size_t ExecutableNameLength = wcslen(ExecutableName);
+ size_t DataFileExtensionLength = wcslen(DataFileExtension);
+ size_t logPathLength = wcslen(logPath);
unsigned int randNumber = 0;
- WCHAR RandNumberString[9];
- RandNumberString[0] = L'\0';
+ WCHAR RandNumberString[9];
+ RandNumberString[0] = L'\0';
size_t RandNumberLength = 0;
- size_t dataFileNameLength = logPathLength + 1 + ExecutableNameLength + 1 + RandNumberLength + 1 + DataFileExtensionLength + 1;
+ size_t dataFileNameLength =
+ logPathLength + 1 + ExecutableNameLength + 1 + RandNumberLength + 1 + DataFileExtensionLength + 1;
- const size_t MaxAcceptablePathLength = MAX_PATH - 20; // subtract 20 to leave buffer, for possible random number addition
+ const size_t MaxAcceptablePathLength =
+ MAX_PATH - 20; // subtract 20 to leave buffer, for possible random number addition
if (dataFileNameLength >= MaxAcceptablePathLength)
{
// The path name is too long; creating the file will fail. This can happen because we use the command line,
@@ -48,7 +50,7 @@ MethodCallSummarizer::MethodCallSummarizer(WCHAR *logPath)
#ifdef FEATURE_PAL
PAL_Random(/* bStrong */ FALSE, &randNumber, sizeof(randNumber));
-#else // !FEATURE_PAL
+#else // !FEATURE_PAL
rand_s(&randNumber);
#endif // !FEATURE_PAL
@@ -58,7 +60,7 @@ MethodCallSummarizer::MethodCallSummarizer(WCHAR *logPath)
dataFileNameLength += RandNumberLength - 1;
}
- dataFileName = new WCHAR[dataFileNameLength];
+ dataFileName = new WCHAR[dataFileNameLength];
dataFileName[0] = 0;
wcsncat_s(dataFileName, dataFileNameLength, logPath, logPathLength);
wcsncat_s(dataFileName, dataFileNameLength, W("\\\0"), 1);
@@ -72,49 +74,50 @@ MethodCallSummarizer::MethodCallSummarizer(WCHAR *logPath)
wcsncat_s(dataFileName, dataFileNameLength, DataFileExtension, DataFileExtensionLength);
}
-//lots of ways will be faster.. this happens to be decently simple and good enough for the task at hand and nicely sorts the output.
-//in this approach the most commonly added items are at the top of the list... 60% landed in the first three slots in short runs
-void MethodCallSummarizer::AddCall(const char *name)
+// lots of ways will be faster.. this happens to be decently simple and good enough for the task at hand and nicely
+// sorts the output. in this approach the most commonly added items are at the top of the list... 60% landed in the first
+// three slots in short runs
+void MethodCallSummarizer::AddCall(const char* name)
{
- //if we can find it already in our list, increment the count
- for(int i=0;i<numNames;i++)
+ // if we can find it already in our list, increment the count
+ for (int i = 0; i < numNames; i++)
{
- if(strcmp(name, names[i])==0)
+ if (strcmp(name, names[i]) == 0)
{
counts[i]++;
- for(i=1;i<numNames;i++)
- if(counts[i]>counts[i-1])
+ for (i = 1; i < numNames; i++)
+ if (counts[i] > counts[i - 1])
{
- unsigned int tempui = counts[i-1];
- counts[i-1] = counts[i];
- counts[i] = tempui;
- char *tempc = names[i-1];
- names[i-1] = names[i];
- names[i] = tempc;
+ unsigned int tempui = counts[i - 1];
+ counts[i - 1] = counts[i];
+ counts[i] = tempui;
+ char* tempc = names[i - 1];
+ names[i - 1] = names[i];
+ names[i] = tempc;
}
return;
}
}
- //else we didn't find it, so add it
- char **tnames = names;
- unsigned int *tcounts = counts;
+ // else we didn't find it, so add it
+ char** tnames = names;
+ unsigned int* tcounts = counts;
- names = new char*[numNames+1];
- if(tnames!=nullptr)
+ names = new char*[numNames + 1];
+ if (tnames != nullptr)
{
- memcpy(names, tnames, numNames*sizeof(char*));
+ memcpy(names, tnames, numNames * sizeof(char*));
delete tnames;
}
- size_t tlen = strlen(name);
- names[numNames] = new char[tlen+1];
- memcpy(names[numNames], name, tlen+1);
+ size_t tlen = strlen(name);
+ names[numNames] = new char[tlen + 1];
+ memcpy(names[numNames], name, tlen + 1);
- counts = new unsigned int[numNames+1];
- if(tcounts!=nullptr)
+ counts = new unsigned int[numNames + 1];
+ if (tcounts != nullptr)
{
- memcpy(counts, tcounts, numNames*sizeof(unsigned int));
+ memcpy(counts, tcounts, numNames * sizeof(unsigned int));
delete tcounts;
}
counts[numNames] = 1;
@@ -124,16 +127,17 @@ void MethodCallSummarizer::AddCall(const char *name)
void MethodCallSummarizer::SaveTextFile()
{
- char buff[512];
- DWORD bytesWritten = 0;
- HANDLE hFile = CreateFileW(dataFileName, GENERIC_READ|GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL|FILE_FLAG_SEQUENTIAL_SCAN, NULL);
+ char buff[512];
+ DWORD bytesWritten = 0;
+ HANDLE hFile = CreateFileW(dataFileName, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
+ FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
- DWORD len = (DWORD)sprintf_s(buff,512,"FunctionName,Count\n");
+ DWORD len = (DWORD)sprintf_s(buff, 512, "FunctionName,Count\n");
WriteFile(hFile, buff, len, &bytesWritten, NULL);
- for(int i=0;i<numNames;i++)
+ for (int i = 0; i < numNames; i++)
{
- len = sprintf_s(buff,512,"%s,%u\n", names[i], counts[i]);
+ len = sprintf_s(buff, 512, "%s,%u\n", names[i], counts[i]);
WriteFile(hFile, buff, len, &bytesWritten, NULL);
}
CloseHandle(hFile);
diff --git a/src/ToolBox/superpmi/superpmi-shim-counter/methodcallsummarizer.h b/src/ToolBox/superpmi/superpmi-shim-counter/methodcallsummarizer.h
index 09eaaca46f..c45b631e76 100644
--- a/src/ToolBox/superpmi/superpmi-shim-counter/methodcallsummarizer.h
+++ b/src/ToolBox/superpmi/superpmi-shim-counter/methodcallsummarizer.h
@@ -9,15 +9,15 @@
class MethodCallSummarizer
{
public:
- MethodCallSummarizer(WCHAR *name);
- void AddCall(const char *name);
+ MethodCallSummarizer(WCHAR* name);
+ void AddCall(const char* name);
void SaveTextFile();
private:
- char **names;
- unsigned int *counts;
- int numNames;
- WCHAR *dataFileName;
+ char** names;
+ unsigned int* counts;
+ int numNames;
+ WCHAR* dataFileName;
};
#endif \ No newline at end of file
diff --git a/src/ToolBox/superpmi/superpmi-shim-counter/superpmi-shim-counter.cpp b/src/ToolBox/superpmi/superpmi-shim-counter/superpmi-shim-counter.cpp
index ee47dd8c44..f838ea683f 100644
--- a/src/ToolBox/superpmi/superpmi-shim-counter/superpmi-shim-counter.cpp
+++ b/src/ToolBox/superpmi/superpmi-shim-counter/superpmi-shim-counter.cpp
@@ -17,12 +17,12 @@
#include "spmiutil.h"
#include "jithost.h"
-HMODULE g_hRealJit = 0; //We leak this currently (could do the proper shutdown in process_detach)
-WCHAR* g_realJitPath = nullptr; //We leak this (could do the proper shutdown in process_detach)
-WCHAR* g_logPath = nullptr; //Again, we leak this one too...
-char* g_logFilePath = nullptr; //We *don't* leak this, hooray!
-WCHAR* g_HomeDirectory = nullptr;
-WCHAR* g_DefaultRealJitPath = nullptr;
+HMODULE g_hRealJit = 0; // We leak this currently (could do the proper shutdown in process_detach)
+WCHAR* g_realJitPath = nullptr; // We leak this (could do the proper shutdown in process_detach)
+WCHAR* g_logPath = nullptr; // Again, we leak this one too...
+char* g_logFilePath = nullptr; // We *don't* leak this, hooray!
+WCHAR* g_HomeDirectory = nullptr;
+WCHAR* g_DefaultRealJitPath = nullptr;
void SetDefaultPaths()
{
@@ -33,7 +33,7 @@ void SetDefaultPaths()
if (g_DefaultRealJitPath == nullptr)
{
- size_t len = wcslen(g_HomeDirectory) + 1 + wcslen(DEFAULT_REAL_JIT_NAME_W) + 1;
+ size_t len = wcslen(g_HomeDirectory) + 1 + wcslen(DEFAULT_REAL_JIT_NAME_W) + 1;
g_DefaultRealJitPath = new WCHAR[len];
wcscpy_s(g_DefaultRealJitPath, len, g_HomeDirectory);
wcscat_s(g_DefaultRealJitPath, len, DIRECTORY_SEPARATOR_STR_W);
@@ -67,52 +67,50 @@ void SetLogFilePath()
}
}
-extern "C"
-BOOL
+extern "C" BOOL
#ifndef FEATURE_PAL
-APIENTRY
+ APIENTRY
#endif // !FEATURE_PAL
-DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
+ DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
switch (ul_reason_for_call)
{
- case DLL_PROCESS_ATTACH:
+ case DLL_PROCESS_ATTACH:
#ifdef FEATURE_PAL
- if (0 != PAL_InitializeDLL())
- {
- fprintf(stderr, "Error: Fail to PAL_InitializeDLL\n");
- exit(1);
- }
+ if (0 != PAL_InitializeDLL())
+ {
+ fprintf(stderr, "Error: Fail to PAL_InitializeDLL\n");
+ exit(1);
+ }
#endif // FEATURE_PAL
- Logger::Initialize();
- SetLogFilePath();
- Logger::OpenLogFile(g_logFilePath);
- break;
+ Logger::Initialize();
+ SetLogFilePath();
+ Logger::OpenLogFile(g_logFilePath);
+ break;
- case DLL_PROCESS_DETACH:
- Logger::Shutdown();
+ case DLL_PROCESS_DETACH:
+ Logger::Shutdown();
- delete[] g_logFilePath;
- g_logFilePath = nullptr;
+ delete[] g_logFilePath;
+ g_logFilePath = nullptr;
- break;
+ break;
- case DLL_THREAD_ATTACH:
- case DLL_THREAD_DETACH:
- break;
+ case DLL_THREAD_ATTACH:
+ case DLL_THREAD_DETACH:
+ break;
}
return TRUE;
}
// Exported via def file
-extern "C"
-void __stdcall jitStartup(ICorJitHost* host)
+extern "C" void __stdcall jitStartup(ICorJitHost* host)
{
SetDefaultPaths();
SetLibName();
- //Load Library
+ // Load Library
if (g_hRealJit == 0)
{
g_hRealJit = ::LoadLibraryW(g_realJitPath);
@@ -136,48 +134,47 @@ void __stdcall jitStartup(ICorJitHost* host)
pnjitStartup(g_ourJitHost);
}
-//Exported via def file
-extern "C"
-ICorJitCompiler* __stdcall getJit()
+// Exported via def file
+extern "C" ICorJitCompiler* __stdcall getJit()
{
- DWORD dwRetVal = 0;
- PgetJit pngetJit;
- interceptor_ICJC *pJitInstance = nullptr;
- ICorJitCompiler *tICJI = nullptr;
+ DWORD dwRetVal = 0;
+ PgetJit pngetJit;
+ interceptor_ICJC* pJitInstance = nullptr;
+ ICorJitCompiler* tICJI = nullptr;
SetDefaultPaths();
SetLibName();
SetLogPath();
- //Load Library
- if(g_hRealJit == 0)
+ // Load Library
+ if (g_hRealJit == 0)
{
g_hRealJit = ::LoadLibraryW(g_realJitPath);
- if(g_hRealJit == 0)
+ if (g_hRealJit == 0)
{
LogError("getJit() - LoadLibrary failed to load '%ws' (0x%08x)", g_realJitPath, ::GetLastError());
return nullptr;
}
}
- //get the required entrypoints
+ // get the required entrypoints
pngetJit = (PgetJit)::GetProcAddress(g_hRealJit, "getJit");
- if(pngetJit == 0)
+ if (pngetJit == 0)
{
LogError("getJit() - GetProcAddress 'getJit' failed (0x%08x)", ::GetLastError());
return nullptr;
}
tICJI = pngetJit();
- if(tICJI == nullptr)
+ if (tICJI == nullptr)
{
LogError("getJit() - pngetJit gave us null");
return nullptr;
}
- pJitInstance = new interceptor_ICJC();
+ pJitInstance = new interceptor_ICJC();
pJitInstance->original_ICorJitCompiler = tICJI;
- pJitInstance->mcs = new MethodCallSummarizer(g_logPath);
+ pJitInstance->mcs = new MethodCallSummarizer(g_logPath);
if (g_ourJitHost != nullptr)
{
g_ourJitHost->setMethodCallSummarizer(pJitInstance->mcs);
@@ -185,42 +182,41 @@ ICorJitCompiler* __stdcall getJit()
return pJitInstance;
}
-//Exported via def file
-extern "C"
-void __stdcall sxsJitStartup(CoreClrCallbacks const & original_cccallbacks)
+// Exported via def file
+extern "C" void __stdcall sxsJitStartup(CoreClrCallbacks const& original_cccallbacks)
{
PsxsJitStartup pnsxsJitStartup;
SetDefaultPaths();
SetLibName();
- //Load Library
- if(g_hRealJit == 0)
+ // Load Library
+ if (g_hRealJit == 0)
{
g_hRealJit = ::LoadLibraryW(g_realJitPath);
- if(g_hRealJit == 0)
+ if (g_hRealJit == 0)
{
LogError("sxsJitStartup() - LoadLibrary failed to load '%ws' (0x%08x)", g_realJitPath, ::GetLastError());
return;
}
}
- //get entry point
+ // get entry point
pnsxsJitStartup = (PsxsJitStartup)::GetProcAddress(g_hRealJit, "sxsJitStartup");
- if(pnsxsJitStartup == 0)
+ if (pnsxsJitStartup == 0)
{
LogError("sxsJitStartup() - GetProcAddress 'sxsJitStartup' failed (0x%08x)", ::GetLastError());
return;
}
- //Setup CoreClrCallbacks and call sxsJitStartup
- original_CoreClrCallbacks = new CoreClrCallbacks();
+ // Setup CoreClrCallbacks and call sxsJitStartup
+ original_CoreClrCallbacks = new CoreClrCallbacks();
original_CoreClrCallbacks->m_hmodCoreCLR = original_cccallbacks.m_hmodCoreCLR;
original_CoreClrCallbacks->m_pfnIEE = original_cccallbacks.m_pfnIEE;
original_CoreClrCallbacks->m_pfnGetCORSystemDirectory = original_cccallbacks.m_pfnGetCORSystemDirectory;
original_CoreClrCallbacks->m_pfnGetCLRFunction = original_cccallbacks.m_pfnGetCLRFunction;
- CoreClrCallbacks *temp = new CoreClrCallbacks();
+ CoreClrCallbacks* temp = new CoreClrCallbacks();
temp->m_hmodCoreCLR = original_cccallbacks.m_hmodCoreCLR;
temp->m_pfnIEE = IEE_t;
diff --git a/src/ToolBox/superpmi/superpmi-shim-counter/superpmi-shim-counter.h b/src/ToolBox/superpmi/superpmi-shim-counter/superpmi-shim-counter.h
index 2068a02775..5edb9263fa 100644
--- a/src/ToolBox/superpmi/superpmi-shim-counter/superpmi-shim-counter.h
+++ b/src/ToolBox/superpmi/superpmi-shim-counter/superpmi-shim-counter.h
@@ -9,5 +9,4 @@
#ifndef _SuperPMIShim
#define _SuperPMIShim
-
#endif
diff --git a/src/ToolBox/superpmi/superpmi-shim-simple/coreclrcallbacks.cpp b/src/ToolBox/superpmi/superpmi-shim-simple/coreclrcallbacks.cpp
index cf35748672..85ceaa215f 100644
--- a/src/ToolBox/superpmi/superpmi-shim-simple/coreclrcallbacks.cpp
+++ b/src/ToolBox/superpmi/superpmi-shim-simple/coreclrcallbacks.cpp
@@ -7,17 +7,14 @@
#include "coreclrcallbacks.h"
#include "iexecutionengine.h"
-typedef LPVOID (__stdcall * pfnEEHeapAllocInProcessHeap)(DWORD dwFlags, SIZE_T dwBytes);
-typedef BOOL (__stdcall * pfnEEHeapFreeInProcessHeap)(DWORD dwFlags, LPVOID lpMem);
-
-CoreClrCallbacks *original_CoreClrCallbacks = nullptr;
+CoreClrCallbacks* original_CoreClrCallbacks = nullptr;
pfnEEHeapAllocInProcessHeap original_EEHeapAllocInProcessHeap = nullptr;
-pfnEEHeapFreeInProcessHeap original_EEHeapFreeInProcessHeap = nullptr;
+pfnEEHeapFreeInProcessHeap original_EEHeapFreeInProcessHeap = nullptr;
-IExecutionEngine* STDMETHODCALLTYPE IEE_t()
+IExecutionEngine* IEE_t()
{
- interceptor_IEE *iee = new interceptor_IEE();
- iee->original_IEE = original_CoreClrCallbacks->m_pfnIEE();
+ interceptor_IEE* iee = new interceptor_IEE();
+ iee->original_IEE = original_CoreClrCallbacks->m_pfnIEE();
return iee;
}
@@ -29,25 +26,25 @@ HRESULT STDMETHODCALLTYPE GetCORSystemDirectory(LPWSTR pbuffer, DWORD cchBuffer,
}
*/
-LPVOID STDMETHODCALLTYPE EEHeapAllocInProcessHeap (DWORD dwFlags, SIZE_T dwBytes)
+LPVOID EEHeapAllocInProcessHeap(DWORD dwFlags, SIZE_T dwBytes)
{
return original_EEHeapAllocInProcessHeap(dwFlags, dwBytes);
}
-BOOL STDMETHODCALLTYPE EEHeapFreeInProcessHeap (DWORD dwFlags, LPVOID lpMem)
+BOOL EEHeapFreeInProcessHeap(DWORD dwFlags, LPVOID lpMem)
{
return original_EEHeapFreeInProcessHeap(dwFlags, lpMem);
}
-void* STDMETHODCALLTYPE GetCLRFunction(LPCSTR functionName)
+void* GetCLRFunction(LPCSTR functionName)
{
- if(strcmp(functionName, "EEHeapAllocInProcessHeap")==0)
+ if (strcmp(functionName, "EEHeapAllocInProcessHeap") == 0)
{
original_EEHeapAllocInProcessHeap =
(pfnEEHeapAllocInProcessHeap)original_CoreClrCallbacks->m_pfnGetCLRFunction("EEHeapAllocInProcessHeap");
return (void*)EEHeapAllocInProcessHeap;
}
- if(strcmp(functionName, "EEHeapFreeInProcessHeap")==0)
+ if (strcmp(functionName, "EEHeapFreeInProcessHeap") == 0)
{
original_EEHeapFreeInProcessHeap =
(pfnEEHeapFreeInProcessHeap)original_CoreClrCallbacks->m_pfnGetCLRFunction("EEHeapFreeInProcessHeap");
@@ -55,4 +52,3 @@ void* STDMETHODCALLTYPE GetCLRFunction(LPCSTR functionName)
}
return original_CoreClrCallbacks->m_pfnGetCLRFunction(functionName);
}
-
diff --git a/src/ToolBox/superpmi/superpmi-shim-simple/coreclrcallbacks.h b/src/ToolBox/superpmi/superpmi-shim-simple/coreclrcallbacks.h
index 2e3a673f57..6c4a054df4 100644
--- a/src/ToolBox/superpmi/superpmi-shim-simple/coreclrcallbacks.h
+++ b/src/ToolBox/superpmi/superpmi-shim-simple/coreclrcallbacks.h
@@ -6,15 +6,9 @@
#ifndef _CoreClrCallbacks
#define _CoreClrCallbacks
-#include "runtimedetails.h"
-
-IExecutionEngine* STDMETHODCALLTYPE IEE_t();
-HRESULT STDMETHODCALLTYPE GetCORSystemDirectory(LPWSTR pbuffer, DWORD cchBuffer, DWORD* pdwlength);
-LPVOID STDMETHODCALLTYPE EEHeapAllocInProcessHeap (DWORD dwFlags, SIZE_T dwBytes);
-BOOL STDMETHODCALLTYPE EEHeapFreeInProcessHeap (DWORD dwFlags, LPVOID lpMem);
-void* STDMETHODCALLTYPE GetCLRFunction(LPCSTR functionName);
+#include "coreclrcommoncallbacks.h"
// Added to allow us to persist a copy of the original callbacks
-extern CoreClrCallbacks *original_CoreClrCallbacks;
+extern CoreClrCallbacks* original_CoreClrCallbacks;
-#endif \ No newline at end of file
+#endif
diff --git a/src/ToolBox/superpmi/superpmi-shim-simple/icorjitcompiler.cpp b/src/ToolBox/superpmi/superpmi-shim-simple/icorjitcompiler.cpp
index ec266e164f..b45a3fe437 100644
--- a/src/ToolBox/superpmi/superpmi-shim-simple/icorjitcompiler.cpp
+++ b/src/ToolBox/superpmi/superpmi-shim-simple/icorjitcompiler.cpp
@@ -7,23 +7,23 @@
#include "icorjitcompiler.h"
#include "icorjitinfo.h"
-interceptor_IEEMM *current_IEEMM = nullptr; //we want this to live beyond the scope of a single compileMethodCall
-
-CorJitResult __stdcall interceptor_ICJC::compileMethod (
- ICorJitInfo *comp, /* IN */
- struct CORINFO_METHOD_INFO *info, /* IN */
- unsigned /* code:CorJitFlag */ flags, /* IN */
- BYTE **nativeEntry, /* OUT */
- ULONG *nativeSizeOfCode /* OUT */
- )
+interceptor_IEEMM* current_IEEMM = nullptr; // we want this to live beyond the scope of a single compileMethodCall
+
+CorJitResult __stdcall interceptor_ICJC::compileMethod(ICorJitInfo* comp, /* IN */
+ struct CORINFO_METHOD_INFO* info, /* IN */
+ unsigned /* code:CorJitFlag */ flags, /* IN */
+ BYTE** nativeEntry, /* OUT */
+ ULONG* nativeSizeOfCode /* OUT */
+ )
{
interceptor_ICJI our_ICorJitInfo;
our_ICorJitInfo.original_ICorJitInfo = comp;
- if(current_IEEMM == nullptr)
+ if (current_IEEMM == nullptr)
current_IEEMM = new interceptor_IEEMM();
- CorJitResult temp = original_ICorJitCompiler->compileMethod(&our_ICorJitInfo, info, flags, nativeEntry, nativeSizeOfCode);
+ CorJitResult temp =
+ original_ICorJitCompiler->compileMethod(&our_ICorJitInfo, info, flags, nativeEntry, nativeSizeOfCode);
return temp;
}
diff --git a/src/ToolBox/superpmi/superpmi-shim-simple/icorjitcompiler.h b/src/ToolBox/superpmi/superpmi-shim-simple/icorjitcompiler.h
index a5eda6aa19..e045da2926 100644
--- a/src/ToolBox/superpmi/superpmi-shim-simple/icorjitcompiler.h
+++ b/src/ToolBox/superpmi/superpmi-shim-simple/icorjitcompiler.h
@@ -16,9 +16,10 @@ class interceptor_ICJC : public ICorJitCompiler
public:
// Added to help us track the original icjc and be able to easily indirect to it.
- ICorJitCompiler *original_ICorJitCompiler;
+ ICorJitCompiler* original_ICorJitCompiler;
};
-extern interceptor_IEEMM *current_IEEMM; // we want a pointer to the memory manager to live beyond the scope of a single compileMethodCall (jit32 expects this)
+extern interceptor_IEEMM* current_IEEMM; // we want a pointer to the memory manager to live beyond the scope of a single
+ // compileMethodCall (jit32 expects this)
#endif
diff --git a/src/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.cpp b/src/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.cpp
index 8941685fe3..aca75361a0 100644
--- a/src/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.cpp
+++ b/src/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.cpp
@@ -10,53 +10,49 @@
#include "icorjitcompiler.h"
#include "spmiutil.h"
-//Stuff on ICorStaticInfo
+// Stuff on ICorStaticInfo
/**********************************************************************************/
//
// ICorMethodInfo
//
/**********************************************************************************/
// return flags (defined above, CORINFO_FLG_PUBLIC ...)
-DWORD interceptor_ICJI::getMethodAttribs (CORINFO_METHOD_HANDLE ftn /* IN */)
+DWORD interceptor_ICJI::getMethodAttribs(CORINFO_METHOD_HANDLE ftn /* IN */)
{
return original_ICorJitInfo->getMethodAttribs(ftn);
}
// sets private JIT flags, which can be, retrieved using getAttrib.
-void interceptor_ICJI::setMethodAttribs (CORINFO_METHOD_HANDLE ftn,/* IN */
- CorInfoMethodRuntimeFlags attribs/* IN */)
+void interceptor_ICJI::setMethodAttribs(CORINFO_METHOD_HANDLE ftn, /* IN */
+ CorInfoMethodRuntimeFlags attribs /* IN */)
{
original_ICorJitInfo->setMethodAttribs(ftn, attribs);
}
-
// 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 interceptor_ICJI::getMethodSig (
- CORINFO_METHOD_HANDLE ftn, /* IN */
- CORINFO_SIG_INFO *sig, /* OUT */
- CORINFO_CLASS_HANDLE memberParent/* IN */
- )
+void interceptor_ICJI::getMethodSig(CORINFO_METHOD_HANDLE ftn, /* IN */
+ CORINFO_SIG_INFO* sig, /* OUT */
+ CORINFO_CLASS_HANDLE memberParent /* IN */
+ )
{
original_ICorJitInfo->getMethodSig(ftn, sig, memberParent);
}
+/*********************************************************************
+* 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
+*********************************************************************/
- /*********************************************************************
- * 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 interceptor_ICJI::getMethodInfo (
- CORINFO_METHOD_HANDLE ftn, /* IN */
- CORINFO_METHOD_INFO* info /* OUT */
- )
+// 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 interceptor_ICJI::getMethodInfo(CORINFO_METHOD_HANDLE ftn, /* IN */
+ CORINFO_METHOD_INFO* info /* OUT */
+ )
{
return original_ICorJitInfo->getMethodInfo(ftn, info);
}
@@ -70,11 +66,10 @@ void interceptor_ICJI::getMethodSig (
//
// The inlined method need not be verified
-CorInfoInline interceptor_ICJI::canInline (
- CORINFO_METHOD_HANDLE callerHnd, /* IN */
- CORINFO_METHOD_HANDLE calleeHnd, /* IN */
- DWORD* pRestrictions /* OUT */
- )
+CorInfoInline interceptor_ICJI::canInline(CORINFO_METHOD_HANDLE callerHnd, /* IN */
+ CORINFO_METHOD_HANDLE calleeHnd, /* IN */
+ DWORD* pRestrictions /* OUT */
+ )
{
return original_ICorJitInfo->canInline(callerHnd, calleeHnd, pRestrictions);
}
@@ -82,24 +77,22 @@ CorInfoInline interceptor_ICJI::canInline (
// 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 interceptor_ICJI::reportInliningDecision (CORINFO_METHOD_HANDLE inlinerHnd,
- CORINFO_METHOD_HANDLE inlineeHnd,
- CorInfoInline inlineResult,
- const char * reason)
+void interceptor_ICJI::reportInliningDecision(CORINFO_METHOD_HANDLE inlinerHnd,
+ CORINFO_METHOD_HANDLE inlineeHnd,
+ CorInfoInline inlineResult,
+ const char* reason)
{
original_ICorJitInfo->reportInliningDecision(inlinerHnd, inlineeHnd, inlineResult, 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 interceptor_ICJI::canTailCall (
- CORINFO_METHOD_HANDLE callerHnd, /* IN */
- CORINFO_METHOD_HANDLE declaredCalleeHnd, /* IN */
- CORINFO_METHOD_HANDLE exactCalleeHnd, /* IN */
- bool fIsTailPrefix /* IN */
- )
+bool interceptor_ICJI::canTailCall(CORINFO_METHOD_HANDLE callerHnd, /* IN */
+ CORINFO_METHOD_HANDLE declaredCalleeHnd, /* IN */
+ CORINFO_METHOD_HANDLE exactCalleeHnd, /* IN */
+ bool fIsTailPrefix /* IN */
+ )
{
return original_ICorJitInfo->canTailCall(callerHnd, declaredCalleeHnd, exactCalleeHnd, fIsTailPrefix);
}
@@ -107,105 +100,86 @@ bool interceptor_ICJI::canTailCall (
// 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 interceptor_ICJI::reportTailCallDecision (CORINFO_METHOD_HANDLE callerHnd,
- CORINFO_METHOD_HANDLE calleeHnd,
- bool fIsTailPrefix,
- CorInfoTailCall tailCallResult,
- const char * reason)
+void interceptor_ICJI::reportTailCallDecision(CORINFO_METHOD_HANDLE callerHnd,
+ CORINFO_METHOD_HANDLE calleeHnd,
+ bool fIsTailPrefix,
+ CorInfoTailCall tailCallResult,
+ const char* reason)
{
original_ICorJitInfo->reportTailCallDecision(callerHnd, calleeHnd, fIsTailPrefix, tailCallResult, reason);
}
// get individual exception handler
-void interceptor_ICJI::getEHinfo(
- CORINFO_METHOD_HANDLE ftn, /* IN */
- unsigned EHnumber, /* IN */
- CORINFO_EH_CLAUSE* clause /* OUT */
- )
+void interceptor_ICJI::getEHinfo(CORINFO_METHOD_HANDLE ftn, /* IN */
+ unsigned EHnumber, /* IN */
+ CORINFO_EH_CLAUSE* clause /* OUT */
+ )
{
original_ICorJitInfo->getEHinfo(ftn, EHnumber, clause);
}
// return class it belongs to
-CORINFO_CLASS_HANDLE interceptor_ICJI::getMethodClass (
- CORINFO_METHOD_HANDLE method
- )
+CORINFO_CLASS_HANDLE interceptor_ICJI::getMethodClass(CORINFO_METHOD_HANDLE method)
{
return original_ICorJitInfo->getMethodClass(method);
}
// return module it belongs to
-CORINFO_MODULE_HANDLE interceptor_ICJI::getMethodModule (
- CORINFO_METHOD_HANDLE method
- )
+CORINFO_MODULE_HANDLE interceptor_ICJI::getMethodModule(CORINFO_METHOD_HANDLE method)
{
return original_ICorJitInfo->getMethodModule(method);
}
// This function returns the offset of the specified method in the
// vtable of it's owning class or interface.
-void interceptor_ICJI::getMethodVTableOffset (
- CORINFO_METHOD_HANDLE method, /* IN */
- unsigned* offsetOfIndirection, /* OUT */
- unsigned* offsetAfterIndirection /* OUT */
- )
+void interceptor_ICJI::getMethodVTableOffset(CORINFO_METHOD_HANDLE method, /* IN */
+ unsigned* offsetOfIndirection, /* OUT */
+ unsigned* offsetAfterIndirection /* OUT */
+ )
{
original_ICorJitInfo->getMethodVTableOffset(method, offsetOfIndirection, offsetAfterIndirection);
}
// Find the virtual method in implementingClass that overrides virtualMethod.
// Return null if devirtualization is not possible.
-CORINFO_METHOD_HANDLE interceptor_ICJI::resolveVirtualMethod(
- CORINFO_METHOD_HANDLE virtualMethod,
- CORINFO_CLASS_HANDLE implementingClass,
- CORINFO_CONTEXT_HANDLE ownerType
- )
+CORINFO_METHOD_HANDLE interceptor_ICJI::resolveVirtualMethod(CORINFO_METHOD_HANDLE virtualMethod,
+ CORINFO_CLASS_HANDLE implementingClass,
+ CORINFO_CONTEXT_HANDLE ownerType)
{
return original_ICorJitInfo->resolveVirtualMethod(virtualMethod, implementingClass, ownerType);
}
// If a method's attributes have (getMethodAttribs) CORINFO_FLG_INTRINSIC set,
// getIntrinsicID() returns the intrinsic ID.
-CorInfoIntrinsics interceptor_ICJI::getIntrinsicID(
- CORINFO_METHOD_HANDLE method,
- bool* pMustExpand /* OUT */
- )
+CorInfoIntrinsics interceptor_ICJI::getIntrinsicID(CORINFO_METHOD_HANDLE method, bool* pMustExpand /* OUT */
+ )
{
return original_ICorJitInfo->getIntrinsicID(method, pMustExpand);
}
// Is the given module the System.Numerics.Vectors module?
-bool interceptor_ICJI::isInSIMDModule(
- CORINFO_CLASS_HANDLE classHnd
- )
+bool interceptor_ICJI::isInSIMDModule(CORINFO_CLASS_HANDLE classHnd)
{
return original_ICorJitInfo->isInSIMDModule(classHnd);
}
// return the unmanaged calling convention for a PInvoke
-CorInfoUnmanagedCallConv interceptor_ICJI::getUnmanagedCallConv(
- CORINFO_METHOD_HANDLE method
- )
+CorInfoUnmanagedCallConv interceptor_ICJI::getUnmanagedCallConv(CORINFO_METHOD_HANDLE method)
{
return original_ICorJitInfo->getUnmanagedCallConv(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 interceptor_ICJI::pInvokeMarshalingRequired(
- CORINFO_METHOD_HANDLE method,
- CORINFO_SIG_INFO* callSiteSig
- )
+BOOL interceptor_ICJI::pInvokeMarshalingRequired(CORINFO_METHOD_HANDLE method, CORINFO_SIG_INFO* callSiteSig)
{
return original_ICorJitInfo->pInvokeMarshalingRequired(method, callSiteSig);
}
// Check constraints on method type arguments (only).
// The parent class should be checked separately using satisfiesClassConstraints(parent).
-BOOL interceptor_ICJI::satisfiesMethodConstraints(
- CORINFO_CLASS_HANDLE parent, // the exact parent of the method
- CORINFO_METHOD_HANDLE method
- )
+BOOL interceptor_ICJI::satisfiesMethodConstraints(CORINFO_CLASS_HANDLE parent, // the exact parent of the method
+ CORINFO_METHOD_HANDLE method)
{
return original_ICorJitInfo->satisfiesMethodConstraints(parent, method);
}
@@ -214,74 +188,63 @@ BOOL interceptor_ICJI::satisfiesMethodConstraints(
// 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 interceptor_ICJI::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 */
- )
+ 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 */
+ )
{
return original_ICorJitInfo->isCompatibleDelegate(objCls, methodParentCls, method, delegateCls, pfIsOpenDelegate);
}
// Determines whether the delegate creation obeys security transparency rules
-BOOL interceptor_ICJI::isDelegateCreationAllowed (
- CORINFO_CLASS_HANDLE delegateHnd,
- CORINFO_METHOD_HANDLE calleeHnd
- )
+BOOL interceptor_ICJI::isDelegateCreationAllowed(CORINFO_CLASS_HANDLE delegateHnd, CORINFO_METHOD_HANDLE calleeHnd)
{
return original_ICorJitInfo->isDelegateCreationAllowed(delegateHnd, calleeHnd);
}
-
// Indicates if the method is an instance of the generic
// method that passes (or has passed) verification
-CorInfoInstantiationVerification interceptor_ICJI::isInstantiationOfVerifiedGeneric (
- CORINFO_METHOD_HANDLE method /* IN */
- )
+CorInfoInstantiationVerification interceptor_ICJI::isInstantiationOfVerifiedGeneric(CORINFO_METHOD_HANDLE method /* IN
+ */
+ )
{
return original_ICorJitInfo->isInstantiationOfVerifiedGeneric(method);
}
// Loads the constraints on a typical method definition, detecting cycles;
// for use in verification.
-void interceptor_ICJI::initConstraintsForVerification(
- CORINFO_METHOD_HANDLE method, /* IN */
- BOOL *pfHasCircularClassConstraints, /* OUT */
- BOOL *pfHasCircularMethodConstraint /* OUT */
- )
+void interceptor_ICJI::initConstraintsForVerification(CORINFO_METHOD_HANDLE method, /* IN */
+ BOOL* pfHasCircularClassConstraints, /* OUT */
+ BOOL* pfHasCircularMethodConstraint /* OUT */
+ )
{
- original_ICorJitInfo->initConstraintsForVerification(method, pfHasCircularClassConstraints, pfHasCircularMethodConstraint);
+ original_ICorJitInfo->initConstraintsForVerification(method, pfHasCircularClassConstraints,
+ pfHasCircularMethodConstraint);
}
-CorInfoCanSkipVerificationResult interceptor_ICJI::canSkipMethodVerification (
- CORINFO_METHOD_HANDLE ftnHandle
- )
+CorInfoCanSkipVerificationResult interceptor_ICJI::canSkipMethodVerification(CORINFO_METHOD_HANDLE ftnHandle)
{
return original_ICorJitInfo->canSkipMethodVerification(ftnHandle);
}
// load and restore the method
-void interceptor_ICJI::methodMustBeLoadedBeforeCodeIsRun(
- CORINFO_METHOD_HANDLE method
- )
+void interceptor_ICJI::methodMustBeLoadedBeforeCodeIsRun(CORINFO_METHOD_HANDLE method)
{
original_ICorJitInfo->methodMustBeLoadedBeforeCodeIsRun(method);
}
-CORINFO_METHOD_HANDLE interceptor_ICJI::mapMethodDeclToMethodImpl(
- CORINFO_METHOD_HANDLE method
- )
+CORINFO_METHOD_HANDLE interceptor_ICJI::mapMethodDeclToMethodImpl(CORINFO_METHOD_HANDLE method)
{
return original_ICorJitInfo->mapMethodDeclToMethodImpl(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 interceptor_ICJI::getGSCookie(
- GSCookie * pCookieVal, // OUT
- GSCookie ** ppCookieVal // OUT
- )
+void interceptor_ICJI::getGSCookie(GSCookie* pCookieVal, // OUT
+ GSCookie** ppCookieVal // OUT
+ )
{
original_ICorJitInfo->getGSCookie(pCookieVal, ppCookieVal);
}
@@ -293,23 +256,22 @@ void interceptor_ICJI::getGSCookie(
/**********************************************************************************/
// Resolve metadata token into runtime method handles.
-void interceptor_ICJI::resolveToken(/* IN, OUT */ CORINFO_RESOLVED_TOKEN * pResolvedToken)
+void interceptor_ICJI::resolveToken(/* IN, OUT */ CORINFO_RESOLVED_TOKEN* pResolvedToken)
{
original_ICorJitInfo->resolveToken(pResolvedToken);
}
-bool interceptor_ICJI::tryResolveToken(/* IN, OUT */ CORINFO_RESOLVED_TOKEN * pResolvedToken)
+bool interceptor_ICJI::tryResolveToken(/* IN, OUT */ CORINFO_RESOLVED_TOKEN* pResolvedToken)
{
return original_ICorJitInfo->tryResolveToken(pResolvedToken);
}
// Signature information about the call sig
-void interceptor_ICJI::findSig (
- CORINFO_MODULE_HANDLE module, /* IN */
- unsigned sigTOK, /* IN */
- CORINFO_CONTEXT_HANDLE context, /* IN */
- CORINFO_SIG_INFO *sig /* OUT */
- )
+void interceptor_ICJI::findSig(CORINFO_MODULE_HANDLE module, /* IN */
+ unsigned sigTOK, /* IN */
+ CORINFO_CONTEXT_HANDLE context, /* IN */
+ CORINFO_SIG_INFO* sig /* OUT */
+ )
{
original_ICorJitInfo->findSig(module, sigTOK, context, sig);
}
@@ -317,18 +279,16 @@ void interceptor_ICJI::findSig (
// 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 interceptor_ICJI::findCallSiteSig (
- CORINFO_MODULE_HANDLE module, /* IN */
- unsigned methTOK, /* IN */
- CORINFO_CONTEXT_HANDLE context, /* IN */
- CORINFO_SIG_INFO *sig /* OUT */
- )
+void interceptor_ICJI::findCallSiteSig(CORINFO_MODULE_HANDLE module, /* IN */
+ unsigned methTOK, /* IN */
+ CORINFO_CONTEXT_HANDLE context, /* IN */
+ CORINFO_SIG_INFO* sig /* OUT */
+ )
{
original_ICorJitInfo->findCallSiteSig(module, methTOK, context, sig);
}
-CORINFO_CLASS_HANDLE interceptor_ICJI::getTokenTypeAsHandle (
- CORINFO_RESOLVED_TOKEN * pResolvedToken /* IN */)
+CORINFO_CLASS_HANDLE interceptor_ICJI::getTokenTypeAsHandle(CORINFO_RESOLVED_TOKEN* pResolvedToken /* IN */)
{
return original_ICorJitInfo->getTokenTypeAsHandle(pResolvedToken);
}
@@ -344,34 +304,29 @@ CORINFO_CLASS_HANDLE interceptor_ICJI::getTokenTypeAsHandle (
// Returns enum whether the module does not require verification
// Also see ICorMethodInfo::canSkipMethodVerification();
-CorInfoCanSkipVerificationResult interceptor_ICJI::canSkipVerification (
- CORINFO_MODULE_HANDLE module /* IN */
- )
+CorInfoCanSkipVerificationResult interceptor_ICJI::canSkipVerification(CORINFO_MODULE_HANDLE module /* IN */
+ )
{
return original_ICorJitInfo->canSkipVerification(module);
}
// Checks if the given metadata token is valid
-BOOL interceptor_ICJI::isValidToken (
- CORINFO_MODULE_HANDLE module, /* IN */
- unsigned metaTOK /* IN */
- )
+BOOL interceptor_ICJI::isValidToken(CORINFO_MODULE_HANDLE module, /* IN */
+ unsigned metaTOK /* IN */
+ )
{
return original_ICorJitInfo->isValidToken(module, metaTOK);
}
// Checks if the given metadata token is valid StringRef
-BOOL interceptor_ICJI::isValidStringRef (
- CORINFO_MODULE_HANDLE module, /* IN */
- unsigned metaTOK /* IN */
- )
+BOOL interceptor_ICJI::isValidStringRef(CORINFO_MODULE_HANDLE module, /* IN */
+ unsigned metaTOK /* IN */
+ )
{
return original_ICorJitInfo->isValidStringRef(module, metaTOK);
}
-BOOL interceptor_ICJI::shouldEnforceCallvirtRestriction(
- CORINFO_MODULE_HANDLE scope
- )
+BOOL interceptor_ICJI::shouldEnforceCallvirtRestriction(CORINFO_MODULE_HANDLE scope)
{
return original_ICorJitInfo->shouldEnforceCallvirtRestriction(scope);
}
@@ -384,40 +339,34 @@ BOOL interceptor_ICJI::shouldEnforceCallvirtRestriction(
// If the value class 'cls' is isomorphic to a primitive type it will
// return that type, otherwise it will return CORINFO_TYPE_VALUECLASS
-CorInfoType interceptor_ICJI::asCorInfoType (
- CORINFO_CLASS_HANDLE cls
- )
+CorInfoType interceptor_ICJI::asCorInfoType(CORINFO_CLASS_HANDLE cls)
{
return original_ICorJitInfo->asCorInfoType(cls);
}
// for completeness
-const char* interceptor_ICJI::getClassName (
- CORINFO_CLASS_HANDLE cls
- )
+const char* interceptor_ICJI::getClassName(CORINFO_CLASS_HANDLE cls)
{
return original_ICorJitInfo->getClassName(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 interceptor_ICJI::appendClassName(
- __deref_inout_ecount(*pnBufLen) WCHAR** ppBuf,
- int* pnBufLen,
- CORINFO_CLASS_HANDLE cls,
- BOOL fNamespace,
- BOOL fFullInst,
- BOOL fAssembly
- )
+int interceptor_ICJI::appendClassName(__deref_inout_ecount(*pnBufLen) WCHAR** ppBuf,
+ int* pnBufLen,
+ CORINFO_CLASS_HANDLE cls,
+ BOOL fNamespace,
+ BOOL fFullInst,
+ BOOL fAssembly)
{
return original_ICorJitInfo->appendClassName(ppBuf, pnBufLen, cls, fNamespace, fFullInst, fAssembly);
}
-// Quick check whether the type is a value class. Returns the same value as getClassAttribs(cls) & CORINFO_FLG_VALUECLASS, except faster.
+// Quick check whether the type is a value class. Returns the same value as getClassAttribs(cls) &
+// CORINFO_FLG_VALUECLASS, except faster.
BOOL interceptor_ICJI::isValueClass(CORINFO_CLASS_HANDLE cls)
{
return original_ICorJitInfo->isValueClass(cls);
@@ -431,9 +380,7 @@ BOOL interceptor_ICJI::canInlineTypeCheckWithObjectVTable(CORINFO_CLASS_HANDLE c
}
// return flags (defined above, CORINFO_FLG_PUBLIC ...)
-DWORD interceptor_ICJI::getClassAttribs (
- CORINFO_CLASS_HANDLE cls
- )
+DWORD interceptor_ICJI::getClassAttribs(CORINFO_CLASS_HANDLE cls)
{
return original_ICorJitInfo->getClassAttribs(cls);
}
@@ -449,25 +396,19 @@ BOOL interceptor_ICJI::isStructRequiringStackAllocRetBuf(CORINFO_CLASS_HANDLE cl
return original_ICorJitInfo->isStructRequiringStackAllocRetBuf(cls);
}
-CORINFO_MODULE_HANDLE interceptor_ICJI::getClassModule (
- CORINFO_CLASS_HANDLE cls
- )
+CORINFO_MODULE_HANDLE interceptor_ICJI::getClassModule(CORINFO_CLASS_HANDLE cls)
{
return original_ICorJitInfo->getClassModule(cls);
}
// Returns the assembly that contains the module "mod".
-CORINFO_ASSEMBLY_HANDLE interceptor_ICJI::getModuleAssembly (
- CORINFO_MODULE_HANDLE mod
- )
+CORINFO_ASSEMBLY_HANDLE interceptor_ICJI::getModuleAssembly(CORINFO_MODULE_HANDLE mod)
{
return original_ICorJitInfo->getModuleAssembly(mod);
}
// Returns the name of the assembly "assem".
-const char* interceptor_ICJI::getAssemblyName (
- CORINFO_ASSEMBLY_HANDLE assem
- )
+const char* interceptor_ICJI::getAssemblyName(CORINFO_ASSEMBLY_HANDLE assem)
{
return original_ICorJitInfo->getAssemblyName(assem);
}
@@ -486,27 +427,20 @@ void interceptor_ICJI::LongLifetimeFree(void* obj)
original_ICorJitInfo->LongLifetimeFree(obj);
}
-size_t interceptor_ICJI::getClassModuleIdForStatics (
- CORINFO_CLASS_HANDLE cls,
- CORINFO_MODULE_HANDLE *pModule,
- void **ppIndirection
- )
+size_t interceptor_ICJI::getClassModuleIdForStatics(CORINFO_CLASS_HANDLE cls,
+ CORINFO_MODULE_HANDLE* pModule,
+ void** ppIndirection)
{
return original_ICorJitInfo->getClassModuleIdForStatics(cls, pModule, ppIndirection);
}
// return the number of bytes needed by an instance of the class
-unsigned interceptor_ICJI::getClassSize (
- CORINFO_CLASS_HANDLE cls
- )
+unsigned interceptor_ICJI::getClassSize(CORINFO_CLASS_HANDLE cls)
{
return original_ICorJitInfo->getClassSize(cls);
}
-unsigned interceptor_ICJI::getClassAlignmentRequirement (
- CORINFO_CLASS_HANDLE cls,
- BOOL fDoubleAlignHint
- )
+unsigned interceptor_ICJI::getClassAlignmentRequirement(CORINFO_CLASS_HANDLE cls, BOOL fDoubleAlignHint)
{
return original_ICorJitInfo->getClassAlignmentRequirement(cls, fDoubleAlignHint);
}
@@ -520,76 +454,56 @@ unsigned interceptor_ICJI::getClassAlignmentRequirement (
// 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 interceptor_ICJI::getClassGClayout (
- CORINFO_CLASS_HANDLE cls, /* IN */
- BYTE *gcPtrs /* OUT */
- )
+unsigned interceptor_ICJI::getClassGClayout(CORINFO_CLASS_HANDLE cls, /* IN */
+ BYTE* gcPtrs /* OUT */
+ )
{
return original_ICorJitInfo->getClassGClayout(cls, gcPtrs);
}
// returns the number of instance fields in a class
-unsigned interceptor_ICJI::getClassNumInstanceFields (
- CORINFO_CLASS_HANDLE cls /* IN */
- )
+unsigned interceptor_ICJI::getClassNumInstanceFields(CORINFO_CLASS_HANDLE cls /* IN */
+ )
{
return original_ICorJitInfo->getClassNumInstanceFields(cls);
}
-CORINFO_FIELD_HANDLE interceptor_ICJI::getFieldInClass(
- CORINFO_CLASS_HANDLE clsHnd,
- INT num
- )
+CORINFO_FIELD_HANDLE interceptor_ICJI::getFieldInClass(CORINFO_CLASS_HANDLE clsHnd, INT num)
{
return original_ICorJitInfo->getFieldInClass(clsHnd, num);
}
-BOOL interceptor_ICJI::checkMethodModifier(
- CORINFO_METHOD_HANDLE hMethod,
- LPCSTR modifier,
- BOOL fOptional
- )
+BOOL interceptor_ICJI::checkMethodModifier(CORINFO_METHOD_HANDLE hMethod, LPCSTR modifier, BOOL fOptional)
{
return original_ICorJitInfo->checkMethodModifier(hMethod, modifier, fOptional);
}
// returns the "NEW" helper optimized for "newCls."
-CorInfoHelpFunc interceptor_ICJI::getNewHelper(
- CORINFO_RESOLVED_TOKEN * pResolvedToken,
- CORINFO_METHOD_HANDLE callerHandle
- )
+CorInfoHelpFunc interceptor_ICJI::getNewHelper(CORINFO_RESOLVED_TOKEN* pResolvedToken,
+ CORINFO_METHOD_HANDLE callerHandle)
{
return original_ICorJitInfo->getNewHelper(pResolvedToken, callerHandle);
}
// returns the newArr (1-Dim array) helper optimized for "arrayCls."
-CorInfoHelpFunc interceptor_ICJI::getNewArrHelper(
- CORINFO_CLASS_HANDLE arrayCls
- )
+CorInfoHelpFunc interceptor_ICJI::getNewArrHelper(CORINFO_CLASS_HANDLE arrayCls)
{
return original_ICorJitInfo->getNewArrHelper(arrayCls);
}
// returns the optimized "IsInstanceOf" or "ChkCast" helper
-CorInfoHelpFunc interceptor_ICJI::getCastingHelper(
- CORINFO_RESOLVED_TOKEN * pResolvedToken,
- bool fThrowing
- )
+CorInfoHelpFunc interceptor_ICJI::getCastingHelper(CORINFO_RESOLVED_TOKEN* pResolvedToken, bool fThrowing)
{
return original_ICorJitInfo->getCastingHelper(pResolvedToken, fThrowing);
}
// returns helper to trigger static constructor
-CorInfoHelpFunc interceptor_ICJI::getSharedCCtorHelper(
- CORINFO_CLASS_HANDLE clsHnd
- )
+CorInfoHelpFunc interceptor_ICJI::getSharedCCtorHelper(CORINFO_CLASS_HANDLE clsHnd)
{
return original_ICorJitInfo->getSharedCCtorHelper(clsHnd);
}
-CorInfoHelpFunc interceptor_ICJI::getSecurityPrologHelper(
- CORINFO_METHOD_HANDLE ftn
- )
+CorInfoHelpFunc interceptor_ICJI::getSecurityPrologHelper(CORINFO_METHOD_HANDLE ftn)
{
return original_ICorJitInfo->getSecurityPrologHelper(ftn);
}
@@ -598,9 +512,7 @@ CorInfoHelpFunc interceptor_ICJI::getSecurityPrologHelper(
// 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 interceptor_ICJI::getTypeForBox(
- CORINFO_CLASS_HANDLE cls
- )
+CORINFO_CLASS_HANDLE interceptor_ICJI::getTypeForBox(CORINFO_CLASS_HANDLE cls)
{
return original_ICorJitInfo->getTypeForBox(cls);
}
@@ -608,9 +520,7 @@ CORINFO_CLASS_HANDLE interceptor_ICJI::getTypeForBox(
// 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 interceptor_ICJI::getBoxHelper(
- CORINFO_CLASS_HANDLE cls
- )
+CorInfoHelpFunc interceptor_ICJI::getBoxHelper(CORINFO_CLASS_HANDLE cls)
{
return original_ICorJitInfo->getBoxHelper(cls);
}
@@ -627,35 +537,27 @@ CorInfoHelpFunc interceptor_ICJI::getBoxHelper(
// The EE set 'helperCopies' on return to indicate what kind of
// helper has been created.
-CorInfoHelpFunc interceptor_ICJI::getUnBoxHelper(
- CORINFO_CLASS_HANDLE cls
- )
+CorInfoHelpFunc interceptor_ICJI::getUnBoxHelper(CORINFO_CLASS_HANDLE cls)
{
return original_ICorJitInfo->getUnBoxHelper(cls);
}
-bool interceptor_ICJI::getReadyToRunHelper(
- CORINFO_RESOLVED_TOKEN * pResolvedToken,
- CORINFO_LOOKUP_KIND * pGenericLookupKind,
- CorInfoHelpFunc id,
- CORINFO_CONST_LOOKUP * pLookup
- )
+bool interceptor_ICJI::getReadyToRunHelper(CORINFO_RESOLVED_TOKEN* pResolvedToken,
+ CORINFO_LOOKUP_KIND* pGenericLookupKind,
+ CorInfoHelpFunc id,
+ CORINFO_CONST_LOOKUP* pLookup)
{
return original_ICorJitInfo->getReadyToRunHelper(pResolvedToken, pGenericLookupKind, id, pLookup);
}
-void interceptor_ICJI::getReadyToRunDelegateCtorHelper(
- CORINFO_RESOLVED_TOKEN * pTargetMethod,
- CORINFO_CLASS_HANDLE delegateType,
- CORINFO_LOOKUP * pLookup
- )
+void interceptor_ICJI::getReadyToRunDelegateCtorHelper(CORINFO_RESOLVED_TOKEN* pTargetMethod,
+ CORINFO_CLASS_HANDLE delegateType,
+ CORINFO_LOOKUP* pLookup)
{
original_ICorJitInfo->getReadyToRunDelegateCtorHelper(pTargetMethod, delegateType, pLookup);
}
-const char* interceptor_ICJI::getHelperName(
- CorInfoHelpFunc funcNum
- )
+const char* interceptor_ICJI::getHelperName(CorInfoHelpFunc funcNum)
{
return original_ICorJitInfo->getHelperName(funcNum);
}
@@ -666,12 +568,12 @@ const char* interceptor_ICJI::getHelperName(
//
// See code:ICorClassInfo#ClassConstruction.
CorInfoInitClassResult interceptor_ICJI::initClass(
- CORINFO_FIELD_HANDLE field, // Non-nullptr - inquire about cctor trigger before static field access
- // nullptr - 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 // TRUE means don't actually run it
- )
+ CORINFO_FIELD_HANDLE field, // Non-nullptr - inquire about cctor trigger before static field access
+ // nullptr - 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 // TRUE means don't actually run it
+ )
{
return original_ICorJitInfo->initClass(field, method, context, speculative);
}
@@ -686,53 +588,40 @@ CorInfoInitClassResult interceptor_ICJI::initClass(
// 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 interceptor_ICJI::classMustBeLoadedBeforeCodeIsRun(
- CORINFO_CLASS_HANDLE cls
- )
+void interceptor_ICJI::classMustBeLoadedBeforeCodeIsRun(CORINFO_CLASS_HANDLE cls)
{
original_ICorJitInfo->classMustBeLoadedBeforeCodeIsRun(cls);
}
// returns the class handle for the special builtin classes
-CORINFO_CLASS_HANDLE interceptor_ICJI::getBuiltinClass (
- CorInfoClassId classId
- )
+CORINFO_CLASS_HANDLE interceptor_ICJI::getBuiltinClass(CorInfoClassId classId)
{
return original_ICorJitInfo->getBuiltinClass(classId);
}
// "System.Int32" ==> CORINFO_TYPE_INT..
-CorInfoType interceptor_ICJI::getTypeForPrimitiveValueClass(
- CORINFO_CLASS_HANDLE cls
- )
+CorInfoType interceptor_ICJI::getTypeForPrimitiveValueClass(CORINFO_CLASS_HANDLE cls)
{
return original_ICorJitInfo->getTypeForPrimitiveValueClass(cls);
}
// TRUE if child is a subtype of parent
// if parent is an interface, then does child implement / extend parent
-BOOL interceptor_ICJI::canCast(
- CORINFO_CLASS_HANDLE child, // subtype (extends parent)
- CORINFO_CLASS_HANDLE parent // base type
- )
+BOOL interceptor_ICJI::canCast(CORINFO_CLASS_HANDLE child, // subtype (extends parent)
+ CORINFO_CLASS_HANDLE parent // base type
+ )
{
return original_ICorJitInfo->canCast(child, parent);
}
// TRUE if cls1 and cls2 are considered equivalent types.
-BOOL interceptor_ICJI::areTypesEquivalent(
- CORINFO_CLASS_HANDLE cls1,
- CORINFO_CLASS_HANDLE cls2
- )
+BOOL interceptor_ICJI::areTypesEquivalent(CORINFO_CLASS_HANDLE cls1, CORINFO_CLASS_HANDLE cls2)
{
return original_ICorJitInfo->areTypesEquivalent(cls1, cls2);
}
// returns is the intersection of cls1 and cls2.
-CORINFO_CLASS_HANDLE interceptor_ICJI::mergeClasses(
- CORINFO_CLASS_HANDLE cls1,
- CORINFO_CLASS_HANDLE cls2
- )
+CORINFO_CLASS_HANDLE interceptor_ICJI::mergeClasses(CORINFO_CLASS_HANDLE cls1, CORINFO_CLASS_HANDLE cls2)
{
return original_ICorJitInfo->mergeClasses(cls1, cls2);
}
@@ -740,9 +629,7 @@ CORINFO_CLASS_HANDLE interceptor_ICJI::mergeClasses(
// 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 interceptor_ICJI::getParentType (
- CORINFO_CLASS_HANDLE cls
- )
+CORINFO_CLASS_HANDLE interceptor_ICJI::getParentType(CORINFO_CLASS_HANDLE cls)
{
return original_ICorJitInfo->getParentType(cls);
}
@@ -751,54 +638,42 @@ CORINFO_CLASS_HANDLE interceptor_ICJI::getParentType (
// not a primitive type, *clsRet will be set.
// Given an Array of Type Foo, returns Foo.
// Given BYREF Foo, returns Foo
-CorInfoType interceptor_ICJI::getChildType (
- CORINFO_CLASS_HANDLE clsHnd,
- CORINFO_CLASS_HANDLE *clsRet
- )
+CorInfoType interceptor_ICJI::getChildType(CORINFO_CLASS_HANDLE clsHnd, CORINFO_CLASS_HANDLE* clsRet)
{
return original_ICorJitInfo->getChildType(clsHnd, clsRet);
}
// Check constraints on type arguments of this class and parent classes
-BOOL interceptor_ICJI::satisfiesClassConstraints(
- CORINFO_CLASS_HANDLE cls
- )
+BOOL interceptor_ICJI::satisfiesClassConstraints(CORINFO_CLASS_HANDLE cls)
{
return original_ICorJitInfo->satisfiesClassConstraints(cls);
}
// Check if this is a single dimensional array type
-BOOL interceptor_ICJI::isSDArray(
- CORINFO_CLASS_HANDLE cls
- )
+BOOL interceptor_ICJI::isSDArray(CORINFO_CLASS_HANDLE cls)
{
return original_ICorJitInfo->isSDArray(cls);
}
// Get the numbmer of dimensions in an array
-unsigned interceptor_ICJI::getArrayRank(
- CORINFO_CLASS_HANDLE cls
- )
+unsigned interceptor_ICJI::getArrayRank(CORINFO_CLASS_HANDLE cls)
{
return original_ICorJitInfo->getArrayRank(cls);
}
// Get static field data for an array
-void * interceptor_ICJI::getArrayInitializationData(
- CORINFO_FIELD_HANDLE field,
- DWORD size
- )
+void* interceptor_ICJI::getArrayInitializationData(CORINFO_FIELD_HANDLE field, DWORD size)
{
return original_ICorJitInfo->getArrayInitializationData(field, size);
}
// Check Visibility rules.
CorInfoIsAccessAllowedResult interceptor_ICJI::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. */
- )
+ 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 original_ICorJitInfo->canAccessClass(pResolvedToken, callerHandle, pAccessHelper);
}
@@ -812,18 +687,15 @@ CorInfoIsAccessAllowedResult interceptor_ICJI::canAccessClass(
// 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* interceptor_ICJI::getFieldName (
- CORINFO_FIELD_HANDLE ftn, /* IN */
- const char **moduleName /* OUT */
- )
+const char* interceptor_ICJI::getFieldName(CORINFO_FIELD_HANDLE ftn, /* IN */
+ const char** moduleName /* OUT */
+ )
{
return original_ICorJitInfo->getFieldName(ftn, moduleName);
}
// return class it belongs to
-CORINFO_CLASS_HANDLE interceptor_ICJI::getFieldClass (
- CORINFO_FIELD_HANDLE field
- )
+CORINFO_CLASS_HANDLE interceptor_ICJI::getFieldClass(CORINFO_FIELD_HANDLE field)
{
return original_ICorJitInfo->getFieldClass(field);
}
@@ -834,19 +706,16 @@ CORINFO_CLASS_HANDLE interceptor_ICJI::getFieldClass (
//
// 'memberParent' is typically only set when verifying. It should be the
// result of calling getMemberParent.
-CorInfoType interceptor_ICJI::getFieldType(
- CORINFO_FIELD_HANDLE field,
- CORINFO_CLASS_HANDLE *structType,
- CORINFO_CLASS_HANDLE memberParent/* IN */
- )
+CorInfoType interceptor_ICJI::getFieldType(CORINFO_FIELD_HANDLE field,
+ CORINFO_CLASS_HANDLE* structType,
+ CORINFO_CLASS_HANDLE memberParent /* IN */
+ )
{
return original_ICorJitInfo->getFieldType(field, structType, memberParent);
}
// return the data member's instance offset
-unsigned interceptor_ICJI::getFieldOffset(
- CORINFO_FIELD_HANDLE field
- )
+unsigned interceptor_ICJI::getFieldOffset(CORINFO_FIELD_HANDLE field)
{
return original_ICorJitInfo->getFieldOffset(field);
}
@@ -854,17 +723,15 @@ unsigned interceptor_ICJI::getFieldOffset(
// 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 interceptor_ICJI::isWriteBarrierHelperRequired(
- CORINFO_FIELD_HANDLE field)
+bool interceptor_ICJI::isWriteBarrierHelperRequired(CORINFO_FIELD_HANDLE field)
{
return original_ICorJitInfo->isWriteBarrierHelperRequired(field);
}
-void interceptor_ICJI::getFieldInfo (CORINFO_RESOLVED_TOKEN * pResolvedToken,
- CORINFO_METHOD_HANDLE callerHandle,
- CORINFO_ACCESS_FLAGS flags,
- CORINFO_FIELD_INFO *pResult
- )
+void interceptor_ICJI::getFieldInfo(CORINFO_RESOLVED_TOKEN* pResolvedToken,
+ CORINFO_METHOD_HANDLE callerHandle,
+ CORINFO_ACCESS_FLAGS flags,
+ CORINFO_FIELD_INFO* pResult)
{
original_ICorJitInfo->getFieldInfo(pResolvedToken, callerHandle, flags, pResult);
}
@@ -890,13 +757,13 @@ bool interceptor_ICJI::isFieldStatic(CORINFO_FIELD_HANDLE fldHnd)
// 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 interceptor_ICJI::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
- )
+void interceptor_ICJI::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
+ )
{
original_ICorJitInfo->getBoundaries(ftn, cILOffsets, pILOffsets, implictBoundaries);
}
@@ -908,12 +775,12 @@ void interceptor_ICJI::getBoundaries(
// 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 interceptor_ICJI::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
- )
+void interceptor_ICJI::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
+ )
{
original_ICorJitInfo->setBoundaries(ftn, cMap, pMap);
}
@@ -926,14 +793,13 @@ void interceptor_ICJI::setBoundaries(
// 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 interceptor_ICJI::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
- )
+void interceptor_ICJI::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
+ )
{
original_ICorJitInfo->getVars(ftn, cVars, vars, extendOthers);
}
@@ -942,12 +808,12 @@ void interceptor_ICJI::getVars(
// note that the JIT might split lifetimes into different
// locations etc.
-void interceptor_ICJI::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
- )
+void interceptor_ICJI::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
+ )
{
original_ICorJitInfo->setVars(ftn, cVars, vars);
}
@@ -957,9 +823,7 @@ void interceptor_ICJI::setVars(
// 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 * interceptor_ICJI::allocateArray(
- ULONG cBytes
- )
+void* interceptor_ICJI::allocateArray(ULONG cBytes)
{
return original_ICorJitInfo->allocateArray(cBytes);
}
@@ -968,9 +832,7 @@ void * interceptor_ICJI::allocateArray(
// For eg, The EE returns memory in getVars() and getBoundaries()
// to the JitCompiler, which the JitCompiler should release using
// freeArray()
-void interceptor_ICJI::freeArray(
- void *array
- )
+void interceptor_ICJI::freeArray(void* array)
{
original_ICorJitInfo->freeArray(array);
}
@@ -983,9 +845,8 @@ void interceptor_ICJI::freeArray(
// advance the pointer to the argument list.
// a ptr of 0, is special and always means the first argument
-CORINFO_ARG_LIST_HANDLE interceptor_ICJI::getArgNext (
- CORINFO_ARG_LIST_HANDLE args /* IN */
- )
+CORINFO_ARG_LIST_HANDLE interceptor_ICJI::getArgNext(CORINFO_ARG_LIST_HANDLE args /* IN */
+ )
{
return original_ICorJitInfo->getArgNext(args);
}
@@ -999,28 +860,24 @@ CORINFO_ARG_LIST_HANDLE interceptor_ICJI::getArgNext (
// 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 interceptor_ICJI::getArgType (
- CORINFO_SIG_INFO* sig, /* IN */
- CORINFO_ARG_LIST_HANDLE args, /* IN */
- CORINFO_CLASS_HANDLE *vcTypeRet /* OUT */
- )
+CorInfoTypeWithMod interceptor_ICJI::getArgType(CORINFO_SIG_INFO* sig, /* IN */
+ CORINFO_ARG_LIST_HANDLE args, /* IN */
+ CORINFO_CLASS_HANDLE* vcTypeRet /* OUT */
+ )
{
return original_ICorJitInfo->getArgType(sig, args, vcTypeRet);
}
// If the Arg is a CORINFO_TYPE_CLASS fetch the class handle associated with it
-CORINFO_CLASS_HANDLE interceptor_ICJI::getArgClass (
- CORINFO_SIG_INFO* sig, /* IN */
- CORINFO_ARG_LIST_HANDLE args /* IN */
- )
+CORINFO_CLASS_HANDLE interceptor_ICJI::getArgClass(CORINFO_SIG_INFO* sig, /* IN */
+ CORINFO_ARG_LIST_HANDLE args /* IN */
+ )
{
return original_ICorJitInfo->getArgClass(sig, args);
}
// Returns type of HFA for valuetype
-CorInfoType interceptor_ICJI::getHFAType (
- CORINFO_CLASS_HANDLE hClass
- )
+CorInfoType interceptor_ICJI::getHFAType(CORINFO_CLASS_HANDLE hClass)
{
return original_ICorJitInfo->getHFAType(hClass);
}
@@ -1032,9 +889,7 @@ CorInfoType interceptor_ICJI::getHFAType (
*****************************************************************************/
// Returns the HRESULT of the current exception
-HRESULT interceptor_ICJI::GetErrorHRESULT(
- struct _EXCEPTION_POINTERS *pExceptionPointers
- )
+HRESULT interceptor_ICJI::GetErrorHRESULT(struct _EXCEPTION_POINTERS* pExceptionPointers)
{
return original_ICorJitInfo->GetErrorHRESULT(pExceptionPointers);
}
@@ -1042,10 +897,7 @@ HRESULT interceptor_ICJI::GetErrorHRESULT(
// 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 interceptor_ICJI::GetErrorMessage(
- __inout_ecount(bufferLength) LPWSTR buffer,
- ULONG bufferLength
- )
+ULONG interceptor_ICJI::GetErrorMessage(__inout_ecount(bufferLength) LPWSTR buffer, ULONG bufferLength)
{
return original_ICorJitInfo->GetErrorMessage(buffer, bufferLength);
}
@@ -1056,30 +908,24 @@ ULONG interceptor_ICJI::GetErrorMessage(
// things like ThreadStoppedException ...
// returns EXCEPTION_CONTINUE_EXECUTION if exception is fixed up by the EE
-int interceptor_ICJI::FilterException(
- struct _EXCEPTION_POINTERS *pExceptionPointers
- )
+int interceptor_ICJI::FilterException(struct _EXCEPTION_POINTERS* pExceptionPointers)
{
return original_ICorJitInfo->FilterException(pExceptionPointers);
}
// Cleans up internal EE tracking when an exception is caught.
-void interceptor_ICJI::HandleException(
- struct _EXCEPTION_POINTERS *pExceptionPointers
- )
+void interceptor_ICJI::HandleException(struct _EXCEPTION_POINTERS* pExceptionPointers)
{
original_ICorJitInfo->HandleException(pExceptionPointers);
}
-void interceptor_ICJI::ThrowExceptionForJitResult(
- HRESULT result)
+void interceptor_ICJI::ThrowExceptionForJitResult(HRESULT result)
{
original_ICorJitInfo->ThrowExceptionForJitResult(result);
}
-//Throws an exception defined by the given throw helper.
-void interceptor_ICJI::ThrowExceptionForHelper(
- const CORINFO_HELPER_DESC * throwHelper)
+// Throws an exception defined by the given throw helper.
+void interceptor_ICJI::ThrowExceptionForHelper(const CORINFO_HELPER_DESC* throwHelper)
{
original_ICorJitInfo->ThrowExceptionForHelper(throwHelper);
}
@@ -1092,9 +938,7 @@ void interceptor_ICJI::ThrowExceptionForHelper(
*****************************************************************************/
// Return details about EE internal data structures
-void interceptor_ICJI::getEEInfo(
- CORINFO_EE_INFO *pEEInfoOut
- )
+void interceptor_ICJI::getEEInfo(CORINFO_EE_INFO* pEEInfoOut)
{
original_ICorJitInfo->getEEInfo(pEEInfoOut);
}
@@ -1102,21 +946,18 @@ void interceptor_ICJI::getEEInfo(
// Returns name of the JIT timer log
LPCWSTR interceptor_ICJI::getJitTimeLogFilename()
{
- return original_ICorJitInfo->getJitTimeLogFilename();
+ return original_ICorJitInfo->getJitTimeLogFilename();
}
-
- /*********************************************************************************/
- //
- // Diagnostic methods
- //
- /*********************************************************************************/
+/*********************************************************************************/
+//
+// Diagnostic methods
+//
+/*********************************************************************************/
// this function is for debugging only. Returns method token.
// Returns mdMethodDefNil for dynamic methods.
-mdMethodDef interceptor_ICJI::getMethodDefFromMethod(
- CORINFO_METHOD_HANDLE hMethod
- )
+mdMethodDef interceptor_ICJI::getMethodDefFromMethod(CORINFO_METHOD_HANDLE hMethod)
{
return original_ICorJitInfo->getMethodDefFromMethod(hMethod);
}
@@ -1124,10 +965,9 @@ mdMethodDef interceptor_ICJI::getMethodDefFromMethod(
// 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* interceptor_ICJI::getMethodName (
- CORINFO_METHOD_HANDLE ftn, /* IN */
- const char **moduleName /* OUT */
- )
+const char* interceptor_ICJI::getMethodName(CORINFO_METHOD_HANDLE ftn, /* IN */
+ const char** moduleName /* OUT */
+ )
{
return original_ICorJitInfo->getMethodName(ftn, moduleName);
}
@@ -1135,64 +975,52 @@ const char* interceptor_ICJI::getMethodName (
// 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 interceptor_ICJI::getMethodHash (
- CORINFO_METHOD_HANDLE ftn /* IN */
- )
+unsigned interceptor_ICJI::getMethodHash(CORINFO_METHOD_HANDLE ftn /* IN */
+ )
{
return original_ICorJitInfo->getMethodHash(ftn);
}
// this function is for debugging only.
-size_t interceptor_ICJI::findNameOfToken (
- CORINFO_MODULE_HANDLE module, /* IN */
- mdToken metaTOK, /* IN */
- __out_ecount (FQNameCapacity) char * szFQName, /* OUT */
- size_t FQNameCapacity /* IN */
- )
+size_t interceptor_ICJI::findNameOfToken(CORINFO_MODULE_HANDLE module, /* IN */
+ mdToken metaTOK, /* IN */
+ __out_ecount(FQNameCapacity) char* szFQName, /* OUT */
+ size_t FQNameCapacity /* IN */
+ )
{
return original_ICorJitInfo->findNameOfToken(module, metaTOK, szFQName, FQNameCapacity);
}
bool interceptor_ICJI::getSystemVAmd64PassStructInRegisterDescriptor(
- /* IN */ CORINFO_CLASS_HANDLE structHnd,
- /* OUT */ SYSTEMV_AMD64_CORINFO_STRUCT_REG_PASSING_DESCRIPTOR* structPassInRegDescPtr
- )
+ /* IN */ CORINFO_CLASS_HANDLE structHnd,
+ /* OUT */ SYSTEMV_AMD64_CORINFO_STRUCT_REG_PASSING_DESCRIPTOR* structPassInRegDescPtr)
{
return original_ICorJitInfo->getSystemVAmd64PassStructInRegisterDescriptor(structHnd, structPassInRegDescPtr);
}
-//Stuff on ICorDynamicInfo
-DWORD interceptor_ICJI::getThreadTLSIndex(
- void **ppIndirection
- )
+// Stuff on ICorDynamicInfo
+DWORD interceptor_ICJI::getThreadTLSIndex(void** ppIndirection)
{
return original_ICorJitInfo->getThreadTLSIndex(ppIndirection);
}
-const void * interceptor_ICJI::getInlinedCallFrameVptr(
- void **ppIndirection
- )
+const void* interceptor_ICJI::getInlinedCallFrameVptr(void** ppIndirection)
{
return original_ICorJitInfo->getInlinedCallFrameVptr(ppIndirection);
}
-LONG * interceptor_ICJI::getAddrOfCaptureThreadGlobal(
- void **ppIndirection
- )
+LONG* interceptor_ICJI::getAddrOfCaptureThreadGlobal(void** ppIndirection)
{
return original_ICorJitInfo->getAddrOfCaptureThreadGlobal(ppIndirection);
}
-SIZE_T* interceptor_ICJI::getAddrModuleDomainID(CORINFO_MODULE_HANDLE module)
+SIZE_T* interceptor_ICJI::getAddrModuleDomainID(CORINFO_MODULE_HANDLE module)
{
return original_ICorJitInfo->getAddrModuleDomainID(module);
}
// return the native entry point to an EE helper (see CorInfoHelpFunc)
-void* interceptor_ICJI::getHelperFtn (
- CorInfoHelpFunc ftnNum,
- void **ppIndirection
- )
+void* interceptor_ICJI::getHelperFtn(CorInfoHelpFunc ftnNum, void** ppIndirection)
{
return original_ICorJitInfo->getHelperFtn(ftnNum, ppIndirection);
}
@@ -1200,10 +1028,9 @@ void* interceptor_ICJI::getHelperFtn (
// 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 interceptor_ICJI::getFunctionEntryPoint(
- CORINFO_METHOD_HANDLE ftn, /* IN */
- CORINFO_CONST_LOOKUP * pResult, /* OUT */
- CORINFO_ACCESS_FLAGS accessFlags)
+void interceptor_ICJI::getFunctionEntryPoint(CORINFO_METHOD_HANDLE ftn, /* IN */
+ CORINFO_CONST_LOOKUP* pResult, /* OUT */
+ CORINFO_ACCESS_FLAGS accessFlags)
{
original_ICorJitInfo->getFunctionEntryPoint(ftn, pResult, accessFlags);
}
@@ -1211,18 +1038,13 @@ void interceptor_ICJI::getFunctionEntryPoint(
// 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 interceptor_ICJI::getFunctionFixedEntryPoint(
- CORINFO_METHOD_HANDLE ftn,
- CORINFO_CONST_LOOKUP * pResult)
+void interceptor_ICJI::getFunctionFixedEntryPoint(CORINFO_METHOD_HANDLE ftn, CORINFO_CONST_LOOKUP* pResult)
{
original_ICorJitInfo->getFunctionFixedEntryPoint(ftn, pResult);
}
// get the synchronization handle that is passed to monXstatic function
-void* interceptor_ICJI::getMethodSync(
- CORINFO_METHOD_HANDLE ftn,
- void **ppIndirection
- )
+void* interceptor_ICJI::getMethodSync(CORINFO_METHOD_HANDLE ftn, void** ppIndirection)
{
return original_ICorJitInfo->getMethodSync(ftn, ppIndirection);
}
@@ -1233,41 +1055,27 @@ void* interceptor_ICJI::getMethodSync(
// get slow lazy string literal helper to use (CORINFO_HELP_STRCNS*).
// Returns CORINFO_HELP_UNDEF if lazy string literal helper cannot be used.
-CorInfoHelpFunc interceptor_ICJI::getLazyStringLiteralHelper(
- CORINFO_MODULE_HANDLE handle
- )
+CorInfoHelpFunc interceptor_ICJI::getLazyStringLiteralHelper(CORINFO_MODULE_HANDLE handle)
{
return original_ICorJitInfo->getLazyStringLiteralHelper(handle);
}
-CORINFO_MODULE_HANDLE interceptor_ICJI::embedModuleHandle(
- CORINFO_MODULE_HANDLE handle,
- void **ppIndirection
- )
+CORINFO_MODULE_HANDLE interceptor_ICJI::embedModuleHandle(CORINFO_MODULE_HANDLE handle, void** ppIndirection)
{
return original_ICorJitInfo->embedModuleHandle(handle, ppIndirection);
}
-CORINFO_CLASS_HANDLE interceptor_ICJI::embedClassHandle(
- CORINFO_CLASS_HANDLE handle,
- void **ppIndirection
- )
+CORINFO_CLASS_HANDLE interceptor_ICJI::embedClassHandle(CORINFO_CLASS_HANDLE handle, void** ppIndirection)
{
return original_ICorJitInfo->embedClassHandle(handle, ppIndirection);
}
-CORINFO_METHOD_HANDLE interceptor_ICJI::embedMethodHandle(
- CORINFO_METHOD_HANDLE handle,
- void **ppIndirection
- )
+CORINFO_METHOD_HANDLE interceptor_ICJI::embedMethodHandle(CORINFO_METHOD_HANDLE handle, void** ppIndirection)
{
return original_ICorJitInfo->embedMethodHandle(handle, ppIndirection);
}
-CORINFO_FIELD_HANDLE interceptor_ICJI::embedFieldHandle(
- CORINFO_FIELD_HANDLE handle,
- void **ppIndirection
- )
+CORINFO_FIELD_HANDLE interceptor_ICJI::embedFieldHandle(CORINFO_FIELD_HANDLE handle, void** ppIndirection)
{
return original_ICorJitInfo->embedFieldHandle(handle, ppIndirection);
}
@@ -1279,10 +1087,10 @@ CORINFO_FIELD_HANDLE interceptor_ICJI::embedFieldHandle(
// code is shared and the token contains generic parameters)
// then indicate how the handle should be looked up at run-time.
//
-void interceptor_ICJI::embedGenericHandle(
- CORINFO_RESOLVED_TOKEN * pResolvedToken,
- BOOL fEmbedParent, // TRUE - embeds parent type handle of the field/method handle
- CORINFO_GENERICHANDLE_RESULT * pResult)
+void interceptor_ICJI::embedGenericHandle(CORINFO_RESOLVED_TOKEN* pResolvedToken,
+ BOOL fEmbedParent, // TRUE - embeds parent type handle of the field/method
+ // handle
+ CORINFO_GENERICHANDLE_RESULT* pResult)
{
original_ICorJitInfo->embedGenericHandle(pResolvedToken, fEmbedParent, pResult);
}
@@ -1294,65 +1102,47 @@ void interceptor_ICJI::embedGenericHandle(
// 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 interceptor_ICJI::getLocationOfThisType(
- CORINFO_METHOD_HANDLE context
- )
+CORINFO_LOOKUP_KIND interceptor_ICJI::getLocationOfThisType(CORINFO_METHOD_HANDLE context)
{
return original_ICorJitInfo->getLocationOfThisType(context);
}
// return the unmanaged target *if method has already been prelinked.*
-void* interceptor_ICJI::getPInvokeUnmanagedTarget(
- CORINFO_METHOD_HANDLE method,
- void **ppIndirection
- )
+void* interceptor_ICJI::getPInvokeUnmanagedTarget(CORINFO_METHOD_HANDLE method, void** ppIndirection)
{
return original_ICorJitInfo->getPInvokeUnmanagedTarget(method, ppIndirection);
}
// return address of fixup area for late-bound PInvoke calls.
-void* interceptor_ICJI::getAddressOfPInvokeFixup(
- CORINFO_METHOD_HANDLE method,
- void **ppIndirection
- )
+void* interceptor_ICJI::getAddressOfPInvokeFixup(CORINFO_METHOD_HANDLE method, void** ppIndirection)
{
return original_ICorJitInfo->getAddressOfPInvokeFixup(method, ppIndirection);
}
// return address of fixup area for late-bound PInvoke calls.
-void interceptor_ICJI::getAddressOfPInvokeTarget(
- CORINFO_METHOD_HANDLE method,
- CORINFO_CONST_LOOKUP *pLookup
- )
+void interceptor_ICJI::getAddressOfPInvokeTarget(CORINFO_METHOD_HANDLE method, CORINFO_CONST_LOOKUP* pLookup)
{
original_ICorJitInfo->getAddressOfPInvokeTarget(method, pLookup);
}
// Generate a cookie based on the signature that would needs to be passed
// to CORINFO_HELP_PINVOKE_CALLI
-LPVOID interceptor_ICJI::GetCookieForPInvokeCalliSig(
- CORINFO_SIG_INFO* szMetaSig,
- void ** ppIndirection
- )
+LPVOID interceptor_ICJI::GetCookieForPInvokeCalliSig(CORINFO_SIG_INFO* szMetaSig, void** ppIndirection)
{
return original_ICorJitInfo->GetCookieForPInvokeCalliSig(szMetaSig, ppIndirection);
}
// 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 interceptor_ICJI::canGetCookieForPInvokeCalliSig(
- CORINFO_SIG_INFO* szMetaSig
- )
+bool interceptor_ICJI::canGetCookieForPInvokeCalliSig(CORINFO_SIG_INFO* szMetaSig)
{
return original_ICorJitInfo->canGetCookieForPInvokeCalliSig(szMetaSig);
}
// Gets a handle that is checked to see if the current method is
// included in "JustMyCode"
-CORINFO_JUST_MY_CODE_HANDLE interceptor_ICJI::getJustMyCodeHandle(
- CORINFO_METHOD_HANDLE method,
- CORINFO_JUST_MY_CODE_HANDLE**ppIndirection
- )
+CORINFO_JUST_MY_CODE_HANDLE interceptor_ICJI::getJustMyCodeHandle(CORINFO_METHOD_HANDLE method,
+ CORINFO_JUST_MY_CODE_HANDLE** ppIndirection)
{
return original_ICorJitInfo->getJustMyCodeHandle(method, ppIndirection);
}
@@ -1360,38 +1150,32 @@ CORINFO_JUST_MY_CODE_HANDLE interceptor_ICJI::getJustMyCodeHandle(
// 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 interceptor_ICJI::GetProfilingHandle(
- BOOL *pbHookFunction,
- void **pProfilerHandle,
- BOOL *pbIndirectedHandles
- )
+void interceptor_ICJI::GetProfilingHandle(BOOL* pbHookFunction, void** pProfilerHandle, BOOL* pbIndirectedHandles)
{
original_ICorJitInfo->GetProfilingHandle(pbHookFunction, pProfilerHandle, pbIndirectedHandles);
}
// Returns instructions on how to make the call. See code:CORINFO_CALL_INFO for possible return values.
void interceptor_ICJI::getCallInfo(
- // Token info
- CORINFO_RESOLVED_TOKEN * pResolvedToken,
+ // Token info
+ CORINFO_RESOLVED_TOKEN* pResolvedToken,
- //Generics info
- CORINFO_RESOLVED_TOKEN * pConstrainedResolvedToken,
+ // Generics info
+ CORINFO_RESOLVED_TOKEN* pConstrainedResolvedToken,
- //Security info
- CORINFO_METHOD_HANDLE callerHandle,
+ // Security info
+ CORINFO_METHOD_HANDLE callerHandle,
- //Jit info
- CORINFO_CALLINFO_FLAGS flags,
+ // Jit info
+ CORINFO_CALLINFO_FLAGS flags,
- //out params
- CORINFO_CALL_INFO *pResult
- )
+ // out params
+ CORINFO_CALL_INFO* pResult)
{
original_ICorJitInfo->getCallInfo(pResolvedToken, pConstrainedResolvedToken, callerHandle, flags, pResult);
}
-BOOL interceptor_ICJI::canAccessFamily(CORINFO_METHOD_HANDLE hCaller,
- CORINFO_CLASS_HANDLE hInstanceType)
+BOOL interceptor_ICJI::canAccessFamily(CORINFO_METHOD_HANDLE hCaller, CORINFO_CLASS_HANDLE hInstanceType)
{
return original_ICorJitInfo->canAccessFamily(hCaller, hInstanceType);
@@ -1404,55 +1188,37 @@ BOOL interceptor_ICJI::isRIDClassDomainID(CORINFO_CLASS_HANDLE cls)
}
// returns the class's domain ID for accessing shared statics
-unsigned interceptor_ICJI::getClassDomainID (
- CORINFO_CLASS_HANDLE cls,
- void **ppIndirection
- )
+unsigned interceptor_ICJI::getClassDomainID(CORINFO_CLASS_HANDLE cls, void** ppIndirection)
{
return original_ICorJitInfo->getClassDomainID(cls, ppIndirection);
}
-
// return the data's address (for static fields only)
-void* interceptor_ICJI::getFieldAddress(
- CORINFO_FIELD_HANDLE field,
- void **ppIndirection
- )
+void* interceptor_ICJI::getFieldAddress(CORINFO_FIELD_HANDLE field, void** ppIndirection)
{
return original_ICorJitInfo->getFieldAddress(field, ppIndirection);
}
// registers a vararg sig & returns a VM cookie for it (which can contain other stuff)
-CORINFO_VARARGS_HANDLE interceptor_ICJI::getVarArgsHandle(
- CORINFO_SIG_INFO *pSig,
- void **ppIndirection
- )
+CORINFO_VARARGS_HANDLE interceptor_ICJI::getVarArgsHandle(CORINFO_SIG_INFO* pSig, void** ppIndirection)
{
return original_ICorJitInfo->getVarArgsHandle(pSig, ppIndirection);
}
// 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 interceptor_ICJI::canGetVarArgsHandle(
- CORINFO_SIG_INFO *pSig
- )
+bool interceptor_ICJI::canGetVarArgsHandle(CORINFO_SIG_INFO* pSig)
{
return original_ICorJitInfo->canGetVarArgsHandle(pSig);
}
// Allocate a string literal on the heap and return a handle to it
-InfoAccessType interceptor_ICJI::constructStringLiteral(
- CORINFO_MODULE_HANDLE module,
- mdToken metaTok,
- void **ppValue
- )
+InfoAccessType interceptor_ICJI::constructStringLiteral(CORINFO_MODULE_HANDLE module, mdToken metaTok, void** ppValue)
{
return original_ICorJitInfo->constructStringLiteral(module, metaTok, ppValue);
}
-InfoAccessType interceptor_ICJI::emptyStringLiteral(
- void **ppValue
- )
+InfoAccessType interceptor_ICJI::emptyStringLiteral(void** ppValue)
{
return original_ICorJitInfo->emptyStringLiteral(ppValue);
}
@@ -1460,60 +1226,44 @@ InfoAccessType interceptor_ICJI::emptyStringLiteral(
// (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 interceptor_ICJI::getFieldThreadLocalStoreID (
- CORINFO_FIELD_HANDLE field,
- void **ppIndirection
- )
+DWORD interceptor_ICJI::getFieldThreadLocalStoreID(CORINFO_FIELD_HANDLE field, void** ppIndirection)
{
return original_ICorJitInfo->getFieldThreadLocalStoreID(field, ppIndirection);
}
// Sets another object to intercept calls to "self" and current method being compiled
-void interceptor_ICJI::setOverride(
- ICorDynamicInfo *pOverride,
- CORINFO_METHOD_HANDLE currentMethod
- )
+void interceptor_ICJI::setOverride(ICorDynamicInfo* pOverride, CORINFO_METHOD_HANDLE currentMethod)
{
original_ICorJitInfo->setOverride(pOverride, 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 interceptor_ICJI::addActiveDependency(
- CORINFO_MODULE_HANDLE moduleFrom,
- CORINFO_MODULE_HANDLE moduleTo
- )
+void interceptor_ICJI::addActiveDependency(CORINFO_MODULE_HANDLE moduleFrom, CORINFO_MODULE_HANDLE moduleTo)
{
original_ICorJitInfo->addActiveDependency(moduleFrom, moduleTo);
}
-CORINFO_METHOD_HANDLE interceptor_ICJI::GetDelegateCtor(
- CORINFO_METHOD_HANDLE methHnd,
- CORINFO_CLASS_HANDLE clsHnd,
- CORINFO_METHOD_HANDLE targetMethodHnd,
- DelegateCtorArgs * pCtorData
- )
+CORINFO_METHOD_HANDLE interceptor_ICJI::GetDelegateCtor(CORINFO_METHOD_HANDLE methHnd,
+ CORINFO_CLASS_HANDLE clsHnd,
+ CORINFO_METHOD_HANDLE targetMethodHnd,
+ DelegateCtorArgs* pCtorData)
{
return original_ICorJitInfo->GetDelegateCtor(methHnd, clsHnd, targetMethodHnd, pCtorData);
}
-void interceptor_ICJI::MethodCompileComplete(
- CORINFO_METHOD_HANDLE methHnd
- )
+void interceptor_ICJI::MethodCompileComplete(CORINFO_METHOD_HANDLE methHnd)
{
original_ICorJitInfo->MethodCompileComplete(methHnd);
}
// return a thunk that will copy the arguments for the given signature.
-void* interceptor_ICJI::getTailCallCopyArgsThunk (
- CORINFO_SIG_INFO *pSig,
- CorInfoHelperTailCallSpecialHandling flags
- )
+void* interceptor_ICJI::getTailCallCopyArgsThunk(CORINFO_SIG_INFO* pSig, CorInfoHelperTailCallSpecialHandling flags)
{
return original_ICorJitInfo->getTailCallCopyArgsThunk(pSig, flags);
}
-//Stuff directly on ICorJitInfo
+// Stuff directly on ICorJitInfo
// Returns extended flags for a particular compilation instance.
DWORD interceptor_ICJI::getJitFlags(CORJIT_FLAGS* jitFlags, DWORD sizeInBytes)
@@ -1523,7 +1273,7 @@ DWORD interceptor_ICJI::getJitFlags(CORJIT_FLAGS* jitFlags, DWORD sizeInBytes)
// Runs the given function with the given parameter under an error trap
// and returns true if the function completes successfully.
-bool interceptor_ICJI::runWithErrorTrap(void (*function)(void*), void *param)
+bool interceptor_ICJI::runWithErrorTrap(void (*function)(void*), void* param)
{
return original_ICorJitInfo->runWithErrorTrap(function, param);
}
@@ -1531,25 +1281,25 @@ bool interceptor_ICJI::runWithErrorTrap(void (*function)(void*), void *param)
// return memory manager that the JIT can use to allocate a regular memory
IEEMemoryManager* interceptor_ICJI::getMemoryManager()
{
- if(current_IEEMM->original_IEEMM == nullptr)
+ if (current_IEEMM->original_IEEMM == nullptr)
current_IEEMM->original_IEEMM = original_ICorJitInfo->getMemoryManager();
return current_IEEMM;
}
// get a block of memory for the code, readonly data, and read-write data
-void interceptor_ICJI::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 */
- )
+void interceptor_ICJI::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 */
+ )
{
- return original_ICorJitInfo->allocMem(hotCodeSize, coldCodeSize, roDataSize, xcptnsCount, flag, hotCodeBlock, coldCodeBlock, roDataBlock);
+ return original_ICorJitInfo->allocMem(hotCodeSize, coldCodeSize, roDataSize, xcptnsCount, flag, hotCodeBlock,
+ coldCodeBlock, roDataBlock);
}
// Reserve memory for the method/funclet's unwind information.
@@ -1563,11 +1313,10 @@ void interceptor_ICJI::allocMem (
// For prejitted code we split up the unwinding information into
// separate sections .rdata and .pdata.
//
-void interceptor_ICJI::reserveUnwindInfo (
- BOOL isFunclet, /* IN */
- BOOL isColdCode, /* IN */
- ULONG unwindSize /* IN */
- )
+void interceptor_ICJI::reserveUnwindInfo(BOOL isFunclet, /* IN */
+ BOOL isColdCode, /* IN */
+ ULONG unwindSize /* IN */
+ )
{
original_ICorJitInfo->reserveUnwindInfo(isFunclet, isColdCode, unwindSize);
}
@@ -1589,26 +1338,25 @@ void interceptor_ICJI::reserveUnwindInfo (
// pUnwindBlock pointer to unwind info
// funcKind type of funclet (main method code, handler, filter)
//
-void interceptor_ICJI::allocUnwindInfo (
- BYTE * pHotCode, /* IN */
- BYTE * pColdCode, /* IN */
- ULONG startOffset, /* IN */
- ULONG endOffset, /* IN */
- ULONG unwindSize, /* IN */
- BYTE * pUnwindBlock, /* IN */
- CorJitFuncKind funcKind /* IN */
- )
+void interceptor_ICJI::allocUnwindInfo(BYTE* pHotCode, /* IN */
+ BYTE* pColdCode, /* IN */
+ ULONG startOffset, /* IN */
+ ULONG endOffset, /* IN */
+ ULONG unwindSize, /* IN */
+ BYTE* pUnwindBlock, /* IN */
+ CorJitFuncKind funcKind /* IN */
+ )
{
- original_ICorJitInfo->allocUnwindInfo(pHotCode, pColdCode, startOffset, endOffset, unwindSize, pUnwindBlock, funcKind);
+ original_ICorJitInfo->allocUnwindInfo(pHotCode, pColdCode, startOffset, endOffset, unwindSize, pUnwindBlock,
+ funcKind);
}
// 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 * interceptor_ICJI::allocGCInfo (
- size_t size /* IN */
- )
+void* interceptor_ICJI::allocGCInfo(size_t size /* IN */
+ )
{
return original_ICorJitInfo->allocGCInfo(size);
}
@@ -1622,9 +1370,8 @@ void interceptor_ICJI::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 interceptor_ICJI::setEHcount (
- unsigned cEH /* IN */
- )
+void interceptor_ICJI::setEHcount(unsigned cEH /* IN */
+ )
{
original_ICorJitInfo->setEHcount(cEH);
}
@@ -1634,10 +1381,9 @@ void interceptor_ICJI::setEHcount (
// Handler regions should be lexically contiguous.
// This is because FinallyIsUnwinding() uses lexicality to
// determine if a "finally" clause is executing.
-void interceptor_ICJI::setEHinfo (
- unsigned EHnumber, /* IN */
- const CORINFO_EH_CLAUSE *clause /* IN */
- )
+void interceptor_ICJI::setEHinfo(unsigned EHnumber, /* IN */
+ const CORINFO_EH_CLAUSE* clause /* IN */
+ )
{
original_ICorJitInfo->setEHinfo(EHnumber, clause);
}
@@ -1664,22 +1410,18 @@ void interceptor_ICJI::reportFatalError(CorJitResult result)
// allocate a basic block profile buffer where execution counts will be stored
// for jitted basic blocks.
-HRESULT interceptor_ICJI::allocBBProfileBuffer (
- ULONG count, // The number of basic blocks that we have
- ProfileBuffer ** profileBuffer
- )
+HRESULT interceptor_ICJI::allocBBProfileBuffer(ULONG count, // The number of basic blocks that we have
+ ProfileBuffer** profileBuffer)
{
return original_ICorJitInfo->allocBBProfileBuffer(count, 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 interceptor_ICJI::getBBProfileData(
- CORINFO_METHOD_HANDLE ftnHnd,
- ULONG * count, // The number of basic blocks that we have
- ProfileBuffer ** profileBuffer,
- ULONG * numRuns
- )
+HRESULT interceptor_ICJI::getBBProfileData(CORINFO_METHOD_HANDLE ftnHnd,
+ ULONG* count, // The number of basic blocks that we have
+ ProfileBuffer** profileBuffer,
+ ULONG* numRuns)
{
return original_ICorJitInfo->getBBProfileData(ftnHnd, count, profileBuffer, numRuns);
}
@@ -1688,29 +1430,27 @@ HRESULT interceptor_ICJI::getBBProfileData(
// 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 interceptor_ICJI::recordCallSite(
- ULONG instrOffset, /* IN */
- CORINFO_SIG_INFO * callSig, /* IN */
- CORINFO_METHOD_HANDLE methodHandle /* IN */
- )
+void interceptor_ICJI::recordCallSite(ULONG instrOffset, /* IN */
+ CORINFO_SIG_INFO* callSig, /* IN */
+ CORINFO_METHOD_HANDLE methodHandle /* IN */
+ )
{
original_ICorJitInfo->recordCallSite(instrOffset, callSig, methodHandle);
}
// A relocation is recorded if we are pre-jitting.
// A jump thunk may be inserted if we are jitting
-void interceptor_ICJI::recordRelocation(
- void * location, /* IN */
- void * target, /* IN */
- WORD fRelocType, /* IN */
- WORD slotNum, /* IN */
- INT32 addlDelta /* IN */
- )
+void interceptor_ICJI::recordRelocation(void* location, /* IN */
+ void* target, /* IN */
+ WORD fRelocType, /* IN */
+ WORD slotNum, /* IN */
+ INT32 addlDelta /* IN */
+ )
{
original_ICorJitInfo->recordRelocation(location, target, fRelocType, slotNum, addlDelta);
}
-WORD interceptor_ICJI::getRelocTypeHint(void * target)
+WORD interceptor_ICJI::getRelocTypeHint(void* target)
{
return original_ICorJitInfo->getRelocTypeHint(target);
}
@@ -1718,10 +1458,9 @@ WORD interceptor_ICJI::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 interceptor_ICJI::getModuleNativeEntryPointRange(
- void ** pStart, /* OUT */
- void ** pEnd /* OUT */
- )
+void interceptor_ICJI::getModuleNativeEntryPointRange(void** pStart, /* OUT */
+ void** pEnd /* OUT */
+ )
{
original_ICorJitInfo->getModuleNativeEntryPointRange(pStart, pEnd);
}
diff --git a/src/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.h b/src/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.h
index c266f036fb..01ccbe6cf0 100644
--- a/src/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.h
+++ b/src/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.h
@@ -15,10 +15,9 @@ class interceptor_ICJI : public ICorJitInfo
#include "icorjitinfoimpl.h"
public:
-
- //Added to help us track the original icji and be able to easily indirect
- //to it. And a simple way to keep one memory manager instance per instance.
- ICorJitInfo *original_ICorJitInfo;
+ // Added to help us track the original icji and be able to easily indirect
+ //to it. And a simple way to keep one memory manager instance per instance.
+ ICorJitInfo* original_ICorJitInfo;
};
#endif
diff --git a/src/ToolBox/superpmi/superpmi-shim-simple/ieememorymanager.cpp b/src/ToolBox/superpmi/superpmi-shim-simple/ieememorymanager.cpp
index 668b4b7728..aecd68e9d9 100644
--- a/src/ToolBox/superpmi/superpmi-shim-simple/ieememorymanager.cpp
+++ b/src/ToolBox/superpmi/superpmi-shim-simple/ieememorymanager.cpp
@@ -10,7 +10,7 @@
//***************************************************************************
// IUnknown methods
//***************************************************************************
-HRESULT STDMETHODCALLTYPE interceptor_IEEMM::QueryInterface(REFIID id, void **pInterface)
+HRESULT STDMETHODCALLTYPE interceptor_IEEMM::QueryInterface(REFIID id, void** pInterface)
{
return original_IEEMM->QueryInterface(id, pInterface);
}
@@ -26,7 +26,10 @@ ULONG STDMETHODCALLTYPE interceptor_IEEMM::Release()
//***************************************************************************
// IEEMemoryManager methods for locking
//***************************************************************************
-LPVOID STDMETHODCALLTYPE interceptor_IEEMM::ClrVirtualAlloc(LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect)
+LPVOID STDMETHODCALLTYPE interceptor_IEEMM::ClrVirtualAlloc(LPVOID lpAddress,
+ SIZE_T dwSize,
+ DWORD flAllocationType,
+ DWORD flProtect)
{
return original_IEEMM->ClrVirtualAlloc(lpAddress, dwSize, flAllocationType, flProtect);
}
@@ -34,11 +37,16 @@ BOOL STDMETHODCALLTYPE interceptor_IEEMM::ClrVirtualFree(LPVOID lpAddress, SIZE_
{
return original_IEEMM->ClrVirtualFree(lpAddress, dwSize, dwFreeType);
}
-SIZE_T STDMETHODCALLTYPE interceptor_IEEMM::ClrVirtualQuery(LPCVOID lpAddress, PMEMORY_BASIC_INFORMATION lpBuffer, SIZE_T dwLength)
+SIZE_T STDMETHODCALLTYPE interceptor_IEEMM::ClrVirtualQuery(LPCVOID lpAddress,
+ PMEMORY_BASIC_INFORMATION lpBuffer,
+ SIZE_T dwLength)
{
return original_IEEMM->ClrVirtualQuery(lpAddress, lpBuffer, dwLength);
}
-BOOL STDMETHODCALLTYPE interceptor_IEEMM::ClrVirtualProtect(LPVOID lpAddress, SIZE_T dwSize, DWORD flNewProtect, PDWORD lpflOldProtect)
+BOOL STDMETHODCALLTYPE interceptor_IEEMM::ClrVirtualProtect(LPVOID lpAddress,
+ SIZE_T dwSize,
+ DWORD flNewProtect,
+ PDWORD lpflOldProtect)
{
return original_IEEMM->ClrVirtualProtect(lpAddress, dwSize, flNewProtect, lpflOldProtect);
}
diff --git a/src/ToolBox/superpmi/superpmi-shim-simple/ieememorymanager.h b/src/ToolBox/superpmi/superpmi-shim-simple/ieememorymanager.h
index 411c532b59..b70c1fd758 100644
--- a/src/ToolBox/superpmi/superpmi-shim-simple/ieememorymanager.h
+++ b/src/ToolBox/superpmi/superpmi-shim-simple/ieememorymanager.h
@@ -76,12 +76,11 @@ interface IEEMemoryManager : IUnknown
class interceptor_IEEMM : public IEEMemoryManager
{
private:
-
//***************************************************************************
// IUnknown methods
//***************************************************************************
- HRESULT STDMETHODCALLTYPE QueryInterface(REFIID id, void **pInterface);
+ HRESULT STDMETHODCALLTYPE QueryInterface(REFIID id, void** pInterface);
ULONG STDMETHODCALLTYPE AddRef();
ULONG STDMETHODCALLTYPE Release();
@@ -91,7 +90,10 @@ private:
LPVOID STDMETHODCALLTYPE ClrVirtualAlloc(LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect);
BOOL STDMETHODCALLTYPE ClrVirtualFree(LPVOID lpAddress, SIZE_T dwSize, DWORD dwFreeType);
SIZE_T STDMETHODCALLTYPE ClrVirtualQuery(LPCVOID lpAddress, PMEMORY_BASIC_INFORMATION lpBuffer, SIZE_T dwLength);
- BOOL STDMETHODCALLTYPE ClrVirtualProtect(LPVOID lpAddress, SIZE_T dwSize, DWORD flNewProtect, PDWORD lpflOldProtect);
+ BOOL STDMETHODCALLTYPE ClrVirtualProtect(LPVOID lpAddress,
+ SIZE_T dwSize,
+ DWORD flNewProtect,
+ PDWORD lpflOldProtect);
HANDLE STDMETHODCALLTYPE ClrGetProcessHeap();
HANDLE STDMETHODCALLTYPE ClrHeapCreate(DWORD flOptions, SIZE_T dwInitialSize, SIZE_T dwMaximumSize);
BOOL STDMETHODCALLTYPE ClrHeapDestroy(HANDLE hHeap);
@@ -102,7 +104,7 @@ private:
public:
// Added so we know where to make the real calls to.
- IEEMemoryManager *original_IEEMM;
+ IEEMemoryManager* original_IEEMM;
};
#endif
diff --git a/src/ToolBox/superpmi/superpmi-shim-simple/iexecutionengine.cpp b/src/ToolBox/superpmi/superpmi-shim-simple/iexecutionengine.cpp
index a137266751..4e8cbb4359 100644
--- a/src/ToolBox/superpmi/superpmi-shim-simple/iexecutionengine.cpp
+++ b/src/ToolBox/superpmi/superpmi-shim-simple/iexecutionengine.cpp
@@ -10,7 +10,7 @@
//***************************************************************************
// IUnknown methods
//***************************************************************************
-HRESULT STDMETHODCALLTYPE interceptor_IEE::QueryInterface(REFIID id, void **pInterface)
+HRESULT STDMETHODCALLTYPE interceptor_IEE::QueryInterface(REFIID id, void** pInterface)
{
return original_IEE->QueryInterface(id, pInterface);
}
@@ -27,7 +27,7 @@ ULONG STDMETHODCALLTYPE interceptor_IEE::Release()
// IExecutionEngine methods for TLS
//***************************************************************************
// Associate a callback for cleanup with a TLS slot
-VOID STDMETHODCALLTYPE interceptor_IEE::TLS_AssociateCallback(DWORD slot, PTLS_CALLBACK_FUNCTION callback)
+VOID STDMETHODCALLTYPE interceptor_IEE::TLS_AssociateCallback(DWORD slot, PTLS_CALLBACK_FUNCTION callback)
{
original_IEE->TLS_AssociateCallback(slot, callback);
}
@@ -44,7 +44,7 @@ LPVOID STDMETHODCALLTYPE interceptor_IEE::TLS_GetValue(DWORD slot)
}
// Get the value at a slot, return FALSE if TLS info block doesn't exist
-BOOL STDMETHODCALLTYPE interceptor_IEE::TLS_CheckValue(DWORD slot, LPVOID * pValue)
+BOOL STDMETHODCALLTYPE interceptor_IEE::TLS_CheckValue(DWORD slot, LPVOID* pValue)
{
return original_IEE->TLS_CheckValue(slot, pValue);
}
@@ -115,17 +115,21 @@ void STDMETHODCALLTYPE interceptor_IEE::ClrCloseSemaphore(SEMAPHORE_COOKIE semap
{
original_IEE->ClrCloseSemaphore(semaphore);
}
-DWORD STDMETHODCALLTYPE interceptor_IEE::ClrWaitForSemaphore(SEMAPHORE_COOKIE semaphore, DWORD dwMilliseconds, BOOL bAlertable)
+DWORD STDMETHODCALLTYPE interceptor_IEE::ClrWaitForSemaphore(SEMAPHORE_COOKIE semaphore,
+ DWORD dwMilliseconds,
+ BOOL bAlertable)
{
return original_IEE->ClrWaitForSemaphore(semaphore, dwMilliseconds, bAlertable);
}
-BOOL STDMETHODCALLTYPE interceptor_IEE::ClrReleaseSemaphore(SEMAPHORE_COOKIE semaphore, LONG lReleaseCount, LONG *lpPreviousCount)
+BOOL STDMETHODCALLTYPE interceptor_IEE::ClrReleaseSemaphore(SEMAPHORE_COOKIE semaphore,
+ LONG lReleaseCount,
+ LONG* lpPreviousCount)
{
return original_IEE->ClrReleaseSemaphore(semaphore, lReleaseCount, lpPreviousCount);
}
MUTEX_COOKIE STDMETHODCALLTYPE interceptor_IEE::ClrCreateMutex(LPSECURITY_ATTRIBUTES lpMutexAttributes,
- BOOL bInitialOwner,
- LPCTSTR lpName)
+ BOOL bInitialOwner,
+ LPCTSTR lpName)
{
return original_IEE->ClrCreateMutex(lpMutexAttributes, bInitialOwner, lpName);
}
@@ -137,9 +141,7 @@ BOOL STDMETHODCALLTYPE interceptor_IEE::ClrReleaseMutex(MUTEX_COOKIE mutex)
{
return original_IEE->ClrReleaseMutex(mutex);
}
-DWORD STDMETHODCALLTYPE interceptor_IEE::ClrWaitForMutex(MUTEX_COOKIE mutex,
- DWORD dwMilliseconds,
- BOOL bAlertable)
+DWORD STDMETHODCALLTYPE interceptor_IEE::ClrWaitForMutex(MUTEX_COOKIE mutex, DWORD dwMilliseconds, BOOL bAlertable)
{
return original_IEE->ClrWaitForMutex(mutex, dwMilliseconds, bAlertable);
}
@@ -152,7 +154,7 @@ BOOL STDMETHODCALLTYPE interceptor_IEE::ClrAllocationDisallowed()
{
return original_IEE->ClrAllocationDisallowed();
}
-void STDMETHODCALLTYPE interceptor_IEE::GetLastThrownObjectExceptionFromThread(void **ppvException)
+void STDMETHODCALLTYPE interceptor_IEE::GetLastThrownObjectExceptionFromThread(void** ppvException)
{
original_IEE->GetLastThrownObjectExceptionFromThread(ppvException);
}
diff --git a/src/ToolBox/superpmi/superpmi-shim-simple/iexecutionengine.h b/src/ToolBox/superpmi/superpmi-shim-simple/iexecutionengine.h
index dd3d7ee1fa..33216496f1 100644
--- a/src/ToolBox/superpmi/superpmi-shim-simple/iexecutionengine.h
+++ b/src/ToolBox/superpmi/superpmi-shim-simple/iexecutionengine.h
@@ -88,11 +88,10 @@ interface IExecutionEngine : IUnknown
class interceptor_IEE : public IExecutionEngine
{
private:
-
//***************************************************************************
// IUnknown methods
//***************************************************************************
- HRESULT STDMETHODCALLTYPE QueryInterface(REFIID id, void **pInterface);
+ HRESULT STDMETHODCALLTYPE QueryInterface(REFIID id, void** pInterface);
ULONG STDMETHODCALLTYPE AddRef();
ULONG STDMETHODCALLTYPE Release();
@@ -100,13 +99,13 @@ private:
// IExecutionEngine methods for TLS
//***************************************************************************
// Associate a callback for cleanup with a TLS slot
- VOID STDMETHODCALLTYPE TLS_AssociateCallback(DWORD slot, PTLS_CALLBACK_FUNCTION callback);
+ VOID STDMETHODCALLTYPE TLS_AssociateCallback(DWORD slot, PTLS_CALLBACK_FUNCTION callback);
// Get the TLS block for fast Get/Set operations
LPVOID* STDMETHODCALLTYPE TLS_GetDataBlock();
// Get the value at a slot
LPVOID STDMETHODCALLTYPE TLS_GetValue(DWORD slot);
// Get the value at a slot, return FALSE if TLS info block doesn't exist
- BOOL STDMETHODCALLTYPE TLS_CheckValue(DWORD slot, LPVOID * pValue);
+ BOOL STDMETHODCALLTYPE TLS_CheckValue(DWORD slot, LPVOID* pValue);
// Set the value at a slot
VOID STDMETHODCALLTYPE TLS_SetValue(DWORD slot, LPVOID pData);
// Free TLS memory block and make callback
@@ -129,22 +128,20 @@ private:
SEMAPHORE_COOKIE STDMETHODCALLTYPE ClrCreateSemaphore(DWORD dwInitial, DWORD dwMax);
void STDMETHODCALLTYPE ClrCloseSemaphore(SEMAPHORE_COOKIE semaphore);
DWORD STDMETHODCALLTYPE ClrWaitForSemaphore(SEMAPHORE_COOKIE semaphore, DWORD dwMilliseconds, BOOL bAlertable);
- BOOL STDMETHODCALLTYPE ClrReleaseSemaphore(SEMAPHORE_COOKIE semaphore, LONG lReleaseCount, LONG *lpPreviousCount);
+ BOOL STDMETHODCALLTYPE ClrReleaseSemaphore(SEMAPHORE_COOKIE semaphore, LONG lReleaseCount, LONG* lpPreviousCount);
MUTEX_COOKIE STDMETHODCALLTYPE ClrCreateMutex(LPSECURITY_ATTRIBUTES lpMutexAttributes,
- BOOL bInitialOwner,
- LPCTSTR lpName);
+ BOOL bInitialOwner,
+ LPCTSTR lpName);
void STDMETHODCALLTYPE ClrCloseMutex(MUTEX_COOKIE mutex);
BOOL STDMETHODCALLTYPE ClrReleaseMutex(MUTEX_COOKIE mutex);
- DWORD STDMETHODCALLTYPE ClrWaitForMutex(MUTEX_COOKIE mutex,
- DWORD dwMilliseconds,
- BOOL bAlertable);
+ DWORD STDMETHODCALLTYPE ClrWaitForMutex(MUTEX_COOKIE mutex, DWORD dwMilliseconds, BOOL bAlertable);
DWORD STDMETHODCALLTYPE ClrSleepEx(DWORD dwMilliseconds, BOOL bAlertable);
BOOL STDMETHODCALLTYPE ClrAllocationDisallowed();
- void STDMETHODCALLTYPE GetLastThrownObjectExceptionFromThread(void **ppvException);
+ void STDMETHODCALLTYPE GetLastThrownObjectExceptionFromThread(void** ppvException);
public:
// Added so we know where to make the real calls to.
- IExecutionEngine *original_IEE;
+ IExecutionEngine* original_IEE;
};
#endif \ No newline at end of file
diff --git a/src/ToolBox/superpmi/superpmi-shim-simple/superpmi-shim-simple.cpp b/src/ToolBox/superpmi/superpmi-shim-simple/superpmi-shim-simple.cpp
index 2381d0fa38..f374836b29 100644
--- a/src/ToolBox/superpmi/superpmi-shim-simple/superpmi-shim-simple.cpp
+++ b/src/ToolBox/superpmi/superpmi-shim-simple/superpmi-shim-simple.cpp
@@ -17,11 +17,11 @@
#include "spmiutil.h"
#include "jithost.h"
-HMODULE g_hRealJit = 0; //We leak this currently (could do the proper shutdown in process_detach)
-WCHAR* g_realJitPath = nullptr; //We leak this (could do the proper shutdown in process_detach)
-char* g_logFilePath = nullptr; //We *don't* leak this, hooray!
-WCHAR* g_HomeDirectory = nullptr;
-WCHAR* g_DefaultRealJitPath = nullptr;
+HMODULE g_hRealJit = 0; // We leak this currently (could do the proper shutdown in process_detach)
+WCHAR* g_realJitPath = nullptr; // We leak this (could do the proper shutdown in process_detach)
+char* g_logFilePath = nullptr; // We *don't* leak this, hooray!
+WCHAR* g_HomeDirectory = nullptr;
+WCHAR* g_DefaultRealJitPath = nullptr;
void SetDefaultPaths()
{
@@ -32,7 +32,7 @@ void SetDefaultPaths()
if (g_DefaultRealJitPath == nullptr)
{
- size_t len = wcslen(g_HomeDirectory) + 1 + wcslen(DEFAULT_REAL_JIT_NAME_W) + 1;
+ size_t len = wcslen(g_HomeDirectory) + 1 + wcslen(DEFAULT_REAL_JIT_NAME_W) + 1;
g_DefaultRealJitPath = new WCHAR[len];
wcscpy_s(g_DefaultRealJitPath, len, g_HomeDirectory);
wcscat_s(g_DefaultRealJitPath, len, DIRECTORY_SEPARATOR_STR_W);
@@ -58,61 +58,59 @@ void SetLogFilePath()
}
}
-extern "C"
-BOOL
+extern "C" BOOL
#ifndef FEATURE_PAL
-APIENTRY
+ APIENTRY
#endif // !FEATURE_PAL
-DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
+ DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
switch (ul_reason_for_call)
{
- case DLL_PROCESS_ATTACH:
+ case DLL_PROCESS_ATTACH:
#ifdef FEATURE_PAL
- if (0 != PAL_InitializeDLL())
- {
- fprintf(stderr, "Error: Fail to PAL_InitializeDLL\n");
- exit(1);
- }
+ if (0 != PAL_InitializeDLL())
+ {
+ fprintf(stderr, "Error: Fail to PAL_InitializeDLL\n");
+ exit(1);
+ }
#endif // FEATURE_PAL
- Logger::Initialize();
- SetLogFilePath();
- Logger::OpenLogFile(g_logFilePath);
- break;
+ Logger::Initialize();
+ SetLogFilePath();
+ Logger::OpenLogFile(g_logFilePath);
+ break;
- case DLL_PROCESS_DETACH:
- Logger::Shutdown();
+ case DLL_PROCESS_DETACH:
+ Logger::Shutdown();
- delete[] g_logFilePath;
- g_logFilePath = nullptr;
+ delete[] g_logFilePath;
+ g_logFilePath = nullptr;
- break;
+ break;
- case DLL_THREAD_ATTACH:
- case DLL_THREAD_DETACH:
- break;
+ case DLL_THREAD_ATTACH:
+ case DLL_THREAD_DETACH:
+ break;
}
return TRUE;
}
// Exported via def file
-extern "C"
-void __stdcall jitStartup(ICorJitHost* host)
+extern "C" void __stdcall jitStartup(ICorJitHost* host)
{
SetDefaultPaths();
SetLibName();
- //Load Library
- if (g_hRealJit == 0)
- {
- g_hRealJit = ::LoadLibraryW(g_realJitPath);
- if (g_hRealJit == 0)
- {
- LogError("getJit() - LoadLibrary failed to load '%ws' (0x%08x)", g_realJitPath, ::GetLastError());
- return;
- }
- }
+ // Load Library
+ if (g_hRealJit == 0)
+ {
+ g_hRealJit = ::LoadLibraryW(g_realJitPath);
+ if (g_hRealJit == 0)
+ {
+ LogError("getJit() - LoadLibrary failed to load '%ws' (0x%08x)", g_realJitPath, ::GetLastError());
+ return;
+ }
+ }
// Get the required entrypoint
PjitStartup pnjitStartup = (PjitStartup)::GetProcAddress(g_hRealJit, "jitStartup");
@@ -127,86 +125,83 @@ void __stdcall jitStartup(ICorJitHost* host)
pnjitStartup(g_ourJitHost);
}
-
-//Exported via def file
-extern "C"
-ICorJitCompiler* __stdcall getJit()
+// Exported via def file
+extern "C" ICorJitCompiler* __stdcall getJit()
{
- DWORD dwRetVal = 0;
- PgetJit pngetJit;
- interceptor_ICJC *pJitInstance = nullptr;
- ICorJitCompiler *tICJI = nullptr;
+ DWORD dwRetVal = 0;
+ PgetJit pngetJit;
+ interceptor_ICJC* pJitInstance = nullptr;
+ ICorJitCompiler* tICJI = nullptr;
SetDefaultPaths();
SetLibName();
- //Load Library
- if(g_hRealJit == 0)
+ // Load Library
+ if (g_hRealJit == 0)
{
g_hRealJit = ::LoadLibraryW(g_realJitPath);
- if(g_hRealJit == 0)
+ if (g_hRealJit == 0)
{
LogError("getJit() - LoadLibrary failed to load '%ws' (0x%08x)", g_realJitPath, ::GetLastError());
return nullptr;
}
}
- //get the required entrypoints
+ // get the required entrypoints
pngetJit = (PgetJit)::GetProcAddress(g_hRealJit, "getJit");
- if(pngetJit == 0)
+ if (pngetJit == 0)
{
LogError("getJit() - GetProcAddress 'getJit' failed (0x%08x)", ::GetLastError());
return nullptr;
}
tICJI = pngetJit();
- if(tICJI == nullptr)
+ if (tICJI == nullptr)
{
LogError("getJit() - pngetJit gave us null");
return nullptr;
}
- pJitInstance = new interceptor_ICJC();
+ pJitInstance = new interceptor_ICJC();
pJitInstance->original_ICorJitCompiler = tICJI;
return pJitInstance;
}
-//Exported via def file
-extern "C"
-void __stdcall sxsJitStartup(CoreClrCallbacks const & original_cccallbacks)
+// Exported via def file
+extern "C" void __stdcall sxsJitStartup(CoreClrCallbacks const& original_cccallbacks)
{
PsxsJitStartup pnsxsJitStartup;
SetDefaultPaths();
SetLibName();
- //Load Library
- if(g_hRealJit == 0)
+ // Load Library
+ if (g_hRealJit == 0)
{
g_hRealJit = ::LoadLibraryW(g_realJitPath);
- if(g_hRealJit == 0)
+ if (g_hRealJit == 0)
{
LogError("sxsJitStartup() - LoadLibrary failed to load '%ws' (0x%08x)", g_realJitPath, ::GetLastError());
return;
}
}
- //get entry point
+ // get entry point
pnsxsJitStartup = (PsxsJitStartup)::GetProcAddress(g_hRealJit, "sxsJitStartup");
- if(pnsxsJitStartup == 0)
+ if (pnsxsJitStartup == 0)
{
LogError("sxsJitStartup() - GetProcAddress 'sxsJitStartup' failed (0x%08x)", ::GetLastError());
return;
}
- //Setup CoreClrCallbacks and call sxsJitStartup
- original_CoreClrCallbacks = new CoreClrCallbacks();
+ // Setup CoreClrCallbacks and call sxsJitStartup
+ original_CoreClrCallbacks = new CoreClrCallbacks();
original_CoreClrCallbacks->m_hmodCoreCLR = original_cccallbacks.m_hmodCoreCLR;
original_CoreClrCallbacks->m_pfnIEE = original_cccallbacks.m_pfnIEE;
original_CoreClrCallbacks->m_pfnGetCORSystemDirectory = original_cccallbacks.m_pfnGetCORSystemDirectory;
original_CoreClrCallbacks->m_pfnGetCLRFunction = original_cccallbacks.m_pfnGetCLRFunction;
- CoreClrCallbacks *temp = new CoreClrCallbacks();
+ CoreClrCallbacks* temp = new CoreClrCallbacks();
temp->m_hmodCoreCLR = original_cccallbacks.m_hmodCoreCLR;
temp->m_pfnIEE = IEE_t;
diff --git a/src/ToolBox/superpmi/superpmi-shim-simple/superpmi-shim-simple.h b/src/ToolBox/superpmi/superpmi-shim-simple/superpmi-shim-simple.h
index 2068a02775..5edb9263fa 100644
--- a/src/ToolBox/superpmi/superpmi-shim-simple/superpmi-shim-simple.h
+++ b/src/ToolBox/superpmi/superpmi-shim-simple/superpmi-shim-simple.h
@@ -9,5 +9,4 @@
#ifndef _SuperPMIShim
#define _SuperPMIShim
-
#endif
diff --git a/src/ToolBox/superpmi/superpmi/commandline.cpp b/src/ToolBox/superpmi/superpmi/commandline.cpp
index 56a2f32d1d..8546afae7c 100644
--- a/src/ToolBox/superpmi/superpmi/commandline.cpp
+++ b/src/ToolBox/superpmi/superpmi/commandline.cpp
@@ -16,7 +16,7 @@
// NOTE: this is parsed by parallelsuperpmi.cpp::ProcessChildStdOut() to determine if an incorrect
// argument usage error has occurred.
-const char* const g_SuperPMIUsageFirstLine = "SuperPMI is a JIT compiler testing tool.";
+const char* const g_SuperPMIUsageFirstLine = "SuperPMI is a JIT compiler testing tool.";
void CommandLine::DumpHelp(const char* program)
{
@@ -135,23 +135,24 @@ void CommandLine::DumpHelp(const char* program)
printf(" ; if there are any failures, record their MC numbers in the file fail.mcl\n");
}
-//Assumption: All inputs are initialized to default or real value. we'll just set the stuff 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 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 tempLen = 0;
- bool foundJit = false;
- bool foundFile = false;
+ size_t argLen = 0;
+ size_t tempLen = 0;
+ bool foundJit = false;
+ bool foundFile = 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
@@ -161,21 +162,20 @@ 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], "HELP", argLen) == 0) ||
+ if ((_strnicmp(&argv[i][1], "help", argLen) == 0) || (_strnicmp(&argv[i][1], "HELP", argLen) == 0) ||
(_strnicmp(&argv[i][1], "?", argLen) == 0))
{
DumpHelp(argv[0]);
@@ -219,12 +219,12 @@ bool CommandLine::Parse(int argc, char* argv[], /* OUT */ Options* o)
DumpHelp(argv[0]);
return false;
}
- char *tempStr = new char[tempLen + 1];
+ char* tempStr = new char[tempLen + 1];
strcpy_s(tempStr, tempLen + 1, argv[i]);
if (!foundJit)
{
o->nameOfJit = tempStr;
- foundJit = true;
+ foundJit = true;
}
else
{
@@ -246,7 +246,7 @@ bool CommandLine::Parse(int argc, char* argv[], /* OUT */ Options* o)
DumpHelp(argv[0]);
return false;
}
- char *tempStr = new char[tempLen + 1];
+ char* tempStr = new char[tempLen + 1];
strcpy_s(tempStr, tempLen + 1, argv[i]);
o->reproName = tempStr;
}
@@ -354,7 +354,8 @@ bool CommandLine::Parse(int argc, char* argv[], /* OUT */ Options* o)
o->compileList = argv[i]; // Save this in case we need it for -parallel.
}
#ifdef USE_COREDISTOOLS
- else if ((_strnicmp(&argv[i][1], "coredistools", argLen) == 0)) {
+ else if ((_strnicmp(&argv[i][1], "coredistools", argLen) == 0))
+ {
o->useCoreDisTools = true;
}
#endif // USE_COREDISTOOLS
@@ -394,13 +395,14 @@ bool CommandLine::Parse(int argc, char* argv[], /* OUT */ Options* o)
if (i + 1 < argc)
{
// If so, does it look like a worker count?
- bool isWorkerCount = true;
- size_t nextlen = strlen(argv[i + 1]);
+ bool isWorkerCount = true;
+ size_t nextlen = strlen(argv[i + 1]);
for (size_t j = 0; j < nextlen; j++)
{
if (!isdigit(argv[i + 1][j]))
{
- isWorkerCount = false; // Doesn't look like a worker count; bail out and let someone else handle it.
+ isWorkerCount =
+ false; // Doesn't look like a worker count; bail out and let someone else handle it.
break;
}
}
@@ -417,7 +419,8 @@ bool CommandLine::Parse(int argc, char* argv[], /* OUT */ Options* o)
}
if (o->workerCount > MAXIMUM_WAIT_OBJECTS)
{
- LogError("Invalid workers count specified, workers count cannot be more than %d.", MAXIMUM_WAIT_OBJECTS);
+ LogError("Invalid workers count specified, workers count cannot be more than %d.",
+ MAXIMUM_WAIT_OBJECTS);
DumpHelp(argv[0]);
return false;
}
@@ -455,7 +458,8 @@ bool CommandLine::Parse(int argc, char* argv[], /* OUT */ Options* o)
if (o->offset < 1 || o->increment < 1)
{
- LogError("Incorrect offset/increment specified for -stride. Offset and increment both must be > 0.");
+ LogError(
+ "Incorrect offset/increment specified for -stride. Offset and increment both must be > 0.");
DumpHelp(argv[0]);
return false;
}
@@ -479,11 +483,11 @@ bool CommandLine::Parse(int argc, char* argv[], /* OUT */ Options* o)
return false;
}
}
- //Process an input filename
- //String comparisons on file extensions must be case-insensitive since we run on Windows
+ // Process an input filename
+ //String comparisons on file extensions must be case-insensitive since we run on Windows
else
{
- char *lastdot = strrchr(argv[i], '.');
+ char* lastdot = strrchr(argv[i], '.');
if (lastdot == nullptr)
{
DumpHelp(argv[0]);
diff --git a/src/ToolBox/superpmi/superpmi/commandline.h b/src/ToolBox/superpmi/superpmi/commandline.h
index 051eb6def2..9937c3c036 100644
--- a/src/ToolBox/superpmi/superpmi/commandline.h
+++ b/src/ToolBox/superpmi/superpmi/commandline.h
@@ -12,33 +12,32 @@
class CommandLine
{
public:
-
class Options
{
public:
- Options() :
- nameOfJit(nullptr),
- nameOfJit2(nullptr),
- nameOfInputMethodContextFile(nullptr),
- writeLogFile(nullptr),
- reproName(nullptr),
- breakOnError(false),
- breakOnAssert(false),
- applyDiff(false),
- parallel(false),
- useCoreDisTools(false),
- skipCleanup(false),
- workerCount(-1),
- indexCount(-1),
- indexes(nullptr),
- hash(nullptr),
- methodStatsTypes(nullptr),
- mclFilename(nullptr),
- diffMCLFilename(nullptr),
- targetArchitecture(nullptr),
- compileList(nullptr),
- offset(-1),
- increment(-1)
+ Options()
+ : nameOfJit(nullptr)
+ , nameOfJit2(nullptr)
+ , nameOfInputMethodContextFile(nullptr)
+ , writeLogFile(nullptr)
+ , reproName(nullptr)
+ , breakOnError(false)
+ , breakOnAssert(false)
+ , applyDiff(false)
+ , parallel(false)
+ , useCoreDisTools(false)
+ , skipCleanup(false)
+ , workerCount(-1)
+ , indexCount(-1)
+ , indexes(nullptr)
+ , hash(nullptr)
+ , methodStatsTypes(nullptr)
+ , mclFilename(nullptr)
+ , diffMCLFilename(nullptr)
+ , targetArchitecture(nullptr)
+ , compileList(nullptr)
+ , offset(-1)
+ , increment(-1)
{
}
@@ -47,23 +46,23 @@ public:
char* nameOfInputMethodContextFile;
char* writeLogFile;
char* reproName;
- bool breakOnError;
- bool breakOnAssert;
- bool applyDiff;
- bool parallel; // User specified to use /parallel mode.
- bool useCoreDisTools; // Use CoreDisTools library instead of Msvcdis
- bool skipCleanup; // In /parallel mode, do we skip cleanup of temporary files? Used for debugging /parallel.
- int workerCount; // Number of workers to use for /parallel mode. -1 (or 1) means don't use parallel mode.
- int indexCount; // If indexCount is -1 and hash points to nullptr it means compile all.
- int* indexes;
+ bool breakOnError;
+ bool breakOnAssert;
+ bool applyDiff;
+ bool parallel; // User specified to use /parallel mode.
+ bool useCoreDisTools; // Use CoreDisTools library instead of Msvcdis
+ bool skipCleanup; // In /parallel mode, do we skip cleanup of temporary files? Used for debugging /parallel.
+ int workerCount; // Number of workers to use for /parallel mode. -1 (or 1) means don't use parallel mode.
+ int indexCount; // If indexCount is -1 and hash points to nullptr it means compile all.
+ int* indexes;
char* hash;
char* methodStatsTypes;
char* mclFilename;
char* diffMCLFilename;
char* targetArchitecture;
char* compileList;
- int offset;
- int increment;
+ int offset;
+ int increment;
};
static bool Parse(int argc, char* argv[], /* OUT */ Options* o);
diff --git a/src/ToolBox/superpmi/superpmi/coreclrcallbacks.cpp b/src/ToolBox/superpmi/superpmi/coreclrcallbacks.cpp
index 7a66d20940..98fbe6980d 100644
--- a/src/ToolBox/superpmi/superpmi/coreclrcallbacks.cpp
+++ b/src/ToolBox/superpmi/superpmi/coreclrcallbacks.cpp
@@ -8,9 +8,9 @@
#include "coreclrcallbacks.h"
#include "iexecutionengine.h"
-IExecutionEngine* STDMETHODCALLTYPE IEE_t()
+IExecutionEngine* IEE_t()
{
- MyIEE *iee = InitIExecutionEngine();
+ MyIEE* iee = InitIExecutionEngine();
return iee;
}
@@ -24,46 +24,46 @@ HRESULT STDMETHODCALLTYPE GetCORSystemDirectory(LPWSTR pbuffer, DWORD cchBuffer,
HANDLE ourHeap = nullptr;
-LPVOID STDMETHODCALLTYPE EEHeapAllocInProcessHeap (DWORD dwFlags, SIZE_T dwBytes)
+LPVOID EEHeapAllocInProcessHeap(DWORD dwFlags, SIZE_T dwBytes)
{
- if(ourHeap==nullptr)
- ourHeap = HeapCreate(0, 4096 ,0);
- if(ourHeap==nullptr)
- {
- LogError("HeapCreate Failed");
- __debugbreak();
- return nullptr;
- }
- LPVOID result = HeapAlloc(ourHeap, dwFlags, dwBytes);
-// LogDebug("EEHeapAllocInProcessHeap %p %u %u", result, dwFlags, dwBytes);
- return result;
+ if (ourHeap == nullptr)
+ ourHeap = HeapCreate(0, 4096, 0);
+ if (ourHeap == nullptr)
+ {
+ LogError("HeapCreate Failed");
+ __debugbreak();
+ return nullptr;
+ }
+ LPVOID result = HeapAlloc(ourHeap, dwFlags, dwBytes);
+ // LogDebug("EEHeapAllocInProcessHeap %p %u %u", result, dwFlags, dwBytes);
+ return result;
}
-BOOL STDMETHODCALLTYPE EEHeapFreeInProcessHeap (DWORD dwFlags, LPVOID lpMem)
+BOOL EEHeapFreeInProcessHeap(DWORD dwFlags, LPVOID lpMem)
{
-// return true;
+ // return true;
return HeapFree(ourHeap, dwFlags, lpMem);
}
-void* STDMETHODCALLTYPE GetCLRFunction(LPCSTR functionName)
+void* GetCLRFunction(LPCSTR functionName)
{
- if(strcmp(functionName, "EEHeapAllocInProcessHeap")==0)
+ if (strcmp(functionName, "EEHeapAllocInProcessHeap") == 0)
return (void*)EEHeapAllocInProcessHeap;
- if(strcmp(functionName, "EEHeapFreeInProcessHeap")==0)
+ if (strcmp(functionName, "EEHeapFreeInProcessHeap") == 0)
return (void*)EEHeapFreeInProcessHeap;
DebugBreakorAV(132);
return nullptr;
}
-CoreClrCallbacks *InitCoreClrCallbacks()
+CoreClrCallbacks* InitCoreClrCallbacks()
{
- CoreClrCallbacks *temp = new CoreClrCallbacks();
+ CoreClrCallbacks* temp = new CoreClrCallbacks();
::ZeroMemory(temp, sizeof(CoreClrCallbacks));
- temp->m_hmodCoreCLR = (HINSTANCE)(size_t)0xbadbad01; // any non-null value seems okay...
- temp->m_pfnIEE = IEE_t;
- temp->m_pfnGetCORSystemDirectory = nullptr;//GetCORSystemDirectory;
- temp->m_pfnGetCLRFunction = GetCLRFunction;
+ temp->m_hmodCoreCLR = (HINSTANCE)(size_t)0xbadbad01; // any non-null value seems okay...
+ temp->m_pfnIEE = IEE_t;
+ temp->m_pfnGetCORSystemDirectory = nullptr; // GetCORSystemDirectory;
+ temp->m_pfnGetCLRFunction = GetCLRFunction;
return temp;
}
diff --git a/src/ToolBox/superpmi/superpmi/coreclrcallbacks.h b/src/ToolBox/superpmi/superpmi/coreclrcallbacks.h
index cb3815525e..3305779535 100644
--- a/src/ToolBox/superpmi/superpmi/coreclrcallbacks.h
+++ b/src/ToolBox/superpmi/superpmi/coreclrcallbacks.h
@@ -6,13 +6,8 @@
#ifndef _CoreClrCallbacks
#define _CoreClrCallbacks
-#include "runtimedetails.h"
+#include "coreclrcommoncallbacks.h"
-IExecutionEngine* STDMETHODCALLTYPE IEE_t();
-HRESULT STDMETHODCALLTYPE GetCORSystemDirectory(LPWSTR pbuffer, DWORD cchBuffer, DWORD* pdwlength);
-LPVOID STDMETHODCALLTYPE EEHeapAllocInProcessHeap (DWORD dwFlags, SIZE_T dwBytes);
-BOOL STDMETHODCALLTYPE EEHeapFreeInProcessHeap (DWORD dwFlags, LPVOID lpMem);
-void* STDMETHODCALLTYPE GetCLRFunction(LPCSTR functionName);
-CoreClrCallbacks *InitCoreClrCallbacks();
+CoreClrCallbacks* InitCoreClrCallbacks();
-#endif \ No newline at end of file
+#endif
diff --git a/src/ToolBox/superpmi/superpmi/cycletimer.cpp b/src/ToolBox/superpmi/superpmi/cycletimer.cpp
index de0e19b935..7904e56fcb 100644
--- a/src/ToolBox/superpmi/superpmi/cycletimer.cpp
+++ b/src/ToolBox/superpmi/superpmi/cycletimer.cpp
@@ -8,8 +8,8 @@
CycleTimer::CycleTimer()
{
- start = 0;
- stop = 0;
+ start = 0;
+ stop = 0;
overhead = QueryOverhead();
}
@@ -21,7 +21,7 @@ void CycleTimer::Start()
{
BOOL retVal = QueryThreadCycleTime(GetCurrentThread(), &start);
- if(retVal == FALSE)
+ if (retVal == FALSE)
{
LogError("CycleTimer::Start unable to QPC. error was 0x%08x", ::GetLastError());
::__debugbreak();
@@ -32,7 +32,7 @@ void CycleTimer::Stop()
{
BOOL retVal = QueryThreadCycleTime(GetCurrentThread(), &stop);
- if(retVal == FALSE)
+ if (retVal == FALSE)
{
LogError("CycleTimer::Stop unable to QPC. error was 0x%08x", ::GetLastError());
::__debugbreak();
@@ -49,12 +49,12 @@ unsigned __int64 CycleTimer::QueryOverhead()
unsigned __int64 tot = 0;
unsigned __int64 startCycles;
unsigned __int64 endCycles;
- const int N = 1000;
+ const int N = 1000;
for (int i = 0; i < N; i++)
{
QueryThreadCycleTime(GetCurrentThread(), &startCycles);
QueryThreadCycleTime(GetCurrentThread(), &endCycles);
- tot += (endCycles-startCycles);
+ tot += (endCycles - startCycles);
}
- return tot/N;
+ return tot / N;
} \ No newline at end of file
diff --git a/src/ToolBox/superpmi/superpmi/cycletimer.h b/src/ToolBox/superpmi/superpmi/cycletimer.h
index 9ad855501a..a99d1c33dc 100644
--- a/src/ToolBox/superpmi/superpmi/cycletimer.h
+++ b/src/ToolBox/superpmi/superpmi/cycletimer.h
@@ -14,8 +14,8 @@ public:
CycleTimer();
~CycleTimer();
- void Start();
- void Stop();
+ void Start();
+ void Stop();
unsigned __int64 GetCycles();
unsigned __int64 QueryOverhead();
diff --git a/src/ToolBox/superpmi/superpmi/filecache.cpp b/src/ToolBox/superpmi/superpmi/filecache.cpp
index dcd783a09b..0455fa9fe7 100644
--- a/src/ToolBox/superpmi/superpmi/filecache.cpp
+++ b/src/ToolBox/superpmi/superpmi/filecache.cpp
@@ -8,93 +8,89 @@
#include "standardpch.h"
#include "filecache.h"
-#define FileCacheSize 0xFFFFFF //needs to be bigger than the biggest read request.
+#define FileCacheSize 0xFFFFFF // needs to be bigger than the biggest read request.
-HANDLE FileCache::cachedHandle;
-bool FileCache::openAsCache;
-BYTE *FileCache::rawBuff;
+HANDLE FileCache::cachedHandle;
+bool FileCache::openAsCache;
+BYTE* FileCache::rawBuff;
unsigned int FileCache::offset;
unsigned int FileCache::length;
-__int64 FileCache::fileoffset;
+__int64 FileCache::fileoffset;
HANDLE
-FileCache::CreateFileA(
- _In_ LPCSTR lpFileName,
- _In_ DWORD dwDesiredAccess,
- _In_ DWORD dwShareMode,
- _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes,
- _In_ DWORD dwCreationDisposition,
- _In_ DWORD dwFlagsAndAttributes,
- _In_opt_ HANDLE hTemplateFile
- )
+FileCache::CreateFileA(_In_ LPCSTR lpFileName,
+ _In_ DWORD dwDesiredAccess,
+ _In_ DWORD dwShareMode,
+ _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes,
+ _In_ DWORD dwCreationDisposition,
+ _In_ DWORD dwFlagsAndAttributes,
+ _In_opt_ HANDLE hTemplateFile)
{
openAsCache = false;
- rawBuff = nullptr;
- offset = 0;
- length = 0;
+ rawBuff = nullptr;
+ offset = 0;
+ length = 0;
- if((dwShareMode&CACHE_THIS_FILE)==CACHE_THIS_FILE)
+ if ((dwShareMode & CACHE_THIS_FILE) == CACHE_THIS_FILE)
{
dwShareMode ^= CACHE_THIS_FILE;
openAsCache = true;
}
- HANDLE temp = ::CreateFileA(lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile);
- if(openAsCache)
- cachedHandle = temp; //yes yes.. this is unsafe.. but one accessor now is okay. bswhack
+ HANDLE temp = ::CreateFileA(lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition,
+ dwFlagsAndAttributes, hTemplateFile);
+ if (openAsCache)
+ cachedHandle = temp; // yes yes.. this is unsafe.. but one accessor now is okay. bswhack
return temp;
}
HANDLE
-FileCache::CreateFileW(
- _In_ LPCWSTR lpFileName,
- _In_ DWORD dwDesiredAccess,
- _In_ DWORD dwShareMode,
- _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes,
- _In_ DWORD dwCreationDisposition,
- _In_ DWORD dwFlagsAndAttributes,
- _In_opt_ HANDLE hTemplateFile
- )
+FileCache::CreateFileW(_In_ LPCWSTR lpFileName,
+ _In_ DWORD dwDesiredAccess,
+ _In_ DWORD dwShareMode,
+ _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes,
+ _In_ DWORD dwCreationDisposition,
+ _In_ DWORD dwFlagsAndAttributes,
+ _In_opt_ HANDLE hTemplateFile)
{
openAsCache = false;
- rawBuff = nullptr;
- offset = 0;
- length = 0;
- return ::CreateFileW(lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile);
+ rawBuff = nullptr;
+ offset = 0;
+ length = 0;
+ return ::CreateFileW(lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition,
+ dwFlagsAndAttributes, hTemplateFile);
}
-
-//Somewhat sloppy quick copy... we don't treat lpNumberOfBytesRead etc correctly
-BOOL
-FileCache::ReadFile(
- _In_ HANDLE hFile,
- _Out_writes_bytes_to_opt_(nNumberOfBytesToRead, *lpNumberOfBytesRead) __out_data_source(FILE) LPVOID lpBuffer,
- _In_ DWORD nNumberOfBytesToRead,
- _Out_opt_ LPDWORD lpNumberOfBytesRead,
- _Inout_opt_ LPOVERLAPPED lpOverlapped
- )
+// Somewhat sloppy quick copy... we don't treat lpNumberOfBytesRead etc correctly
+BOOL FileCache::ReadFile(_In_ HANDLE hFile,
+ _Out_writes_bytes_to_opt_(nNumberOfBytesToRead, *lpNumberOfBytesRead) __out_data_source(FILE)
+ LPVOID lpBuffer,
+ _In_ DWORD nNumberOfBytesToRead,
+ _Out_opt_ LPDWORD lpNumberOfBytesRead,
+ _Inout_opt_ LPOVERLAPPED lpOverlapped)
{
- if(!openAsCache)
+ if (!openAsCache)
return ::ReadFile(hFile, lpBuffer, nNumberOfBytesToRead, lpNumberOfBytesRead, lpOverlapped);
else
{
- if(rawBuff == nullptr)
+ if (rawBuff == nullptr)
{
rawBuff = new BYTE[FileCacheSize];
- length = FileCacheSize;
- offset = FileCacheSize;
+ length = FileCacheSize;
+ offset = FileCacheSize;
}
- if(nNumberOfBytesToRead > FileCacheSize)
+ if (nNumberOfBytesToRead > FileCacheSize)
{
printf("ERROR: nNumberOfBytesToRead exceeds FileCacheSize %u > %u\n", nNumberOfBytesToRead, FileCacheSize);
__debugbreak();
}
- if((offset+nNumberOfBytesToRead) > length)
+ if ((offset + nNumberOfBytesToRead) > length)
{
- memmove(rawBuff, &rawBuff[offset], length-offset); //Use memmove since we have overlapping regions more than half the time
- ::ReadFile(hFile, &rawBuff[length-offset], offset, lpNumberOfBytesRead, lpOverlapped);
- if(*lpNumberOfBytesRead ==0)
+ memmove(rawBuff, &rawBuff[offset],
+ length - offset); // Use memmove since we have overlapping regions more than half the time
+ ::ReadFile(hFile, &rawBuff[length - offset], offset, lpNumberOfBytesRead, lpOverlapped);
+ if (*lpNumberOfBytesRead == 0)
__debugbreak();
- length -= offset-(*lpNumberOfBytesRead);
+ length -= offset - (*lpNumberOfBytesRead);
LARGE_INTEGER DataTemp;
LARGE_INTEGER zero;
zero.QuadPart = 0;
@@ -104,23 +100,20 @@ FileCache::ReadFile(
offset = 0;
}
memcpy(lpBuffer, &rawBuff[offset], nNumberOfBytesToRead);
- offset+=nNumberOfBytesToRead;
- if(offset > FileCacheSize)
+ offset += nNumberOfBytesToRead;
+ if (offset > FileCacheSize)
__debugbreak();
return true;
}
}
-BOOL
-FileCache::WriteFile(
- _In_ HANDLE hFile,
- _In_reads_bytes_opt_(nNumberOfBytesToWrite) LPCVOID lpBuffer,
- _In_ DWORD nNumberOfBytesToWrite,
- _Out_opt_ LPDWORD lpNumberOfBytesWritten,
- _Inout_opt_ LPOVERLAPPED lpOverlapped
- )
+BOOL FileCache::WriteFile(_In_ HANDLE hFile,
+ _In_reads_bytes_opt_(nNumberOfBytesToWrite) LPCVOID lpBuffer,
+ _In_ DWORD nNumberOfBytesToWrite,
+ _Out_opt_ LPDWORD lpNumberOfBytesWritten,
+ _Inout_opt_ LPOVERLAPPED lpOverlapped)
{
- if(!openAsCache)
+ if (!openAsCache)
return ::WriteFile(hFile, lpBuffer, nNumberOfBytesToWrite, lpNumberOfBytesWritten, lpOverlapped);
else
{
@@ -130,17 +123,14 @@ FileCache::WriteFile(
}
}
-BOOL
-FileCache::CloseHandle(
- _In_ HANDLE hObject
- )
+BOOL FileCache::CloseHandle(_In_ HANDLE hObject)
{
- if(!openAsCache)
+ if (!openAsCache)
return ::CloseHandle(hObject);
else
{
- if(rawBuff!=nullptr)
- delete []rawBuff;
+ if (rawBuff != nullptr)
+ delete[] rawBuff;
return ::CloseHandle(hObject);
}
}
diff --git a/src/ToolBox/superpmi/superpmi/filecache.h b/src/ToolBox/superpmi/superpmi/filecache.h
index 51df5edde9..876100ec6e 100644
--- a/src/ToolBox/superpmi/superpmi/filecache.h
+++ b/src/ToolBox/superpmi/superpmi/filecache.h
@@ -19,60 +19,45 @@
class FileCache
{
public:
-
-static HANDLE
-CreateFileA(
- _In_ LPCSTR lpFileName,
- _In_ DWORD dwDesiredAccess,
- _In_ DWORD dwShareMode,
- _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes,
- _In_ DWORD dwCreationDisposition,
- _In_ DWORD dwFlagsAndAttributes,
- _In_opt_ HANDLE hTemplateFile
- );
-
-static HANDLE
-CreateFileW(
- _In_ LPCWSTR lpFileName,
- _In_ DWORD dwDesiredAccess,
- _In_ DWORD dwShareMode,
- _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes,
- _In_ DWORD dwCreationDisposition,
- _In_ DWORD dwFlagsAndAttributes,
- _In_opt_ HANDLE hTemplateFile
- );
-
-static BOOL
-ReadFile(
- _In_ HANDLE hFile,
- _Out_writes_bytes_to_opt_(nNumberOfBytesToRead, *lpNumberOfBytesRead) __out_data_source(FILE) LPVOID lpBuffer,
- _In_ DWORD nNumberOfBytesToRead,
- _Out_opt_ LPDWORD lpNumberOfBytesRead,
- _Inout_opt_ LPOVERLAPPED lpOverlapped
- );
-
-static BOOL
-WriteFile(
- _In_ HANDLE hFile,
- _In_reads_bytes_opt_(nNumberOfBytesToWrite) LPCVOID lpBuffer,
- _In_ DWORD nNumberOfBytesToWrite,
- _Out_opt_ LPDWORD lpNumberOfBytesWritten,
- _Inout_opt_ LPOVERLAPPED lpOverlapped
- );
-
-static BOOL
-CloseHandle(
- _In_ HANDLE hObject
- );
-
-static __int64 GetFilePos(HANDLE hFile);
+ static HANDLE CreateFileA(_In_ LPCSTR lpFileName,
+ _In_ DWORD dwDesiredAccess,
+ _In_ DWORD dwShareMode,
+ _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes,
+ _In_ DWORD dwCreationDisposition,
+ _In_ DWORD dwFlagsAndAttributes,
+ _In_opt_ HANDLE hTemplateFile);
+
+ static HANDLE CreateFileW(_In_ LPCWSTR lpFileName,
+ _In_ DWORD dwDesiredAccess,
+ _In_ DWORD dwShareMode,
+ _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes,
+ _In_ DWORD dwCreationDisposition,
+ _In_ DWORD dwFlagsAndAttributes,
+ _In_opt_ HANDLE hTemplateFile);
+
+ static BOOL ReadFile(_In_ HANDLE hFile,
+ _Out_writes_bytes_to_opt_(nNumberOfBytesToRead, *lpNumberOfBytesRead) __out_data_source(FILE)
+ LPVOID lpBuffer,
+ _In_ DWORD nNumberOfBytesToRead,
+ _Out_opt_ LPDWORD lpNumberOfBytesRead,
+ _Inout_opt_ LPOVERLAPPED lpOverlapped);
+
+ static BOOL WriteFile(_In_ HANDLE hFile,
+ _In_reads_bytes_opt_(nNumberOfBytesToWrite) LPCVOID lpBuffer,
+ _In_ DWORD nNumberOfBytesToWrite,
+ _Out_opt_ LPDWORD lpNumberOfBytesWritten,
+ _Inout_opt_ LPOVERLAPPED lpOverlapped);
+
+ static BOOL CloseHandle(_In_ HANDLE hObject);
+
+ static __int64 GetFilePos(HANDLE hFile);
private:
- static HANDLE cachedHandle;
- static bool openAsCache;
- static BYTE *rawBuff;
+ static HANDLE cachedHandle;
+ static bool openAsCache;
+ static BYTE* rawBuff;
static unsigned int offset;
static unsigned int length;
- static __int64 fileoffset;
+ static __int64 fileoffset;
};
#endif
diff --git a/src/ToolBox/superpmi/superpmi/icorjitinfo.cpp b/src/ToolBox/superpmi/superpmi/icorjitinfo.cpp
index 6478b3c684..59ad3c5e40 100644
--- a/src/ToolBox/superpmi/superpmi/icorjitinfo.cpp
+++ b/src/ToolBox/superpmi/superpmi/icorjitinfo.cpp
@@ -8,17 +8,17 @@
#include "jitdebugger.h"
#include "spmiutil.h"
-ICorJitInfo *pICJI = nullptr;
+ICorJitInfo* pICJI = nullptr;
-ICorJitInfo* InitICorJitInfo(JitInstance *jitInstance)
+ICorJitInfo* InitICorJitInfo(JitInstance* jitInstance)
{
- MyICJI *icji = new MyICJI();
+ MyICJI* icji = new MyICJI();
icji->jitInstance = jitInstance;
- pICJI = icji;
+ pICJI = icji;
return icji;
}
-//Stuff on ICorStaticInfo
+// Stuff on ICorStaticInfo
/**********************************************************************************/
//
// ICorMethodInfo
@@ -26,54 +26,50 @@ ICorJitInfo* InitICorJitInfo(JitInstance *jitInstance)
/**********************************************************************************/
// return flags (defined above, CORINFO_FLG_PUBLIC ...)
-DWORD MyICJI::getMethodAttribs (CORINFO_METHOD_HANDLE ftn /* IN */)
+DWORD MyICJI::getMethodAttribs(CORINFO_METHOD_HANDLE ftn /* IN */)
{
jitInstance->mc->cr->AddCall("getMethodAttribs");
return jitInstance->mc->repGetMethodAttribs(ftn);
}
// sets private JIT flags, which can be, retrieved using getAttrib.
-void MyICJI::setMethodAttribs (CORINFO_METHOD_HANDLE ftn,/* IN */
- CorInfoMethodRuntimeFlags attribs/* IN */)
+void MyICJI::setMethodAttribs(CORINFO_METHOD_HANDLE ftn, /* IN */
+ CorInfoMethodRuntimeFlags attribs /* IN */)
{
jitInstance->mc->cr->AddCall("setMethodAttribs");
jitInstance->mc->cr->recSetMethodAttribs(ftn, attribs);
}
-
// 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 MyICJI::getMethodSig (
- CORINFO_METHOD_HANDLE ftn, /* IN */
- CORINFO_SIG_INFO *sig, /* OUT */
- CORINFO_CLASS_HANDLE memberParent/* IN */
- )
+void MyICJI::getMethodSig(CORINFO_METHOD_HANDLE ftn, /* IN */
+ CORINFO_SIG_INFO* sig, /* OUT */
+ CORINFO_CLASS_HANDLE memberParent /* IN */
+ )
{
jitInstance->mc->cr->AddCall("getMethodSig");
jitInstance->mc->repGetMethodSig(ftn, sig, memberParent);
}
+/*********************************************************************
+* 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
+*********************************************************************/
- /*********************************************************************
- * 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 MyICJI::getMethodInfo (
- CORINFO_METHOD_HANDLE ftn, /* IN */
- CORINFO_METHOD_INFO* info /* OUT */
- )
+// 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 MyICJI::getMethodInfo(CORINFO_METHOD_HANDLE ftn, /* IN */
+ CORINFO_METHOD_INFO* info /* OUT */
+ )
{
jitInstance->mc->cr->AddCall("getMethodInfo");
DWORD exceptionCode = 0;
- bool value = jitInstance->mc->repGetMethodInfo(ftn, info, &exceptionCode);
- if(exceptionCode != 0)
+ bool value = jitInstance->mc->repGetMethodInfo(ftn, info, &exceptionCode);
+ if (exceptionCode != 0)
ThrowException(exceptionCode);
return value;
}
@@ -87,17 +83,16 @@ void MyICJI::getMethodSig (
//
// The inlined method need not be verified
-CorInfoInline MyICJI::canInline (
- CORINFO_METHOD_HANDLE callerHnd, /* IN */
- CORINFO_METHOD_HANDLE calleeHnd, /* IN */
- DWORD* pRestrictions /* OUT */
- )
+CorInfoInline MyICJI::canInline(CORINFO_METHOD_HANDLE callerHnd, /* IN */
+ CORINFO_METHOD_HANDLE calleeHnd, /* IN */
+ DWORD* pRestrictions /* OUT */
+ )
{
jitInstance->mc->cr->AddCall("canInline");
- DWORD exceptionCode = 0;
- CorInfoInline result = jitInstance->mc->repCanInline(callerHnd, calleeHnd, pRestrictions, &exceptionCode);
- if(exceptionCode != 0)
+ DWORD exceptionCode = 0;
+ CorInfoInline result = jitInstance->mc->repCanInline(callerHnd, calleeHnd, pRestrictions, &exceptionCode);
+ if (exceptionCode != 0)
ThrowException(exceptionCode);
return result;
}
@@ -105,25 +100,23 @@ CorInfoInline MyICJI::canInline (
// 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 MyICJI::reportInliningDecision (CORINFO_METHOD_HANDLE inlinerHnd,
- CORINFO_METHOD_HANDLE inlineeHnd,
- CorInfoInline inlineResult,
- const char * reason)
+void MyICJI::reportInliningDecision(CORINFO_METHOD_HANDLE inlinerHnd,
+ CORINFO_METHOD_HANDLE inlineeHnd,
+ CorInfoInline inlineResult,
+ const char* reason)
{
jitInstance->mc->cr->AddCall("reportInliningDecision");
jitInstance->mc->cr->recReportInliningDecision(inlinerHnd, inlineeHnd, inlineResult, 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 MyICJI::canTailCall (
- CORINFO_METHOD_HANDLE callerHnd, /* IN */
- CORINFO_METHOD_HANDLE declaredCalleeHnd, /* IN */
- CORINFO_METHOD_HANDLE exactCalleeHnd, /* IN */
- bool fIsTailPrefix /* IN */
- )
+bool MyICJI::canTailCall(CORINFO_METHOD_HANDLE callerHnd, /* IN */
+ CORINFO_METHOD_HANDLE declaredCalleeHnd, /* IN */
+ CORINFO_METHOD_HANDLE exactCalleeHnd, /* IN */
+ bool fIsTailPrefix /* IN */
+ )
{
jitInstance->mc->cr->AddCall("canTailCall");
return jitInstance->mc->repCanTailCall(callerHnd, declaredCalleeHnd, exactCalleeHnd, fIsTailPrefix);
@@ -132,40 +125,35 @@ bool MyICJI::canTailCall (
// 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 MyICJI::reportTailCallDecision (CORINFO_METHOD_HANDLE callerHnd,
- CORINFO_METHOD_HANDLE calleeHnd,
- bool fIsTailPrefix,
- CorInfoTailCall tailCallResult,
- const char * reason)
+void MyICJI::reportTailCallDecision(CORINFO_METHOD_HANDLE callerHnd,
+ CORINFO_METHOD_HANDLE calleeHnd,
+ bool fIsTailPrefix,
+ CorInfoTailCall tailCallResult,
+ const char* reason)
{
jitInstance->mc->cr->AddCall("reportTailCallDecision");
jitInstance->mc->cr->recReportTailCallDecision(callerHnd, calleeHnd, fIsTailPrefix, tailCallResult, reason);
}
// get individual exception handler
-void MyICJI::getEHinfo(
- CORINFO_METHOD_HANDLE ftn, /* IN */
- unsigned EHnumber, /* IN */
- CORINFO_EH_CLAUSE* clause /* OUT */
- )
+void MyICJI::getEHinfo(CORINFO_METHOD_HANDLE ftn, /* IN */
+ unsigned EHnumber, /* IN */
+ CORINFO_EH_CLAUSE* clause /* OUT */
+ )
{
jitInstance->mc->cr->AddCall("getEHinfo");
jitInstance->mc->repGetEHinfo(ftn, EHnumber, clause);
}
// return class it belongs to
-CORINFO_CLASS_HANDLE MyICJI::getMethodClass (
- CORINFO_METHOD_HANDLE method
- )
+CORINFO_CLASS_HANDLE MyICJI::getMethodClass(CORINFO_METHOD_HANDLE method)
{
jitInstance->mc->cr->AddCall("getMethodClass");
return jitInstance->mc->repGetMethodClass(method);
}
// return module it belongs to
-CORINFO_MODULE_HANDLE MyICJI::getMethodModule (
- CORINFO_METHOD_HANDLE method
- )
+CORINFO_MODULE_HANDLE MyICJI::getMethodModule(CORINFO_METHOD_HANDLE method)
{
jitInstance->mc->cr->AddCall("getMethodModule");
LogError("Hit unimplemented getMethodModule");
@@ -175,11 +163,10 @@ CORINFO_MODULE_HANDLE MyICJI::getMethodModule (
// This function returns the offset of the specified method in the
// vtable of it's owning class or interface.
-void MyICJI::getMethodVTableOffset (
- CORINFO_METHOD_HANDLE method, /* IN */
- unsigned* offsetOfIndirection, /* OUT */
- unsigned* offsetAfterIndirection /* OUT */
- )
+void MyICJI::getMethodVTableOffset(CORINFO_METHOD_HANDLE method, /* IN */
+ unsigned* offsetOfIndirection, /* OUT */
+ unsigned* offsetAfterIndirection /* OUT */
+ )
{
jitInstance->mc->cr->AddCall("getMethodVTableOffset");
jitInstance->mc->repGetMethodVTableOffset(method, offsetOfIndirection, offsetAfterIndirection);
@@ -187,41 +174,34 @@ void MyICJI::getMethodVTableOffset (
// Find the virtual method in implementingClass that overrides virtualMethod.
// Return null if devirtualization is not possible.
-CORINFO_METHOD_HANDLE MyICJI::resolveVirtualMethod(
- CORINFO_METHOD_HANDLE virtualMethod,
- CORINFO_CLASS_HANDLE implementingClass,
- CORINFO_CONTEXT_HANDLE ownerType
- )
+CORINFO_METHOD_HANDLE MyICJI::resolveVirtualMethod(CORINFO_METHOD_HANDLE virtualMethod,
+ CORINFO_CLASS_HANDLE implementingClass,
+ CORINFO_CONTEXT_HANDLE ownerType)
{
jitInstance->mc->cr->AddCall("resolveVirtualMethod");
- CORINFO_METHOD_HANDLE result = jitInstance->mc->repResolveVirtualMethod(virtualMethod, implementingClass, ownerType);
+ CORINFO_METHOD_HANDLE result =
+ jitInstance->mc->repResolveVirtualMethod(virtualMethod, implementingClass, ownerType);
return result;
}
// If a method's attributes have (getMethodAttribs) CORINFO_FLG_INTRINSIC set,
// getIntrinsicID() returns the intrinsic ID.
-CorInfoIntrinsics MyICJI::getIntrinsicID(
- CORINFO_METHOD_HANDLE method,
- bool* pMustExpand /* OUT */
- )
+CorInfoIntrinsics MyICJI::getIntrinsicID(CORINFO_METHOD_HANDLE method, bool* pMustExpand /* OUT */
+ )
{
jitInstance->mc->cr->AddCall("getIntrinsicID");
return jitInstance->mc->repGetIntrinsicID(method, pMustExpand);
}
// Is the given module the System.Numerics.Vectors module?
-bool MyICJI::isInSIMDModule(
- CORINFO_CLASS_HANDLE classHnd
- )
+bool MyICJI::isInSIMDModule(CORINFO_CLASS_HANDLE classHnd)
{
jitInstance->mc->cr->AddCall("isInSIMDModule");
return jitInstance->mc->repIsInSIMDModule(classHnd) ? true : false;
}
// return the unmanaged calling convention for a PInvoke
-CorInfoUnmanagedCallConv MyICJI::getUnmanagedCallConv(
- CORINFO_METHOD_HANDLE method
- )
+CorInfoUnmanagedCallConv MyICJI::getUnmanagedCallConv(CORINFO_METHOD_HANDLE method)
{
jitInstance->mc->cr->AddCall("getUnmanagedCallConv");
return jitInstance->mc->repGetUnmanagedCallConv(method);
@@ -229,10 +209,7 @@ CorInfoUnmanagedCallConv MyICJI::getUnmanagedCallConv(
// 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 MyICJI::pInvokeMarshalingRequired(
- CORINFO_METHOD_HANDLE method,
- CORINFO_SIG_INFO* callSiteSig
- )
+BOOL MyICJI::pInvokeMarshalingRequired(CORINFO_METHOD_HANDLE method, CORINFO_SIG_INFO* callSiteSig)
{
jitInstance->mc->cr->AddCall("pInvokeMarshalingRequired");
return jitInstance->mc->repPInvokeMarshalingRequired(method, callSiteSig);
@@ -240,10 +217,8 @@ BOOL MyICJI::pInvokeMarshalingRequired(
// Check constraints on method type arguments (only).
// The parent class should be checked separately using satisfiesClassConstraints(parent).
-BOOL MyICJI::satisfiesMethodConstraints(
- CORINFO_CLASS_HANDLE parent, // the exact parent of the method
- CORINFO_METHOD_HANDLE method
- )
+BOOL MyICJI::satisfiesMethodConstraints(CORINFO_CLASS_HANDLE parent, // the exact parent of the method
+ CORINFO_METHOD_HANDLE method)
{
jitInstance->mc->cr->AddCall("satisfiesMethodConstraints");
return jitInstance->mc->repSatisfiesMethodConstraints(parent, method);
@@ -252,34 +227,28 @@ BOOL MyICJI::satisfiesMethodConstraints(
// 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 MyICJI::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 */
- )
+BOOL MyICJI::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 */
+ )
{
jitInstance->mc->cr->AddCall("isCompatibleDelegate");
return jitInstance->mc->repIsCompatibleDelegate(objCls, methodParentCls, method, delegateCls, pfIsOpenDelegate);
}
// Determines whether the delegate creation obeys security transparency rules
-BOOL MyICJI::isDelegateCreationAllowed (
- CORINFO_CLASS_HANDLE delegateHnd,
- CORINFO_METHOD_HANDLE calleeHnd
- )
+BOOL MyICJI::isDelegateCreationAllowed(CORINFO_CLASS_HANDLE delegateHnd, CORINFO_METHOD_HANDLE calleeHnd)
{
jitInstance->mc->cr->AddCall("isDelegateCreationAllowed");
return jitInstance->mc->repIsDelegateCreationAllowed(delegateHnd, calleeHnd);
}
-
// Indicates if the method is an instance of the generic
// method that passes (or has passed) verification
-CorInfoInstantiationVerification MyICJI::isInstantiationOfVerifiedGeneric (
- CORINFO_METHOD_HANDLE method /* IN */
- )
+CorInfoInstantiationVerification MyICJI::isInstantiationOfVerifiedGeneric(CORINFO_METHOD_HANDLE method /* IN */
+ )
{
jitInstance->mc->cr->AddCall("isInstantiationOfVerifiedGeneric");
return jitInstance->mc->repIsInstantiationOfVerifiedGeneric(method);
@@ -287,38 +256,32 @@ CorInfoInstantiationVerification MyICJI::isInstantiationOfVerifiedGeneric (
// Loads the constraints on a typical method definition, detecting cycles;
// for use in verification.
-void MyICJI::initConstraintsForVerification(
- CORINFO_METHOD_HANDLE method, /* IN */
- BOOL *pfHasCircularClassConstraints, /* OUT */
- BOOL *pfHasCircularMethodConstraint /* OUT */
- )
+void MyICJI::initConstraintsForVerification(CORINFO_METHOD_HANDLE method, /* IN */
+ BOOL* pfHasCircularClassConstraints, /* OUT */
+ BOOL* pfHasCircularMethodConstraint /* OUT */
+ )
{
jitInstance->mc->cr->AddCall("initConstraintsForVerification");
- jitInstance->mc->repInitConstraintsForVerification(method, pfHasCircularClassConstraints, pfHasCircularMethodConstraint);
+ jitInstance->mc->repInitConstraintsForVerification(method, pfHasCircularClassConstraints,
+ pfHasCircularMethodConstraint);
}
// Returns enum whether the method does not require verification
// Also see ICorModuleInfo::canSkipVerification
-CorInfoCanSkipVerificationResult MyICJI::canSkipMethodVerification (
- CORINFO_METHOD_HANDLE ftnHandle
- )
+CorInfoCanSkipVerificationResult MyICJI::canSkipMethodVerification(CORINFO_METHOD_HANDLE ftnHandle)
{
jitInstance->mc->cr->AddCall("canSkipMethodVerification");
return jitInstance->mc->repCanSkipMethodVerification(ftnHandle, FALSE);
}
// load and restore the method
-void MyICJI::methodMustBeLoadedBeforeCodeIsRun(
- CORINFO_METHOD_HANDLE method
- )
+void MyICJI::methodMustBeLoadedBeforeCodeIsRun(CORINFO_METHOD_HANDLE method)
{
jitInstance->mc->cr->AddCall("methodMustBeLoadedBeforeCodeIsRun");
jitInstance->mc->cr->recMethodMustBeLoadedBeforeCodeIsRun(method);
}
-CORINFO_METHOD_HANDLE MyICJI::mapMethodDeclToMethodImpl(
- CORINFO_METHOD_HANDLE method
- )
+CORINFO_METHOD_HANDLE MyICJI::mapMethodDeclToMethodImpl(CORINFO_METHOD_HANDLE method)
{
jitInstance->mc->cr->AddCall("mapMethodDeclToMethodImpl");
LogError("Hit unimplemented mapMethodDeclToMethodImpl");
@@ -328,10 +291,9 @@ CORINFO_METHOD_HANDLE MyICJI::mapMethodDeclToMethodImpl(
// 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 MyICJI::getGSCookie(
- GSCookie * pCookieVal, // OUT
- GSCookie ** ppCookieVal // OUT
- )
+void MyICJI::getGSCookie(GSCookie* pCookieVal, // OUT
+ GSCookie** ppCookieVal // OUT
+ )
{
jitInstance->mc->cr->AddCall("getGSCookie");
jitInstance->mc->repGetGSCookie(pCookieVal, ppCookieVal);
@@ -344,29 +306,28 @@ void MyICJI::getGSCookie(
/**********************************************************************************/
// Resolve metadata token into runtime method handles.
-void MyICJI::resolveToken(/* IN, OUT */ CORINFO_RESOLVED_TOKEN * pResolvedToken)
+void MyICJI::resolveToken(/* IN, OUT */ CORINFO_RESOLVED_TOKEN* pResolvedToken)
{
DWORD exceptionCode = 0;
jitInstance->mc->cr->AddCall("resolveToken");
jitInstance->mc->repResolveToken(pResolvedToken, &exceptionCode);
- if(exceptionCode != 0)
+ if (exceptionCode != 0)
ThrowException(exceptionCode);
}
// Resolve metadata token into runtime method handles.
-bool MyICJI::tryResolveToken(/* IN, OUT */ CORINFO_RESOLVED_TOKEN * pResolvedToken)
+bool MyICJI::tryResolveToken(/* IN, OUT */ CORINFO_RESOLVED_TOKEN* pResolvedToken)
{
jitInstance->mc->cr->AddCall("tryResolveToken");
return jitInstance->mc->repTryResolveToken(pResolvedToken);
}
// Signature information about the call sig
-void MyICJI::findSig (
- CORINFO_MODULE_HANDLE module, /* IN */
- unsigned sigTOK, /* IN */
- CORINFO_CONTEXT_HANDLE context, /* IN */
- CORINFO_SIG_INFO *sig /* OUT */
- )
+void MyICJI::findSig(CORINFO_MODULE_HANDLE module, /* IN */
+ unsigned sigTOK, /* IN */
+ CORINFO_CONTEXT_HANDLE context, /* IN */
+ CORINFO_SIG_INFO* sig /* OUT */
+ )
{
jitInstance->mc->cr->AddCall("findSig");
jitInstance->mc->repFindSig(module, sigTOK, context, sig);
@@ -375,19 +336,17 @@ void MyICJI::findSig (
// 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 MyICJI::findCallSiteSig (
- CORINFO_MODULE_HANDLE module, /* IN */
- unsigned methTOK, /* IN */
- CORINFO_CONTEXT_HANDLE context, /* IN */
- CORINFO_SIG_INFO *sig /* OUT */
- )
+void MyICJI::findCallSiteSig(CORINFO_MODULE_HANDLE module, /* IN */
+ unsigned methTOK, /* IN */
+ CORINFO_CONTEXT_HANDLE context, /* IN */
+ CORINFO_SIG_INFO* sig /* OUT */
+ )
{
jitInstance->mc->cr->AddCall("findCallSiteSig");
jitInstance->mc->repFindCallSiteSig(module, methTOK, context, sig);
}
-CORINFO_CLASS_HANDLE MyICJI::getTokenTypeAsHandle (
- CORINFO_RESOLVED_TOKEN * pResolvedToken /* IN */)
+CORINFO_CLASS_HANDLE MyICJI::getTokenTypeAsHandle(CORINFO_RESOLVED_TOKEN* pResolvedToken /* IN */)
{
jitInstance->mc->cr->AddCall("getTokenTypeAsHandle");
return jitInstance->mc->repGetTokenTypeAsHandle(pResolvedToken);
@@ -404,9 +363,8 @@ CORINFO_CLASS_HANDLE MyICJI::getTokenTypeAsHandle (
// Returns enum whether the module does not require verification
// Also see ICorMethodInfo::canSkipMethodVerification();
-CorInfoCanSkipVerificationResult MyICJI::canSkipVerification (
- CORINFO_MODULE_HANDLE module /* IN */
- )
+CorInfoCanSkipVerificationResult MyICJI::canSkipVerification(CORINFO_MODULE_HANDLE module /* IN */
+ )
{
jitInstance->mc->cr->AddCall("canSkipVerification");
LogError("Hit unimplemented canSkipVerification");
@@ -415,28 +373,24 @@ CorInfoCanSkipVerificationResult MyICJI::canSkipVerification (
}
// Checks if the given metadata token is valid
-BOOL MyICJI::isValidToken (
- CORINFO_MODULE_HANDLE module, /* IN */
- unsigned metaTOK /* IN */
- )
+BOOL MyICJI::isValidToken(CORINFO_MODULE_HANDLE module, /* IN */
+ unsigned metaTOK /* IN */
+ )
{
jitInstance->mc->cr->AddCall("isValidToken");
return jitInstance->mc->repIsValidToken(module, metaTOK);
}
// Checks if the given metadata token is valid StringRef
-BOOL MyICJI::isValidStringRef (
- CORINFO_MODULE_HANDLE module, /* IN */
- unsigned metaTOK /* IN */
- )
+BOOL MyICJI::isValidStringRef(CORINFO_MODULE_HANDLE module, /* IN */
+ unsigned metaTOK /* IN */
+ )
{
jitInstance->mc->cr->AddCall("isValidStringRef");
return jitInstance->mc->repIsValidStringRef(module, metaTOK);
}
-BOOL MyICJI::shouldEnforceCallvirtRestriction(
- CORINFO_MODULE_HANDLE scope
- )
+BOOL MyICJI::shouldEnforceCallvirtRestriction(CORINFO_MODULE_HANDLE scope)
{
jitInstance->mc->cr->AddCall("shouldEnforceCallvirtRestriction");
return jitInstance->mc->repShouldEnforceCallvirtRestriction(scope);
@@ -450,48 +404,41 @@ BOOL MyICJI::shouldEnforceCallvirtRestriction(
// If the value class 'cls' is isomorphic to a primitive type it will
// return that type, otherwise it will return CORINFO_TYPE_VALUECLASS
-CorInfoType MyICJI::asCorInfoType (
- CORINFO_CLASS_HANDLE cls
- )
+CorInfoType MyICJI::asCorInfoType(CORINFO_CLASS_HANDLE cls)
{
jitInstance->mc->cr->AddCall("asCorInfoType");
return jitInstance->mc->repAsCorInfoType(cls);
}
// for completeness
-const char* MyICJI::getClassName (
- CORINFO_CLASS_HANDLE cls
- )
+const char* MyICJI::getClassName(CORINFO_CLASS_HANDLE cls)
{
jitInstance->mc->cr->AddCall("getClassName");
const char* result = jitInstance->mc->repGetClassName(cls);
return result;
}
-
// 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 MyICJI::appendClassName(
- __deref_inout_ecount(*pnBufLen) WCHAR** ppBuf,
- int* pnBufLen,
- CORINFO_CLASS_HANDLE cls,
- BOOL fNamespace,
- BOOL fFullInst,
- BOOL fAssembly
- )
+int MyICJI::appendClassName(__deref_inout_ecount(*pnBufLen) WCHAR** ppBuf,
+ int* pnBufLen,
+ CORINFO_CLASS_HANDLE cls,
+ BOOL fNamespace,
+ BOOL fFullInst,
+ BOOL fAssembly)
{
jitInstance->mc->cr->AddCall("appendClassName");
const WCHAR* result = jitInstance->mc->repAppendClassName(cls, fNamespace, fFullInst, fAssembly);
- int nLen = 0;
+ int nLen = 0;
if (ppBuf != nullptr && result != nullptr)
{
nLen = (int)wcslen(result);
if (*pnBufLen > nLen)
{
- wcscpy_s(*ppBuf, *pnBufLen, result );
+ wcscpy_s(*ppBuf, *pnBufLen, result);
(*ppBuf) += nLen;
(*pnBufLen) -= nLen;
}
@@ -499,7 +446,8 @@ int MyICJI::appendClassName(
return nLen;
}
-// Quick check whether the type is a value class. Returns the same value as getClassAttribs(cls) & CORINFO_FLG_VALUECLASS, except faster.
+// Quick check whether the type is a value class. Returns the same value as getClassAttribs(cls) &
+// CORINFO_FLG_VALUECLASS, except faster.
BOOL MyICJI::isValueClass(CORINFO_CLASS_HANDLE cls)
{
jitInstance->mc->cr->AddCall("isValueClass");
@@ -515,9 +463,7 @@ BOOL MyICJI::canInlineTypeCheckWithObjectVTable(CORINFO_CLASS_HANDLE cls)
}
// return flags (defined above, CORINFO_FLG_PUBLIC ...)
-DWORD MyICJI::getClassAttribs (
- CORINFO_CLASS_HANDLE cls
- )
+DWORD MyICJI::getClassAttribs(CORINFO_CLASS_HANDLE cls)
{
jitInstance->mc->cr->AddCall("getClassAttribs");
return jitInstance->mc->repGetClassAttribs(cls);
@@ -535,40 +481,34 @@ BOOL MyICJI::isStructRequiringStackAllocRetBuf(CORINFO_CLASS_HANDLE cls)
return jitInstance->mc->repIsStructRequiringStackAllocRetBuf(cls);
}
-CORINFO_MODULE_HANDLE MyICJI::getClassModule (
- CORINFO_CLASS_HANDLE cls
- )
+CORINFO_MODULE_HANDLE MyICJI::getClassModule(CORINFO_CLASS_HANDLE cls)
{
jitInstance->mc->cr->AddCall("getClassModule");
LogError("Hit unimplemented getClassModule");
DebugBreakorAV(28);
return (CORINFO_MODULE_HANDLE)0;
- //jitInstance->mc->getClassModule(cls);
+ // jitInstance->mc->getClassModule(cls);
}
// Returns the assembly that contains the module "mod".
-CORINFO_ASSEMBLY_HANDLE MyICJI::getModuleAssembly (
- CORINFO_MODULE_HANDLE mod
- )
+CORINFO_ASSEMBLY_HANDLE MyICJI::getModuleAssembly(CORINFO_MODULE_HANDLE mod)
{
jitInstance->mc->cr->AddCall("getModuleAssembly");
LogError("Hit unimplemented getModuleAssembly");
DebugBreakorAV(28);
return (CORINFO_ASSEMBLY_HANDLE)0;
-// return jitInstance->mc->getModuleAssembly(mod);
+ // return jitInstance->mc->getModuleAssembly(mod);
}
// Returns the name of the assembly "assem".
-const char* MyICJI::getAssemblyName (
- CORINFO_ASSEMBLY_HANDLE assem
- )
+const char* MyICJI::getAssemblyName(CORINFO_ASSEMBLY_HANDLE assem)
{
jitInstance->mc->cr->AddCall("getAssemblyName");
LogError("Hit unimplemented getAssemblyName");
DebugBreakorAV(28);
return nullptr;
-// return jitInstance->mc->getAssemblyName(assem);
+ // return jitInstance->mc->getAssemblyName(assem);
}
// Allocate and delete process-lifetime objects. Should only be
@@ -590,29 +530,22 @@ void MyICJI::LongLifetimeFree(void* obj)
DebugBreakorAV(33);
}
-size_t MyICJI::getClassModuleIdForStatics (
- CORINFO_CLASS_HANDLE cls,
- CORINFO_MODULE_HANDLE *pModule,
- void **ppIndirection
- )
+size_t MyICJI::getClassModuleIdForStatics(CORINFO_CLASS_HANDLE cls,
+ CORINFO_MODULE_HANDLE* pModule,
+ void** ppIndirection)
{
jitInstance->mc->cr->AddCall("getClassModuleIdForStatics");
return jitInstance->mc->repGetClassModuleIdForStatics(cls, pModule, ppIndirection);
}
// return the number of bytes needed by an instance of the class
-unsigned MyICJI::getClassSize (
- CORINFO_CLASS_HANDLE cls
- )
+unsigned MyICJI::getClassSize(CORINFO_CLASS_HANDLE cls)
{
jitInstance->mc->cr->AddCall("getClassSize");
return jitInstance->mc->repGetClassSize(cls);
}
-unsigned MyICJI::getClassAlignmentRequirement (
- CORINFO_CLASS_HANDLE cls,
- BOOL fDoubleAlignHint
- )
+unsigned MyICJI::getClassAlignmentRequirement(CORINFO_CLASS_HANDLE cls, BOOL fDoubleAlignHint)
{
jitInstance->mc->cr->AddCall("getClassAlignmentRequirement");
return jitInstance->mc->repGetClassAlignmentRequirement(cls, fDoubleAlignHint);
@@ -627,38 +560,29 @@ unsigned MyICJI::getClassAlignmentRequirement (
// 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 MyICJI::getClassGClayout (
- CORINFO_CLASS_HANDLE cls, /* IN */
- BYTE *gcPtrs /* OUT */
- )
+unsigned MyICJI::getClassGClayout(CORINFO_CLASS_HANDLE cls, /* IN */
+ BYTE* gcPtrs /* OUT */
+ )
{
jitInstance->mc->cr->AddCall("getClassGClayout");
return jitInstance->mc->repGetClassGClayout(cls, gcPtrs);
}
// returns the number of instance fields in a class
-unsigned MyICJI::getClassNumInstanceFields (
- CORINFO_CLASS_HANDLE cls /* IN */
- )
+unsigned MyICJI::getClassNumInstanceFields(CORINFO_CLASS_HANDLE cls /* IN */
+ )
{
jitInstance->mc->cr->AddCall("getClassNumInstanceFields");
return jitInstance->mc->repGetClassNumInstanceFields(cls);
}
-CORINFO_FIELD_HANDLE MyICJI::getFieldInClass(
- CORINFO_CLASS_HANDLE clsHnd,
- INT num
- )
+CORINFO_FIELD_HANDLE MyICJI::getFieldInClass(CORINFO_CLASS_HANDLE clsHnd, INT num)
{
jitInstance->mc->cr->AddCall("getFieldInClass");
return jitInstance->mc->repGetFieldInClass(clsHnd, num);
}
-BOOL MyICJI::checkMethodModifier(
- CORINFO_METHOD_HANDLE hMethod,
- LPCSTR modifier,
- BOOL fOptional
- )
+BOOL MyICJI::checkMethodModifier(CORINFO_METHOD_HANDLE hMethod, LPCSTR modifier, BOOL fOptional)
{
jitInstance->mc->cr->AddCall("checkMethodModifier");
BOOL result = jitInstance->mc->repCheckMethodModifier(hMethod, modifier, fOptional);
@@ -666,46 +590,34 @@ BOOL MyICJI::checkMethodModifier(
}
// returns the "NEW" helper optimized for "newCls."
-CorInfoHelpFunc MyICJI::getNewHelper(
- CORINFO_RESOLVED_TOKEN * pResolvedToken,
- CORINFO_METHOD_HANDLE callerHandle
- )
+CorInfoHelpFunc MyICJI::getNewHelper(CORINFO_RESOLVED_TOKEN* pResolvedToken, CORINFO_METHOD_HANDLE callerHandle)
{
jitInstance->mc->cr->AddCall("getNewHelper");
return jitInstance->mc->repGetNewHelper(pResolvedToken, callerHandle);
}
// returns the newArr (1-Dim array) helper optimized for "arrayCls."
-CorInfoHelpFunc MyICJI::getNewArrHelper(
- CORINFO_CLASS_HANDLE arrayCls
- )
+CorInfoHelpFunc MyICJI::getNewArrHelper(CORINFO_CLASS_HANDLE arrayCls)
{
jitInstance->mc->cr->AddCall("getNewArrHelper");
return jitInstance->mc->repGetNewArrHelper(arrayCls);
}
// returns the optimized "IsInstanceOf" or "ChkCast" helper
-CorInfoHelpFunc MyICJI::getCastingHelper(
- CORINFO_RESOLVED_TOKEN * pResolvedToken,
- bool fThrowing
- )
+CorInfoHelpFunc MyICJI::getCastingHelper(CORINFO_RESOLVED_TOKEN* pResolvedToken, bool fThrowing)
{
jitInstance->mc->cr->AddCall("getCastingHelper");
return jitInstance->mc->repGetCastingHelper(pResolvedToken, fThrowing);
}
// returns helper to trigger static constructor
-CorInfoHelpFunc MyICJI::getSharedCCtorHelper(
- CORINFO_CLASS_HANDLE clsHnd
- )
+CorInfoHelpFunc MyICJI::getSharedCCtorHelper(CORINFO_CLASS_HANDLE clsHnd)
{
jitInstance->mc->cr->AddCall("getSharedCCtorHelper");
return jitInstance->mc->repGetSharedCCtorHelper(clsHnd);
}
-CorInfoHelpFunc MyICJI::getSecurityPrologHelper(
- CORINFO_METHOD_HANDLE ftn
- )
+CorInfoHelpFunc MyICJI::getSecurityPrologHelper(CORINFO_METHOD_HANDLE ftn)
{
jitInstance->mc->cr->AddCall("getSecurityPrologHelper");
return jitInstance->mc->repGetSecurityPrologHelper(ftn);
@@ -715,9 +627,7 @@ CorInfoHelpFunc MyICJI::getSecurityPrologHelper(
// 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 MyICJI::getTypeForBox(
- CORINFO_CLASS_HANDLE cls
- )
+CORINFO_CLASS_HANDLE MyICJI::getTypeForBox(CORINFO_CLASS_HANDLE cls)
{
jitInstance->mc->cr->AddCall("getTypeForBox");
return jitInstance->mc->repGetTypeForBox(cls);
@@ -726,9 +636,7 @@ CORINFO_CLASS_HANDLE MyICJI::getTypeForBox(
// 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 MyICJI::getBoxHelper(
- CORINFO_CLASS_HANDLE cls
- )
+CorInfoHelpFunc MyICJI::getBoxHelper(CORINFO_CLASS_HANDLE cls)
{
jitInstance->mc->cr->AddCall("getBoxHelper");
return jitInstance->mc->repGetBoxHelper(cls);
@@ -746,39 +654,31 @@ CorInfoHelpFunc MyICJI::getBoxHelper(
// The EE set 'helperCopies' on return to indicate what kind of
// helper has been created.
-CorInfoHelpFunc MyICJI::getUnBoxHelper(
- CORINFO_CLASS_HANDLE cls
- )
+CorInfoHelpFunc MyICJI::getUnBoxHelper(CORINFO_CLASS_HANDLE cls)
{
jitInstance->mc->cr->AddCall("getUnBoxHelper");
CorInfoHelpFunc result = jitInstance->mc->repGetUnBoxHelper(cls);
return result;
}
-bool MyICJI::getReadyToRunHelper(
- CORINFO_RESOLVED_TOKEN * pResolvedToken,
- CORINFO_LOOKUP_KIND * pGenericLookupKind,
- CorInfoHelpFunc id,
- CORINFO_CONST_LOOKUP * pLookup
- )
+bool MyICJI::getReadyToRunHelper(CORINFO_RESOLVED_TOKEN* pResolvedToken,
+ CORINFO_LOOKUP_KIND* pGenericLookupKind,
+ CorInfoHelpFunc id,
+ CORINFO_CONST_LOOKUP* pLookup)
{
jitInstance->mc->cr->AddCall("getReadyToRunHelper");
return jitInstance->mc->repGetReadyToRunHelper(pResolvedToken, pGenericLookupKind, id, pLookup);
}
-void MyICJI::getReadyToRunDelegateCtorHelper(
- CORINFO_RESOLVED_TOKEN * pTargetMethod,
- CORINFO_CLASS_HANDLE delegateType,
- CORINFO_LOOKUP * pLookup
- )
+void MyICJI::getReadyToRunDelegateCtorHelper(CORINFO_RESOLVED_TOKEN* pTargetMethod,
+ CORINFO_CLASS_HANDLE delegateType,
+ CORINFO_LOOKUP* pLookup)
{
jitInstance->mc->cr->AddCall("getReadyToRunDelegateCtorHelper");
jitInstance->mc->repGetReadyToRunDelegateCtorHelper(pTargetMethod, delegateType, pLookup);
}
-const char* MyICJI::getHelperName(
- CorInfoHelpFunc funcNum
- )
+const char* MyICJI::getHelperName(CorInfoHelpFunc funcNum)
{
jitInstance->mc->cr->AddCall("getHelperName");
return jitInstance->mc->repGetHelperName(funcNum);
@@ -789,13 +689,13 @@ const char* MyICJI::getHelperName(
// accessing static field or method.
//
// See code:ICorClassInfo#ClassConstruction.
-CorInfoInitClassResult MyICJI::initClass(
- CORINFO_FIELD_HANDLE field, // Non-nullptr - inquire about cctor trigger before static field access
- // nullptr - 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 // TRUE means don't actually run it
- )
+CorInfoInitClassResult MyICJI::initClass(CORINFO_FIELD_HANDLE field, // Non-nullptr - inquire about cctor trigger before
+ // static field access nullptr - 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 // TRUE means don't actually run it
+ )
{
jitInstance->mc->cr->AddCall("initClass");
return jitInstance->mc->repInitClass(field, method, context, speculative);
@@ -811,27 +711,21 @@ CorInfoInitClassResult MyICJI::initClass(
// 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 MyICJI::classMustBeLoadedBeforeCodeIsRun(
- CORINFO_CLASS_HANDLE cls
- )
+void MyICJI::classMustBeLoadedBeforeCodeIsRun(CORINFO_CLASS_HANDLE cls)
{
jitInstance->mc->cr->AddCall("classMustBeLoadedBeforeCodeIsRun");
jitInstance->mc->cr->recClassMustBeLoadedBeforeCodeIsRun(cls);
}
// returns the class handle for the special builtin classes
-CORINFO_CLASS_HANDLE MyICJI::getBuiltinClass (
- CorInfoClassId classId
- )
+CORINFO_CLASS_HANDLE MyICJI::getBuiltinClass(CorInfoClassId classId)
{
jitInstance->mc->cr->AddCall("getBuiltinClass");
return jitInstance->mc->repGetBuiltinClass(classId);
}
// "System.Int32" ==> CORINFO_TYPE_INT..
-CorInfoType MyICJI::getTypeForPrimitiveValueClass(
- CORINFO_CLASS_HANDLE cls
- )
+CorInfoType MyICJI::getTypeForPrimitiveValueClass(CORINFO_CLASS_HANDLE cls)
{
jitInstance->mc->cr->AddCall("getTypeForPrimitiveValueClass");
return jitInstance->mc->repGetTypeForPrimitiveValueClass(cls);
@@ -839,30 +733,23 @@ CorInfoType MyICJI::getTypeForPrimitiveValueClass(
// TRUE if child is a subtype of parent
// if parent is an interface, then does child implement / extend parent
-BOOL MyICJI::canCast(
- CORINFO_CLASS_HANDLE child, // subtype (extends parent)
- CORINFO_CLASS_HANDLE parent // base type
- )
+BOOL MyICJI::canCast(CORINFO_CLASS_HANDLE child, // subtype (extends parent)
+ CORINFO_CLASS_HANDLE parent // base type
+ )
{
jitInstance->mc->cr->AddCall("canCast");
return jitInstance->mc->repCanCast(child, parent);
}
// TRUE if cls1 and cls2 are considered equivalent types.
-BOOL MyICJI::areTypesEquivalent(
- CORINFO_CLASS_HANDLE cls1,
- CORINFO_CLASS_HANDLE cls2
- )
+BOOL MyICJI::areTypesEquivalent(CORINFO_CLASS_HANDLE cls1, CORINFO_CLASS_HANDLE cls2)
{
jitInstance->mc->cr->AddCall("areTypesEquivalent");
return jitInstance->mc->repAreTypesEquivalent(cls1, cls2);
}
// returns is the intersection of cls1 and cls2.
-CORINFO_CLASS_HANDLE MyICJI::mergeClasses(
- CORINFO_CLASS_HANDLE cls1,
- CORINFO_CLASS_HANDLE cls2
- )
+CORINFO_CLASS_HANDLE MyICJI::mergeClasses(CORINFO_CLASS_HANDLE cls1, CORINFO_CLASS_HANDLE cls2)
{
jitInstance->mc->cr->AddCall("mergeClasses");
return jitInstance->mc->repMergeClasses(cls1, cls2);
@@ -871,9 +758,7 @@ CORINFO_CLASS_HANDLE MyICJI::mergeClasses(
// 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 MyICJI::getParentType (
- CORINFO_CLASS_HANDLE cls
- )
+CORINFO_CLASS_HANDLE MyICJI::getParentType(CORINFO_CLASS_HANDLE cls)
{
jitInstance->mc->cr->AddCall("getParentType");
return jitInstance->mc->repGetParentType(cls);
@@ -883,59 +768,47 @@ CORINFO_CLASS_HANDLE MyICJI::getParentType (
// not a primitive type, *clsRet will be set.
// Given an Array of Type Foo, returns Foo.
// Given BYREF Foo, returns Foo
-CorInfoType MyICJI::getChildType (
- CORINFO_CLASS_HANDLE clsHnd,
- CORINFO_CLASS_HANDLE *clsRet
- )
+CorInfoType MyICJI::getChildType(CORINFO_CLASS_HANDLE clsHnd, CORINFO_CLASS_HANDLE* clsRet)
{
jitInstance->mc->cr->AddCall("getChildType");
return jitInstance->mc->repGetChildType(clsHnd, clsRet);
}
// Check constraints on type arguments of this class and parent classes
-BOOL MyICJI::satisfiesClassConstraints(
- CORINFO_CLASS_HANDLE cls
- )
+BOOL MyICJI::satisfiesClassConstraints(CORINFO_CLASS_HANDLE cls)
{
jitInstance->mc->cr->AddCall("satisfiesClassConstraints");
return jitInstance->mc->repSatisfiesClassConstraints(cls);
}
// Check if this is a single dimensional array type
-BOOL MyICJI::isSDArray(
- CORINFO_CLASS_HANDLE cls
- )
+BOOL MyICJI::isSDArray(CORINFO_CLASS_HANDLE cls)
{
jitInstance->mc->cr->AddCall("isSDArray");
return jitInstance->mc->repIsSDArray(cls);
}
// Get the numbmer of dimensions in an array
-unsigned MyICJI::getArrayRank(
- CORINFO_CLASS_HANDLE cls
- )
+unsigned MyICJI::getArrayRank(CORINFO_CLASS_HANDLE cls)
{
jitInstance->mc->cr->AddCall("getArrayRank");
return jitInstance->mc->repGetArrayRank(cls);
}
// Get static field data for an array
-void * MyICJI::getArrayInitializationData(
- CORINFO_FIELD_HANDLE field,
- DWORD size
- )
+void* MyICJI::getArrayInitializationData(CORINFO_FIELD_HANDLE field, DWORD size)
{
jitInstance->mc->cr->AddCall("getArrayInitializationData");
return jitInstance->mc->repGetArrayInitializationData(field, size);
}
// Check Visibility rules.
-CorInfoIsAccessAllowedResult MyICJI::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. */
- )
+CorInfoIsAccessAllowedResult MyICJI::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. */
+ )
{
jitInstance->mc->cr->AddCall("canAccessClass");
return jitInstance->mc->repCanAccessClass(pResolvedToken, callerHandle, pAccessHelper);
@@ -950,19 +823,16 @@ CorInfoIsAccessAllowedResult MyICJI::canAccessClass(
// 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* MyICJI::getFieldName (
- CORINFO_FIELD_HANDLE ftn, /* IN */
- const char **moduleName /* OUT */
- )
+const char* MyICJI::getFieldName(CORINFO_FIELD_HANDLE ftn, /* IN */
+ const char** moduleName /* OUT */
+ )
{
jitInstance->mc->cr->AddCall("getFieldName");
return jitInstance->mc->repGetFieldName(ftn, moduleName);
}
// return class it belongs to
-CORINFO_CLASS_HANDLE MyICJI::getFieldClass (
- CORINFO_FIELD_HANDLE field
- )
+CORINFO_CLASS_HANDLE MyICJI::getFieldClass(CORINFO_FIELD_HANDLE field)
{
jitInstance->mc->cr->AddCall("getFieldClass");
return jitInstance->mc->repGetFieldClass(field);
@@ -974,20 +844,17 @@ CORINFO_CLASS_HANDLE MyICJI::getFieldClass (
//
// 'memberParent' is typically only set when verifying. It should be the
// result of calling getMemberParent.
-CorInfoType MyICJI::getFieldType(
- CORINFO_FIELD_HANDLE field,
- CORINFO_CLASS_HANDLE *structType,
- CORINFO_CLASS_HANDLE memberParent/* IN */
- )
+CorInfoType MyICJI::getFieldType(CORINFO_FIELD_HANDLE field,
+ CORINFO_CLASS_HANDLE* structType,
+ CORINFO_CLASS_HANDLE memberParent /* IN */
+ )
{
jitInstance->mc->cr->AddCall("getFieldType");
- return jitInstance->mc->repGetFieldType(field, structType, memberParent);
+ return jitInstance->mc->repGetFieldType(field, structType, memberParent);
}
// return the data member's instance offset
-unsigned MyICJI::getFieldOffset(
- CORINFO_FIELD_HANDLE field
- )
+unsigned MyICJI::getFieldOffset(CORINFO_FIELD_HANDLE field)
{
jitInstance->mc->cr->AddCall("getFieldOffset");
return jitInstance->mc->repGetFieldOffset(field);
@@ -996,19 +863,17 @@ unsigned MyICJI::getFieldOffset(
// 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 MyICJI::isWriteBarrierHelperRequired(
- CORINFO_FIELD_HANDLE field)
+bool MyICJI::isWriteBarrierHelperRequired(CORINFO_FIELD_HANDLE field)
{
jitInstance->mc->cr->AddCall("isWriteBarrierHelperRequired");
bool result = jitInstance->mc->repIsWriteBarrierHelperRequired(field);
return result;
}
-void MyICJI::getFieldInfo (CORINFO_RESOLVED_TOKEN * pResolvedToken,
- CORINFO_METHOD_HANDLE callerHandle,
- CORINFO_ACCESS_FLAGS flags,
- CORINFO_FIELD_INFO *pResult
- )
+void MyICJI::getFieldInfo(CORINFO_RESOLVED_TOKEN* pResolvedToken,
+ CORINFO_METHOD_HANDLE callerHandle,
+ CORINFO_ACCESS_FLAGS flags,
+ CORINFO_FIELD_INFO* pResult)
{
jitInstance->mc->cr->AddCall("getFieldInfo");
jitInstance->mc->repGetFieldInfo(pResolvedToken, callerHandle, flags, pResult);
@@ -1034,22 +899,22 @@ bool MyICJI::isFieldStatic(CORINFO_FIELD_HANDLE fldHnd)
// 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 MyICJI::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
- )
+void MyICJI::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
+ )
{
jitInstance->mc->cr->AddCall("getBoundaries");
jitInstance->mc->repGetBoundaries(ftn, cILOffsets, pILOffsets, implictBoundaries);
- //The JIT will want to call freearray on the array we pass back, so move the data into a form that complies with this
- if(*cILOffsets > 0)
+ // The JIT will want to call freearray on the array we pass back, so move the data into a form that complies with
+ // this
+ if (*cILOffsets > 0)
{
- DWORD *realOffsets = (DWORD*)allocateArray(*cILOffsets*sizeof(ICorDebugInfo::BoundaryTypes));
- memcpy(realOffsets, *pILOffsets, *cILOffsets*sizeof(ICorDebugInfo::BoundaryTypes));
+ DWORD* realOffsets = (DWORD*)allocateArray(*cILOffsets * sizeof(ICorDebugInfo::BoundaryTypes));
+ memcpy(realOffsets, *pILOffsets, *cILOffsets * sizeof(ICorDebugInfo::BoundaryTypes));
*pILOffsets = realOffsets;
}
else
@@ -1063,17 +928,16 @@ void MyICJI::getBoundaries(
// 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 MyICJI::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
- )
+void MyICJI::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
+ )
{
jitInstance->mc->cr->AddCall("setBoundaries");
jitInstance->mc->cr->recSetBoundaries(ftn, cMap, pMap);
- freeArray(pMap);//see note in recSetBoundaries... we own this array and own destroying it.
+ freeArray(pMap); // see note in recSetBoundaries... we own this array and own destroying it.
}
// Query the EE to find out the scope of local varables.
@@ -1084,23 +948,24 @@ void MyICJI::setBoundaries(
// 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 MyICJI::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
- )
+void MyICJI::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
+ )
{
jitInstance->mc->cr->AddCall("getVars");
jitInstance->mc->repGetVars(ftn, cVars, vars, extendOthers);
- //The JIT will want to call freearray on the array we pass back, so move the data into a form that complies with this
- if(*cVars > 0)
+ // The JIT will want to call freearray on the array we pass back, so move the data into a form that complies with
+ // this
+ if (*cVars > 0)
{
- ICorDebugInfo::ILVarInfo *realOffsets = (ICorDebugInfo::ILVarInfo*)allocateArray(*cVars*sizeof(ICorDebugInfo::ILVarInfo));
- memcpy(realOffsets, *vars, *cVars*sizeof(ICorDebugInfo::ILVarInfo));
+ ICorDebugInfo::ILVarInfo* realOffsets =
+ (ICorDebugInfo::ILVarInfo*)allocateArray(*cVars * sizeof(ICorDebugInfo::ILVarInfo));
+ memcpy(realOffsets, *vars, *cVars * sizeof(ICorDebugInfo::ILVarInfo));
*vars = realOffsets;
}
else
@@ -1111,16 +976,15 @@ void MyICJI::getVars(
// note that the JIT might split lifetimes into different
// locations etc.
-void MyICJI::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
+void MyICJI::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
- )
+ )
{
jitInstance->mc->cr->AddCall("setVars");
jitInstance->mc->cr->recSetVars(ftn, cVars, vars);
- freeArray(vars);//See note in recSetVars... we own destroying this array
+ freeArray(vars); // See note in recSetVars... we own destroying this array
}
/*-------------------------- Misc ---------------------------------------*/
@@ -1128,9 +992,7 @@ void MyICJI::setVars(
// 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 * MyICJI::allocateArray(
- ULONG cBytes
- )
+void* MyICJI::allocateArray(ULONG cBytes)
{
return jitInstance->allocateArray(cBytes);
}
@@ -1139,9 +1001,7 @@ void * MyICJI::allocateArray(
// For eg, The EE returns memory in getVars() and getBoundaries()
// to the JitCompiler, which the JitCompiler should release using
// freeArray()
-void MyICJI::freeArray(
- void *array
- )
+void MyICJI::freeArray(void* array)
{
jitInstance->freeArray(array);
}
@@ -1154,9 +1014,8 @@ void MyICJI::freeArray(
// advance the pointer to the argument list.
// a ptr of 0, is special and always means the first argument
-CORINFO_ARG_LIST_HANDLE MyICJI::getArgNext (
- CORINFO_ARG_LIST_HANDLE args /* IN */
- )
+CORINFO_ARG_LIST_HANDLE MyICJI::getArgNext(CORINFO_ARG_LIST_HANDLE args /* IN */
+ )
{
jitInstance->mc->cr->AddCall("getArgNext");
return jitInstance->mc->repGetArgNext(args);
@@ -1171,38 +1030,34 @@ CORINFO_ARG_LIST_HANDLE MyICJI::getArgNext (
// 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 MyICJI::getArgType (
- CORINFO_SIG_INFO* sig, /* IN */
- CORINFO_ARG_LIST_HANDLE args, /* IN */
- CORINFO_CLASS_HANDLE *vcTypeRet /* OUT */
- )
+CorInfoTypeWithMod MyICJI::getArgType(CORINFO_SIG_INFO* sig, /* IN */
+ CORINFO_ARG_LIST_HANDLE args, /* IN */
+ CORINFO_CLASS_HANDLE* vcTypeRet /* OUT */
+ )
{
DWORD exceptionCode = 0;
jitInstance->mc->cr->AddCall("getArgType");
CorInfoTypeWithMod value = jitInstance->mc->repGetArgType(sig, args, vcTypeRet, &exceptionCode);
- if(exceptionCode != 0)
+ if (exceptionCode != 0)
ThrowException(exceptionCode);
return value;
}
// If the Arg is a CORINFO_TYPE_CLASS fetch the class handle associated with it
-CORINFO_CLASS_HANDLE MyICJI::getArgClass (
- CORINFO_SIG_INFO* sig, /* IN */
- CORINFO_ARG_LIST_HANDLE args /* IN */
- )
+CORINFO_CLASS_HANDLE MyICJI::getArgClass(CORINFO_SIG_INFO* sig, /* IN */
+ CORINFO_ARG_LIST_HANDLE args /* IN */
+ )
{
DWORD exceptionCode = 0;
jitInstance->mc->cr->AddCall("getArgClass");
CORINFO_CLASS_HANDLE value = jitInstance->mc->repGetArgClass(sig, args, &exceptionCode);
- if(exceptionCode != 0)
+ if (exceptionCode != 0)
ThrowException(exceptionCode);
return value;
}
// Returns type of HFA for valuetype
-CorInfoType MyICJI::getHFAType (
- CORINFO_CLASS_HANDLE hClass
- )
+CorInfoType MyICJI::getHFAType(CORINFO_CLASS_HANDLE hClass)
{
jitInstance->mc->cr->AddCall("getHFAType");
CorInfoType value = jitInstance->mc->repGetHFAType(hClass);
@@ -1216,9 +1071,7 @@ CorInfoType MyICJI::getHFAType (
*****************************************************************************/
// Returns the HRESULT of the current exception
-HRESULT MyICJI::GetErrorHRESULT(
- struct _EXCEPTION_POINTERS *pExceptionPointers
- )
+HRESULT MyICJI::GetErrorHRESULT(struct _EXCEPTION_POINTERS* pExceptionPointers)
{
jitInstance->mc->cr->AddCall("GetErrorHRESULT");
LogError("Hit unimplemented GetErrorHRESULT");
@@ -1229,10 +1082,7 @@ HRESULT MyICJI::GetErrorHRESULT(
// 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 MyICJI::GetErrorMessage(
- __inout_ecount(bufferLength) LPWSTR buffer,
- ULONG bufferLength
- )
+ULONG MyICJI::GetErrorMessage(__inout_ecount(bufferLength) LPWSTR buffer, ULONG bufferLength)
{
jitInstance->mc->cr->AddCall("GetErrorMessage");
LogError("Hit unimplemented GetErrorMessage");
@@ -1246,9 +1096,7 @@ ULONG MyICJI::GetErrorMessage(
// things like ThreadStoppedException ...
// returns EXCEPTION_CONTINUE_EXECUTION if exception is fixed up by the EE
-int MyICJI::FilterException(
- struct _EXCEPTION_POINTERS *pExceptionPointers
- )
+int MyICJI::FilterException(struct _EXCEPTION_POINTERS* pExceptionPointers)
{
jitInstance->mc->cr->AddCall("FilterException");
int result = jitInstance->mc->repFilterException(pExceptionPointers);
@@ -1256,24 +1104,20 @@ int MyICJI::FilterException(
}
// Cleans up internal EE tracking when an exception is caught.
-void MyICJI::HandleException(
- struct _EXCEPTION_POINTERS *pExceptionPointers
- )
+void MyICJI::HandleException(struct _EXCEPTION_POINTERS* pExceptionPointers)
{
jitInstance->mc->cr->AddCall("HandleException");
}
-void MyICJI::ThrowExceptionForJitResult(
- HRESULT result)
+void MyICJI::ThrowExceptionForJitResult(HRESULT result)
{
jitInstance->mc->cr->AddCall("ThrowExceptionForJitResult");
LogError("Hit unimplemented ThrowExceptionForJitResult");
DebugBreakorAV(80);
}
-//Throws an exception defined by the given throw helper.
-void MyICJI::ThrowExceptionForHelper(
- const CORINFO_HELPER_DESC * throwHelper)
+// Throws an exception defined by the given throw helper.
+void MyICJI::ThrowExceptionForHelper(const CORINFO_HELPER_DESC* throwHelper)
{
jitInstance->mc->cr->AddCall("ThrowExceptionForHelper");
LogError("Hit unimplemented ThrowExceptionForHelper");
@@ -1288,9 +1132,7 @@ void MyICJI::ThrowExceptionForHelper(
*****************************************************************************/
// Return details about EE internal data structures
-void MyICJI::getEEInfo(
- CORINFO_EE_INFO *pEEInfoOut
- )
+void MyICJI::getEEInfo(CORINFO_EE_INFO* pEEInfoOut)
{
jitInstance->mc->cr->AddCall("getEEInfo");
jitInstance->mc->repGetEEInfo(pEEInfoOut);
@@ -1300,8 +1142,8 @@ void MyICJI::getEEInfo(
LPCWSTR MyICJI::getJitTimeLogFilename()
{
jitInstance->mc->cr->AddCall("getJitTimeLogFilename");
- //we have the ability to replay this, but we treat it in this case as EE context
-// return jitInstance->eec->jitTimeLogFilename;
+ // we have the ability to replay this, but we treat it in this case as EE context
+ // return jitInstance->eec->jitTimeLogFilename;
// We want to be able to set COMPLUS_JitTimeLogFile when replaying, to collect JIT
// statistics. So, just do a getenv() call. This isn't quite as thorough as
@@ -1312,17 +1154,15 @@ LPCWSTR MyICJI::getJitTimeLogFilename()
return GetEnvironmentVariableWithDefaultW(W("COMPlus_JitTimeLogFile"));
}
- /*********************************************************************************/
- //
- // Diagnostic methods
- //
- /*********************************************************************************/
+/*********************************************************************************/
+//
+// Diagnostic methods
+//
+/*********************************************************************************/
// this function is for debugging only. Returns method token.
// Returns mdMethodDefNil for dynamic methods.
-mdMethodDef MyICJI::getMethodDefFromMethod(
- CORINFO_METHOD_HANDLE hMethod
- )
+mdMethodDef MyICJI::getMethodDefFromMethod(CORINFO_METHOD_HANDLE hMethod)
{
jitInstance->mc->cr->AddCall("getMethodDefFromMethod");
mdMethodDef result = jitInstance->mc->repGetMethodDefFromMethod(hMethod);
@@ -1332,10 +1172,9 @@ mdMethodDef MyICJI::getMethodDefFromMethod(
// 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* MyICJI::getMethodName (
- CORINFO_METHOD_HANDLE ftn, /* IN */
- const char **moduleName /* OUT */
- )
+const char* MyICJI::getMethodName(CORINFO_METHOD_HANDLE ftn, /* IN */
+ const char** moduleName /* OUT */
+ )
{
jitInstance->mc->cr->AddCall("getMethodName");
return jitInstance->mc->repGetMethodName(ftn, moduleName);
@@ -1344,61 +1183,52 @@ const char* MyICJI::getMethodName (
// 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 MyICJI::getMethodHash (
- CORINFO_METHOD_HANDLE ftn /* IN */
- )
+unsigned MyICJI::getMethodHash(CORINFO_METHOD_HANDLE ftn /* IN */
+ )
{
jitInstance->mc->cr->AddCall("getMethodHash");
return jitInstance->mc->repGetMethodHash(ftn);
}
// this function is for debugging only.
-size_t MyICJI::findNameOfToken (
- CORINFO_MODULE_HANDLE module, /* IN */
- mdToken metaTOK, /* IN */
- __out_ecount (FQNameCapacity) char * szFQName, /* OUT */
- size_t FQNameCapacity /* IN */
- )
+size_t MyICJI::findNameOfToken(CORINFO_MODULE_HANDLE module, /* IN */
+ mdToken metaTOK, /* IN */
+ __out_ecount(FQNameCapacity) char* szFQName, /* OUT */
+ size_t FQNameCapacity /* IN */
+ )
{
jitInstance->mc->cr->AddCall("findNameOfToken");
return jitInstance->mc->repFindNameOfToken(module, metaTOK, szFQName, FQNameCapacity);
}
bool MyICJI::getSystemVAmd64PassStructInRegisterDescriptor(
- /* IN */ CORINFO_CLASS_HANDLE structHnd,
- /* OUT */ SYSTEMV_AMD64_CORINFO_STRUCT_REG_PASSING_DESCRIPTOR* structPassInRegDescPtr
- )
+ /* IN */ CORINFO_CLASS_HANDLE structHnd,
+ /* OUT */ SYSTEMV_AMD64_CORINFO_STRUCT_REG_PASSING_DESCRIPTOR* structPassInRegDescPtr)
{
jitInstance->mc->cr->AddCall("getSystemVAmd64PassStructInRegisterDescriptor");
return jitInstance->mc->repGetSystemVAmd64PassStructInRegisterDescriptor(structHnd, structPassInRegDescPtr);
}
-//Stuff on ICorDynamicInfo
-DWORD MyICJI::getThreadTLSIndex(
- void **ppIndirection
- )
+// Stuff on ICorDynamicInfo
+DWORD MyICJI::getThreadTLSIndex(void** ppIndirection)
{
jitInstance->mc->cr->AddCall("getThreadTLSIndex");
- return jitInstance->mc->repGetThreadTLSIndex(ppIndirection);
+ return jitInstance->mc->repGetThreadTLSIndex(ppIndirection);
}
-const void * MyICJI::getInlinedCallFrameVptr(
- void **ppIndirection
- )
+const void* MyICJI::getInlinedCallFrameVptr(void** ppIndirection)
{
jitInstance->mc->cr->AddCall("getInlinedCallFrameVptr");
return jitInstance->mc->repGetInlinedCallFrameVptr(ppIndirection);
}
-LONG * MyICJI::getAddrOfCaptureThreadGlobal(
- void **ppIndirection
- )
+LONG* MyICJI::getAddrOfCaptureThreadGlobal(void** ppIndirection)
{
jitInstance->mc->cr->AddCall("getAddrOfCaptureThreadGlobal");
return jitInstance->mc->repGetAddrOfCaptureThreadGlobal(ppIndirection);
}
-SIZE_T* MyICJI::getAddrModuleDomainID(CORINFO_MODULE_HANDLE module)
+SIZE_T* MyICJI::getAddrModuleDomainID(CORINFO_MODULE_HANDLE module)
{
jitInstance->mc->cr->AddCall("getAddrModuleDomainID");
LogError("Hit unimplemented getAddrModuleDomainID");
@@ -1407,10 +1237,7 @@ SIZE_T* MyICJI::getAddrModuleDomainID(CORINFO_MODULE_HANDLE module)
}
// return the native entry point to an EE helper (see CorInfoHelpFunc)
-void* MyICJI::getHelperFtn (
- CorInfoHelpFunc ftnNum,
- void **ppIndirection
- )
+void* MyICJI::getHelperFtn(CorInfoHelpFunc ftnNum, void** ppIndirection)
{
jitInstance->mc->cr->AddCall("getHelperFtn");
return jitInstance->mc->repGetHelperFtn(ftnNum, ppIndirection);
@@ -1419,10 +1246,9 @@ void* MyICJI::getHelperFtn (
// 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 MyICJI::getFunctionEntryPoint(
- CORINFO_METHOD_HANDLE ftn, /* IN */
- CORINFO_CONST_LOOKUP * pResult, /* OUT */
- CORINFO_ACCESS_FLAGS accessFlags)
+void MyICJI::getFunctionEntryPoint(CORINFO_METHOD_HANDLE ftn, /* IN */
+ CORINFO_CONST_LOOKUP* pResult, /* OUT */
+ CORINFO_ACCESS_FLAGS accessFlags)
{
jitInstance->mc->cr->AddCall("getFunctionEntryPoint");
jitInstance->mc->repGetFunctionEntryPoint(ftn, pResult, accessFlags);
@@ -1431,19 +1257,14 @@ void MyICJI::getFunctionEntryPoint(
// 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 MyICJI::getFunctionFixedEntryPoint(
- CORINFO_METHOD_HANDLE ftn,
- CORINFO_CONST_LOOKUP * pResult)
+void MyICJI::getFunctionFixedEntryPoint(CORINFO_METHOD_HANDLE ftn, CORINFO_CONST_LOOKUP* pResult)
{
jitInstance->mc->cr->AddCall("getFunctionFixedEntryPoint");
jitInstance->mc->repGetFunctionFixedEntryPoint(ftn, pResult);
}
// get the synchronization handle that is passed to monXstatic function
-void* MyICJI::getMethodSync(
- CORINFO_METHOD_HANDLE ftn,
- void **ppIndirection
- )
+void* MyICJI::getMethodSync(CORINFO_METHOD_HANDLE ftn, void** ppIndirection)
{
jitInstance->mc->cr->AddCall("getMethodSync");
return jitInstance->mc->repGetMethodSync(ftn, ppIndirection);
@@ -1455,46 +1276,31 @@ void* MyICJI::getMethodSync(
// get slow lazy string literal helper to use (CORINFO_HELP_STRCNS*).
// Returns CORINFO_HELP_UNDEF if lazy string literal helper cannot be used.
-CorInfoHelpFunc MyICJI::getLazyStringLiteralHelper(
- CORINFO_MODULE_HANDLE handle
- )
+CorInfoHelpFunc MyICJI::getLazyStringLiteralHelper(CORINFO_MODULE_HANDLE handle)
{
jitInstance->mc->cr->AddCall("getLazyStringLiteralHelper");
return jitInstance->mc->repGetLazyStringLiteralHelper(handle);
}
-
-CORINFO_MODULE_HANDLE MyICJI::embedModuleHandle(
- CORINFO_MODULE_HANDLE handle,
- void **ppIndirection
- )
+CORINFO_MODULE_HANDLE MyICJI::embedModuleHandle(CORINFO_MODULE_HANDLE handle, void** ppIndirection)
{
jitInstance->mc->cr->AddCall("embedModuleHandle");
return jitInstance->mc->repEmbedModuleHandle(handle, ppIndirection);
}
-CORINFO_CLASS_HANDLE MyICJI::embedClassHandle(
- CORINFO_CLASS_HANDLE handle,
- void **ppIndirection
- )
+CORINFO_CLASS_HANDLE MyICJI::embedClassHandle(CORINFO_CLASS_HANDLE handle, void** ppIndirection)
{
jitInstance->mc->cr->AddCall("embedClassHandle");
return jitInstance->mc->repEmbedClassHandle(handle, ppIndirection);
}
-CORINFO_METHOD_HANDLE MyICJI::embedMethodHandle(
- CORINFO_METHOD_HANDLE handle,
- void **ppIndirection
- )
+CORINFO_METHOD_HANDLE MyICJI::embedMethodHandle(CORINFO_METHOD_HANDLE handle, void** ppIndirection)
{
jitInstance->mc->cr->AddCall("embedMethodHandle");
return jitInstance->mc->repEmbedMethodHandle(handle, ppIndirection);
}
-CORINFO_FIELD_HANDLE MyICJI::embedFieldHandle(
- CORINFO_FIELD_HANDLE handle,
- void **ppIndirection
- )
+CORINFO_FIELD_HANDLE MyICJI::embedFieldHandle(CORINFO_FIELD_HANDLE handle, void** ppIndirection)
{
jitInstance->mc->cr->AddCall("embedFieldHandle");
return jitInstance->mc->repEmbedFieldHandle(handle, ppIndirection);
@@ -1507,10 +1313,9 @@ CORINFO_FIELD_HANDLE MyICJI::embedFieldHandle(
// code is shared and the token contains generic parameters)
// then indicate how the handle should be looked up at run-time.
//
-void MyICJI::embedGenericHandle(
- CORINFO_RESOLVED_TOKEN * pResolvedToken,
- BOOL fEmbedParent, // TRUE - embeds parent type handle of the field/method handle
- CORINFO_GENERICHANDLE_RESULT * pResult)
+void MyICJI::embedGenericHandle(CORINFO_RESOLVED_TOKEN* pResolvedToken,
+ BOOL fEmbedParent, // TRUE - embeds parent type handle of the field/method handle
+ CORINFO_GENERICHANDLE_RESULT* pResult)
{
jitInstance->mc->cr->AddCall("embedGenericHandle");
jitInstance->mc->repEmbedGenericHandle(pResolvedToken, fEmbedParent, pResult);
@@ -1523,40 +1328,29 @@ void MyICJI::embedGenericHandle(
// 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 MyICJI::getLocationOfThisType(
- CORINFO_METHOD_HANDLE context
- )
+CORINFO_LOOKUP_KIND MyICJI::getLocationOfThisType(CORINFO_METHOD_HANDLE context)
{
jitInstance->mc->cr->AddCall("getLocationOfThisType");
return jitInstance->mc->repGetLocationOfThisType(context);
}
// return the unmanaged target *if method has already been prelinked.*
-void* MyICJI::getPInvokeUnmanagedTarget(
- CORINFO_METHOD_HANDLE method,
- void **ppIndirection
- )
+void* MyICJI::getPInvokeUnmanagedTarget(CORINFO_METHOD_HANDLE method, void** ppIndirection)
{
jitInstance->mc->cr->AddCall("getPInvokeUnmanagedTarget");
- void *result = jitInstance->mc->repGetPInvokeUnmanagedTarget(method, ppIndirection);
+ void* result = jitInstance->mc->repGetPInvokeUnmanagedTarget(method, ppIndirection);
return result;
}
// return address of fixup area for late-bound PInvoke calls.
-void* MyICJI::getAddressOfPInvokeFixup(
- CORINFO_METHOD_HANDLE method,
- void **ppIndirection
- )
+void* MyICJI::getAddressOfPInvokeFixup(CORINFO_METHOD_HANDLE method, void** ppIndirection)
{
jitInstance->mc->cr->AddCall("getAddressOfPInvokeFixup");
return jitInstance->mc->repGetAddressOfPInvokeFixup(method, ppIndirection);
}
// return address of fixup area for late-bound PInvoke calls.
-void MyICJI::getAddressOfPInvokeTarget(
- CORINFO_METHOD_HANDLE method,
- CORINFO_CONST_LOOKUP *pLookup
- )
+void MyICJI::getAddressOfPInvokeTarget(CORINFO_METHOD_HANDLE method, CORINFO_CONST_LOOKUP* pLookup)
{
jitInstance->mc->cr->AddCall("getAddressOfPInvokeTarget");
jitInstance->mc->repGetAddressOfPInvokeTarget(method, pLookup);
@@ -1564,10 +1358,7 @@ void MyICJI::getAddressOfPInvokeTarget(
// Generate a cookie based on the signature that would needs to be passed
// to CORINFO_HELP_PINVOKE_CALLI
-LPVOID MyICJI::GetCookieForPInvokeCalliSig(
- CORINFO_SIG_INFO* szMetaSig,
- void ** ppIndirection
- )
+LPVOID MyICJI::GetCookieForPInvokeCalliSig(CORINFO_SIG_INFO* szMetaSig, void** ppIndirection)
{
jitInstance->mc->cr->AddCall("GetCookieForPInvokeCalliSig");
return jitInstance->mc->repGetCookieForPInvokeCalliSig(szMetaSig, ppIndirection);
@@ -1575,9 +1366,7 @@ LPVOID MyICJI::GetCookieForPInvokeCalliSig(
// 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 MyICJI::canGetCookieForPInvokeCalliSig(
- CORINFO_SIG_INFO* szMetaSig
- )
+bool MyICJI::canGetCookieForPInvokeCalliSig(CORINFO_SIG_INFO* szMetaSig)
{
jitInstance->mc->cr->AddCall("canGetCookieForPInvokeCalliSig");
return jitInstance->mc->repCanGetCookieForPInvokeCalliSig(szMetaSig);
@@ -1585,23 +1374,17 @@ bool MyICJI::canGetCookieForPInvokeCalliSig(
// Gets a handle that is checked to see if the current method is
// included in "JustMyCode"
-CORINFO_JUST_MY_CODE_HANDLE MyICJI::getJustMyCodeHandle(
- CORINFO_METHOD_HANDLE method,
- CORINFO_JUST_MY_CODE_HANDLE**ppIndirection
- )
+CORINFO_JUST_MY_CODE_HANDLE MyICJI::getJustMyCodeHandle(CORINFO_METHOD_HANDLE method,
+ CORINFO_JUST_MY_CODE_HANDLE** ppIndirection)
{
jitInstance->mc->cr->AddCall("getJustMyCodeHandle");
- return jitInstance->mc->repGetJustMyCodeHandle(method, ppIndirection);
+ return jitInstance->mc->repGetJustMyCodeHandle(method, ppIndirection);
}
// 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 MyICJI::GetProfilingHandle(
- BOOL *pbHookFunction,
- void **pProfilerHandle,
- BOOL *pbIndirectedHandles
- )
+void MyICJI::GetProfilingHandle(BOOL* pbHookFunction, void** pProfilerHandle, BOOL* pbIndirectedHandles)
{
jitInstance->mc->cr->AddCall("GetProfilingHandle");
jitInstance->mc->repGetProfilingHandle(pbHookFunction, pProfilerHandle, pbIndirectedHandles);
@@ -1609,31 +1392,30 @@ void MyICJI::GetProfilingHandle(
// Returns instructions on how to make the call. See code:CORINFO_CALL_INFO for possible return values.
void MyICJI::getCallInfo(
- // Token info
- CORINFO_RESOLVED_TOKEN * pResolvedToken,
+ // Token info
+ CORINFO_RESOLVED_TOKEN* pResolvedToken,
- //Generics info
- CORINFO_RESOLVED_TOKEN * pConstrainedResolvedToken,
+ // Generics info
+ CORINFO_RESOLVED_TOKEN* pConstrainedResolvedToken,
- //Security info
- CORINFO_METHOD_HANDLE callerHandle,
+ // Security info
+ CORINFO_METHOD_HANDLE callerHandle,
- //Jit info
- CORINFO_CALLINFO_FLAGS flags,
+ // Jit info
+ CORINFO_CALLINFO_FLAGS flags,
- //out params
- CORINFO_CALL_INFO *pResult
- )
+ // out params
+ CORINFO_CALL_INFO* pResult)
{
jitInstance->mc->cr->AddCall("getCallInfo");
DWORD exceptionCode = 0;
- jitInstance->mc->repGetCallInfo(pResolvedToken, pConstrainedResolvedToken, callerHandle, flags, pResult, &exceptionCode);
- if(exceptionCode != 0)
+ jitInstance->mc->repGetCallInfo(pResolvedToken, pConstrainedResolvedToken, callerHandle, flags, pResult,
+ &exceptionCode);
+ if (exceptionCode != 0)
ThrowException(exceptionCode);
}
-BOOL MyICJI::canAccessFamily(CORINFO_METHOD_HANDLE hCaller,
- CORINFO_CLASS_HANDLE hInstanceType)
+BOOL MyICJI::canAccessFamily(CORINFO_METHOD_HANDLE hCaller, CORINFO_CLASS_HANDLE hInstanceType)
{
jitInstance->mc->cr->AddCall("canAccessFamily");
@@ -1650,31 +1432,21 @@ BOOL MyICJI::isRIDClassDomainID(CORINFO_CLASS_HANDLE cls)
}
// returns the class's domain ID for accessing shared statics
-unsigned MyICJI::getClassDomainID (
- CORINFO_CLASS_HANDLE cls,
- void **ppIndirection
- )
+unsigned MyICJI::getClassDomainID(CORINFO_CLASS_HANDLE cls, void** ppIndirection)
{
jitInstance->mc->cr->AddCall("getClassDomainID");
return jitInstance->mc->repGetClassDomainID(cls, ppIndirection);
}
-
// return the data's address (for static fields only)
-void* MyICJI::getFieldAddress(
- CORINFO_FIELD_HANDLE field,
- void **ppIndirection
- )
+void* MyICJI::getFieldAddress(CORINFO_FIELD_HANDLE field, void** ppIndirection)
{
jitInstance->mc->cr->AddCall("getFieldAddress");
return jitInstance->mc->repGetFieldAddress(field, ppIndirection);
}
// registers a vararg sig & returns a VM cookie for it (which can contain other stuff)
-CORINFO_VARARGS_HANDLE MyICJI::getVarArgsHandle(
- CORINFO_SIG_INFO *pSig,
- void **ppIndirection
- )
+CORINFO_VARARGS_HANDLE MyICJI::getVarArgsHandle(CORINFO_SIG_INFO* pSig, void** ppIndirection)
{
jitInstance->mc->cr->AddCall("getVarArgsHandle");
return jitInstance->mc->repGetVarArgsHandle(pSig, ppIndirection);
@@ -1682,50 +1454,36 @@ CORINFO_VARARGS_HANDLE MyICJI::getVarArgsHandle(
// 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 MyICJI::canGetVarArgsHandle(
- CORINFO_SIG_INFO *pSig
- )
+bool MyICJI::canGetVarArgsHandle(CORINFO_SIG_INFO* pSig)
{
jitInstance->mc->cr->AddCall("canGetVarArgsHandle");
return jitInstance->mc->repCanGetVarArgsHandle(pSig);
}
// Allocate a string literal on the heap and return a handle to it
-InfoAccessType MyICJI::constructStringLiteral(
- CORINFO_MODULE_HANDLE module,
- mdToken metaTok,
- void **ppValue
- )
+InfoAccessType MyICJI::constructStringLiteral(CORINFO_MODULE_HANDLE module, mdToken metaTok, void** ppValue)
{
jitInstance->mc->cr->AddCall("constructStringLiteral");
return jitInstance->mc->repConstructStringLiteral(module, metaTok, ppValue);
}
-InfoAccessType MyICJI::emptyStringLiteral(
- void **ppValue
- )
+InfoAccessType MyICJI::emptyStringLiteral(void** ppValue)
{
jitInstance->mc->cr->AddCall("emptyStringLiteral");
- return jitInstance->mc->repEmptyStringLiteral(ppValue);
+ return jitInstance->mc->repEmptyStringLiteral(ppValue);
}
// (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 MyICJI::getFieldThreadLocalStoreID (
- CORINFO_FIELD_HANDLE field,
- void **ppIndirection
- )
+DWORD MyICJI::getFieldThreadLocalStoreID(CORINFO_FIELD_HANDLE field, void** ppIndirection)
{
jitInstance->mc->cr->AddCall("getFieldThreadLocalStoreID");
return jitInstance->mc->repGetFieldThreadLocalStoreID(field, ppIndirection);
}
// Sets another object to intercept calls to "self" and current method being compiled
-void MyICJI::setOverride(
- ICorDynamicInfo *pOverride,
- CORINFO_METHOD_HANDLE currentMethod
- )
+void MyICJI::setOverride(ICorDynamicInfo* pOverride, CORINFO_METHOD_HANDLE currentMethod)
{
jitInstance->mc->cr->AddCall("setOverride");
LogError("Hit unimplemented setOverride");
@@ -1734,30 +1492,23 @@ void MyICJI::setOverride(
// 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 MyICJI::addActiveDependency(
- CORINFO_MODULE_HANDLE moduleFrom,
- CORINFO_MODULE_HANDLE moduleTo
- )
+void MyICJI::addActiveDependency(CORINFO_MODULE_HANDLE moduleFrom, CORINFO_MODULE_HANDLE moduleTo)
{
jitInstance->mc->cr->AddCall("addActiveDependency");
LogError("Hit unimplemented addActiveDependency");
DebugBreakorAV(116);
}
-CORINFO_METHOD_HANDLE MyICJI::GetDelegateCtor(
- CORINFO_METHOD_HANDLE methHnd,
- CORINFO_CLASS_HANDLE clsHnd,
- CORINFO_METHOD_HANDLE targetMethodHnd,
- DelegateCtorArgs * pCtorData
- )
+CORINFO_METHOD_HANDLE MyICJI::GetDelegateCtor(CORINFO_METHOD_HANDLE methHnd,
+ CORINFO_CLASS_HANDLE clsHnd,
+ CORINFO_METHOD_HANDLE targetMethodHnd,
+ DelegateCtorArgs* pCtorData)
{
jitInstance->mc->cr->AddCall("GetDelegateCtor");
- return jitInstance->mc->repGetDelegateCtor(methHnd, clsHnd, targetMethodHnd, pCtorData);
+ return jitInstance->mc->repGetDelegateCtor(methHnd, clsHnd, targetMethodHnd, pCtorData);
}
-void MyICJI::MethodCompileComplete(
- CORINFO_METHOD_HANDLE methHnd
- )
+void MyICJI::MethodCompileComplete(CORINFO_METHOD_HANDLE methHnd)
{
jitInstance->mc->cr->AddCall("MethodCompileComplete");
LogError("Hit unimplemented MethodCompileComplete");
@@ -1765,19 +1516,16 @@ void MyICJI::MethodCompileComplete(
}
// return a thunk that will copy the arguments for the given signature.
-void* MyICJI::getTailCallCopyArgsThunk (
- CORINFO_SIG_INFO *pSig,
- CorInfoHelperTailCallSpecialHandling flags
- )
+void* MyICJI::getTailCallCopyArgsThunk(CORINFO_SIG_INFO* pSig, CorInfoHelperTailCallSpecialHandling flags)
{
jitInstance->mc->cr->AddCall("getTailCallCopyArgsThunk");
return jitInstance->mc->repGetTailCallCopyArgsThunk(pSig, flags);
}
-//Stuff directly on ICorJitInfo
+// Stuff directly on ICorJitInfo
// Returns extended flags for a particular compilation instance.
-DWORD MyICJI::getJitFlags(CORJIT_FLAGS *jitFlags, DWORD sizeInBytes)
+DWORD MyICJI::getJitFlags(CORJIT_FLAGS* jitFlags, DWORD sizeInBytes)
{
jitInstance->mc->cr->AddCall("getJitFlags");
return jitInstance->mc->repGetJitFlags(jitFlags, sizeInBytes);
@@ -1786,7 +1534,7 @@ DWORD MyICJI::getJitFlags(CORJIT_FLAGS *jitFlags, DWORD sizeInBytes)
// Runs the given function with the given parameter under an error trap
// and returns true if the function completes successfully. We fake this
// up a bit for SuperPMI and simply catch all exceptions.
-bool MyICJI::runWithErrorTrap(void (*function)(void*), void *param)
+bool MyICJI::runWithErrorTrap(void (*function)(void*), void* param)
{
return RunWithErrorTrap(function, param);
}
@@ -1798,26 +1546,26 @@ IEEMemoryManager* MyICJI::getMemoryManager()
}
// get a block of memory for the code, readonly data, and read-write data
-void MyICJI::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 */
- )
+void MyICJI::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 */
+ )
{
jitInstance->mc->cr->AddCall("allocMem");
- //TODO-Cleanup: investigate if we need to check roDataBlock as well. Could hot block size be ever 0?
- *hotCodeBlock = HeapAlloc(jitInstance->mc->cr->getCodeHeap(),0,hotCodeSize);
- if (coldCodeSize>0)
- *coldCodeBlock = HeapAlloc(jitInstance->mc->cr->getCodeHeap(),0,coldCodeSize);
+ // TODO-Cleanup: investigate if we need to check roDataBlock as well. Could hot block size be ever 0?
+ *hotCodeBlock = HeapAlloc(jitInstance->mc->cr->getCodeHeap(), 0, hotCodeSize);
+ if (coldCodeSize > 0)
+ *coldCodeBlock = HeapAlloc(jitInstance->mc->cr->getCodeHeap(), 0, coldCodeSize);
else
*coldCodeBlock = nullptr;
- *roDataBlock = HeapAlloc(jitInstance->mc->cr->getCodeHeap(),0,roDataSize);
- jitInstance->mc->cr->recAllocMem(hotCodeSize, coldCodeSize, roDataSize, xcptnsCount, flag, hotCodeBlock, coldCodeBlock, roDataBlock);
+ *roDataBlock = HeapAlloc(jitInstance->mc->cr->getCodeHeap(), 0, roDataSize);
+ jitInstance->mc->cr->recAllocMem(hotCodeSize, coldCodeSize, roDataSize, xcptnsCount, flag, hotCodeBlock,
+ coldCodeBlock, roDataBlock);
}
// Reserve memory for the method/funclet's unwind information.
@@ -1831,11 +1579,10 @@ void MyICJI::allocMem (
// For prejitted code we split up the unwinding information into
// separate sections .rdata and .pdata.
//
-void MyICJI::reserveUnwindInfo (
- BOOL isFunclet, /* IN */
- BOOL isColdCode, /* IN */
- ULONG unwindSize /* IN */
- )
+void MyICJI::reserveUnwindInfo(BOOL isFunclet, /* IN */
+ BOOL isColdCode, /* IN */
+ ULONG unwindSize /* IN */
+ )
{
jitInstance->mc->cr->AddCall("reserveUnwindInfo");
jitInstance->mc->cr->recReserveUnwindInfo(isFunclet, isColdCode, unwindSize);
@@ -1858,30 +1605,29 @@ void MyICJI::reserveUnwindInfo (
// pUnwindBlock pointer to unwind info
// funcKind type of funclet (main method code, handler, filter)
//
-void MyICJI::allocUnwindInfo (
- BYTE * pHotCode, /* IN */
- BYTE * pColdCode, /* IN */
- ULONG startOffset, /* IN */
- ULONG endOffset, /* IN */
- ULONG unwindSize, /* IN */
- BYTE * pUnwindBlock, /* IN */
- CorJitFuncKind funcKind /* IN */
- )
+void MyICJI::allocUnwindInfo(BYTE* pHotCode, /* IN */
+ BYTE* pColdCode, /* IN */
+ ULONG startOffset, /* IN */
+ ULONG endOffset, /* IN */
+ ULONG unwindSize, /* IN */
+ BYTE* pUnwindBlock, /* IN */
+ CorJitFuncKind funcKind /* IN */
+ )
{
jitInstance->mc->cr->AddCall("allocUnwindInfo");
- jitInstance->mc->cr->recAllocUnwindInfo(pHotCode, pColdCode, startOffset, endOffset, unwindSize, pUnwindBlock, funcKind);
+ jitInstance->mc->cr->recAllocUnwindInfo(pHotCode, pColdCode, startOffset, endOffset, unwindSize, pUnwindBlock,
+ funcKind);
}
// 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 * MyICJI::allocGCInfo (
- size_t size /* IN */
- )
+void* MyICJI::allocGCInfo(size_t size /* IN */
+ )
{
jitInstance->mc->cr->AddCall("allocGCInfo");
- void *temp = (unsigned char*)HeapAlloc(jitInstance->mc->cr->getCodeHeap(),0,size);
+ void* temp = (unsigned char*)HeapAlloc(jitInstance->mc->cr->getCodeHeap(), 0, size);
jitInstance->mc->cr->recAllocGCInfo(size, temp);
return temp;
@@ -1896,9 +1642,8 @@ void MyICJI::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 MyICJI::setEHcount (
- unsigned cEH /* IN */
- )
+void MyICJI::setEHcount(unsigned cEH /* IN */
+ )
{
jitInstance->mc->cr->AddCall("setEHcount");
jitInstance->mc->cr->recSetEHcount(cEH);
@@ -1909,10 +1654,9 @@ void MyICJI::setEHcount (
// Handler regions should be lexically contiguous.
// This is because FinallyIsUnwinding() uses lexicality to
// determine if a "finally" clause is executing.
-void MyICJI::setEHinfo (
- unsigned EHnumber, /* IN */
- const CORINFO_EH_CLAUSE *clause /* IN */
- )
+void MyICJI::setEHinfo(unsigned EHnumber, /* IN */
+ const CORINFO_EH_CLAUSE* clause /* IN */
+ )
{
jitInstance->mc->cr->AddCall("setEHinfo");
jitInstance->mc->cr->recSetEHinfo(EHnumber, clause);
@@ -1925,10 +1669,10 @@ BOOL MyICJI::logMsg(unsigned level, const char* fmt, va_list args)
{
jitInstance->mc->cr->AddCall("logMsg");
-// if(level<=2)
-// {
- //jitInstance->mc->cr->recMessageLog(fmt, args);
- //DebugBreakorAV(0x99);
+ // if(level<=2)
+ // {
+ //jitInstance->mc->cr->recMessageLog(fmt, args);
+ //DebugBreakorAV(0x99);
//}
jitInstance->mc->cr->recMessageLog(fmt, args);
return 0;
@@ -1965,10 +1709,8 @@ void MyICJI::reportFatalError(CorJitResult result)
// allocate a basic block profile buffer where execution counts will be stored
// for jitted basic blocks.
-HRESULT MyICJI::allocBBProfileBuffer (
- ULONG count, // The number of basic blocks that we have
- ProfileBuffer ** profileBuffer
- )
+HRESULT MyICJI::allocBBProfileBuffer(ULONG count, // The number of basic blocks that we have
+ ProfileBuffer** profileBuffer)
{
jitInstance->mc->cr->AddCall("allocBBProfileBuffer");
return jitInstance->mc->cr->repAllocBBProfileBuffer(count, profileBuffer);
@@ -1976,12 +1718,10 @@ HRESULT MyICJI::allocBBProfileBuffer (
// 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 MyICJI::getBBProfileData(
- CORINFO_METHOD_HANDLE ftnHnd,
- ULONG * count, // The number of basic blocks that we have
- ProfileBuffer ** profileBuffer,
- ULONG * numRuns
- )
+HRESULT MyICJI::getBBProfileData(CORINFO_METHOD_HANDLE ftnHnd,
+ ULONG* count, // The number of basic blocks that we have
+ ProfileBuffer** profileBuffer,
+ ULONG* numRuns)
{
jitInstance->mc->cr->AddCall("getBBProfileData");
return jitInstance->mc->repGetBBProfileData(ftnHnd, count, profileBuffer, numRuns);
@@ -1991,11 +1731,10 @@ HRESULT MyICJI::getBBProfileData(
// 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 MyICJI::recordCallSite(
- ULONG instrOffset, /* IN */
- CORINFO_SIG_INFO * callSig, /* IN */
- CORINFO_METHOD_HANDLE methodHandle /* IN */
- )
+void MyICJI::recordCallSite(ULONG instrOffset, /* IN */
+ CORINFO_SIG_INFO* callSig, /* IN */
+ CORINFO_METHOD_HANDLE methodHandle /* IN */
+ )
{
jitInstance->mc->cr->AddCall("recordCallSite");
jitInstance->mc->cr->repRecordCallSite(instrOffset, callSig, methodHandle);
@@ -2003,19 +1742,18 @@ void MyICJI::recordCallSite(
// A relocation is recorded if we are pre-jitting.
// A jump thunk may be inserted if we are jitting
-void MyICJI::recordRelocation(
- void * location, /* IN */
- void * target, /* IN */
- WORD fRelocType, /* IN */
- WORD slotNum, /* IN */
- INT32 addlDelta /* IN */
- )
+void MyICJI::recordRelocation(void* location, /* IN */
+ void* target, /* IN */
+ WORD fRelocType, /* IN */
+ WORD slotNum, /* IN */
+ INT32 addlDelta /* IN */
+ )
{
jitInstance->mc->cr->AddCall("recordRelocation");
jitInstance->mc->cr->repRecordRelocation(location, target, fRelocType, slotNum, addlDelta);
}
-WORD MyICJI::getRelocTypeHint(void * target)
+WORD MyICJI::getRelocTypeHint(void* target)
{
jitInstance->mc->cr->AddCall("getRelocTypeHint");
WORD result = jitInstance->mc->repGetRelocTypeHint(target);
@@ -2025,10 +1763,9 @@ WORD MyICJI::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 MyICJI::getModuleNativeEntryPointRange(
- void ** pStart, /* OUT */
- void ** pEnd /* OUT */
- )
+void MyICJI::getModuleNativeEntryPointRange(void** pStart, /* OUT */
+ void** pEnd /* OUT */
+ )
{
jitInstance->mc->cr->AddCall("getModuleNativeEntryPointRange");
LogError("Hit unimplemented getModuleNativeEntryPointRange");
diff --git a/src/ToolBox/superpmi/superpmi/icorjitinfo.h b/src/ToolBox/superpmi/superpmi/icorjitinfo.h
index 2182db3be6..333d69dbbe 100644
--- a/src/ToolBox/superpmi/superpmi/icorjitinfo.h
+++ b/src/ToolBox/superpmi/superpmi/icorjitinfo.h
@@ -9,7 +9,7 @@
#include "runtimedetails.h"
#include "ieememorymanager.h"
-extern ICorJitInfo *pICJI;
+extern ICorJitInfo* pICJI;
class MyICJI : public ICorJitInfo
{
@@ -17,10 +17,9 @@ class MyICJI : public ICorJitInfo
#include "icorjitinfoimpl.h"
public:
-
- //Added extras... todo add padding to detect corruption?
- JitInstance *jitInstance;
+ // Added extras... todo add padding to detect corruption?
+ JitInstance* jitInstance;
};
-ICorJitInfo* InitICorJitInfo(JitInstance *jitInstance);
+ICorJitInfo* InitICorJitInfo(JitInstance* jitInstance);
#endif
diff --git a/src/ToolBox/superpmi/superpmi/ieememorymanager.cpp b/src/ToolBox/superpmi/superpmi/ieememorymanager.cpp
index 8bb95b1f4d..b8d5f152af 100644
--- a/src/ToolBox/superpmi/superpmi/ieememorymanager.cpp
+++ b/src/ToolBox/superpmi/superpmi/ieememorymanager.cpp
@@ -7,14 +7,14 @@
#include "spmiutil.h"
#include "ieememorymanager.h"
-IEEMemoryManager *pIEEMM = nullptr;
-HANDLE processHeap = INVALID_HANDLE_VALUE;
+IEEMemoryManager* pIEEMM = nullptr;
+HANDLE processHeap = INVALID_HANDLE_VALUE;
//***************************************************************************
// IUnknown methods
//***************************************************************************
-HRESULT STDMETHODCALLTYPE MyIEEMM::QueryInterface(REFIID id, void **pInterface)
+HRESULT STDMETHODCALLTYPE MyIEEMM::QueryInterface(REFIID id, void** pInterface)
{
DebugBreakorAV(133);
return 0;
@@ -35,11 +35,14 @@ HANDLE virtHeap = INVALID_HANDLE_VALUE;
//***************************************************************************
// IEEMemoryManager methods for locking
//***************************************************************************
-LPVOID STDMETHODCALLTYPE MyIEEMM::ClrVirtualAlloc(LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect)
+LPVOID STDMETHODCALLTYPE MyIEEMM::ClrVirtualAlloc(LPVOID lpAddress,
+ SIZE_T dwSize,
+ DWORD flAllocationType,
+ DWORD flProtect)
{
- if(virtHeap == INVALID_HANDLE_VALUE)
+ if (virtHeap == INVALID_HANDLE_VALUE)
virtHeap = HeapCreate(0, 0xFFFF, 0);
- if(virtHeap != INVALID_HANDLE_VALUE)
+ if (virtHeap != INVALID_HANDLE_VALUE)
return HeapAlloc(virtHeap, HEAP_ZERO_MEMORY, dwSize);
return nullptr;
}
@@ -47,12 +50,17 @@ BOOL STDMETHODCALLTYPE MyIEEMM::ClrVirtualFree(LPVOID lpAddress, SIZE_T dwSize,
{
return HeapFree(virtHeap, 0, lpAddress);
}
-SIZE_T STDMETHODCALLTYPE MyIEEMM::ClrVirtualQuery(LPCVOID lpAddress, PMEMORY_BASIC_INFORMATION lpBuffer, SIZE_T dwLength)
+SIZE_T STDMETHODCALLTYPE MyIEEMM::ClrVirtualQuery(LPCVOID lpAddress,
+ PMEMORY_BASIC_INFORMATION lpBuffer,
+ SIZE_T dwLength)
{
DebugBreakorAV(136);
return 0;
}
-BOOL STDMETHODCALLTYPE MyIEEMM::ClrVirtualProtect(LPVOID lpAddress, SIZE_T dwSize, DWORD flNewProtect, PDWORD lpflOldProtect)
+BOOL STDMETHODCALLTYPE MyIEEMM::ClrVirtualProtect(LPVOID lpAddress,
+ SIZE_T dwSize,
+ DWORD flNewProtect,
+ PDWORD lpflOldProtect)
{
DebugBreakorAV(137);
return 0;
@@ -74,7 +82,7 @@ BOOL STDMETHODCALLTYPE MyIEEMM::ClrHeapDestroy(HANDLE hHeap)
}
LPVOID STDMETHODCALLTYPE MyIEEMM::ClrHeapAlloc(HANDLE hHeap, DWORD dwFlags, SIZE_T dwBytes)
{
- return HeapAlloc(hHeap,dwFlags,dwBytes);
+ return HeapAlloc(hHeap, dwFlags, dwBytes);
}
BOOL STDMETHODCALLTYPE MyIEEMM::ClrHeapFree(HANDLE hHeap, DWORD dwFlags, LPVOID lpMem)
{
@@ -98,13 +106,13 @@ HANDLE STDMETHODCALLTYPE MyIEEMM::ClrGetProcessExecutableHeap()
return processHeap;
}
-IEEMemoryManager *InitIEEMemoryManager(JitInstance *jitInstance)
+IEEMemoryManager* InitIEEMemoryManager(JitInstance* jitInstance)
{
- if(pIEEMM==nullptr)
+ if (pIEEMM == nullptr)
{
- MyIEEMM *ieemm = new MyIEEMM();
- ieemm->jitInstance = jitInstance;
- pIEEMM = ieemm;
+ MyIEEMM* ieemm = new MyIEEMM();
+ ieemm->jitInstance = jitInstance;
+ pIEEMM = ieemm;
}
return pIEEMM;
}
diff --git a/src/ToolBox/superpmi/superpmi/ieememorymanager.h b/src/ToolBox/superpmi/superpmi/ieememorymanager.h
index 90763bc233..5793f2b90a 100644
--- a/src/ToolBox/superpmi/superpmi/ieememorymanager.h
+++ b/src/ToolBox/superpmi/superpmi/ieememorymanager.h
@@ -73,18 +73,17 @@ interface IEEMemoryManager : IUnknown
}; // interface IEEMemoryManager
*/
-extern HANDLE virtHeap;
-extern IEEMemoryManager *pIEEMM;
-extern HANDLE processHeap;
+extern HANDLE virtHeap;
+extern IEEMemoryManager* pIEEMM;
+extern HANDLE processHeap;
class MyIEEMM : public IEEMemoryManager
{
private:
-
//***************************************************************************
// IUnknown methods
//***************************************************************************
- HRESULT STDMETHODCALLTYPE QueryInterface(REFIID id, void **pInterface);
+ HRESULT STDMETHODCALLTYPE QueryInterface(REFIID id, void** pInterface);
ULONG STDMETHODCALLTYPE AddRef();
ULONG STDMETHODCALLTYPE Release();
@@ -94,7 +93,10 @@ private:
LPVOID STDMETHODCALLTYPE ClrVirtualAlloc(LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect);
BOOL STDMETHODCALLTYPE ClrVirtualFree(LPVOID lpAddress, SIZE_T dwSize, DWORD dwFreeType);
SIZE_T STDMETHODCALLTYPE ClrVirtualQuery(LPCVOID lpAddress, PMEMORY_BASIC_INFORMATION lpBuffer, SIZE_T dwLength);
- BOOL STDMETHODCALLTYPE ClrVirtualProtect(LPVOID lpAddress, SIZE_T dwSize, DWORD flNewProtect, PDWORD lpflOldProtect);
+ BOOL STDMETHODCALLTYPE ClrVirtualProtect(LPVOID lpAddress,
+ SIZE_T dwSize,
+ DWORD flNewProtect,
+ PDWORD lpflOldProtect);
HANDLE STDMETHODCALLTYPE ClrGetProcessHeap();
HANDLE STDMETHODCALLTYPE ClrHeapCreate(DWORD flOptions, SIZE_T dwInitialSize, SIZE_T dwMaximumSize);
BOOL STDMETHODCALLTYPE ClrHeapDestroy(HANDLE hHeap);
@@ -104,10 +106,10 @@ private:
HANDLE STDMETHODCALLTYPE ClrGetProcessExecutableHeap();
public:
- //Added extras... todo add padding to detect corruption?
- JitInstance *jitInstance;
+ // Added extras... todo add padding to detect corruption?
+ JitInstance* jitInstance;
};
-IEEMemoryManager *InitIEEMemoryManager(JitInstance *jitInstance);
+IEEMemoryManager* InitIEEMemoryManager(JitInstance* jitInstance);
#endif
diff --git a/src/ToolBox/superpmi/superpmi/iexecutionengine.cpp b/src/ToolBox/superpmi/superpmi/iexecutionengine.cpp
index db9e121d8e..7a39734500 100644
--- a/src/ToolBox/superpmi/superpmi/iexecutionengine.cpp
+++ b/src/ToolBox/superpmi/superpmi/iexecutionengine.cpp
@@ -9,15 +9,15 @@
LPVOID TLS_Slots[MAX_PREDEFINED_TLS_SLOT];
class MyIEE;
-IExecutionEngine *pIEE = nullptr;
+IExecutionEngine* pIEE = nullptr;
//***************************************************************************
// IUnknown methods
//***************************************************************************
-HRESULT STDMETHODCALLTYPE MyIEE::QueryInterface(REFIID id, void **pInterface)
+HRESULT STDMETHODCALLTYPE MyIEE::QueryInterface(REFIID id, void** pInterface)
{
- //TODO-Cleanup: check the rid
+ // TODO-Cleanup: check the rid
*pInterface = InitIEEMemoryManager(nullptr);
return 0;
}
@@ -39,18 +39,18 @@ ULONG STDMETHODCALLTYPE MyIEE::Release()
DWORD TlsIndex = 42;
// Associate a callback for cleanup with a TLS slot
-VOID STDMETHODCALLTYPE MyIEE::TLS_AssociateCallback(DWORD slot, PTLS_CALLBACK_FUNCTION callback)
+VOID STDMETHODCALLTYPE MyIEE::TLS_AssociateCallback(DWORD slot, PTLS_CALLBACK_FUNCTION callback)
{
- //TODO-Cleanup: figure an appropriate realish value for this
+ // TODO-Cleanup: figure an appropriate realish value for this
}
// Get the TLS block for fast Get/Set operations
LPVOID* STDMETHODCALLTYPE MyIEE::TLS_GetDataBlock()
{
- //We were previously allocating a TlsIndex with
- //the master slot index set to a nullptr
- //so in the new version we just return nullptr
- //and it seems to be working for now
+ // We were previously allocating a TlsIndex with
+ //the master slot index set to a nullptr
+ //so in the new version we just return nullptr
+ //and it seems to be working for now
return nullptr;
}
@@ -69,10 +69,10 @@ LPVOID STDMETHODCALLTYPE MyIEE::TLS_GetValue(DWORD slot)
}
// Get the value at a slot, return FALSE if TLS info block doesn't exist
-BOOL STDMETHODCALLTYPE MyIEE::TLS_CheckValue(DWORD slot, LPVOID * pValue)
+BOOL STDMETHODCALLTYPE MyIEE::TLS_CheckValue(DWORD slot, LPVOID* pValue)
{
DebugBreakorAV(144);
- //TODO-Cleanup: does anything beyond contracts care? This seems like a pretty thin mock.
+ // TODO-Cleanup: does anything beyond contracts care? This seems like a pretty thin mock.
return true;
}
// Set the value at a slot
@@ -83,9 +83,9 @@ VOID STDMETHODCALLTYPE MyIEE::TLS_SetValue(DWORD slot, LPVOID pData)
DebugBreakorAV(143);
return;
}
- void *thing = TlsGetValue(TlsIndex);//TODO-Cleanup: this seems odd.. explain?
+ void* thing = TlsGetValue(TlsIndex); // TODO-Cleanup: this seems odd.. explain?
- //TODO-Cleanup: does anything beyond contracts care? This seems like a pretty thin mock.
+ // TODO-Cleanup: does anything beyond contracts care? This seems like a pretty thin mock.
TLS_Slots[slot] = pData;
}
// Free TLS memory block and make callback
@@ -161,14 +161,14 @@ DWORD STDMETHODCALLTYPE MyIEE::ClrWaitForSemaphore(SEMAPHORE_COOKIE semaphore, D
DebugBreakorAV(156);
return 0;
}
-BOOL STDMETHODCALLTYPE MyIEE::ClrReleaseSemaphore(SEMAPHORE_COOKIE semaphore, LONG lReleaseCount, LONG *lpPreviousCount)
+BOOL STDMETHODCALLTYPE MyIEE::ClrReleaseSemaphore(SEMAPHORE_COOKIE semaphore, LONG lReleaseCount, LONG* lpPreviousCount)
{
DebugBreakorAV(157);
return 0;
}
MUTEX_COOKIE STDMETHODCALLTYPE MyIEE::ClrCreateMutex(LPSECURITY_ATTRIBUTES lpMutexAttributes,
- BOOL bInitialOwner,
- LPCTSTR lpName)
+ BOOL bInitialOwner,
+ LPCTSTR lpName)
{
DebugBreakorAV(158);
return 0;
@@ -182,9 +182,7 @@ BOOL STDMETHODCALLTYPE MyIEE::ClrReleaseMutex(MUTEX_COOKIE mutex)
DebugBreakorAV(160);
return 0;
}
-DWORD STDMETHODCALLTYPE MyIEE::ClrWaitForMutex(MUTEX_COOKIE mutex,
- DWORD dwMilliseconds,
- BOOL bAlertable)
+DWORD STDMETHODCALLTYPE MyIEE::ClrWaitForMutex(MUTEX_COOKIE mutex, DWORD dwMilliseconds, BOOL bAlertable)
{
DebugBreakorAV(161);
return 0;
@@ -200,14 +198,14 @@ BOOL STDMETHODCALLTYPE MyIEE::ClrAllocationDisallowed()
DebugBreakorAV(163);
return 0;
}
-void STDMETHODCALLTYPE MyIEE::GetLastThrownObjectExceptionFromThread(void **ppvException)
+void STDMETHODCALLTYPE MyIEE::GetLastThrownObjectExceptionFromThread(void** ppvException)
{
DebugBreakorAV(164);
}
-MyIEE *InitIExecutionEngine()
+MyIEE* InitIExecutionEngine()
{
- MyIEE *iee = new MyIEE();
- pIEE = iee;
+ MyIEE* iee = new MyIEE();
+ pIEE = iee;
return iee;
}
diff --git a/src/ToolBox/superpmi/superpmi/iexecutionengine.h b/src/ToolBox/superpmi/superpmi/iexecutionengine.h
index f1a76b9a4f..fb3a413cb4 100644
--- a/src/ToolBox/superpmi/superpmi/iexecutionengine.h
+++ b/src/ToolBox/superpmi/superpmi/iexecutionengine.h
@@ -85,17 +85,16 @@ interface IExecutionEngine : IUnknown
}; // interface IExecutionEngine
*/
-extern LPVOID TLS_Slots[MAX_PREDEFINED_TLS_SLOT];
-extern IExecutionEngine *pIEE;
+extern LPVOID TLS_Slots[MAX_PREDEFINED_TLS_SLOT];
+extern IExecutionEngine* pIEE;
class MyIEE : public IExecutionEngine
{
private:
-
//***************************************************************************
// IUnknown methods
//***************************************************************************
- HRESULT STDMETHODCALLTYPE QueryInterface(REFIID id, void **pInterface);
+ HRESULT STDMETHODCALLTYPE QueryInterface(REFIID id, void** pInterface);
ULONG STDMETHODCALLTYPE AddRef();
ULONG STDMETHODCALLTYPE Release();
@@ -103,14 +102,14 @@ private:
// IExecutionEngine methods for TLS
//***************************************************************************
// Associate a callback for cleanup with a TLS slot
- VOID STDMETHODCALLTYPE TLS_AssociateCallback(DWORD slot, PTLS_CALLBACK_FUNCTION callback);
+ VOID STDMETHODCALLTYPE TLS_AssociateCallback(DWORD slot, PTLS_CALLBACK_FUNCTION callback);
// Get the TLS block for fast Get/Set operations
LPVOID* STDMETHODCALLTYPE TLS_GetDataBlock();
// Get the value at a slot
LPVOID STDMETHODCALLTYPE TLS_GetValue(DWORD slot);
// Get the value at a slot, return FALSE if TLS info block doesn't exist
- BOOL STDMETHODCALLTYPE TLS_CheckValue(DWORD slot, LPVOID * pValue);
+ BOOL STDMETHODCALLTYPE TLS_CheckValue(DWORD slot, LPVOID* pValue);
// Set the value at a slot
VOID STDMETHODCALLTYPE TLS_SetValue(DWORD slot, LPVOID pData);
// Free TLS memory block and make callback
@@ -133,19 +132,17 @@ private:
SEMAPHORE_COOKIE STDMETHODCALLTYPE ClrCreateSemaphore(DWORD dwInitial, DWORD dwMax);
void STDMETHODCALLTYPE ClrCloseSemaphore(SEMAPHORE_COOKIE semaphore);
DWORD STDMETHODCALLTYPE ClrWaitForSemaphore(SEMAPHORE_COOKIE semaphore, DWORD dwMilliseconds, BOOL bAlertable);
- BOOL STDMETHODCALLTYPE ClrReleaseSemaphore(SEMAPHORE_COOKIE semaphore, LONG lReleaseCount, LONG *lpPreviousCount);
+ BOOL STDMETHODCALLTYPE ClrReleaseSemaphore(SEMAPHORE_COOKIE semaphore, LONG lReleaseCount, LONG* lpPreviousCount);
MUTEX_COOKIE STDMETHODCALLTYPE ClrCreateMutex(LPSECURITY_ATTRIBUTES lpMutexAttributes,
- BOOL bInitialOwner,
- LPCTSTR lpName);
+ BOOL bInitialOwner,
+ LPCTSTR lpName);
void STDMETHODCALLTYPE ClrCloseMutex(MUTEX_COOKIE mutex);
BOOL STDMETHODCALLTYPE ClrReleaseMutex(MUTEX_COOKIE mutex);
- DWORD STDMETHODCALLTYPE ClrWaitForMutex(MUTEX_COOKIE mutex,
- DWORD dwMilliseconds,
- BOOL bAlertable);
+ DWORD STDMETHODCALLTYPE ClrWaitForMutex(MUTEX_COOKIE mutex, DWORD dwMilliseconds, BOOL bAlertable);
DWORD STDMETHODCALLTYPE ClrSleepEx(DWORD dwMilliseconds, BOOL bAlertable);
BOOL STDMETHODCALLTYPE ClrAllocationDisallowed();
- void STDMETHODCALLTYPE GetLastThrownObjectExceptionFromThread(void **ppvException);
+ void STDMETHODCALLTYPE GetLastThrownObjectExceptionFromThread(void** ppvException);
};
-MyIEE *InitIExecutionEngine();
+MyIEE* InitIExecutionEngine();
#endif \ No newline at end of file
diff --git a/src/ToolBox/superpmi/superpmi/jitdebugger.cpp b/src/ToolBox/superpmi/superpmi/jitdebugger.cpp
index 867664e82f..b4b4ede20f 100644
--- a/src/ToolBox/superpmi/superpmi/jitdebugger.cpp
+++ b/src/ToolBox/superpmi/superpmi/jitdebugger.cpp
@@ -25,17 +25,13 @@
#ifndef FEATURE_JIT_DEBUGGING
-int DbgBreakCheck(
- const char* szFile,
- int iLine,
- const char* szExpr)
+int DbgBreakCheck(const char* szFile, int iLine, const char* szExpr)
{
LogError("SuperPMI: Assert Failure (PID %d, Thread %d/%x)\n"
"%s\n"
"\n"
"%s, Line: %d\n",
- GetCurrentProcessId(), GetCurrentThreadId(), GetCurrentThreadId(),
- szExpr, szFile, iLine);
+ GetCurrentProcessId(), GetCurrentThreadId(), GetCurrentThreadId(), szExpr, szFile, iLine);
return 1;
}
@@ -90,18 +86,14 @@ BOOL RunningInWow64()
// Exceptions
// None
//------------------------------------------------------------------------------
-BOOL GetRegistryLongValue(HKEY hKeyParent,
- LPCWSTR szKey,
- LPCWSTR szName,
- long *pValue,
- BOOL fReadNonVirtualizedKey)
+BOOL GetRegistryLongValue(HKEY hKeyParent, LPCWSTR szKey, LPCWSTR szName, long* pValue, BOOL fReadNonVirtualizedKey)
{
- DWORD ret; // Return value from registry operation.
- HKEY hkey; // Registry key.
- long iValue; // The value to read.
- DWORD iType; // Type of value to get.
- DWORD iSize; // Size of buffer.
- REGSAM samDesired = KEY_READ; // Desired access rights to the key
+ DWORD ret; // Return value from registry operation.
+ HKEY hkey; // Registry key.
+ long iValue; // The value to read.
+ DWORD iType; // Type of value to get.
+ DWORD iSize; // Size of buffer.
+ REGSAM samDesired = KEY_READ; // Desired access rights to the key
if (fReadNonVirtualizedKey)
{
@@ -118,10 +110,10 @@ BOOL GetRegistryLongValue(HKEY hKeyParent,
{
iType = REG_DWORD;
iSize = sizeof(long);
- ret = RegQueryValueExW(hkey, szName, NULL, &iType, reinterpret_cast<BYTE*>(&iValue), &iSize);
+ ret = RegQueryValueExW(hkey, szName, NULL, &iType, reinterpret_cast<BYTE*>(&iValue), &iSize);
if (ret == ERROR_SUCCESS && iType == REG_DWORD && iSize == sizeof(long))
- { // We successfully read a DWORD value.
+ { // We successfully read a DWORD value.
*pValue = iValue;
return TRUE;
}
@@ -144,7 +136,7 @@ BOOL GetRegistryLongValue(HKEY hKeyParent,
// Note:
//
//----------------------------------------------------------------------------
-HRESULT GetCurrentModuleFileName(__out_ecount(*pcchBuffer) LPWSTR pBuffer, __inout DWORD *pcchBuffer)
+HRESULT GetCurrentModuleFileName(__out_ecount(*pcchBuffer) LPWSTR pBuffer, __inout DWORD* pcchBuffer)
{
LIMITED_METHOD_CONTRACT;
@@ -165,10 +157,10 @@ HRESULT GetCurrentModuleFileName(__out_ecount(*pcchBuffer) LPWSTR pBuffer, __ino
}
// Pick off the part after the path.
- WCHAR* appName = wcsrchr(appPath, L'\\');
+ WCHAR* appName = wcsrchr(appPath, L'\\');
// If no backslash, use the whole name; if there is a backslash, skip it.
- appName = appName ? appName+1 : appPath;
+ appName = appName ? appName + 1 : appPath;
if (*pcchBuffer < wcslen(appName))
{
@@ -180,7 +172,6 @@ HRESULT GetCurrentModuleFileName(__out_ecount(*pcchBuffer) LPWSTR pBuffer, __ino
return S_OK;
}
-
//----------------------------------------------------------------------------
//
// IsCurrentModuleFileNameInAutoExclusionList - decide if the current module's filename
@@ -232,12 +223,10 @@ BOOL IsCurrentModuleFileNameInAutoExclusionList()
return FALSE;
} // IsCurrentModuleFileNameInAutoExclusionList
-
-
//*****************************************************************************
// Retrieve information regarding what registered default debugger
//*****************************************************************************
-void GetDebuggerSettingInfo(LPWSTR wszDebuggerString, DWORD cchDebuggerString, BOOL *pfAuto)
+void GetDebuggerSettingInfo(LPWSTR wszDebuggerString, DWORD cchDebuggerString, BOOL* pfAuto)
{
HRESULT hr = GetDebuggerSettingInfoWorker(wszDebuggerString, &cchDebuggerString, pfAuto);
@@ -265,7 +254,10 @@ void GetDebuggerSettingInfo(LPWSTR wszDebuggerString, DWORD cchDebuggerString, B
// * wszDebuggerString can be NULL. When wszDebuggerString is NULL, pcchDebuggerString should
// * point to a DWORD of zero. pcchDebuggerString cannot be NULL, and the DWORD pointed by
// * pcchDebuggerString will store the used or required string buffer size in characters.
-HRESULT GetDebuggerSettingInfoWorker(__out_ecount_part_opt(*pcchDebuggerString, *pcchDebuggerString) LPWSTR wszDebuggerString, DWORD * pcchDebuggerString, BOOL * pfAuto)
+HRESULT GetDebuggerSettingInfoWorker(__out_ecount_part_opt(*pcchDebuggerString, *pcchDebuggerString)
+ LPWSTR wszDebuggerString,
+ DWORD* pcchDebuggerString,
+ BOOL* pfAuto)
{
if ((pcchDebuggerString == NULL) || ((wszDebuggerString == NULL) && (*pcchDebuggerString != 0)))
{
@@ -289,7 +281,7 @@ HRESULT GetDebuggerSettingInfoWorker(__out_ecount_part_opt(*pcchDebuggerString,
DWORD ret = WszRegOpenKeyEx(HKEY_LOCAL_MACHINE, kUnmanagedDebuggerKey, 0, KEY_READ, &hKey);
if (ret != ERROR_SUCCESS)
- { // Wow, there's not even an AeDebug hive, so no native debugger, no auto.
+ { // Wow, there's not even an AeDebug hive, so no native debugger, no auto.
return S_OK;
}
@@ -315,7 +307,8 @@ HRESULT GetDebuggerSettingInfoWorker(__out_ecount_part_opt(*pcchDebuggerString,
return S_OK;
}
- ret = RegQueryValueExW(hKey, kUnmanagedDebuggerValue, NULL, NULL, reinterpret_cast< LPBYTE >(wszDebuggerString), &valueSize);
+ ret = RegQueryValueExW(hKey, kUnmanagedDebuggerValue, NULL, NULL, reinterpret_cast<LPBYTE>(wszDebuggerString),
+ &valueSize);
if (ret != ERROR_SUCCESS)
{
*wszDebuggerString = L'\0';
@@ -330,16 +323,14 @@ HRESULT GetDebuggerSettingInfoWorker(__out_ecount_part_opt(*pcchDebuggerString,
// Get the appname to look up in DebugApplications key.
WCHAR wzAppName[MAX_PATH];
DWORD cchAppName = NumItems(wzAppName);
- long iValue;
+ long iValue;
// Check DebugApplications setting
if ((SUCCEEDED(GetCurrentModuleFileName(wzAppName, &cchAppName))) &&
- (
- GetRegistryLongValue(HKEY_LOCAL_MACHINE, kDebugApplicationsPoliciesKey, wzAppName, &iValue, TRUE) ||
- GetRegistryLongValue(HKEY_LOCAL_MACHINE, kDebugApplicationsKey, wzAppName, &iValue, TRUE) ||
- GetRegistryLongValue(HKEY_CURRENT_USER, kDebugApplicationsPoliciesKey, wzAppName, &iValue, TRUE) ||
- GetRegistryLongValue(HKEY_CURRENT_USER, kDebugApplicationsKey, wzAppName, &iValue, TRUE)
- ) &&
+ (GetRegistryLongValue(HKEY_LOCAL_MACHINE, kDebugApplicationsPoliciesKey, wzAppName, &iValue, TRUE) ||
+ GetRegistryLongValue(HKEY_LOCAL_MACHINE, kDebugApplicationsKey, wzAppName, &iValue, TRUE) ||
+ GetRegistryLongValue(HKEY_CURRENT_USER, kDebugApplicationsPoliciesKey, wzAppName, &iValue, TRUE) ||
+ GetRegistryLongValue(HKEY_CURRENT_USER, kDebugApplicationsKey, wzAppName, &iValue, TRUE)) &&
(iValue == 1))
{
fAuto = TRUE;
@@ -352,7 +343,8 @@ HRESULT GetDebuggerSettingInfoWorker(__out_ecount_part_opt(*pcchDebuggerString,
{
WCHAR wzAutoKey[MAX_PATH];
valueSize = NumItems(wzAutoKey) * sizeof(WCHAR);
- RegQueryValueExW(hKey, kUnmanagedDebuggerAutoValue, NULL, NULL, reinterpret_cast< LPBYTE >(wzAutoKey), &valueSize);
+ RegQueryValueExW(hKey, kUnmanagedDebuggerAutoValue, NULL, NULL, reinterpret_cast<LPBYTE>(wzAutoKey),
+ &valueSize);
// The OS's behavior is to consider Auto to be FALSE unless the first character is set
// to 1. They don't take into consideration the following characters. Also if the value
@@ -379,14 +371,15 @@ BOOL LaunchJITDebugger()
GetDebuggerSettingInfo(debugger, NumItems(debugger), NULL);
SECURITY_ATTRIBUTES sa;
- sa.nLength = sizeof(sa);
+ sa.nLength = sizeof(sa);
sa.lpSecurityDescriptor = NULL;
- sa.bInheritHandle = TRUE;
+ sa.bInheritHandle = TRUE;
// We can leave this event as it is since it is inherited by a child process.
// We will block one scheduler, but the process is asking a user if they want to attach debugger.
HANDLE eventHandle = WszCreateEvent(&sa, TRUE, FALSE, NULL);
- if (eventHandle == NULL) {
+ if (eventHandle == NULL)
+ {
return FALSE;
}
@@ -395,7 +388,7 @@ BOOL LaunchJITDebugger()
STARTUPINFOW StartupInfo;
memset(&StartupInfo, 0, sizeof(StartupInfo));
- StartupInfo.cb = sizeof(StartupInfo);
+ StartupInfo.cb = sizeof(StartupInfo);
StartupInfo.lpDesktop = L"Winsta0\\Default";
PROCESS_INFORMATION ProcessInformation;
@@ -410,47 +403,44 @@ BOOL LaunchJITDebugger()
return fSuccess;
}
-
// See if we should invoke the just-in-time debugger on an assert.
-int DbgBreakCheck(
- const char* szFile,
- int iLine,
- const char* szExpr)
+int DbgBreakCheck(const char* szFile, int iLine, const char* szExpr)
{
char dialogText[1000];
char dialogTitle[1000];
- sprintf_s(dialogText, sizeof(dialogText), "%s\n\n%s, Line: %d\n\nAbort - Kill program\nRetry - Debug\nIgnore - Keep running\n",
- szExpr, szFile, iLine);
+ sprintf_s(dialogText, sizeof(dialogText),
+ "%s\n\n%s, Line: %d\n\nAbort - Kill program\nRetry - Debug\nIgnore - Keep running\n", szExpr, szFile,
+ iLine);
sprintf_s(dialogTitle, sizeof(dialogTitle), "SuperPMI: Assert Failure (PID %d, Thread %d/%x) ",
- GetCurrentProcessId(), GetCurrentThreadId(), GetCurrentThreadId());
+ GetCurrentProcessId(), GetCurrentThreadId(), GetCurrentThreadId());
// Tell user there was an error.
int ret = MessageBoxA(NULL, dialogText, dialogTitle, MB_ABORTRETRYIGNORE | MB_ICONEXCLAMATION | MB_TOPMOST);
- switch(ret)
+ switch (ret)
{
- case IDABORT:
- TerminateProcess(GetCurrentProcess(), 1);
- break;
+ case IDABORT:
+ TerminateProcess(GetCurrentProcess(), 1);
+ break;
- // Tell caller to break at the correct loction.
- case IDRETRY:
+ // Tell caller to break at the correct loction.
+ case IDRETRY:
- if (IsDebuggerPresent())
- {
- SetErrorMode(0);
- }
- else
- {
- LaunchJITDebugger();
- }
+ if (IsDebuggerPresent())
+ {
+ SetErrorMode(0);
+ }
+ else
+ {
+ LaunchJITDebugger();
+ }
- return 1;
+ return 1;
- case IDIGNORE:
- // nothing to do
- break;
+ case IDIGNORE:
+ // nothing to do
+ break;
}
return 0;
diff --git a/src/ToolBox/superpmi/superpmi/jitdebugger.h b/src/ToolBox/superpmi/superpmi/jitdebugger.h
index eee2318f8f..27f42121b1 100644
--- a/src/ToolBox/superpmi/superpmi/jitdebugger.h
+++ b/src/ToolBox/superpmi/superpmi/jitdebugger.h
@@ -6,7 +6,8 @@
#ifndef _JitDebugger
#define _JitDebugger
-extern bool breakOnDebugBreakorAV; // It's kind of awful that I'm making this global, but it was kind of awful that it was file-global already.
+extern bool breakOnDebugBreakorAV; // It's kind of awful that I'm making this global, but it was kind of awful that it
+ // was file-global already.
//
// Functions to support just-in-time debugging.
@@ -15,18 +16,21 @@ extern bool breakOnDebugBreakorAV; // It's kind of awful that I'm making this gl
BOOL GetRegistryLongValue(HKEY hKeyParent, // Parent key.
LPCWSTR szKey, // Key name to look at.
LPCWSTR szName, // Name of value to get.
- long *pValue, // Put value here, if found.
+ long* pValue, // Put value here, if found.
BOOL fReadNonVirtualizedKey); // Whether to read 64-bit hive on WOW64
-HRESULT GetCurrentModuleFileName(__out_ecount(*pcchBuffer) LPWSTR pBuffer, __inout DWORD *pcchBuffer);
+HRESULT GetCurrentModuleFileName(__out_ecount(*pcchBuffer) LPWSTR pBuffer, __inout DWORD* pcchBuffer);
#ifndef _WIN64
BOOL RunningInWow64();
#endif
-BOOL IsCurrentModuleFileNameInAutoExclusionList();
-HRESULT GetDebuggerSettingInfoWorker(__out_ecount_part_opt(*pcchDebuggerString, *pcchDebuggerString) LPWSTR wszDebuggerString, DWORD * pcchDebuggerString, BOOL * pfAuto);
-void GetDebuggerSettingInfo(LPWSTR wszDebuggerString, DWORD cchDebuggerString, BOOL *pfAuto);
+BOOL IsCurrentModuleFileNameInAutoExclusionList();
+HRESULT GetDebuggerSettingInfoWorker(__out_ecount_part_opt(*pcchDebuggerString, *pcchDebuggerString)
+ LPWSTR wszDebuggerString,
+ DWORD* pcchDebuggerString,
+ BOOL* pfAuto);
+void GetDebuggerSettingInfo(LPWSTR wszDebuggerString, DWORD cchDebuggerString, BOOL* pfAuto);
int DbgBreakCheck(const char* szFile, int iLine, const char* szExpr);
diff --git a/src/ToolBox/superpmi/superpmi/jithost.cpp b/src/ToolBox/superpmi/superpmi/jithost.cpp
index cb61e48de2..d14909bae1 100644
--- a/src/ToolBox/superpmi/superpmi/jithost.cpp
+++ b/src/ToolBox/superpmi/superpmi/jithost.cpp
@@ -14,13 +14,14 @@
// value must be freed with jitInstance.freeLongLivedArray(value).
wchar_t* GetCOMPlusVariable(const wchar_t* key, JitInstance& jitInstance)
{
- static const wchar_t Prefix[] = W("COMPlus_");
- static const size_t PrefixLen = (sizeof(Prefix) / sizeof(Prefix[0])) - 1;
+ static const wchar_t Prefix[] = W("COMPlus_");
+ static const size_t PrefixLen = (sizeof(Prefix) / sizeof(Prefix[0])) - 1;
// Prepend "COMPlus_" to the provided key
- size_t keyLen = wcslen(key);
- size_t keyBufferLen = keyLen + PrefixLen + 1;
- wchar_t* keyBuffer = reinterpret_cast<wchar_t*>(jitInstance.allocateArray(static_cast<ULONG>(sizeof(wchar_t) * keyBufferLen)));
+ size_t keyLen = wcslen(key);
+ size_t keyBufferLen = keyLen + PrefixLen + 1;
+ wchar_t* keyBuffer =
+ reinterpret_cast<wchar_t*>(jitInstance.allocateArray(static_cast<ULONG>(sizeof(wchar_t) * keyBufferLen)));
wcscpy_s(keyBuffer, keyBufferLen, Prefix);
wcscpy_s(&keyBuffer[PrefixLen], keyLen + 1, key);
@@ -33,8 +34,8 @@ wchar_t* GetCOMPlusVariable(const wchar_t* key, JitInstance& jitInstance)
}
// Note this value must live as long as the jit instance does.
- wchar_t* value = reinterpret_cast<wchar_t*>(jitInstance.allocateLongLivedArray(sizeof(wchar_t) * valueLen));
- DWORD newValueLen = GetEnvironmentVariableW(keyBuffer, value, valueLen);
+ wchar_t* value = reinterpret_cast<wchar_t*>(jitInstance.allocateLongLivedArray(sizeof(wchar_t) * valueLen));
+ DWORD newValueLen = GetEnvironmentVariableW(keyBuffer, value, valueLen);
jitInstance.freeArray(keyBuffer);
if (valueLen < newValueLen)
@@ -86,7 +87,7 @@ int JitHost::getIntConfigValue(const wchar_t* key, int defaultValue)
// Parse the value as a hex integer.
wchar_t* endPtr;
- result = static_cast<int>(wcstoul(complus, &endPtr, 16));
+ result = static_cast<int>(wcstoul(complus, &endPtr, 16));
bool succeeded = (errno != ERANGE) && (endPtr != complus);
jitInstance.freeLongLivedArray(complus);
@@ -96,13 +97,13 @@ int JitHost::getIntConfigValue(const wchar_t* key, int defaultValue)
const wchar_t* JitHost::getStringConfigValue(const wchar_t* key)
{
jitInstance.mc->cr->AddCall("getStringConfigValue");
- const wchar_t *result = jitInstance.mc->repGetStringConfigValue(key);
+ const wchar_t* result = jitInstance.mc->repGetStringConfigValue(key);
if (result != nullptr)
{
// Now we need to dup it, so you can call freeStringConfigValue() on what we return.
- size_t resultLenInChars = wcslen(result) + 1;
- wchar_t *dupResult = (wchar_t*)jitInstance.allocateLongLivedArray((ULONG)(sizeof(wchar_t) * resultLenInChars));
+ size_t resultLenInChars = wcslen(result) + 1;
+ wchar_t* dupResult = (wchar_t*)jitInstance.allocateLongLivedArray((ULONG)(sizeof(wchar_t) * resultLenInChars));
wcscpy_s(dupResult, resultLenInChars, result);
return dupResult;
diff --git a/src/ToolBox/superpmi/superpmi/jitinstance.cpp b/src/ToolBox/superpmi/superpmi/jitinstance.cpp
index 5003e91f96..e463f82139 100644
--- a/src/ToolBox/superpmi/superpmi/jitinstance.cpp
+++ b/src/ToolBox/superpmi/superpmi/jitinstance.cpp
@@ -12,9 +12,9 @@
#include "errorhandling.h"
#include "spmiutil.h"
-JitInstance *JitInstance::InitJit(char *nameOfJit, bool breakOnAssert, SimpleTimer *st1, MethodContext* firstContext)
+JitInstance* JitInstance::InitJit(char* nameOfJit, bool breakOnAssert, SimpleTimer* st1, MethodContext* firstContext)
{
- JitInstance *jit = new JitInstance();
+ JitInstance* jit = new JitInstance();
if (jit == nullptr)
{
LogError("Failed to allocate a JitInstance");
@@ -36,12 +36,15 @@ JitInstance *JitInstance::InitJit(char *nameOfJit, bool breakOnAssert, SimpleTim
return jit;
}
-HRESULT JitInstance::StartUp(char * PathToJit, bool copyJit, bool parambreakOnDebugBreakorAV, MethodContext* firstContext)
+HRESULT JitInstance::StartUp(char* PathToJit,
+ bool copyJit,
+ bool parambreakOnDebugBreakorAV,
+ MethodContext* firstContext)
{
- //startup jit
+ // startup jit
DWORD dwRetVal = 0;
- UINT uRetVal = 0;
- BOOL bRetVal = FALSE;
+ UINT uRetVal = 0;
+ BOOL bRetVal = FALSE;
breakOnDebugBreakorAV = parambreakOnDebugBreakorAV;
@@ -49,16 +52,16 @@ HRESULT JitInstance::StartUp(char * PathToJit, bool copyJit, bool parambreakOnDe
char lpTempPathBuffer[MAX_PATH];
char szTempFileName[MAX_PATH];
-//Get an allocator instance
-//Note: we do this to keep cleanup somewhat simple...
- ourHeap = ::HeapCreate(0,0,0);
- if(ourHeap == nullptr)
+ // Get an allocator instance
+ //Note: we do this to keep cleanup somewhat simple...
+ ourHeap = ::HeapCreate(0, 0, 0);
+ if (ourHeap == nullptr)
{
LogError("Failed to get a new heap (0x%08x)", ::GetLastError());
return E_FAIL;
}
-//find the full jit path
+ // find the full jit path
dwRetVal = ::GetFullPathNameA(PathToJit, MAX_PATH, pFullPathName, nullptr);
if (dwRetVal == 0)
{
@@ -66,18 +69,18 @@ HRESULT JitInstance::StartUp(char * PathToJit, bool copyJit, bool parambreakOnDe
return E_FAIL;
}
-//Store the full path to the jit
- PathToOriginalJit = (char *)::HeapAlloc(ourHeap, 0, MAX_PATH);
- if(PathToOriginalJit == nullptr)
+ // Store the full path to the jit
+ PathToOriginalJit = (char*)::HeapAlloc(ourHeap, 0, MAX_PATH);
+ if (PathToOriginalJit == nullptr)
{
LogError("1st HeapAlloc failed (0x%08x)", ::GetLastError());
return E_FAIL;
}
::strcpy_s(PathToOriginalJit, MAX_PATH, pFullPathName);
- if(copyJit)
+ if (copyJit)
{
- //Get a temp file location
+ // Get a temp file location
dwRetVal = ::GetTempPathA(MAX_PATH, lpTempPathBuffer);
if (dwRetVal == 0)
{
@@ -89,7 +92,7 @@ HRESULT JitInstance::StartUp(char * PathToJit, bool copyJit, bool parambreakOnDe
LogError("GetTempPath returned a path that was larger than MAX_PATH");
return E_FAIL;
}
- //Get a temp filename
+ // Get a temp filename
uRetVal = ::GetTempFileNameA(lpTempPathBuffer, "Jit", 0, szTempFileName);
if (uRetVal == 0)
{
@@ -98,16 +101,16 @@ HRESULT JitInstance::StartUp(char * PathToJit, bool copyJit, bool parambreakOnDe
}
dwRetVal = (DWORD)::strlen(szTempFileName);
- //Store the full path to the temp jit
- PathToTempJit = (char *)::HeapAlloc(ourHeap, 0, MAX_PATH);
- if(PathToTempJit == nullptr)
+ // Store the full path to the temp jit
+ PathToTempJit = (char*)::HeapAlloc(ourHeap, 0, MAX_PATH);
+ if (PathToTempJit == nullptr)
{
LogError("2nd HeapAlloc failed 0x%08x)", ::GetLastError());
return E_FAIL;
}
::strcpy_s(PathToTempJit, MAX_PATH, szTempFileName);
- //Copy Temp File
+ // Copy Temp File
bRetVal = ::CopyFileA(PathToOriginalJit, PathToTempJit, FALSE);
if (bRetVal == FALSE)
{
@@ -119,25 +122,25 @@ HRESULT JitInstance::StartUp(char * PathToJit, bool copyJit, bool parambreakOnDe
PathToTempJit = PathToOriginalJit;
#ifndef FEATURE_PAL // No file version APIs in the PAL
- //Do a quick version check
+ // Do a quick version check
DWORD dwHandle = 0;
- DWORD fviSize = GetFileVersionInfoSizeA(PathToTempJit, &dwHandle);
+ DWORD fviSize = GetFileVersionInfoSizeA(PathToTempJit, &dwHandle);
- if ((fviSize != 0)&&(dwHandle==0))
+ if ((fviSize != 0) && (dwHandle == 0))
{
- unsigned char *fviData = new unsigned char[fviSize];
+ unsigned char* fviData = new unsigned char[fviSize];
if (GetFileVersionInfoA(PathToTempJit, dwHandle, fviSize, fviData))
{
- UINT size = 0;
- VS_FIXEDFILEINFO *verInfo = nullptr;
+ UINT size = 0;
+ VS_FIXEDFILEINFO* verInfo = nullptr;
if (VerQueryValueA(fviData, "\\", (LPVOID*)&verInfo, &size))
{
if (size)
{
if (verInfo->dwSignature == 0xfeef04bd)
- LogDebug("'%s' is version %u.%u.%u.%u", PathToTempJit,
- (verInfo->dwFileVersionMS)>>16, (verInfo->dwFileVersionMS)&0xFFFF,
- (verInfo->dwFileVersionLS)>>16, (verInfo->dwFileVersionLS)&0xFFFF);
+ LogDebug("'%s' is version %u.%u.%u.%u", PathToTempJit, (verInfo->dwFileVersionMS) >> 16,
+ (verInfo->dwFileVersionMS) & 0xFFFF, (verInfo->dwFileVersionLS) >> 16,
+ (verInfo->dwFileVersionLS) & 0xFFFF);
}
}
}
@@ -145,43 +148,43 @@ HRESULT JitInstance::StartUp(char * PathToJit, bool copyJit, bool parambreakOnDe
}
#endif // !FEATURE_PAL
-//Load Library
+ // Load Library
hLib = ::LoadLibraryA(PathToTempJit);
- if(hLib == 0)
+ if (hLib == 0)
{
LogError("LoadLibrary failed (0x%08x)", ::GetLastError());
return E_FAIL;
}
-//get entry points
+ // get entry points
pngetJit = (PgetJit)::GetProcAddress(hLib, "getJit");
- if(pngetJit == 0)
+ if (pngetJit == 0)
{
LogError("GetProcAddress 'getJit' failed (0x%08x)", ::GetLastError());
return -1;
}
pnsxsJitStartup = (PsxsJitStartup)::GetProcAddress(hLib, "sxsJitStartup");
- if(pnsxsJitStartup == 0)
+ if (pnsxsJitStartup == 0)
{
LogError("GetProcAddress 'sxsJitStartup' failed (0x%08x)", ::GetLastError());
return -1;
}
pnjitStartup = (PjitStartup)::GetProcAddress(hLib, "jitStartup");
- //Setup CoreClrCallbacks and call sxsJitStartup
- CoreClrCallbacks *cccallbacks = InitCoreClrCallbacks();
+ // Setup CoreClrCallbacks and call sxsJitStartup
+ CoreClrCallbacks* cccallbacks = InitCoreClrCallbacks();
pnsxsJitStartup(*cccallbacks);
// Setup ICorJitHost and call jitStartup if necessary
if (pnjitStartup != nullptr)
{
- mc = firstContext;
+ mc = firstContext;
jitHost = new JitHost(*this);
pnjitStartup(jitHost);
}
pJitInstance = pngetJit();
- if(pJitInstance == nullptr)
+ if (pJitInstance == nullptr)
{
LogError("pngetJit gave us null");
return -1;
@@ -202,7 +205,6 @@ HRESULT JitInstance::StartUp(char * PathToJit, bool copyJit, bool parambreakOnDe
return -1;
}
-
icji = InitICorJitInfo(this);
return S_OK;
@@ -212,43 +214,43 @@ bool JitInstance::reLoad(MethodContext* firstContext)
{
FreeLibrary(hLib);
-//Load Library
+ // Load Library
hLib = ::LoadLibraryA(PathToTempJit);
- if(hLib == 0)
+ if (hLib == 0)
{
LogError("LoadLibrary failed (0x%08x)", ::GetLastError());
return false;
}
-//get entry points
+ // get entry points
pngetJit = (PgetJit)::GetProcAddress(hLib, "getJit");
- if(pngetJit == 0)
+ if (pngetJit == 0)
{
LogError("GetProcAddress 'getJit' failed (0x%08x)", ::GetLastError());
return false;
}
pnsxsJitStartup = (PsxsJitStartup)::GetProcAddress(hLib, "sxsJitStartup");
- if(pnsxsJitStartup == 0)
+ if (pnsxsJitStartup == 0)
{
LogError("GetProcAddress 'sxsJitStartup' failed (0x%08x)", ::GetLastError());
return false;
}
pnjitStartup = (PjitStartup)::GetProcAddress(hLib, "jitStartup");
- //Setup CoreClrCallbacks and call sxsJitStartup
- CoreClrCallbacks *cccallbacks = InitCoreClrCallbacks();
+ // Setup CoreClrCallbacks and call sxsJitStartup
+ CoreClrCallbacks* cccallbacks = InitCoreClrCallbacks();
pnsxsJitStartup(*cccallbacks);
// Setup ICorJitHost and call jitStartup if necessary
if (pnjitStartup != nullptr)
{
- mc = firstContext;
+ mc = firstContext;
jitHost = new JitHost(*this);
pnjitStartup(jitHost);
}
pJitInstance = pngetJit();
- if(pJitInstance == nullptr)
+ if (pJitInstance == nullptr)
{
LogError("pngetJit gave us null");
return false;
@@ -259,7 +261,7 @@ bool JitInstance::reLoad(MethodContext* firstContext)
return true;
}
-JitInstance::Result JitInstance::CompileMethod(MethodContext *MethodToCompile, int mcIndex, bool collectThroughput)
+JitInstance::Result JitInstance::CompileMethod(MethodContext* MethodToCompile, int mcIndex, bool collectThroughput)
{
struct Param : FilterSuperPMIExceptionsParam_CaptureException
{
@@ -270,24 +272,24 @@ JitInstance::Result JitInstance::CompileMethod(MethodContext *MethodToCompile, i
int mcIndex;
bool collectThroughput;
} param;
- param.pThis = this;
- param.result = RESULT_SUCCESS; // assume success
- param.flags = 0;
- param.mcIndex = mcIndex;
+ param.pThis = this;
+ param.result = RESULT_SUCCESS; // assume success
+ param.flags = 0;
+ param.mcIndex = mcIndex;
param.collectThroughput = collectThroughput;
- //store to instance field our raw values, so we can figure things out a bit later...
+ // store to instance field our raw values, so we can figure things out a bit later...
mc = MethodToCompile;
times[0] = 0;
times[1] = 0;
- mc->repEnvironmentSet(); //Sets envvars
+ mc->repEnvironmentSet(); // Sets envvars
stj.Start();
PAL_TRY(Param*, pParam, &param)
{
- BYTE *NEntryBlock = nullptr;
+ BYTE* NEntryBlock = nullptr;
ULONG NCodeSizeBlock = 0;
pParam->pThis->mc->repCompileMethod(&pParam->info, &pParam->flags);
@@ -295,7 +297,8 @@ JitInstance::Result JitInstance::CompileMethod(MethodContext *MethodToCompile, i
{
pParam->pThis->lt.Start();
}
- CorJitResult temp = pParam->pThis->pJitInstance->compileMethod(pParam->pThis->icji, &pParam->info, pParam->flags, &NEntryBlock, &NCodeSizeBlock);
+ CorJitResult temp = pParam->pThis->pJitInstance->compileMethod(pParam->pThis->icji, &pParam->info,
+ pParam->flags, &NEntryBlock, &NCodeSizeBlock);
if (pParam->collectThroughput)
{
pParam->pThis->lt.Stop();
@@ -308,7 +311,7 @@ JitInstance::Result JitInstance::CompileMethod(MethodContext *MethodToCompile, i
}
if (temp == CORJIT_OK)
{
- //capture the results of compilation
+ // capture the results of compilation
pParam->pThis->mc->cr->recCompileMethod(&NEntryBlock, &NCodeSizeBlock, temp);
pParam->pThis->mc->cr->recAllocMemCapture();
pParam->pThis->mc->cr->recAllocGCInfoCapture();
@@ -327,7 +330,7 @@ JitInstance::Result JitInstance::CompileMethod(MethodContext *MethodToCompile, i
if (e.GetCode() == EXCEPTIONCODE_MC)
{
- char *message = e.GetExceptionMessage();
+ char* message = e.GetExceptionMessage();
LogMissing("Method context %d failed to replay: %s", mcIndex, message);
e.DeleteMessage();
param.result = RESULT_MISSING;
@@ -346,7 +349,7 @@ JitInstance::Result JitInstance::CompileMethod(MethodContext *MethodToCompile, i
// If we get here, we know it compiles
timeResult(param.info, param.flags);
}
- mc->repEnvironmentUnset(); //Unsets envvars
+ mc->repEnvironmentUnset(); // Unsets envvars
mc->cr->secondsToCompile = stj.GetSeconds();
@@ -355,7 +358,7 @@ JitInstance::Result JitInstance::CompileMethod(MethodContext *MethodToCompile, i
void JitInstance::timeResult(CORINFO_METHOD_INFO info, unsigned flags)
{
- BYTE *NEntryBlock = nullptr;
+ BYTE* NEntryBlock = nullptr;
ULONG NCodeSizeBlock = 0;
int sampleSize = 10;
@@ -398,39 +401,31 @@ void JitInstance::timeResult(CORINFO_METHOD_INFO info, unsigned flags)
// 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 * JitInstance::allocateArray(
- ULONG cBytes
- )
+void* JitInstance::allocateArray(ULONG cBytes)
{
mc->cr->AddCall("allocateArray");
- return HeapAlloc(mc->cr->getCodeHeap(),0,cBytes);
+ return HeapAlloc(mc->cr->getCodeHeap(), 0, cBytes);
}
// Used to allocate memory that needs to live as long as the jit
// instance does.
-void * JitInstance::allocateLongLivedArray(
- ULONG cBytes
- )
+void* JitInstance::allocateLongLivedArray(ULONG cBytes)
{
- return HeapAlloc(ourHeap,0,cBytes);
+ return HeapAlloc(ourHeap, 0, 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 JitInstance::freeArray(
- void *array
- )
+void JitInstance::freeArray(void* array)
{
mc->cr->AddCall("freeArray");
- HeapFree(mc->cr->getCodeHeap(),0,array);
+ HeapFree(mc->cr->getCodeHeap(), 0, array);
}
// Used to free memory allocated by JitInstance::allocateLongLivedArray.
-void JitInstance::freeLongLivedArray(
- void *array
- )
+void JitInstance::freeLongLivedArray(void* array)
{
- HeapFree(ourHeap,0,array);
+ HeapFree(ourHeap, 0, array);
}
diff --git a/src/ToolBox/superpmi/superpmi/jitinstance.h b/src/ToolBox/superpmi/superpmi/jitinstance.h
index c85c2f5bee..9db17dc1ad 100644
--- a/src/ToolBox/superpmi/superpmi/jitinstance.h
+++ b/src/ToolBox/superpmi/superpmi/jitinstance.h
@@ -14,18 +14,18 @@
class JitInstance
{
private:
- char *PathToOriginalJit;
- char *PathToTempJit;
- HANDLE ourHeap;
- HMODULE hLib;
- PgetJit pngetJit;
- PjitStartup pnjitStartup;
+ char* PathToOriginalJit;
+ char* PathToTempJit;
+ HANDLE ourHeap;
+ HMODULE hLib;
+ PgetJit pngetJit;
+ PjitStartup pnjitStartup;
PsxsJitStartup pnsxsJitStartup;
- ICorJitHost *jitHost;
- ICorJitInfo *icji;
- SimpleTimer stj;
+ ICorJitHost* jitHost;
+ ICorJitInfo* icji;
+ SimpleTimer stj;
- JitInstance() {};
+ JitInstance(){};
void timeResult(CORINFO_METHOD_INFO info, unsigned flags);
public:
@@ -35,18 +35,18 @@ public:
RESULT_SUCCESS,
RESULT_MISSING
};
- CycleTimer lt;
- MethodContext *mc;
- ULONGLONG times[2];
- ICorJitCompiler *pJitInstance;
+ CycleTimer lt;
+ MethodContext* mc;
+ ULONGLONG times[2];
+ ICorJitCompiler* pJitInstance;
// Allocate and initialize the jit provided
- static JitInstance *InitJit(char *nameOfJit, bool breakOnAssert, SimpleTimer *st1, MethodContext* firstContext);
+ static JitInstance* InitJit(char* nameOfJit, bool breakOnAssert, SimpleTimer* st1, MethodContext* firstContext);
- HRESULT StartUp(char *PathToJit, bool copyJit, bool breakOnDebugBreakorAV, MethodContext* firstContext);
+ HRESULT StartUp(char* PathToJit, bool copyJit, bool breakOnDebugBreakorAV, MethodContext* firstContext);
bool reLoad(MethodContext* firstContext);
- Result CompileMethod(MethodContext *MethodToCompile, int mcIndex, bool collectThroughput);
+ Result CompileMethod(MethodContext* MethodToCompile, int mcIndex, bool collectThroughput);
void* allocateArray(ULONG size);
void* allocateLongLivedArray(ULONG size);
diff --git a/src/ToolBox/superpmi/superpmi/methodstatsemitter.cpp b/src/ToolBox/superpmi/superpmi/methodstatsemitter.cpp
index 5cebc97db4..2ca1adf0cf 100644
--- a/src/ToolBox/superpmi/superpmi/methodstatsemitter.cpp
+++ b/src/ToolBox/superpmi/superpmi/methodstatsemitter.cpp
@@ -11,12 +11,13 @@
#include "methodstatsemitter.h"
#include "logging.h"
-MethodStatsEmitter::MethodStatsEmitter(char *nameOfInput)
+MethodStatsEmitter::MethodStatsEmitter(char* nameOfInput)
{
char filename[MAX_PATH + 1];
sprintf_s(filename, MAX_PATH + 1, "%s.stats", nameOfInput);
- hStatsFile = CreateFileA(filename, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+ hStatsFile =
+ CreateFileA(filename, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (hStatsFile == INVALID_HANDLE_VALUE)
{
LogError("Failed to open output file '%s'. GetLastError()=%u", filename, GetLastError());
@@ -34,18 +35,18 @@ MethodStatsEmitter::~MethodStatsEmitter()
}
}
-void MethodStatsEmitter::Emit(int methodNumber, MethodContext *mc, ULONGLONG firstTime, ULONGLONG secondTime)
+void MethodStatsEmitter::Emit(int methodNumber, MethodContext* mc, ULONGLONG firstTime, ULONGLONG secondTime)
{
if (hStatsFile != INVALID_HANDLE_VALUE)
{
- //Print the CSV header row
- char rowData[2048];
- DWORD charCount = 0;
+ // Print the CSV header row
+ char rowData[2048];
+ DWORD charCount = 0;
DWORD bytesWritten = 0;
if (strchr(statsTypes, '*') != NULL || strchr(statsTypes, 'h') != NULL || strchr(statsTypes, 'H') != NULL)
{
- //Obtain the method Hash
+ // Obtain the method Hash
char md5Hash[MD5_HASH_BUFFER_SIZE];
if (mc->dumpMethodMD5HashToBuffer(md5Hash, MD5_HASH_BUFFER_SIZE) != MD5_HASH_BUFFER_SIZE)
md5Hash[0] = 0;
@@ -58,32 +59,33 @@ void MethodStatsEmitter::Emit(int methodNumber, MethodContext *mc, ULONGLONG fir
}
if (strchr(statsTypes, '*') != NULL || strchr(statsTypes, 'i') != NULL || strchr(statsTypes, 'I') != NULL)
{
- //Obtain the IL code size for this method
+ // Obtain the IL code size for this method
CORINFO_METHOD_INFO info;
- unsigned flags = 0;
+ unsigned flags = 0;
mc->repCompileMethod(&info, &flags);
charCount += sprintf_s(rowData + charCount, _countof(rowData) - charCount, "%d,", info.ILCodeSize);
}
if (strchr(statsTypes, '*') != NULL || strchr(statsTypes, 'a') != NULL || strchr(statsTypes, 'A') != NULL)
{
- //Obtain the compiled method ASM size
- BYTE *temp;
- DWORD codeSize;
+ // Obtain the compiled method ASM size
+ BYTE* temp;
+ DWORD codeSize;
CorJitResult result;
if (mc->cr->CompileMethod != nullptr)
mc->cr->repCompileMethod(&temp, &codeSize, &result);
else
- codeSize = 0;//this is likely a thin mc
+ codeSize = 0; // this is likely a thin mc
charCount += sprintf_s(rowData + charCount, _countof(rowData) - charCount, "%d,", codeSize);
}
if (strchr(statsTypes, '*') != NULL || strchr(statsTypes, 't') != NULL || strchr(statsTypes, 'T') != NULL)
{
- charCount += sprintf_s(rowData + charCount, _countof(rowData) - charCount, "%llu,%llu,", firstTime, secondTime);
+ charCount +=
+ sprintf_s(rowData + charCount, _countof(rowData) - charCount, "%llu,%llu,", firstTime, secondTime);
}
- //get rid of the final ',' and replace it with a '\n'
+ // get rid of the final ',' and replace it with a '\n'
rowData[charCount - 1] = '\n';
if (!WriteFile(hStatsFile, rowData, charCount, &bytesWritten, nullptr) || bytesWritten != charCount)
@@ -93,15 +95,15 @@ void MethodStatsEmitter::Emit(int methodNumber, MethodContext *mc, ULONGLONG fir
}
}
-void MethodStatsEmitter::SetStatsTypes(char *types)
+void MethodStatsEmitter::SetStatsTypes(char* types)
{
statsTypes = types;
if (hStatsFile != INVALID_HANDLE_VALUE)
{
- //Print the CSV header row
- char rowHeader[1024];
- DWORD charCount = 0;
+ // Print the CSV header row
+ char rowHeader[1024];
+ DWORD charCount = 0;
DWORD bytesWritten = 0;
if (strchr(statsTypes, '*') != NULL || strchr(statsTypes, 'h') != NULL || strchr(statsTypes, 'H') != NULL)
@@ -115,7 +117,7 @@ void MethodStatsEmitter::SetStatsTypes(char *types)
if (strchr(statsTypes, '*') != NULL || strchr(statsTypes, 't') != NULL || strchr(statsTypes, 'T') != NULL)
charCount += sprintf_s(rowHeader + charCount, _countof(rowHeader) - charCount, "Time1,Time2,");
- //get rid of the final ',' and replace it with a '\n'
+ // get rid of the final ',' and replace it with a '\n'
rowHeader[charCount - 1] = '\n';
if (!WriteFile(hStatsFile, rowHeader, charCount, &bytesWritten, nullptr) || bytesWritten != charCount)
diff --git a/src/ToolBox/superpmi/superpmi/methodstatsemitter.h b/src/ToolBox/superpmi/superpmi/methodstatsemitter.h
index fb651b04b2..7b03ddeea5 100644
--- a/src/ToolBox/superpmi/superpmi/methodstatsemitter.h
+++ b/src/ToolBox/superpmi/superpmi/methodstatsemitter.h
@@ -16,14 +16,14 @@ class MethodStatsEmitter
{
private:
- char *statsTypes;
+ char* statsTypes;
HANDLE hStatsFile;
public:
- MethodStatsEmitter(char *nameOfInput);
+ MethodStatsEmitter(char* nameOfInput);
~MethodStatsEmitter();
- void Emit(int methodNumber, MethodContext *mc, ULONGLONG firstTime, ULONGLONG secondTime);
- void SetStatsTypes(char *types);
+ void Emit(int methodNumber, MethodContext* mc, ULONGLONG firstTime, ULONGLONG secondTime);
+ void SetStatsTypes(char* types);
};
#endif \ No newline at end of file
diff --git a/src/ToolBox/superpmi/superpmi/neardiffer.cpp b/src/ToolBox/superpmi/superpmi/neardiffer.cpp
index 3f2c4db3b8..d3ccae5ccc 100644
--- a/src/ToolBox/superpmi/superpmi/neardiffer.cpp
+++ b/src/ToolBox/superpmi/superpmi/neardiffer.cpp
@@ -23,25 +23,28 @@
// The file/linenumber information is from this helper itself,
// since we are only linking with the CoreDisTools library.
//
-static void LogFromCoreDisToolsHelper(LogLevel level, const char *msg, va_list argList)
+static void LogFromCoreDisToolsHelper(LogLevel level, const char* msg, va_list argList)
{
Logger::LogVprintf(__func__, __FILE__, __LINE__, level, argList, msg);
}
-#define LOGGER(L) \
-static void Log##L(const char *msg, ...) \
-{\
- va_list argList; \
- va_start(argList, msg); \
- LogFromCoreDisToolsHelper (LOGLEVEL_##L, msg, argList); \
- va_end(argList); \
+#define LOGGER(L) \
+ \
+static void Log##L(const char* msg, ...) \
+ \
+{ \
+ va_list argList; \
+ va_start(argList, msg); \
+ LogFromCoreDisToolsHelper(LOGLEVEL_##L, msg, argList); \
+ va_end(argList); \
+ \
}
LOGGER(VERBOSE)
LOGGER(ERROR)
LOGGER(WARNING)
-const PrintControl CorPrinter= { LogERROR, LogWARNING, LogVERBOSE, LogVERBOSE };
+const PrintControl CorPrinter = {LogERROR, LogWARNING, LogVERBOSE, LogVERBOSE};
#endif // USE_COREDISTOOLS
@@ -64,7 +67,7 @@ void NearDiffer::InitAsmDiff()
NearDiffer::~NearDiffer()
{
#ifdef USE_COREDISTOOLS
- if (corAsmDiff != nullptr)
+ if (corAsmDiff != nullptr)
{
FinishDiff(corAsmDiff);
}
@@ -94,7 +97,7 @@ NearDiffer::~NearDiffer()
DIS* NearDiffer::GetMsVcDis()
{
- DIS *disasm;
+ DIS* disasm;
#ifdef _TARGET_AMD64_
if ((TargetArchitecture != nullptr) && (0 == _stricmp(TargetArchitecture, "arm64")))
@@ -126,43 +129,44 @@ DIS* NearDiffer::GetMsVcDis()
// blocksize - The size of the code block to disassemble.
// originalAddr - The original base address of the code block.
//
-void NearDiffer::DumpCodeBlock(unsigned char *block, ULONG blocksize, void *originalAddr)
+void NearDiffer::DumpCodeBlock(unsigned char* block, ULONG blocksize, void* originalAddr)
{
-#ifdef USE_MSVCDIS
- DIS *disasm = GetMsVcDis();
- size_t offset = 0;
+#ifdef USE_MSVCDIS
+ DIS* disasm = GetMsVcDis();
+ size_t offset = 0;
std::string codeBlock;
while (offset < blocksize)
{
DIS::INSTRUCTION instr;
- DIS::OPERAND ops[3];
+ DIS::OPERAND ops[3];
- size_t instrSize = disasm->CbDisassemble((DIS::ADDR)originalAddr + offset, (void *)(block + offset), 15);
- if(instrSize==0)
+ size_t instrSize = disasm->CbDisassemble((DIS::ADDR)originalAddr + offset, (void*)(block + offset), 15);
+ if (instrSize == 0)
{
LogWarning("Zero sized instruction");
break;
}
disasm->FDecode(&instr, ops, 3);
- wchar_t instrMnemonicWide[64]; // I never know how much to allocate...
+ wchar_t instrMnemonicWide[64]; // I never know how much to allocate...
disasm->CchFormatInstr(instrMnemonicWide, 64);
- char instrMnemonic[128];
+ char instrMnemonic[128];
size_t count;
wcstombs_s(&count, instrMnemonic, 128, instrMnemonicWide, 64);
const size_t minInstrBytes = 7;
- size_t instrBytes = max(instrSize, minInstrBytes);
- size_t buffSize = sizeof("%p %s\n") + 10 + count + 3 * instrBytes + 1;
- char *buff = new char[buffSize];
- int written = 0;
- written += sprintf_s(buff, buffSize, "%p ", (void*)((size_t)originalAddr+offset));
+ size_t instrBytes = max(instrSize, minInstrBytes);
+ size_t buffSize = sizeof("%p %s\n") + 10 + count + 3 * instrBytes + 1;
+ char* buff = new char[buffSize];
+ int written = 0;
+ written += sprintf_s(buff, buffSize, "%p ", (void*)((size_t)originalAddr + offset));
for (size_t i = 0; i < instrBytes; i++)
{
if (i < instrSize)
{
- written += sprintf_s(buff + written, buffSize - written, "%02X ", *(const uint8_t*)(block + offset + i));
+ written +=
+ sprintf_s(buff + written, buffSize - written, "%02X ", *(const uint8_t*)(block + offset + i));
}
else
{
@@ -176,7 +180,7 @@ void NearDiffer::DumpCodeBlock(unsigned char *block, ULONG blocksize, void *orig
}
LogVerbose("Code dump:\n%s", codeBlock.c_str());
delete disasm;
-#else // !USE_MSVCDIS
+#else // !USE_MSVCDIS
LogVerbose("No disassembler");
#endif // !USE_MSVCDIS
}
@@ -187,7 +191,7 @@ void NearDiffer::DumpCodeBlock(unsigned char *block, ULONG blocksize, void *orig
struct DiffData
{
// Common Data
- CompileResult *cr;
+ CompileResult* cr;
// Details of the first block
size_t blocksize1;
@@ -213,11 +217,8 @@ struct DiffData
// Determine whether two syntactically different constants are
// semantically equivalent, using certain heuristics.
//
-bool NearDiffer::compareOffsets(const void *payload,
- size_t blockOffset,
- size_t instrLen,
- uint64_t offset1,
- uint64_t offset2)
+bool NearDiffer::compareOffsets(
+ const void* payload, size_t blockOffset, size_t instrLen, uint64_t offset1, uint64_t offset2)
{
// The trivial case
if (offset1 == offset2)
@@ -225,91 +226,94 @@ bool NearDiffer::compareOffsets(const void *payload,
return true;
}
- const DiffData *data = (const DiffData *)payload;
- size_t ip1 = data->originalBlock1 + blockOffset;
- size_t ip2 = data->originalBlock2 + blockOffset;
- size_t ipRelOffset1 = ip1 + instrLen + (size_t)offset1;
- size_t ipRelOffset2 = ip2 + instrLen + (size_t)offset2;
+ const DiffData* data = (const DiffData*)payload;
+ size_t ip1 = data->originalBlock1 + blockOffset;
+ size_t ip2 = data->originalBlock2 + blockOffset;
+ size_t ipRelOffset1 = ip1 + instrLen + (size_t)offset1;
+ size_t ipRelOffset2 = ip2 + instrLen + (size_t)offset2;
// Case where we have a call into flat address -- the most common case.
size_t gOffset1 = ipRelOffset1;
size_t gOffset2 = ipRelOffset2;
- if ((DWORD)gOffset1 == (DWORD)gOffset2) //make sure the lower 32bits match (best we can do in the current replay form)
+ if ((DWORD)gOffset1 ==
+ (DWORD)gOffset2) // make sure the lower 32bits match (best we can do in the current replay form)
return true;
- //Case where we have an offset into the read only section (e.g. loading a float value)
+ // Case where we have an offset into the read only section (e.g. loading a float value)
size_t roOffset1a = (size_t)offset1 - data->originalDataBlock1;
size_t roOffset2a = (size_t)offset2 - data->originalDataBlock2;
- if ((roOffset1a == roOffset2a) && (roOffset1a < data->datablockSize1)) //Confirm its an offset that fits inside our RoRegion
+ if ((roOffset1a == roOffset2a) &&
+ (roOffset1a < data->datablockSize1)) // Confirm its an offset that fits inside our RoRegion
return true;
// This case is written to catch IP-relative offsets to the RO data-section
// For example:
- //
+ //
size_t roOffset1b = ipRelOffset1 - data->originalDataBlock1;
size_t roOffset2b = ipRelOffset2 - data->originalDataBlock2;
- if ((roOffset1b == roOffset2b) && (roOffset1b < data->datablockSize1)) //Confirm its an offset that fits inside our RoRegion
+ if ((roOffset1b == roOffset2b) &&
+ (roOffset1b < data->datablockSize1)) // Confirm its an offset that fits inside our RoRegion
return true;
- //Case where we push an address to our own code section.
+ // Case where we push an address to our own code section.
size_t gOffset1a = (size_t)offset1 - data->originalBlock1;
size_t gOffset2a = (size_t)offset2 - data->originalBlock2;
- if ((gOffset1a == gOffset2a) && (gOffset1a < data->blocksize1)) //Confirm its in our code region
+ if ((gOffset1a == gOffset2a) && (gOffset1a < data->blocksize1)) // Confirm its in our code region
return true;
- //Case where we push an address in the other codeblock.
+ // Case where we push an address in the other codeblock.
size_t gOffset1b = (size_t)offset1 - data->otherCodeBlock1;
size_t gOffset2b = (size_t)offset2 - data->otherCodeBlock2;
- if ((gOffset1b == gOffset2b) && (gOffset1b < data->otherCodeBlockSize1)) //Confirm it's in the other code region
+ if ((gOffset1b == gOffset2b) && (gOffset1b < data->otherCodeBlockSize1)) // Confirm it's in the other code region
return true;
- //Case where we have an offset into the hot codeblock from the cold code block (why?)
+ // Case where we have an offset into the hot codeblock from the cold code block (why?)
size_t ocOffset1 = ipRelOffset1 - data->otherCodeBlock1;
size_t ocOffset2 = ipRelOffset2 - data->otherCodeBlock2;
- if (ocOffset1 == ocOffset2) //Would be nice to check to see if it fits in the other code block
+ if (ocOffset1 == ocOffset2) // Would be nice to check to see if it fits in the other code block
return true;
- //VSD calling case.
+ // VSD calling case.
size_t Offset1 = (ipRelOffset1 - 8);
if (data->cr->CallTargetTypes->GetIndex((DWORDLONG)Offset1) != (DWORD)-1)
{
// This logging is too noisy, so disable it.
- //LogVerbose("Found VSD callsite, did softer compare than ideal");
+ //LogVerbose("Found VSD callsite, did softer compare than ideal");
return true;
}
- //x86 VSD calling cases.
+ // x86 VSD calling cases.
size_t Offset1b = (size_t)offset1 - 4;
size_t Offset2b = (size_t)offset2;
if (data->cr->CallTargetTypes->GetIndex((DWORDLONG)Offset1b) != (DWORD)-1)
{
// This logging is too noisy, so disable it.
- //LogVerbose("Found VSD callsite, did softer compare than ideal");
+ //LogVerbose("Found VSD callsite, did softer compare than ideal");
return true;
}
if (data->cr->CallTargetTypes->GetIndex((DWORDLONG)Offset2b) != (DWORD)-1)
{
// This logging is too noisy, so disable it.
- //LogVerbose("Found VSD callsite, did softer compare than ideal");
+ //LogVerbose("Found VSD callsite, did softer compare than ideal");
return true;
}
- //Case might be a field address that we handed out to handle inlined values being loaded into
- //a register as an immediate value (and where the address is encoded as an indirect immediate load)
+ // Case might be a field address that we handed out to handle inlined values being loaded into
+ //a register as an immediate value (and where the address is encoded as an indirect immediate load)
size_t realTargetAddr = (size_t)data->cr->searchAddressMap((void*)gOffset2);
if (realTargetAddr == gOffset1)
return true;
- //Case might be a field address that we handed out to handle inlined values being loaded into
- //a register as an immediate value (and where the address is encoded and loaded by immediate into a register)
+ // Case might be a field address that we handed out to handle inlined values being loaded into
+ //a register as an immediate value (and where the address is encoded and loaded by immediate into a register)
realTargetAddr = (size_t)data->cr->searchAddressMap((void*)offset2);
if (realTargetAddr == offset1)
return true;
- if (realTargetAddr == 0x424242)//this offset matches what we got back from a getTailCallCopyArgsThunk
+ if (realTargetAddr == 0x424242) // this offset matches what we got back from a getTailCallCopyArgsThunk
return true;
realTargetAddr = (size_t)data->cr->searchAddressMap((void*)(gOffset2));
- if (realTargetAddr != -1) //we know this was passed out as a bbloc
+ if (realTargetAddr != -1) // we know this was passed out as a bbloc
return true;
return false;
@@ -366,72 +370,56 @@ bool NearDiffer::compareOffsets(const void *payload,
// True if the code sections are syntactically identical; false otherwise.
//
-bool NearDiffer::compareCodeSection(
- MethodContext *mc,
- CompileResult *cr1,
- CompileResult *cr2,
- unsigned char *block1,
- ULONG blocksize1,
- unsigned char *datablock1,
- ULONG datablockSize1,
- void *originalBlock1,
- void *originalDataBlock1,
- void *otherCodeBlock1,
- ULONG otherCodeBlockSize1,
- unsigned char *block2,
- ULONG blocksize2,
- unsigned char *datablock2,
- ULONG datablockSize2,
- void *originalBlock2,
- void *originalDataBlock2,
- void *otherCodeBlock2,
- ULONG otherCodeBlockSize2)
+bool NearDiffer::compareCodeSection(MethodContext* mc,
+ CompileResult* cr1,
+ CompileResult* cr2,
+ unsigned char* block1,
+ ULONG blocksize1,
+ unsigned char* datablock1,
+ ULONG datablockSize1,
+ void* originalBlock1,
+ void* originalDataBlock1,
+ void* otherCodeBlock1,
+ ULONG otherCodeBlockSize1,
+ unsigned char* block2,
+ ULONG blocksize2,
+ unsigned char* datablock2,
+ ULONG datablockSize2,
+ void* originalBlock2,
+ void* originalDataBlock2,
+ void* otherCodeBlock2,
+ ULONG otherCodeBlockSize2)
{
- DiffData data =
- {
- cr2,
-
- // Details of the first block
- (size_t)blocksize1,
- (size_t)datablock1,
- (size_t)datablockSize1,
- (size_t)originalBlock1,
- (size_t)originalDataBlock1,
- (size_t)otherCodeBlock1,
- (size_t)otherCodeBlockSize1,
-
- // Details of the second block
- (size_t)blocksize2,
- (size_t)datablock2,
- (size_t)datablockSize2,
- (size_t)originalBlock2,
- (size_t)originalDataBlock2,
- (size_t)otherCodeBlock2,
- (size_t)otherCodeBlockSize2
- };
+ DiffData data = {cr2,
+
+ // Details of the first block
+ (size_t)blocksize1, (size_t)datablock1, (size_t)datablockSize1, (size_t)originalBlock1,
+ (size_t)originalDataBlock1, (size_t)otherCodeBlock1, (size_t)otherCodeBlockSize1,
+
+ // Details of the second block
+ (size_t)blocksize2, (size_t)datablock2, (size_t)datablockSize2, (size_t)originalBlock2,
+ (size_t)originalDataBlock2, (size_t)otherCodeBlock2, (size_t)otherCodeBlockSize2};
#ifdef USE_COREDISTOOLS
- if (UseCoreDisTools)
+ if (UseCoreDisTools)
{
- bool areSame = NearDiffCodeBlocks(corAsmDiff, &data,
- (const uint8_t *)originalBlock1, block1, blocksize1,
- (const uint8_t *)originalBlock2, block2, blocksize2);
+ bool areSame = NearDiffCodeBlocks(corAsmDiff, &data, (const uint8_t*)originalBlock1, block1, blocksize1,
+ (const uint8_t*)originalBlock2, block2, blocksize2);
- if (!areSame)
+ if (!areSame)
{
- DumpDiffBlocks(corAsmDiff, (const uint8_t *) originalBlock1,
- block1, blocksize1, (const uint8_t *) originalBlock2,
- block2, blocksize2);
+ DumpDiffBlocks(corAsmDiff, (const uint8_t*)originalBlock1, block1, blocksize1,
+ (const uint8_t*)originalBlock2, block2, blocksize2);
}
return areSame;
}
#endif // USE_COREDISTOOLS
-#ifdef USE_MSVCDIS
+#ifdef USE_MSVCDIS
bool haveSeenRet = false;
- DIS *disasm_1 = GetMsVcDis();
- DIS *disasm_2 = GetMsVcDis();
+ DIS* disasm_1 = GetMsVcDis();
+ DIS* disasm_2 = GetMsVcDis();
size_t offset = 0;
@@ -445,9 +433,9 @@ bool NearDiffer::compareCodeSection(
{
DIS::INSTRUCTION instr_1;
DIS::INSTRUCTION instr_2;
- const int MaxOperandCount = 5;
- DIS::OPERAND ops_1[MaxOperandCount];
- DIS::OPERAND ops_2[MaxOperandCount];
+ const int MaxOperandCount = 5;
+ DIS::OPERAND ops_1[MaxOperandCount];
+ DIS::OPERAND ops_2[MaxOperandCount];
// Zero out the locals, just in case.
memset(&instr_1, 0, sizeof(instr_1));
@@ -455,8 +443,8 @@ bool NearDiffer::compareCodeSection(
memset(&ops_1, 0, sizeof(ops_1));
memset(&ops_2, 0, sizeof(ops_2));
- size_t instrSize_1 = disasm_1->CbDisassemble((DIS::ADDR)originalBlock1 + offset, (void *)(block1 + offset), 15);
- size_t instrSize_2 = disasm_2->CbDisassemble((DIS::ADDR)originalBlock2 + offset, (void *)(block2 + offset), 15);
+ size_t instrSize_1 = disasm_1->CbDisassemble((DIS::ADDR)originalBlock1 + offset, (void*)(block1 + offset), 15);
+ size_t instrSize_2 = disasm_2->CbDisassemble((DIS::ADDR)originalBlock2 + offset, (void*)(block2 + offset), 15);
if (instrSize_1 != instrSize_2)
{
@@ -468,7 +456,7 @@ bool NearDiffer::compareCodeSection(
if (haveSeenRet)
{
// This logging is pretty noisy, so disable it.
- //LogVerbose("instruction size of zero after seeing a ret (soft issue?).");
+ //LogVerbose("instruction size of zero after seeing a ret (soft issue?).");
break;
}
LogWarning("instruction size of zero.");
@@ -487,9 +475,9 @@ bool NearDiffer::compareCodeSection(
FDecodeError = true;
}
- wchar_t instrMnemonic_1[64]; // I never know how much to allocate...
+ wchar_t instrMnemonic_1[64]; // I never know how much to allocate...
disasm_1->CchFormatInstr(instrMnemonic_1, 64);
- wchar_t instrMnemonic_2[64]; // I never know how much to allocate...
+ wchar_t instrMnemonic_2[64]; // I never know how much to allocate...
disasm_2->CchFormatInstr(instrMnemonic_2, 64);
if (wcscmp(instrMnemonic_1, L"ret") == 0)
haveSeenRet = true;
@@ -576,11 +564,11 @@ bool NearDiffer::compareCodeSection(
// 0F 2E 05 67 00 9A FD ucomiss xmm0, dword ptr[FFFFFFFFFD9A006Eh]
//
- if (compareOffsets(&data, offset, 0, ops_1[i].dwl, ops_2[i].dwl))
+ if (compareOffsets(&data, offset, 0, ops_1[i].dwl, ops_2[i].dwl))
{
continue;
}
- else
+ else
{
size_t gOffset1 = (size_t)originalBlock1 + offset + (size_t)ops_1[i].dwl;
size_t gOffset2 = (size_t)originalBlock2 + offset + (size_t)ops_2[i].dwl;
@@ -610,16 +598,16 @@ bool NearDiffer::compareCodeSection(
DumpDetails:
LogVerbose("block1 %p", block1);
LogVerbose("block2 %p", block2);
- LogVerbose("originalBlock1 [%p,%p)", originalBlock1, (const uint8_t *)originalBlock1 + blocksize1);
- LogVerbose("originalBlock2 [%p,%p)", originalBlock2, (const uint8_t *)originalBlock2 + blocksize2);
+ LogVerbose("originalBlock1 [%p,%p)", originalBlock1, (const uint8_t*)originalBlock1 + blocksize1);
+ LogVerbose("originalBlock2 [%p,%p)", originalBlock2, (const uint8_t*)originalBlock2 + blocksize2);
LogVerbose("blocksize1 %08X", blocksize1);
LogVerbose("blocksize2 %08X", blocksize2);
- LogVerbose("dataBlock1 [%p,%p)", originalDataBlock1, (const uint8_t *)originalDataBlock1 + datablockSize1);
- LogVerbose("dataBlock2 [%p,%p)", originalDataBlock2, (const uint8_t *)originalDataBlock2 + datablockSize2);
+ LogVerbose("dataBlock1 [%p,%p)", originalDataBlock1, (const uint8_t*)originalDataBlock1 + datablockSize1);
+ LogVerbose("dataBlock2 [%p,%p)", originalDataBlock2, (const uint8_t*)originalDataBlock2 + datablockSize2);
LogVerbose("datablockSize1 %08X", datablockSize1);
LogVerbose("datablockSize2 %08X", datablockSize2);
- LogVerbose("otherCodeBlock1 [%p,%p)", otherCodeBlock1, (const uint8_t *)otherCodeBlock1 + otherCodeBlockSize1);
- LogVerbose("otherCodeBlock2 [%p,%p)", otherCodeBlock2, (const uint8_t *)otherCodeBlock2 + otherCodeBlockSize2);
+ LogVerbose("otherCodeBlock1 [%p,%p)", otherCodeBlock1, (const uint8_t*)otherCodeBlock1 + otherCodeBlockSize1);
+ LogVerbose("otherCodeBlock2 [%p,%p)", otherCodeBlock2, (const uint8_t*)otherCodeBlock2 + otherCodeBlockSize2);
LogVerbose("otherCodeBlockSize1 %08X", otherCodeBlockSize1);
LogVerbose("otherCodeBlockSize2 %08X", otherCodeBlockSize2);
@@ -643,7 +631,7 @@ DumpDetails:
if (disasm_2 != nullptr)
delete disasm_2;
return false;
-#else // !USE_MSVCDIS
+#else // !USE_MSVCDIS
return false; // No disassembler; assume there are differences
#endif // !USE_MSVCDIS
}
@@ -665,21 +653,28 @@ DumpDetails:
// Return Value:
// True if the read-only data sections are identical; false otherwise.
//
-bool NearDiffer::compareReadOnlyDataBlock(MethodContext *mc, CompileResult *cr1, CompileResult *cr2,
- unsigned char *block1, ULONG blocksize1, void *originalDataBlock1,
- unsigned char *block2, ULONG blocksize2, void *originalDataBlock2)
+bool NearDiffer::compareReadOnlyDataBlock(MethodContext* mc,
+ CompileResult* cr1,
+ CompileResult* cr2,
+ unsigned char* block1,
+ ULONG blocksize1,
+ void* originalDataBlock1,
+ unsigned char* block2,
+ ULONG blocksize2,
+ void* originalDataBlock2)
{
- //no rodata
- if(blocksize1==0 && blocksize2==0)
+ // no rodata
+ if (blocksize1 == 0 && blocksize2 == 0)
return true;
- if(blocksize1!=blocksize2)
+ if (blocksize1 != blocksize2)
{
LogVerbose("compareReadOnlyDataBlock found non-matching sizes %u %u", blocksize1, blocksize2);
return false;
}
- //TODO-Cleanup: The values on the datablock seem to wobble. Need further investigation to evaluate a good near comparison for these
+ // TODO-Cleanup: The values on the datablock seem to wobble. Need further investigation to evaluate a good near
+ // comparison for these
return true;
}
@@ -694,7 +689,7 @@ bool NearDiffer::compareReadOnlyDataBlock(MethodContext *mc, CompileResult *cr1,
// Return Value:
// True if the EH info blocks are identical; false otherwise.
//
-bool NearDiffer::compareEHInfo(MethodContext *mc, CompileResult *cr1, CompileResult *cr2)
+bool NearDiffer::compareEHInfo(MethodContext* mc, CompileResult* cr1, CompileResult* cr2)
{
ULONG cEHSize_1;
ULONG ehFlags_1;
@@ -712,40 +707,41 @@ bool NearDiffer::compareEHInfo(MethodContext *mc, CompileResult *cr1, CompileRes
ULONG handlerLength_2;
ULONG classToken_2;
-
cEHSize_1 = cr1->repSetEHcount();
cEHSize_2 = cr2->repSetEHcount();
- //no exception
- if(cEHSize_1==0 && cEHSize_2==0)
+ // no exception
+ if (cEHSize_1 == 0 && cEHSize_2 == 0)
return true;
- if(cEHSize_1!=cEHSize_2)
+ if (cEHSize_1 != cEHSize_2)
{
LogVerbose("compareEHInfo found non-matching sizes %u %u", cEHSize_1, cEHSize_2);
return false;
}
- for(unsigned int i=0;i<cEHSize_1;i++)
+ for (unsigned int i = 0; i < cEHSize_1; i++)
{
cr1->repSetEHinfo(i, &ehFlags_1, &tryOffset_1, &tryLength_1, &handlerOffset_1, &handlerLength_1, &classToken_1);
cr2->repSetEHinfo(i, &ehFlags_2, &tryOffset_2, &tryLength_2, &handlerOffset_2, &handlerLength_2, &classToken_2);
- if(ehFlags_1!=ehFlags_2)
+ if (ehFlags_1 != ehFlags_2)
{
LogVerbose("EH flags don't match %u != %u", ehFlags_1, ehFlags_2);
return false;
}
- if((tryOffset_1!=tryOffset_2) || (tryLength_1!=tryLength_2))
+ if ((tryOffset_1 != tryOffset_2) || (tryLength_1 != tryLength_2))
{
- LogVerbose("EH try information don't match, offset: %u %u, length: %u %u", tryOffset_1, tryOffset_2, tryLength_1, tryLength_2);
+ LogVerbose("EH try information don't match, offset: %u %u, length: %u %u", tryOffset_1, tryOffset_2,
+ tryLength_1, tryLength_2);
return false;
}
- if((handlerOffset_1!=handlerOffset_2) || (handlerLength_1!=handlerLength_2))
+ if ((handlerOffset_1 != handlerOffset_2) || (handlerLength_1 != handlerLength_2))
{
- LogVerbose("EH handler information don't match, offset: %u %u, length: %u %u", handlerOffset_1, handlerOffset_2, handlerLength_1, handlerLength_2);
+ LogVerbose("EH handler information don't match, offset: %u %u, length: %u %u", handlerOffset_1,
+ handlerOffset_2, handlerLength_1, handlerLength_2);
return false;
}
- if(classToken_1!=classToken_2)
+ if (classToken_1 != classToken_2)
{
LogVerbose("EH class tokens don't match %u!=%u", classToken_1, classToken_2);
return false;
@@ -766,11 +762,11 @@ bool NearDiffer::compareEHInfo(MethodContext *mc, CompileResult *cr1, CompileRes
// Return Value:
// True if the GC info blocks are identical; false otherwise.
//
-bool NearDiffer::compareGCInfo(MethodContext *mc, CompileResult *cr1, CompileResult *cr2)
+bool NearDiffer::compareGCInfo(MethodContext* mc, CompileResult* cr1, CompileResult* cr2)
{
- void *gcInfo1;
+ void* gcInfo1;
size_t gcInfo1Size;
- void *gcInfo2;
+ void* gcInfo2;
size_t gcInfo2Size;
cr1->repAllocGCInfo(&gcInfo1Size, &gcInfo1);
@@ -802,62 +798,62 @@ bool NearDiffer::compareGCInfo(MethodContext *mc, CompileResult *cr1, CompileRes
// Return Value:
// True if the native var info is identical; false otherwise.
//
-bool NearDiffer::compareVars(MethodContext *mc, CompileResult *cr1, CompileResult *cr2)
+bool NearDiffer::compareVars(MethodContext* mc, CompileResult* cr1, CompileResult* cr2)
{
- CORINFO_METHOD_HANDLE ftn_1;
- ULONG32 cVars_1;
- ICorDebugInfo::NativeVarInfo *vars_1;
+ CORINFO_METHOD_HANDLE ftn_1;
+ ULONG32 cVars_1;
+ ICorDebugInfo::NativeVarInfo* vars_1;
- CORINFO_METHOD_HANDLE ftn_2;
- ULONG32 cVars_2;
- ICorDebugInfo::NativeVarInfo *vars_2;
+ CORINFO_METHOD_HANDLE ftn_2;
+ ULONG32 cVars_2;
+ ICorDebugInfo::NativeVarInfo* vars_2;
CORINFO_METHOD_INFO info;
- unsigned flags = 0;
+ unsigned flags = 0;
mc->repCompileMethod(&info, &flags);
bool set1 = cr1->repSetVars(&ftn_1, &cVars_1, &vars_1);
bool set2 = cr2->repSetVars(&ftn_2, &cVars_2, &vars_2);
- if((set1==false)&&(set2==false))
+ if ((set1 == false) && (set2 == false))
return true; // we don't have boundaries for either of these.
- if(((set1==true)&&(set2==false))||((set1==false)&&(set2==true)))
+ if (((set1 == true) && (set2 == false)) || ((set1 == false) && (set2 == true)))
{
LogVerbose("missing matching vars sets");
return false;
}
- //no vars
- if(cVars_1==0 && cVars_2==0)
+ // no vars
+ if (cVars_1 == 0 && cVars_2 == 0)
{
return true;
}
- if(ftn_1!=ftn_2)
+ if (ftn_1 != ftn_2)
{
- //We would like to find out this situation
+ // We would like to find out this situation
__debugbreak();
LogVerbose("compareVars found non-matching CORINFO_METHOD_HANDLE %p %p", ftn_1, ftn_2);
return false;
}
- if(ftn_1!=info.ftn)
+ if (ftn_1 != info.ftn)
{
LogVerbose("compareVars found issues with the CORINFO_METHOD_HANDLE %p %p", ftn_1, info.ftn);
return false;
}
- if(cVars_1!=cVars_2)
+ if (cVars_1 != cVars_2)
{
LogVerbose("compareVars found non-matching var count %u %u", cVars_1, cVars_2);
return false;
}
- //TODO-Cleanup: The values on the NativeVarInfo array seem to wobble. Need further investigation to evaluate a good near comparison for these
- //for(unsigned int i=0;i<cVars_1;i++)
+ // TODO-Cleanup: The values on the NativeVarInfo array seem to wobble. Need further investigation to evaluate a good
+ // near comparison for these for(unsigned int i=0;i<cVars_1;i++)
//{
// if(vars_1[i].startOffset!=vars_2[i].startOffset)
// {
- // LogVerbose("compareVars found non-matching startOffsets %u %u for var: %u", vars_1[i].startOffset, vars_2[i].startOffset, i);
- // return false;
+ // LogVerbose("compareVars found non-matching startOffsets %u %u for var: %u", vars_1[i].startOffset,
+ // vars_2[i].startOffset, i); return false;
// }
//}
@@ -875,66 +871,68 @@ bool NearDiffer::compareVars(MethodContext *mc, CompileResult *cr1, CompileResul
// Return Value:
// True if the native offset mappings are identical; false otherwise.
//
-bool NearDiffer::compareBoundaries(MethodContext *mc, CompileResult *cr1, CompileResult *cr2)
+bool NearDiffer::compareBoundaries(MethodContext* mc, CompileResult* cr1, CompileResult* cr2)
{
- CORINFO_METHOD_HANDLE ftn_1;
- ULONG32 cMap_1;
- ICorDebugInfo::OffsetMapping *map_1;
+ CORINFO_METHOD_HANDLE ftn_1;
+ ULONG32 cMap_1;
+ ICorDebugInfo::OffsetMapping* map_1;
- CORINFO_METHOD_HANDLE ftn_2;
- ULONG32 cMap_2;
- ICorDebugInfo::OffsetMapping *map_2;
+ CORINFO_METHOD_HANDLE ftn_2;
+ ULONG32 cMap_2;
+ ICorDebugInfo::OffsetMapping* map_2;
CORINFO_METHOD_INFO info;
- unsigned flags = 0;
+ unsigned flags = 0;
mc->repCompileMethod(&info, &flags);
bool set1 = cr1->repSetBoundaries(&ftn_1, &cMap_1, &map_1);
bool set2 = cr2->repSetBoundaries(&ftn_2, &cMap_2, &map_2);
- if((set1==false)&&(set2==false))
+ if ((set1 == false) && (set2 == false))
return true; // we don't have boundaries for either of these.
- if(((set1==true)&&(set2==false))||((set1==false)&&(set2==true)))
+ if (((set1 == true) && (set2 == false)) || ((set1 == false) && (set2 == true)))
{
LogVerbose("missing matching boundary sets");
return false;
}
- if(ftn_1!=ftn_2)
+ if (ftn_1 != ftn_2)
{
LogVerbose("compareBoundaries found non-matching CORINFO_METHOD_HANDLE %p %p", ftn_1, ftn_2);
return false;
}
- //no maps
- if(cMap_1==0 && cMap_2==0)
+ // no maps
+ if (cMap_1 == 0 && cMap_2 == 0)
return true;
- if(cMap_1!=cMap_2)
+ if (cMap_1 != cMap_2)
{
LogVerbose("compareBoundaries found non-matching var count %u %u", cMap_1, cMap_2);
return false;
}
- for(unsigned int i=0;i<cMap_1;i++)
+ for (unsigned int i = 0; i < cMap_1; i++)
{
- if(map_1[i].ilOffset!=map_2[i].ilOffset)
+ if (map_1[i].ilOffset != map_2[i].ilOffset)
{
- LogVerbose("compareBoundaries found non-matching ilOffset %u %u for map: %u", map_1[i].ilOffset, map_2[i].ilOffset, i);
+ LogVerbose("compareBoundaries found non-matching ilOffset %u %u for map: %u", map_1[i].ilOffset,
+ map_2[i].ilOffset, i);
return false;
}
- if(map_1[i].nativeOffset!=map_2[i].nativeOffset)
+ if (map_1[i].nativeOffset != map_2[i].nativeOffset)
{
- LogVerbose("compareBoundaries found non-matching nativeOffset %u %u for map: %u", map_1[i].nativeOffset, map_2[i].nativeOffset, i);
+ LogVerbose("compareBoundaries found non-matching nativeOffset %u %u for map: %u", map_1[i].nativeOffset,
+ map_2[i].nativeOffset, i);
return false;
}
- if(map_1[i].source!=map_2[i].source)
+ if (map_1[i].source != map_2[i].source)
{
- LogVerbose("compareBoundaries found non-matching source %u %u for map: %u", (unsigned int)map_1[i].source, (unsigned int)map_2[i].source, i);
+ LogVerbose("compareBoundaries found non-matching source %u %u for map: %u", (unsigned int)map_1[i].source,
+ (unsigned int)map_2[i].source, i);
return false;
}
}
-
return true;
}
@@ -953,45 +951,45 @@ bool NearDiffer::compareBoundaries(MethodContext *mc, CompileResult *cr1, Compil
// Return Value:
// True if the compile results are identical; false otherwise.
//
-bool NearDiffer::compare(MethodContext *mc, CompileResult *cr1, CompileResult *cr2)
+bool NearDiffer::compare(MethodContext* mc, CompileResult* cr1, CompileResult* cr2)
{
- ULONG hotCodeSize_1;
- ULONG coldCodeSize_1;
- ULONG roDataSize_1;
- ULONG xcptnsCount_1;
+ ULONG hotCodeSize_1;
+ ULONG coldCodeSize_1;
+ ULONG roDataSize_1;
+ ULONG xcptnsCount_1;
CorJitAllocMemFlag flag_1;
- unsigned char *hotCodeBlock_1;
- unsigned char *coldCodeBlock_1;
- unsigned char *roDataBlock_1;
- void *orig_hotCodeBlock_1;
- void *orig_coldCodeBlock_1;
- void *orig_roDataBlock_1;
-
- ULONG hotCodeSize_2;
- ULONG coldCodeSize_2;
- ULONG roDataSize_2;
- ULONG xcptnsCount_2;
+ unsigned char* hotCodeBlock_1;
+ unsigned char* coldCodeBlock_1;
+ unsigned char* roDataBlock_1;
+ void* orig_hotCodeBlock_1;
+ void* orig_coldCodeBlock_1;
+ void* orig_roDataBlock_1;
+
+ ULONG hotCodeSize_2;
+ ULONG coldCodeSize_2;
+ ULONG roDataSize_2;
+ ULONG xcptnsCount_2;
CorJitAllocMemFlag flag_2;
- unsigned char *hotCodeBlock_2;
- unsigned char *coldCodeBlock_2;
- unsigned char *roDataBlock_2;
- void *orig_hotCodeBlock_2;
- void *orig_coldCodeBlock_2;
- void *orig_roDataBlock_2;
-
- cr1->repAllocMem(&hotCodeSize_1, &coldCodeSize_1, &roDataSize_1, &xcptnsCount_1, &flag_1,
- &hotCodeBlock_1, &coldCodeBlock_1, &roDataBlock_1, &orig_hotCodeBlock_1, &orig_coldCodeBlock_1, &orig_roDataBlock_1);
- cr2->repAllocMem(&hotCodeSize_2, &coldCodeSize_2, &roDataSize_2, &xcptnsCount_2, &flag_2,
- &hotCodeBlock_2, &coldCodeBlock_2, &roDataBlock_2, &orig_hotCodeBlock_2, &orig_coldCodeBlock_2, &orig_roDataBlock_2);
-
- LogDebug("HCS1 %d CCS1 %d RDS1 %d xcpnt1 %d flag1 %08X, HCB %p CCB %p RDB %p ohcb %p occb %p odb %p",
- hotCodeSize_1, coldCodeSize_1, roDataSize_1, xcptnsCount_1, flag_1,
- hotCodeBlock_1, coldCodeBlock_1, roDataBlock_1,
- orig_hotCodeBlock_1, orig_coldCodeBlock_1, orig_roDataBlock_1);
- LogDebug("HCS2 %d CCS2 %d RDS2 %d xcpnt2 %d flag2 %08X, HCB %p CCB %p RDB %p ohcb %p occb %p odb %p",
- hotCodeSize_2, coldCodeSize_2, roDataSize_2, xcptnsCount_2, flag_2,
- hotCodeBlock_2, coldCodeBlock_2, roDataBlock_2,
- orig_hotCodeBlock_2, orig_coldCodeBlock_2, orig_roDataBlock_2);
+ unsigned char* hotCodeBlock_2;
+ unsigned char* coldCodeBlock_2;
+ unsigned char* roDataBlock_2;
+ void* orig_hotCodeBlock_2;
+ void* orig_coldCodeBlock_2;
+ void* orig_roDataBlock_2;
+
+ cr1->repAllocMem(&hotCodeSize_1, &coldCodeSize_1, &roDataSize_1, &xcptnsCount_1, &flag_1, &hotCodeBlock_1,
+ &coldCodeBlock_1, &roDataBlock_1, &orig_hotCodeBlock_1, &orig_coldCodeBlock_1,
+ &orig_roDataBlock_1);
+ cr2->repAllocMem(&hotCodeSize_2, &coldCodeSize_2, &roDataSize_2, &xcptnsCount_2, &flag_2, &hotCodeBlock_2,
+ &coldCodeBlock_2, &roDataBlock_2, &orig_hotCodeBlock_2, &orig_coldCodeBlock_2,
+ &orig_roDataBlock_2);
+
+ LogDebug("HCS1 %d CCS1 %d RDS1 %d xcpnt1 %d flag1 %08X, HCB %p CCB %p RDB %p ohcb %p occb %p odb %p", hotCodeSize_1,
+ coldCodeSize_1, roDataSize_1, xcptnsCount_1, flag_1, hotCodeBlock_1, coldCodeBlock_1, roDataBlock_1,
+ orig_hotCodeBlock_1, orig_coldCodeBlock_1, orig_roDataBlock_1);
+ LogDebug("HCS2 %d CCS2 %d RDS2 %d xcpnt2 %d flag2 %08X, HCB %p CCB %p RDB %p ohcb %p occb %p odb %p", hotCodeSize_2,
+ coldCodeSize_2, roDataSize_2, xcptnsCount_2, flag_2, hotCodeBlock_2, coldCodeBlock_2, roDataBlock_2,
+ orig_hotCodeBlock_2, orig_coldCodeBlock_2, orig_roDataBlock_2);
cr1->applyRelocs(hotCodeBlock_1, hotCodeSize_1, orig_hotCodeBlock_1);
cr2->applyRelocs(hotCodeBlock_2, hotCodeSize_2, orig_hotCodeBlock_2);
@@ -1000,22 +998,23 @@ bool NearDiffer::compare(MethodContext *mc, CompileResult *cr1, CompileResult *c
cr1->applyRelocs(roDataBlock_1, roDataSize_1, orig_roDataBlock_1);
cr2->applyRelocs(roDataBlock_2, roDataSize_2, orig_roDataBlock_2);
- if(!compareCodeSection(mc, cr1, cr2,
- hotCodeBlock_1, hotCodeSize_1, roDataBlock_1, roDataSize_1, orig_hotCodeBlock_1, orig_roDataBlock_1, orig_coldCodeBlock_1, coldCodeSize_1,
- hotCodeBlock_2, hotCodeSize_2, roDataBlock_2, roDataSize_2, orig_hotCodeBlock_2, orig_roDataBlock_2, orig_coldCodeBlock_2, coldCodeSize_2))
+ if (!compareCodeSection(mc, cr1, cr2, hotCodeBlock_1, hotCodeSize_1, roDataBlock_1, roDataSize_1,
+ orig_hotCodeBlock_1, orig_roDataBlock_1, orig_coldCodeBlock_1, coldCodeSize_1,
+ hotCodeBlock_2, hotCodeSize_2, roDataBlock_2, roDataSize_2, orig_hotCodeBlock_2,
+ orig_roDataBlock_2, orig_coldCodeBlock_2, coldCodeSize_2))
return false;
- if(!compareCodeSection(mc, cr1, cr2,
- coldCodeBlock_1, coldCodeSize_1, roDataBlock_1, roDataSize_1, orig_coldCodeBlock_1, orig_roDataBlock_1, orig_hotCodeBlock_1, hotCodeSize_1,
- coldCodeBlock_2, coldCodeSize_2, roDataBlock_2, roDataSize_2, orig_coldCodeBlock_2, orig_roDataBlock_2, orig_hotCodeBlock_2, hotCodeSize_2))
+ if (!compareCodeSection(mc, cr1, cr2, coldCodeBlock_1, coldCodeSize_1, roDataBlock_1, roDataSize_1,
+ orig_coldCodeBlock_1, orig_roDataBlock_1, orig_hotCodeBlock_1, hotCodeSize_1,
+ coldCodeBlock_2, coldCodeSize_2, roDataBlock_2, roDataSize_2, orig_coldCodeBlock_2,
+ orig_roDataBlock_2, orig_hotCodeBlock_2, hotCodeSize_2))
return false;
- if(!compareReadOnlyDataBlock(mc, cr1, cr2,
- roDataBlock_1, roDataSize_1, orig_roDataBlock_1,
- roDataBlock_2, roDataSize_2, orig_roDataBlock_2))
+ if (!compareReadOnlyDataBlock(mc, cr1, cr2, roDataBlock_1, roDataSize_1, orig_roDataBlock_1, roDataBlock_2,
+ roDataSize_2, orig_roDataBlock_2))
return false;
- if(!compareEHInfo(mc, cr1, cr2))
+ if (!compareEHInfo(mc, cr1, cr2))
return false;
if (!compareGCInfo(mc, cr1, cr2))
@@ -1024,7 +1023,7 @@ bool NearDiffer::compare(MethodContext *mc, CompileResult *cr1, CompileResult *c
if (!compareVars(mc, cr1, cr2))
return false;
- if(!compareBoundaries(mc, cr1, cr2))
+ if (!compareBoundaries(mc, cr1, cr2))
return false;
return true;
diff --git a/src/ToolBox/superpmi/superpmi/neardiffer.h b/src/ToolBox/superpmi/superpmi/neardiffer.h
index e3ffe1c790..100f87cce2 100644
--- a/src/ToolBox/superpmi/superpmi/neardiffer.h
+++ b/src/ToolBox/superpmi/superpmi/neardiffer.h
@@ -15,8 +15,7 @@
class NearDiffer
{
public:
-
- NearDiffer(const char *targetArch, bool useCorDisTools)
+ NearDiffer(const char* targetArch, bool useCorDisTools)
: TargetArchitecture(targetArch)
, UseCoreDisTools(useCorDisTools)
#ifdef USE_COREDISTOOLS
@@ -29,58 +28,58 @@ public:
void InitAsmDiff();
- bool compare(MethodContext *mc, CompileResult *cr1,CompileResult *cr2);
+ bool compare(MethodContext* mc, CompileResult* cr1, CompileResult* cr2);
const char* TargetArchitecture;
- const bool UseCoreDisTools;
+ const bool UseCoreDisTools;
private:
-
- void DumpCodeBlock(unsigned char *block, ULONG blocksize, void *originalAddr);
-
- bool compareCodeSection(
- MethodContext *mc,
- CompileResult *cr1,
- CompileResult *cr2,
- unsigned char *block1,
- ULONG blocksize1,
- unsigned char *datablock1,
- ULONG datablockSize1,
- void *originalBlock1,
- void *originalDataBlock1,
- void *otherCodeBlock1,
- ULONG otherCodeBlockSize1,
- unsigned char *block2,
- ULONG blocksize2,
- unsigned char *datablock2,
- ULONG datablockSize2,
- void *originalBlock2,
- void *originalDataBlock2,
- void *otherCodeBlock2,
- ULONG otherCodeBlockSize2);
-
- bool compareReadOnlyDataBlock(MethodContext *mc, CompileResult *cr1, CompileResult *cr2,
- unsigned char *block1, ULONG blocksize1, void *originalDataBlock1,
- unsigned char *block2, ULONG blocksize2, void *originalDataBlock2);
- bool compareEHInfo(MethodContext *mc, CompileResult *cr1, CompileResult *cr2);
- bool compareGCInfo(MethodContext *mc, CompileResult *cr1, CompileResult *cr2);
- bool compareVars(MethodContext *mc, CompileResult *cr1, CompileResult *cr2);
- bool compareBoundaries(MethodContext *mc, CompileResult *cr1, CompileResult *cr2);
-
- static bool compareOffsets(const void *payload,
- size_t blockOffset,
- size_t instrLen,
- uint64_t offset1,
- uint64_t offset2);
+ void DumpCodeBlock(unsigned char* block, ULONG blocksize, void* originalAddr);
+
+ bool compareCodeSection(MethodContext* mc,
+ CompileResult* cr1,
+ CompileResult* cr2,
+ unsigned char* block1,
+ ULONG blocksize1,
+ unsigned char* datablock1,
+ ULONG datablockSize1,
+ void* originalBlock1,
+ void* originalDataBlock1,
+ void* otherCodeBlock1,
+ ULONG otherCodeBlockSize1,
+ unsigned char* block2,
+ ULONG blocksize2,
+ unsigned char* datablock2,
+ ULONG datablockSize2,
+ void* originalBlock2,
+ void* originalDataBlock2,
+ void* otherCodeBlock2,
+ ULONG otherCodeBlockSize2);
+
+ bool compareReadOnlyDataBlock(MethodContext* mc,
+ CompileResult* cr1,
+ CompileResult* cr2,
+ unsigned char* block1,
+ ULONG blocksize1,
+ void* originalDataBlock1,
+ unsigned char* block2,
+ ULONG blocksize2,
+ void* originalDataBlock2);
+ bool compareEHInfo(MethodContext* mc, CompileResult* cr1, CompileResult* cr2);
+ bool compareGCInfo(MethodContext* mc, CompileResult* cr1, CompileResult* cr2);
+ bool compareVars(MethodContext* mc, CompileResult* cr1, CompileResult* cr2);
+ bool compareBoundaries(MethodContext* mc, CompileResult* cr1, CompileResult* cr2);
+
+ static bool compareOffsets(
+ const void* payload, size_t blockOffset, size_t instrLen, uint64_t offset1, uint64_t offset2);
#ifdef USE_COREDISTOOLS
- CorAsmDiff *corAsmDiff;
+ CorAsmDiff* corAsmDiff;
#endif // USE_COREDISTOOLS
#ifdef USE_MSVCDIS
DIS* GetMsVcDis();
#endif // USE_MSVCDIS
-
};
#endif // _nearDiffer
diff --git a/src/ToolBox/superpmi/superpmi/parallelsuperpmi.cpp b/src/ToolBox/superpmi/superpmi/parallelsuperpmi.cpp
index 301db3cfe9..0f2d31d3e5 100644
--- a/src/ToolBox/superpmi/superpmi/parallelsuperpmi.cpp
+++ b/src/ToolBox/superpmi/superpmi/parallelsuperpmi.cpp
@@ -10,20 +10,20 @@
#include "commandline.h"
#include "errorhandling.h"
-#define MAX_LOG_LINE_SIZE 0x1000 //4 KB
+#define MAX_LOG_LINE_SIZE 0x1000 // 4 KB
bool closeRequested = false; // global variable to communicate CTRL+C between threads.
-bool StartProcess(char *commandLine, HANDLE hStdOutput, HANDLE hStdError, HANDLE *hProcess)
+bool StartProcess(char* commandLine, HANDLE hStdOutput, HANDLE hStdError, HANDLE* hProcess)
{
LogDebug("StartProcess commandLine=%s", commandLine);
- STARTUPINFO si;
+ STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory(&si, sizeof(si));
- si.cb = sizeof(si);
- si.dwFlags = STARTF_USESTDHANDLES;
+ si.cb = sizeof(si);
+ si.dwFlags = STARTF_USESTDHANDLES;
si.hStdInput = GetStdHandle(STD_INPUT_HANDLE);
si.hStdOutput = hStdOutput;
si.hStdError = hStdError;
@@ -31,16 +31,16 @@ bool StartProcess(char *commandLine, HANDLE hStdOutput, HANDLE hStdError, HANDLE
ZeroMemory(&pi, sizeof(pi));
// Start the child process.
- if (!CreateProcess(NULL, // No module name (use command line)
- commandLine, // Command line
- NULL, // Process handle not inheritable
- NULL, // Thread handle not inheritable
- TRUE, // Set handle inheritance to TRUE (required to use STARTF_USESTDHANDLES)
- 0, // No creation flags
- NULL, // Use parent's environment block
- NULL, // Use parent's starting directory
- &si, // Pointer to STARTUPINFO structure
- &pi)) // Pointer to PROCESS_INFORMATION structure
+ if (!CreateProcess(NULL, // No module name (use command line)
+ commandLine, // Command line
+ NULL, // Process handle not inheritable
+ NULL, // Thread handle not inheritable
+ TRUE, // Set handle inheritance to TRUE (required to use STARTF_USESTDHANDLES)
+ 0, // No creation flags
+ NULL, // Use parent's environment block
+ NULL, // Use parent's starting directory
+ &si, // Pointer to STARTUPINFO structure
+ &pi)) // Pointer to PROCESS_INFORMATION structure
{
LogError("CreateProcess failed (%d). CommandLine: %s", GetLastError(), commandLine);
*hProcess = INVALID_HANDLE_VALUE;
@@ -51,13 +51,14 @@ bool StartProcess(char *commandLine, HANDLE hStdOutput, HANDLE hStdError, HANDLE
return true;
}
-void ReadMCLToArray(char *mclFilename, int **arr, int *count)
+void ReadMCLToArray(char* mclFilename, int** arr, int* count)
{
- *count = 0;
- *arr = nullptr;
+ *count = 0;
+ *arr = nullptr;
char* buff = nullptr;
- HANDLE hFile = CreateFileA(mclFilename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
+ HANDLE hFile = CreateFileA(mclFilename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING,
+ FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
if (hFile == INVALID_HANDLE_VALUE)
{
@@ -99,14 +100,14 @@ void ReadMCLToArray(char *mclFilename, int **arr, int *count)
return;
*arr = new int[*count];
- for (int j = 0, arrIndex = 0; j < sz; )
+ for (int j = 0, arrIndex = 0; j < sz;)
{
- //seek the first number on the line
+ // seek the first number on the line
while (!isdigit((unsigned char)buff[j]))
j++;
- //read in the number
+ // read in the number
(*arr)[arrIndex++] = atoi(&buff[j]);
- //seek to the start of next line
+ // seek to the start of next line
while ((j < sz) && (buff[j] != 0x0a))
j++;
j++;
@@ -120,9 +121,10 @@ Cleanup:
CloseHandle(hFile);
}
-bool WriteArrayToMCL(char *mclFilename, int *arr, int count)
+bool WriteArrayToMCL(char* mclFilename, int* arr, int count)
{
- HANDLE hMCLFile = CreateFileA(mclFilename, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+ HANDLE hMCLFile =
+ CreateFileA(mclFilename, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
bool result = true;
if (hMCLFile == INVALID_HANDLE_VALUE)
@@ -134,8 +136,8 @@ bool WriteArrayToMCL(char *mclFilename, int *arr, int count)
for (int i = 0; i < count; i++)
{
- char strMethodIndex[12];
- DWORD charCount = 0;
+ char strMethodIndex[12];
+ DWORD charCount = 0;
DWORD bytesWritten = 0;
charCount = sprintf_s(strMethodIndex, sizeof(strMethodIndex), "%d\r\n", arr[i]);
@@ -155,11 +157,11 @@ Cleanup:
return result;
}
-void ProcessChildStdErr(char *stderrFilename)
+void ProcessChildStdErr(char* stderrFilename)
{
char buff[MAX_LOG_LINE_SIZE];
- FILE *fp = fopen(stderrFilename, "r");
+ FILE* fp = fopen(stderrFilename, "r");
if (fp == NULL)
{
@@ -169,17 +171,17 @@ void ProcessChildStdErr(char *stderrFilename)
while (fgets(buff, MAX_LOG_LINE_SIZE, fp) != NULL)
{
- //get rid of the '\n' at the end of line
+ // get rid of the '\n' at the end of line
size_t buffLen = strlen(buff);
if (buff[buffLen - 1] == '\n')
buff[buffLen - 1] = 0;
if (strncmp(buff, "ERROR: ", 7) == 0)
- LogError("%s", &buff[7]); //log as Error and remove the "ERROR: " in front
+ LogError("%s", &buff[7]); // log as Error and remove the "ERROR: " in front
else if (strncmp(buff, "WARNING: ", 9) == 0)
- LogWarning("%s", &buff[9]); //log as Warning and remove the "WARNING: " in front
+ LogWarning("%s", &buff[9]); // log as Warning and remove the "WARNING: " in front
else if (strlen(buff) > 0)
- LogWarning("%s", buff); //unknown output, log it as a warning
+ LogWarning("%s", buff); // unknown output, log it as a warning
}
Cleanup:
@@ -187,11 +189,17 @@ Cleanup:
fclose(fp);
}
-void ProcessChildStdOut(const CommandLine::Options& o, char *stdoutFilename, int *loaded, int *jitted, int *failed, int *diffs, bool *usageError)
+void ProcessChildStdOut(const CommandLine::Options& o,
+ char* stdoutFilename,
+ int* loaded,
+ int* jitted,
+ int* failed,
+ int* diffs,
+ bool* usageError)
{
char buff[MAX_LOG_LINE_SIZE];
- FILE *fp = fopen(stdoutFilename, "r");
+ FILE* fp = fopen(stdoutFilename, "r");
if (fp == NULL)
{
@@ -201,25 +209,25 @@ void ProcessChildStdOut(const CommandLine::Options& o, char *stdoutFilename, int
while (fgets(buff, MAX_LOG_LINE_SIZE, fp) != NULL)
{
- //get rid of the '\n' at the end of line
+ // get rid of the '\n' at the end of line
size_t buffLen = strlen(buff);
if (buff[buffLen - 1] == '\n')
buff[buffLen - 1] = 0;
if (strncmp(buff, "MISSING: ", 9) == 0)
- LogMissing("%s", &buff[9]); //log as Missing and remove the "MISSING: " in front
+ LogMissing("%s", &buff[9]); // log as Missing and remove the "MISSING: " in front
else if (strncmp(buff, "ISSUE: ", 7) == 0)
{
if (strncmp(&buff[7], "<ASM_DIFF> ", 11) == 0)
- LogIssue(ISSUE_ASM_DIFF, "%s", &buff[18]); //log as Issue and remove the "ISSUE: <ASM_DIFF>" in front
+ LogIssue(ISSUE_ASM_DIFF, "%s", &buff[18]); // log as Issue and remove the "ISSUE: <ASM_DIFF>" in front
else if (strncmp(&buff[7], "<ASSERT> ", 9) == 0)
- LogIssue(ISSUE_ASSERT, "%s", &buff[16]); //log as Issue and remove the "ISSUE: <ASSERT>" in front
+ LogIssue(ISSUE_ASSERT, "%s", &buff[16]); // log as Issue and remove the "ISSUE: <ASSERT>" in front
}
else if (strncmp(buff, g_SuperPMIUsageFirstLine, strlen(g_SuperPMIUsageFirstLine)) == 0)
{
- *usageError = true; //Signals that we had a SuperPMI command line usage error
+ *usageError = true; // Signals that we had a SuperPMI command line usage error
- //Read the entire stdout file and printf it
+ // Read the entire stdout file and printf it
printf("%s", buff);
while (fgets(buff, MAX_LOG_LINE_SIZE, fp) != NULL)
{
@@ -272,61 +280,74 @@ Cleanup:
#ifndef FEATURE_PAL // TODO-Porting: handle Ctrl-C signals gracefully on Unix
BOOL WINAPI CtrlHandler(DWORD fdwCtrlType)
{
- //Since the child SuperPMI.exe processes share the same console
- //We don't need to kill them individually as they also receive the Ctrl-C
+ // Since the child SuperPMI.exe processes share the same console
+ //We don't need to kill them individually as they also receive the Ctrl-C
- closeRequested = true; //set a flag to indicate we need to quit
+ closeRequested = true; // set a flag to indicate we need to quit
return TRUE;
}
#endif // !FEATURE_PAL
-int __cdecl compareInt(const void *arg1, const void *arg2)
+int __cdecl compareInt(const void* arg1, const void* arg2)
{
- return (*(const int *)arg1) - (*(const int *)arg2);
+ return (*(const int*)arg1) - (*(const int*)arg2);
}
// 'arrWorkerMCLPath' is an array of strings of size 'workerCount'.
-void MergeWorkerMCLs(char *mclFilename, char **arrWorkerMCLPath, int workerCount)
+void MergeWorkerMCLs(char* mclFilename, char** arrWorkerMCLPath, int workerCount)
{
- int **MCL = new int*[workerCount], *MCLCount = new int[workerCount], totalCount = 0;
+ int **MCL = new int *[workerCount], *MCLCount = new int[workerCount], totalCount = 0;
for (int i = 0; i < workerCount; i++)
{
- //Read the next partial MCL file
+ // Read the next partial MCL file
ReadMCLToArray(arrWorkerMCLPath[i], &MCL[i], &MCLCount[i]);
totalCount += MCLCount[i];
}
- int *mergedMCL = new int[totalCount];
- int index = 0;
+ int* mergedMCL = new int[totalCount];
+ int index = 0;
for (int i = 0; i < workerCount; i++)
{
- for (int j = 0; j < MCLCount[i]; j++)
+ for (int j = 0; j < MCLCount[i]; j++)
mergedMCL[index++] = MCL[i][j];
}
qsort(mergedMCL, totalCount, sizeof(int), compareInt);
- //Write the merged MCL array back to disk
+ // Write the merged MCL array back to disk
if (!WriteArrayToMCL(mclFilename, mergedMCL, totalCount))
LogError("Unable to write to MCL file %s.", mclFilename);
}
// From the arguments that we parsed, construct the arguments to pass to the child processes.
-#define MAX_CMDLINE_SIZE 0x1000 //4 KB
+#define MAX_CMDLINE_SIZE 0x1000 // 4 KB
char* ConstructChildProcessArgs(const CommandLine::Options& o)
{
- int bytesWritten = 0;
- char* spmiArgs = new char[MAX_CMDLINE_SIZE];
- *spmiArgs = '\0';
+ int bytesWritten = 0;
+ char* spmiArgs = new char[MAX_CMDLINE_SIZE];
+ *spmiArgs = '\0';
- // We don't pass through /parallel, /skipCleanup, /verbosity, /failingMCList, or /diffMCList. Everything else we need to reconstruct and pass through.
+// We don't pass through /parallel, /skipCleanup, /verbosity, /failingMCList, or /diffMCList. Everything else we need to
+// reconstruct and pass through.
-#define ADDSTRING(s) if (s != nullptr) { bytesWritten += sprintf_s(spmiArgs + bytesWritten, MAX_CMDLINE_SIZE - bytesWritten, " %s", s); }
-#define ADDARG_BOOL(b,arg) if (b) { bytesWritten += sprintf_s(spmiArgs + bytesWritten, MAX_CMDLINE_SIZE - bytesWritten, " %s", arg); }
-#define ADDARG_STRING(s,arg) if (s != nullptr) { bytesWritten += sprintf_s(spmiArgs + bytesWritten, MAX_CMDLINE_SIZE - bytesWritten, " %s %s", arg, s); }
+#define ADDSTRING(s) \
+ if (s != nullptr) \
+ { \
+ bytesWritten += sprintf_s(spmiArgs + bytesWritten, MAX_CMDLINE_SIZE - bytesWritten, " %s", s); \
+ }
+#define ADDARG_BOOL(b, arg) \
+ if (b) \
+ { \
+ bytesWritten += sprintf_s(spmiArgs + bytesWritten, MAX_CMDLINE_SIZE - bytesWritten, " %s", arg); \
+ }
+#define ADDARG_STRING(s, arg) \
+ if (s != nullptr) \
+ { \
+ bytesWritten += sprintf_s(spmiArgs + bytesWritten, MAX_CMDLINE_SIZE - bytesWritten, " %s %s", arg, s); \
+ }
ADDARG_BOOL(o.breakOnError, "-boe");
ADDARG_BOOL(o.breakOnAssert, "-boa");
@@ -352,12 +373,12 @@ char* ConstructChildProcessArgs(const CommandLine::Options& o)
int doParallelSuperPMI(CommandLine::Options& o)
{
- HRESULT hr = E_FAIL;
+ HRESULT hr = E_FAIL;
SimpleTimer st;
st.Start();
#ifndef FEATURE_PAL // TODO-Porting: handle Ctrl-C signals gracefully on Unix
- //Register a ConsoleCtrlHandler
+ // Register a ConsoleCtrlHandler
if (!SetConsoleCtrlHandler(CtrlHandler, TRUE))
{
LogError("Failed to set control handler.");
@@ -374,14 +395,14 @@ int doParallelSuperPMI(CommandLine::Options& o)
if (o.workerCount <= 0)
{
- //Use the default value which is the number of processors on the machine.
+ // Use the default value which is the number of processors on the machine.
SYSTEM_INFO sysinfo;
GetSystemInfo(&sysinfo);
o.workerCount = sysinfo.dwNumberOfProcessors;
- //If we ever execute on a machine which has more than MAXIMUM_WAIT_OBJECTS(64) CPU cores
- //we still can't spawn more than the max supported by WaitForMultipleObjects()
+ // If we ever execute on a machine which has more than MAXIMUM_WAIT_OBJECTS(64) CPU cores
+ //we still can't spawn more than the max supported by WaitForMultipleObjects()
if (o.workerCount > MAXIMUM_WAIT_OBJECTS)
o.workerCount = MAXIMUM_WAIT_OBJECTS;
}
@@ -404,9 +425,9 @@ int doParallelSuperPMI(CommandLine::Options& o)
LogVerbose(" diffMCLFilename=%s", o.diffMCLFilename);
LogVerbose(" workerCount=%d, skipCleanup=%d.", o.workerCount, o.skipCleanup);
- HANDLE *hProcesses = new HANDLE[o.workerCount];
- HANDLE *hStdOutput = new HANDLE[o.workerCount];
- HANDLE *hStdError = new HANDLE[o.workerCount];
+ HANDLE* hProcesses = new HANDLE[o.workerCount];
+ HANDLE* hStdOutput = new HANDLE[o.workerCount];
+ HANDLE* hStdError = new HANDLE[o.workerCount];
char** arrFailingMCListPath = new char*[o.workerCount];
char** arrDiffMCListPath = new char*[o.workerCount];
@@ -417,7 +438,7 @@ int doParallelSuperPMI(CommandLine::Options& o)
unsigned int randNumber = 0;
#ifdef FEATURE_PAL
PAL_Random(/* bStrong */ FALSE, &randNumber, sizeof(randNumber));
-#else // !FEATURE_PAL
+#else // !FEATURE_PAL
rand_s(&randNumber);
#endif // !FEATURE_PAL
@@ -447,7 +468,7 @@ int doParallelSuperPMI(CommandLine::Options& o)
arrStdErrorPath[i] = new char[MAX_PATH];
sprintf_s(arrStdOutputPath[i], MAX_PATH, "%sParallelSuperPMI-stdout-%u-%d.txt", tempPath, randNumber, i);
- sprintf_s(arrStdErrorPath[i], MAX_PATH, "%sParallelSuperPMI-stderr-%u-%d.txt", tempPath, randNumber, i);
+ sprintf_s(arrStdErrorPath[i], MAX_PATH, "%sParallelSuperPMI-stderr-%u-%d.txt", tempPath, randNumber, i);
}
char cmdLine[MAX_CMDLINE_SIZE];
@@ -460,23 +481,26 @@ int doParallelSuperPMI(CommandLine::Options& o)
if (o.mclFilename != nullptr)
{
- bytesWritten += sprintf_s(cmdLine + bytesWritten, MAX_CMDLINE_SIZE - bytesWritten, " -failingMCList %s", arrFailingMCListPath[i]);
+ bytesWritten += sprintf_s(cmdLine + bytesWritten, MAX_CMDLINE_SIZE - bytesWritten, " -failingMCList %s",
+ arrFailingMCListPath[i]);
}
if (o.diffMCLFilename != nullptr)
{
- bytesWritten += sprintf_s(cmdLine + bytesWritten, MAX_CMDLINE_SIZE - bytesWritten, " -diffMCList %s", arrDiffMCListPath[i]);
+ bytesWritten += sprintf_s(cmdLine + bytesWritten, MAX_CMDLINE_SIZE - bytesWritten, " -diffMCList %s",
+ arrDiffMCListPath[i]);
}
bytesWritten += sprintf_s(cmdLine + bytesWritten, MAX_CMDLINE_SIZE - bytesWritten, " -v ewmin %s", spmiArgs);
SECURITY_ATTRIBUTES sa;
- sa.nLength = sizeof(sa);
+ sa.nLength = sizeof(sa);
sa.lpSecurityDescriptor = NULL;
- sa.bInheritHandle = TRUE; // Let newly created stdout/stderr handles be inherited.
+ sa.bInheritHandle = TRUE; // Let newly created stdout/stderr handles be inherited.
LogDebug("stdout %i=%s", i, arrStdOutputPath[i]);
- hStdOutput[i] = CreateFileA(arrStdOutputPath[i], GENERIC_WRITE, FILE_SHARE_READ, &sa, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+ hStdOutput[i] = CreateFileA(arrStdOutputPath[i], GENERIC_WRITE, FILE_SHARE_READ, &sa, CREATE_ALWAYS,
+ FILE_ATTRIBUTE_NORMAL, NULL);
if (hStdOutput[i] == INVALID_HANDLE_VALUE)
{
LogError("Unable to open '%s'. GetLastError()=%u", arrStdOutputPath[i], GetLastError());
@@ -484,14 +508,15 @@ int doParallelSuperPMI(CommandLine::Options& o)
}
LogDebug("stderr %i=%s", i, arrStdErrorPath[i]);
- hStdError[i] = CreateFileA(arrStdErrorPath[i], GENERIC_WRITE, FILE_SHARE_READ, &sa, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+ hStdError[i] = CreateFileA(arrStdErrorPath[i], GENERIC_WRITE, FILE_SHARE_READ, &sa, CREATE_ALWAYS,
+ FILE_ATTRIBUTE_NORMAL, NULL);
if (hStdError[i] == INVALID_HANDLE_VALUE)
{
LogError("Unable to open '%s'. GetLastError()=%u", arrStdErrorPath[i], GetLastError());
return -1;
}
- //Create a SuperPMI worker process and redirect its output to file
+ // Create a SuperPMI worker process and redirect its output to file
if (!StartProcess(cmdLine, hStdOutput[i], hStdError[i], &hProcesses[i]))
{
return -1;
@@ -516,19 +541,19 @@ int doParallelSuperPMI(CommandLine::Options& o)
for (int i = 0; i < o.workerCount; i++)
{
DWORD exitCodeTmp;
- BOOL ok = GetExitCodeProcess(hProcesses[i], &exitCodeTmp);
+ BOOL ok = GetExitCodeProcess(hProcesses[i], &exitCodeTmp);
if (ok && (exitCodeTmp > exitCode))
{
exitCode = exitCodeTmp;
}
}
- bool usageError = false; //variable to flag if we hit a usage error in SuperPMI
+ bool usageError = false; // variable to flag if we hit a usage error in SuperPMI
int loaded = 0, jitted = 0, failed = 0, diffs = 0;
- //Read the stderr files and log them as errors
- //Read the stdout files and parse them for counts and log any MISSING or ISSUE errors
+ // Read the stderr files and log them as errors
+ //Read the stdout files and parse them for counts and log any MISSING or ISSUE errors
for (int i = 0; i < o.workerCount; i++)
{
ProcessChildStdErr(arrStdErrorPath[i]);
@@ -539,13 +564,13 @@ int doParallelSuperPMI(CommandLine::Options& o)
if (o.mclFilename != nullptr && !usageError)
{
- //Concat the resulting .mcl files
+ // Concat the resulting .mcl files
MergeWorkerMCLs(o.mclFilename, arrFailingMCListPath, o.workerCount);
}
if (o.diffMCLFilename != nullptr && !usageError)
{
- //Concat the resulting diff .mcl files
+ // Concat the resulting diff .mcl files
MergeWorkerMCLs(o.diffMCLFilename, arrDiffMCListPath, o.workerCount);
}
diff --git a/src/ToolBox/superpmi/superpmi/superpmi.cpp b/src/ToolBox/superpmi/superpmi/superpmi.cpp
index 980792d4a9..c1225e419e 100644
--- a/src/ToolBox/superpmi/superpmi/superpmi.cpp
+++ b/src/ToolBox/superpmi/superpmi/superpmi.cpp
@@ -52,37 +52,35 @@ void SetSuperPmiTargetArchitecture(const char* targetArchitecture)
// This function uses PAL_TRY, so it can't be in the a function that requires object unwinding. Extracting it out here
// avoids compiler error.
-//
-void InvokeNearDiffer(
- NearDiffer* nearDiffer,
- CommandLine::Options* o,
- MethodContext** mc,
- CompileResult** crl,
- int* matchCount,
- MethodContextReader** reader,
- MCList* failingMCL,
- MCList* diffMCL
- )
+//
+void InvokeNearDiffer(NearDiffer* nearDiffer,
+ CommandLine::Options* o,
+ MethodContext** mc,
+ CompileResult** crl,
+ int* matchCount,
+ MethodContextReader** reader,
+ MCList* failingMCL,
+ MCList* diffMCL)
{
struct Param : FilterSuperPMIExceptionsParam_CaptureException
{
- NearDiffer* nearDiffer;
- CommandLine::Options* o;
- MethodContext** mc;
- CompileResult** crl;
- int* matchCount;
- MethodContextReader** reader;
- MCList* failingMCL;
- MCList* diffMCL;
+ NearDiffer* nearDiffer;
+ CommandLine::Options* o;
+ MethodContext** mc;
+ CompileResult** crl;
+ int* matchCount;
+ MethodContextReader** reader;
+ MCList* failingMCL;
+ MCList* diffMCL;
} param;
param.nearDiffer = nearDiffer;
- param.o = o;
- param.mc = mc;
- param.crl = crl;
+ param.o = o;
+ param.mc = mc;
+ param.crl = crl;
param.matchCount = matchCount;
- param.reader = reader;
+ param.reader = reader;
param.failingMCL = failingMCL;
- param.diffMCL = diffMCL;
+ param.diffMCL = diffMCL;
PAL_TRY(Param*, pParam, &param)
{
@@ -92,12 +90,12 @@ void InvokeNearDiffer(
}
else
{
- LogIssue(ISSUE_ASM_DIFF,
- "main method %d of size %d differs", (*pParam->reader)->GetMethodContextIndex(), (*pParam->mc)->methodSize);
+ LogIssue(ISSUE_ASM_DIFF, "main method %d of size %d differs", (*pParam->reader)->GetMethodContextIndex(),
+ (*pParam->mc)->methodSize);
- //This is a difference in ASM outputs from Jit1 & Jit2 and not a playback failure
- //We will add this MC to the diffMCList if one is requested
- //Otherwise this will end up in failingMCList
+ // This is a difference in ASM outputs from Jit1 & Jit2 and not a playback failure
+ //We will add this MC to the diffMCList if one is requested
+ //Otherwise this will end up in failingMCList
if ((*pParam->o).diffMCLFilename != nullptr)
(*pParam->diffMCL).AddMethodToMCL((*pParam->reader)->GetMethodContextIndex());
else if ((*pParam->o).mclFilename != nullptr)
@@ -109,7 +107,7 @@ void InvokeNearDiffer(
SpmiException e(&param.exceptionPointers);
LogError("main method %d of size %d failed to load and compile correctly. EnvCnt=%d",
- (*reader)->GetMethodContextIndex(), (*mc)->methodSize, (*mc)->repEnvironmentGetCount());
+ (*reader)->GetMethodContextIndex(), (*mc)->methodSize, (*mc)->repEnvironmentGetCount());
e.ShowAndDeleteMessage();
if ((*o).mclFilename != nullptr)
(*failingMCL).AddMethodToMCL((*reader)->GetMethodContextIndex());
@@ -141,13 +139,13 @@ int __cdecl main(int argc, char* argv[])
SimpleTimer st4;
st2.Start();
JitInstance::Result res, res2;
- HRESULT hr = E_FAIL;
- MethodContext *mc = nullptr;
- JitInstance *jit = nullptr, *jit2 = nullptr;
- MethodStatsEmitter *methodStatsEmitter = nullptr;
+ HRESULT hr = E_FAIL;
+ MethodContext* mc = nullptr;
+ JitInstance * jit = nullptr, *jit2 = nullptr;
+ MethodStatsEmitter* methodStatsEmitter = nullptr;
#ifdef SuperPMI_ChewMemory
- //Chew up the base 2gb of memory on x86... helpful in finding any places where classhandles etc are de-ref'd
+ // Chew up the base 2gb of memory on x86... helpful in finding any places where classhandles etc are de-ref'd
SYSTEM_INFO sSysInfo;
GetSystemInfo(&sSysInfo);
@@ -159,7 +157,7 @@ int __cdecl main(int argc, char* argv[])
} while ((size_t)lpvAddr < SuperPMI_ChewMemory);
#endif
- bool collectThroughput = false;
+ bool collectThroughput = false;
MCList failingMCL, diffMCL;
CommandLine::Options o;
@@ -175,7 +173,9 @@ int __cdecl main(int argc, char* argv[])
SetSuperPmiTargetArchitecture(o.targetArchitecture);
- if (o.methodStatsTypes != NULL && (strchr(o.methodStatsTypes, '*') != NULL || strchr(o.methodStatsTypes, 't') != NULL || strchr(o.methodStatsTypes, 'T') != NULL))
+ if (o.methodStatsTypes != NULL &&
+ (strchr(o.methodStatsTypes, '*') != NULL || strchr(o.methodStatsTypes, 't') != NULL ||
+ strchr(o.methodStatsTypes, 'T') != NULL))
{
collectThroughput = true;
}
@@ -222,7 +222,8 @@ int __cdecl main(int argc, char* argv[])
// 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(o.nameOfInputMethodContextFile, o.indexes, o.indexCount, o.hash, o.offset, o.increment);
+ MethodContextReader* reader =
+ new MethodContextReader(o.nameOfInputMethodContextFile, o.indexes, o.indexCount, o.hash, o.offset, o.increment);
if (!reader->isValid())
{
return -1;
@@ -230,13 +231,13 @@ int __cdecl main(int argc, char* argv[])
int loadedCount = 0;
int jittedCount = 0;
- int matchCount = 0;
- int failCount = 0;
- int index = 0;
+ int matchCount = 0;
+ int failCount = 0;
+ int index = 0;
st1.Start();
NearDiffer nearDiffer(o.targetArchitecture, o.useCoreDisTools);
-
+
if (o.applyDiff)
{
nearDiffer.InitAsmDiff();
@@ -260,21 +261,14 @@ int __cdecl main(int argc, char* argv[])
if (o.applyDiff)
{
LogVerbose(" %2.1f%% - Loaded %d Jitted %d Matching %d FailedCompile %d at %d per second",
- reader->PercentComplete(),
- loadedCount,
- jittedCount,
- matchCount,
- failCount,
- (int)((double)500 / st1.GetSeconds()));
+ reader->PercentComplete(), loadedCount, jittedCount, matchCount, failCount,
+ (int)((double)500 / st1.GetSeconds()));
}
else
{
LogVerbose(" %2.1f%% - Loaded %d Jitted %d FailedCompile %d at %d per second",
- reader->PercentComplete(),
- loadedCount,
- jittedCount,
- failCount,
- (int)((double)500 / st1.GetSeconds()));
+ reader->PercentComplete(), loadedCount, jittedCount, failCount,
+ (int)((double)500 / st1.GetSeconds()));
}
st1.Start();
}
@@ -311,9 +305,9 @@ int __cdecl main(int argc, char* argv[])
// Here is my guess based on reading the code so far
// crl initially contains the CompileResult from the MCH file
// However if we have a second jit it has the CompileResult from Jit1
- CompileResult *crl = mc->cr;
+ CompileResult* crl = mc->cr;
- mc->cr = new CompileResult();
+ mc->cr = new CompileResult();
mc->originalCR = crl;
jittedCount++;
@@ -332,13 +326,14 @@ int __cdecl main(int argc, char* argv[])
// Lets get the results for the 2nd JIT
// We will save the first JIT's CR to save space for the 2nd JIT CR
// Note that the recorded CR is still stored in MC->originalCR
- crl = mc->cr;
+ crl = mc->cr;
mc->cr = new CompileResult();
st4.Start();
res2 = jit2->CompileMethod(mc, reader->GetMethodContextIndex(), collectThroughput);
st4.Stop();
- LogDebug("Method %d compiled by JIT2 in %fms, result %d", reader->GetMethodContextIndex(), st4.GetMilliseconds(), res2);
+ LogDebug("Method %d compiled by JIT2 in %fms, result %d", reader->GetMethodContextIndex(),
+ st4.GetMilliseconds(), res2);
if ((res2 == JitInstance::RESULT_SUCCESS) && Logger::IsLogLevelEnabled(LOGLEVEL_DEBUG))
{
@@ -348,14 +343,13 @@ int __cdecl main(int argc, char* argv[])
if (res2 == JitInstance::RESULT_ERROR)
{
LogError("JIT2 main method %d of size %d failed to load and compile correctly. EnvCnt=%d",
- reader->GetMethodContextIndex(), mc->methodSize, mc->repEnvironmentGetCount());
+ reader->GetMethodContextIndex(), mc->methodSize, mc->repEnvironmentGetCount());
}
// Methods that don't compile due to missing JIT-EE information
// should still be added to the failing MC list.
// However, we will not add this MC# if JIT1 also failed, Else there will be duplicate logging
- if ((res == JitInstance::RESULT_SUCCESS) &&
- (res2 != JitInstance::RESULT_SUCCESS) &&
+ if ((res == JitInstance::RESULT_SUCCESS) && (res2 != JitInstance::RESULT_SUCCESS) &&
(o.mclFilename != nullptr))
{
failingMCL.AddMethodToMCL(reader->GetMethodContextIndex());
@@ -368,7 +362,7 @@ int __cdecl main(int argc, char* argv[])
{
if (o.nameOfJit2 != nullptr && res2 == JitInstance::RESULT_SUCCESS)
{
- //TODO-Bug?: bug in getting the lowest cycle time??
+ // TODO-Bug?: bug in getting the lowest cycle time??
ULONGLONG dif1, dif2, dif3, dif4;
dif1 = (jit->times[0] - jit2->times[0]) * (jit->times[0] - jit2->times[0]);
dif2 = (jit->times[0] - jit2->times[1]) * (jit->times[0] - jit2->times[1]);
@@ -381,12 +375,12 @@ int __cdecl main(int argc, char* argv[])
{
if (dif1 < dif3)
{
- crl->clockCyclesToCompile = jit->times[0];
+ crl->clockCyclesToCompile = jit->times[0];
mc->cr->clockCyclesToCompile = jit2->times[0];
}
else
{
- crl->clockCyclesToCompile = jit->times[1];
+ crl->clockCyclesToCompile = jit->times[1];
mc->cr->clockCyclesToCompile = jit2->times[0];
}
}
@@ -394,12 +388,12 @@ int __cdecl main(int argc, char* argv[])
{
if (dif1 < dif4)
{
- crl->clockCyclesToCompile = jit->times[0];
+ crl->clockCyclesToCompile = jit->times[0];
mc->cr->clockCyclesToCompile = jit2->times[0];
}
else
{
- crl->clockCyclesToCompile = jit->times[1];
+ crl->clockCyclesToCompile = jit->times[1];
mc->cr->clockCyclesToCompile = jit2->times[1];
}
}
@@ -410,12 +404,12 @@ int __cdecl main(int argc, char* argv[])
{
if (dif2 < dif3)
{
- crl->clockCyclesToCompile = jit->times[0];
+ crl->clockCyclesToCompile = jit->times[0];
mc->cr->clockCyclesToCompile = jit2->times[1];
}
else
{
- crl->clockCyclesToCompile = jit->times[1];
+ crl->clockCyclesToCompile = jit->times[1];
mc->cr->clockCyclesToCompile = jit2->times[0];
}
}
@@ -423,12 +417,12 @@ int __cdecl main(int argc, char* argv[])
{
if (dif2 < dif4)
{
- crl->clockCyclesToCompile = jit->times[0];
+ crl->clockCyclesToCompile = jit->times[0];
mc->cr->clockCyclesToCompile = jit2->times[1];
}
else
{
- crl->clockCyclesToCompile = jit->times[1];
+ crl->clockCyclesToCompile = jit->times[1];
mc->cr->clockCyclesToCompile = jit2->times[1];
}
}
@@ -436,7 +430,8 @@ int __cdecl main(int argc, char* argv[])
if (methodStatsEmitter != nullptr)
{
- methodStatsEmitter->Emit(reader->GetMethodContextIndex(), mc, crl->clockCyclesToCompile, mc->cr->clockCyclesToCompile);
+ methodStatsEmitter->Emit(reader->GetMethodContextIndex(), mc, crl->clockCyclesToCompile,
+ mc->cr->clockCyclesToCompile);
}
}
else
@@ -454,7 +449,7 @@ int __cdecl main(int argc, char* argv[])
if (!collectThroughput && methodStatsEmitter != nullptr)
{
- //We have a separate call to Emit for collectThroughput
+ // We have a separate call to Emit for collectThroughput
methodStatsEmitter->Emit(reader->GetMethodContextIndex(), mc, -1, -1);
}
@@ -466,7 +461,8 @@ int __cdecl main(int argc, char* argv[])
// We need to check both CompileResults to ensure we have a valid CR
if (crl->AllocMem == nullptr || mc->cr->AllocMem == nullptr)
{
- LogError("method %d is missing a compileResult, cannot do diffing", reader->GetMethodContextIndex());
+ LogError("method %d is missing a compileResult, cannot do diffing",
+ reader->GetMethodContextIndex());
// If we are here this means that either we have 2 Jits and the second Jit failed to compile
// Or we have single Jit and the MethodContext doesn't have an originalCR
@@ -489,12 +485,14 @@ int __cdecl main(int argc, char* argv[])
// to, for instance, failures caused by missing JIT-EE details).
if (res == JitInstance::RESULT_ERROR)
{
- LogError("main method %d of size %d failed to load and compile correctly. EnvCnt=%d", reader->GetMethodContextIndex(), mc->methodSize, mc->repEnvironmentGetCount());
+ LogError("main method %d of size %d failed to load and compile correctly. EnvCnt=%d",
+ reader->GetMethodContextIndex(), mc->methodSize, mc->repEnvironmentGetCount());
if ((o.reproName != nullptr) && (o.indexCount == -1))
{
char buff[500];
sprintf_s(buff, 500, "%s-%d.mc", o.reproName, reader->GetMethodContextIndex());
- 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());
@@ -527,7 +525,8 @@ int __cdecl main(int argc, char* argv[])
// NOTE: these output status strings are parsed by parallelsuperpmi.cpp::ProcessChildStdOut().
if (o.applyDiff)
{
- LogInfo(g_AsmDiffsSummaryFormatString, loadedCount, jittedCount, failCount, jittedCount - failCount - matchCount);
+ LogInfo(g_AsmDiffsSummaryFormatString, loadedCount, jittedCount, failCount,
+ jittedCount - failCount - matchCount);
if (matchCount != jittedCount)
{
diff --git a/src/classlibnative/bcltype/currency.cpp b/src/classlibnative/bcltype/currency.cpp
index 928a903f3f..4506105e25 100644
--- a/src/classlibnative/bcltype/currency.cpp
+++ b/src/classlibnative/bcltype/currency.cpp
@@ -16,7 +16,7 @@
#include "string.h"
-FCIMPL2(void, COMCurrency::DoToDecimal, DECIMAL * result, CY c)
+FCIMPL2_IV(void, COMCurrency::DoToDecimal, DECIMAL * result, CY c)
{
FCALL_CONTRACT;
diff --git a/src/classlibnative/bcltype/currency.h b/src/classlibnative/bcltype/currency.h
index 00c3e8dd5c..a1ba64e463 100644
--- a/src/classlibnative/bcltype/currency.h
+++ b/src/classlibnative/bcltype/currency.h
@@ -16,7 +16,7 @@
class COMCurrency
{
public:
- static FCDECL2 (void, DoToDecimal, DECIMAL * result, CY c);
+ static FCDECL2_IV(void, DoToDecimal, DECIMAL * result, CY c);
};
#include <poppack.h>
diff --git a/src/classlibnative/bcltype/objectnative.cpp b/src/classlibnative/bcltype/objectnative.cpp
index 82b189d5c8..a90a37a692 100644
--- a/src/classlibnative/bcltype/objectnative.cpp
+++ b/src/classlibnative/bcltype/objectnative.cpp
@@ -198,12 +198,6 @@ NOINLINE static Object* GetClassHelper(OBJECTREF objRef)
TypeHandle typeHandle = objRef->GetTypeHandle();
OBJECTREF refType = NULL;
- // Arrays go down this slow path, at least don't do the full HelperMethodFrame setup
- // if we are fetching the cached entry.
- refType = typeHandle.GetManagedClassObjectFast();
- if (refType != NULL)
- return OBJECTREFToObject(refType);
-
HELPER_METHOD_FRAME_BEGIN_RET_ATTRIB_1(Frame::FRAME_ATTR_EXACT_DEPTH|Frame::FRAME_ATTR_CAPTURE_DEPTH_2, refType);
refType = typeHandle.GetManagedClassObject();
diff --git a/src/coreclr/hosts/coreconsole/coreconsole.cpp b/src/coreclr/hosts/coreconsole/coreconsole.cpp
index ea4e2e72c5..e3813d49b3 100644
--- a/src/coreclr/hosts/coreconsole/coreconsole.cpp
+++ b/src/coreclr/hosts/coreconsole/coreconsole.cpp
@@ -71,7 +71,7 @@ class HostEnvironment
// The list of paths to the assemblies that will be trusted by CoreCLR
StringBuffer m_tpaList;
- ICLRRuntimeHost2* m_CLRRuntimeHost;
+ ICLRRuntimeHost4* m_CLRRuntimeHost;
HMODULE m_coreCLRModule;
@@ -326,8 +326,8 @@ public:
return m_hostExeName;
}
- // Returns the ICLRRuntimeHost2 instance, loading it from CoreCLR.dll if necessary, or nullptr on failure.
- ICLRRuntimeHost2* GetCLRRuntimeHost() {
+ // Returns the ICLRRuntimeHost4 instance, loading it from CoreCLR.dll if necessary, or nullptr on failure.
+ ICLRRuntimeHost4* GetCLRRuntimeHost() {
if (!m_CLRRuntimeHost) {
if (!m_coreCLRModule) {
@@ -347,9 +347,9 @@ public:
*m_log << W("Calling GetCLRRuntimeHost(...)") << Logger::endl;
- HRESULT hr = pfnGetCLRRuntimeHost(IID_ICLRRuntimeHost2, (IUnknown**)&m_CLRRuntimeHost);
+ HRESULT hr = pfnGetCLRRuntimeHost(IID_ICLRRuntimeHost4, (IUnknown**)&m_CLRRuntimeHost);
if (FAILED(hr)) {
- *m_log << W("Failed to get ICLRRuntimeHost2 interface. ERRORCODE: ") << hr << Logger::endl;
+ *m_log << W("Failed to get ICLRRuntimeHost4 interface. ERRORCODE: ") << hr << Logger::endl;
return nullptr;
}
}
@@ -405,14 +405,14 @@ bool TryRun(const int argc, const wchar_t* argv[], Logger &log, const bool verbo
// Start the CoreCLR
- ICLRRuntimeHost2 *host = hostEnvironment.GetCLRRuntimeHost();
+ ICLRRuntimeHost4 *host = hostEnvironment.GetCLRRuntimeHost();
if (!host) {
return false;
}
HRESULT hr;
- log << W("Setting ICLRRuntimeHost2 startup flags") << Logger::endl;
+ log << W("Setting ICLRRuntimeHost4 startup flags") << Logger::endl;
// Default startup flags
hr = host->SetStartupFlags((STARTUP_FLAGS)
@@ -424,7 +424,7 @@ bool TryRun(const int argc, const wchar_t* argv[], Logger &log, const bool verbo
return false;
}
- log << W("Starting ICLRRuntimeHost2") << Logger::endl;
+ log << W("Starting ICLRRuntimeHost4") << Logger::endl;
hr = host->Start();
if (FAILED(hr)) {
@@ -541,15 +541,17 @@ bool TryRun(const int argc, const wchar_t* argv[], Logger &log, const bool verbo
log << W("Unloading the AppDomain") << Logger::endl;
- hr = host->UnloadAppDomain(
+ hr = host->UnloadAppDomain2(
domainId,
- true); // Wait until done
+ true,
+ (int *)&exitCode); // Wait until done
if (FAILED(hr)) {
log << W("Failed to unload the AppDomain. ERRORCODE: ") << hr << Logger::endl;
return false;
}
+ log << W("App domain unloaded exit value = ") << exitCode << Logger::endl;
//-------------------------------------------------------------
@@ -568,7 +570,7 @@ bool TryRun(const int argc, const wchar_t* argv[], Logger &log, const bool verbo
// Release the reference to the host
- log << W("Releasing ICLRRuntimeHost2") << Logger::endl;
+ log << W("Releasing ICLRRuntimeHost4") << Logger::endl;
host->Release();
diff --git a/src/coreclr/hosts/corerun/corerun.cpp b/src/coreclr/hosts/corerun/corerun.cpp
index dfbb79c0d2..a9e3b66f3b 100644
--- a/src/coreclr/hosts/corerun/corerun.cpp
+++ b/src/coreclr/hosts/corerun/corerun.cpp
@@ -47,7 +47,7 @@ class HostEnvironment
// The list of paths to the assemblies that will be trusted by CoreCLR
SString m_tpaList;
- ICLRRuntimeHost2* m_CLRRuntimeHost;
+ ICLRRuntimeHost4* m_CLRRuntimeHost;
HMODULE m_coreCLRModule;
@@ -298,8 +298,8 @@ public:
return m_hostExeName;
}
- // Returns the ICLRRuntimeHost2 instance, loading it from CoreCLR.dll if necessary, or nullptr on failure.
- ICLRRuntimeHost2* GetCLRRuntimeHost() {
+ // Returns the ICLRRuntimeHost4 instance, loading it from CoreCLR.dll if necessary, or nullptr on failure.
+ ICLRRuntimeHost4* GetCLRRuntimeHost() {
if (!m_CLRRuntimeHost) {
if (!m_coreCLRModule) {
@@ -319,9 +319,9 @@ public:
*m_log << W("Calling GetCLRRuntimeHost(...)") << Logger::endl;
- HRESULT hr = pfnGetCLRRuntimeHost(IID_ICLRRuntimeHost2, (IUnknown**)&m_CLRRuntimeHost);
+ HRESULT hr = pfnGetCLRRuntimeHost(IID_ICLRRuntimeHost4, (IUnknown**)&m_CLRRuntimeHost);
if (FAILED(hr)) {
- *m_log << W("Failed to get ICLRRuntimeHost2 interface. ERRORCODE: ") << Logger::hresult << hr << Logger::endl;
+ *m_log << W("Failed to get ICLRRuntimeHost4 interface. ERRORCODE: ") << Logger::hresult << hr << Logger::endl;
return nullptr;
}
}
@@ -442,7 +442,7 @@ bool TryRun(const int argc, const wchar_t* argv[], Logger &log, const bool verbo
// Start the CoreCLR
- ICLRRuntimeHost2 *host = hostEnvironment.GetCLRRuntimeHost();
+ ICLRRuntimeHost4 *host = hostEnvironment.GetCLRRuntimeHost();
if (!host) {
return false;
}
@@ -451,7 +451,7 @@ bool TryRun(const int argc, const wchar_t* argv[], Logger &log, const bool verbo
STARTUP_FLAGS flags = CreateStartupFlags();
- log << W("Setting ICLRRuntimeHost2 startup flags") << Logger::endl;
+ log << W("Setting ICLRRuntimeHost4 startup flags") << Logger::endl;
log << W("Server GC enabled: ") << HAS_FLAG(flags, STARTUP_FLAGS::STARTUP_SERVER_GC) << Logger::endl;
log << W("Concurrent GC enabled: ") << HAS_FLAG(flags, STARTUP_FLAGS::STARTUP_CONCURRENT_GC) << Logger::endl;
@@ -462,7 +462,7 @@ bool TryRun(const int argc, const wchar_t* argv[], Logger &log, const bool verbo
return false;
}
- log << W("Starting ICLRRuntimeHost2") << Logger::endl;
+ log << W("Starting ICLRRuntimeHost4") << Logger::endl;
hr = host->Start();
if (FAILED(hr)) {
@@ -470,6 +470,18 @@ bool TryRun(const int argc, const wchar_t* argv[], Logger &log, const bool verbo
return false;
}
+ StackSString tpaList;
+ if (!managedAssemblyFullName.IsEmpty())
+ {
+ // Target assembly should be added to the tpa list. Otherwise corerun.exe
+ // may find wrong assembly to execute.
+ // Details can be found at https://github.com/dotnet/coreclr/issues/5631
+ tpaList = managedAssemblyFullName;
+ tpaList.Append(W(';'));
+ }
+
+ tpaList.Append(hostEnvironment.GetTpaList());
+
//-------------------------------------------------------------
// Create an AppDomain
@@ -499,7 +511,7 @@ bool TryRun(const int argc, const wchar_t* argv[], Logger &log, const bool verbo
};
const wchar_t *property_values[] = {
// TRUSTED_PLATFORM_ASSEMBLIES
- hostEnvironment.GetTpaList(),
+ tpaList,
// APP_PATHS
appPath,
// APP_NI_PATHS
@@ -581,15 +593,17 @@ bool TryRun(const int argc, const wchar_t* argv[], Logger &log, const bool verbo
log << W("Unloading the AppDomain") << Logger::endl;
- hr = host->UnloadAppDomain(
+ hr = host->UnloadAppDomain2(
domainId,
- true); // Wait until done
+ true,
+ (int *)&exitCode); // Wait until done
if (FAILED(hr)) {
log << W("Failed to unload the AppDomain. ERRORCODE: ") << Logger::hresult << hr << Logger::endl;
return false;
}
+ log << W("App domain unloaded exit value = ") << exitCode << Logger::endl;
//-------------------------------------------------------------
@@ -608,7 +622,7 @@ bool TryRun(const int argc, const wchar_t* argv[], Logger &log, const bool verbo
// Release the reference to the host
- log << W("Releasing ICLRRuntimeHost2") << Logger::endl;
+ log << W("Releasing ICLRRuntimeHost4") << Logger::endl;
host->Release();
diff --git a/src/coreclr/hosts/inc/coreclrhost.h b/src/coreclr/hosts/inc/coreclrhost.h
index f0d7952aa6..dd11cb6a51 100644
--- a/src/coreclr/hosts/inc/coreclrhost.h
+++ b/src/coreclr/hosts/inc/coreclrhost.h
@@ -29,6 +29,11 @@ CORECLR_HOSTING_API(coreclr_shutdown,
void* hostHandle,
unsigned int domainId);
+CORECLR_HOSTING_API(coreclr_shutdown_2,
+ void* hostHandle,
+ unsigned int domainId,
+ int* latchedExitCode);
+
CORECLR_HOSTING_API(coreclr_create_delegate,
void* hostHandle,
unsigned int domainId,
diff --git a/src/coreclr/hosts/unixcoreruncommon/coreruncommon.cpp b/src/coreclr/hosts/unixcoreruncommon/coreruncommon.cpp
index d40fb424e6..f97f262993 100644
--- a/src/coreclr/hosts/unixcoreruncommon/coreruncommon.cpp
+++ b/src/coreclr/hosts/unixcoreruncommon/coreruncommon.cpp
@@ -35,6 +35,10 @@
// disabled. Server GC is off by default.
static const char* serverGcVar = "CORECLR_SERVER_GC";
+// Name of environment variable to control "System.Globalization.Invariant"
+// Set to 1 for Globalization Invariant mode to be true. Default is false.
+static const char* globalizationInvariantVar = "CORECLR_GLOBAL_INVARIANT";
+
#if defined(__linux__)
#define symlinkEntrypointExecutable "/proc/self/exe"
#elif !defined(__APPLE__)
@@ -260,6 +264,17 @@ void AddFilesFromDirectoryToTpaList(const char* directory, std::string& tpaList)
closedir(dir);
}
+const char* GetEnvValueBoolean(const char* envVariable)
+{
+ const char* envValue = std::getenv(envVariable);
+ if (envValue == nullptr)
+ {
+ envValue = "0";
+ }
+ // CoreCLR expects strings "true" and "false" instead of "1" and "0".
+ return (std::strcmp(envValue, "1") == 0 || strcasecmp(envValue, "true") == 0) ? "true" : "false";
+}
+
int ExecuteManagedAssembly(
const char* currentExeAbsolutePath,
const char* clrFilesAbsolutePath,
@@ -299,6 +314,15 @@ int ExecuteManagedAssembly(
GetDirectory(managedAssemblyAbsolutePath, appPath);
std::string tpaList;
+ if (strlen(managedAssemblyAbsolutePath) > 0)
+ {
+ // Target assembly should be added to the tpa list. Otherwise corerun.exe
+ // may find wrong assembly to execute.
+ // Details can be found at https://github.com/dotnet/coreclr/issues/5631
+ tpaList = managedAssemblyAbsolutePath;
+ tpaList.append(":");
+ }
+
// Construct native search directory paths
std::string nativeDllSearchDirs(appPath);
char *coreLibraries = getenv("CORE_LIBRARIES");
@@ -311,6 +335,7 @@ int ExecuteManagedAssembly(
AddFilesFromDirectoryToTpaList(coreLibraries, tpaList);
}
}
+
nativeDllSearchDirs.append(":");
nativeDllSearchDirs.append(clrFilesAbsolutePath);
@@ -321,7 +346,7 @@ int ExecuteManagedAssembly(
{
coreclr_initialize_ptr initializeCoreCLR = (coreclr_initialize_ptr)dlsym(coreclrLib, "coreclr_initialize");
coreclr_execute_assembly_ptr executeAssembly = (coreclr_execute_assembly_ptr)dlsym(coreclrLib, "coreclr_execute_assembly");
- coreclr_shutdown_ptr shutdownCoreCLR = (coreclr_shutdown_ptr)dlsym(coreclrLib, "coreclr_shutdown");
+ coreclr_shutdown_2_ptr shutdownCoreCLR = (coreclr_shutdown_2_ptr)dlsym(coreclrLib, "coreclr_shutdown_2");
if (initializeCoreCLR == nullptr)
{
@@ -333,19 +358,15 @@ int ExecuteManagedAssembly(
}
else if (shutdownCoreCLR == nullptr)
{
- fprintf(stderr, "Function coreclr_shutdown not found in the libcoreclr.so\n");
+ fprintf(stderr, "Function coreclr_shutdown_2 not found in the libcoreclr.so\n");
}
else
{
// Check whether we are enabling server GC (off by default)
- const char* useServerGc = std::getenv(serverGcVar);
- if (useServerGc == nullptr)
- {
- useServerGc = "0";
- }
+ const char* useServerGc = GetEnvValueBoolean(serverGcVar);
- // CoreCLR expects strings "true" and "false" instead of "1" and "0".
- useServerGc = std::strcmp(useServerGc, "1") == 0 ? "true" : "false";
+ // Check Globalization Invariant mode (false by default)
+ const char* globalizationInvariant = GetEnvValueBoolean(globalizationInvariantVar);
// Allowed property names:
// APPBASE
@@ -369,6 +390,7 @@ int ExecuteManagedAssembly(
"APP_NI_PATHS",
"NATIVE_DLL_SEARCH_DIRECTORIES",
"System.GC.Server",
+ "System.Globalization.Invariant",
};
const char *propertyValues[] = {
// TRUSTED_PLATFORM_ASSEMBLIES
@@ -381,6 +403,8 @@ int ExecuteManagedAssembly(
nativeDllSearchDirs.c_str(),
// System.GC.Server
useServerGc,
+ // System.Globalization.Invariant
+ globalizationInvariant,
};
void* hostHandle;
@@ -416,12 +440,18 @@ int ExecuteManagedAssembly(
exitCode = -1;
}
- st = shutdownCoreCLR(hostHandle, domainId);
+ int latchedExitCode = 0;
+ st = shutdownCoreCLR(hostHandle, domainId, &latchedExitCode);
if (!SUCCEEDED(st))
{
fprintf(stderr, "coreclr_shutdown failed - status: 0x%08x\n", st);
exitCode = -1;
}
+
+ if (exitCode != -1)
+ {
+ exitCode = latchedExitCode;
+ }
}
}
diff --git a/src/debug/CMakeLists.txt b/src/debug/CMakeLists.txt
index 1940aa9c79..bcfc257b9d 100644
--- a/src/debug/CMakeLists.txt
+++ b/src/debug/CMakeLists.txt
@@ -3,4 +3,4 @@ add_subdirectory(dbgutil)
add_subdirectory(ildbsymlib)
add_subdirectory(ee)
add_subdirectory(di)
-add_subdirectory(shim)
+add_subdirectory(shim) \ No newline at end of file
diff --git a/src/debug/createdump/.gitmirrorall b/src/debug/createdump/.gitmirrorall
new file mode 100644
index 0000000000..9ee5c57b99
--- /dev/null
+++ b/src/debug/createdump/.gitmirrorall
@@ -0,0 +1 @@
+This folder will be mirrored by the Git-TFS Mirror recursively. \ No newline at end of file
diff --git a/src/debug/createdump/CMakeLists.txt b/src/debug/createdump/CMakeLists.txt
new file mode 100644
index 0000000000..5b5ec0a5c6
--- /dev/null
+++ b/src/debug/createdump/CMakeLists.txt
@@ -0,0 +1,38 @@
+project(createdump)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+remove_definitions(-DUNICODE)
+remove_definitions(-D_UNICODE)
+
+include_directories(BEFORE ${VM_DIR})
+
+add_definitions(-DPAL_STDCPP_COMPAT=1)
+
+add_compile_options(-fPIC)
+
+set(CREATEDUMP_SOURCES
+ createdump.cpp
+ crashinfo.cpp
+ threadinfo.cpp
+ datatarget.cpp
+ dumpwriter.cpp
+)
+
+_add_library(createdump_lib
+ ${CREATEDUMP_SOURCES}
+)
+
+_add_executable(createdump
+ main.cpp
+)
+
+target_link_libraries(createdump
+ createdump_lib
+ # share the PAL in the dac module
+ mscordaccore
+)
+
+add_dependencies(createdump mscordaccore)
+
+install_clr(createdump)
diff --git a/src/debug/createdump/crashinfo.cpp b/src/debug/createdump/crashinfo.cpp
new file mode 100644
index 0000000000..cae8857d65
--- /dev/null
+++ b/src/debug/createdump/crashinfo.cpp
@@ -0,0 +1,628 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+#include "createdump.h"
+
+CrashInfo::CrashInfo(pid_t pid, ICLRDataTarget* dataTarget, bool sos) :
+ m_ref(1),
+ m_pid(pid),
+ m_ppid(-1),
+ m_name(nullptr),
+ m_sos(sos),
+ m_dataTarget(dataTarget)
+{
+ dataTarget->AddRef();
+ m_auxvValues.fill(0);
+}
+
+CrashInfo::~CrashInfo()
+{
+ if (m_name != nullptr)
+ {
+ free(m_name);
+ }
+ // Clean up the threads
+ for (ThreadInfo* thread : m_threads)
+ {
+ delete thread;
+ }
+ m_threads.clear();
+
+ // Module and other mappings have a file name to clean up.
+ for (const MemoryRegion& region : m_moduleMappings)
+ {
+ const_cast<MemoryRegion&>(region).Cleanup();
+ }
+ m_moduleMappings.clear();
+ for (const MemoryRegion& region : m_otherMappings)
+ {
+ const_cast<MemoryRegion&>(region).Cleanup();
+ }
+ m_otherMappings.clear();
+ m_dataTarget->Release();
+}
+
+STDMETHODIMP
+CrashInfo::QueryInterface(
+ ___in REFIID InterfaceId,
+ ___out PVOID* Interface)
+{
+ if (InterfaceId == IID_IUnknown ||
+ InterfaceId == IID_ICLRDataEnumMemoryRegionsCallback)
+ {
+ *Interface = (ICLRDataEnumMemoryRegionsCallback*)this;
+ AddRef();
+ return S_OK;
+ }
+ else
+ {
+ *Interface = NULL;
+ return E_NOINTERFACE;
+ }
+}
+
+STDMETHODIMP_(ULONG)
+CrashInfo::AddRef()
+{
+ LONG ref = InterlockedIncrement(&m_ref);
+ return ref;
+}
+
+STDMETHODIMP_(ULONG)
+CrashInfo::Release()
+{
+ LONG ref = InterlockedDecrement(&m_ref);
+ if (ref == 0)
+ {
+ delete this;
+ }
+ return ref;
+}
+
+HRESULT STDMETHODCALLTYPE
+CrashInfo::EnumMemoryRegion(
+ /* [in] */ CLRDATA_ADDRESS address,
+ /* [in] */ ULONG32 size)
+{
+ InsertMemoryRegion(address, size);
+ return S_OK;
+}
+
+bool
+CrashInfo::EnumerateAndSuspendThreads()
+{
+ char taskPath[128];
+ snprintf(taskPath, sizeof(taskPath), "/proc/%d/task", m_pid);
+
+ DIR* taskDir = opendir(taskPath);
+ if (taskDir == nullptr)
+ {
+ fprintf(stderr, "opendir(%s) FAILED %s\n", taskPath, strerror(errno));
+ return false;
+ }
+
+ struct dirent* entry;
+ while ((entry = readdir(taskDir)) != nullptr)
+ {
+ pid_t tid = static_cast<pid_t>(strtol(entry->d_name, nullptr, 10));
+ if (tid != 0)
+ {
+ // Don't suspend the threads if running under sos
+ if (!m_sos)
+ {
+ // Reference: http://stackoverflow.com/questions/18577956/how-to-use-ptrace-to-get-a-consistent-view-of-multiple-threads
+ if (ptrace(PTRACE_ATTACH, tid, nullptr, nullptr) != -1)
+ {
+ int waitStatus;
+ waitpid(tid, &waitStatus, __WALL);
+ }
+ else
+ {
+ fprintf(stderr, "ptrace(ATTACH, %d) FAILED %s\n", tid, strerror(errno));
+ closedir(taskDir);
+ return false;
+ }
+ }
+ // Add to the list of threads
+ ThreadInfo* thread = new ThreadInfo(tid);
+ m_threads.push_back(thread);
+ }
+ }
+
+ closedir(taskDir);
+ return true;
+}
+
+bool
+CrashInfo::GatherCrashInfo(const char* programPath, MINIDUMP_TYPE minidumpType)
+{
+ // Get the process info
+ if (!GetStatus(m_pid, &m_ppid, &m_tgid, &m_name))
+ {
+ return false;
+ }
+ // Get the info about the threads (registers, etc.)
+ for (ThreadInfo* thread : m_threads)
+ {
+ if (!thread->Initialize(m_sos ? m_dataTarget : nullptr))
+ {
+ return false;
+ }
+ }
+ // Get the auxv data
+ if (!GetAuxvEntries())
+ {
+ return false;
+ }
+ // Get shared module debug info
+ if (!GetDSOInfo())
+ {
+ return false;
+ }
+ // Gather all the module memory mappings (from /dev/$pid/maps)
+ if (!EnumerateModuleMappings())
+ {
+ return false;
+ }
+ // Gather all the useful memory regions from the DAC
+ if (!EnumerateMemoryRegionsWithDAC(programPath, minidumpType))
+ {
+ return false;
+ }
+ // Add the thread's stack and some code memory to core
+ for (ThreadInfo* thread : m_threads)
+ {
+ uint64_t start;
+ size_t size;
+
+ // Add the thread's stack and some of the code
+ thread->GetThreadStack(*this, &start, &size);
+ InsertMemoryRegion(start, size);
+
+ thread->GetThreadCode(&start, &size);
+ InsertMemoryRegion(start, size);
+ }
+ // Join all adjacent memory regions
+ CombineMemoryRegions();
+ return true;
+}
+
+void
+CrashInfo::ResumeThreads()
+{
+ if (!m_sos)
+ {
+ for (ThreadInfo* thread : m_threads)
+ {
+ thread->ResumeThread();
+ }
+ }
+}
+
+bool
+CrashInfo::GetAuxvEntries()
+{
+ char auxvPath[128];
+ snprintf(auxvPath, sizeof(auxvPath), "/proc/%d/auxv", m_pid);
+
+ int fd = open(auxvPath, O_RDONLY, 0);
+ if (fd == -1)
+ {
+ fprintf(stderr, "open(%s) FAILED %s\n", auxvPath, strerror(errno));
+ return false;
+ }
+ bool result = false;
+ elf_aux_entry auxvEntry;
+
+ while (read(fd, &auxvEntry, sizeof(elf_aux_entry)) == sizeof(elf_aux_entry))
+ {
+ m_auxvEntries.push_back(auxvEntry);
+ if (auxvEntry.a_type == AT_NULL)
+ {
+ break;
+ }
+ if (auxvEntry.a_type < AT_MAX)
+ {
+ m_auxvValues[auxvEntry.a_type] = auxvEntry.a_un.a_val;
+ TRACE("AUXV: %lu = %016lx\n", auxvEntry.a_type, auxvEntry.a_un.a_val);
+ result = true;
+ }
+ }
+
+ close(fd);
+ return result;
+}
+
+bool
+CrashInfo::EnumerateModuleMappings()
+{
+ // Here we read /proc/<pid>/maps file in order to parse it and figure out what it says
+ // about a library we are looking for. This file looks something like this:
+ //
+ // [address] [perms] [offset] [dev] [inode] [pathname] - HEADER is not preset in an actual file
+ //
+ // 35b1800000-35b1820000 r-xp 00000000 08:02 135522 /usr/lib64/ld-2.15.so
+ // 35b1a1f000-35b1a20000 r--p 0001f000 08:02 135522 /usr/lib64/ld-2.15.so
+ // 35b1a20000-35b1a21000 rw-p 00020000 08:02 135522 /usr/lib64/ld-2.15.so
+ // 35b1a21000-35b1a22000 rw-p 00000000 00:00 0 [heap]
+ // 35b1c00000-35b1dac000 r-xp 00000000 08:02 135870 /usr/lib64/libc-2.15.so
+ // 35b1dac000-35b1fac000 ---p 001ac000 08:02 135870 /usr/lib64/libc-2.15.so
+ // 35b1fac000-35b1fb0000 r--p 001ac000 08:02 135870 /usr/lib64/libc-2.15.so
+ // 35b1fb0000-35b1fb2000 rw-p 001b0000 08:02 135870 /usr/lib64/libc-2.15.so
+ char* line = NULL;
+ size_t lineLen = 0;
+ int count = 0;
+ ssize_t read;
+
+ // Making something like: /proc/123/maps
+ char mapPath[128];
+ int chars = snprintf(mapPath, sizeof(mapPath), "/proc/%d/maps", m_pid);
+ assert(chars > 0 && chars <= sizeof(mapPath));
+
+ FILE* mapsFile = fopen(mapPath, "r");
+ if (mapsFile == NULL)
+ {
+ fprintf(stderr, "fopen(%s) FAILED %s\n", mapPath, strerror(errno));
+ return false;
+ }
+ // linuxGateAddress is the beginning of the kernel's mapping of
+ // linux-gate.so in the process. It doesn't actually show up in the
+ // maps list as a filename, but it can be found using the AT_SYSINFO_EHDR
+ // aux vector entry, which gives the information necessary to special
+ // case its entry when creating the list of mappings.
+ // See http://www.trilithium.com/johan/2005/08/linux-gate/ for more
+ // information.
+ const void* linuxGateAddress = (const void*)m_auxvValues[AT_SYSINFO_EHDR];
+
+ // Reading maps file line by line
+ while ((read = getline(&line, &lineLen, mapsFile)) != -1)
+ {
+ uint64_t start, end, offset;
+ char* permissions = nullptr;
+ char* moduleName = nullptr;
+
+ int c = 0;
+ if ((c = sscanf(line, "%lx-%lx %m[-rwxsp] %lx %*[:0-9a-f] %*d %ms\n", &start, &end, &permissions, &offset, &moduleName)) == 5)
+ {
+ if (linuxGateAddress != nullptr && reinterpret_cast<void*>(start) == linuxGateAddress)
+ {
+ InsertMemoryRegion(start, end - start);
+ free(moduleName);
+ }
+ else {
+ uint32_t permissionFlags = 0;
+ if (strchr(permissions, 'r')) {
+ permissionFlags |= PF_R;
+ }
+ if (strchr(permissions, 'w')) {
+ permissionFlags |= PF_W;
+ }
+ if (strchr(permissions, 'x')) {
+ permissionFlags |= PF_X;
+ }
+ MemoryRegion memoryRegion(permissionFlags, start, end, offset, moduleName);
+
+ if (moduleName != nullptr && *moduleName == '/') {
+ m_moduleMappings.insert(memoryRegion);
+ }
+ else {
+ m_otherMappings.insert(memoryRegion);
+ }
+ }
+ free(permissions);
+ }
+ }
+
+ if (g_diagnostics)
+ {
+ TRACE("Module mappings:\n");
+ for (const MemoryRegion& region : m_moduleMappings)
+ {
+ region.Print();
+ }
+ TRACE("Other mappings:\n");
+ for (const MemoryRegion& region : m_otherMappings)
+ {
+ region.Print();
+ }
+ }
+
+ free(line); // We didn't allocate line, but as per contract of getline we should free it
+ fclose(mapsFile);
+
+ return true;
+}
+
+bool
+CrashInfo::EnumerateMemoryRegionsWithDAC(const char* programPath, MINIDUMP_TYPE minidumpType)
+{
+ PFN_CLRDataCreateInstance pfnCLRDataCreateInstance = nullptr;
+ ICLRDataEnumMemoryRegions *clrDataEnumRegions = nullptr;
+ HMODULE hdac = nullptr;
+ HRESULT hr = S_OK;
+ bool result = false;
+
+ // We assume that the DAC is in the same location as this createdump exe
+ std::string dacPath;
+ dacPath.append(programPath);
+ dacPath.append("/");
+ dacPath.append(MAKEDLLNAME_A("mscordaccore"));
+
+ // Load and initialize the DAC
+ hdac = LoadLibraryA(dacPath.c_str());
+ if (hdac == nullptr)
+ {
+ fprintf(stderr, "LoadLibraryA(%s) FAILED %d\n", dacPath.c_str(), GetLastError());
+ goto exit;
+ }
+ pfnCLRDataCreateInstance = (PFN_CLRDataCreateInstance)GetProcAddress(hdac, "CLRDataCreateInstance");
+ if (pfnCLRDataCreateInstance == nullptr)
+ {
+ fprintf(stderr, "GetProcAddress(CLRDataCreateInstance) FAILED %d\n", GetLastError());
+ goto exit;
+ }
+ hr = pfnCLRDataCreateInstance(__uuidof(ICLRDataEnumMemoryRegions), m_dataTarget, (void**)&clrDataEnumRegions);
+ if (FAILED(hr))
+ {
+ fprintf(stderr, "CLRDataCreateInstance(ICLRDataEnumMemoryRegions) FAILED %08x\n", hr);
+ goto exit;
+ }
+ // Calls CrashInfo::EnumMemoryRegion for each memory region found by the DAC
+ hr = clrDataEnumRegions->EnumMemoryRegions(this, minidumpType, CLRDATA_ENUM_MEM_DEFAULT);
+ if (FAILED(hr))
+ {
+ fprintf(stderr, "EnumMemoryRegions FAILED %08x\n", hr);
+ goto exit;
+ }
+ result = true;
+exit:
+ if (clrDataEnumRegions != nullptr)
+ {
+ clrDataEnumRegions->Release();
+ }
+ if (hdac != nullptr)
+ {
+ FreeLibrary(hdac);
+ }
+ return result;
+}
+
+bool
+CrashInfo::GetDSOInfo()
+{
+ Phdr* phdrAddr = reinterpret_cast<Phdr*>(m_auxvValues[AT_PHDR]);
+ int phnum = m_auxvValues[AT_PHNUM];
+ assert(m_auxvValues[AT_PHENT] == sizeof(Phdr));
+
+ if (phnum <= 0 || phdrAddr == nullptr) {
+ return false;
+ }
+ TRACE("DSO: phdr %p phnum %d\n", phdrAddr, phnum);
+
+ // Search for the program PT_DYNAMIC header
+ ElfW(Dyn)* dynamicAddr = nullptr;
+ for (int i = 0; i < phnum; i++, phdrAddr++)
+ {
+ Phdr ph;
+ if (!ReadMemory(phdrAddr, &ph, sizeof(ph))) {
+ return false;
+ }
+ TRACE("DSO: phdr %p type %d (%x) vaddr %016lx memsz %016lx offset %016lx\n",
+ phdrAddr, ph.p_type, ph.p_type, ph.p_vaddr, ph.p_memsz, ph.p_offset);
+
+ if (ph.p_type == PT_DYNAMIC)
+ {
+ dynamicAddr = reinterpret_cast<ElfW(Dyn)*>(ph.p_vaddr);
+ }
+ else if (ph.p_type == PT_GNU_EH_FRAME)
+ {
+ if (ph.p_vaddr != 0 && ph.p_memsz != 0)
+ {
+ InsertMemoryRegion(ph.p_vaddr, ph.p_memsz);
+ }
+ }
+ }
+
+ if (dynamicAddr == nullptr) {
+ return false;
+ }
+
+ // Search for dynamic debug (DT_DEBUG) entry
+ struct r_debug* rdebugAddr = nullptr;
+ for (;;) {
+ ElfW(Dyn) dyn;
+ if (!ReadMemory(dynamicAddr, &dyn, sizeof(dyn))) {
+ return false;
+ }
+ TRACE("DSO: dyn %p tag %ld (%lx) d_ptr %016lx\n", dynamicAddr, dyn.d_tag, dyn.d_tag, dyn.d_un.d_ptr);
+ if (dyn.d_tag == DT_DEBUG) {
+ rdebugAddr = reinterpret_cast<struct r_debug*>(dyn.d_un.d_ptr);
+ }
+ else if (dyn.d_tag == DT_NULL) {
+ break;
+ }
+ dynamicAddr++;
+ }
+
+ // Add the DSO r_debug entry
+ TRACE("DSO: rdebugAddr %p\n", rdebugAddr);
+ struct r_debug debugEntry;
+ if (!ReadMemory(rdebugAddr, &debugEntry, sizeof(debugEntry))) {
+ return false;
+ }
+
+ // Add the DSO link_map entries
+ for (struct link_map* linkMapAddr = debugEntry.r_map; linkMapAddr != nullptr;) {
+ struct link_map map;
+ if (!ReadMemory(linkMapAddr, &map, sizeof(map))) {
+ return false;
+ }
+ char moduleName[257] = { 0 };
+ if (map.l_name != nullptr) {
+ if (!ReadMemory(map.l_name, &moduleName, sizeof(moduleName) - 1)) {
+ return false;
+ }
+ }
+ TRACE("DSO: link_map entry %p l_ld %p l_addr %lx %s\n", linkMapAddr, map.l_ld, map.l_addr, moduleName);
+ linkMapAddr = map.l_next;
+ }
+
+ return true;
+}
+
+//
+// ReadMemory from target and add to memory regions list
+//
+bool
+CrashInfo::ReadMemory(void* address, void* buffer, size_t size)
+{
+ uint32_t read = 0;
+ if (FAILED(m_dataTarget->ReadVirtual(reinterpret_cast<CLRDATA_ADDRESS>(address), reinterpret_cast<PBYTE>(buffer), size, &read)))
+ {
+ return false;
+ }
+ InsertMemoryRegion(reinterpret_cast<uint64_t>(address), size);
+ return true;
+}
+
+//
+// Add this memory chunk to the list of regions to be
+// written to the core dump.
+//
+void
+CrashInfo::InsertMemoryRegion(uint64_t address, size_t size)
+{
+ // Round to page boundary
+ uint64_t start = address & PAGE_MASK;
+ assert(start > 0);
+
+ // Round up to page boundary
+ uint64_t end = ((address + size) + (PAGE_SIZE - 1)) & PAGE_MASK;
+ assert(end > 0);
+
+ MemoryRegion memoryRegionFull(start, end);
+
+ // First check if the full memory region can be added without conflicts
+ const auto& found = m_memoryRegions.find(memoryRegionFull);
+ if (found == m_memoryRegions.end())
+ {
+ // Add full memory region
+ m_memoryRegions.insert(memoryRegionFull);
+ }
+ else
+ {
+ // The memory region is not wholely contained in region found
+ if (!found->Contains(memoryRegionFull))
+ {
+ // The region overlaps/conflicts with one already in the set so
+ // add one page at a time to avoid the overlapping pages.
+ uint64_t numberPages = (end - start) >> PAGE_SHIFT;
+
+ for (int p = 0; p < numberPages; p++, start += PAGE_SIZE)
+ {
+ MemoryRegion memoryRegion(start, start + PAGE_SIZE);
+
+ const auto& found = m_memoryRegions.find(memoryRegion);
+ if (found == m_memoryRegions.end())
+ {
+ m_memoryRegions.insert(memoryRegion);
+ }
+ }
+ }
+ }
+}
+
+//
+// Combine any adjacent memory regions into one
+//
+void
+CrashInfo::CombineMemoryRegions()
+{
+ assert(!m_memoryRegions.empty());
+
+ std::set<MemoryRegion> memoryRegionsNew;
+
+ uint64_t start = m_memoryRegions.begin()->StartAddress();
+ uint64_t end = start;
+
+ for (const MemoryRegion& region : m_memoryRegions)
+ {
+ if (end == region.StartAddress())
+ {
+ end = region.EndAddress();
+ }
+ else
+ {
+ MemoryRegion memoryRegion(start, end);
+ assert(memoryRegionsNew.find(memoryRegion) == memoryRegionsNew.end());
+ memoryRegionsNew.insert(memoryRegion);
+
+ start = region.StartAddress();
+ end = region.EndAddress();
+ }
+ }
+
+ assert(start != end);
+ MemoryRegion memoryRegion(start, end);
+ assert(memoryRegionsNew.find(memoryRegion) == memoryRegionsNew.end());
+ memoryRegionsNew.insert(memoryRegion);
+
+ m_memoryRegions = memoryRegionsNew;
+
+ if (g_diagnostics)
+ {
+ TRACE("Memory Regions:\n");
+ for (const MemoryRegion& region : m_memoryRegions)
+ {
+ region.Print();
+ }
+ }
+}
+
+bool
+CrashInfo::GetStatus(pid_t pid, pid_t* ppid, pid_t* tgid, char** name)
+{
+ char statusPath[128];
+ snprintf(statusPath, sizeof(statusPath), "/proc/%d/status", pid);
+
+ FILE *statusFile = fopen(statusPath, "r");
+ if (statusFile == nullptr)
+ {
+ fprintf(stderr, "GetStatus fopen(%s) FAILED\n", statusPath);
+ return false;
+ }
+
+ *ppid = -1;
+
+ char *line = nullptr;
+ size_t lineLen = 0;
+ ssize_t read;
+ while ((read = getline(&line, &lineLen, statusFile)) != -1)
+ {
+ if (strncmp("PPid:\t", line, 6) == 0)
+ {
+ *ppid = _atoi64(line + 6);
+ }
+ else if (strncmp("Tgid:\t", line, 6) == 0)
+ {
+ *tgid = _atoi64(line + 6);
+ }
+ else if (strncmp("Name:\t", line, 6) == 0)
+ {
+ if (name != nullptr)
+ {
+ char* n = strchr(line + 6, '\n');
+ if (n != nullptr)
+ {
+ *n = '\0';
+ }
+ *name = strdup(line + 6);
+ }
+ }
+ }
+
+ free(line);
+ fclose(statusFile);
+ return true;
+}
diff --git a/src/debug/createdump/crashinfo.h b/src/debug/createdump/crashinfo.h
new file mode 100644
index 0000000000..40d7f5da45
--- /dev/null
+++ b/src/debug/createdump/crashinfo.h
@@ -0,0 +1,73 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+// typedef for our parsing of the auxv variables in /proc/pid/auxv.
+#if defined(__i386) || defined(__ARM_EABI__)
+typedef Elf32_auxv_t elf_aux_entry;
+#elif defined(__x86_64) || defined(__aarch64__)
+typedef Elf64_auxv_t elf_aux_entry;
+#endif
+
+typedef __typeof__(((elf_aux_entry*) 0)->a_un.a_val) elf_aux_val_t;
+
+// All interesting auvx entry types are AT_SYSINFO_EHDR and below
+#define AT_MAX (AT_SYSINFO_EHDR + 1)
+
+class CrashInfo : public ICLRDataEnumMemoryRegionsCallback
+{
+private:
+ LONG m_ref; // reference count
+ pid_t m_pid; // pid
+ pid_t m_ppid; // parent pid
+ pid_t m_tgid; // process group
+ char* m_name; // exe name
+ bool m_sos; // true if running under sos
+ ICLRDataTarget* m_dataTarget; // read process memory, etc.
+ std::array<elf_aux_val_t, AT_MAX> m_auxvValues; // auxv values
+ std::vector<elf_aux_entry> m_auxvEntries; // full auxv entries
+ std::vector<ThreadInfo*> m_threads; // threads found and suspended
+ std::set<MemoryRegion> m_moduleMappings; // module memory mappings
+ std::set<MemoryRegion> m_otherMappings; // other memory mappings
+ std::set<MemoryRegion> m_memoryRegions; // memory regions from DAC, etc.
+
+public:
+ CrashInfo(pid_t pid, ICLRDataTarget* dataTarget, bool sos);
+ virtual ~CrashInfo();
+ bool EnumerateAndSuspendThreads();
+ bool GatherCrashInfo(const char* programPath, MINIDUMP_TYPE minidumpType);
+ void ResumeThreads();
+ static bool GetStatus(pid_t pid, pid_t* ppid, pid_t* tgid, char** name);
+
+ const pid_t Pid() const { return m_pid; }
+ const pid_t Ppid() const { return m_ppid; }
+ const pid_t Tgid() const { return m_tgid; }
+ const char* Name() const { return m_name; }
+ ICLRDataTarget* DataTarget() const { return m_dataTarget; }
+
+ const std::vector<ThreadInfo*> Threads() const { return m_threads; }
+ const std::set<MemoryRegion> ModuleMappings() const { return m_moduleMappings; }
+ const std::set<MemoryRegion> OtherMappings() const { return m_otherMappings; }
+ const std::set<MemoryRegion> MemoryRegions() const { return m_memoryRegions; }
+ const std::vector<elf_aux_entry> AuxvEntries() const { return m_auxvEntries; }
+ const size_t GetAuxvSize() const { return m_auxvEntries.size() * sizeof(elf_aux_entry); }
+
+ // IUnknown
+ STDMETHOD(QueryInterface)(___in REFIID InterfaceId, ___out PVOID* Interface);
+ STDMETHOD_(ULONG, AddRef)();
+ STDMETHOD_(ULONG, Release)();
+
+ // ICLRDataEnumMemoryRegionsCallback
+ virtual HRESULT STDMETHODCALLTYPE EnumMemoryRegion(
+ /* [in] */ CLRDATA_ADDRESS address,
+ /* [in] */ ULONG32 size);
+
+private:
+ bool GetAuxvEntries();
+ bool EnumerateModuleMappings();
+ bool EnumerateMemoryRegionsWithDAC(const char* programPath, MINIDUMP_TYPE minidumpType);
+ bool GetDSOInfo();
+ bool ReadMemory(void* address, void* buffer, size_t size);
+ void InsertMemoryRegion(uint64_t address, size_t size);
+ void CombineMemoryRegions();
+};
diff --git a/src/debug/createdump/createdump.cpp b/src/debug/createdump/createdump.cpp
new file mode 100644
index 0000000000..0a95e535aa
--- /dev/null
+++ b/src/debug/createdump/createdump.cpp
@@ -0,0 +1,69 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+#include "createdump.h"
+
+bool g_diagnostics = false;
+
+//
+// The common create dump code
+//
+bool
+CreateDumpCommon(const char* programPath, const char* dumpPathTemplate, MINIDUMP_TYPE minidumpType, CrashInfo* crashInfo)
+{
+ ReleaseHolder<DumpWriter> dumpWriter = new DumpWriter(*crashInfo);
+ bool result = false;
+
+ ArrayHolder<char> dumpPath = new char[MAX_LONGPATH];
+ snprintf(dumpPath, MAX_LONGPATH, dumpPathTemplate, crashInfo->Pid());
+
+ const char* dumpType = "minidump";
+ switch (minidumpType)
+ {
+ case MiniDumpWithPrivateReadWriteMemory:
+ dumpType = "minidump with heap";
+ break;
+
+ case MiniDumpFilterTriage:
+ dumpType = "triage minidump";
+ break;
+
+ default:
+ break;
+ }
+ printf("Writing %s to file %s\n", dumpType, (char*)dumpPath);
+
+ // Suspend all the threads in the target process and build the list of threads
+ if (!crashInfo->EnumerateAndSuspendThreads())
+ {
+ goto exit;
+ }
+ // Gather all the info about the process, threads (registers, etc.) and memory regions
+ if (!crashInfo->GatherCrashInfo(programPath, minidumpType))
+ {
+ goto exit;
+ }
+ if (!dumpWriter->OpenDump(dumpPath))
+ {
+ goto exit;
+ }
+ if (!dumpWriter->WriteDump())
+ {
+ goto exit;
+ }
+ result = true;
+exit:
+ crashInfo->ResumeThreads();
+ return result;
+}
+
+//
+// Entry point for SOS createdump command
+//
+bool
+CreateDumpForSOS(const char* programPath, const char* dumpPathTemplate, pid_t pid, MINIDUMP_TYPE minidumpType, ICLRDataTarget* dataTarget)
+{
+ ReleaseHolder<CrashInfo> crashInfo = new CrashInfo(pid, dataTarget, true);
+ return CreateDumpCommon(programPath, dumpPathTemplate, minidumpType, crashInfo);
+} \ No newline at end of file
diff --git a/src/debug/createdump/createdump.h b/src/debug/createdump/createdump.h
new file mode 100644
index 0000000000..38c3525f34
--- /dev/null
+++ b/src/debug/createdump/createdump.h
@@ -0,0 +1,57 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+#define ___in _SAL1_Source_(__in, (), _In_)
+#define ___out _SAL1_Source_(__out, (), _Out_)
+
+#ifndef _countof
+#define _countof(x) (sizeof(x)/sizeof(x[0]))
+#endif
+
+extern bool g_diagnostics;
+
+#define TRACE(args...) \
+ if (g_diagnostics) { \
+ printf(args); \
+ }
+
+#include <winternl.h>
+#include <winver.h>
+#include <windows.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <stddef.h>
+#include <string.h>
+#include <corhdr.h>
+#include <cor.h>
+#include <corsym.h>
+#include <clrdata.h>
+#include <xclrdata.h>
+#include <corerror.h>
+#include <cordebug.h>
+#include <xcordebug.h>
+#include <mscoree.h>
+#include <dumpcommon.h>
+#include <arrayholder.h>
+#include <releaseholder.h>
+#include <unistd.h>
+#include <signal.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/ptrace.h>
+#include <sys/user.h>
+#include <sys/wait.h>
+#include <sys/procfs.h>
+#include <dirent.h>
+#include <fcntl.h>
+#include <elf.h>
+#include <link.h>
+#include <map>
+#include <set>
+#include <vector>
+#include "datatarget.h"
+#include "threadinfo.h"
+#include "memoryregion.h"
+#include "crashinfo.h"
+#include "dumpwriter.h" \ No newline at end of file
diff --git a/src/debug/createdump/datatarget.cpp b/src/debug/createdump/datatarget.cpp
new file mode 100644
index 0000000000..38505e2d45
--- /dev/null
+++ b/src/debug/createdump/datatarget.cpp
@@ -0,0 +1,263 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+#include "createdump.h"
+
+#define IMAGE_FILE_MACHINE_AMD64 0x8664 // AMD64 (K8)
+
+DumpDataTarget::DumpDataTarget(pid_t pid) :
+ m_ref(1),
+ m_pid(pid),
+ m_fd(-1),
+ m_crashInfo(nullptr)
+{
+}
+
+DumpDataTarget::~DumpDataTarget()
+{
+ if (m_fd != -1)
+ {
+ close(m_fd);
+ m_fd = -1;
+ }
+}
+
+bool
+DumpDataTarget::Initialize(CrashInfo * crashInfo)
+{
+ char memPath[128];
+ _snprintf_s(memPath, sizeof(memPath), sizeof(memPath), "/proc/%lu/mem", m_pid);
+
+ m_fd = open(memPath, O_RDONLY);
+ if (m_fd == -1)
+ {
+ fprintf(stderr, "open(%s) FAILED %d (%s)\n", memPath, errno, strerror(errno));
+ return false;
+ }
+ m_crashInfo = crashInfo;
+ return true;
+}
+
+STDMETHODIMP
+DumpDataTarget::QueryInterface(
+ ___in REFIID InterfaceId,
+ ___out PVOID* Interface
+ )
+{
+ if (InterfaceId == IID_IUnknown ||
+ InterfaceId == IID_ICLRDataTarget)
+ {
+ *Interface = (ICLRDataTarget*)this;
+ AddRef();
+ return S_OK;
+ }
+ else if (InterfaceId == IID_ICorDebugDataTarget4)
+ {
+ *Interface = (ICorDebugDataTarget4*)this;
+ AddRef();
+ return S_OK;
+ }
+ else
+ {
+ *Interface = NULL;
+ return E_NOINTERFACE;
+ }
+}
+
+STDMETHODIMP_(ULONG)
+DumpDataTarget::AddRef()
+{
+ LONG ref = InterlockedIncrement(&m_ref);
+ return ref;
+}
+
+STDMETHODIMP_(ULONG)
+DumpDataTarget::Release()
+{
+ LONG ref = InterlockedDecrement(&m_ref);
+ if (ref == 0)
+ {
+ delete this;
+ }
+ return ref;
+}
+
+HRESULT STDMETHODCALLTYPE
+DumpDataTarget::GetMachineType(
+ /* [out] */ ULONG32 *machine)
+{
+#ifdef _AMD64_
+ *machine = IMAGE_FILE_MACHINE_AMD64;
+#elif _ARM_
+ *machine = IMAGE_FILE_MACHINE_ARMNT;
+#elif _ARM64_
+ *machine = IMAGE_FILE_MACHINE_ARM64;
+#elif _X86_
+ *machine = IMAGE_FILE_MACHINE_I386;
+#else
+#error Unsupported architecture
+#endif
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE
+DumpDataTarget::GetPointerSize(
+ /* [out] */ ULONG32 *size)
+{
+#if defined(_AMD64_) || defined(_ARM64_)
+ *size = 8;
+#elif defined(_ARM_) || defined(_X86_)
+ *size = 4;
+#else
+#error Unsupported architecture
+#endif
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE
+DumpDataTarget::GetImageBase(
+ /* [string][in] */ LPCWSTR moduleName,
+ /* [out] */ CLRDATA_ADDRESS *baseAddress)
+{
+ assert(m_crashInfo != nullptr);
+ *baseAddress = 0;
+
+ char tempModuleName[MAX_PATH];
+ int length = WideCharToMultiByte(CP_ACP, 0, moduleName, -1, tempModuleName, sizeof(tempModuleName), NULL, NULL);
+ if (length > 0)
+ {
+ for (const MemoryRegion& image : m_crashInfo->ModuleMappings())
+ {
+ const char *name = strrchr(image.FileName(), '/');
+ if (name != nullptr)
+ {
+ name++;
+ }
+ else
+ {
+ name = image.FileName();
+ }
+ if (strcmp(name, tempModuleName) == 0)
+ {
+ *baseAddress = image.StartAddress();
+ return S_OK;
+ }
+ }
+ }
+ return E_FAIL;
+}
+
+HRESULT STDMETHODCALLTYPE
+DumpDataTarget::ReadVirtual(
+ /* [in] */ CLRDATA_ADDRESS address,
+ /* [length_is][size_is][out] */ PBYTE buffer,
+ /* [in] */ ULONG32 size,
+ /* [optional][out] */ ULONG32 *done)
+{
+ assert(m_fd != -1);
+ size_t read = pread64(m_fd, buffer, size, (off64_t)address);
+ if (read == -1)
+ {
+ fprintf(stderr, "ReadVirtual FAILED %016lx %08x\n", address, size);
+ *done = 0;
+ return E_FAIL;
+ }
+ *done = read;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE
+DumpDataTarget::WriteVirtual(
+ /* [in] */ CLRDATA_ADDRESS address,
+ /* [size_is][in] */ PBYTE buffer,
+ /* [in] */ ULONG32 size,
+ /* [optional][out] */ ULONG32 *done)
+{
+ assert(false);
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE
+DumpDataTarget::GetTLSValue(
+ /* [in] */ ULONG32 threadID,
+ /* [in] */ ULONG32 index,
+ /* [out] */ CLRDATA_ADDRESS* value)
+{
+ assert(false);
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE
+DumpDataTarget::SetTLSValue(
+ /* [in] */ ULONG32 threadID,
+ /* [in] */ ULONG32 index,
+ /* [in] */ CLRDATA_ADDRESS value)
+{
+ assert(false);
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE
+DumpDataTarget::GetCurrentThreadID(
+ /* [out] */ ULONG32* threadID)
+{
+ assert(false);
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE
+DumpDataTarget::GetThreadContext(
+ /* [in] */ ULONG32 threadID,
+ /* [in] */ ULONG32 contextFlags,
+ /* [in] */ ULONG32 contextSize,
+ /* [out, size_is(contextSize)] */ PBYTE context)
+{
+ assert(m_crashInfo != nullptr);
+ if (contextSize < sizeof(CONTEXT))
+ {
+ assert(false);
+ return E_INVALIDARG;
+ }
+ memset(context, 0, contextSize);
+ for (const ThreadInfo* thread : m_crashInfo->Threads())
+ {
+ if (thread->Tid() == threadID)
+ {
+ thread->GetThreadContext(contextFlags, reinterpret_cast<CONTEXT*>(context));
+ return S_OK;
+ }
+ }
+ return E_FAIL;
+}
+
+HRESULT STDMETHODCALLTYPE
+DumpDataTarget::SetThreadContext(
+ /* [in] */ ULONG32 threadID,
+ /* [in] */ ULONG32 contextSize,
+ /* [out, size_is(contextSize)] */ PBYTE context)
+{
+ assert(false);
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE
+DumpDataTarget::Request(
+ /* [in] */ ULONG32 reqCode,
+ /* [in] */ ULONG32 inBufferSize,
+ /* [size_is][in] */ BYTE *inBuffer,
+ /* [in] */ ULONG32 outBufferSize,
+ /* [size_is][out] */ BYTE *outBuffer)
+{
+ assert(false);
+ return E_NOTIMPL;
+}
+
+HRESULT STDMETHODCALLTYPE
+DumpDataTarget::VirtualUnwind(
+ /* [in] */ DWORD threadId,
+ /* [in] */ ULONG32 contextSize,
+ /* [in, out, size_is(contextSize)] */ PBYTE context)
+{
+ return E_NOTIMPL;
+}
diff --git a/src/debug/createdump/datatarget.h b/src/debug/createdump/datatarget.h
new file mode 100644
index 0000000000..8ff6773fa3
--- /dev/null
+++ b/src/debug/createdump/datatarget.h
@@ -0,0 +1,90 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+class CrashInfo;
+
+class DumpDataTarget : public ICLRDataTarget, ICorDebugDataTarget4
+{
+private:
+ LONG m_ref; // reference count
+ pid_t m_pid; // process id
+ int m_fd; // /proc/<pid>/mem handle
+ CrashInfo* m_crashInfo;
+
+public:
+ DumpDataTarget(pid_t pid);
+ virtual ~DumpDataTarget();
+ bool Initialize(CrashInfo* crashInfo);
+
+ //
+ // IUnknown
+ //
+ STDMETHOD(QueryInterface)(___in REFIID InterfaceId, ___out PVOID* Interface);
+ STDMETHOD_(ULONG, AddRef)();
+ STDMETHOD_(ULONG, Release)();
+
+ //
+ // ICLRDataTarget
+ //
+ virtual HRESULT STDMETHODCALLTYPE GetMachineType(
+ /* [out] */ ULONG32 *machine);
+
+ virtual HRESULT STDMETHODCALLTYPE GetPointerSize(
+ /* [out] */ ULONG32 *size);
+
+ virtual HRESULT STDMETHODCALLTYPE GetImageBase(
+ /* [string][in] */ LPCWSTR moduleName,
+ /* [out] */ CLRDATA_ADDRESS *baseAddress);
+
+ virtual HRESULT STDMETHODCALLTYPE ReadVirtual(
+ /* [in] */ CLRDATA_ADDRESS address,
+ /* [length_is][size_is][out] */ PBYTE buffer,
+ /* [in] */ ULONG32 size,
+ /* [optional][out] */ ULONG32 *done);
+
+ virtual HRESULT STDMETHODCALLTYPE WriteVirtual(
+ /* [in] */ CLRDATA_ADDRESS address,
+ /* [size_is][in] */ PBYTE buffer,
+ /* [in] */ ULONG32 size,
+ /* [optional][out] */ ULONG32 *done);
+
+ virtual HRESULT STDMETHODCALLTYPE GetTLSValue(
+ /* [in] */ ULONG32 threadID,
+ /* [in] */ ULONG32 index,
+ /* [out] */ CLRDATA_ADDRESS* value);
+
+ virtual HRESULT STDMETHODCALLTYPE SetTLSValue(
+ /* [in] */ ULONG32 threadID,
+ /* [in] */ ULONG32 index,
+ /* [in] */ CLRDATA_ADDRESS value);
+
+ virtual HRESULT STDMETHODCALLTYPE GetCurrentThreadID(
+ /* [out] */ ULONG32* threadID);
+
+ virtual HRESULT STDMETHODCALLTYPE GetThreadContext(
+ /* [in] */ ULONG32 threadID,
+ /* [in] */ ULONG32 contextFlags,
+ /* [in] */ ULONG32 contextSize,
+ /* [out, size_is(contextSize)] */ PBYTE context);
+
+ virtual HRESULT STDMETHODCALLTYPE SetThreadContext(
+ /* [in] */ ULONG32 threadID,
+ /* [in] */ ULONG32 contextSize,
+ /* [in, size_is(contextSize)] */ PBYTE context);
+
+ virtual HRESULT STDMETHODCALLTYPE Request(
+ /* [in] */ ULONG32 reqCode,
+ /* [in] */ ULONG32 inBufferSize,
+ /* [size_is][in] */ BYTE *inBuffer,
+ /* [in] */ ULONG32 outBufferSize,
+ /* [size_is][out] */ BYTE *outBuffer);
+
+ //
+ // ICorDebugDataTarget4
+ //
+ virtual HRESULT STDMETHODCALLTYPE VirtualUnwind(
+ /* [in] */ DWORD threadId,
+ /* [in] */ ULONG32 contextSize,
+ /* [in, out, size_is(contextSize)] */ PBYTE context);
+};
diff --git a/src/debug/createdump/dumpwriter.cpp b/src/debug/createdump/dumpwriter.cpp
new file mode 100644
index 0000000000..9057d180e1
--- /dev/null
+++ b/src/debug/createdump/dumpwriter.cpp
@@ -0,0 +1,486 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+#include "createdump.h"
+
+DumpWriter::DumpWriter(CrashInfo& crashInfo) :
+ m_ref(1),
+ m_fd(-1),
+ m_crashInfo(crashInfo)
+{
+ m_crashInfo.AddRef();
+}
+
+DumpWriter::~DumpWriter()
+{
+ if (m_fd != -1)
+ {
+ close(m_fd);
+ m_fd = -1;
+ }
+ m_crashInfo.Release();
+}
+
+STDMETHODIMP
+DumpWriter::QueryInterface(
+ ___in REFIID InterfaceId,
+ ___out PVOID* Interface)
+{
+ if (InterfaceId == IID_IUnknown)
+ {
+ *Interface = (IUnknown*)this;
+ AddRef();
+ return S_OK;
+ }
+ else
+ {
+ *Interface = NULL;
+ return E_NOINTERFACE;
+ }
+}
+
+STDMETHODIMP_(ULONG)
+DumpWriter::AddRef()
+{
+ LONG ref = InterlockedIncrement(&m_ref);
+ return ref;
+}
+
+STDMETHODIMP_(ULONG)
+DumpWriter::Release()
+{
+ LONG ref = InterlockedDecrement(&m_ref);
+ if (ref == 0)
+ {
+ delete this;
+ }
+ return ref;
+}
+
+bool
+DumpWriter::OpenDump(const char* dumpFileName)
+{
+ m_fd = open(dumpFileName, O_WRONLY|O_CREAT|O_TRUNC, 0664);
+ if (m_fd == -1)
+ {
+ fprintf(stderr, "Could not open output %s: %s\n", dumpFileName, strerror(errno));
+ return false;
+ }
+ return true;
+}
+
+// Write the core dump file:
+// ELF header
+// Single section header (Shdr) for 64 bit program header count
+// Phdr for the PT_NOTE
+// PT_LOAD
+// PT_NOTEs
+// process info (prpsinfo_t)
+// NT_FILE entries
+// threads
+// alignment
+// memory blocks
+bool
+DumpWriter::WriteDump()
+{
+ // Write the ELF header
+ Ehdr ehdr;
+ memset(&ehdr, 0, sizeof(Ehdr));
+ ehdr.e_ident[0] = ELFMAG0;
+ ehdr.e_ident[1] = ELFMAG1;
+ ehdr.e_ident[2] = ELFMAG2;
+ ehdr.e_ident[3] = ELFMAG3;
+ ehdr.e_ident[4] = ELF_CLASS;
+
+ // Note: The sex is the current system running minidump-2-core
+ // Big or Little endian. This means you have to create
+ // the core (minidump-2-core) on the system that matches
+ // your intent to debug properly.
+ ehdr.e_ident[5] = sex() ? ELFDATA2MSB : ELFDATA2LSB;
+ ehdr.e_ident[6] = EV_CURRENT;
+ ehdr.e_ident[EI_OSABI] = ELFOSABI_LINUX;
+
+ ehdr.e_type = ET_CORE;
+ ehdr.e_machine = ELF_ARCH;
+ ehdr.e_version = EV_CURRENT;
+ ehdr.e_shoff = sizeof(Ehdr);
+ ehdr.e_phoff = sizeof(Ehdr) + sizeof(Shdr);
+
+ ehdr.e_ehsize = sizeof(Ehdr);
+ ehdr.e_phentsize = sizeof(Phdr);
+ ehdr.e_shentsize = sizeof(Shdr);
+
+ // The ELF header only allows UINT16 for the number of program
+ // headers. In a core dump this equates to PT_NODE and PT_LOAD.
+ //
+ // When more program headers than 65534 the first section entry
+ // is used to store the actual program header count.
+
+ // PT_NOTE + number of memory regions
+ uint64_t phnum = 1 + m_crashInfo.MemoryRegions().size();
+
+ if (phnum < PH_HDR_CANARY) {
+ ehdr.e_phnum = phnum;
+ }
+ else {
+ ehdr.e_phnum = PH_HDR_CANARY;
+ }
+
+ if (!WriteData(&ehdr, sizeof(Ehdr))) {
+ return false;
+ }
+
+ size_t offset = sizeof(Ehdr) + sizeof(Shdr) + (phnum * sizeof(Phdr));
+ size_t filesz = GetProcessInfoSize() + GetAuxvInfoSize() + GetThreadInfoSize() + GetNTFileInfoSize();
+
+ // Add single section containing the actual count
+ // of the program headers to be written.
+ Shdr shdr;
+ memset(&shdr, 0, sizeof(shdr));
+ shdr.sh_info = phnum;
+ // When section header offset is present but ehdr section num = 0
+ // then is is expected that the sh_size indicates the size of the
+ // section array or 1 in our case.
+ shdr.sh_size = 1;
+ if (!WriteData(&shdr, sizeof(shdr))) {
+ return false;
+ }
+
+ // PT_NOTE header
+ Phdr phdr;
+ memset(&phdr, 0, sizeof(Phdr));
+ phdr.p_type = PT_NOTE;
+ phdr.p_offset = offset;
+ phdr.p_filesz = filesz;
+
+ if (!WriteData(&phdr, sizeof(phdr))) {
+ return false;
+ }
+
+ // PT_NOTE sections must end on 4 byte boundary
+ // We output the NT_FILE, AUX and Thread entries
+ // AUX is aligned, NT_FILE is aligned and then we
+ // check to pad end of the thread list
+ phdr.p_type = PT_LOAD;
+ phdr.p_align = 4096;
+
+ size_t finalNoteAlignment = phdr.p_align - ((offset + filesz) % phdr.p_align);
+ if (finalNoteAlignment == phdr.p_align) {
+ finalNoteAlignment = 0;
+ }
+ offset += finalNoteAlignment;
+
+ TRACE("Writing memory region headers to core file\n");
+
+ // Write memory region note headers
+ for (const MemoryRegion& memoryRegion : m_crashInfo.MemoryRegions())
+ {
+ phdr.p_flags = memoryRegion.Permissions();
+ phdr.p_vaddr = memoryRegion.StartAddress();
+ phdr.p_memsz = memoryRegion.Size();
+
+ offset += filesz;
+ phdr.p_filesz = filesz = memoryRegion.Size();
+ phdr.p_offset = offset;
+
+ if (!WriteData(&phdr, sizeof(phdr))) {
+ return false;
+ }
+ }
+
+ // Write process info data to core file
+ if (!WriteProcessInfo()) {
+ return false;
+ }
+
+ // Write auxv data to core file
+ if (!WriteAuxv()) {
+ return false;
+ }
+
+ // Write NT_FILE entries to the core file
+ if (!WriteNTFileInfo()) {
+ return false;
+ }
+
+ TRACE("Writing %ld thread entries to core file\n", m_crashInfo.Threads().size());
+
+ // Write all the thread's state and registers
+ for (const ThreadInfo* thread : m_crashInfo.Threads())
+ {
+ if (!WriteThread(*thread, 0)) {
+ return false;
+ }
+ }
+
+ // Zero out the end of the PT_NOTE section to the boundary
+ // and then laydown the memory blocks
+ if (finalNoteAlignment > 0) {
+ assert(finalNoteAlignment < sizeof(m_tempBuffer));
+ memset(m_tempBuffer, 0, finalNoteAlignment);
+ if (!WriteData(m_tempBuffer, finalNoteAlignment)) {
+ return false;
+ }
+ }
+
+ TRACE("Writing %ld memory regions to core file\n", m_crashInfo.MemoryRegions().size());
+
+ // Read from target process and write memory regions to core
+ uint64_t total = 0;
+ for (const MemoryRegion& memoryRegion : m_crashInfo.MemoryRegions())
+ {
+ uint32_t size = memoryRegion.Size();
+ uint64_t address = memoryRegion.StartAddress();
+ total += size;
+
+ while (size > 0)
+ {
+ uint32_t bytesToRead = std::min(size, (uint32_t)sizeof(m_tempBuffer));
+ uint32_t read = 0;
+
+ if (FAILED(m_crashInfo.DataTarget()->ReadVirtual(address, m_tempBuffer, bytesToRead, &read))) {
+ fprintf(stderr, "ReadVirtual(%016lx, %08x) FAILED\n", address, bytesToRead);
+ return false;
+ }
+
+ if (!WriteData(m_tempBuffer, read)) {
+ return false;
+ }
+
+ address += read;
+ size -= read;
+ }
+ }
+
+ printf("Written %ld bytes (%ld pages) to core file\n", total, total >> PAGE_SHIFT);
+
+ return true;
+}
+
+bool
+DumpWriter::WriteProcessInfo()
+{
+ prpsinfo_t processInfo;
+ memset(&processInfo, 0, sizeof(processInfo));
+ processInfo.pr_sname = 'R';
+ processInfo.pr_pid = m_crashInfo.Pid();
+ processInfo.pr_ppid = m_crashInfo.Ppid();
+ processInfo.pr_pgrp = m_crashInfo.Tgid();
+ strcpy_s(processInfo.pr_fname, sizeof(processInfo.pr_fname), m_crashInfo.Name());
+
+ Nhdr nhdr;
+ memset(&nhdr, 0, sizeof(nhdr));
+ nhdr.n_namesz = 5;
+ nhdr.n_descsz = sizeof(prpsinfo_t);
+ nhdr.n_type = NT_PRPSINFO;
+
+ TRACE("Writing process information to core file\n");
+
+ // Write process info data to core file
+ if (!WriteData(&nhdr, sizeof(nhdr)) ||
+ !WriteData("CORE\0PRP", 8) ||
+ !WriteData(&processInfo, sizeof(prpsinfo_t))) {
+ return false;
+ }
+ return true;
+}
+
+bool
+DumpWriter::WriteAuxv()
+{
+ Nhdr nhdr;
+ memset(&nhdr, 0, sizeof(nhdr));
+ nhdr.n_namesz = 5;
+ nhdr.n_descsz = m_crashInfo.GetAuxvSize();
+ nhdr.n_type = NT_AUXV;
+
+ TRACE("Writing %ld auxv entries to core file\n", m_crashInfo.AuxvEntries().size());
+
+ if (!WriteData(&nhdr, sizeof(nhdr)) ||
+ !WriteData("CORE\0AUX", 8)) {
+ return false;
+ }
+ for (const auto& auxvEntry : m_crashInfo.AuxvEntries())
+ {
+ if (!WriteData(&auxvEntry, sizeof(auxvEntry))) {
+ return false;
+ }
+ }
+ return true;
+}
+
+struct NTFileEntry
+{
+ uint64_t StartAddress;
+ uint64_t EndAddress;
+ uint64_t Offset;
+};
+
+// Calculate the NT_FILE entries total size
+size_t
+DumpWriter::GetNTFileInfoSize(size_t* alignmentBytes)
+{
+ size_t count = m_crashInfo.ModuleMappings().size();
+ size_t size = 0;
+
+ // Header, CORE, entry count, page size
+ size = sizeof(Nhdr) + sizeof(NTFileEntry);
+
+ // start_address, end_address, offset
+ size += count * sizeof(NTFileEntry);
+
+ // \0 terminator for each filename
+ size += count;
+
+ // File name storage needed
+ for (const MemoryRegion& image : m_crashInfo.ModuleMappings()) {
+ size += strlen(image.FileName());
+ }
+ // Notes must end on 4 byte alignment
+ size_t alignmentBytesNeeded = 4 - (size % 4);
+ size += alignmentBytesNeeded;
+
+ if (alignmentBytes != nullptr) {
+ *alignmentBytes = alignmentBytesNeeded;
+ }
+ return size;
+}
+
+// Write NT_FILE entries to the PT_NODE section
+//
+// Nhdr (NT_FILE)
+// Total entries
+// Page size
+// [0] start_address end_address offset
+// [1] start_address end_address offset
+// [file name]\0[file name]\0...
+bool
+DumpWriter::WriteNTFileInfo()
+{
+ Nhdr nhdr;
+ memset(&nhdr, 0, sizeof(nhdr));
+
+ // CORE + \0 and we align on 4 byte boundary
+ // so we can use CORE\0FIL for easier hex debugging
+ nhdr.n_namesz = 5;
+ nhdr.n_type = NT_FILE; // "FILE"
+
+ // Size of payload for NT_FILE after CORE tag written
+ size_t alignmentBytesNeeded = 0;
+ nhdr.n_descsz = GetNTFileInfoSize(&alignmentBytesNeeded) - sizeof(nhdr) - 8;
+
+ size_t count = m_crashInfo.ModuleMappings().size();
+ size_t pageSize = PAGE_SIZE;
+
+ TRACE("Writing %ld NT_FILE entries to core file\n", m_crashInfo.ModuleMappings().size());
+
+ if (!WriteData(&nhdr, sizeof(nhdr)) ||
+ !WriteData("CORE\0FIL", 8) ||
+ !WriteData(&count, 8) ||
+ !WriteData(&pageSize, 8)) {
+ return false;
+ }
+
+ for (const MemoryRegion& image : m_crashInfo.ModuleMappings())
+ {
+ struct NTFileEntry entry { image.StartAddress(), image.EndAddress(), image.Offset() };
+ if (!WriteData(&entry, sizeof(entry))) {
+ return false;
+ }
+ }
+
+ for (const MemoryRegion& image : m_crashInfo.ModuleMappings())
+ {
+ if (!WriteData(image.FileName(), strlen(image.FileName())) ||
+ !WriteData("\0", 1)) {
+ return false;
+ }
+ }
+
+ // Has to end on a 4 byte boundary. Debugger, readelf and such
+ // will automatically align on next 4 bytes and look for a PT_NOTE
+ // header.
+ if (alignmentBytesNeeded) {
+ if (!WriteData("\0\0\0\0", alignmentBytesNeeded)) {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool
+DumpWriter::WriteThread(const ThreadInfo& thread, int fatal_signal)
+{
+ prstatus_t pr;
+ memset(&pr, 0, sizeof(pr));
+
+ pr.pr_info.si_signo = fatal_signal;
+ pr.pr_cursig = fatal_signal;
+ pr.pr_pid = thread.Tid();
+ pr.pr_ppid = thread.Ppid();
+ pr.pr_pgrp = thread.Tgid();
+ memcpy(&pr.pr_reg, thread.GPRegisters(), sizeof(user_regs_struct));
+
+ Nhdr nhdr;
+ memset(&nhdr, 0, sizeof(nhdr));
+
+ // Name size is CORE plus the NULL terminator
+ // The format requires 4 byte alignment so the
+ // value written in 8 bytes. Stuff the last 3
+ // bytes with the type of NT_PRSTATUS so it is
+ // easier to debug in a hex editor.
+ nhdr.n_namesz = 5;
+ nhdr.n_descsz = sizeof(prstatus_t);
+ nhdr.n_type = NT_PRSTATUS;
+ if (!WriteData(&nhdr, sizeof(nhdr)) ||
+ !WriteData("CORE\0THR", 8) ||
+ !WriteData(&pr, sizeof(prstatus_t))) {
+ return false;
+ }
+
+#if defined(__i386__) || defined(__x86_64__)
+ nhdr.n_descsz = sizeof(user_fpregs_struct);
+ nhdr.n_type = NT_FPREGSET;
+ if (!WriteData(&nhdr, sizeof(nhdr)) ||
+ !WriteData("CORE\0FLT", 8) ||
+ !WriteData(thread.FPRegisters(), sizeof(user_fpregs_struct))) {
+ return false;
+ }
+#endif
+
+#if defined(__i386__)
+ nhdr.n_descsz = sizeof(user_fpxregs_struct);
+ nhdr.n_type = NT_PRXFPREG;
+ if (!WriteData(&nhdr, sizeof(nhdr)) ||
+ !WriteData("LINUX\0\0\0", 8) ||
+ !WriteData(&thread.FPXRegisters(), sizeof(user_fpxregs_struct))) {
+ return false;
+ }
+#endif
+
+ return true;
+}
+
+// Write all of the given buffer, handling short writes and EINTR. Return true iff successful.
+bool
+DumpWriter::WriteData(const void* buffer, size_t length)
+{
+ const uint8_t* data = (const uint8_t*)buffer;
+
+ size_t done = 0;
+ while (done < length) {
+ ssize_t written;
+ do {
+ written = write(m_fd, data + done, length - done);
+ } while (written == -1 && errno == EINTR);
+
+ if (written < 1) {
+ fprintf(stderr, "WriteData FAILED %s\n", strerror(errno));
+ return false;
+ }
+ done += written;
+ }
+ return true;
+}
diff --git a/src/debug/createdump/dumpwriter.h b/src/debug/createdump/dumpwriter.h
new file mode 100644
index 0000000000..0b4f88cbd6
--- /dev/null
+++ b/src/debug/createdump/dumpwriter.h
@@ -0,0 +1,77 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+#ifdef BIT64
+#define ELF_CLASS ELFCLASS64
+#else
+#define ELF_CLASS ELFCLASS32
+#endif
+
+#define Ehdr ElfW(Ehdr)
+#define Phdr ElfW(Phdr)
+#define Shdr ElfW(Shdr)
+#define Nhdr ElfW(Nhdr)
+#define auxv_t ElfW(auxv_t)
+
+#if defined(__x86_64__)
+#define ELF_ARCH EM_X86_64
+#elif defined(__i386__)
+#define ELF_ARCH EM_386
+#elif defined(__arm__)
+#define ELF_ARCH EM_ARM
+#endif
+
+#define PH_HDR_CANARY 0xFFFF
+
+#ifndef NT_FILE
+#define NT_FILE 0x46494c45
+#endif
+
+class DumpWriter : IUnknown
+{
+private:
+ LONG m_ref; // reference count
+ int m_fd;
+ CrashInfo& m_crashInfo;
+ BYTE m_tempBuffer[0x4000];
+
+public:
+ DumpWriter(CrashInfo& crashInfo);
+ virtual ~DumpWriter();
+ bool OpenDump(const char* dumpFileName);
+ bool WriteDump();
+
+ // IUnknown
+ STDMETHOD(QueryInterface)(___in REFIID InterfaceId, ___out PVOID* Interface);
+ STDMETHOD_(ULONG, AddRef)();
+ STDMETHOD_(ULONG, Release)();
+
+private:
+ bool WriteProcessInfo();
+ bool WriteAuxv();
+ size_t GetNTFileInfoSize(size_t* alignmentBytes = nullptr);
+ bool WriteNTFileInfo();
+ bool WriteThread(const ThreadInfo& thread, int fatal_signal);
+ bool WriteData(const void* buffer, size_t length);
+
+ const size_t GetProcessInfoSize() const { return sizeof(Nhdr) + 8 + sizeof(prpsinfo_t); }
+ const size_t GetAuxvInfoSize() const { return sizeof(Nhdr) + 8 + m_crashInfo.GetAuxvSize(); }
+ const size_t GetThreadInfoSize() const
+ {
+ return m_crashInfo.Threads().size() * ((sizeof(Nhdr) + 8 + sizeof(prstatus_t))
+#if defined(__i386__) || defined(__x86_64__)
+ + sizeof(Nhdr) + 8 + sizeof(user_fpregs_struct)
+#endif
+#if defined(__i386__)
+ + sizeof(Nhdr) + 8 + sizeof(user_fpxregs_struct)
+#endif
+ );
+ }
+};
+
+static inline int sex()
+{
+ int probe = 1;
+ return !*(char *)&probe;
+}
diff --git a/src/debug/createdump/main.cpp b/src/debug/createdump/main.cpp
new file mode 100644
index 0000000000..03382779a5
--- /dev/null
+++ b/src/debug/createdump/main.cpp
@@ -0,0 +1,99 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+#include "createdump.h"
+
+const char* g_help = "createdump [options] pid\n"
+"-f, --name - dump path and file name. The pid can be placed in the name with %d. The default is '/tmp/coredump.%d'\n"
+"-n, --normal - create minidump.\n"
+"-h, --withheap - create minidump with heap (default).\n"
+"-t, --triage - create triage minidump.\n"
+"-d, --diag - enable diagnostic messages.\n";
+
+bool CreateDumpCommon(const char* programPath, const char* dumpPathTemplate, MINIDUMP_TYPE minidumpType, CrashInfo* crashInfo);
+
+//
+// Main entry point
+//
+int __cdecl main(const int argc, const char* argv[])
+{
+ MINIDUMP_TYPE minidumpType = MiniDumpWithPrivateReadWriteMemory;
+#ifdef ANDROID
+ const char* dumpPathTemplate = "/data/local/tmp/coredump.%d";
+#else
+ const char* dumpPathTemplate = "/tmp/coredump.%d";
+#endif
+ pid_t pid = 0;
+
+ int exitCode = PAL_InitializeDLL();
+ if (exitCode != 0)
+ {
+ fprintf(stderr, "PAL initialization FAILED %d\n", exitCode);
+ return exitCode;
+ }
+
+ // Parse off the program name leaving just the path. Used to locate/load the DAC module.
+ std::string programPath;
+ programPath.append(*argv++);
+ size_t last = programPath.find_last_of('/');
+ programPath = programPath.substr(0, last);
+
+ // Parse the command line options and target pid
+ for (int i = 1; i < argc; i++)
+ {
+ if (*argv != nullptr)
+ {
+ if ((strcmp(*argv, "-f") == 0) || (strcmp(*argv, "--name") == 0))
+ {
+ dumpPathTemplate = *++argv;
+ }
+ else if ((strcmp(*argv, "-n") == 0) || (strcmp(*argv, "--normal") == 0))
+ {
+ minidumpType = MiniDumpNormal;
+ }
+ else if ((strcmp(*argv, "-h") == 0) || (strcmp(*argv, "--withheap") == 0))
+ {
+ minidumpType = MiniDumpWithPrivateReadWriteMemory;
+ }
+ else if ((strcmp(*argv, "-t") == 0) || (strcmp(*argv, "--triage") == 0))
+ {
+ minidumpType = MiniDumpFilterTriage;
+ }
+ else if ((strcmp(*argv, "-d") == 0) || (strcmp(*argv, "--diag") == 0))
+ {
+ g_diagnostics = true;
+ }
+ else {
+ pid = atoll(*argv);
+ }
+ argv++;
+ }
+ }
+ if (pid != 0)
+ {
+ ReleaseHolder<DumpDataTarget> dataTarget = new DumpDataTarget(pid);
+ ReleaseHolder<CrashInfo> crashInfo = new CrashInfo(pid, dataTarget, false);
+
+ // The initialize the data target's ReadVirtual support (opens /proc/$pid/mem)
+ if (dataTarget->Initialize(crashInfo))
+ {
+ if (!CreateDumpCommon(programPath.c_str(), dumpPathTemplate, minidumpType, crashInfo))
+ {
+ exitCode = -1;
+ }
+ }
+ else
+ {
+ exitCode = -1;
+ }
+ }
+ else
+ {
+ // if no pid or invalid command line option
+ fprintf(stderr, "%s", g_help);
+ exitCode = -1;
+ }
+ PAL_TerminateEx(exitCode);
+ return exitCode;
+}
diff --git a/src/debug/createdump/memoryregion.h b/src/debug/createdump/memoryregion.h
new file mode 100644
index 0000000000..16c4d1c693
--- /dev/null
+++ b/src/debug/createdump/memoryregion.h
@@ -0,0 +1,97 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+struct MemoryRegion
+{
+private:
+ uint32_t m_permissions;
+ uint64_t m_startAddress;
+ uint64_t m_endAddress;
+ uint64_t m_offset;
+
+ // The name used for NT_FILE output
+ char* m_fileName;
+
+public:
+ MemoryRegion(uint64_t start, uint64_t end) :
+ m_permissions(PF_R | PF_W | PF_X),
+ m_startAddress(start),
+ m_endAddress(end),
+ m_offset(0),
+ m_fileName(nullptr)
+ {
+ assert((start & ~PAGE_MASK) == 0);
+ assert((end & ~PAGE_MASK) == 0);
+ }
+
+ MemoryRegion(uint32_t permissions, uint64_t start, uint64_t end, uint64_t offset, char* filename) :
+ m_permissions(permissions),
+ m_startAddress(start),
+ m_endAddress(end),
+ m_offset(offset),
+ m_fileName(filename)
+ {
+ assert((start & ~PAGE_MASK) == 0);
+ assert((end & ~PAGE_MASK) == 0);
+ }
+
+ const uint32_t Permissions() const
+ {
+ return m_permissions;
+ }
+
+ const uint64_t StartAddress() const
+ {
+ return m_startAddress;
+ }
+
+ const uint64_t EndAddress() const
+ {
+ return m_endAddress;
+ }
+
+ const uint64_t Size() const
+ {
+ return m_endAddress - m_startAddress;
+ }
+
+ const uint64_t Offset() const
+ {
+ return m_offset;
+ }
+
+ const char* FileName() const
+ {
+ return m_fileName;
+ }
+
+ bool operator<(const MemoryRegion& rhs) const
+ {
+ return (m_startAddress < rhs.m_startAddress) && (m_endAddress <= rhs.m_startAddress);
+ }
+
+ bool Contains(const MemoryRegion& rhs) const
+ {
+ return (m_startAddress <= rhs.m_startAddress) && (m_endAddress >= rhs.m_endAddress);
+ }
+
+ void Cleanup()
+ {
+ if (m_fileName != nullptr)
+ {
+ free(m_fileName);
+ m_fileName = nullptr;
+ }
+ }
+
+ void Print() const
+ {
+ if (m_fileName != nullptr) {
+ TRACE("%016lx - %016lx (%04ld) %016lx %x %s\n", m_startAddress, m_endAddress, (Size() >> PAGE_SHIFT), m_offset, m_permissions, m_fileName);
+ }
+ else {
+ TRACE("%016lx - %016lx (%04ld) %02x\n", m_startAddress, m_endAddress, (Size() >> PAGE_SHIFT), m_permissions);
+ }
+ }
+};
diff --git a/src/debug/createdump/threadinfo.cpp b/src/debug/createdump/threadinfo.cpp
new file mode 100644
index 0000000000..8e73fcf2cb
--- /dev/null
+++ b/src/debug/createdump/threadinfo.cpp
@@ -0,0 +1,235 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+#include "createdump.h"
+
+#define FPREG_ErrorOffset(fpregs) *(DWORD*)&((fpregs).rip)
+#define FPREG_ErrorSelector(fpregs) *(((WORD*)&((fpregs).rip)) + 2)
+#define FPREG_DataOffset(fpregs) *(DWORD*)&((fpregs).rdp)
+#define FPREG_DataSelector(fpregs) *(((WORD*)&((fpregs).rdp)) + 2)
+
+ThreadInfo::ThreadInfo(pid_t tid) :
+ m_tid(tid)
+{
+}
+
+ThreadInfo::~ThreadInfo()
+{
+}
+
+bool
+ThreadInfo::Initialize(ICLRDataTarget* dataTarget)
+{
+ if (!CrashInfo::GetStatus(m_tid, &m_ppid, &m_tgid, nullptr))
+ {
+ return false;
+ }
+ if (dataTarget != nullptr)
+ {
+ if (!GetRegistersWithDataTarget(dataTarget))
+ {
+ return false;
+ }
+ }
+ else {
+ if (!GetRegistersWithPTrace())
+ {
+ return false;
+ }
+ }
+ TRACE("Thread %04x RIP %016llx RSP %016llx\n", m_tid, m_gpRegisters.rip, m_gpRegisters.rsp);
+ return true;
+}
+
+void
+ThreadInfo::ResumeThread()
+{
+ if (ptrace(PTRACE_DETACH, m_tid, nullptr, nullptr) != -1)
+ {
+ int waitStatus;
+ waitpid(m_tid, &waitStatus, __WALL);
+ }
+}
+
+bool
+ThreadInfo::GetRegistersWithPTrace()
+{
+ if (ptrace((__ptrace_request)PTRACE_GETREGS, m_tid, nullptr, &m_gpRegisters) == -1)
+ {
+ fprintf(stderr, "ptrace(GETREGS, %d) FAILED %d (%s)\n", m_tid, errno, strerror(errno));
+ return false;
+ }
+ if (ptrace((__ptrace_request)PTRACE_GETFPREGS, m_tid, nullptr, &m_fpRegisters) == -1)
+ {
+ fprintf(stderr, "ptrace(GETFPREGS, %d) FAILED %d (%s)\n", m_tid, errno, strerror(errno));
+ return false;
+ }
+#if defined(__i386__)
+ if (ptrace((__ptrace_request)PTRACE_GETFPXREGS, m_tid, nullptr, &m_fpxRegisters) == -1)
+ {
+ fprintf(stderr, "ptrace(GETFPXREGS, %d) FAILED %d (%s)\n", m_tid, errno, strerror(errno));
+ return false;
+ }
+#endif
+ return true;
+}
+
+bool
+ThreadInfo::GetRegistersWithDataTarget(ICLRDataTarget* dataTarget)
+{
+ CONTEXT context;
+ context.ContextFlags = CONTEXT_ALL;
+ if (dataTarget->GetThreadContext(m_tid, context.ContextFlags, sizeof(context), reinterpret_cast<PBYTE>(&context)) != S_OK)
+ {
+ return false;
+ }
+#if defined(__x86_64__)
+ m_gpRegisters.rbp = context.Rbp;
+ m_gpRegisters.rip = context.Rip;
+ m_gpRegisters.cs = context.SegCs;
+ m_gpRegisters.eflags = context.EFlags;
+ m_gpRegisters.ss = context.SegSs;
+ m_gpRegisters.rsp = context.Rsp;
+ m_gpRegisters.rdi = context.Rdi;
+
+ m_gpRegisters.rsi = context.Rsi;
+ m_gpRegisters.rbx = context.Rbx;
+ m_gpRegisters.rdx = context.Rdx;
+ m_gpRegisters.rcx = context.Rcx;
+ m_gpRegisters.rax = context.Rax;
+ m_gpRegisters.orig_rax = context.Rax;
+ m_gpRegisters.r8 = context.R8;
+ m_gpRegisters.r9 = context.R9;
+ m_gpRegisters.r10 = context.R10;
+ m_gpRegisters.r11 = context.R11;
+ m_gpRegisters.r12 = context.R12;
+ m_gpRegisters.r13 = context.R13;
+ m_gpRegisters.r14 = context.R14;
+ m_gpRegisters.r15 = context.R15;
+
+ m_gpRegisters.ds = context.SegDs;
+ m_gpRegisters.es = context.SegEs;
+ m_gpRegisters.fs = context.SegFs;
+ m_gpRegisters.gs = context.SegGs;
+ m_gpRegisters.fs_base = 0;
+ m_gpRegisters.gs_base = 0;
+
+ m_fpRegisters.cwd = context.FltSave.ControlWord;
+ m_fpRegisters.swd = context.FltSave.StatusWord;
+ m_fpRegisters.ftw = context.FltSave.TagWord;
+ m_fpRegisters.fop = context.FltSave.ErrorOpcode;
+
+ FPREG_ErrorOffset(m_fpRegisters) = context.FltSave.ErrorOffset;
+ FPREG_ErrorSelector(m_fpRegisters) = context.FltSave.ErrorSelector;
+ FPREG_DataOffset(m_fpRegisters) = context.FltSave.DataOffset;
+ FPREG_DataSelector(m_fpRegisters) = context.FltSave.DataSelector;
+
+ m_fpRegisters.mxcsr = context.FltSave.MxCsr;
+ m_fpRegisters.mxcr_mask = context.FltSave.MxCsr_Mask;
+
+ assert(sizeof(context.FltSave.FloatRegisters) == sizeof(m_fpRegisters.st_space));
+ memcpy(m_fpRegisters.st_space, context.FltSave.FloatRegisters, sizeof(m_fpRegisters.st_space));
+
+ assert(sizeof(context.FltSave.XmmRegisters) == sizeof(m_fpRegisters.xmm_space));
+ memcpy(m_fpRegisters.xmm_space, context.FltSave.XmmRegisters, sizeof(m_fpRegisters.xmm_space));
+#else
+#error Platform not supported
+#endif
+ return true;
+}
+
+void
+ThreadInfo::GetThreadStack(const CrashInfo& crashInfo, uint64_t* startAddress, size_t* size) const
+{
+ *startAddress = m_gpRegisters.rsp & PAGE_MASK;
+ *size = 4 * PAGE_SIZE;
+
+ for (const MemoryRegion& mapping : crashInfo.OtherMappings())
+ {
+ if (*startAddress >= mapping.StartAddress() && *startAddress < mapping.EndAddress())
+ {
+ // Use the mapping found for the size of the thread's stack
+ *size = mapping.EndAddress() - *startAddress;
+
+ if (g_diagnostics)
+ {
+ TRACE("Thread %04x stack found in other mapping (size %08lx): ", m_tid, *size);
+ mapping.Print();
+ }
+ break;
+ }
+ }
+}
+
+void
+ThreadInfo::GetThreadCode(uint64_t* startAddress, size_t* size) const
+{
+ *startAddress = m_gpRegisters.rip & PAGE_MASK;
+ *size = PAGE_SIZE;
+}
+
+void
+ThreadInfo::GetThreadContext(uint32_t flags, CONTEXT* context) const
+{
+ context->ContextFlags = flags;
+#if defined(__x86_64__)
+ if ((flags & CONTEXT_CONTROL) == CONTEXT_CONTROL)
+ {
+ context->Rbp = m_gpRegisters.rbp;
+ context->Rip = m_gpRegisters.rip;
+ context->SegCs = m_gpRegisters.cs;
+ context->EFlags = m_gpRegisters.eflags;
+ context->SegSs = m_gpRegisters.ss;
+ context->Rsp = m_gpRegisters.rsp;
+ }
+ if ((flags & CONTEXT_INTEGER) == CONTEXT_INTEGER)
+ {
+ context->Rdi = m_gpRegisters.rdi;
+ context->Rsi = m_gpRegisters.rsi;
+ context->Rbx = m_gpRegisters.rbx;
+ context->Rdx = m_gpRegisters.rdx;
+ context->Rcx = m_gpRegisters.rcx;
+ context->Rax = m_gpRegisters.rax;
+ context->R8 = m_gpRegisters.r8;
+ context->R9 = m_gpRegisters.r9;
+ context->R10 = m_gpRegisters.r10;
+ context->R11 = m_gpRegisters.r11;
+ context->R12 = m_gpRegisters.r12;
+ context->R13 = m_gpRegisters.r13;
+ context->R14 = m_gpRegisters.r14;
+ context->R15 = m_gpRegisters.r15;
+ }
+ if ((flags & CONTEXT_SEGMENTS) == CONTEXT_SEGMENTS)
+ {
+ context->SegDs = m_gpRegisters.ds;
+ context->SegEs = m_gpRegisters.es;
+ context->SegFs = m_gpRegisters.fs;
+ context->SegGs = m_gpRegisters.gs;
+ }
+ if ((flags & CONTEXT_FLOATING_POINT) == CONTEXT_FLOATING_POINT)
+ {
+ context->FltSave.ControlWord = m_fpRegisters.cwd;
+ context->FltSave.StatusWord = m_fpRegisters.swd;
+ context->FltSave.TagWord = m_fpRegisters.ftw;
+ context->FltSave.ErrorOpcode = m_fpRegisters.fop;
+
+ context->FltSave.ErrorOffset = FPREG_ErrorOffset(m_fpRegisters);
+ context->FltSave.ErrorSelector = FPREG_ErrorSelector(m_fpRegisters);
+ context->FltSave.DataOffset = FPREG_DataOffset(m_fpRegisters);
+ context->FltSave.DataSelector = FPREG_DataSelector(m_fpRegisters);
+
+ context->FltSave.MxCsr = m_fpRegisters.mxcsr;
+ context->FltSave.MxCsr_Mask = m_fpRegisters.mxcr_mask;
+
+ assert(sizeof(context->FltSave.FloatRegisters) == sizeof(m_fpRegisters.st_space));
+ memcpy(context->FltSave.FloatRegisters, m_fpRegisters.st_space, sizeof(context->FltSave.FloatRegisters));
+
+ assert(sizeof(context->FltSave.XmmRegisters) == sizeof(m_fpRegisters.xmm_space));
+ memcpy(context->FltSave.XmmRegisters, m_fpRegisters.xmm_space, sizeof(context->FltSave.XmmRegisters));
+ }
+ // TODO: debug registers?
+#else
+#error Platform not supported
+#endif
+}
diff --git a/src/debug/createdump/threadinfo.h b/src/debug/createdump/threadinfo.h
new file mode 100644
index 0000000000..8620219747
--- /dev/null
+++ b/src/debug/createdump/threadinfo.h
@@ -0,0 +1,42 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+class CrashInfo;
+
+class ThreadInfo
+{
+private:
+ pid_t m_tid; // thread id
+ pid_t m_ppid; // parent process
+ pid_t m_tgid; // thread group
+ struct user_regs_struct m_gpRegisters; // general purpose registers
+ struct user_fpregs_struct m_fpRegisters; // floating point registers
+#if defined(__i386__)
+ struct user_fpxregs_struct m_fpxRegisters; // x86 floating point registers
+#endif
+
+public:
+ ThreadInfo(pid_t tid);
+ ~ThreadInfo();
+ bool Initialize(ICLRDataTarget* dataTarget);
+ void ResumeThread();
+ void GetThreadStack(const CrashInfo& crashInfo, uint64_t* startAddress, size_t* size) const;
+ void GetThreadCode(uint64_t* startAddress, size_t* size) const;
+ void GetThreadContext(uint32_t flags, CONTEXT* context) const;
+
+ const pid_t Tid() const { return m_tid; }
+ const pid_t Ppid() const { return m_ppid; }
+ const pid_t Tgid() const { return m_tgid; }
+
+ const user_regs_struct* GPRegisters() const { return &m_gpRegisters; }
+ const user_fpregs_struct* FPRegisters() const { return &m_fpRegisters; }
+#if defined(__i386__)
+ const user_fpxregs_struct* FPXRegisters() const { return &m_fpxRegisters; }
+#endif
+
+private:
+ bool GetRegistersWithPTrace();
+ bool GetRegistersWithDataTarget(ICLRDataTarget* dataTarget);
+};
+
diff --git a/src/debug/daccess/dacfn.cpp b/src/debug/daccess/dacfn.cpp
index 0a167418a1..2f7a98de1a 100644
--- a/src/debug/daccess/dacfn.cpp
+++ b/src/debug/daccess/dacfn.cpp
@@ -1386,6 +1386,8 @@ bool DacTargetConsistencyAssertsEnabled()
//
void DacEnumCodeForStackwalk(TADDR taCallEnd)
{
+ if (taCallEnd == 0)
+ return;
//
// x86 stack walkers often end up having to guess
// about what's a return address on the stack.
diff --git a/src/debug/daccess/enummem.cpp b/src/debug/daccess/enummem.cpp
index 027fe59543..9305bba488 100644
--- a/src/debug/daccess/enummem.cpp
+++ b/src/debug/daccess/enummem.cpp
@@ -22,6 +22,10 @@
#include "binder.h"
#include "win32threadpool.h"
+#ifdef FEATURE_PAL
+#include <dactablerva.h>
+#endif
+
#ifdef FEATURE_APPX
#include "appxutil.h"
#endif // FEATURE_APPX
@@ -220,6 +224,11 @@ HRESULT ClrDataAccess::EnumMemCLRStatic(IN CLRDataEnumMemoryFlags flags)
#define DEFINE_DACVAR_SVR(id_type, size_type, id, var) \
ReportMem(m_globalBase + g_dacGlobals.id, sizeof(size_type));
+#ifdef FEATURE_PAL
+ // Add the dac table memory in coreclr
+ CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED ( ReportMem(m_globalBase + DAC_TABLE_RVA, sizeof(g_dacGlobals)); )
+#endif
+
// Cannot use CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED
// around conditional preprocessor directives in a sane fashion.
EX_TRY
@@ -233,39 +242,33 @@ HRESULT ClrDataAccess::EnumMemCLRStatic(IN CLRDataEnumMemoryFlags flags)
}
EX_END_CATCH(RethrowCancelExceptions)
- CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED
- (
- // StressLog is not defined on Rotor build for DAC
- ReportMem(m_globalBase + g_dacGlobals.dac__g_pStressLog, sizeof(StressLog *));
- );
+ // StressLog is not defined on Rotor build for DAC
+ CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED ( ReportMem(m_globalBase + g_dacGlobals.dac__g_pStressLog, sizeof(StressLog *)); )
EX_TRY
{
// These two static pointers are pointed to static data of byte[]
// then run constructor in place
//
- ReportMem(m_globalBase + g_dacGlobals.SystemDomain__m_pSystemDomain,
- sizeof(SystemDomain));
- ReportMem(m_globalBase + g_dacGlobals.SharedDomain__m_pSharedDomain,
- sizeof(SharedDomain));
+ ReportMem(m_globalBase + g_dacGlobals.SystemDomain__m_pSystemDomain, sizeof(SystemDomain));
+ ReportMem(m_globalBase + g_dacGlobals.SharedDomain__m_pSharedDomain, sizeof(SharedDomain));
// We need IGCHeap pointer to make EEVersion work
- ReportMem(m_globalBase + g_dacGlobals.dac__g_pGCHeap,
- sizeof(IGCHeap *));
+ ReportMem(m_globalBase + g_dacGlobals.dac__g_pGCHeap, sizeof(IGCHeap *));
// see synblk.cpp, the pointer is pointed to a static byte[]
SyncBlockCache::s_pSyncBlockCache.EnumMem();
#ifndef FEATURE_IMPLICIT_TLS
- ReportMem(m_globalBase + g_dacGlobals.dac__gThreadTLSIndex,
- sizeof(DWORD));
- ReportMem(m_globalBase + g_dacGlobals.dac__gAppDomainTLSIndex,
- sizeof(DWORD));
+ ReportMem(m_globalBase + g_dacGlobals.dac__gThreadTLSIndex, sizeof(DWORD));
+ ReportMem(m_globalBase + g_dacGlobals.dac__gAppDomainTLSIndex, sizeof(DWORD));
#endif
- ReportMem( m_globalBase + g_dacGlobals.dac__g_FCDynamicallyAssignedImplementations,
+ ReportMem(m_globalBase + g_dacGlobals.dac__g_FCDynamicallyAssignedImplementations,
sizeof(TADDR)*ECall::NUM_DYNAMICALLY_ASSIGNED_FCALL_IMPLEMENTATIONS);
+ ReportMem(g_gcDacGlobals.GetAddr(), sizeof(GcDacVars));
+
// We need all of the dac variables referenced by the GC DAC global struct.
// This struct contains pointers to pointers, so we first dereference the pointers
// to obtain the location of the variable that's reported.
@@ -316,11 +319,8 @@ HRESULT ClrDataAccess::EnumMemCLRStatic(IN CLRDataEnumMemoryFlags flags)
CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( StubManager::EnumMemoryRegions(flags); )
CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( g_pFinalizerThread.EnumMem(); )
CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( g_pSuspensionThread.EnumMem(); )
-
- CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED
- (
- g_heap_type.EnumMem();
- );
+
+ CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( g_heap_type.EnumMem(); )
m_dumpStats.m_cbClrStatics = m_cbMemoryReported - cbMemoryReported;
@@ -345,8 +345,6 @@ HRESULT ClrDataAccess::EnumMemoryRegionsWorkerHeap(IN CLRDataEnumMemoryFlags fla
HRESULT status = S_OK;
- m_instances.ClearEnumMemMarker();
-
// clear all of the previous cached memory
Flush();
@@ -365,7 +363,6 @@ HRESULT ClrDataAccess::EnumMemoryRegionsWorkerHeap(IN CLRDataEnumMemoryFlags fla
// would be true, but I don't think we have that guarantee here.
CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( status = EnumMemDumpModuleList(flags); );
-#ifdef FEATURE_LAZY_COW_PAGES
// Iterating to all threads' stacks, as we have to collect data stored inside (core)clr.dll
CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( status = EnumMemDumpAllThreadsStack(flags); )
@@ -377,11 +374,11 @@ HRESULT ClrDataAccess::EnumMemoryRegionsWorkerHeap(IN CLRDataEnumMemoryFlags fla
// now dump the memory get dragged in by using DAC API implicitly.
m_dumpStats.m_cbImplicity = m_instances.DumpAllInstances(m_enumMemCb);
-#endif // FEATURE_LAZY_COW_PAGES
-
- // end of code
status = m_memStatus;
+ // Do not let any remaining implicitly enumerated memory leak out.
+ Flush();
+
return S_OK;
} // EnumMemoryRegionsWorkerHeap
@@ -976,16 +973,19 @@ HRESULT ClrDataAccess::EnumMemWalkStackHelper(CLRDataEnumMemoryFlags flags,
{
EECodeInfo codeInfo(addr);
- // We want IsFilterFunclet to work for anything on the stack
- codeInfo.GetJitManager()->IsFilterFunclet(&codeInfo);
-
- // The stackwalker needs GC info to find the parent 'stack pointer' or PSP
- GCInfoToken gcInfoToken = codeInfo.GetGCInfoToken();
- PTR_BYTE pGCInfo = dac_cast<PTR_BYTE>(gcInfoToken.Info);
- if (pGCInfo != NULL)
+ if (codeInfo.IsValid())
{
- GcInfoDecoder gcDecoder(gcInfoToken, DECODE_PSP_SYM, 0);
- DacEnumMemoryRegion(dac_cast<TADDR>(pGCInfo), gcDecoder.GetNumBytesRead(), true);
+ // We want IsFilterFunclet to work for anything on the stack
+ codeInfo.GetJitManager()->IsFilterFunclet(&codeInfo);
+
+ // The stackwalker needs GC info to find the parent 'stack pointer' or PSP
+ GCInfoToken gcInfoToken = codeInfo.GetGCInfoToken();
+ PTR_BYTE pGCInfo = dac_cast<PTR_BYTE>(gcInfoToken.Info);
+ if (pGCInfo != NULL)
+ {
+ GcInfoDecoder gcDecoder(gcInfoToken, DECODE_PSP_SYM, 0);
+ DacEnumMemoryRegion(dac_cast<TADDR>(pGCInfo), gcDecoder.GetNumBytesRead(), true);
+ }
}
}
#endif // WIN64EXCEPTIONS && USE_GC_INFO_DECODER
@@ -1603,10 +1603,6 @@ HRESULT ClrDataAccess::EnumMemoryRegionsWorkerSkinny(IN CLRDataEnumMemoryFlags f
// collect CLR static
CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( status = EnumMemCLRStatic(flags); )
- // now dump the memory get dragged in by using DAC API implicitly.
- m_dumpStats.m_cbImplicity = m_instances.DumpAllInstances(m_enumMemCb);
- status = m_memStatus;
-
// Dump AppDomain-specific info needed for MiniDumpNormal.
CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( status = EnumMemDumpAppDomainInfo(flags); )
@@ -1618,6 +1614,10 @@ HRESULT ClrDataAccess::EnumMemoryRegionsWorkerSkinny(IN CLRDataEnumMemoryFlags f
CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( EnumStreams(flags); )
#endif // FEATURE_MINIMETADATA_IN_TRIAGEDUMPS
+ // now dump the memory get dragged in by using DAC API implicitly.
+ m_dumpStats.m_cbImplicity = m_instances.DumpAllInstances(m_enumMemCb);
+ status = m_memStatus;
+
// Do not let any remaining implicitly enumerated memory leak out.
Flush();
@@ -1654,10 +1654,6 @@ HRESULT ClrDataAccess::EnumMemoryRegionsWorkerMicroTriage(IN CLRDataEnumMemoryFl
// collect CLR static
CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( status = EnumMemCLRStatic(flags); )
- // now dump the memory get dragged in by using DAC API implicitly.
- m_dumpStats.m_cbImplicity = m_instances.DumpAllInstances(m_enumMemCb);
- status = m_memStatus;
-
// Dump AppDomain-specific info needed for triage dumps methods enumeration (k command).
CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( status = EnumMemDumpAppDomainInfo(flags); )
@@ -1669,6 +1665,10 @@ HRESULT ClrDataAccess::EnumMemoryRegionsWorkerMicroTriage(IN CLRDataEnumMemoryFl
CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( EnumStreams(flags); )
#endif // FEATURE_MINIMETADATA_IN_TRIAGEDUMPS
+ // now dump the memory get dragged in by using DAC API implicitly.
+ m_dumpStats.m_cbImplicity = m_instances.DumpAllInstances(m_enumMemCb);
+ status = m_memStatus;
+
// Do not let any remaining implicitly enumerated memory leak out.
Flush();
@@ -1847,17 +1847,17 @@ HRESULT ClrDataAccess::EnumMemoryRegionsWrapper(IN CLRDataEnumMemoryFlags flags)
// The various EnumMemoryRegions() implementations should understand
// CLRDATA_ENUM_MEM_MINI to mean that the bare minimimum memory
// to make a MiniDumpNormal work should be included.
- if ( flags == CLRDATA_ENUM_MEM_MINI)
+ if (flags == CLRDATA_ENUM_MEM_MINI)
{
// skinny mini-dump
status = EnumMemoryRegionsWorkerSkinny(flags);
}
- else if ( flags == CLRDATA_ENUM_MEM_TRIAGE)
+ else if (flags == CLRDATA_ENUM_MEM_TRIAGE)
{
// triage micro-dump
status = EnumMemoryRegionsWorkerMicroTriage(flags);
}
- else if ( flags == CLRDATA_ENUM_MEM_HEAP)
+ else if (flags == CLRDATA_ENUM_MEM_HEAP)
{
status = EnumMemoryRegionsWorkerHeap(flags);
}
@@ -1874,12 +1874,6 @@ HRESULT ClrDataAccess::EnumMemoryRegionsWrapper(IN CLRDataEnumMemoryFlags flags)
return status;
}
-#define MiniDumpWithPrivateReadWriteMemory 0x00000200
-#define MiniDumpWithFullAuxiliaryState 0x00008000
-#define MiniDumpFilterTriage 0x00100000
-
-
-
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
// Entry function for generating CLR aware dump. This function is called
@@ -1972,6 +1966,7 @@ ClrDataAccess::EnumMemoryRegions(IN ICLRDataEnumMemoryRegionsCallback* callback,
status = EnumMemoryRegionsWrapper(CLRDATA_ENUM_MEM_MINI);
}
+#ifndef FEATURE_PAL
// For all dump types, we need to capture the chain to the IMAGE_DIRECTORY_ENTRY_DEBUG
// contents, so that DAC can validate against the TimeDateStamp even if the
// debugger can't find the main CLR module on disk.
@@ -1986,7 +1981,7 @@ ClrDataAccess::EnumMemoryRegions(IN ICLRDataEnumMemoryRegionsCallback* callback,
m_instances.DumpAllInstances(m_enumMemCb);
}
}
-
+#endif
Flush();
}
EX_CATCH
diff --git a/src/debug/daccess/request_svr.cpp b/src/debug/daccess/request_svr.cpp
index 6a1de35ff9..40e3600f9f 100644
--- a/src/debug/daccess/request_svr.cpp
+++ b/src/debug/daccess/request_svr.cpp
@@ -22,6 +22,8 @@
int GCHeapCount()
{
+ if (g_gcDacGlobals->n_heaps == nullptr)
+ return 0;
return *g_gcDacGlobals->n_heaps;
}
@@ -206,14 +208,19 @@ void
ClrDataAccess::EnumSvrGlobalMemoryRegions(CLRDataEnumMemoryFlags flags)
{
SUPPORTS_DAC;
+
+ if (g_gcDacGlobals->n_heaps == nullptr || g_gcDacGlobals->g_heaps == nullptr)
+ return;
+
g_gcDacGlobals->n_heaps.EnumMem();
- DacEnumMemoryRegion(g_gcDacGlobals->g_heaps.GetAddr(),
- sizeof(TADDR) * *g_gcDacGlobals->n_heaps);
+
+ int heaps = *g_gcDacGlobals->n_heaps;
+ DacEnumMemoryRegion(g_gcDacGlobals->g_heaps.GetAddr(), sizeof(TADDR) * heaps);
g_gcDacGlobals->gc_structures_invalid_cnt.EnumMem();
g_gcDacGlobals->g_heaps.EnumMem();
- for (int i=0; i < *g_gcDacGlobals->n_heaps; i++)
+ for (int i = 0; i < heaps; i++)
{
DPTR(dac_gc_heap) pHeap = HeapTableIndex(g_gcDacGlobals->g_heaps, i);
@@ -249,6 +256,9 @@ DWORD DacGetNumHeaps()
HRESULT DacHeapWalker::InitHeapDataSvr(HeapData *&pHeaps, size_t &pCount)
{
+ if (g_gcDacGlobals->n_heaps == nullptr || g_gcDacGlobals->g_heaps == nullptr)
+ return S_OK;
+
// Scrape basic heap details
int heaps = *g_gcDacGlobals->n_heaps;
pCount = heaps;
diff --git a/src/debug/di/dbgtransportmanager.cpp b/src/debug/di/dbgtransportmanager.cpp
index 77a3548ea5..8c1079dc33 100644
--- a/src/debug/di/dbgtransportmanager.cpp
+++ b/src/debug/di/dbgtransportmanager.cpp
@@ -102,7 +102,7 @@ HRESULT DbgTransportTarget::GetTransportForProcess(DWORD dwPID
entry->m_cProcessRef++;
_ASSERTE(entry->m_cProcessRef > 0);
_ASSERTE(entry->m_transport != NULL);
- _ASSERTE(entry->m_hProcess > 0);
+ _ASSERTE((intptr_t)entry->m_hProcess > 0);
*ppTransport = entry->m_transport;
if (!DuplicateHandle(GetCurrentProcess(),
@@ -139,7 +139,7 @@ void DbgTransportTarget::ReleaseTransport(DbgTransportSession *pTransport)
_ASSERTE(entry->m_cProcessRef > 0);
_ASSERTE(entry->m_transport != NULL);
- _ASSERTE(entry->m_hProcess > 0);
+ _ASSERTE((intptr_t)entry->m_hProcess > 0);
if (entry->m_transport == pTransport)
{
diff --git a/src/debug/inc/dump/dumpcommon.h b/src/debug/inc/dump/dumpcommon.h
index 3e197ce29b..e57b4b3a12 100644
--- a/src/debug/inc/dump/dumpcommon.h
+++ b/src/debug/inc/dump/dumpcommon.h
@@ -5,6 +5,35 @@
#ifndef DEBUGGER_DUMPCOMMON_H
#define DEBUGGER_DUMPCOMMON_H
+#ifdef FEATURE_PAL
+typedef enum _MINIDUMP_TYPE {
+ MiniDumpNormal = 0x00000000,
+ MiniDumpWithDataSegs = 0x00000001,
+ MiniDumpWithFullMemory = 0x00000002,
+ MiniDumpWithHandleData = 0x00000004,
+ MiniDumpFilterMemory = 0x00000008,
+ MiniDumpScanMemory = 0x00000010,
+ MiniDumpWithUnloadedModules = 0x00000020,
+ MiniDumpWithIndirectlyReferencedMemory = 0x00000040,
+ MiniDumpFilterModulePaths = 0x00000080,
+ MiniDumpWithProcessThreadData = 0x00000100,
+ MiniDumpWithPrivateReadWriteMemory = 0x00000200,
+ MiniDumpWithoutOptionalData = 0x00000400,
+ MiniDumpWithFullMemoryInfo = 0x00000800,
+ MiniDumpWithThreadInfo = 0x00001000,
+ MiniDumpWithCodeSegs = 0x00002000,
+ MiniDumpWithoutAuxiliaryState = 0x00004000,
+ MiniDumpWithFullAuxiliaryState = 0x00008000,
+ MiniDumpWithPrivateWriteCopyMemory = 0x00010000,
+ MiniDumpIgnoreInaccessibleMemory = 0x00020000,
+ MiniDumpWithTokenInformation = 0x00040000,
+ MiniDumpWithModuleHeaders = 0x00080000,
+ MiniDumpFilterTriage = 0x00100000,
+ MiniDumpWithAvxXStateContext = 0x00200000,
+ MiniDumpValidTypeFlags = 0x003fffff,
+} MINIDUMP_TYPE;
+#endif // FEATURE_PAL
+
#if defined(DACCESS_COMPILE) || defined(RIGHT_SIDE_COMPILE)
// When debugging against minidumps, we frequently need to ignore errors
diff --git a/src/dlls/mscordac/mscordac_unixexports.src b/src/dlls/mscordac/mscordac_unixexports.src
index ab73c4fcb8..b0c3b0463c 100644
--- a/src/dlls/mscordac/mscordac_unixexports.src
+++ b/src/dlls/mscordac/mscordac_unixexports.src
@@ -21,9 +21,11 @@ PAL_GetPALDirectoryW
PAL_GetResourceString
PAL_get_stdout
PAL_get_stderr
+PAL_GetCurrentThread
PAL_GetSymbolModuleBase
PAL_GetTransportPipeName
PAL_InitializeDLL
+PAL_TerminateEx
PAL_IsDebuggerPresent
PAL_ProbeMemory
PAL_iswspace
@@ -119,6 +121,9 @@ IID_IClassFactory
IID_ISequentialStream
IID_IStream
IID_IUnknown
+IID_ICLRDataTarget
+IID_ICorDebugDataTarget4
+IID_ICLRDataEnumMemoryRegionsCallback
InitializeCriticalSection
IsDBCSLeadByte
LeaveCriticalSection
diff --git a/src/dlls/mscoree/coreclr/CMakeLists.txt b/src/dlls/mscoree/coreclr/CMakeLists.txt
index 3144b5139f..afa253f08f 100644
--- a/src/dlls/mscoree/coreclr/CMakeLists.txt
+++ b/src/dlls/mscoree/coreclr/CMakeLists.txt
@@ -5,6 +5,10 @@ if (WIN32)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /ENTRY:CoreDllMain")
+ # Incremental linking results in the linker inserting extra padding and routing function calls via thunks that can break the
+ # invariants (e.g. size of region between Jit_PatchedCodeLast-Jit_PatchCodeStart needs to fit in a page).
+ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /INCREMENTAL:NO")
+
# Delay load libraries required for WinRT as that is not supported on all platforms
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DELAYLOAD:api-ms-win-core-winrt-string-l1-1-0.dll")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /DELAYLOAD:api-ms-win-core-winrt-l1-1-0.dll")
diff --git a/src/dlls/mscoree/mscoree.cpp b/src/dlls/mscoree/mscoree.cpp
index f33f0955e4..f3e22da46b 100644
--- a/src/dlls/mscoree/mscoree.cpp
+++ b/src/dlls/mscoree/mscoree.cpp
@@ -48,7 +48,7 @@ HINSTANCE g_hThisInst; // This library.
#include <process.h> // for __security_init_cookie()
-extern "C" IExecutionEngine* __stdcall IEE();
+extern "C" IExecutionEngine* IEE();
#ifdef NO_CRT_INIT
#define _CRT_INIT(hInstance, dwReason, lpReserved) (TRUE)
diff --git a/src/dlls/mscoree/mscorwks_ntdef.src b/src/dlls/mscoree/mscorwks_ntdef.src
index 8115475418..d7e6a2dcf4 100644
--- a/src/dlls/mscoree/mscorwks_ntdef.src
+++ b/src/dlls/mscoree/mscorwks_ntdef.src
@@ -21,6 +21,7 @@ EXPORTS
coreclr_execute_assembly
coreclr_initialize
coreclr_shutdown
+ coreclr_shutdown_2
; il{d}asm
MetaDataGetDispenser
diff --git a/src/dlls/mscoree/mscorwks_unixexports.src b/src/dlls/mscoree/mscorwks_unixexports.src
index f7862d3afe..28e9ac223f 100644
--- a/src/dlls/mscoree/mscorwks_unixexports.src
+++ b/src/dlls/mscoree/mscorwks_unixexports.src
@@ -3,6 +3,7 @@ coreclr_create_delegate
coreclr_execute_assembly
coreclr_initialize
coreclr_shutdown
+coreclr_shutdown_2
; il{d}asm
MetaDataGetDispenser
diff --git a/src/dlls/mscoree/unixinterface.cpp b/src/dlls/mscoree/unixinterface.cpp
index edd361c0c2..cf9bbc5c72 100644
--- a/src/dlls/mscoree/unixinterface.cpp
+++ b/src/dlls/mscoree/unixinterface.cpp
@@ -183,9 +183,9 @@ int coreclr_initialize(
}
#endif
- ReleaseHolder<ICLRRuntimeHost2> host;
+ ReleaseHolder<ICLRRuntimeHost4> host;
- hr = CorHost2::CreateObject(IID_ICLRRuntimeHost2, (void**)&host);
+ hr = CorHost2::CreateObject(IID_ICLRRuntimeHost4, (void**)&host);
IfFailRet(hr);
ConstWStringHolder appDomainFriendlyNameW = StringToUnicode(appDomainFriendlyName);
@@ -284,7 +284,7 @@ int coreclr_shutdown(
void* hostHandle,
unsigned int domainId)
{
- ReleaseHolder<ICLRRuntimeHost2> host(reinterpret_cast<ICLRRuntimeHost2*>(hostHandle));
+ ReleaseHolder<ICLRRuntimeHost4> host(reinterpret_cast<ICLRRuntimeHost4*>(hostHandle));
HRESULT hr = host->UnloadAppDomain(domainId, true); // Wait until done
IfFailRet(hr);
@@ -299,6 +299,37 @@ int coreclr_shutdown(
}
//
+// Shutdown CoreCLR. It unloads the app domain and stops the CoreCLR host.
+//
+// Parameters:
+// hostHandle - Handle of the host
+// domainId - Id of the domain
+// latchedExitCode - Latched exit code after domain unloaded
+//
+// Returns:
+// HRESULT indicating status of the operation. S_OK if the assembly was successfully executed
+//
+extern "C"
+int coreclr_shutdown_2(
+ void* hostHandle,
+ unsigned int domainId,
+ int* latchedExitCode)
+{
+ ReleaseHolder<ICLRRuntimeHost4> host(reinterpret_cast<ICLRRuntimeHost4*>(hostHandle));
+
+ HRESULT hr = host->UnloadAppDomain2(domainId, true, latchedExitCode); // Wait until done
+ IfFailRet(hr);
+
+ hr = host->Stop();
+
+#ifdef FEATURE_PAL
+ PAL_Shutdown();
+#endif
+
+ return hr;
+}
+
+//
// Create a native callable delegate for a managed method.
//
// Parameters:
@@ -321,7 +352,7 @@ int coreclr_create_delegate(
const char* entryPointMethodName,
void** delegate)
{
- ICLRRuntimeHost2* host = reinterpret_cast<ICLRRuntimeHost2*>(hostHandle);
+ ICLRRuntimeHost4* host = reinterpret_cast<ICLRRuntimeHost4*>(hostHandle);
ConstWStringHolder entryPointAssemblyNameW = StringToUnicode(entryPointAssemblyName);
ConstWStringHolder entryPointTypeNameW = StringToUnicode(entryPointTypeName);
@@ -366,7 +397,7 @@ int coreclr_execute_assembly(
}
*exitCode = -1;
- ICLRRuntimeHost2* host = reinterpret_cast<ICLRRuntimeHost2*>(hostHandle);
+ ICLRRuntimeHost4* host = reinterpret_cast<ICLRRuntimeHost4*>(hostHandle);
ConstWStringArrayHolder argvW;
argvW.Set(StringArrayToUnicode(argc, argv), argc);
diff --git a/src/gc/env/gcenv.os.h b/src/gc/env/gcenv.os.h
index 6a126f29ed..d3e40ac4ff 100644
--- a/src/gc/env/gcenv.os.h
+++ b/src/gc/env/gcenv.os.h
@@ -47,6 +47,86 @@ struct GCThreadAffinity
int Processor;
};
+// An event is a synchronization object whose state can be set and reset
+// indicating that an event has occured. It is used pervasively throughout
+// the GC.
+//
+// Note that GCEvent deliberately leaks its contents by not having a non-trivial destructor.
+// This is by design; since all uses of GCEvent have static lifetime, their destructors
+// are run on process exit, potentially concurrently with other threads that may still be
+// operating on the static event. To avoid these sorts of unsafety, GCEvent chooses to
+// not have a destructor at all. The cost of this is leaking a small amount of memory, but
+// this is not a problem since a majority of the uses of GCEvent are static. See CoreCLR#11111
+// for more details on the hazards of static destructors.
+class GCEvent {
+private:
+ class Impl;
+ Impl *m_impl;
+
+public:
+ // Constructs a new uninitialized event.
+ GCEvent();
+
+ // Closes the event. Attempting to use the event past calling CloseEvent
+ // is a logic error.
+ void CloseEvent();
+
+ // "Sets" the event, indicating that a particular event has occured. May
+ // wake up other threads waiting on this event. Depending on whether or
+ // not this event is an auto-reset event, the state of the event may
+ // or may not be automatically reset after Set is called.
+ void Set();
+
+ // Resets the event, resetting it back to a non-signalled state. Auto-reset
+ // events automatically reset once the event is set, while manual-reset
+ // events do not reset until Reset is called. It is a no-op to call Reset
+ // on an auto-reset event.
+ void Reset();
+
+ // Waits for some period of time for this event to be signalled. The
+ // period of time may be infinite (if the timeout argument is INFINITE) or
+ // it may be a specified period of time, in milliseconds.
+ // Returns:
+ // One of three values, depending on how why this thread was awoken:
+ // WAIT_OBJECT_0 - This event was signalled and woke up this thread.
+ // WAIT_TIMEOUT - The timeout interval expired without this event being signalled.
+ // WAIT_FAILED - The wait failed.
+ uint32_t Wait(uint32_t timeout, bool alertable);
+
+ // Determines whether or not this event is valid.
+ // Returns:
+ // true if this event is invalid (i.e. it has not yet been initialized or
+ // has already been closed), false otherwise
+ bool IsValid() const
+ {
+ return m_impl != nullptr;
+ }
+
+ // Initializes this event to be a host-aware manual reset event with the
+ // given initial state.
+ // Returns:
+ // true if the initialization succeeded, false if it did not
+ bool CreateManualEventNoThrow(bool initialState);
+
+ // Initializes this event to be a host-aware auto-resetting event with the
+ // given initial state.
+ // Returns:
+ // true if the initialization succeeded, false if it did not
+ bool CreateAutoEventNoThrow(bool initialState);
+
+ // Initializes this event to be a host-unaware manual reset event with the
+ // given initial state.
+ // Returns:
+ // true if the initialization succeeded, false if it did not
+ bool CreateOSManualEventNoThrow(bool initialState);
+
+ // Initializes this event to be a host-unaware auto-resetting event with the
+ // given initial state.
+ // Returns:
+ // true if the initialization succeeded, false if it did not
+ bool CreateOSAutoEventNoThrow(bool initialState);
+};
+
// GC thread function prototype
typedef void (*GCThreadFunction)(void* param);
diff --git a/src/gc/gc.cpp b/src/gc/gc.cpp
index ecc13e38fd..08de1facb2 100644
--- a/src/gc/gc.cpp
+++ b/src/gc/gc.cpp
@@ -621,7 +621,7 @@ enum gc_join_flavor
#define first_thread_arrived 2
struct join_structure
{
- CLREvent joined_event[3]; // the last event in the array is only used for first_thread_arrived.
+ GCEvent joined_event[3]; // the last event in the array is only used for first_thread_arrived.
VOLATILE(int32_t) join_lock;
VOLATILE(int32_t) r_join_lock;
VOLATILE(int32_t) join_restart;
@@ -1201,8 +1201,8 @@ class recursive_gc_sync
static VOLATILE(BOOL) gc_background_running; //initial state FALSE
static VOLATILE(int32_t) foreground_count; // initial state 0;
static VOLATILE(uint32_t) foreground_gate; // initial state FALSE;
- static CLREvent foreground_complete;//Auto Reset
- static CLREvent foreground_allowed;//Auto Reset
+ static GCEvent foreground_complete;//Auto Reset
+ static GCEvent foreground_allowed;//Auto Reset
public:
static void begin_background();
static void end_background();
@@ -1218,8 +1218,8 @@ VOLATILE(int32_t) recursive_gc_sync::foreground_request_count = 0;//initial stat
VOLATILE(int32_t) recursive_gc_sync::foreground_count = 0; // initial state 0;
VOLATILE(BOOL) recursive_gc_sync::gc_background_running = FALSE; //initial state FALSE
VOLATILE(uint32_t) recursive_gc_sync::foreground_gate = 0;
-CLREvent recursive_gc_sync::foreground_complete;//Auto Reset
-CLREvent recursive_gc_sync::foreground_allowed;//Manual Reset
+GCEvent recursive_gc_sync::foreground_complete;//Auto Reset
+GCEvent recursive_gc_sync::foreground_allowed;//Manual Reset
BOOL recursive_gc_sync::init ()
{
@@ -2308,7 +2308,7 @@ sorted_table* gc_heap::seg_table;
#endif //!SEG_MAPPING_TABLE || FEATURE_BASICFREEZE
#ifdef MULTIPLE_HEAPS
-CLREvent gc_heap::ee_suspend_event;
+GCEvent gc_heap::ee_suspend_event;
size_t gc_heap::min_balance_threshold = 0;
#endif //MULTIPLE_HEAPS
@@ -2316,7 +2316,7 @@ VOLATILE(BOOL) gc_heap::gc_started;
#ifdef MULTIPLE_HEAPS
-CLREvent gc_heap::gc_start_event;
+GCEvent gc_heap::gc_start_event;
bool gc_heap::gc_thread_no_affinitize_p = false;
@@ -2385,13 +2385,13 @@ uint64_t gc_heap::total_physical_mem;
uint64_t gc_heap::entry_available_physical_mem;
#ifdef BACKGROUND_GC
-CLREvent gc_heap::bgc_start_event;
+GCEvent gc_heap::bgc_start_event;
gc_mechanisms gc_heap::saved_bgc_settings;
-CLREvent gc_heap::background_gc_done_event;
+GCEvent gc_heap::background_gc_done_event;
-CLREvent gc_heap::ee_proceed_event;
+GCEvent gc_heap::ee_proceed_event;
bool gc_heap::gc_can_use_concurrent = false;
@@ -2403,7 +2403,7 @@ BOOL gc_heap::dont_restart_ee_p = FALSE;
BOOL gc_heap::keep_bgc_threads_p = FALSE;
-CLREvent gc_heap::bgc_threads_sync_event;
+GCEvent gc_heap::bgc_threads_sync_event;
BOOL gc_heap::do_ephemeral_gc_p = FALSE;
@@ -2589,7 +2589,7 @@ BOOL gc_heap::bgc_thread_running;
CLRCriticalSection gc_heap::bgc_threads_timeout_cs;
-CLREvent gc_heap::gc_lh_block_event;
+GCEvent gc_heap::gc_lh_block_event;
#endif //BACKGROUND_GC
@@ -2685,9 +2685,9 @@ int gc_heap::loh_pinned_queue_decay = LOH_PIN_DECAY;
#endif //FEATURE_LOH_COMPACTION
-CLREvent gc_heap::full_gc_approach_event;
+GCEvent gc_heap::full_gc_approach_event;
-CLREvent gc_heap::full_gc_end_event;
+GCEvent gc_heap::full_gc_end_event;
uint32_t gc_heap::fgn_maxgen_percent = 0;
@@ -5151,7 +5151,6 @@ void gc_heap::destroy_thread_support ()
}
}
-#if !defined(FEATURE_PAL)
void set_thread_group_affinity_for_heap(int heap_number, GCThreadAffinity* affinity)
{
affinity->Group = GCThreadAffinity::None;
@@ -5231,7 +5230,6 @@ void set_thread_affinity_mask_for_heap(int heap_number, GCThreadAffinity* affini
}
}
}
-#endif // !FEATURE_PAL
bool gc_heap::create_gc_thread ()
{
@@ -5241,7 +5239,6 @@ bool gc_heap::create_gc_thread ()
affinity.Group = GCThreadAffinity::None;
affinity.Processor = GCThreadAffinity::None;
-#if !defined(FEATURE_PAL)
if (!gc_thread_no_affinitize_p)
{
// We are about to set affinity for GC threads. It is a good place to set up NUMA and
@@ -5252,7 +5249,6 @@ bool gc_heap::create_gc_thread ()
else
set_thread_affinity_mask_for_heap(heap_number, &affinity);
}
-#endif // !FEATURE_PAL
return GCToOSInterface::CreateThread(gc_thread_stub, this, &affinity);
}
@@ -9266,12 +9262,10 @@ void gc_heap::delete_heap_segment (heap_segment* seg, BOOL consider_hoarding)
void gc_heap::reset_heap_segment_pages (heap_segment* seg)
{
-#ifndef FEATURE_PAL // No MEM_RESET support in PAL VirtualAlloc
size_t page_start = align_on_page ((size_t)heap_segment_allocated (seg));
size_t size = (size_t)heap_segment_committed (seg) - page_start;
if (size != 0)
GCToOSInterface::VirtualReset((void*)page_start, size, false /* unlock */);
-#endif //!FEATURE_PAL
}
void gc_heap::decommit_heap_segment_pages (heap_segment* seg,
@@ -10312,7 +10306,7 @@ gc_heap::loh_state_info gc_heap::last_loh_states[max_saved_loh_states];
VOLATILE(int32_t) gc_heap::gc_done_event_lock;
VOLATILE(bool) gc_heap::gc_done_event_set;
-CLREvent gc_heap::gc_done_event;
+GCEvent gc_heap::gc_done_event;
#endif //!MULTIPLE_HEAPS
VOLATILE(bool) gc_heap::internal_gc_done;
@@ -11741,7 +11735,7 @@ void gc_heap::send_full_gc_notification (int gen_num, BOOL due_to_alloc_p)
}
}
-wait_full_gc_status gc_heap::full_gc_wait (CLREvent *event, int time_out_ms)
+wait_full_gc_status gc_heap::full_gc_wait (GCEvent *event, int time_out_ms)
{
if (fgn_maxgen_percent == 0)
{
@@ -20362,7 +20356,7 @@ size_t gc_heap::update_brick_table (uint8_t* tree, size_t current_brick,
dprintf (3, ("tree: %Ix, current b: %Ix, x: %Ix, plug_end: %Ix",
tree, current_brick, x, plug_end));
- if (tree > 0)
+ if (tree != NULL)
{
dprintf (3, ("b- %Ix->%Ix pointing to tree %Ix",
current_brick, (size_t)(tree - brick_address (current_brick)), tree));
@@ -30809,7 +30803,6 @@ CObjectHeader* gc_heap::allocate_large_object (size_t jsize, int64_t& alloc_byte
void reset_memory (uint8_t* o, size_t sizeo)
{
-#ifndef FEATURE_PAL
if (sizeo > 128 * 1024)
{
// We cannot reset the memory for the useful part of a free object.
@@ -30824,7 +30817,6 @@ void reset_memory (uint8_t* o, size_t sizeo)
reset_mm_p = GCToOSInterface::VirtualReset((void*)page_start, size, true /* unlock */);
}
}
-#endif //!FEATURE_PAL
}
void gc_heap::reset_large_object (uint8_t* o)
@@ -32417,7 +32409,7 @@ void gc_heap::descr_generations (BOOL begin_gc_p)
VOLATILE(BOOL) GCHeap::GcInProgress = FALSE;
//GCTODO
//CMCSafeLock* GCHeap::fGcLock;
-CLREvent *GCHeap::WaitForGCEvent = NULL;
+GCEvent *GCHeap::WaitForGCEvent = NULL;
//GCTODO
#ifdef TRACE_GC
unsigned int GCHeap::GcDuration;
@@ -33691,7 +33683,7 @@ HRESULT GCHeap::Initialize ()
gc_heap::youngest_gen_desired_th = gc_heap::mem_one_percent;
#endif // BIT64
- WaitForGCEvent = new (nothrow) CLREvent;
+ WaitForGCEvent = new (nothrow) GCEvent;
if (!WaitForGCEvent)
{
@@ -33891,7 +33883,7 @@ bool GCHeap::IsHeapPointer (void* vpObject, bool small_heap_only)
STATIC_CONTRACT_SO_TOLERANT;
// removed STATIC_CONTRACT_CAN_TAKE_LOCK here because find_segment
- // no longer calls CLREvent::Wait which eventually takes a lock.
+ // no longer calls GCEvent::Wait which eventually takes a lock.
uint8_t* object = (uint8_t*) vpObject;
#ifndef FEATURE_BASICFREEZE
@@ -34226,7 +34218,7 @@ bool GCHeap::StressHeap(gc_alloc_context * context)
if (g_pConfig->AppDomainLeaks() && str->SetAppDomainNoThrow())
{
#endif
- StoreObjectInHandle(m_StressObjs[i], ObjectToOBJECTREF(str));
+ HndAssignHandle(m_StressObjs[i], ObjectToOBJECTREF(str));
#if CHECK_APP_DOMAIN_LEAKS
}
#endif
@@ -34259,7 +34251,7 @@ bool GCHeap::StressHeap(gc_alloc_context * context)
{
// Let the string itself become garbage.
// will be realloced next time around
- StoreObjectInHandle(m_StressObjs[m_CurStressObj], 0);
+ HndAssignHandle(m_StressObjs[m_CurStressObj], 0);
}
}
}
diff --git a/src/gc/gc.h b/src/gc/gc.h
index a661c311ab..07ae6c916c 100644
--- a/src/gc/gc.h
+++ b/src/gc/gc.h
@@ -115,7 +115,7 @@ extern "C" GCHeapType g_gc_heap_type;
extern "C" uint32_t g_max_generation;
extern "C" MethodTable* g_gc_pFreeObjectMethodTable;
-::IGCHandleTable* CreateGCHandleTable();
+::IGCHandleManager* CreateGCHandleManager();
namespace WKS {
::IGCHeapInternal* CreateGCHeap();
@@ -260,8 +260,8 @@ void updateGCShadow(Object** ptr, Object* val);
// The single GC heap instance, shared with the VM.
extern IGCHeapInternal* g_theGCHeap;
-// The single GC handle table instance, shared with the VM.
-extern IGCHandleTable* g_theGCHandleTable;
+// The single GC handle manager instance, shared with the VM.
+extern IGCHandleManager* g_theGCHandleManager;
#ifndef DACCESS_COMPILE
inline bool IsGCInProgress(bool bConsiderGCStart = false)
diff --git a/src/gc/gccommon.cpp b/src/gc/gccommon.cpp
index f931597667..4950809cda 100644
--- a/src/gc/gccommon.cpp
+++ b/src/gc/gccommon.cpp
@@ -15,7 +15,7 @@
#include "gc.h"
IGCHeapInternal* g_theGCHeap;
-IGCHandleTable* g_theGCHandleTable;
+IGCHandleManager* g_theGCHandleManager;
#ifdef FEATURE_STANDALONE_GC
IGCToCLR* g_theGCToCLR;
@@ -143,7 +143,7 @@ namespace SVR
extern void PopulateDacVars(GcDacVars* dacVars);
}
-bool InitializeGarbageCollector(IGCToCLR* clrToGC, IGCHeap** gcHeap, IGCHandleTable** gcHandleTable, GcDacVars* gcDacVars)
+bool InitializeGarbageCollector(IGCToCLR* clrToGC, IGCHeap** gcHeap, IGCHandleManager** gcHandleManager, GcDacVars* gcDacVars)
{
LIMITED_METHOD_CONTRACT;
@@ -151,10 +151,10 @@ bool InitializeGarbageCollector(IGCToCLR* clrToGC, IGCHeap** gcHeap, IGCHandleTa
assert(gcDacVars != nullptr);
assert(gcHeap != nullptr);
- assert(gcHandleTable != nullptr);
+ assert(gcHandleManager != nullptr);
- IGCHandleTable* handleTable = CreateGCHandleTable();
- if (handleTable == nullptr)
+ IGCHandleManager* handleManager = CreateGCHandleManager();
+ if (handleManager == nullptr)
{
return false;
}
@@ -192,7 +192,7 @@ bool InitializeGarbageCollector(IGCToCLR* clrToGC, IGCHeap** gcHeap, IGCHandleTa
assert(clrToGC == nullptr);
#endif
- *gcHandleTable = handleTable;
+ *gcHandleManager = handleManager;
*gcHeap = heap;
return true;
}
diff --git a/src/gc/gcee.cpp b/src/gc/gcee.cpp
index 889f940973..0404058cde 100644
--- a/src/gc/gcee.cpp
+++ b/src/gc/gcee.cpp
@@ -428,9 +428,14 @@ void GCHeap::SetGCInProgress(bool fInProgress)
GcInProgress = fInProgress;
}
-CLREvent * GCHeap::GetWaitForGCEvent()
+void GCHeap::SetWaitForGCEvent()
{
- return WaitForGCEvent;
+ WaitForGCEvent->Set();
+}
+
+void GCHeap::ResetWaitForGCEvent()
+{
+ WaitForGCEvent->Reset();
}
void GCHeap::WaitUntilConcurrentGCComplete()
@@ -520,7 +525,7 @@ void gc_heap::fire_etw_pin_object_event (uint8_t* object, uint8_t** ppObject)
}
#endif // FEATURE_EVENT_TRACE
-uint32_t gc_heap::user_thread_wait (CLREvent *event, BOOL no_mode_change, int time_out_ms)
+uint32_t gc_heap::user_thread_wait (GCEvent *event, BOOL no_mode_change, int time_out_ms)
{
Thread* pCurThread = NULL;
bool mode = false;
diff --git a/src/gc/gchandletable.cpp b/src/gc/gchandletable.cpp
index 82ab269861..52fede6299 100644
--- a/src/gc/gchandletable.cpp
+++ b/src/gc/gchandletable.cpp
@@ -8,104 +8,146 @@
#include "gchandletableimpl.h"
#include "objecthandle.h"
-IGCHandleTable* CreateGCHandleTable()
+GCHandleStore* g_gcGlobalHandleStore;
+
+IGCHandleManager* CreateGCHandleManager()
{
- return new(nothrow) GCHandleTable();
+ return new (nothrow) GCHandleManager();
}
-bool GCHandleTable::Initialize()
+void GCHandleStore::Uproot()
{
- return Ref_Initialize();
+ Ref_RemoveHandleTableBucket(&_underlyingBucket);
}
-void GCHandleTable::Shutdown()
+bool GCHandleStore::ContainsHandle(OBJECTHANDLE handle)
{
- Ref_Shutdown();
+ return _underlyingBucket.Contains(handle);
}
-void* GCHandleTable::GetGlobalHandleStore()
+OBJECTHANDLE GCHandleStore::CreateHandleOfType(Object* object, int type)
{
- return (void*)g_HandleTableMap.pBuckets[0];
+ HHANDLETABLE handletable = _underlyingBucket.pTable[GetCurrentThreadHomeHeapNumber()];
+ return ::HndCreateHandle(handletable, type, ObjectToOBJECTREF(object));
}
-void* GCHandleTable::CreateHandleStore(void* context)
+OBJECTHANDLE GCHandleStore::CreateHandleOfType(Object* object, int type, int heapToAffinitizeTo)
{
-#ifndef FEATURE_REDHAWK
- return (void*)::Ref_CreateHandleTableBucket(ADIndex((DWORD)(uintptr_t)context));
-#else
- assert("CreateHandleStore is not implemented when FEATURE_REDHAWK is defined!");
- return nullptr;
-#endif
+ HHANDLETABLE handletable = _underlyingBucket.pTable[heapToAffinitizeTo];
+ return ::HndCreateHandle(handletable, type, ObjectToOBJECTREF(object));
}
-void* GCHandleTable::GetHandleContext(OBJECTHANDLE handle)
+OBJECTHANDLE GCHandleStore::CreateHandleWithExtraInfo(Object* object, int type, void* pExtraInfo)
{
- return (void*)((uintptr_t)::HndGetHandleTableADIndex(::HndGetHandleTable(handle)).m_dwIndex);
+ HHANDLETABLE handletable = _underlyingBucket.pTable[GetCurrentThreadHomeHeapNumber()];
+ return ::HndCreateHandle(handletable, type, ObjectToOBJECTREF(object), reinterpret_cast<uintptr_t>(pExtraInfo));
}
-void GCHandleTable::DestroyHandleStore(void* store)
+OBJECTHANDLE GCHandleStore::CreateDependentHandle(Object* primary, Object* secondary)
{
- Ref_DestroyHandleTableBucket((HandleTableBucket*) store);
+ HHANDLETABLE handletable = _underlyingBucket.pTable[GetCurrentThreadHomeHeapNumber()];
+ OBJECTHANDLE handle = ::HndCreateHandle(handletable, HNDTYPE_DEPENDENT, ObjectToOBJECTREF(primary));
+ if (!handle)
+ {
+ return nullptr;
+ }
+
+ ::SetDependentHandleSecondary(handle, ObjectToOBJECTREF(secondary));
+ return handle;
}
-void GCHandleTable::UprootHandleStore(void* store)
+GCHandleStore::~GCHandleStore()
{
- Ref_RemoveHandleTableBucket((HandleTableBucket*) store);
+ ::Ref_DestroyHandleTableBucket(&_underlyingBucket);
}
-bool GCHandleTable::ContainsHandle(void* store, OBJECTHANDLE handle)
+bool GCHandleManager::Initialize()
{
- return ((HandleTableBucket*)store)->Contains(handle);
+ return Ref_Initialize();
}
-OBJECTHANDLE GCHandleTable::CreateHandleOfType(void* store, Object* object, int type)
+void GCHandleManager::Shutdown()
{
- HHANDLETABLE handletable = ((HandleTableBucket*)store)->pTable[GetCurrentThreadHomeHeapNumber()];
- return ::HndCreateHandle(handletable, type, ObjectToOBJECTREF(object));
+ if (g_gcGlobalHandleStore != nullptr)
+ {
+ DestroyHandleStore(g_gcGlobalHandleStore);
+ }
+
+ ::Ref_Shutdown();
}
-OBJECTHANDLE GCHandleTable::CreateHandleOfType(void* store, Object* object, int type, int heapToAffinitizeTo)
+IGCHandleStore* GCHandleManager::GetGlobalHandleStore()
{
- HHANDLETABLE handletable = ((HandleTableBucket*)store)->pTable[heapToAffinitizeTo];
- return ::HndCreateHandle(handletable, type, ObjectToOBJECTREF(object));
+ return g_gcGlobalHandleStore;
}
-OBJECTHANDLE GCHandleTable::CreateGlobalHandleOfType(Object* object, int type)
+IGCHandleStore* GCHandleManager::CreateHandleStore(void* context)
{
- return ::HndCreateHandle(g_HandleTableMap.pBuckets[0]->pTable[GetCurrentThreadHomeHeapNumber()], type, ObjectToOBJECTREF(object));
+#ifndef FEATURE_REDHAWK
+ GCHandleStore* store = new (nothrow) GCHandleStore();
+ if (store == nullptr)
+ return nullptr;
+
+ bool success = ::Ref_InitializeHandleTableBucket(&store->_underlyingBucket, context);
+ if (!success)
+ {
+ delete store;
+ return nullptr;
+ }
+
+ return store;
+#else
+ assert("CreateHandleStore is not implemented when FEATURE_REDHAWK is defined!");
+ return nullptr;
+#endif
}
-OBJECTHANDLE GCHandleTable::CreateHandleWithExtraInfo(void* store, Object* object, int type, void* pExtraInfo)
+void GCHandleManager::DestroyHandleStore(IGCHandleStore* store)
{
- HHANDLETABLE handletable = ((HandleTableBucket*)store)->pTable[GetCurrentThreadHomeHeapNumber()];
- return ::HndCreateHandle(handletable, type, ObjectToOBJECTREF(object), reinterpret_cast<uintptr_t>(pExtraInfo));
+ delete store;
}
-OBJECTHANDLE GCHandleTable::CreateDependentHandle(void* store, Object* primary, Object* secondary)
+void* GCHandleManager::GetHandleContext(OBJECTHANDLE handle)
{
- HHANDLETABLE handletable = ((HandleTableBucket*)store)->pTable[GetCurrentThreadHomeHeapNumber()];
- OBJECTHANDLE handle = ::HndCreateHandle(handletable, HNDTYPE_DEPENDENT, ObjectToOBJECTREF(primary));
- ::SetDependentHandleSecondary(handle, ObjectToOBJECTREF(secondary));
+ return (void*)((uintptr_t)::HndGetHandleTableADIndex(::HndGetHandleTable(handle)).m_dwIndex);
+}
- return handle;
+OBJECTHANDLE GCHandleManager::CreateGlobalHandleOfType(Object* object, int type)
+{
+ return ::HndCreateHandle(g_HandleTableMap.pBuckets[0]->pTable[GetCurrentThreadHomeHeapNumber()], type, ObjectToOBJECTREF(object));
}
-OBJECTHANDLE GCHandleTable::CreateDuplicateHandle(OBJECTHANDLE handle)
+OBJECTHANDLE GCHandleManager::CreateDuplicateHandle(OBJECTHANDLE handle)
{
return ::HndCreateHandle(HndGetHandleTable(handle), HNDTYPE_DEFAULT, ::HndFetchHandle(handle));
}
-void GCHandleTable::DestroyHandleOfType(OBJECTHANDLE handle, int type)
+void GCHandleManager::DestroyHandleOfType(OBJECTHANDLE handle, int type)
{
::HndDestroyHandle(::HndGetHandleTable(handle), type, handle);
}
-void GCHandleTable::DestroyHandleOfUnknownType(OBJECTHANDLE handle)
+void GCHandleManager::DestroyHandleOfUnknownType(OBJECTHANDLE handle)
{
::HndDestroyHandleOfUnknownType(::HndGetHandleTable(handle), handle);
}
-void* GCHandleTable::GetExtraInfoFromHandle(OBJECTHANDLE handle)
+void* GCHandleManager::GetExtraInfoFromHandle(OBJECTHANDLE handle)
{
return (void*)::HndGetHandleExtraInfo(handle);
}
+
+void GCHandleManager::StoreObjectInHandle(OBJECTHANDLE handle, Object* object)
+{
+ ::HndAssignHandle(handle, ObjectToOBJECTREF(object));
+}
+
+bool GCHandleManager::StoreObjectInHandleIfNull(OBJECTHANDLE handle, Object* object)
+{
+ return !!::HndFirstAssignHandle(handle, ObjectToOBJECTREF(object));
+}
+
+Object* GCHandleManager::InterlockedCompareExchangeObjectInHandle(OBJECTHANDLE handle, Object* object, Object* comparandObject)
+{
+ return (Object*)::HndInterlockedCompareExchangeHandle(handle, ObjectToOBJECTREF(object), ObjectToOBJECTREF(comparandObject));
+}
diff --git a/src/gc/gchandletableimpl.h b/src/gc/gchandletableimpl.h
index af20f52e54..01c1c130ed 100644
--- a/src/gc/gchandletableimpl.h
+++ b/src/gc/gchandletableimpl.h
@@ -6,33 +6,44 @@
#define GCHANDLETABLE_H_
#include "gcinterface.h"
+#include "objecthandle.h"
-class GCHandleTable : public IGCHandleTable
+class GCHandleStore : public IGCHandleStore
{
public:
- virtual bool Initialize();
+ virtual void Uproot();
- virtual void Shutdown();
+ virtual bool ContainsHandle(OBJECTHANDLE handle);
- virtual void* GetGlobalHandleStore();
+ virtual OBJECTHANDLE CreateHandleOfType(Object* object, int type);
- virtual void* CreateHandleStore(void* context);
+ virtual OBJECTHANDLE CreateHandleOfType(Object* object, int type, int heapToAffinitizeTo);
- virtual void* GetHandleContext(OBJECTHANDLE handle);
+ virtual OBJECTHANDLE CreateHandleWithExtraInfo(Object* object, int type, void* pExtraInfo);
- virtual void DestroyHandleStore(void* store);
+ virtual OBJECTHANDLE CreateDependentHandle(Object* primary, Object* secondary);
- virtual void UprootHandleStore(void* store);
+ virtual ~GCHandleStore();
- virtual bool ContainsHandle(void* store, OBJECTHANDLE handle);
+ HandleTableBucket _underlyingBucket;
+};
- virtual OBJECTHANDLE CreateHandleOfType(void* store, Object* object, int type);
+extern GCHandleStore* g_gcGlobalHandleStore;
- virtual OBJECTHANDLE CreateHandleOfType(void* store, Object* object, int type, int heapToAffinitizeTo);
+class GCHandleManager : public IGCHandleManager
+{
+public:
+ virtual bool Initialize();
- virtual OBJECTHANDLE CreateHandleWithExtraInfo(void* store, Object* object, int type, void* pExtraInfo);
+ virtual void Shutdown();
- virtual OBJECTHANDLE CreateDependentHandle(void* store, Object* primary, Object* secondary);
+ virtual void* GetHandleContext(OBJECTHANDLE handle);
+
+ virtual IGCHandleStore* GetGlobalHandleStore();
+
+ virtual IGCHandleStore* CreateHandleStore(void* context);
+
+ virtual void DestroyHandleStore(IGCHandleStore* store);
virtual OBJECTHANDLE CreateGlobalHandleOfType(Object* object, int type);
@@ -43,6 +54,12 @@ public:
virtual void DestroyHandleOfUnknownType(OBJECTHANDLE handle);
virtual void* GetExtraInfoFromHandle(OBJECTHANDLE handle);
+
+ virtual void StoreObjectInHandle(OBJECTHANDLE handle, Object* object);
+
+ virtual bool StoreObjectInHandleIfNull(OBJECTHANDLE handle, Object* object);
+
+ virtual Object* InterlockedCompareExchangeObjectInHandle(OBJECTHANDLE handle, Object* object, Object* comparandObject);
};
#endif // GCHANDLETABLE_H_
diff --git a/src/gc/gcimpl.h b/src/gc/gcimpl.h
index 2a51d477b0..8ac16c5107 100644
--- a/src/gc/gcimpl.h
+++ b/src/gc/gcimpl.h
@@ -6,8 +6,6 @@
#ifndef GCIMPL_H_
#define GCIMPL_H_
-#define CLREvent CLREventStatic
-
#ifdef SERVER_GC
#define MULTIPLE_HEAPS 1
#endif // SERVER_GC
@@ -93,7 +91,8 @@ public:
bool RuntimeStructuresValid();
- CLREvent * GetWaitForGCEvent();
+ void SetWaitForGCEvent();
+ void ResetWaitForGCEvent();
HRESULT Initialize ();
@@ -242,7 +241,7 @@ public: // FIX
void TemporaryDisableConcurrentGC();
bool IsConcurrentGCEnabled();
- PER_HEAP_ISOLATED CLREvent *WaitForGCEvent; // used for syncing w/GC
+ PER_HEAP_ISOLATED GCEvent *WaitForGCEvent; // used for syncing w/GC
PER_HEAP_ISOLATED CFinalize* m_Finalize;
diff --git a/src/gc/gcinterface.h b/src/gc/gcinterface.h
index cac2ba7114..552a8caec8 100644
--- a/src/gc/gcinterface.h
+++ b/src/gc/gcinterface.h
@@ -169,12 +169,12 @@ struct segment_info
class Object;
class IGCHeap;
-class IGCHandleTable;
+class IGCHandleManager;
// Initializes the garbage collector. Should only be called
// once, during EE startup. Returns true if the initialization
// was successful, false otherwise.
-bool InitializeGarbageCollector(IGCToCLR* clrToGC, IGCHeap** gcHeap, IGCHandleTable** gcHandleTable, GcDacVars* gcDacVars);
+bool InitializeGarbageCollector(IGCToCLR* clrToGC, IGCHeap** gcHeap, IGCHandleManager** gcHandleTable, GcDacVars* gcDacVars);
// The runtime needs to know whether we're using workstation or server GC
// long before the GCHeap is created. This function sets the type of
@@ -402,32 +402,38 @@ typedef struct OBJECTHANDLE__* OBJECTHANDLE;
typedef uintptr_t OBJECTHANDLE;
#endif
-class IGCHandleTable {
+class IGCHandleStore {
public:
- virtual bool Initialize() = 0;
+ virtual void Uproot() = 0;
- virtual void Shutdown() = 0;
+ virtual bool ContainsHandle(OBJECTHANDLE handle) = 0;
- virtual void* GetHandleContext(OBJECTHANDLE handle) = 0;
+ virtual OBJECTHANDLE CreateHandleOfType(Object* object, int type) = 0;
+
+ virtual OBJECTHANDLE CreateHandleOfType(Object* object, int type, int heapToAffinitizeTo) = 0;
- virtual void* GetGlobalHandleStore() = 0;
+ virtual OBJECTHANDLE CreateHandleWithExtraInfo(Object* object, int type, void* pExtraInfo) = 0;
- virtual void* CreateHandleStore(void* context) = 0;
+ virtual OBJECTHANDLE CreateDependentHandle(Object* primary, Object* secondary) = 0;
- virtual void DestroyHandleStore(void* store) = 0;
+ virtual ~IGCHandleStore() {};
+};
+
+class IGCHandleManager {
+public:
- virtual void UprootHandleStore(void* store) = 0;
+ virtual bool Initialize() = 0;
- virtual bool ContainsHandle(void* store, OBJECTHANDLE handle) = 0;
+ virtual void Shutdown() = 0;
- virtual OBJECTHANDLE CreateHandleOfType(void* store, Object* object, int type) = 0;
+ virtual void* GetHandleContext(OBJECTHANDLE handle) = 0;
- virtual OBJECTHANDLE CreateHandleOfType(void* store, Object* object, int type, int heapToAffinitizeTo) = 0;
+ virtual IGCHandleStore* GetGlobalHandleStore() = 0;
- virtual OBJECTHANDLE CreateHandleWithExtraInfo(void* store, Object* object, int type, void* pExtraInfo) = 0;
+ virtual IGCHandleStore* CreateHandleStore(void* context) = 0;
- virtual OBJECTHANDLE CreateDependentHandle(void* store, Object* primary, Object* secondary) = 0;
+ virtual void DestroyHandleStore(IGCHandleStore* store) = 0;
virtual OBJECTHANDLE CreateGlobalHandleOfType(Object* object, int type) = 0;
@@ -438,6 +444,12 @@ public:
virtual void DestroyHandleOfUnknownType(OBJECTHANDLE handle) = 0;
virtual void* GetExtraInfoFromHandle(OBJECTHANDLE handle) = 0;
+
+ virtual void StoreObjectInHandle(OBJECTHANDLE handle, Object* object) = 0;
+
+ virtual bool StoreObjectInHandleIfNull(OBJECTHANDLE handle, Object* object) = 0;
+
+ virtual Object* InterlockedCompareExchangeObjectInHandle(OBJECTHANDLE handle, Object* object, Object* comparandObject) = 0;
};
// IGCHeap is the interface that the VM will use when interacting with the GC.
@@ -687,9 +699,11 @@ public:
// background GC as the BGC threads also need to walk LOH.
virtual void PublishObject(uint8_t* obj) = 0;
- // Gets the event that suspended threads will use to wait for the
- // end of a GC.
- virtual CLREventStatic* GetWaitForGCEvent() = 0;
+ // Signals the WaitForGCEvent event, indicating that a GC has completed.
+ virtual void SetWaitForGCEvent() = 0;
+
+ // Resets the state of the WaitForGCEvent back to an unsignalled state.
+ virtual void ResetWaitForGCEvent() = 0;
/*
===========================================================================
diff --git a/src/gc/gcpriv.h b/src/gc/gcpriv.h
index 108045cd37..a2ec64b614 100644
--- a/src/gc/gcpriv.h
+++ b/src/gc/gcpriv.h
@@ -197,8 +197,6 @@ void GCLogConfig (const char *fmt, ... );
//Please leave these definitions intact.
-#define CLREvent CLREventStatic
-
// hosted api
#ifdef memcpy
#undef memcpy
@@ -2766,7 +2764,7 @@ public:
BOOL dont_restart_ee_p;
PER_HEAP_ISOLATED
- CLREvent bgc_start_event;
+ GCEvent bgc_start_event;
#endif //BACKGROUND_GC
// The variables in this block are known to the DAC and must come first
@@ -2833,9 +2831,9 @@ public:
PER_HEAP
#ifndef MULTIPLE_HEAPS
- CLREvent gc_done_event;
+ GCEvent gc_done_event;
#else // MULTIPLE_HEAPS
- CLREvent gc_done_event;
+ GCEvent gc_done_event;
#endif // MULTIPLE_HEAPS
PER_HEAP
@@ -2890,10 +2888,10 @@ public:
// notification feature which is only enabled if concurrent
// GC is disabled.
PER_HEAP_ISOLATED
- CLREvent full_gc_approach_event;
+ GCEvent full_gc_approach_event;
PER_HEAP_ISOLATED
- CLREvent full_gc_end_event;
+ GCEvent full_gc_end_event;
// Full GC Notification percentages.
PER_HEAP_ISOLATED
@@ -2913,9 +2911,9 @@ public:
PER_HEAP
size_t fgn_last_alloc;
- static uint32_t user_thread_wait (CLREvent *event, BOOL no_mode_change, int time_out_ms=INFINITE);
+ static uint32_t user_thread_wait (GCEvent *event, BOOL no_mode_change, int time_out_ms=INFINITE);
- static wait_full_gc_status full_gc_wait (CLREvent *event, int time_out_ms);
+ static wait_full_gc_status full_gc_wait (GCEvent *event, int time_out_ms);
PER_HEAP
uint8_t* demotion_low;
@@ -2943,10 +2941,10 @@ public:
bool gc_thread_no_affinitize_p;
PER_HEAP_ISOLATED
- CLREvent gc_start_event;
+ GCEvent gc_start_event;
PER_HEAP_ISOLATED
- CLREvent ee_suspend_event;
+ GCEvent ee_suspend_event;
PER_HEAP
heap_segment* new_heap_segment;
@@ -3133,7 +3131,7 @@ protected:
// we need to create them on the thread that called
// SuspendEE which is heap 0.
PER_HEAP_ISOLATED
- CLREvent bgc_threads_sync_event;
+ GCEvent bgc_threads_sync_event;
PER_HEAP
Thread* bgc_thread;
@@ -3142,13 +3140,13 @@ protected:
CLRCriticalSection bgc_threads_timeout_cs;
PER_HEAP_ISOLATED
- CLREvent background_gc_done_event;
+ GCEvent background_gc_done_event;
PER_HEAP_ISOLATED
- CLREvent ee_proceed_event;
+ GCEvent ee_proceed_event;
PER_HEAP
- CLREvent gc_lh_block_event;
+ GCEvent gc_lh_block_event;
PER_HEAP_ISOLATED
bool gc_can_use_concurrent;
diff --git a/src/gc/handletable.cpp b/src/gc/handletable.cpp
index eee181959f..05137e4d68 100644
--- a/src/gc/handletable.cpp
+++ b/src/gc/handletable.cpp
@@ -285,12 +285,7 @@ OBJECTHANDLE HndCreateHandle(HHANDLETABLE hTable, uint32_t uType, OBJECTREF obje
{
CONTRACTL
{
-#ifdef FEATURE_REDHAWK
- // Redhawk returns NULL on failure.
NOTHROW;
-#else
- THROWS;
-#endif
GC_NOTRIGGER;
if (object != NULL)
{
@@ -308,8 +303,7 @@ OBJECTHANDLE HndCreateHandle(HHANDLETABLE hTable, uint32_t uType, OBJECTREF obje
if (g_pConfig->ShouldInjectFault(INJECTFAULT_HANDLETABLE))
{
FAULT_NOT_FATAL();
- char *a = new char;
- delete a;
+ return NULL;
}
#endif // _DEBUG && !FEATURE_REDHAWK
@@ -331,11 +325,7 @@ OBJECTHANDLE HndCreateHandle(HHANDLETABLE hTable, uint32_t uType, OBJECTREF obje
// did the allocation succeed?
if (!handle)
{
-#ifdef FEATURE_REDHAWK
return NULL;
-#else
- ThrowOutOfMemory();
-#endif
}
#ifdef DEBUG_DestroyedHandleValue
diff --git a/src/gc/handletable.inl b/src/gc/handletable.inl
index ae815c129b..752a7b01ae 100644
--- a/src/gc/handletable.inl
+++ b/src/gc/handletable.inl
@@ -22,13 +22,6 @@ inline void HndAssignHandle(OBJECTHANDLE handle, OBJECTREF objref)
// sanity
_ASSERTE(handle);
-#ifdef _DEBUG_IMPL
- // handle should not be in unloaded domain
- ValidateAppDomainForHandle(handle);
-
- // Make sure the objref is valid before it is assigned to a handle
- ValidateAssignObjrefForHandle(objref, HndGetHandleTableADIndex(HndGetHandleTable(handle)));
-#endif
// unwrap the objectref we were given
_UNCHECKED_OBJECTREF value = OBJECTREF_TO_UNCHECKED_OBJECTREF(objref);
@@ -49,13 +42,6 @@ inline void* HndInterlockedCompareExchangeHandle(OBJECTHANDLE handle, OBJECTREF
// sanity
_ASSERTE(handle);
-#ifdef _DEBUG_IMPL
- // handle should not be in unloaded domain
- ValidateAppDomainForHandle(handle);
-
- // Make sure the objref is valid before it is assigned to a handle
- ValidateAssignObjrefForHandle(objref, HndGetHandleTableADIndex(HndGetHandleTable(handle)));
-#endif
// unwrap the objectref we were given
_UNCHECKED_OBJECTREF value = OBJECTREF_TO_UNCHECKED_OBJECTREF(objref);
_UNCHECKED_OBJECTREF oldValue = OBJECTREF_TO_UNCHECKED_OBJECTREF(oldObjref);
@@ -88,13 +74,6 @@ inline BOOL HndFirstAssignHandle(OBJECTHANDLE handle, OBJECTREF objref)
// sanity
_ASSERTE(handle);
-#ifdef _DEBUG_IMPL
- // handle should not be in unloaded domain
- ValidateAppDomainForHandle(handle);
-
- // Make sure the objref is valid before it is assigned to a handle
- ValidateAssignObjrefForHandle(objref, HndGetHandleTableADIndex(HndGetHandleTable(handle)));
-#endif
// unwrap the objectref we were given
_UNCHECKED_OBJECTREF value = OBJECTREF_TO_UNCHECKED_OBJECTREF(objref);
_UNCHECKED_OBJECTREF null = NULL;
diff --git a/src/gc/handletablecore.cpp b/src/gc/handletablecore.cpp
index 5776c26ace..00ab6a24b9 100644
--- a/src/gc/handletablecore.cpp
+++ b/src/gc/handletablecore.cpp
@@ -961,12 +961,12 @@ BOOL SegmentHandleAsyncPinHandles (TableSegment *pSegment)
}
// Replace an async pin handle with one from default domain
-void SegmentRelocateAsyncPinHandles (TableSegment *pSegment, HandleTable *pTargetTable)
+bool SegmentRelocateAsyncPinHandles (TableSegment *pSegment, HandleTable *pTargetTable)
{
CONTRACTL
{
GC_NOTRIGGER;
- THROWS;
+ NOTHROW;
MODE_COOPERATIVE;
}
CONTRACTL_END;
@@ -975,7 +975,7 @@ void SegmentRelocateAsyncPinHandles (TableSegment *pSegment, HandleTable *pTarge
if (uBlock == BLOCK_INVALID)
{
// There is no pinning handles.
- return;
+ return true;
}
for (uBlock = 0; uBlock < pSegment->bEmptyLine; uBlock ++)
{
@@ -1003,12 +1003,21 @@ void SegmentRelocateAsyncPinHandles (TableSegment *pSegment, HandleTable *pTarge
overlapped->m_userObject = NULL;
}
BashMTForPinnedObject(ObjectToOBJECTREF(value));
- overlapped->m_pinSelf = CreateAsyncPinningHandle((HHANDLETABLE)pTargetTable,ObjectToOBJECTREF(value));
+
+ overlapped->m_pinSelf = HndCreateHandle((HHANDLETABLE)pTargetTable, HNDTYPE_ASYNCPINNED, ObjectToOBJECTREF(value));
+ if (!overlapped->m_pinSelf)
+ {
+ // failed to allocate a new handle - callers have to handle this.
+ return false;
+ }
+
*pValue = NULL;
}
pValue ++;
} while (pValue != pLast);
}
+
+ return true;
}
// Mark all non-pending AsyncPinHandle ready for cleanup.
@@ -1067,6 +1076,7 @@ void TableRelocateAsyncPinHandles(HandleTable *pTable, HandleTable *pTargetTable
BOOL fGotException = FALSE;
TableSegment *pSegment = pTable->pSegmentList;
+ bool wasSuccessful = true;
#ifdef _DEBUG
// on debug builds, execute the OOM path 10% of the time.
@@ -1075,21 +1085,18 @@ void TableRelocateAsyncPinHandles(HandleTable *pTable, HandleTable *pTargetTable
#endif
// Step 1: replace pinning handles with ones from default domain
- EX_TRY
+ while (pSegment)
{
- while (pSegment)
+ wasSuccessful = wasSuccessful && SegmentRelocateAsyncPinHandles (pSegment, pTargetTable);
+ if (!wasSuccessful)
{
- SegmentRelocateAsyncPinHandles (pSegment, pTargetTable);
- pSegment = pSegment->pNextSegment;
+ break;
}
+
+ pSegment = pSegment->pNextSegment;
}
- EX_CATCH
- {
- fGotException = TRUE;
- }
- EX_END_CATCH(SwallowAllExceptions);
- if (!fGotException)
+ if (wasSuccessful)
{
return;
}
@@ -2719,9 +2726,8 @@ void TableFreeBulkUnpreparedHandles(HandleTable *pTable, uint32_t uType, const O
{
CONTRACTL
{
- THROWS;
+ NOTHROW;
WRAPPER(GC_TRIGGERS);
- INJECT_FAULT(COMPlusThrowOM());
}
CONTRACTL_END;
diff --git a/src/gc/handletablescan.cpp b/src/gc/handletablescan.cpp
index 86ce62d5b1..967aca5095 100644
--- a/src/gc/handletablescan.cpp
+++ b/src/gc/handletablescan.cpp
@@ -949,7 +949,7 @@ static void VerifyObjectAndAge(_UNCHECKED_OBJECTREF *pValue, _UNCHECKED_OBJECTRE
if (minAge >= GEN_MAX_AGE || (minAge > thisAge && thisAge < static_cast<int>(g_theGCHeap->GetMaxGeneration())))
{
_ASSERTE(!"Fatal Error in HandleTable.");
- EEPOLICY_HANDLE_FATAL_ERROR(COR_E_EXECUTIONENGINE);
+ GCToEEInterface::HandleFatalError(COR_E_EXECUTIONENGINE);
}
}
@@ -1423,7 +1423,7 @@ PTR_TableSegment CALLBACK StandardSegmentIterator(PTR_HandleTable pTable, PTR_Ta
{
CONTRACTL
{
- WRAPPER(THROWS);
+ WRAPPER(NOTHROW);
WRAPPER(GC_TRIGGERS);
FORBID_FAULT;
SUPPORTS_DAC;
diff --git a/src/gc/objecthandle.cpp b/src/gc/objecthandle.cpp
index 5df53baad5..dd43ec23d5 100644
--- a/src/gc/objecthandle.cpp
+++ b/src/gc/objecthandle.cpp
@@ -19,6 +19,8 @@
#include "objecthandle.h"
#include "handletablepriv.h"
+#include "gchandletableimpl.h"
+
#ifdef FEATURE_COMINTEROP
#include "comcallablewrapper.h"
#endif // FEATURE_COMINTEROP
@@ -627,54 +629,62 @@ bool Ref_Initialize()
if (pBuckets == NULL)
return false;
- ZeroMemory(pBuckets,
- INITIAL_HANDLE_TABLE_ARRAY_SIZE * sizeof (HandleTableBucket *));
+ ZeroMemory(pBuckets, INITIAL_HANDLE_TABLE_ARRAY_SIZE * sizeof (HandleTableBucket *));
- // Crate the first bucket
- HandleTableBucket * pBucket = new (nothrow) HandleTableBucket;
- if (pBucket != NULL)
+ g_gcGlobalHandleStore = new (nothrow) GCHandleStore();
+ if (g_gcGlobalHandleStore == NULL)
{
- pBucket->HandleTableIndex = 0;
-
- int n_slots = getNumberOfSlots();
-
- HandleTableBucketHolder bucketHolder(pBucket, n_slots);
+ delete[] pBuckets;
+ return false;
+ }
- // create the handle table set for the first bucket
- pBucket->pTable = new (nothrow) HHANDLETABLE[n_slots];
- if (pBucket->pTable == NULL)
- goto CleanupAndFail;
+ // Initialize the bucket in the global handle store
+ HandleTableBucket* pBucket = &g_gcGlobalHandleStore->_underlyingBucket;
- ZeroMemory(pBucket->pTable,
- n_slots * sizeof(HHANDLETABLE));
- for (int uCPUindex = 0; uCPUindex < n_slots; uCPUindex++)
- {
- pBucket->pTable[uCPUindex] = HndCreateHandleTable(s_rgTypeFlags, _countof(s_rgTypeFlags), ADIndex(1));
- if (pBucket->pTable[uCPUindex] == NULL)
- goto CleanupAndFail;
+ pBucket->HandleTableIndex = 0;
- HndSetHandleTableIndex(pBucket->pTable[uCPUindex], 0);
- }
+ int n_slots = getNumberOfSlots();
- pBuckets[0] = pBucket;
- bucketHolder.SuppressRelease();
+ HandleTableBucketHolder bucketHolder(pBucket, n_slots);
- g_HandleTableMap.pBuckets = pBuckets;
- g_HandleTableMap.dwMaxIndex = INITIAL_HANDLE_TABLE_ARRAY_SIZE;
- g_HandleTableMap.pNext = NULL;
+ // create the handle table set for the first bucket
+ pBucket->pTable = new (nothrow) HHANDLETABLE[n_slots];
+ if (pBucket->pTable == NULL)
+ goto CleanupAndFail;
- // Allocate contexts used during dependent handle promotion scanning. There's one of these for every GC
- // heap since they're scanned in parallel.
- g_pDependentHandleContexts = new (nothrow) DhContext[n_slots];
- if (g_pDependentHandleContexts == NULL)
+ ZeroMemory(pBucket->pTable,
+ n_slots * sizeof(HHANDLETABLE));
+ for (int uCPUindex = 0; uCPUindex < n_slots; uCPUindex++)
+ {
+ pBucket->pTable[uCPUindex] = HndCreateHandleTable(s_rgTypeFlags, _countof(s_rgTypeFlags), ADIndex(1));
+ if (pBucket->pTable[uCPUindex] == NULL)
goto CleanupAndFail;
- return true;
+ HndSetHandleTableIndex(pBucket->pTable[uCPUindex], 0);
}
+ pBuckets[0] = pBucket;
+ bucketHolder.SuppressRelease();
+
+ g_HandleTableMap.pBuckets = pBuckets;
+ g_HandleTableMap.dwMaxIndex = INITIAL_HANDLE_TABLE_ARRAY_SIZE;
+ g_HandleTableMap.pNext = NULL;
+
+ // Allocate contexts used during dependent handle promotion scanning. There's one of these for every GC
+ // heap since they're scanned in parallel.
+ g_pDependentHandleContexts = new (nothrow) DhContext[n_slots];
+ if (g_pDependentHandleContexts == NULL)
+ goto CleanupAndFail;
+
+ return true;
+
CleanupAndFail:
if (pBuckets != NULL)
delete[] pBuckets;
+
+ if (g_gcGlobalHandleStore != NULL)
+ delete g_gcGlobalHandleStore;
+
return false;
}
@@ -694,9 +704,6 @@ void Ref_Shutdown()
// don't destroy any of the indexed handle tables; they should
// be destroyed externally.
- // destroy the global handle table bucket tables
- Ref_DestroyHandleTableBucket(g_HandleTableMap.pBuckets[0]);
-
// destroy the handle table bucket array
HandleTableMap *walk = &g_HandleTableMap;
while (walk) {
@@ -714,26 +721,37 @@ void Ref_Shutdown()
}
#ifndef FEATURE_REDHAWK
-// ATTENTION: interface changed
-// Note: this function called only from AppDomain::Init()
-HandleTableBucket *Ref_CreateHandleTableBucket(ADIndex uADIndex)
+HandleTableBucket* Ref_CreateHandleTableBucket(void* context)
+{
+ HandleTableBucket* result = new (nothrow) HandleTableBucket();
+ if (result == nullptr)
+ return nullptr;
+
+ if (!Ref_InitializeHandleTableBucket(result, context))
+ {
+ delete result;
+ return nullptr;
+ }
+
+ return result;
+}
+
+bool Ref_InitializeHandleTableBucket(HandleTableBucket* bucket, void* context)
{
CONTRACTL
{
- THROWS;
+ NOTHROW;
WRAPPER(GC_TRIGGERS);
- INJECT_FAULT(COMPlusThrowOM());
+ INJECT_FAULT(return false);
}
CONTRACTL_END;
- HandleTableBucket *result = NULL;
- HandleTableMap *walk;
-
- walk = &g_HandleTableMap;
+ HandleTableBucket *result = bucket;
+ HandleTableMap *walk = &g_HandleTableMap;
+
HandleTableMap *last = NULL;
uint32_t offset = 0;
- result = new HandleTableBucket;
result->pTable = NULL;
// create handle table set for the bucket
@@ -741,13 +759,18 @@ HandleTableBucket *Ref_CreateHandleTableBucket(ADIndex uADIndex)
HandleTableBucketHolder bucketHolder(result, n_slots);
- result->pTable = new HHANDLETABLE [ n_slots ];
- ZeroMemory(result->pTable, n_slots * sizeof (HHANDLETABLE));
+ result->pTable = new (nothrow) HHANDLETABLE[n_slots];
+ if (!result->pTable)
+ {
+ return false;
+ }
+
+ ZeroMemory(result->pTable, n_slots * sizeof(HHANDLETABLE));
for (int uCPUindex=0; uCPUindex < n_slots; uCPUindex++) {
- result->pTable[uCPUindex] = HndCreateHandleTable(s_rgTypeFlags, _countof(s_rgTypeFlags), uADIndex);
+ result->pTable[uCPUindex] = HndCreateHandleTable(s_rgTypeFlags, _countof(s_rgTypeFlags), ADIndex((DWORD)(uintptr_t)context));
if (!result->pTable[uCPUindex])
- COMPlusThrowOM();
+ return false;
}
for (;;) {
@@ -762,7 +785,7 @@ HandleTableBucket *Ref_CreateHandleTableBucket(ADIndex uADIndex)
if (Interlocked::CompareExchangePointer(&walk->pBuckets[i], result, NULL) == 0) {
// Get a free slot.
bucketHolder.SuppressRelease();
- return result;
+ return true;
}
}
}
@@ -774,9 +797,18 @@ HandleTableBucket *Ref_CreateHandleTableBucket(ADIndex uADIndex)
// No free slot.
// Let's create a new node
NewHolder<HandleTableMap> newMap;
- newMap = new HandleTableMap;
+ newMap = new (nothrow) HandleTableMap;
+ if (!newMap)
+ {
+ return false;
+ }
+
+ newMap->pBuckets = new (nothrow) HandleTableBucket * [ INITIAL_HANDLE_TABLE_ARRAY_SIZE ];
+ if (!newMap->pBuckets)
+ {
+ return false;
+ }
- newMap->pBuckets = new HandleTableBucket * [ INITIAL_HANDLE_TABLE_ARRAY_SIZE ];
newMap.SuppressRelease();
newMap->dwMaxIndex = last->dwMaxIndex + INITIAL_HANDLE_TABLE_ARRAY_SIZE;
diff --git a/src/gc/objecthandle.h b/src/gc/objecthandle.h
index d3e45f8659..b3e4b58a1c 100644
--- a/src/gc/objecthandle.h
+++ b/src/gc/objecthandle.h
@@ -21,16 +21,6 @@
#include <weakreference.h>
#endif // FEATURE_COMINTEROP
-/*
- * Convenience macros for accessing handles. StoreFirstObjectInHandle is like
- * StoreObjectInHandle, except it only succeeds if transitioning from NULL to
- * non-NULL. In other words, if this handle is being initialized for the first
- * time.
- */
-#define StoreObjectInHandle(handle, object) HndAssignHandle(handle, object)
-#define InterlockedCompareExchangeObjectInHandle(handle, object, oldObj) HndInterlockedCompareExchangeHandle(handle, object, oldObj)
-#define StoreFirstObjectInHandle(handle, object) HndFirstAssignHandle(handle, object)
-
typedef DPTR(struct HandleTableMap) PTR_HandleTableMap;
typedef DPTR(struct HandleTableBucket) PTR_HandleTableBucket;
typedef DPTR(PTR_HandleTableBucket) PTR_PTR_HandleTableBucket;
@@ -90,23 +80,13 @@ void GCHandleValidatePinnedObject(OBJECTREF obj);
int GetCurrentThreadHomeHeapNumber();
-inline void ResetOBJECTHANDLE(OBJECTHANDLE handle)
-{
- WRAPPER_NO_CONTRACT;
-
- StoreObjectInHandle(handle, NULL);
-}
-
-#ifndef FEATURE_REDHAWK
-typedef Holder<OBJECTHANDLE,DoNothing<OBJECTHANDLE>,ResetOBJECTHANDLE> ObjectInHandleHolder;
-#endif
-
/*
* Table maintenance routines
*/
bool Ref_Initialize();
void Ref_Shutdown();
-HandleTableBucket *Ref_CreateHandleTableBucket(ADIndex uADIndex);
+HandleTableBucket* Ref_CreateHandleTableBucket(void* context);
+bool Ref_InitializeHandleTableBucket(HandleTableBucket* bucket, void* context);
BOOL Ref_HandleAsyncPinHandles();
void Ref_RelocateAsyncPinHandles(HandleTableBucket *pSource, HandleTableBucket *pTarget);
void Ref_RemoveHandleTableBucket(HandleTableBucket *pBucket);
diff --git a/src/gc/sample/GCSample.cpp b/src/gc/sample/GCSample.cpp
index 2914ee1665..0a771b7e91 100644
--- a/src/gc/sample/GCSample.cpp
+++ b/src/gc/sample/GCSample.cpp
@@ -130,8 +130,8 @@ int __cdecl main(int argc, char* argv[])
//
GcDacVars dacVars;
IGCHeap *pGCHeap;
- IGCHandleTable *pGCHandleTable;
- if (!InitializeGarbageCollector(nullptr, &pGCHeap, &pGCHandleTable, &dacVars))
+ IGCHandleManager *pGCHandleManager;
+ if (!InitializeGarbageCollector(nullptr, &pGCHeap, &pGCHandleManager, &dacVars))
{
return -1;
}
@@ -140,9 +140,9 @@ int __cdecl main(int argc, char* argv[])
return -1;
//
- // Initialize handle table
+ // Initialize handle manager
//
- if (!pGCHandleTable->Initialize())
+ if (!pGCHandleManager->Initialize())
return -1;
//
diff --git a/src/gc/unix/CMakeLists.txt b/src/gc/unix/CMakeLists.txt
index 3e1aa5ad19..10258108c6 100644
--- a/src/gc/unix/CMakeLists.txt
+++ b/src/gc/unix/CMakeLists.txt
@@ -6,6 +6,7 @@ include(configure.cmake)
set(GC_PAL_SOURCES
gcenv.unix.cpp
+ events.cpp
cgroup.cpp)
add_library(gc_unix STATIC ${GC_PAL_SOURCES} ${VERSION_FILE_PATH})
diff --git a/src/gc/unix/config.h.in b/src/gc/unix/config.h.in
index 7578c74c05..21980a7d08 100644
--- a/src/gc/unix/config.h.in
+++ b/src/gc/unix/config.h.in
@@ -10,5 +10,7 @@
#cmakedefine01 HAVE_PTHREAD_THREADID_NP
#cmakedefine01 HAVE_PTHREAD_GETTHREADID_NP
#cmakedefine01 HAVE_SCHED_GETCPU
+#cmakedefine01 HAVE_PTHREAD_CONDATTR_SETCLOCK
+#cmakedefine01 HAVE_MACH_ABSOLUTE_TIME
-#endif // __CONFIG_H__ \ No newline at end of file
+#endif // __CONFIG_H__
diff --git a/src/gc/unix/configure.cmake b/src/gc/unix/configure.cmake
index 6e1e8fe27d..5f2bdbd8b3 100644
--- a/src/gc/unix/configure.cmake
+++ b/src/gc/unix/configure.cmake
@@ -37,4 +37,19 @@ check_cxx_source_runs("
}
" HAVE_SCHED_GETCPU)
-configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h) \ No newline at end of file
+check_library_exists(pthread pthread_condattr_setclock "" HAVE_PTHREAD_CONDATTR_SETCLOCK)
+
+check_cxx_source_runs("
+ #include <stdlib.h>
+ #include <mach/mach_time.h>
+ int main()
+ {
+ int ret;
+ mach_timebase_info_data_t timebaseInfo;
+ ret = mach_timebase_info(&timebaseInfo);
+ mach_absolute_time();
+ exit(ret);
+ }
+ " HAVE_MACH_ABSOLUTE_TIME)
+
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
diff --git a/src/gc/unix/events.cpp b/src/gc/unix/events.cpp
new file mode 100644
index 0000000000..7c665f4aaa
--- /dev/null
+++ b/src/gc/unix/events.cpp
@@ -0,0 +1,323 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+#include <cstdint>
+#include <cstddef>
+#include <cassert>
+#include <memory>
+#include <mutex>
+#include <pthread.h>
+#include <errno.h>
+#include "config.h"
+
+#ifndef __out_z
+#define __out_z
+#endif // __out_z
+
+#include "gcenv.structs.h"
+#include "gcenv.base.h"
+#include "gcenv.os.h"
+#include "globals.h"
+
+#if HAVE_MACH_ABSOLUTE_TIME
+mach_timebase_info_data_t g_TimebaseInfo;
+#endif // MACH_ABSOLUTE_TIME
+
+namespace
+{
+
+#if HAVE_PTHREAD_CONDATTR_SETCLOCK
+void TimeSpecAdd(timespec* time, uint32_t milliseconds)
+{
+ uint64_t nsec = time->tv_nsec + (uint64_t)milliseconds * tccMilliSecondsToNanoSeconds;
+ if (nsec >= tccSecondsToNanoSeconds)
+ {
+ time->tv_sec += nsec / tccSecondsToNanoSeconds;
+ nsec %= tccSecondsToNanoSeconds;
+ }
+
+ time->tv_nsec = nsec;
+}
+#endif // HAVE_PTHREAD_CONDATTR_SETCLOCK
+
+#if HAVE_MACH_ABSOLUTE_TIME
+// Convert nanoseconds to the timespec structure
+// Parameters:
+// nanoseconds - time in nanoseconds to convert
+// t - the target timespec structure
+void NanosecondsToTimeSpec(uint64_t nanoseconds, timespec* t)
+{
+ t->tv_sec = nanoseconds / tccSecondsToNanoSeconds;
+ t->tv_nsec = nanoseconds % tccSecondsToNanoSeconds;
+}
+#endif // HAVE_PTHREAD_CONDATTR_SETCLOCK
+
+} // anonymous namespace
+
+class GCEvent::Impl
+{
+ pthread_cond_t m_condition;
+ pthread_mutex_t m_mutex;
+ bool m_manualReset;
+ bool m_state;
+ bool m_isValid;
+
+public:
+
+ Impl(bool manualReset, bool initialState)
+ : m_manualReset(manualReset),
+ m_state(initialState),
+ m_isValid(false)
+ {
+ }
+
+ bool Initialize()
+ {
+ pthread_condattr_t attrs;
+ int st = pthread_condattr_init(&attrs);
+ if (st != 0)
+ {
+ assert(!"Failed to initialize UnixEvent condition attribute");
+ return false;
+ }
+
+ // TODO(segilles) implement this for CoreCLR
+ //PthreadCondAttrHolder attrsHolder(&attrs);
+
+#if HAVE_PTHREAD_CONDATTR_SETCLOCK && !HAVE_MACH_ABSOLUTE_TIME
+ // Ensure that the pthread_cond_timedwait will use CLOCK_MONOTONIC
+ st = pthread_condattr_setclock(&attrs, CLOCK_MONOTONIC);
+ if (st != 0)
+ {
+ assert(!"Failed to set UnixEvent condition variable wait clock");
+ return false;
+ }
+#endif // HAVE_PTHREAD_CONDATTR_SETCLOCK && !HAVE_MACH_ABSOLUTE_TIME
+
+ st = pthread_mutex_init(&m_mutex, NULL);
+ if (st != 0)
+ {
+ assert(!"Failed to initialize UnixEvent mutex");
+ return false;
+ }
+
+ st = pthread_cond_init(&m_condition, &attrs);
+ if (st != 0)
+ {
+ assert(!"Failed to initialize UnixEvent condition variable");
+
+ st = pthread_mutex_destroy(&m_mutex);
+ assert(st == 0 && "Failed to destroy UnixEvent mutex");
+ return false;
+ }
+
+ m_isValid = true;
+
+ return true;
+ }
+
+ void CloseEvent()
+ {
+ if (m_isValid)
+ {
+ int st = pthread_mutex_destroy(&m_mutex);
+ assert(st == 0 && "Failed to destroy UnixEvent mutex");
+
+ st = pthread_cond_destroy(&m_condition);
+ assert(st == 0 && "Failed to destroy UnixEvent condition variable");
+ }
+ }
+
+ uint32_t Wait(uint32_t milliseconds, bool alertable)
+ {
+ UNREFERENCED_PARAMETER(alertable);
+
+ timespec endTime;
+#if HAVE_MACH_ABSOLUTE_TIME
+ uint64_t endMachTime;
+ if (milliseconds != INFINITE)
+ {
+ uint64_t nanoseconds = (uint64_t)milliseconds * tccMilliSecondsToNanoSeconds;
+ NanosecondsToTimeSpec(nanoseconds, &endTime);
+ endMachTime = mach_absolute_time() + nanoseconds * g_TimebaseInfo.denom / g_TimebaseInfo.numer;
+ }
+#elif HAVE_PTHREAD_CONDATTR_SETCLOCK
+ if (milliseconds != INFINITE)
+ {
+ clock_gettime(CLOCK_MONOTONIC, &endTime);
+ TimeSpecAdd(&endTime, milliseconds);
+ }
+#else
+#error Don't know how to perfom timed wait on this platform
+#endif
+
+ int st = 0;
+
+ pthread_mutex_lock(&m_mutex);
+ while (!m_state)
+ {
+ if (milliseconds == INFINITE)
+ {
+ st = pthread_cond_wait(&m_condition, &m_mutex);
+ }
+ else
+ {
+#if HAVE_MACH_ABSOLUTE_TIME
+ // Since OSX doesn't support CLOCK_MONOTONIC, we use relative variant of the
+ // timed wait and we need to handle spurious wakeups properly.
+ st = pthread_cond_timedwait_relative_np(&m_condition, &m_mutex, &endTime);
+ if ((st == 0) && !m_state)
+ {
+ uint64_t machTime = mach_absolute_time();
+ if (machTime < endMachTime)
+ {
+ // The wake up was spurious, recalculate the relative endTime
+ uint64_t remainingNanoseconds = (endMachTime - machTime) * g_TimebaseInfo.numer / g_TimebaseInfo.denom;
+ NanosecondsToTimeSpec(remainingNanoseconds, &endTime);
+ }
+ else
+ {
+ // Although the timed wait didn't report a timeout, time calculated from the
+ // mach time shows we have already reached the end time. It can happen if
+ // the wait was spuriously woken up right before the timeout.
+ st = ETIMEDOUT;
+ }
+ }
+#else // HAVE_MACH_ABSOLUTE_TIME
+ st = pthread_cond_timedwait(&m_condition, &m_mutex, &endTime);
+#endif // HAVE_MACH_ABSOLUTE_TIME
+ // Verify that if the wait timed out, the event was not set
+ assert((st != ETIMEDOUT) || !m_state);
+ }
+
+ if (st != 0)
+ {
+ // wait failed or timed out
+ break;
+ }
+ }
+
+ if ((st == 0) && !m_manualReset)
+ {
+ // Clear the state for auto-reset events so that only one waiter gets released
+ m_state = false;
+ }
+
+ pthread_mutex_unlock(&m_mutex);
+
+ uint32_t waitStatus;
+
+ if (st == 0)
+ {
+ waitStatus = WAIT_OBJECT_0;
+ }
+ else if (st == ETIMEDOUT)
+ {
+ waitStatus = WAIT_TIMEOUT;
+ }
+ else
+ {
+ waitStatus = WAIT_FAILED;
+ }
+
+ return waitStatus;
+ }
+
+ void Set()
+ {
+ pthread_mutex_lock(&m_mutex);
+ m_state = true;
+ pthread_mutex_unlock(&m_mutex);
+
+ // Unblock all threads waiting for the condition variable
+ pthread_cond_broadcast(&m_condition);
+ }
+
+ void Reset()
+ {
+ pthread_mutex_lock(&m_mutex);
+ m_state = false;
+ pthread_mutex_unlock(&m_mutex);
+ }
+};
+
+GCEvent::GCEvent()
+ : m_impl(nullptr)
+{
+}
+
+void GCEvent::CloseEvent()
+{
+ assert(m_impl != nullptr);
+ m_impl->CloseEvent();
+}
+
+void GCEvent::Set()
+{
+ assert(m_impl != nullptr);
+ m_impl->Set();
+}
+
+void GCEvent::Reset()
+{
+ assert(m_impl != nullptr);
+ m_impl->Reset();
+}
+
+uint32_t GCEvent::Wait(uint32_t timeout, bool alertable)
+{
+ assert(m_impl != nullptr);
+ return m_impl->Wait(timeout, alertable);
+}
+
+bool GCEvent::CreateAutoEventNoThrow(bool initialState)
+{
+ // This implementation of GCEvent makes no distinction between
+ // host-aware and non-host-aware events (since there will be no host).
+ return CreateOSAutoEventNoThrow(initialState);
+}
+
+bool GCEvent::CreateManualEventNoThrow(bool initialState)
+{
+ // This implementation of GCEvent makes no distinction between
+ // host-aware and non-host-aware events (since there will be no host).
+ return CreateOSManualEventNoThrow(initialState);
+}
+
+bool GCEvent::CreateOSAutoEventNoThrow(bool initialState)
+{
+ assert(m_impl == nullptr);
+ std::unique_ptr<GCEvent::Impl> event(new (std::nothrow) GCEvent::Impl(false, initialState));
+ if (!event)
+ {
+ return false;
+ }
+
+ if (!event->Initialize())
+ {
+ return false;
+ }
+
+ m_impl = event.release();
+ return true;
+}
+
+bool GCEvent::CreateOSManualEventNoThrow(bool initialState)
+{
+ assert(m_impl == nullptr);
+ std::unique_ptr<GCEvent::Impl> event(new (std::nothrow) GCEvent::Impl(true, initialState));
+ if (!event)
+ {
+ return false;
+ }
+
+ if (!event->Initialize())
+ {
+ return false;
+ }
+
+ m_impl = event.release();
+ return true;
+}
+
diff --git a/src/gc/unix/gcenv.unix.cpp b/src/gc/unix/gcenv.unix.cpp
index 45489c69a7..5fc63f47d3 100644
--- a/src/gc/unix/gcenv.unix.cpp
+++ b/src/gc/unix/gcenv.unix.cpp
@@ -36,13 +36,13 @@ static_assert(sizeof(uint64_t) == 8, "unsigned long isn't 8 bytes");
#error "A GC-private implementation of GCToOSInterface should only be used with FEATURE_STANDALONE_GC"
#endif // FEATURE_STANDALONE_GC
-#ifdef HAVE_SYS_TIME_H
+#if HAVE_SYS_TIME_H
#include <sys/time.h>
#else
#error "sys/time.h required by GC PAL for the time being"
#endif // HAVE_SYS_TIME_
-#ifdef HAVE_SYS_MMAN_H
+#if HAVE_SYS_MMAN_H
#include <sys/mman.h>
#else
#error "sys/mman.h required by GC PAL"
@@ -56,18 +56,7 @@ static_assert(sizeof(uint64_t) == 8, "unsigned long isn't 8 bytes");
#include <sched.h> // sched_yield
#include <errno.h>
#include <unistd.h> // sysconf
-
-// The number of milliseconds in a second.
-static const int tccSecondsToMilliSeconds = 1000;
-
-// The number of microseconds in a second.
-static const int tccSecondsToMicroSeconds = 1000000;
-
-// The number of microseconds in a millisecond.
-static const int tccMilliSecondsToMicroSeconds = 1000;
-
-// The number of nanoseconds in a millisecond.
-static const int tccMilliSecondsToNanoSeconds = 1000000;
+#include "globals.h"
// The cachced number of logical CPUs observed.
static uint32_t g_logicalCpuCount = 0;
@@ -117,6 +106,14 @@ bool GCToOSInterface::Initialize()
return false;
}
+#if HAVE_MACH_ABSOLUTE_TIME
+ kern_return_t machRet;
+ if ((machRet = mach_timebase_info(&g_TimebaseInfo)) != KERN_SUCCESS)
+ {
+ return false;
+ }
+#endif // HAVE_MACH_ABSOLUTE_TIME
+
return true;
}
@@ -348,8 +345,20 @@ bool GCToOSInterface::VirtualDecommit(void* address, size_t size)
// true if it has succeeded, false if it has failed
bool GCToOSInterface::VirtualReset(void * address, size_t size, bool unlock)
{
- // TODO(CoreCLR#1259) pipe to madvise?
- return false;
+ int st;
+#if HAVE_MADV_FREE
+ // Try to use MADV_FREE if supported. It tells the kernel that the application doesn't
+ // need the pages in the range. Freeing the pages can be delayed until a memory pressure
+ // occurs.
+ st = madvise(address, size, MADV_FREE);
+ if (st != 0)
+#endif
+ {
+ // In case the MADV_FREE is not supported, use MADV_DONTNEED
+ st = madvise(address, size, MADV_DONTNEED);
+ }
+
+ return (st == 0);
}
// Check if the OS supports write watching
diff --git a/src/gc/unix/globals.h b/src/gc/unix/globals.h
new file mode 100644
index 0000000000..bc3dc49918
--- /dev/null
+++ b/src/gc/unix/globals.h
@@ -0,0 +1,30 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+#ifndef __GLOBALS_H__
+#define __GLOBALS_H__
+
+#if HAVE_MACH_ABSOLUTE_TIME
+#include <mach/mach_time.h>
+#endif // HAVE_MACH_ABSOLUTE_TIME
+
+const int tccSecondsToMilliSeconds = 1000;
+
+// The number of microseconds in a second.
+const int tccSecondsToMicroSeconds = 1000000;
+
+// The number of nanoseconds in a second.
+const int tccSecondsToNanoSeconds = 1000000000;
+
+// The number of microseconds in a millisecond.
+const int tccMilliSecondsToMicroSeconds = 1000;
+
+// The number of nanoseconds in a millisecond.
+const int tccMilliSecondsToNanoSeconds = 1000000;
+
+#if HAVE_MACH_ABSOLUTE_TIME
+extern mach_timebase_info_data_t g_TimebaseInfo;
+#endif // HAVE_MACH_ABSOLUTE_TIME
+
+#endif // __GLOBALS_H__
diff --git a/src/gc/windows/gcenv.windows.cpp b/src/gc/windows/gcenv.windows.cpp
index 30232bfb09..3749f06a68 100644
--- a/src/gc/windows/gcenv.windows.cpp
+++ b/src/gc/windows/gcenv.windows.cpp
@@ -626,3 +626,145 @@ void CLRCriticalSection::Leave()
{
::LeaveCriticalSection(&m_cs);
}
+
+// WindowsEvent is an implementation of GCEvent that forwards
+// directly to Win32 APIs.
+class GCEvent::Impl
+{
+private:
+ HANDLE m_hEvent;
+
+public:
+ Impl() : m_hEvent(INVALID_HANDLE_VALUE) {}
+
+ bool IsValid() const
+ {
+ return m_hEvent != INVALID_HANDLE_VALUE;
+ }
+
+ void Set()
+ {
+ assert(IsValid());
+ BOOL result = SetEvent(m_hEvent);
+ assert(result && "SetEvent failed");
+ }
+
+ void Reset()
+ {
+ assert(IsValid());
+ BOOL result = ResetEvent(m_hEvent);
+ assert(result && "ResetEvent failed");
+ }
+
+ uint32_t Wait(uint32_t timeout, bool alertable)
+ {
+ UNREFERENCED_PARAMETER(alertable);
+ assert(IsValid());
+
+ return WaitForSingleObject(m_hEvent, timeout);
+ }
+
+ void CloseEvent()
+ {
+ assert(IsValid());
+ BOOL result = CloseHandle(m_hEvent);
+ assert(result && "CloseHandle failed");
+ m_hEvent = INVALID_HANDLE_VALUE;
+ }
+
+ bool CreateAutoEvent(bool initialState)
+ {
+ m_hEvent = CreateEvent(nullptr, false, initialState, nullptr);
+ return IsValid();
+ }
+
+ bool CreateManualEvent(bool initialState)
+ {
+ m_hEvent = CreateEvent(nullptr, true, initialState, nullptr);
+ return IsValid();
+ }
+};
+
+GCEvent::GCEvent()
+ : m_impl(nullptr)
+{
+}
+
+void GCEvent::CloseEvent()
+{
+ assert(m_impl != nullptr);
+ m_impl->CloseEvent();
+}
+
+void GCEvent::Set()
+{
+ assert(m_impl != nullptr);
+ m_impl->Set();
+}
+
+void GCEvent::Reset()
+{
+ assert(m_impl != nullptr);
+ m_impl->Reset();
+}
+
+uint32_t GCEvent::Wait(uint32_t timeout, bool alertable)
+{
+ assert(m_impl != nullptr);
+ return m_impl->Wait(timeout, alertable);
+}
+
+bool GCEvent::CreateAutoEventNoThrow(bool initialState)
+{
+ // [DESKTOP TODO] The difference between events and OS events is
+ // whether or not the hosting API is made aware of them. When (if)
+ // we implement hosting support for Local GC, we will need to be
+ // aware of the host here.
+ return CreateOSAutoEventNoThrow(initialState);
+}
+
+bool GCEvent::CreateManualEventNoThrow(bool initialState)
+{
+ // [DESKTOP TODO] The difference between events and OS events is
+ // whether or not the hosting API is made aware of them. When (if)
+ // we implement hosting support for Local GC, we will need to be
+ // aware of the host here.
+ return CreateOSManualEventNoThrow(initialState);
+}
+
+bool GCEvent::CreateOSAutoEventNoThrow(bool initialState)
+{
+ assert(m_impl == nullptr);
+ std::unique_ptr<GCEvent::Impl> event(new (std::nothrow) GCEvent::Impl());
+ if (!event)
+ {
+ return false;
+ }
+
+ if (!event->CreateAutoEvent(initialState))
+ {
+ return false;
+ }
+
+ m_impl = event.release();
+ return true;
+}
+
+bool GCEvent::CreateOSManualEventNoThrow(bool initialState)
+{
+ assert(m_impl == nullptr);
+ std::unique_ptr<GCEvent::Impl> event(new (std::nothrow) GCEvent::Impl());
+ if (!event)
+ {
+ return false;
+ }
+
+ if (!event->CreateManualEvent(initialState))
+ {
+ return false;
+ }
+
+ m_impl = event.release();
+ return true;
+}
+
diff --git a/src/gcinfo/CMakeLists.txt b/src/gcinfo/CMakeLists.txt
index e4730c69b3..ab7e48dcfd 100644
--- a/src/gcinfo/CMakeLists.txt
+++ b/src/gcinfo/CMakeLists.txt
@@ -23,5 +23,15 @@ endif(CLR_CMAKE_PLATFORM_UNIX)
add_subdirectory(lib)
add_subdirectory(crossgen)
+if (CLR_CMAKE_PLATFORM_ARCH_I386)
+ # On x86, build RyuJIT/ARM32 cross-compiling altjit.
+ add_subdirectory(gcinfo_arm)
+endif ()
+
+if (CLR_CMAKE_PLATFORM_ARCH_AMD64)
+ # On amd64, build RyuJIT/ARM64 cross-compiling altjit.
+ add_subdirectory(gcinfo_arm64)
+endif ()
+
_install (FILES gcinfoencoder.cpp
DESTINATION gcinfo)
diff --git a/src/gcinfo/gcinfo_arm/CMakeLists.txt b/src/gcinfo/gcinfo_arm/CMakeLists.txt
new file mode 100644
index 0000000000..3617c97f3f
--- /dev/null
+++ b/src/gcinfo/gcinfo_arm/CMakeLists.txt
@@ -0,0 +1,7 @@
+remove_definitions(-D_TARGET_X86_=1)
+add_definitions(-D_TARGET_ARM_)
+
+add_library_clr(gcinfo_arm
+ STATIC
+ ${GCINFO_SOURCES}
+)
diff --git a/src/gcinfo/gcinfo_arm64/CMakeLists.txt b/src/gcinfo/gcinfo_arm64/CMakeLists.txt
new file mode 100644
index 0000000000..116ed7c1d6
--- /dev/null
+++ b/src/gcinfo/gcinfo_arm64/CMakeLists.txt
@@ -0,0 +1,7 @@
+remove_definitions(-D_TARGET_AMD64_=1)
+add_definitions(-D_TARGET_ARM64_)
+
+add_library_clr(gcinfo_arm64
+ STATIC
+ ${GCINFO_SOURCES}
+)
diff --git a/src/ilasm/asmman.cpp b/src/ilasm/asmman.cpp
index 0f0d1cff71..22e780f554 100644
--- a/src/ilasm/asmman.cpp
+++ b/src/ilasm/asmman.cpp
@@ -297,9 +297,10 @@ void AsmMan::EmitDebuggableAttribute(mdToken tkOwner)
else
{
AsmManAssembly *pAssembly = GetAsmRefByName("mscorlib");
- _ASSERTE(pAssembly != NULL);
- PREFIX_ASSUME(pAssembly != NULL);
- fOldStyle = (pAssembly->usVerMajor == 1);
+ if(pAssembly != NULL)
+ {
+ fOldStyle = (pAssembly->usVerMajor == 1);
+ }
}
bsBytes->appendInt8(1);
diff --git a/src/inc/MSCOREE.IDL b/src/inc/MSCOREE.IDL
index 97e2f2aca6..53d4ce3bb0 100644
--- a/src/inc/MSCOREE.IDL
+++ b/src/inc/MSCOREE.IDL
@@ -86,6 +86,9 @@ cpp_quote("EXTERN_GUID(IID_ICLRRuntimeHost, 0x90F1A06C, 0x7712, 0x4762, 0x86, 0x
// IID ICLRRuntimeHost2: uuid(712AB73F-2C22-4807-AD7E-F501D7B72C2D)
cpp_quote("EXTERN_GUID(IID_ICLRRuntimeHost2, 0x712AB73F, 0x2C22, 0x4807, 0xAD, 0x7E, 0xF5, 0x01, 0xD7, 0xb7, 0x2C, 0x2D);")
+// IID ICLRRuntimeHost4: uuid(64F6D366-D7C2-4F1F-B4B2-E8160CAC43AF)
+cpp_quote("EXTERN_GUID(IID_ICLRRuntimeHost4, 0x64F6D366, 0xD7C2, 0x4F1F, 0xB4, 0xB2, 0xE8, 0x16, 0x0C, 0xAC, 0x43, 0xAF);")
+
// IID IID_ICLRExecutionManager: uuid(1000A3E7-B420-4620-AE30-FB19B587AD1D)
cpp_quote("EXTERN_GUID(IID_ICLRExecutionManager, 0x1000A3E7, 0xB420, 0x4620, 0xAE, 0x30, 0xFB, 0x19, 0xB5, 0x87, 0xAD, 0x1D);")
@@ -848,6 +851,21 @@ interface ICLRRuntimeHost2 : ICLRRuntimeHost
};
[
+ object,
+ uuid(64F6D366-D7C2-4F1F-B4B2-E8160CAC43AF),
+ version(4.0),
+ helpstring("Common Language Runtime Hosting Interface"),
+ pointer_default(unique),
+ local
+]
+interface ICLRRuntimeHost4 : ICLRRuntimeHost2
+{
+ HRESULT UnloadAppDomain2([in] DWORD dwAppDomainId,
+ [in] BOOL fWaitUntilDone,
+ [out] int *pLatchedExitCode);
+};
+
+[
uuid(1000A3E7-B420-4620-AE30-FB19B587AD1D),
version(1.0),
helpstring("Pause and Resume Interface"),
diff --git a/src/inc/arrayholder.h b/src/inc/arrayholder.h
new file mode 100644
index 0000000000..681014fc95
--- /dev/null
+++ b/src/inc/arrayholder.h
@@ -0,0 +1,80 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+template <class T>
+class ArrayHolder
+{
+public:
+ ArrayHolder(T *ptr)
+ : m_ptr(ptr)
+ {
+ }
+
+ ~ArrayHolder()
+ {
+ Clear();
+ }
+
+ ArrayHolder(const ArrayHolder &rhs)
+ {
+ m_ptr = const_cast<ArrayHolder *>(&rhs)->Detach();
+ }
+
+ ArrayHolder &operator=(T *ptr)
+ {
+ Clear();
+ m_ptr = ptr;
+ return *this;
+ }
+
+ const T &operator[](int i) const
+ {
+ return m_ptr[i];
+ }
+
+ T &operator[](int i)
+ {
+ return m_ptr[i];
+ }
+
+ operator const T *() const
+ {
+ return m_ptr;
+ }
+
+ operator T *()
+ {
+ return m_ptr;
+ }
+
+ T **operator&()
+ {
+ return &m_ptr;
+ }
+
+ T *GetPtr()
+ {
+ return m_ptr;
+ }
+
+ T *Detach()
+ {
+ T *ret = m_ptr;
+ m_ptr = NULL;
+ return ret;
+ }
+
+private:
+ void Clear()
+ {
+ if (m_ptr)
+ {
+ delete [] m_ptr;
+ m_ptr = NULL;
+ }
+ }
+
+private:
+ T *m_ptr;
+};
diff --git a/src/inc/corhost.h b/src/inc/corhost.h
index 3aabe9ed5d..59ab23cd27 100644
--- a/src/inc/corhost.h
+++ b/src/inc/corhost.h
@@ -137,6 +137,7 @@ protected:
STDMETHODIMP UnloadAppDomain(DWORD dwDomainId, BOOL fWaitUntilDone);
+ STDMETHODIMP UnloadAppDomain2(DWORD dwDomainId, BOOL fWaitUntilDone, int *pLatchedExitCode);
public:
static ULONG GetHostVersion()
{
@@ -275,7 +276,7 @@ class CorHost2 :
#ifndef FEATURE_PAL
, public IPrivateManagedExceptionReporting /* This interface is for internal Watson testing only*/
#endif // FEATURE_PAL
- , public ICLRRuntimeHost2
+ , public ICLRRuntimeHost4
, public CorExecutionManager
{
friend struct _DacGlobals;
@@ -337,6 +338,8 @@ public:
STDMETHODIMP UnloadAppDomain(DWORD dwDomainId, BOOL fWaitUntilDone);
+ STDMETHODIMP UnloadAppDomain2(DWORD dwDomainId, BOOL fWaitUntilDone, int *pLatchedExitCode);
+
STDMETHODIMP GetCurrentAppDomainId(DWORD *pdwAppDomainId);
STDMETHODIMP ExecuteApplication(LPCWSTR pwzAppFullName,
diff --git a/src/inc/corinfo.h b/src/inc/corinfo.h
index cbc4464e1d..97f395800e 100644
--- a/src/inc/corinfo.h
+++ b/src/inc/corinfo.h
@@ -213,7 +213,6 @@ TODO: Talk about initializing strutures before use
#define SELECTANY extern __declspec(selectany)
#endif
-// Update this one
SELECTANY const GUID JITEEVersionIdentifier = { /* f00b3f49-ddd2-49be-ba43-6e49ffa66959 */
0xf00b3f49,
0xddd2,
@@ -959,6 +958,8 @@ enum CorInfoIntrinsics
CORINFO_INTRINSIC_GetManagedThreadId,
CORINFO_INTRINSIC_ByReference_Ctor,
CORINFO_INTRINSIC_ByReference_Value,
+ CORINFO_INTRINSIC_Span_GetItem,
+ CORINFO_INTRINSIC_ReadOnlySpan_GetItem,
CORINFO_INTRINSIC_Count,
CORINFO_INTRINSIC_Illegal = -1, // Not a true intrinsic,
diff --git a/src/inc/releaseholder.h b/src/inc/releaseholder.h
new file mode 100644
index 0000000000..b2c42e3928
--- /dev/null
+++ b/src/inc/releaseholder.h
@@ -0,0 +1,77 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+// This class acts a smart pointer which calls the Release method on any object
+// you place in it when the ReleaseHolder class falls out of scope. You may use it
+// just like you would a standard pointer to a COM object (including if (foo),
+// if (!foo), if (foo == 0), etc) except for two caveats:
+// 1. This class never calls AddRef and it always calls Release when it
+// goes out of scope.
+// 2. You should never use & to try to get a pointer to a pointer unless
+// you call Release first, or you will leak whatever this object contains
+// prior to updating its internal pointer.
+template<class T>
+class ReleaseHolder
+{
+public:
+ ReleaseHolder()
+ : m_ptr(NULL)
+ {}
+
+ ReleaseHolder(T* ptr)
+ : m_ptr(ptr)
+ {}
+
+ ~ReleaseHolder()
+ {
+ Release();
+ }
+
+ void operator=(T *ptr)
+ {
+ Release();
+
+ m_ptr = ptr;
+ }
+
+ T* operator->()
+ {
+ return m_ptr;
+ }
+
+ operator T*()
+ {
+ return m_ptr;
+ }
+
+ T** operator&()
+ {
+ return &m_ptr;
+ }
+
+ T* GetPtr() const
+ {
+ return m_ptr;
+ }
+
+ T* Detach()
+ {
+ T* pT = m_ptr;
+ m_ptr = NULL;
+ return pT;
+ }
+
+ void Release()
+ {
+ if (m_ptr != NULL)
+ {
+ m_ptr->Release();
+ m_ptr = NULL;
+ }
+ }
+
+private:
+ T* m_ptr;
+};
+
diff --git a/src/inc/utilcode.h b/src/inc/utilcode.h
index 5394f1beb2..78dbf69226 100644
--- a/src/inc/utilcode.h
+++ b/src/inc/utilcode.h
@@ -1380,7 +1380,7 @@ public:
static BOOL CanEnableGCNumaAware();
static void InitNumaNodeInfo();
-#if !defined(FEATURE_REDHAWK)&& !defined(FEATURE_PAL)
+#if !defined(FEATURE_REDHAWK)
private: // apis types
//GetNumaHighestNodeNumber()
@@ -1448,7 +1448,7 @@ public:
static DWORD CalculateCurrentProcessorNumber();
//static void PopulateCPUUsageArray(void * infoBuffer, ULONG infoSize);
-#if !defined(FEATURE_REDHAWK) && !defined(FEATURE_PAL)
+#if !defined(FEATURE_REDHAWK)
private:
//GetLogicalProcessorInforomationEx()
typedef BOOL
@@ -5109,9 +5109,9 @@ BOOL IsIPInModule(HMODULE_TGT hModule, PCODE ip);
//----------------------------------------------------------------------------------------
struct CoreClrCallbacks
{
- typedef IExecutionEngine* (__stdcall * pfnIEE_t)();
- typedef HRESULT (__stdcall * pfnGetCORSystemDirectory_t)(SString& pbuffer);
- typedef void* (__stdcall * pfnGetCLRFunction_t)(LPCSTR functionName);
+ typedef IExecutionEngine* (* pfnIEE_t)();
+ typedef HRESULT (* pfnGetCORSystemDirectory_t)(SString& pbuffer);
+ typedef void* (* pfnGetCLRFunction_t)(LPCSTR functionName);
HINSTANCE m_hmodCoreCLR;
pfnIEE_t m_pfnIEE;
@@ -5516,6 +5516,6 @@ extern SpinConstants g_SpinConstants;
// ======================================================================================
-void* __stdcall GetCLRFunction(LPCSTR FunctionName);
+void* GetCLRFunction(LPCSTR FunctionName);
#endif // __UtilCode_h__
diff --git a/src/jit/block.cpp b/src/jit/block.cpp
index 6d8bc348fd..8e5dc2999f 100644
--- a/src/jit/block.cpp
+++ b/src/jit/block.cpp
@@ -16,6 +16,19 @@ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#pragma hdrstop
#endif
+#if MEASURE_BLOCK_SIZE
+/* static */
+size_t BasicBlock::s_Size;
+/* static */
+size_t BasicBlock::s_Count;
+#endif // MEASURE_BLOCK_SIZE
+
+#ifdef DEBUG
+// The max # of tree nodes in any BB
+/* static */
+unsigned BasicBlock::s_nMaxTrees;
+#endif // DEBUG
+
#ifdef DEBUG
flowList* ShuffleHelper(unsigned hash, flowList* res)
{
@@ -804,3 +817,552 @@ bool BasicBlock::isEmpty()
return true;
}
+
+GenTreeStmt* BasicBlock::FirstNonPhiDef()
+{
+ GenTreePtr stmt = bbTreeList;
+ if (stmt == nullptr)
+ {
+ return nullptr;
+ }
+ GenTreePtr tree = stmt->gtStmt.gtStmtExpr;
+ while ((tree->OperGet() == GT_ASG && tree->gtOp.gtOp2->OperGet() == GT_PHI) ||
+ (tree->OperGet() == GT_STORE_LCL_VAR && tree->gtOp.gtOp1->OperGet() == GT_PHI))
+ {
+ stmt = stmt->gtNext;
+ if (stmt == nullptr)
+ {
+ return nullptr;
+ }
+ tree = stmt->gtStmt.gtStmtExpr;
+ }
+ return stmt->AsStmt();
+}
+
+GenTreePtr BasicBlock::FirstNonPhiDefOrCatchArgAsg()
+{
+ GenTreePtr stmt = FirstNonPhiDef();
+ if (stmt == nullptr)
+ {
+ return nullptr;
+ }
+ GenTreePtr tree = stmt->gtStmt.gtStmtExpr;
+ if ((tree->OperGet() == GT_ASG && tree->gtOp.gtOp2->OperGet() == GT_CATCH_ARG) ||
+ (tree->OperGet() == GT_STORE_LCL_VAR && tree->gtOp.gtOp1->OperGet() == GT_CATCH_ARG))
+ {
+ stmt = stmt->gtNext;
+ }
+ return stmt;
+}
+
+/*****************************************************************************
+ *
+ * Mark a block as rarely run, we also don't want to have a loop in a
+ * rarely run block, and we set it's weight to zero.
+ */
+
+void BasicBlock::bbSetRunRarely()
+{
+ setBBWeight(BB_ZERO_WEIGHT);
+ if (bbWeight == BB_ZERO_WEIGHT)
+ {
+ bbFlags |= BBF_RUN_RARELY; // This block is never/rarely run
+ }
+}
+
+/*****************************************************************************
+ *
+ * Can a BasicBlock be inserted after this without altering the flowgraph
+ */
+
+bool BasicBlock::bbFallsThrough()
+{
+ switch (bbJumpKind)
+ {
+
+ case BBJ_THROW:
+ case BBJ_EHFINALLYRET:
+ case BBJ_EHFILTERRET:
+ case BBJ_EHCATCHRET:
+ case BBJ_RETURN:
+ case BBJ_ALWAYS:
+ case BBJ_LEAVE:
+ case BBJ_SWITCH:
+ return false;
+
+ case BBJ_NONE:
+ case BBJ_COND:
+ return true;
+
+ case BBJ_CALLFINALLY:
+ return ((bbFlags & BBF_RETLESS_CALL) == 0);
+
+ default:
+ assert(!"Unknown bbJumpKind in bbFallsThrough()");
+ return true;
+ }
+}
+
+//------------------------------------------------------------------------
+// NumSucc: Returns the count of block successors. See the declaration comment for details.
+//
+// Arguments:
+// None.
+//
+// Return Value:
+// Count of block successors.
+//
+unsigned BasicBlock::NumSucc()
+{
+ switch (bbJumpKind)
+ {
+ case BBJ_THROW:
+ case BBJ_RETURN:
+ case BBJ_EHFINALLYRET:
+ case BBJ_EHFILTERRET:
+ return 0;
+
+ case BBJ_CALLFINALLY:
+ case BBJ_ALWAYS:
+ case BBJ_EHCATCHRET:
+ case BBJ_LEAVE:
+ case BBJ_NONE:
+ return 1;
+
+ case BBJ_COND:
+ if (bbJumpDest == bbNext)
+ {
+ return 1;
+ }
+ else
+ {
+ return 2;
+ }
+
+ case BBJ_SWITCH:
+ return bbJumpSwt->bbsCount;
+
+ default:
+ unreached();
+ }
+}
+
+//------------------------------------------------------------------------
+// GetSucc: Returns the requested block successor. See the declaration comment for details.
+//
+// Arguments:
+// i - index of successor to return. 0 <= i <= NumSucc().
+//
+// Return Value:
+// Requested successor block
+//
+BasicBlock* BasicBlock::GetSucc(unsigned i)
+{
+ assert(i < NumSucc()); // Index bounds check.
+ switch (bbJumpKind)
+ {
+ case BBJ_CALLFINALLY:
+ case BBJ_ALWAYS:
+ case BBJ_EHCATCHRET:
+ case BBJ_LEAVE:
+ return bbJumpDest;
+
+ case BBJ_NONE:
+ return bbNext;
+
+ case BBJ_COND:
+ if (i == 0)
+ {
+ return bbNext;
+ }
+ else
+ {
+ assert(i == 1);
+ return bbJumpDest;
+ }
+
+ case BBJ_SWITCH:
+ return bbJumpSwt->bbsDstTab[i];
+
+ default:
+ unreached();
+ }
+}
+
+//------------------------------------------------------------------------
+// NumSucc: Returns the count of block successors. See the declaration comment for details.
+//
+// Arguments:
+// comp - Compiler instance
+//
+// Return Value:
+// Count of block successors.
+//
+unsigned BasicBlock::NumSucc(Compiler* comp)
+{
+ assert(comp != nullptr);
+
+ switch (bbJumpKind)
+ {
+ case BBJ_THROW:
+ case BBJ_RETURN:
+ return 0;
+
+ case BBJ_EHFINALLYRET:
+ {
+ // The first block of the handler is labelled with the catch type.
+ BasicBlock* hndBeg = comp->fgFirstBlockOfHandler(this);
+ if (hndBeg->bbCatchTyp == BBCT_FINALLY)
+ {
+ return comp->fgNSuccsOfFinallyRet(this);
+ }
+ else
+ {
+ assert(hndBeg->bbCatchTyp == BBCT_FAULT); // We can only BBJ_EHFINALLYRET from FINALLY and FAULT.
+ // A FAULT block has no successors.
+ return 0;
+ }
+ }
+
+ case BBJ_CALLFINALLY:
+ case BBJ_ALWAYS:
+ case BBJ_EHCATCHRET:
+ case BBJ_EHFILTERRET:
+ case BBJ_LEAVE:
+ case BBJ_NONE:
+ return 1;
+
+ case BBJ_COND:
+ if (bbJumpDest == bbNext)
+ {
+ return 1;
+ }
+ else
+ {
+ return 2;
+ }
+
+ case BBJ_SWITCH:
+ {
+ Compiler::SwitchUniqueSuccSet sd = comp->GetDescriptorForSwitch(this);
+ return sd.numDistinctSuccs;
+ }
+
+ default:
+ unreached();
+ }
+}
+
+//------------------------------------------------------------------------
+// GetSucc: Returns the requested block successor. See the declaration comment for details.
+//
+// Arguments:
+// i - index of successor to return. 0 <= i <= NumSucc(comp).
+// comp - Compiler instance
+//
+// Return Value:
+// Requested successor block
+//
+BasicBlock* BasicBlock::GetSucc(unsigned i, Compiler* comp)
+{
+ assert(comp != nullptr);
+
+ assert(i < NumSucc(comp)); // Index bounds check.
+ switch (bbJumpKind)
+ {
+ case BBJ_EHFILTERRET:
+ {
+ // Handler is the (sole) normal successor of the filter.
+ assert(comp->fgFirstBlockOfHandler(this) == bbJumpDest);
+ return bbJumpDest;
+ }
+
+ case BBJ_EHFINALLYRET:
+ // Note: the following call is expensive.
+ return comp->fgSuccOfFinallyRet(this, i);
+
+ case BBJ_CALLFINALLY:
+ case BBJ_ALWAYS:
+ case BBJ_EHCATCHRET:
+ case BBJ_LEAVE:
+ return bbJumpDest;
+
+ case BBJ_NONE:
+ return bbNext;
+
+ case BBJ_COND:
+ if (i == 0)
+ {
+ return bbNext;
+ }
+ else
+ {
+ assert(i == 1);
+ return bbJumpDest;
+ }
+
+ case BBJ_SWITCH:
+ {
+ Compiler::SwitchUniqueSuccSet sd = comp->GetDescriptorForSwitch(this);
+ assert(i < sd.numDistinctSuccs); // Range check.
+ return sd.nonDuplicates[i];
+ }
+
+ default:
+ unreached();
+ }
+}
+
+void BasicBlock::InitVarSets(Compiler* comp)
+{
+ VarSetOps::AssignNoCopy(comp, bbVarUse, VarSetOps::MakeEmpty(comp));
+ VarSetOps::AssignNoCopy(comp, bbVarDef, VarSetOps::MakeEmpty(comp));
+ VarSetOps::AssignNoCopy(comp, bbLiveIn, VarSetOps::MakeEmpty(comp));
+ VarSetOps::AssignNoCopy(comp, bbLiveOut, VarSetOps::MakeEmpty(comp));
+ VarSetOps::AssignNoCopy(comp, bbScope, VarSetOps::MakeEmpty(comp));
+
+ bbMemoryUse = emptyMemoryKindSet;
+ bbMemoryDef = emptyMemoryKindSet;
+ bbMemoryLiveIn = emptyMemoryKindSet;
+ bbMemoryLiveOut = emptyMemoryKindSet;
+}
+
+// Returns true if the basic block ends with GT_JMP
+bool BasicBlock::endsWithJmpMethod(Compiler* comp)
+{
+ if (comp->compJmpOpUsed && (bbJumpKind == BBJ_RETURN) && (bbFlags & BBF_HAS_JMP))
+ {
+ GenTree* lastNode = this->lastNode();
+ assert(lastNode != nullptr);
+ return lastNode->OperGet() == GT_JMP;
+ }
+
+ return false;
+}
+
+// Returns true if the basic block ends with either
+// i) GT_JMP or
+// ii) tail call (implicit or explicit)
+//
+// Params:
+// comp - Compiler instance
+// fastTailCallsOnly - Only consider fast tail calls excluding tail calls via helper.
+//
+bool BasicBlock::endsWithTailCallOrJmp(Compiler* comp, bool fastTailCallsOnly /*=false*/)
+{
+ GenTreePtr tailCall = nullptr;
+ bool tailCallsConvertibleToLoopOnly = false;
+ return endsWithJmpMethod(comp) ||
+ endsWithTailCall(comp, fastTailCallsOnly, tailCallsConvertibleToLoopOnly, &tailCall);
+}
+
+//------------------------------------------------------------------------------
+// endsWithTailCall : Check if the block ends with a tail call.
+//
+// Arguments:
+// comp - compiler instance
+// fastTailCallsOnly - check for fast tail calls only
+// tailCallsConvertibleToLoopOnly - check for tail calls convertible to loop only
+// tailCall - a pointer to a tree that will be set to the call tree if the block
+// ends with a tail call and will be set to nullptr otherwise.
+//
+// Return Value:
+// true if the block ends with a tail call; false otherwise.
+//
+// Notes:
+// At most one of fastTailCallsOnly and tailCallsConvertibleToLoopOnly flags can be true.
+//
+bool BasicBlock::endsWithTailCall(Compiler* comp,
+ bool fastTailCallsOnly,
+ bool tailCallsConvertibleToLoopOnly,
+ GenTree** tailCall)
+{
+ assert(!fastTailCallsOnly || !tailCallsConvertibleToLoopOnly);
+ *tailCall = nullptr;
+ bool result = false;
+
+ // Is this a tail call?
+ // The reason for keeping this under RyuJIT is so as not to impact existing Jit32 x86 and arm
+ // targets.
+ if (comp->compTailCallUsed)
+ {
+ if (fastTailCallsOnly || tailCallsConvertibleToLoopOnly)
+ {
+ // Only fast tail calls or only tail calls convertible to loops
+ result = (bbFlags & BBF_HAS_JMP) && (bbJumpKind == BBJ_RETURN);
+ }
+ else
+ {
+ // Fast tail calls, tail calls convertible to loops, and tails calls dispatched via helper
+ result = (bbJumpKind == BBJ_THROW) || ((bbFlags & BBF_HAS_JMP) && (bbJumpKind == BBJ_RETURN));
+ }
+
+ if (result)
+ {
+ GenTree* lastNode = this->lastNode();
+ if (lastNode->OperGet() == GT_CALL)
+ {
+ GenTreeCall* call = lastNode->AsCall();
+ if (tailCallsConvertibleToLoopOnly)
+ {
+ result = call->IsTailCallConvertibleToLoop();
+ }
+ else if (fastTailCallsOnly)
+ {
+ result = call->IsFastTailCall();
+ }
+ else
+ {
+ result = call->IsTailCall();
+ }
+
+ if (result)
+ {
+ *tailCall = call;
+ }
+ }
+ else
+ {
+ result = false;
+ }
+ }
+ }
+
+ return result;
+}
+
+//------------------------------------------------------------------------------
+// endsWithTailCallConvertibleToLoop : Check if the block ends with a tail call convertible to loop.
+//
+// Arguments:
+// comp - compiler instance
+// tailCall - a pointer to a tree that will be set to the call tree if the block
+// ends with a tail call convertible to loop and will be set to nullptr otherwise.
+//
+// Return Value:
+// true if the block ends with a tail call convertible to loop.
+//
+bool BasicBlock::endsWithTailCallConvertibleToLoop(Compiler* comp, GenTree** tailCall)
+{
+ bool fastTailCallsOnly = false;
+ bool tailCallsConvertibleToLoopOnly = true;
+ return endsWithTailCall(comp, fastTailCallsOnly, tailCallsConvertibleToLoopOnly, tailCall);
+}
+
+/*****************************************************************************
+ *
+ * Allocate a basic block but don't append it to the current BB list.
+ */
+
+BasicBlock* Compiler::bbNewBasicBlock(BBjumpKinds jumpKind)
+{
+ BasicBlock* block;
+
+ /* Allocate the block descriptor and zero it out */
+ assert(fgSafeBasicBlockCreation);
+
+ block = new (this, CMK_BasicBlock) BasicBlock;
+
+#if MEASURE_BLOCK_SIZE
+ BasicBlock::s_Count += 1;
+ BasicBlock::s_Size += sizeof(*block);
+#endif
+
+#ifdef DEBUG
+ // fgLookupBB() is invalid until fgInitBBLookup() is called again.
+ fgBBs = (BasicBlock**)0xCDCD;
+#endif
+
+ // TODO-Throughput: The following memset is pretty expensive - do something else?
+ // Note that some fields have to be initialized to 0 (like bbFPStateX87)
+ memset(block, 0, sizeof(*block));
+
+ // scopeInfo needs to be able to differentiate between blocks which
+ // correspond to some instrs (and so may have some LocalVarInfo
+ // boundaries), or have been inserted by the JIT
+ block->bbCodeOffs = BAD_IL_OFFSET;
+ block->bbCodeOffsEnd = BAD_IL_OFFSET;
+
+ /* Give the block a number, set the ancestor count and weight */
+
+ ++fgBBcount;
+
+ if (compIsForInlining())
+ {
+ block->bbNum = ++impInlineInfo->InlinerCompiler->fgBBNumMax;
+ }
+ else
+ {
+ block->bbNum = ++fgBBNumMax;
+ }
+
+#ifndef LEGACY_BACKEND
+ if (compRationalIRForm)
+ {
+ block->bbFlags |= BBF_IS_LIR;
+ }
+#endif // !LEGACY_BACKEND
+
+ block->bbRefs = 1;
+ block->bbWeight = BB_UNITY_WEIGHT;
+
+ block->bbStkTempsIn = NO_BASE_TMP;
+ block->bbStkTempsOut = NO_BASE_TMP;
+
+ block->bbEntryState = nullptr;
+
+ /* Record the jump kind in the block */
+
+ block->bbJumpKind = jumpKind;
+
+ if (jumpKind == BBJ_THROW)
+ {
+ block->bbSetRunRarely();
+ }
+
+#ifdef DEBUG
+ if (verbose)
+ {
+ printf("New Basic Block BB%02u [%p] created.\n", block->bbNum, dspPtr(block));
+ }
+#endif
+
+ // We will give all the blocks var sets after the number of tracked variables
+ // is determined and frozen. After that, if we dynamically create a basic block,
+ // we will initialize its var sets.
+ if (fgBBVarSetsInited)
+ {
+ VarSetOps::AssignNoCopy(this, block->bbVarUse, VarSetOps::MakeEmpty(this));
+ VarSetOps::AssignNoCopy(this, block->bbVarDef, VarSetOps::MakeEmpty(this));
+ VarSetOps::AssignNoCopy(this, block->bbLiveIn, VarSetOps::MakeEmpty(this));
+ VarSetOps::AssignNoCopy(this, block->bbLiveOut, VarSetOps::MakeEmpty(this));
+ VarSetOps::AssignNoCopy(this, block->bbScope, VarSetOps::MakeEmpty(this));
+ }
+ else
+ {
+ VarSetOps::AssignNoCopy(this, block->bbVarUse, VarSetOps::UninitVal());
+ VarSetOps::AssignNoCopy(this, block->bbVarDef, VarSetOps::UninitVal());
+ VarSetOps::AssignNoCopy(this, block->bbLiveIn, VarSetOps::UninitVal());
+ VarSetOps::AssignNoCopy(this, block->bbLiveOut, VarSetOps::UninitVal());
+ VarSetOps::AssignNoCopy(this, block->bbScope, VarSetOps::UninitVal());
+ }
+
+ block->bbMemoryUse = emptyMemoryKindSet;
+ block->bbMemoryDef = emptyMemoryKindSet;
+ block->bbMemoryLiveIn = emptyMemoryKindSet;
+ block->bbMemoryLiveOut = emptyMemoryKindSet;
+
+ for (MemoryKind memoryKind : allMemoryKinds())
+ {
+ block->bbMemorySsaPhiFunc[memoryKind] = nullptr;
+ block->bbMemorySsaNumIn[memoryKind] = 0;
+ block->bbMemorySsaNumOut[memoryKind] = 0;
+ }
+
+ // Make sure we reserve a NOT_IN_LOOP value that isn't a legal table index.
+ static_assert_no_msg(MAX_LOOP_NUM < BasicBlock::NOT_IN_LOOP);
+
+ block->bbNatLoopNum = BasicBlock::NOT_IN_LOOP;
+
+ return block;
+}
diff --git a/src/jit/block.h b/src/jit/block.h
index 752219bdb7..d67891d4dd 100644
--- a/src/jit/block.h
+++ b/src/jit/block.h
@@ -139,10 +139,9 @@ enum ThisInitState
struct EntryState
{
- ThisInitState thisInitialized : 8; // used to track whether the this ptr is initialized (we could use
- // fewer bits here)
- unsigned esStackDepth : 24; // size of esStack
- StackEntry* esStack; // ptr to stack
+ ThisInitState thisInitialized; // used to track whether the this ptr is initialized.
+ unsigned esStackDepth; // size of esStack
+ StackEntry* esStack; // ptr to stack
};
// Enumeration of the kinds of memory whose state changes the compiler tracks
@@ -706,33 +705,42 @@ struct BasicBlock : private LIR::Range
BBswtDesc* bbJumpSwt; // switch descriptor
};
- // NumSucc() gives the number of successors, and GetSucc() allows one to iterate over them.
+ // NumSucc() gives the number of successors, and GetSucc() returns a given numbered successor.
//
- // The behavior of both for blocks that end in BBJ_EHFINALLYRET (a return from a finally or fault block)
- // depends on whether "comp" is non-null. If it is null, then the block is considered to have no
- // successor. If it is non-null, we figure out the actual successors. Some cases will want one behavior,
- // other cases the other. For example, IL verification requires that these blocks end in an empty operand
+ // There are two versions of these functions: ones that take a Compiler* and ones that don't. You must
+ // always use a matching set. Thus, if you call NumSucc() without a Compiler*, you must also call
+ // GetSucc() without a Compiler*.
+ //
+ // The behavior of NumSucc()/GetSucc() is different when passed a Compiler* for blocks that end in:
+ // (1) BBJ_EHFINALLYRET (a return from a finally or fault block)
+ // (2) BBJ_EHFILTERRET (a return from EH filter block)
+ // (3) BBJ_SWITCH
+ //
+ // For BBJ_EHFINALLYRET, if no Compiler* is passed, then the block is considered to have no
+ // successor. If Compiler* is passed, we figure out the actual successors. Some cases will want one behavior,
+ // other cases the other. For example, IL verification requires that these blocks end in an empty operand
// stack, and since the dataflow analysis of IL verification is concerned only with the contents of the
// operand stack, we can consider the finally block to have no successors. But a more general dataflow
// analysis that is tracking the contents of local variables might want to consider *all* successors,
// and would pass the current Compiler object.
//
- // Similarly, BBJ_EHFILTERRET blocks are assumed to have no successors if "comp" is null; if non-null,
- // NumSucc/GetSucc yields the first block of the try blocks handler.
+ // Similarly, BBJ_EHFILTERRET blocks are assumed to have no successors if Compiler* is not passed; if
+ // Compiler* is passed, NumSucc/GetSucc yields the first block of the try block's handler.
//
- // Also, the behavior for switches changes depending on the value of "comp". If it is null, then all
- // switch successors are returned. If it is non-null, then only unique switch successors are returned;
- // the duplicate successors are omitted.
+ // For BBJ_SWITCH, if Compiler* is not passed, then all switch successors are returned. If Compiler*
+ // is passed, then only unique switch successors are returned; the duplicate successors are omitted.
//
// Note that for BBJ_COND, which has two successors (fall through and condition true branch target),
// only the unique targets are returned. Thus, if both targets are the same, NumSucc() will only return 1
// instead of 2.
- //
- // Returns the number of successors of "this".
- unsigned NumSucc(Compiler* comp = nullptr);
- // Returns the "i"th successor. Requires (0 <= i < NumSucc()).
- BasicBlock* GetSucc(unsigned i, Compiler* comp = nullptr);
+ // NumSucc: Returns the number of successors of "this".
+ unsigned NumSucc();
+ unsigned NumSucc(Compiler* comp);
+
+ // GetSucc: Returns the "i"th successor. Requires (0 <= i < NumSucc()).
+ BasicBlock* GetSucc(unsigned i);
+ BasicBlock* GetSucc(unsigned i, Compiler* comp);
BasicBlock* GetUniquePred(Compiler* comp);
@@ -1067,8 +1075,6 @@ struct BasicBlock : private LIR::Range
GenTree* firstNode();
GenTree* lastNode();
- bool containsStatement(GenTree* statement);
-
bool endsWithJmpMethod(Compiler* comp);
bool endsWithTailCall(Compiler* comp,
diff --git a/src/jit/codegenarm.cpp b/src/jit/codegenarm.cpp
index 41bd8040ac..c28b27bf9b 100644
--- a/src/jit/codegenarm.cpp
+++ b/src/jit/codegenarm.cpp
@@ -166,9 +166,7 @@ void CodeGen::genSetRegToConst(regNumber targetReg, var_types targetType, GenTre
if (targetType == TYP_FLOAT)
{
// Get a temp integer register
- regMaskTP tmpRegMask = tree->gtRsvdRegs;
- regNumber tmpReg = genRegNumFromMask(tmpRegMask);
- assert(tmpReg != REG_NA);
+ regNumber tmpReg = tree->GetSingleTempReg();
float f = forceCastToFloat(constValue);
genSetRegToIcon(tmpReg, *((int*)(&f)));
@@ -181,15 +179,8 @@ void CodeGen::genSetRegToConst(regNumber targetReg, var_types targetType, GenTre
unsigned* cv = (unsigned*)&constValue;
// Get two temp integer registers
- regMaskTP tmpRegsMask = tree->gtRsvdRegs;
- regMaskTP tmpRegMask = genFindHighestBit(tmpRegsMask); // set tmpRegMsk to a one-bit mask
- regNumber tmpReg1 = genRegNumFromMask(tmpRegMask);
- assert(tmpReg1 != REG_NA);
-
- tmpRegsMask &= ~genRegMask(tmpReg1); // remove the bit for 'tmpReg1'
- tmpRegMask = genFindHighestBit(tmpRegsMask); // set tmpRegMsk to a one-bit mask
- regNumber tmpReg2 = genRegNumFromMask(tmpRegMask);
- assert(tmpReg2 != REG_NA);
+ regNumber tmpReg1 = tree->ExtractTempReg();
+ regNumber tmpReg2 = tree->GetSingleTempReg();
genSetRegToIcon(tmpReg1, cv[0]);
genSetRegToIcon(tmpReg2, cv[1]);
@@ -225,14 +216,8 @@ void CodeGen::genCodeForBinary(GenTree* treeNode)
var_types targetType = treeNode->TypeGet();
emitter* emit = getEmitter();
- assert(oper == GT_ADD || oper == GT_SUB || oper == GT_ADD_LO || oper == GT_ADD_HI || oper == GT_SUB_LO ||
- oper == GT_SUB_HI || oper == GT_OR || oper == GT_XOR || oper == GT_AND);
-
- if ((oper == GT_ADD || oper == GT_SUB || oper == GT_ADD_HI || oper == GT_SUB_HI) && treeNode->gtOverflow())
- {
- // This is also checked in the importer.
- NYI("Overflow not yet implemented");
- }
+ assert(oper == GT_ADD || oper == GT_SUB || oper == GT_MUL || oper == GT_ADD_LO || oper == GT_ADD_HI ||
+ oper == GT_SUB_LO || oper == GT_SUB_HI || oper == GT_OR || oper == GT_XOR || oper == GT_AND);
GenTreePtr op1 = treeNode->gtGetOp1();
GenTreePtr op2 = treeNode->gtGetOp2();
@@ -412,32 +397,9 @@ void CodeGen::genCodeForTreeNode(GenTreePtr treeNode)
case GT_SUB_HI:
case GT_ADD:
case GT_SUB:
- genConsumeOperands(treeNode->AsOp());
- genCodeForBinary(treeNode);
- break;
-
case GT_MUL:
- {
genConsumeOperands(treeNode->AsOp());
-
- const genTreeOps oper = treeNode->OperGet();
- if (treeNode->gtOverflow())
- {
- // This is also checked in the importer.
- NYI("Overflow not yet implemented");
- }
-
- GenTreePtr op1 = treeNode->gtGetOp1();
- GenTreePtr op2 = treeNode->gtGetOp2();
- instruction ins = genGetInsForOper(treeNode->OperGet(), targetType);
-
- // The arithmetic node must be sitting in a register (since it's not contained)
- noway_assert(targetReg != REG_NA);
-
- regNumber r = emit->emitInsTernary(ins, emitTypeSize(treeNode), treeNode, op1, op2);
- assert(r == targetReg);
- }
- genProduceReg(treeNode);
+ genCodeForBinary(treeNode);
break;
case GT_LSH:
@@ -529,7 +491,21 @@ void CodeGen::genCodeForTreeNode(GenTreePtr treeNode)
unsigned varNum = treeNode->gtLclVarCommon.gtLclNum;
assert(varNum < compiler->lvaCount);
- emit->emitIns_R_S(ins_Move_Extend(targetType, treeNode->InReg()), size, targetReg, varNum, offs);
+ if (varTypeIsFloating(targetType))
+ {
+ if (treeNode->InReg())
+ {
+ NYI("GT_LCL_FLD with reg-to-reg floating point move");
+ }
+ else
+ {
+ emit->emitIns_R_S(ins_Load(targetType), size, targetReg, varNum, offs);
+ }
+ }
+ else
+ {
+ emit->emitIns_R_S(ins_Move_Extend(targetType, treeNode->InReg()), size, targetReg, varNum, offs);
+ }
}
genProduceReg(treeNode);
break;
@@ -804,22 +780,8 @@ void CodeGen::genCodeForTreeNode(GenTreePtr treeNode)
break;
case GT_JTRUE:
- {
- GenTree* cmp = treeNode->gtOp.gtOp1->gtEffectiveVal();
- assert(cmp->OperIsCompare());
- assert(compiler->compCurBB->bbJumpKind == BBJ_COND);
-
- // Get the "kind" and type of the comparison. Note that whether it is an unsigned cmp
- // is governed by a flag NOT by the inherent type of the node
- // TODO-ARM-CQ: Check if we can use the currently set flags.
- CompareKind compareKind = ((cmp->gtFlags & GTF_UNSIGNED) != 0) ? CK_UNSIGNED : CK_SIGNED;
-
- emitJumpKind jmpKind = genJumpKindForOper(cmp->gtOper, compareKind);
- BasicBlock* jmpTarget = compiler->compCurBB->bbJumpDest;
-
- inst_JMP(jmpKind, jmpTarget);
- }
- break;
+ genCodeForJumpTrue(treeNode);
+ break;
case GT_JCC:
{
@@ -1013,8 +975,8 @@ void CodeGen::genCodeForTreeNode(GenTreePtr treeNode)
case GT_NULLCHECK:
{
assert(!treeNode->gtOp.gtOp1->isContained());
- regNumber reg = genConsumeReg(treeNode->gtOp.gtOp1);
- emit->emitIns_AR_R(INS_cmp, EA_4BYTE, reg, reg, 0);
+ regNumber addrReg = genConsumeReg(treeNode->gtOp.gtOp1);
+ emit->emitIns_R_R_I(INS_ldr, EA_4BYTE, targetReg, addrReg, 0);
}
break;
@@ -1129,7 +1091,6 @@ void CodeGen::genLclHeap(GenTreePtr tree)
// Also it used as temporary register in code generation
// for storing allocation size
regNumber regCnt = tree->gtRegNum;
- regMaskTP tmpRegsMask = tree->gtRsvdRegs;
regNumber pspSymReg = REG_NA;
var_types type = genActualType(size->gtType);
emitAttr easz = emitTypeSize(type);
@@ -1198,10 +1159,7 @@ void CodeGen::genLclHeap(GenTreePtr tree)
stackAdjustment += STACK_ALIGN;
// Save a copy of PSPSym
- assert(genCountBits(tmpRegsMask) >= 1);
- regMaskTP pspSymRegMask = genFindLowestBit(tmpRegsMask);
- tmpRegsMask &= ~pspSymRegMask;
- pspSymReg = genRegNumFromMask(pspSymRegMask);
+ pspSymReg = tree->ExtractTempReg();
getEmitter()->emitIns_R_S(ins_Load(TYP_I_IMPL), EA_PTRSIZE, pspSymReg, compiler->lvaPSPSym, 0);
}
#endif
@@ -1266,12 +1224,7 @@ void CodeGen::genLclHeap(GenTreePtr tree)
// Since we have to zero out the allocated memory AND ensure that RSP is always valid
// by tickling the pages, we will just push 0's on the stack.
- assert(tmpRegsMask != RBM_NONE);
- assert(genCountBits(tmpRegsMask) >= 1);
-
- regMaskTP regCntMask = genFindLowestBit(tmpRegsMask);
- tmpRegsMask &= ~regCntMask;
- regNumber regTmp = genRegNumFromMask(regCntMask);
+ regNumber regTmp = tree->ExtractTempReg();
instGen_Set_Reg_To_Zero(EA_PTRSIZE, regTmp);
// Loop:
@@ -1285,7 +1238,7 @@ void CodeGen::genLclHeap(GenTreePtr tree)
// If not done, loop
// Note that regCnt is the number of bytes to stack allocate.
assert(genIsValidIntReg(regCnt));
- getEmitter()->emitIns_R_R_I(INS_sub, EA_PTRSIZE, regCnt, regCnt, STACK_ALIGN);
+ getEmitter()->emitIns_R_I(INS_sub, EA_PTRSIZE, regCnt, STACK_ALIGN, INS_FLAGS_SET);
emitJumpKind jmpNotEqual = genJumpKindForOper(GT_NE, CK_SIGNED);
inst_JMP(jmpNotEqual, loop);
}
@@ -1323,15 +1276,13 @@ void CodeGen::genLclHeap(GenTreePtr tree)
//
// Setup the regTmp
- assert(tmpRegsMask != RBM_NONE);
- assert(genCountBits(tmpRegsMask) == 1);
- regNumber regTmp = genRegNumFromMask(tmpRegsMask);
+ regNumber regTmp = tree->ExtractTempReg();
BasicBlock* loop = genCreateTempLabel();
BasicBlock* done = genCreateTempLabel();
// subs regCnt, SP, regCnt // regCnt now holds ultimate SP
- getEmitter()->emitIns_R_R_R(INS_sub, EA_PTRSIZE, regCnt, REG_SPBASE, regCnt);
+ getEmitter()->emitIns_R_R_R(INS_sub, EA_PTRSIZE, regCnt, REG_SPBASE, regCnt, INS_FLAGS_SET);
inst_JMP(EJ_vc, loop); // branch if the V flag is not set
diff --git a/src/jit/codegenarm64.cpp b/src/jit/codegenarm64.cpp
index 7f98221df8..7de19f9043 100644
--- a/src/jit/codegenarm64.cpp
+++ b/src/jit/codegenarm64.cpp
@@ -906,7 +906,7 @@ void CodeGen::genFuncletProlog(BasicBlock* block)
#endif
assert(block != NULL);
- assert(block->bbFlags && BBF_FUNCLET_BEG);
+ assert(block->bbFlags & BBF_FUNCLET_BEG);
ScopedSetVariable<bool> _setGeneratingProlog(&compiler->compGeneratingProlog, true);
@@ -1441,9 +1441,7 @@ void CodeGen::genSetRegToConst(regNumber targetReg, var_types targetType, GenTre
else
{
// Get a temp integer register to compute long address.
- regMaskTP addrRegMask = tree->gtRsvdRegs;
- regNumber addrReg = genRegNumFromMask(addrRegMask);
- noway_assert(addrReg != REG_NA);
+ regNumber addrReg = tree->GetSingleTempReg();
// We must load the FP constant from the constant pool
// Emit a data section constant for the float or double constant.
@@ -2441,30 +2439,8 @@ void CodeGen::genCodeForTreeNode(GenTreePtr treeNode)
break;
case GT_JTRUE:
- {
- GenTree* cmp = treeNode->gtOp.gtOp1->gtEffectiveVal();
- assert(cmp->OperIsCompare());
- assert(compiler->compCurBB->bbJumpKind == BBJ_COND);
-
- // Get the "kind" and type of the comparison. Note that whether it is an unsigned cmp
- // is governed by a flag NOT by the inherent type of the node
- emitJumpKind jumpKind[2];
- bool branchToTrueLabel[2];
- genJumpKindsForTree(cmp, jumpKind, branchToTrueLabel);
- assert(jumpKind[0] != EJ_NONE);
-
- // On Arm64 the branches will always branch to the true label
- assert(branchToTrueLabel[0]);
- inst_JMP(jumpKind[0], compiler->compCurBB->bbJumpDest);
-
- if (jumpKind[1] != EJ_NONE)
- {
- // the second conditional branch always has to be to the true label
- assert(branchToTrueLabel[1]);
- inst_JMP(jumpKind[1], compiler->compCurBB->bbJumpDest);
- }
- }
- break;
+ genCodeForJumpTrue(treeNode);
+ break;
case GT_RETURNTRAP:
{
@@ -2854,7 +2830,6 @@ void CodeGen::genLclHeap(GenTreePtr tree)
noway_assert((genActualType(size->gtType) == TYP_INT) || (genActualType(size->gtType) == TYP_I_IMPL));
regNumber targetReg = tree->gtRegNum;
- regMaskTP tmpRegsMask = tree->gtRsvdRegs;
regNumber regCnt = REG_NA;
regNumber pspSymReg = REG_NA;
var_types type = genActualType(size->gtType);
@@ -2923,17 +2898,16 @@ void CodeGen::genLclHeap(GenTreePtr tree)
// since we don't need any internal registers.
if (!hasPspSym && compiler->info.compInitMem)
{
- assert(genCountBits(tmpRegsMask) == 0);
+ assert(tree->AvailableTempRegCount() == 0);
regCnt = targetReg;
}
else
{
- assert(genCountBits(tmpRegsMask) >= 1);
- regMaskTP regCntMask = genFindLowestBit(tmpRegsMask);
- tmpRegsMask &= ~regCntMask;
- regCnt = genRegNumFromMask(regCntMask);
+ regCnt = tree->ExtractTempReg();
if (regCnt != targetReg)
+ {
inst_RV_RV(INS_mov, regCnt, targetReg, size->TypeGet());
+ }
}
// Align to STACK_ALIGN
@@ -2950,10 +2924,7 @@ void CodeGen::genLclHeap(GenTreePtr tree)
stackAdjustment += STACK_ALIGN;
// Save a copy of PSPSym
- assert(genCountBits(tmpRegsMask) >= 1);
- regMaskTP pspSymRegMask = genFindLowestBit(tmpRegsMask);
- tmpRegsMask &= ~pspSymRegMask;
- pspSymReg = genRegNumFromMask(pspSymRegMask);
+ pspSymReg = tree->ExtractTempReg();
getEmitter()->emitIns_R_S(ins_Load(TYP_I_IMPL), EA_PTRSIZE, pspSymReg, compiler->lvaPSPSym, 0);
}
#endif
@@ -3021,15 +2992,12 @@ void CodeGen::genLclHeap(GenTreePtr tree)
assert(regCnt == REG_NA);
if (!hasPspSym && compiler->info.compInitMem)
{
- assert(genCountBits(tmpRegsMask) == 0);
+ assert(tree->AvailableTempRegCount() == 0);
regCnt = targetReg;
}
else
{
- assert(genCountBits(tmpRegsMask) >= 1);
- regMaskTP regCntMask = genFindLowestBit(tmpRegsMask);
- tmpRegsMask &= ~regCntMask;
- regCnt = genRegNumFromMask(regCntMask);
+ regCnt = tree->ExtractTempReg();
}
genSetRegToIcon(regCnt, amount, ((int)amount == amount) ? TYP_INT : TYP_LONG);
}
@@ -3094,9 +3062,7 @@ void CodeGen::genLclHeap(GenTreePtr tree)
//
// Setup the regTmp
- assert(tmpRegsMask != RBM_NONE);
- assert(genCountBits(tmpRegsMask) == 1);
- regNumber regTmp = genRegNumFromMask(tmpRegsMask);
+ regNumber regTmp = tree->GetSingleTempReg();
BasicBlock* loop = genCreateTempLabel();
BasicBlock* done = genCreateTempLabel();
@@ -3391,13 +3357,11 @@ void CodeGen::genCodeForCpBlkUnroll(GenTreeBlk* cpBlkNode)
unsigned offset = 0;
// Grab the integer temp register to emit the loads and stores.
- regMaskTP tmpMask = genFindLowestBit(cpBlkNode->gtRsvdRegs & RBM_ALLINT);
- regNumber tmpReg = genRegNumFromMask(tmpMask);
+ regNumber tmpReg = cpBlkNode->ExtractTempReg(RBM_ALLINT);
if (size >= 2 * REGSIZE_BYTES)
{
- regMaskTP tmp2Mask = cpBlkNode->gtRsvdRegs & RBM_ALLINT & ~tmpMask;
- regNumber tmp2Reg = genRegNumFromMask(tmp2Mask);
+ regNumber tmp2Reg = cpBlkNode->ExtractTempReg(RBM_ALLINT);
size_t slots = size / (2 * REGSIZE_BYTES);
@@ -3498,13 +3462,8 @@ void CodeGen::genCodeForCpObj(GenTreeObj* cpObjNode)
gcInfo.gcMarkRegPtrVal(REG_WRITE_BARRIER_DST_BYREF, dstAddr->TypeGet());
// Temp register used to perform the sequence of loads and stores.
- regNumber tmpReg = genRegNumFromMask(cpObjNode->gtRsvdRegs);
-
-#ifdef DEBUG
- assert(cpObjNode->gtRsvdRegs != RBM_NONE);
- assert(genCountBits(cpObjNode->gtRsvdRegs) == 1);
+ regNumber tmpReg = cpObjNode->GetSingleTempReg();
assert(genIsValidIntReg(tmpReg));
-#endif // DEBUG
unsigned slots = cpObjNode->gtSlots;
emitter* emit = getEmitter();
@@ -3571,7 +3530,7 @@ void CodeGen::genTableBasedSwitch(GenTree* treeNode)
regNumber idxReg = treeNode->gtOp.gtOp1->gtRegNum;
regNumber baseReg = treeNode->gtOp.gtOp2->gtRegNum;
- regNumber tmpReg = genRegNumFromMask(treeNode->gtRsvdRegs);
+ regNumber tmpReg = treeNode->GetSingleTempReg();
// load the ip-relative offset (which is relative to start of fgFirstBB)
getEmitter()->emitIns_R_R_R(INS_ldr, EA_4BYTE, baseReg, baseReg, idxReg, INS_OPTS_LSL);
@@ -4022,9 +3981,7 @@ void CodeGen::genLeaInstruction(GenTreeAddrMode* lea)
if (offset != 0)
{
- regMaskTP tmpRegMask = lea->gtRsvdRegs;
- regNumber tmpReg = genRegNumFromMask(tmpRegMask);
- noway_assert(tmpReg != REG_NA);
+ regNumber tmpReg = lea->GetSingleTempReg();
if (emitter::emitIns_valid_imm_for_add(offset, EA_8BYTE))
{
@@ -4041,7 +3998,6 @@ void CodeGen::genLeaInstruction(GenTreeAddrMode* lea)
// Then compute target reg from [tmpReg + offset]
emit->emitIns_R_R_I(INS_add, size, lea->gtRegNum, tmpReg, offset);
- ;
}
else // large offset
{
@@ -4091,9 +4047,7 @@ void CodeGen::genLeaInstruction(GenTreeAddrMode* lea)
else
{
// We require a tmpReg to hold the offset
- regMaskTP tmpRegMask = lea->gtRsvdRegs;
- regNumber tmpReg = genRegNumFromMask(tmpRegMask);
- noway_assert(tmpReg != REG_NA);
+ regNumber tmpReg = lea->GetSingleTempReg();
// First load tmpReg with the large offset constant
instGen_Set_Reg_To_Imm(EA_PTRSIZE, tmpReg, offset);
@@ -4116,131 +4070,6 @@ void CodeGen::genLeaInstruction(GenTreeAddrMode* lea)
}
//-------------------------------------------------------------------------------------------
-// genJumpKindsForTree: Determine the number and kinds of conditional branches
-// necessary to implement the given GT_CMP node
-//
-// Arguments:
-// cmpTree - (input) The GenTree node that is used to set the Condition codes
-// - The GenTree Relop node that was used to set the Condition codes
-// jmpKind[2] - (output) One or two conditional branch instructions
-// jmpToTrueLabel[2] - (output) On Arm64 both branches will always branch to the true label
-//
-// Return Value:
-// Sets the proper values into the array elements of jmpKind[] and jmpToTrueLabel[]
-//
-// Assumptions:
-// At least one conditional branch instruction will be returned.
-// Typically only one conditional branch is needed
-// and the second jmpKind[] value is set to EJ_NONE
-//-------------------------------------------------------------------------------------------
-
-// static
-void CodeGen::genJumpKindsForTree(GenTreePtr cmpTree, emitJumpKind jmpKind[2], bool jmpToTrueLabel[2])
-{
- // On Arm64 both branches will always branch to the true label
- jmpToTrueLabel[0] = true;
- jmpToTrueLabel[1] = true;
-
- // For integer comparisons just use genJumpKindForOper
- if (!varTypeIsFloating(cmpTree->gtOp.gtOp1->gtEffectiveVal()))
- {
- CompareKind compareKind = ((cmpTree->gtFlags & GTF_UNSIGNED) != 0) ? CK_UNSIGNED : CK_SIGNED;
- jmpKind[0] = genJumpKindForOper(cmpTree->gtOper, compareKind);
- jmpKind[1] = EJ_NONE;
- }
- else // We have a Floating Point Compare operation
- {
- assert(cmpTree->OperIsCompare());
-
- // For details on this mapping, see the ARM64 Condition Code
- // table at section C1.2.3 in the ARMV8 architecture manual
- //
-
- // We must check the GTF_RELOP_NAN_UN to find out
- // if we need to branch when we have a NaN operand.
- //
- if ((cmpTree->gtFlags & GTF_RELOP_NAN_UN) != 0)
- {
- // Must branch if we have an NaN, unordered
- switch (cmpTree->gtOper)
- {
- case GT_EQ:
- jmpKind[0] = EJ_eq; // branch or set when equal (and no NaN's)
- jmpKind[1] = EJ_vs; // branch or set when we have a NaN
- break;
-
- case GT_NE:
- jmpKind[0] = EJ_ne; // branch or set when not equal (or have NaN's)
- jmpKind[1] = EJ_NONE;
- break;
-
- case GT_LT:
- jmpKind[0] = EJ_lt; // branch or set when less than (or have NaN's)
- jmpKind[1] = EJ_NONE;
- break;
-
- case GT_LE:
- jmpKind[0] = EJ_le; // branch or set when less than or equal (or have NaN's)
- jmpKind[1] = EJ_NONE;
- break;
-
- case GT_GT:
- jmpKind[0] = EJ_hi; // branch or set when greater than (or have NaN's)
- jmpKind[1] = EJ_NONE;
- break;
-
- case GT_GE:
- jmpKind[0] = EJ_hs; // branch or set when greater than or equal (or have NaN's)
- jmpKind[1] = EJ_NONE;
- break;
-
- default:
- unreached();
- }
- }
- else // ((cmpTree->gtFlags & GTF_RELOP_NAN_UN) == 0)
- {
- // Do not branch if we have an NaN, unordered
- switch (cmpTree->gtOper)
- {
- case GT_EQ:
- jmpKind[0] = EJ_eq; // branch or set when equal (and no NaN's)
- jmpKind[1] = EJ_NONE;
- break;
-
- case GT_NE:
- jmpKind[0] = EJ_gt; // branch or set when greater than (and no NaN's)
- jmpKind[1] = EJ_lo; // branch or set when less than (and no NaN's)
- break;
-
- case GT_LT:
- jmpKind[0] = EJ_lo; // branch or set when less than (and no NaN's)
- jmpKind[1] = EJ_NONE;
- break;
-
- case GT_LE:
- jmpKind[0] = EJ_ls; // branch or set when less than or equal (and no NaN's)
- jmpKind[1] = EJ_NONE;
- break;
-
- case GT_GT:
- jmpKind[0] = EJ_gt; // branch or set when greater than (and no NaN's)
- jmpKind[1] = EJ_NONE;
- break;
-
- case GT_GE:
- jmpKind[0] = EJ_ge; // branch or set when greater than or equal (and no NaN's)
- jmpKind[1] = EJ_NONE;
- break;
-
- default:
- unreached();
- }
- }
- }
-}
-
-//-------------------------------------------------------------------------------------------
// genSetRegToCond: Set a register 'dstReg' to the appropriate one or zero value
// corresponding to a binary Relational operator result.
//
@@ -4484,9 +4313,8 @@ void CodeGen::genCkfinite(GenTreePtr treeNode)
emitter* emit = getEmitter();
// Extract exponent into a register.
- regNumber intReg = genRegNumFromMask(treeNode->gtRsvdRegs);
+ regNumber intReg = treeNode->GetSingleTempReg();
regNumber fpReg = genConsumeReg(op1);
- assert(intReg != REG_NA);
emit->emitIns_R_R(ins_Copy(targetType), emitTypeSize(treeNode), intReg, fpReg);
emit->emitIns_R_R_I(INS_lsr, emitTypeSize(targetType), intReg, intReg, shiftAmount);
diff --git a/src/jit/codegenarmarch.cpp b/src/jit/codegenarmarch.cpp
index af9fdfed9c..c541472284 100644
--- a/src/jit/codegenarmarch.cpp
+++ b/src/jit/codegenarmarch.cpp
@@ -212,13 +212,10 @@ void CodeGen::genPutArgStk(GenTreePutArgStk* treeNode)
// We will copy this struct to the stack, possibly using a ldp instruction
// Setup loReg and hiReg from the internal registers that we reserved in lower.
//
- regNumber loReg = REG_NA;
- regNumber hiReg = REG_NA;
+ regNumber loReg = treeNode->ExtractTempReg();
+ regNumber hiReg = treeNode->GetSingleTempReg();
regNumber addrReg = REG_NA;
- // In lowerArm64/TreeNodeInfoInitPutArgStk we have reserved two internal integer registers
- genGetRegPairFromMask(treeNode->gtRsvdRegs, &loReg, &hiReg);
-
GenTreeLclVarCommon* varNode = nullptr;
GenTreePtr addrNode = nullptr;
@@ -709,15 +706,9 @@ void CodeGen::genCodeForArrIndex(GenTreeArrIndex* arrIndex)
regNumber tgtReg = arrIndex->gtRegNum;
noway_assert(tgtReg != REG_NA);
- // We will use a temp register to load the lower bound and dimension size values
- //
- regMaskTP tmpRegsMask = arrIndex->gtRsvdRegs; // there will be two bits set
- tmpRegsMask &= ~genRegMask(tgtReg); // remove the bit for 'tgtReg' from 'tmpRegsMask'
-
- regMaskTP tmpRegMask = genFindLowestBit(tmpRegsMask); // set tmpRegMsk to a one-bit mask
- regNumber tmpReg = genRegNumFromMask(tmpRegMask); // set tmpReg from that mask
- noway_assert(tmpReg != REG_NA);
+ // We will use a temp register to load the lower bound and dimension size values.
+ regNumber tmpReg = arrIndex->GetSingleTempReg();
assert(tgtReg != tmpReg);
unsigned dim = arrIndex->gtCurrDim;
@@ -773,25 +764,17 @@ void CodeGen::genCodeForArrOffset(GenTreeArrOffs* arrOffset)
noway_assert(indexReg != REG_NA);
noway_assert(arrReg != REG_NA);
- regMaskTP tmpRegMask = arrOffset->gtRsvdRegs;
- regNumber tmpReg = genRegNumFromMask(tmpRegMask);
- noway_assert(tmpReg != REG_NA);
+ regNumber tmpReg = arrOffset->GetSingleTempReg();
unsigned dim = arrOffset->gtCurrDim;
unsigned rank = arrOffset->gtArrRank;
var_types elemType = arrOffset->gtArrElemType;
unsigned offset = genOffsetOfMDArrayDimensionSize(elemType, rank, dim);
-// Load tmpReg with the dimension size and evaluate
-// tgtReg = offsetReg*dim_size + indexReg.
-#if defined(_TARGET_ARM_)
- emit->emitIns_R_R_I(ins_Load(TYP_INT), EA_4BYTE, tmpReg, arrReg, offset); // a 4 BYTE sign extending load
- emit->emitIns_R_R_R(INS_MUL, EA_4BYTE, tgtReg, tmpReg, offsetReg);
- emit->emitIns_R_R_R(INS_add, EA_4BYTE, tgtReg, tgtReg, indexReg);
-#elif defined(_TARGET_ARM64_)
- emit->emitIns_R_R_I(ins_Load(TYP_INT), EA_8BYTE, tmpReg, arrReg, offset); // a 4 BYTE sign extending load
- emit->emitIns_R_R_R_R(INS_madd, EA_4BYTE, tgtReg, tmpReg, offsetReg, indexReg);
-#endif // _TARGET_*
+ // Load tmpReg with the dimension size and evaluate
+ // tgtReg = offsetReg*tmpReg + indexReg.
+ emit->emitIns_R_R_I(ins_Load(TYP_INT), EA_PTRSIZE, tmpReg, arrReg, offset);
+ emit->emitIns_R_R_R_R(INS_MULADD, EA_PTRSIZE, tgtReg, tmpReg, offsetReg, indexReg);
}
else
{
@@ -1073,12 +1056,7 @@ void CodeGen::genCallInstruction(GenTreeCall* call)
const regNumber regThis = genGetThisArgReg(call);
#if defined(_TARGET_ARM_)
- regMaskTP tempMask = genFindLowestBit(call->gtRsvdRegs);
- const regNumber tmpReg = genRegNumFromMask(tempMask);
- if (genCountBits(call->gtRsvdRegs) > 1)
- {
- call->gtRsvdRegs &= ~tempMask;
- }
+ const regNumber tmpReg = call->ExtractTempReg();
getEmitter()->emitIns_R_R_I(INS_ldr, EA_4BYTE, tmpReg, regThis, 0);
#elif defined(_TARGET_ARM64_)
getEmitter()->emitIns_R_R_I(INS_ldr, EA_4BYTE, REG_ZR, regThis, 0);
@@ -1239,7 +1217,7 @@ void CodeGen::genCallInstruction(GenTreeCall* call)
#ifdef _TARGET_ARM_
if (!arm_Valid_Imm_For_BL((ssize_t)addr))
{
- regNumber tmpReg = genRegNumFromMask(call->gtRsvdRegs);
+ regNumber tmpReg = call->GetSingleTempReg();
instGen_Set_Reg_To_Imm(EA_HANDLE_CNS_RELOC, tmpReg, (ssize_t)addr);
genEmitCall(emitter::EC_INDIR_R, methHnd, INDEBUG_LDISASM_COMMA(sigInfo) NULL, retSize, ilOffset, tmpReg);
}
@@ -1388,7 +1366,7 @@ void CodeGen::genIntToIntCast(GenTreePtr treeNode)
regNumber sourceReg = castOp->gtRegNum;
// For Long to Int conversion we will have a reserved integer register to hold the immediate mask
- regNumber tmpReg = (treeNode->gtRsvdRegs == RBM_NONE) ? REG_NA : genRegNumFromMask(treeNode->gtRsvdRegs);
+ regNumber tmpReg = (treeNode->AvailableTempRegCount() == 0) ? REG_NA : treeNode->GetSingleTempReg();
assert(genIsValidIntReg(targetReg));
assert(genIsValidIntReg(sourceReg));
@@ -1428,7 +1406,20 @@ void CodeGen::genIntToIntCast(GenTreePtr treeNode)
// we only have to check for any bits set in 'typeMask'
noway_assert(castInfo.typeMask != 0);
+#if defined(_TARGET_ARM_)
+ if (arm_Valid_Imm_For_Instr(INS_tst, castInfo.typeMask, INS_FLAGS_DONT_CARE))
+ {
+ emit->emitIns_R_I(INS_tst, cmpSize, sourceReg, castInfo.typeMask);
+ }
+ else
+ {
+ noway_assert(tmpReg != REG_NA);
+ instGen_Set_Reg_To_Imm(cmpSize, tmpReg, castInfo.typeMask);
+ emit->emitIns_R_R(INS_tst, cmpSize, sourceReg, tmpReg);
+ }
+#elif defined(_TARGET_ARM64_)
emit->emitIns_R_I(INS_tst, cmpSize, sourceReg, castInfo.typeMask);
+#endif // _TARGET_ARM*
emitJumpKind jmpNotEqual = genJumpKindForOper(GT_NE, CK_SIGNED);
genJumpToThrowHlpBlk(jmpNotEqual, SCK_OVERFLOW);
}
@@ -1682,6 +1673,163 @@ void CodeGen::genCreateAndStoreGCInfo(unsigned codeSize,
compiler->compInfoBlkSize = 0; // not exposed by the GCEncoder interface
}
+//-------------------------------------------------------------------------------------------
+// genJumpKindsForTree: Determine the number and kinds of conditional branches
+// necessary to implement the given GT_CMP node
+//
+// Arguments:
+// cmpTree - (input) The GenTree node that is used to set the Condition codes
+// - The GenTree Relop node that was used to set the Condition codes
+// jmpKind[2] - (output) One or two conditional branch instructions
+// jmpToTrueLabel[2] - (output) On Arm64 both branches will always branch to the true label
+//
+// Return Value:
+// Sets the proper values into the array elements of jmpKind[] and jmpToTrueLabel[]
+//
+// Assumptions:
+// At least one conditional branch instruction will be returned.
+// Typically only one conditional branch is needed
+// and the second jmpKind[] value is set to EJ_NONE
+//
+void CodeGen::genJumpKindsForTree(GenTreePtr cmpTree, emitJumpKind jmpKind[2], bool jmpToTrueLabel[2])
+{
+ // On ARM both branches will always branch to the true label
+ jmpToTrueLabel[0] = true;
+ jmpToTrueLabel[1] = true;
+
+ // For integer comparisons just use genJumpKindForOper
+ if (!varTypeIsFloating(cmpTree->gtOp.gtOp1->gtEffectiveVal()))
+ {
+ CompareKind compareKind = ((cmpTree->gtFlags & GTF_UNSIGNED) != 0) ? CK_UNSIGNED : CK_SIGNED;
+ jmpKind[0] = genJumpKindForOper(cmpTree->gtOper, compareKind);
+ jmpKind[1] = EJ_NONE;
+ }
+ else // We have a Floating Point Compare operation
+ {
+ assert(cmpTree->OperIsCompare());
+
+ // For details on this mapping, see the ARM Condition Code table
+ // at section A8.3 in the ARMv7 architecture manual or
+ // at section C1.2.3 in the ARMV8 architecture manual.
+
+ // We must check the GTF_RELOP_NAN_UN to find out
+ // if we need to branch when we have a NaN operand.
+ //
+ if ((cmpTree->gtFlags & GTF_RELOP_NAN_UN) != 0)
+ {
+ // Must branch if we have an NaN, unordered
+ switch (cmpTree->gtOper)
+ {
+ case GT_EQ:
+ jmpKind[0] = EJ_eq; // branch or set when equal (and no NaN's)
+ jmpKind[1] = EJ_vs; // branch or set when we have a NaN
+ break;
+
+ case GT_NE:
+ jmpKind[0] = EJ_ne; // branch or set when not equal (or have NaN's)
+ jmpKind[1] = EJ_NONE;
+ break;
+
+ case GT_LT:
+ jmpKind[0] = EJ_lt; // branch or set when less than (or have NaN's)
+ jmpKind[1] = EJ_NONE;
+ break;
+
+ case GT_LE:
+ jmpKind[0] = EJ_le; // branch or set when less than or equal (or have NaN's)
+ jmpKind[1] = EJ_NONE;
+ break;
+
+ case GT_GT:
+ jmpKind[0] = EJ_hi; // branch or set when greater than (or have NaN's)
+ jmpKind[1] = EJ_NONE;
+ break;
+
+ case GT_GE:
+ jmpKind[0] = EJ_hs; // branch or set when greater than or equal (or have NaN's)
+ jmpKind[1] = EJ_NONE;
+ break;
+
+ default:
+ unreached();
+ }
+ }
+ else // ((cmpTree->gtFlags & GTF_RELOP_NAN_UN) == 0)
+ {
+ // Do not branch if we have an NaN, unordered
+ switch (cmpTree->gtOper)
+ {
+ case GT_EQ:
+ jmpKind[0] = EJ_eq; // branch or set when equal (and no NaN's)
+ jmpKind[1] = EJ_NONE;
+ break;
+
+ case GT_NE:
+ jmpKind[0] = EJ_gt; // branch or set when greater than (and no NaN's)
+ jmpKind[1] = EJ_lo; // branch or set when less than (and no NaN's)
+ break;
+
+ case GT_LT:
+ jmpKind[0] = EJ_lo; // branch or set when less than (and no NaN's)
+ jmpKind[1] = EJ_NONE;
+ break;
+
+ case GT_LE:
+ jmpKind[0] = EJ_ls; // branch or set when less than or equal (and no NaN's)
+ jmpKind[1] = EJ_NONE;
+ break;
+
+ case GT_GT:
+ jmpKind[0] = EJ_gt; // branch or set when greater than (and no NaN's)
+ jmpKind[1] = EJ_NONE;
+ break;
+
+ case GT_GE:
+ jmpKind[0] = EJ_ge; // branch or set when greater than or equal (and no NaN's)
+ jmpKind[1] = EJ_NONE;
+ break;
+
+ default:
+ unreached();
+ }
+ }
+ }
+}
+
+//------------------------------------------------------------------------
+// genCodeForJumpTrue: Generates code for jmpTrue statement.
+//
+// Arguments:
+// tree - The GT_JTRUE tree node.
+//
+// Return Value:
+// None
+//
+void CodeGen::genCodeForJumpTrue(GenTreePtr tree)
+{
+ GenTree* cmp = tree->gtOp.gtOp1->gtEffectiveVal();
+ assert(cmp->OperIsCompare());
+ assert(compiler->compCurBB->bbJumpKind == BBJ_COND);
+
+ // Get the "kind" and type of the comparison. Note that whether it is an unsigned cmp
+ // is governed by a flag NOT by the inherent type of the node
+ emitJumpKind jumpKind[2];
+ bool branchToTrueLabel[2];
+ genJumpKindsForTree(cmp, jumpKind, branchToTrueLabel);
+ assert(jumpKind[0] != EJ_NONE);
+
+ // On ARM the branches will always branch to the true label
+ assert(branchToTrueLabel[0]);
+ inst_JMP(jumpKind[0], compiler->compCurBB->bbJumpDest);
+
+ if (jumpKind[1] != EJ_NONE)
+ {
+ // the second conditional branch always has to be to the true label
+ assert(branchToTrueLabel[1]);
+ inst_JMP(jumpKind[1], compiler->compCurBB->bbJumpDest);
+ }
+}
+
#endif // _TARGET_ARMARCH_
#endif // !LEGACY_BACKEND
diff --git a/src/jit/codegencommon.cpp b/src/jit/codegencommon.cpp
index 89d6a4ca34..64561de567 100644
--- a/src/jit/codegencommon.cpp
+++ b/src/jit/codegencommon.cpp
@@ -557,30 +557,6 @@ regMaskTP CodeGenInterface::genGetRegMask(GenTreePtr tree)
return regMask;
}
-//------------------------------------------------------------------------
-// getRegistersFromMask: Given a register mask return the two registers
-// specified by the mask.
-//
-// Arguments:
-// regPairMask: a register mask that has exactly two bits set
-// Return values:
-// pLoReg: the address of where to write the first register
-// pHiReg: the address of where to write the second register
-//
-void CodeGenInterface::genGetRegPairFromMask(regMaskTP regPairMask, regNumber* pLoReg, regNumber* pHiReg)
-{
- assert(genCountBits(regPairMask) == 2);
-
- regMaskTP loMask = genFindLowestBit(regPairMask); // set loMask to a one-bit mask
- regMaskTP hiMask = regPairMask - loMask; // set hiMask to the other bit that was in tmpRegMask
-
- regNumber loReg = genRegNumFromMask(loMask); // set loReg from loMask
- regNumber hiReg = genRegNumFromMask(hiMask); // set hiReg from hiMask
-
- *pLoReg = loReg;
- *pHiReg = hiReg;
-}
-
// The given lclVar is either going live (being born) or dying.
// It might be both going live and dying (that is, it is a dead store) under MinOpts.
// Update regSet.rsMaskVars accordingly.
@@ -9917,7 +9893,7 @@ void CodeGen::genFuncletProlog(BasicBlock* block)
#endif
assert(block != NULL);
- assert(block->bbFlags && BBF_FUNCLET_BEG);
+ assert(block->bbFlags & BBF_FUNCLET_BEG);
ScopedSetVariable<bool> _setGeneratingProlog(&compiler->compGeneratingProlog, true);
diff --git a/src/jit/codegeninterface.h b/src/jit/codegeninterface.h
index 08d854eaaf..a993ddb629 100644
--- a/src/jit/codegeninterface.h
+++ b/src/jit/codegeninterface.h
@@ -149,8 +149,6 @@ protected:
regMaskTP genLiveMask(VARSET_VALARG_TP liveSet);
#endif
- void genGetRegPairFromMask(regMaskTP regPairMask, regNumber* pLoReg, regNumber* pHiReg);
-
// The following property indicates whether the current method sets up
// an explicit stack frame or not.
private:
diff --git a/src/jit/codegenlinear.h b/src/jit/codegenlinear.h
index fa0c85c749..715e87a944 100644
--- a/src/jit/codegenlinear.h
+++ b/src/jit/codegenlinear.h
@@ -268,6 +268,8 @@ void genJmpMethod(GenTreePtr jmp);
BasicBlock* genCallFinally(BasicBlock* block);
+void genCodeForJumpTrue(GenTreePtr tree);
+
#if FEATURE_EH_FUNCLETS
void genEHCatchRet(BasicBlock* block);
#else // !FEATURE_EH_FUNCLETS
diff --git a/src/jit/codegenxarch.cpp b/src/jit/codegenxarch.cpp
index 23c2a186a4..d693ff914a 100644
--- a/src/jit/codegenxarch.cpp
+++ b/src/jit/codegenxarch.cpp
@@ -617,7 +617,7 @@ void CodeGen::genCodeForLongUMod(GenTreeOp* node)
// xor edx, edx
// div divisor->gtRegNum
// mov eax, temp
- const regNumber tempReg = genRegNumFromMask(node->gtRsvdRegs);
+ const regNumber tempReg = node->GetSingleTempReg();
inst_RV_RV(INS_mov, tempReg, REG_EAX, TYP_INT);
inst_RV_RV(INS_mov, REG_EAX, REG_EDX, TYP_INT);
instGen_Set_Reg_To_Zero(EA_PTRSIZE, REG_EDX);
@@ -1234,6 +1234,66 @@ void CodeGen::genReturn(GenTreePtr treeNode)
#endif
}
+//------------------------------------------------------------------------
+// genCodeForJumpTrue: Generates code for jmpTrue statement.
+//
+// Arguments:
+// tree - The GT_JTRUE tree node.
+//
+// Return Value:
+// None
+//
+void CodeGen::genCodeForJumpTrue(GenTreePtr tree)
+{
+ GenTree* cmp = tree->gtOp.gtOp1;
+
+ assert(cmp->OperIsCompare());
+ assert(compiler->compCurBB->bbJumpKind == BBJ_COND);
+
+#if !defined(_TARGET_64BIT_)
+ // Long-typed compares should have been handled by Lowering::LowerCompare.
+ assert(!varTypeIsLong(cmp->gtGetOp1()));
+#endif
+
+ // Get the "kind" and type of the comparison. Note that whether it is an unsigned cmp
+ // is governed by a flag NOT by the inherent type of the node
+ // TODO-XArch-CQ: Check if we can use the currently set flags.
+ emitJumpKind jumpKind[2];
+ bool branchToTrueLabel[2];
+ genJumpKindsForTree(cmp, jumpKind, branchToTrueLabel);
+
+ BasicBlock* skipLabel = nullptr;
+ if (jumpKind[0] != EJ_NONE)
+ {
+ BasicBlock* jmpTarget;
+ if (branchToTrueLabel[0])
+ {
+ jmpTarget = compiler->compCurBB->bbJumpDest;
+ }
+ else
+ {
+ // This case arises only for ordered GT_EQ right now
+ assert((cmp->gtOper == GT_EQ) && ((cmp->gtFlags & GTF_RELOP_NAN_UN) == 0));
+ skipLabel = genCreateTempLabel();
+ jmpTarget = skipLabel;
+ }
+
+ inst_JMP(jumpKind[0], jmpTarget);
+ }
+
+ if (jumpKind[1] != EJ_NONE)
+ {
+ // the second conditional branch always has to be to the true label
+ assert(branchToTrueLabel[1]);
+ inst_JMP(jumpKind[1], compiler->compCurBB->bbJumpDest);
+ }
+
+ if (skipLabel != nullptr)
+ {
+ genDefineTempLabel(skipLabel);
+ }
+}
+
/*****************************************************************************
*
* Generate code for a single node in the tree.
@@ -1844,56 +1904,8 @@ void CodeGen::genCodeForTreeNode(GenTreePtr treeNode)
break;
case GT_JTRUE:
- {
- GenTree* cmp = treeNode->gtOp.gtOp1;
-
- assert(cmp->OperIsCompare());
- assert(compiler->compCurBB->bbJumpKind == BBJ_COND);
-
-#if !defined(_TARGET_64BIT_)
- // Long-typed compares should have been handled by Lowering::LowerCompare.
- assert(!varTypeIsLong(cmp->gtGetOp1()));
-#endif
-
- // Get the "kind" and type of the comparison. Note that whether it is an unsigned cmp
- // is governed by a flag NOT by the inherent type of the node
- // TODO-XArch-CQ: Check if we can use the currently set flags.
- emitJumpKind jumpKind[2];
- bool branchToTrueLabel[2];
- genJumpKindsForTree(cmp, jumpKind, branchToTrueLabel);
-
- BasicBlock* skipLabel = nullptr;
- if (jumpKind[0] != EJ_NONE)
- {
- BasicBlock* jmpTarget;
- if (branchToTrueLabel[0])
- {
- jmpTarget = compiler->compCurBB->bbJumpDest;
- }
- else
- {
- // This case arises only for ordered GT_EQ right now
- assert((cmp->gtOper == GT_EQ) && ((cmp->gtFlags & GTF_RELOP_NAN_UN) == 0));
- skipLabel = genCreateTempLabel();
- jmpTarget = skipLabel;
- }
-
- inst_JMP(jumpKind[0], jmpTarget);
- }
-
- if (jumpKind[1] != EJ_NONE)
- {
- // the second conditional branch always has to be to the true label
- assert(branchToTrueLabel[1]);
- inst_JMP(jumpKind[1], compiler->compCurBB->bbJumpDest);
- }
-
- if (skipLabel != nullptr)
- {
- genDefineTempLabel(skipLabel);
- }
- }
- break;
+ genCodeForJumpTrue(treeNode);
+ break;
case GT_JCC:
{
@@ -1924,9 +1936,7 @@ void CodeGen::genCodeForTreeNode(GenTreePtr treeNode)
inst_JMP(jmpEqual, skipLabel);
// emit the call to the EE-helper that stops for GC (or other reasons)
- assert(treeNode->gtRsvdRegs != RBM_NONE);
- assert(genCountBits(treeNode->gtRsvdRegs) == 1);
- regNumber tmpReg = genRegNumFromMask(treeNode->gtRsvdRegs);
+ regNumber tmpReg = treeNode->GetSingleTempReg();
assert(genIsValidIntReg(tmpReg));
genEmitHelperCall(CORINFO_HELP_STOP_FOR_GC, 0, EA_UNKNOWN, tmpReg);
@@ -2431,12 +2441,11 @@ void CodeGen::genLclHeap(GenTreePtr tree)
GenTreePtr size = tree->gtOp.gtOp1;
noway_assert((genActualType(size->gtType) == TYP_INT) || (genActualType(size->gtType) == TYP_I_IMPL));
- regNumber targetReg = tree->gtRegNum;
- regMaskTP tmpRegsMask = tree->gtRsvdRegs;
- regNumber regCnt = REG_NA;
- var_types type = genActualType(size->gtType);
- emitAttr easz = emitTypeSize(type);
- BasicBlock* endLabel = nullptr;
+ regNumber targetReg = tree->gtRegNum;
+ regNumber regCnt = REG_NA;
+ var_types type = genActualType(size->gtType);
+ emitAttr easz = emitTypeSize(type);
+ BasicBlock* endLabel = nullptr;
#ifdef DEBUG
// Verify ESP
@@ -2494,15 +2503,12 @@ void CodeGen::genLclHeap(GenTreePtr tree)
// since we don't need any internal registers.
if (compiler->info.compInitMem)
{
- assert(genCountBits(tmpRegsMask) == 0);
+ assert(tree->AvailableTempRegCount() == 0);
regCnt = targetReg;
}
else
{
- assert(genCountBits(tmpRegsMask) >= 1);
- regMaskTP regCntMask = genFindLowestBit(tmpRegsMask);
- tmpRegsMask &= ~regCntMask;
- regCnt = genRegNumFromMask(regCntMask);
+ regCnt = tree->ExtractTempReg();
if (regCnt != targetReg)
{
// Above, we put the size in targetReg. Now, copy it to our new temp register if necessary.
@@ -2594,15 +2600,12 @@ void CodeGen::genLclHeap(GenTreePtr tree)
assert(regCnt == REG_NA);
if (compiler->info.compInitMem)
{
- assert(genCountBits(tmpRegsMask) == 0);
+ assert(tree->AvailableTempRegCount() == 0);
regCnt = targetReg;
}
else
{
- assert(genCountBits(tmpRegsMask) >= 1);
- regMaskTP regCntMask = genFindLowestBit(tmpRegsMask);
- tmpRegsMask &= ~regCntMask;
- regCnt = genRegNumFromMask(regCntMask);
+ regCnt = tree->ExtractTempReg();
}
}
@@ -2717,9 +2720,7 @@ void CodeGen::genLclHeap(GenTreePtr tree)
// This is a harmless trick to avoid the emitter trying to track the
// decrement of the ESP - we do the subtraction in another reg instead
// of adjusting ESP directly.
- assert(tmpRegsMask != RBM_NONE);
- assert(genCountBits(tmpRegsMask) == 1);
- regNumber regTmp = genRegNumFromMask(tmpRegsMask);
+ regNumber regTmp = tree->GetSingleTempReg();
inst_RV_RV(INS_mov, regTmp, REG_SPBASE, TYP_I_IMPL);
inst_RV_IV(INS_sub, regTmp, compiler->eeGetPageSize(), EA_PTRSIZE);
@@ -2922,13 +2923,8 @@ void CodeGen::genCodeForInitBlkUnroll(GenTreeBlk* initBlkNode)
// Perform an unroll using SSE2 loads and stores.
if (size >= XMM_REGSIZE_BYTES)
{
- regNumber tmpReg = genRegNumFromMask(initBlkNode->gtRsvdRegs);
-
-#ifdef DEBUG
- assert(initBlkNode->gtRsvdRegs != RBM_NONE);
- assert(genCountBits(initBlkNode->gtRsvdRegs) == 1);
+ regNumber tmpReg = initBlkNode->GetSingleTempReg();
assert(genIsValidFloatReg(tmpReg));
-#endif // DEBUG
if (initVal->gtIntCon.gtIconVal != 0)
{
@@ -3122,8 +3118,7 @@ void CodeGen::genCodeForCpBlkUnroll(GenTreeBlk* cpBlkNode)
if (size >= XMM_REGSIZE_BYTES)
{
- assert(cpBlkNode->gtRsvdRegs != RBM_NONE);
- regNumber xmmReg = genRegNumFromMask(cpBlkNode->gtRsvdRegs & RBM_ALLFLOAT);
+ regNumber xmmReg = cpBlkNode->GetSingleTempReg(RBM_ALLFLOAT);
assert(genIsValidFloatReg(xmmReg));
size_t slots = size / XMM_REGSIZE_BYTES;
@@ -3144,7 +3139,7 @@ void CodeGen::genCodeForCpBlkUnroll(GenTreeBlk* cpBlkNode)
if ((size & 0xf) != 0)
{
// Grab the integer temp register to emit the remaining loads and stores.
- regNumber tmpReg = genRegNumFromMask(cpBlkNode->gtRsvdRegs & RBM_ALLINT);
+ regNumber tmpReg = cpBlkNode->GetSingleTempReg(RBM_ALLINT);
if ((size & 8) != 0)
{
@@ -3390,22 +3385,22 @@ void CodeGen::genStructPutArgUnroll(GenTreePutArgStk* putArgNode)
// less than 16 bytes, we will just be using pushes
if (size >= 8)
{
- xmmTmpReg = genRegNumFromMask(putArgNode->gtRsvdRegs & RBM_ALLFLOAT);
+ xmmTmpReg = putArgNode->GetSingleTempReg(RBM_ALLFLOAT);
longTmpReg = xmmTmpReg;
}
if ((size & 0x7) != 0)
{
- intTmpReg = genRegNumFromMask(putArgNode->gtRsvdRegs & RBM_ALLINT);
+ intTmpReg = putArgNode->GetSingleTempReg(RBM_ALLINT);
}
#else // !_TARGET_X86_
// On x64 we use an XMM register only for 16-byte chunks.
if (size >= XMM_REGSIZE_BYTES)
{
- xmmTmpReg = genRegNumFromMask(putArgNode->gtRsvdRegs & RBM_ALLFLOAT);
+ xmmTmpReg = putArgNode->GetSingleTempReg(RBM_ALLFLOAT);
}
if ((size & 0xf) != 0)
{
- intTmpReg = genRegNumFromMask(putArgNode->gtRsvdRegs & RBM_ALLINT);
+ intTmpReg = putArgNode->GetSingleTempReg(RBM_ALLINT);
longTmpReg = intTmpReg;
}
#endif // !_TARGET_X86_
@@ -3418,7 +3413,6 @@ void CodeGen::genStructPutArgUnroll(GenTreePutArgStk* putArgNode)
#ifdef _TARGET_X86_
assert(!m_pushStkArg);
#endif // _TARGET_X86_
- assert(putArgNode->gtRsvdRegs != RBM_NONE);
size_t slots = size / XMM_REGSIZE_BYTES;
assert(putArgNode->gtGetOp1()->isContained());
@@ -3578,7 +3572,6 @@ void CodeGen::genCodeForCpObj(GenTreeObj* cpObjNode)
bool dstOnStack = dstAddr->OperIsLocalAddr();
#ifdef DEBUG
- bool isRepMovspUsed = false;
assert(dstAddr->isUsedFromReg());
@@ -3629,13 +3622,9 @@ void CodeGen::genCodeForCpObj(GenTreeObj* cpObjNode)
{
if (slots >= CPOBJ_NONGC_SLOTS_LIMIT)
{
-#ifdef DEBUG
// If the destination of the CpObj is on the stack, make sure we allocated
// RCX to emit the movsp (alias for movsd or movsq for 32 and 64 bits respectively).
assert((cpObjNode->gtRsvdRegs & RBM_RCX) != 0);
- regNumber tmpReg = REG_RCX;
- isRepMovspUsed = true;
-#endif // DEBUG
getEmitter()->emitIns_R_I(INS_mov, EA_4BYTE, REG_RCX, slots);
instGen(INS_r_movsp);
@@ -3685,13 +3674,10 @@ void CodeGen::genCodeForCpObj(GenTreeObj* cpObjNode)
}
else
{
-#ifdef DEBUG
// Otherwise, we can save code-size and improve CQ by emitting
// rep movsp (alias for movsd/movsq for x86/x64)
assert((cpObjNode->gtRsvdRegs & RBM_RCX) != 0);
- regNumber tmpReg = REG_RCX;
- isRepMovspUsed = true;
-#endif // DEBUG
+
getEmitter()->emitIns_R_I(INS_mov, EA_4BYTE, REG_RCX, nonGcSlotCount);
instGen(INS_r_movsp);
}
@@ -3767,7 +3753,7 @@ void CodeGen::genTableBasedSwitch(GenTree* treeNode)
regNumber idxReg = treeNode->gtOp.gtOp1->gtRegNum;
regNumber baseReg = treeNode->gtOp.gtOp2->gtRegNum;
- regNumber tmpReg = genRegNumFromMask(treeNode->gtRsvdRegs);
+ regNumber tmpReg = treeNode->GetSingleTempReg();
// load the ip-relative offset (which is relative to start of fgFirstBB)
getEmitter()->emitIns_R_ARX(INS_mov, EA_4BYTE, baseReg, baseReg, idxReg, 4, 0);
@@ -4057,8 +4043,7 @@ void CodeGen::genCodeForArrOffset(GenTreeArrOffs* arrOffset)
offsetReg = genConsumeReg(offsetNode);
// We will use a temp register for the offset*scale+effectiveIndex computation.
- regMaskTP tmpRegMask = arrOffset->gtRsvdRegs;
- tmpReg = genRegNumFromMask(tmpRegMask);
+ tmpReg = arrOffset->GetSingleTempReg();
}
else
{
@@ -5006,9 +4991,10 @@ void CodeGen::genCallInstruction(GenTreeCall* call)
}
#if defined(_TARGET_X86_)
- bool fCallerPop = (call->gtFlags & GTF_CALL_POP_ARGS) != 0;
+ bool fCallerPop = call->CallerPop();
#ifdef UNIX_X86_ABI
+ if (!call->IsUnmanaged())
{
CorInfoCallConv callConv = CORINFO_CALLCONV_DEFAULT;
@@ -6371,7 +6357,7 @@ void CodeGen::genSetRegToCond(regNumber dstReg, GenTreePtr tree)
#if !defined(_TARGET_64BIT_)
//------------------------------------------------------------------------
-// genIntToIntCast: Generate code for long to int casts on x86.
+// genLongToIntCast: Generate code for long to int casts on x86.
//
// Arguments:
// cast - The GT_CAST node
@@ -6481,14 +6467,15 @@ void CodeGen::genIntToIntCast(GenTreePtr treeNode)
GenTreePtr castOp = treeNode->gtCast.CastOp();
var_types srcType = genActualType(castOp->TypeGet());
+ noway_assert(genTypeSize(srcType) >= 4);
-#if !defined(_TARGET_64BIT_)
+#ifdef _TARGET_X86_
if (varTypeIsLong(srcType))
{
genLongToIntCast(treeNode);
return;
}
-#endif // !defined(_TARGET_64BIT_)
+#endif // _TARGET_X86_
regNumber targetReg = treeNode->gtRegNum;
regNumber sourceReg = castOp->gtRegNum;
@@ -6504,18 +6491,17 @@ void CodeGen::genIntToIntCast(GenTreePtr treeNode)
}
bool requiresOverflowCheck = false;
- bool needAndAfter = false;
assert(genIsValidIntReg(targetReg));
assert(genIsValidIntReg(sourceReg));
- instruction ins = INS_invalid;
- emitAttr size = EA_UNKNOWN;
+ instruction ins = INS_invalid;
+ emitAttr srcSize = EA_ATTR(genTypeSize(srcType));
+ emitAttr dstSize = EA_ATTR(genTypeSize(dstType));
- if (genTypeSize(srcType) < genTypeSize(dstType))
+ if (srcSize < dstSize)
{
// Widening cast
-
// Is this an Overflow checking cast?
// We only need to handle one case, as the other casts can never overflow.
// cast from TYP_INT to TYP_ULONG
@@ -6523,14 +6509,11 @@ void CodeGen::genIntToIntCast(GenTreePtr treeNode)
if (treeNode->gtOverflow() && (srcType == TYP_INT) && (dstType == TYP_ULONG))
{
requiresOverflowCheck = true;
- size = EA_ATTR(genTypeSize(srcType));
ins = INS_mov;
}
else
{
- // we need the source size
- size = EA_ATTR(genTypeSize(srcType));
- noway_assert(size < EA_PTRSIZE);
+ noway_assert(srcSize < EA_PTRSIZE);
ins = ins_Move_Extend(srcType, castOp->InReg());
@@ -6540,7 +6523,7 @@ void CodeGen::genIntToIntCast(GenTreePtr treeNode)
64-bit, and a regular 32-bit mov clears the high 32 bits (like the non-existant movzxd),
but for a sign extension from TYP_INT to TYP_LONG, we need to use movsxd opcode.
*/
- if (!isUnsignedSrc && !isUnsignedDst && (size == EA_4BYTE) && (genTypeSize(dstType) > EA_4BYTE))
+ if (!isUnsignedSrc && !isUnsignedDst)
{
#ifdef _TARGET_X86_
NYI_X86("Cast to 64 bit for x86/RyuJIT");
@@ -6548,36 +6531,22 @@ void CodeGen::genIntToIntCast(GenTreePtr treeNode)
ins = INS_movsxd;
#endif // !_TARGET_X86_
}
-
- /*
- Special case: for a cast of byte to char we first
- have to expand the byte (w/ sign extension), then
- mask off the high bits.
- Use 'movsx' followed by 'and'
- */
- if (!isUnsignedSrc && isUnsignedDst && (genTypeSize(dstType) < EA_4BYTE))
- {
- noway_assert(genTypeSize(dstType) == EA_2BYTE && size == EA_1BYTE);
- needAndAfter = true;
- }
}
}
else
{
// Narrowing cast, or sign-changing cast
- noway_assert(genTypeSize(srcType) >= genTypeSize(dstType));
+ noway_assert(srcSize >= dstSize);
// Is this an Overflow checking cast?
if (treeNode->gtOverflow())
{
requiresOverflowCheck = true;
- size = EA_ATTR(genTypeSize(srcType));
ins = INS_mov;
}
else
{
- size = EA_ATTR(genTypeSize(dstType));
- ins = ins_Move_Extend(dstType, castOp->InReg());
+ ins = ins_Move_Extend(dstType, castOp->InReg());
}
}
@@ -6659,36 +6628,26 @@ void CodeGen::genIntToIntCast(GenTreePtr treeNode)
if (signCheckOnly)
{
// We only need to check for a negative value in sourceReg
- inst_RV_IV(INS_cmp, sourceReg, 0, size);
+ inst_RV_IV(INS_cmp, sourceReg, 0, srcSize);
genJumpToThrowHlpBlk(EJ_jl, SCK_OVERFLOW);
}
else
{
- regNumber tmpReg = REG_NA;
-
- if (needScratchReg)
- {
- // We need an additional temp register
- // Make sure we have exactly one allocated.
- assert(treeNode->gtRsvdRegs != RBM_NONE);
- assert(genCountBits(treeNode->gtRsvdRegs) == 1);
- tmpReg = genRegNumFromMask(treeNode->gtRsvdRegs);
- }
-
// When we are converting from unsigned or to unsigned, we
// will only have to check for any bits set using 'typeMask'
if (isUnsignedSrc || isUnsignedDst)
{
if (needScratchReg)
{
+ regNumber tmpReg = treeNode->GetSingleTempReg();
inst_RV_RV(INS_mov, tmpReg, sourceReg, TYP_LONG); // Move the 64-bit value to a writeable temp reg
- inst_RV_SH(INS_SHIFT_RIGHT_LOGICAL, size, tmpReg, 32); // Shift right by 32 bits
- genJumpToThrowHlpBlk(EJ_jne, SCK_OVERFLOW); // Thow if result shift is non-zero
+ inst_RV_SH(INS_SHIFT_RIGHT_LOGICAL, srcSize, tmpReg, 32); // Shift right by 32 bits
+ genJumpToThrowHlpBlk(EJ_jne, SCK_OVERFLOW); // Throw if result shift is non-zero
}
else
{
noway_assert(typeMask != 0);
- inst_RV_IV(INS_TEST, sourceReg, typeMask, size);
+ inst_RV_IV(INS_TEST, sourceReg, typeMask, srcSize);
genJumpToThrowHlpBlk(EJ_jne, SCK_OVERFLOW);
}
}
@@ -6702,12 +6661,12 @@ void CodeGen::genIntToIntCast(GenTreePtr treeNode)
noway_assert((typeMin != 0) && (typeMax != 0));
- inst_RV_IV(INS_cmp, sourceReg, typeMax, size);
+ inst_RV_IV(INS_cmp, sourceReg, typeMax, srcSize);
genJumpToThrowHlpBlk(EJ_jg, SCK_OVERFLOW);
// Compare with the MIN
- inst_RV_IV(INS_cmp, sourceReg, typeMin, size);
+ inst_RV_IV(INS_cmp, sourceReg, typeMin, srcSize);
genJumpToThrowHlpBlk(EJ_jl, SCK_OVERFLOW);
}
}
@@ -6717,15 +6676,13 @@ void CodeGen::genIntToIntCast(GenTreePtr treeNode)
// On amd64, we can hit this path for a same-register
// 4-byte to 8-byte widening conversion, and need to
// emit the instruction to set the high bits correctly.
- || (EA_ATTR(genTypeSize(dstType)) == EA_8BYTE && EA_ATTR(genTypeSize(srcType)) == EA_4BYTE)
+ || (dstSize == EA_8BYTE && srcSize == EA_4BYTE)
#endif // _TARGET_AMD64_
)
- inst_RV_RV(ins, targetReg, sourceReg, srcType, size);
+ inst_RV_RV(ins, targetReg, sourceReg, srcType, srcSize);
}
else // non-overflow checking cast
{
- noway_assert(size < EA_PTRSIZE || srcType == dstType);
-
// We may have code transformations that result in casts where srcType is the same as dstType.
// e.g. Bug 824281, in which a comma is split by the rationalizer, leaving an assignment of a
// long constant to a long lclVar.
@@ -6734,7 +6691,7 @@ void CodeGen::genIntToIntCast(GenTreePtr treeNode)
ins = INS_mov;
}
/* Is the value sitting in a non-byte-addressable register? */
- else if (castOp->InReg() && (size == EA_1BYTE) && !isByteReg(sourceReg))
+ else if (castOp->InReg() && (dstSize == EA_1BYTE) && !isByteReg(sourceReg))
{
if (isUnsignedDst)
{
@@ -6750,21 +6707,21 @@ void CodeGen::genIntToIntCast(GenTreePtr treeNode)
/* Generate "mov targetReg, castOp->gtReg */
if (targetReg != sourceReg)
{
- inst_RV_RV(INS_mov, targetReg, sourceReg, srcType);
+ inst_RV_RV(INS_mov, targetReg, sourceReg, srcType, srcSize);
}
}
if (ins == INS_AND)
{
- noway_assert((needAndAfter == false) && isUnsignedDst);
+ noway_assert(isUnsignedDst);
/* Generate "and reg, MASK */
unsigned fillPattern;
- if (size == EA_1BYTE)
+ if (dstSize == EA_1BYTE)
{
fillPattern = 0xff;
}
- else if (size == EA_2BYTE)
+ else if (dstSize == EA_2BYTE)
{
fillPattern = 0xffff;
}
@@ -6778,37 +6735,29 @@ void CodeGen::genIntToIntCast(GenTreePtr treeNode)
#ifdef _TARGET_AMD64_
else if (ins == INS_movsxd)
{
- noway_assert(!needAndAfter);
- inst_RV_RV(ins, targetReg, sourceReg, srcType, size);
+ inst_RV_RV(ins, targetReg, sourceReg, srcType, srcSize);
}
#endif // _TARGET_AMD64_
else if (ins == INS_mov)
{
- noway_assert(!needAndAfter);
if (targetReg != sourceReg
#ifdef _TARGET_AMD64_
// On amd64, 'mov' is the opcode used to zero-extend from
// 4 bytes to 8 bytes.
- || (EA_ATTR(genTypeSize(dstType)) == EA_8BYTE && EA_ATTR(genTypeSize(srcType)) == EA_4BYTE)
+ || (dstSize == EA_8BYTE && srcSize == EA_4BYTE)
#endif // _TARGET_AMD64_
)
{
- inst_RV_RV(ins, targetReg, sourceReg, srcType, size);
+ inst_RV_RV(ins, targetReg, sourceReg, srcType, srcSize);
}
}
else
{
noway_assert(ins == INS_movsx || ins == INS_movzx);
+ noway_assert(srcSize >= dstSize);
/* Generate "mov targetReg, castOp->gtReg */
- inst_RV_RV(ins, targetReg, sourceReg, srcType, size);
-
- /* Mask off high bits for cast from byte to char */
- if (needAndAfter)
- {
- noway_assert(genTypeSize(dstType) == 2 && ins == INS_movsx);
- inst_RV_IV(INS_AND, targetReg, 0xFFFF, EA_4BYTE);
- }
+ inst_RV_RV(ins, targetReg, sourceReg, srcType, dstSize);
}
}
@@ -7089,9 +7038,7 @@ void CodeGen::genCkfinite(GenTreePtr treeNode)
regNumber targetReg = treeNode->gtRegNum;
// Extract exponent into a register.
- assert(treeNode->gtRsvdRegs != RBM_NONE);
- assert(genCountBits(treeNode->gtRsvdRegs) == 1);
- regNumber tmpReg = genRegNumFromMask(treeNode->gtRsvdRegs);
+ regNumber tmpReg = treeNode->GetSingleTempReg();
genConsumeReg(op1);
@@ -7397,10 +7344,7 @@ void CodeGen::genSSE2BitwiseOp(GenTreePtr treeNode)
}
// We need an additional register for bitmask.
- // Make sure we have one allocated.
- assert(treeNode->gtRsvdRegs != RBM_NONE);
- assert(genCountBits(treeNode->gtRsvdRegs) == 1);
- regNumber tmpReg = genRegNumFromMask(treeNode->gtRsvdRegs);
+ regNumber tmpReg = treeNode->GetSingleTempReg();
// Move operand into targetReg only if the reg reserved for
// internal purpose is not the same as targetReg.
@@ -7716,17 +7660,17 @@ void CodeGen::genPutArgStkFieldList(GenTreePutArgStk* putArgStk)
unsigned prevFieldOffset = currentOffset;
regNumber intTmpReg = REG_NA;
regNumber simdTmpReg = REG_NA;
- if (putArgStk->gtRsvdRegs != RBM_NONE)
+ if (putArgStk->AvailableTempRegCount() != 0)
{
regMaskTP rsvdRegs = putArgStk->gtRsvdRegs;
if ((rsvdRegs & RBM_ALLINT) != 0)
{
- intTmpReg = genRegNumFromMask(rsvdRegs & RBM_ALLINT);
+ intTmpReg = putArgStk->GetSingleTempReg(RBM_ALLINT);
assert(genIsValidIntReg(intTmpReg));
}
if ((rsvdRegs & RBM_ALLFLOAT) != 0)
{
- simdTmpReg = genRegNumFromMask(rsvdRegs & RBM_ALLFLOAT);
+ simdTmpReg = putArgStk->GetSingleTempReg(RBM_ALLFLOAT);
assert(genIsValidFloatReg(simdTmpReg));
}
assert(genCountBits(rsvdRegs) == (unsigned)((intTmpReg == REG_NA) ? 0 : 1) + ((simdTmpReg == REG_NA) ? 0 : 1));
diff --git a/src/jit/compiler.cpp b/src/jit/compiler.cpp
index 14b2abafb6..1c24b93abe 100644
--- a/src/jit/compiler.cpp
+++ b/src/jit/compiler.cpp
@@ -1134,6 +1134,170 @@ var_types Compiler::getReturnTypeForStruct(CORINFO_CLASS_HANDLE clsHnd,
return useType;
}
+///////////////////////////////////////////////////////////////////////////////
+//
+// MEASURE_NOWAY: code to measure and rank dynamic occurences of noway_assert.
+// (Just the appearances of noway_assert, whether the assert is true or false.)
+// This might help characterize the cost of noway_assert in non-DEBUG builds,
+// or determine which noway_assert should be simple DEBUG-only asserts.
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#if MEASURE_NOWAY
+
+struct FileLine
+{
+ char* m_file;
+ unsigned m_line;
+ char* m_condStr;
+
+ FileLine() : m_file(nullptr), m_line(0), m_condStr(nullptr)
+ {
+ }
+
+ FileLine(const char* file, unsigned line, const char* condStr) : m_line(line)
+ {
+ size_t newSize = (strlen(file) + 1) * sizeof(char);
+ m_file = (char*)HostAllocator::getHostAllocator()->Alloc(newSize);
+ strcpy_s(m_file, newSize, file);
+
+ newSize = (strlen(condStr) + 1) * sizeof(char);
+ m_condStr = (char*)HostAllocator::getHostAllocator()->Alloc(newSize);
+ strcpy_s(m_condStr, newSize, condStr);
+ }
+
+ FileLine(const FileLine& other)
+ {
+ m_file = other.m_file;
+ m_line = other.m_line;
+ m_condStr = other.m_condStr;
+ }
+
+ // GetHashCode() and Equals() are needed by SimplerHashTable
+
+ static unsigned GetHashCode(FileLine fl)
+ {
+ assert(fl.m_file != nullptr);
+ unsigned code = fl.m_line;
+ for (const char* p = fl.m_file; *p != '\0'; p++)
+ {
+ code += *p;
+ }
+ // Could also add condStr.
+ return code;
+ }
+
+ static bool Equals(FileLine fl1, FileLine fl2)
+ {
+ return (fl1.m_line == fl2.m_line) && (0 == strcmp(fl1.m_file, fl2.m_file));
+ }
+};
+
+typedef SimplerHashTable<FileLine, FileLine, size_t, JitSimplerHashBehavior> FileLineToCountMap;
+FileLineToCountMap* NowayAssertMap;
+
+void Compiler::RecordNowayAssert(const char* filename, unsigned line, const char* condStr)
+{
+ if (NowayAssertMap == nullptr)
+ {
+ NowayAssertMap = new (HostAllocator::getHostAllocator()) FileLineToCountMap(HostAllocator::getHostAllocator());
+ }
+ FileLine fl(filename, line, condStr);
+ size_t* pCount = NowayAssertMap->LookupPointer(fl);
+ if (pCount == nullptr)
+ {
+ NowayAssertMap->Set(fl, 1);
+ }
+ else
+ {
+ ++(*pCount);
+ }
+}
+
+void RecordNowayAssertGlobal(const char* filename, unsigned line, const char* condStr)
+{
+ if ((JitConfig.JitMeasureNowayAssert() == 1) && (JitTls::GetCompiler() != nullptr))
+ {
+ JitTls::GetCompiler()->RecordNowayAssert(filename, line, condStr);
+ }
+}
+
+struct NowayAssertCountMap
+{
+ size_t count;
+ FileLine fl;
+
+ NowayAssertCountMap() : count(0)
+ {
+ }
+
+ static int __cdecl compare(const void* elem1, const void* elem2)
+ {
+ NowayAssertCountMap* e1 = (NowayAssertCountMap*)elem1;
+ NowayAssertCountMap* e2 = (NowayAssertCountMap*)elem2;
+ return (int)((ssize_t)e2->count - (ssize_t)e1->count); // sort in descending order
+ }
+};
+
+void DisplayNowayAssertMap()
+{
+ if (NowayAssertMap != nullptr)
+ {
+ FILE* fout;
+
+ LPCWSTR strJitMeasureNowayAssertFile = JitConfig.JitMeasureNowayAssertFile();
+ if (strJitMeasureNowayAssertFile != nullptr)
+ {
+ fout = _wfopen(strJitMeasureNowayAssertFile, W("a"));
+ if (fout == nullptr)
+ {
+ fprintf(jitstdout, "Failed to open JitMeasureNowayAssertFile \"%ws\"\n", strJitMeasureNowayAssertFile);
+ return;
+ }
+ }
+ else
+ {
+ fout = jitstdout;
+ }
+
+ // Iterate noway assert map, create sorted table by occurrence, dump it.
+ unsigned count = NowayAssertMap->GetCount();
+ NowayAssertCountMap* nacp = new NowayAssertCountMap[count];
+ unsigned i = 0;
+
+ for (FileLineToCountMap::KeyIterator iter = NowayAssertMap->Begin(), end = NowayAssertMap->End();
+ !iter.Equal(end); ++iter)
+ {
+ nacp[i].count = iter.GetValue();
+ nacp[i].fl = iter.Get();
+ ++i;
+ }
+
+ qsort(nacp, count, sizeof(nacp[0]), NowayAssertCountMap::compare);
+
+ if (fout == jitstdout)
+ {
+ // Don't output the header if writing to a file, since we'll be appending to existing dumps in that case.
+ fprintf(fout, "\nnoway_assert counts:\n");
+ fprintf(fout, "count, file, line, text\n");
+ }
+
+ for (i = 0; i < count; i++)
+ {
+ fprintf(fout, "%u, %s, %u, \"%s\"\n", nacp[i].count, nacp[i].fl.m_file, nacp[i].fl.m_line,
+ nacp[i].fl.m_condStr);
+ }
+
+ if (fout != jitstdout)
+ {
+ fclose(fout);
+ fout = nullptr;
+ }
+ }
+}
+
+#endif // MEASURE_NOWAY
+
/*****************************************************************************
* variables to keep track of how many iterations we go in a dataflow pass
*/
@@ -1222,6 +1386,10 @@ void Compiler::compShutdown()
}
#endif // ALT_JIT
+#if MEASURE_NOWAY
+ DisplayNowayAssertMap();
+#endif // MEASURE_NOWAY
+
ArenaAllocator::shutdown();
/* Shut down the emitter */
@@ -2414,6 +2582,7 @@ bool Compiler::compShouldThrowOnNoway(
#ifdef FEATURE_TRACELOGGING
compJitTelemetry.NotifyNowayAssert(filename, line);
#endif
+
// In min opts, we don't want the noway assert to go through the exception
// path. Instead we want it to just silently go through codegen for
// compat reasons.
diff --git a/src/jit/compiler.h b/src/jit/compiler.h
index 9ca0e1a3e1..998b647702 100644
--- a/src/jit/compiler.h
+++ b/src/jit/compiler.h
@@ -1218,13 +1218,13 @@ struct fgArgTabEntry
regNumber otherRegNum; // The (second) register to use when passing this argument.
SYSTEMV_AMD64_CORINFO_STRUCT_REG_PASSING_DESCRIPTOR structDesc;
-#elif defined(_TARGET_X86_)
+#elif !defined(_TARGET_64BIT_)
__declspec(property(get = getIsStruct)) bool isStruct;
bool getIsStruct()
{
return varTypeIsStruct(node);
}
-#endif // _TARGET_X86_
+#endif // !_TARGET_64BIT_
#ifdef _TARGET_ARM_
void SetIsHfaRegArg(bool hfaRegArg)
@@ -2875,13 +2875,10 @@ protected:
bool impILConsumesAddr(const BYTE* codeAddr, CORINFO_METHOD_HANDLE fncHandle, CORINFO_MODULE_HANDLE scpHandle);
void impResolveToken(const BYTE* addr, CORINFO_RESOLVED_TOKEN* pResolvedToken, CorInfoTokenKind kind);
- void impPushOnStackNoType(GenTreePtr tree);
void impPushOnStack(GenTreePtr tree, typeInfo ti);
- void impPushNullObjRefOnStack();
- StackEntry impPopStack();
- StackEntry impPopStack(CORINFO_CLASS_HANDLE& structTypeRet);
- GenTreePtr impPopStack(typeInfo& ti);
+ void impPushNullObjRefOnStack();
+ StackEntry impPopStack();
StackEntry& impStackTop(unsigned n = 0);
unsigned impStackHeight();
@@ -9074,6 +9071,10 @@ public:
// Is the compilation in a full trust context?
bool compIsFullTrust();
+#if MEASURE_NOWAY
+ void RecordNowayAssert(const char* filename, unsigned line, const char* condStr);
+#endif // MEASURE_NOWAY
+
#ifndef FEATURE_TRACELOGGING
// Should we actually fire the noway assert body and the exception handler?
bool compShouldThrowOnNoway();
@@ -9475,6 +9476,7 @@ const instruction INS_XOR = INS_eor;
const instruction INS_NEG = INS_rsb;
const instruction INS_TEST = INS_tst;
const instruction INS_MUL = INS_mul;
+const instruction INS_MULADD = INS_mla;
const instruction INS_SIGNED_DIVIDE = INS_sdiv;
const instruction INS_UNSIGNED_DIVIDE = INS_udiv;
const instruction INS_BREAKPOINT = INS_bkpt;
@@ -9500,6 +9502,7 @@ const instruction INS_XOR = INS_eor;
const instruction INS_NEG = INS_neg;
const instruction INS_TEST = INS_tst;
const instruction INS_MUL = INS_mul;
+const instruction INS_MULADD = INS_madd;
const instruction INS_SIGNED_DIVIDE = INS_sdiv;
const instruction INS_UNSIGNED_DIVIDE = INS_udiv;
const instruction INS_BREAKPOINT = INS_bkpt;
diff --git a/src/jit/compiler.hpp b/src/jit/compiler.hpp
index 88c082d499..959db68a94 100644
--- a/src/jit/compiler.hpp
+++ b/src/jit/compiler.hpp
@@ -4686,141 +4686,6 @@ inline char* regMaskIntToString(regMaskTP mask, Compiler* context)
#endif // DEBUG
-inline void BasicBlock::InitVarSets(Compiler* comp)
-{
- VarSetOps::AssignNoCopy(comp, bbVarUse, VarSetOps::MakeEmpty(comp));
- VarSetOps::AssignNoCopy(comp, bbVarDef, VarSetOps::MakeEmpty(comp));
- VarSetOps::AssignNoCopy(comp, bbLiveIn, VarSetOps::MakeEmpty(comp));
- VarSetOps::AssignNoCopy(comp, bbLiveOut, VarSetOps::MakeEmpty(comp));
- VarSetOps::AssignNoCopy(comp, bbScope, VarSetOps::MakeEmpty(comp));
-
- bbMemoryUse = emptyMemoryKindSet;
- bbMemoryDef = emptyMemoryKindSet;
- bbMemoryLiveIn = emptyMemoryKindSet;
- bbMemoryLiveOut = emptyMemoryKindSet;
-}
-
-// Returns true if the basic block ends with GT_JMP
-inline bool BasicBlock::endsWithJmpMethod(Compiler* comp)
-{
- if (comp->compJmpOpUsed && (bbJumpKind == BBJ_RETURN) && (bbFlags & BBF_HAS_JMP))
- {
- GenTree* lastNode = this->lastNode();
- assert(lastNode != nullptr);
- return lastNode->OperGet() == GT_JMP;
- }
-
- return false;
-}
-
-// Returns true if the basic block ends with either
-// i) GT_JMP or
-// ii) tail call (implicit or explicit)
-//
-// Params:
-// comp - Compiler instance
-// fastTailCallsOnly - Only consider fast tail calls excluding tail calls via helper.
-inline bool BasicBlock::endsWithTailCallOrJmp(Compiler* comp, bool fastTailCallsOnly /*=false*/)
-{
- GenTreePtr tailCall = nullptr;
- bool tailCallsConvertibleToLoopOnly = false;
- return endsWithJmpMethod(comp) ||
- endsWithTailCall(comp, fastTailCallsOnly, tailCallsConvertibleToLoopOnly, &tailCall);
-}
-
-//------------------------------------------------------------------------------
-// endsWithTailCall : Check if the block ends with a tail call.
-//
-// Arguments:
-// comp - compiler instance
-// fastTailCallsOnly - check for fast tail calls only
-// tailCallsConvertibleToLoopOnly - check for tail calls convertible to loop only
-// tailCall - a pointer to a tree that will be set to the call tree if the block
-// ends with a tail call and will be set to nullptr otherwise.
-//
-// Return Value:
-// true if the block ends with a tail call; false otherwise.
-//
-// Notes:
-// At most one of fastTailCallsOnly and tailCallsConvertibleToLoopOnly flags can be true.
-
-inline bool BasicBlock::endsWithTailCall(Compiler* comp,
- bool fastTailCallsOnly,
- bool tailCallsConvertibleToLoopOnly,
- GenTree** tailCall)
-{
- assert(!fastTailCallsOnly || !tailCallsConvertibleToLoopOnly);
- *tailCall = nullptr;
- bool result = false;
-
- // Is this a tail call?
- // The reason for keeping this under RyuJIT is so as not to impact existing Jit32 x86 and arm
- // targets.
- if (comp->compTailCallUsed)
- {
- if (fastTailCallsOnly || tailCallsConvertibleToLoopOnly)
- {
- // Only fast tail calls or only tail calls convertible to loops
- result = (bbFlags & BBF_HAS_JMP) && (bbJumpKind == BBJ_RETURN);
- }
- else
- {
- // Fast tail calls, tail calls convertible to loops, and tails calls dispatched via helper
- result = (bbJumpKind == BBJ_THROW) || ((bbFlags & BBF_HAS_JMP) && (bbJumpKind == BBJ_RETURN));
- }
-
- if (result)
- {
- GenTree* lastNode = this->lastNode();
- if (lastNode->OperGet() == GT_CALL)
- {
- GenTreeCall* call = lastNode->AsCall();
- if (tailCallsConvertibleToLoopOnly)
- {
- result = call->IsTailCallConvertibleToLoop();
- }
- else if (fastTailCallsOnly)
- {
- result = call->IsFastTailCall();
- }
- else
- {
- result = call->IsTailCall();
- }
-
- if (result)
- {
- *tailCall = call;
- }
- }
- else
- {
- result = false;
- }
- }
- }
-
- return result;
-}
-
-//------------------------------------------------------------------------------
-// endsWithTailCallConvertibleToLoop : Check if the block ends with a tail call convertible to loop.
-//
-// Arguments:
-// comp - compiler instance
-// tailCall - a pointer to a tree that will be set to the call tree if the block
-// ends with a tail call convertible to loop and will be set to nullptr otherwise.
-//
-// Return Value:
-// true if the block ends with a tail call convertible to loop.
-
-inline bool BasicBlock::endsWithTailCallConvertibleToLoop(Compiler* comp, GenTree** tailCall)
-{
- bool fastTailCallsOnly = false;
- bool tailCallsConvertibleToLoopOnly = true;
- return endsWithTailCall(comp, fastTailCallsOnly, tailCallsConvertibleToLoopOnly, tailCall);
-}
-
inline static bool StructHasOverlappingFields(DWORD attribs)
{
return ((attribs & CORINFO_FLG_OVERLAPPING_FIELDS) != 0);
diff --git a/src/jit/dataflow.h b/src/jit/dataflow.h
index c9803a0cc1..615a5d1494 100644
--- a/src/jit/dataflow.h
+++ b/src/jit/dataflow.h
@@ -70,11 +70,9 @@ void DataFlow::ForwardAnalysis(TCallback& callback)
if (callback.EndMerge(block))
{
- AllSuccessorIter succsBegin = block->GetAllSuccs(m_pCompiler).begin();
- AllSuccessorIter succsEnd = block->GetAllSuccs(m_pCompiler).end();
- for (AllSuccessorIter succ = succsBegin; succ != succsEnd; ++succ)
+ for (BasicBlock* succ : block->GetAllSuccs(m_pCompiler))
{
- worklist.insert(worklist.end(), *succ);
+ worklist.insert(worklist.end(), succ);
}
}
}
diff --git a/src/jit/emitarm.cpp b/src/jit/emitarm.cpp
index 53ee88b3a2..2b8eb25bc2 100644
--- a/src/jit/emitarm.cpp
+++ b/src/jit/emitarm.cpp
@@ -7568,9 +7568,7 @@ void emitter::emitInsLoadStoreOp(instruction ins, emitAttr attr, regNumber dataR
if (offset != 0)
{
- regMaskTP tmpRegMask = indir->gtRsvdRegs;
- regNumber tmpReg = genRegNumFromMask(tmpRegMask);
- noway_assert(tmpReg != REG_NA);
+ regNumber tmpReg = indir->GetSingleTempReg();
if (emitIns_valid_imm_for_add(offset, INS_FLAGS_DONT_CARE))
{
@@ -7632,9 +7630,7 @@ void emitter::emitInsLoadStoreOp(instruction ins, emitAttr attr, regNumber dataR
else
{
// We require a tmpReg to hold the offset
- regMaskTP tmpRegMask = indir->gtRsvdRegs;
- regNumber tmpReg = genRegNumFromMask(tmpRegMask);
- noway_assert(tmpReg != REG_NA);
+ regNumber tmpReg = indir->GetSingleTempReg();
// First load/store tmpReg with the large offset constant
codeGen->instGen_Set_Reg_To_Imm(EA_PTRSIZE, tmpReg, offset);
@@ -7684,8 +7680,6 @@ regNumber emitter::emitInsBinary(instruction ins, emitAttr attr, GenTree* dst, G
regNumber emitter::emitInsTernary(instruction ins, emitAttr attr, GenTree* dst, GenTree* src1, GenTree* src2)
{
- regNumber result = REG_NA;
-
// dst can only be a reg
assert(!dst->isContained());
@@ -7732,120 +7726,85 @@ regNumber emitter::emitInsTernary(instruction ins, emitAttr attr, GenTree* dst,
assert(!src1->isContained());
}
}
- bool isMulOverflow = false;
- bool isUnsignedMul = false;
- regNumber extraReg = REG_NA;
+
+ insFlags flags = INS_FLAGS_DONT_CARE;
+ bool isMulOverflow = false;
if (dst->gtOverflowEx())
{
- NYI_ARM("emitInsTernary overflow");
-#if 0
- if (ins == INS_add)
- {
- ins = INS_adds;
- }
- else if (ins == INS_sub)
+ if ((ins == INS_add) || (ins == INS_adc) || (ins == INS_sub) || (ins == INS_sbc))
{
- ins = INS_subs;
+ flags = INS_FLAGS_SET;
}
else if (ins == INS_mul)
{
isMulOverflow = true;
- isUnsignedMul = ((dst->gtFlags & GTF_UNSIGNED) != 0);
assert(intConst == nullptr); // overflow format doesn't support an int constant operand
}
else
{
assert(!"Invalid ins for overflow check");
}
-#endif
}
if (intConst != nullptr)
{
- emitIns_R_R_I(ins, attr, dst->gtRegNum, nonIntReg->gtRegNum, intConst->IconValue());
+ emitIns_R_R_I(ins, attr, dst->gtRegNum, nonIntReg->gtRegNum, intConst->IconValue(), flags);
}
else
{
if (isMulOverflow)
{
- NYI_ARM("emitInsTernary overflow");
-#if 0
- // Make sure that we have an internal register
- assert(genCountBits(dst->gtRsvdRegs) == 2);
+ regNumber extraReg = dst->GetSingleTempReg();
+ assert(extraReg != dst->gtRegNum);
- // There will be two bits set in tmpRegsMask.
- // Remove the bit for 'dst->gtRegNum' from 'tmpRegsMask'
- regMaskTP tmpRegsMask = dst->gtRsvdRegs & ~genRegMask(dst->gtRegNum);
- assert(tmpRegsMask != RBM_NONE);
- regMaskTP tmpRegMask = genFindLowestBit(tmpRegsMask); // set tmpRegMsk to a one-bit mask
- extraReg = genRegNumFromMask(tmpRegMask); // set tmpReg from that mask
-
- if (isUnsignedMul)
+ if ((dst->gtFlags & GTF_UNSIGNED) != 0)
{
- if (attr == EA_4BYTE)
- {
- // Compute 8 byte results from 4 byte by 4 byte multiplication.
- emitIns_R_R_R(INS_umull, EA_8BYTE, dst->gtRegNum, src1->gtRegNum, src2->gtRegNum);
+ // Compute 8 byte result from 4 byte by 4 byte multiplication.
+ emitIns_R_R_R_R(INS_umull, EA_4BYTE, dst->gtRegNum, extraReg, src1->gtRegNum, src2->gtRegNum);
- // Get the high result by shifting dst.
- emitIns_R_R_I(INS_lsr, EA_8BYTE, extraReg, dst->gtRegNum, 32);
- }
- else
- {
- assert(attr == EA_8BYTE);
- // Compute the high result.
- emitIns_R_R_R(INS_umulh, attr, extraReg, src1->gtRegNum, src2->gtRegNum);
-
- // Now multiply without skewing the high result.
- emitIns_R_R_R(ins, attr, dst->gtRegNum, src1->gtRegNum, src2->gtRegNum);
- }
-
- // zero-sign bit comparision to detect overflow.
+ // Overflow exists if the result's high word is non-zero.
emitIns_R_I(INS_cmp, attr, extraReg, 0);
}
else
{
- int bitShift = 0;
- if (attr == EA_4BYTE)
- {
- // Compute 8 byte results from 4 byte by 4 byte multiplication.
- emitIns_R_R_R(INS_smull, EA_8BYTE, dst->gtRegNum, src1->gtRegNum, src2->gtRegNum);
-
- // Get the high result by shifting dst.
- emitIns_R_R_I(INS_lsr, EA_8BYTE, extraReg, dst->gtRegNum, 32);
-
- bitShift = 31;
- }
- else
- {
- assert(attr == EA_8BYTE);
- // Save the high result in a temporary register.
- emitIns_R_R_R(INS_smulh, attr, extraReg, src1->gtRegNum, src2->gtRegNum);
-
- // Now multiply without skewing the high result.
- emitIns_R_R_R(ins, attr, dst->gtRegNum, src1->gtRegNum, src2->gtRegNum);
-
- bitShift = 63;
- }
+ // Compute 8 byte result from 4 byte by 4 byte multiplication.
+ emitIns_R_R_R_R(INS_smull, EA_4BYTE, dst->gtRegNum, extraReg, src1->gtRegNum, src2->gtRegNum);
- // Sign bit comparision to detect overflow.
- emitIns_R_R_I(INS_cmp, attr, extraReg, dst->gtRegNum, bitShift, INS_OPTS_ASR);
+ // Overflow exists if the result's high word is not merely a sign bit.
+ emitIns_R_R_I(INS_cmp, attr, extraReg, dst->gtRegNum, 31, INS_FLAGS_DONT_CARE, INS_OPTS_ASR);
}
-#endif
}
else
{
- // We can just multiply.
- emitIns_R_R_R(ins, attr, dst->gtRegNum, src1->gtRegNum, src2->gtRegNum);
+ // We can just do the arithmetic, setting the flags if needed.
+ emitIns_R_R_R(ins, attr, dst->gtRegNum, src1->gtRegNum, src2->gtRegNum, flags);
}
}
if (dst->gtOverflowEx())
{
- NYI_ARM("emitInsTernary overflow");
-#if 0
assert(!varTypeIsFloating(dst));
- codeGen->genCheckOverflow(dst);
-#endif
+
+ emitJumpKind jumpKind;
+
+ if (dst->OperGet() == GT_MUL)
+ {
+ jumpKind = EJ_ne;
+ }
+ else
+ {
+ bool isUnsignedOverflow = ((dst->gtFlags & GTF_UNSIGNED) != 0);
+ jumpKind = isUnsignedOverflow ? EJ_lo : EJ_vs;
+ if (jumpKind == EJ_lo)
+ {
+ if ((dst->OperGet() != GT_SUB) && (dst->OperGet() != GT_ASG_SUB) && (dst->OperGet() != GT_SUB_HI))
+ {
+ jumpKind = EJ_hs;
+ }
+ }
+ }
+
+ // Jump to the block which will throw the exception.
+ codeGen->genJumpToThrowHlpBlk(jumpKind, SCK_OVERFLOW);
}
return dst->gtRegNum;
diff --git a/src/jit/emitarm64.cpp b/src/jit/emitarm64.cpp
index 93994e7918..0328cb6712 100644
--- a/src/jit/emitarm64.cpp
+++ b/src/jit/emitarm64.cpp
@@ -10809,9 +10809,7 @@ void emitter::emitInsLoadStoreOp(instruction ins, emitAttr attr, regNumber dataR
if (offset != 0)
{
- regMaskTP tmpRegMask = indir->gtRsvdRegs;
- regNumber tmpReg = genRegNumFromMask(tmpRegMask);
- noway_assert(tmpReg != REG_NA);
+ regNumber tmpReg = indir->GetSingleTempReg();
emitAttr addType = varTypeIsGC(memBase) ? EA_BYREF : EA_PTRSIZE;
@@ -10833,7 +10831,6 @@ void emitter::emitInsLoadStoreOp(instruction ins, emitAttr attr, regNumber dataR
// Then load/store dataReg from/to [tmpReg + offset]
emitIns_R_R_I(ins, ldstAttr, dataReg, tmpReg, offset);
- ;
}
else // large offset
{
@@ -10874,9 +10871,7 @@ void emitter::emitInsLoadStoreOp(instruction ins, emitAttr attr, regNumber dataR
else
{
// We require a tmpReg to hold the offset
- regMaskTP tmpRegMask = indir->gtRsvdRegs;
- regNumber tmpReg = genRegNumFromMask(tmpRegMask);
- noway_assert(tmpReg != REG_NA);
+ regNumber tmpReg = indir->GetSingleTempReg();
// First load/store tmpReg with the large offset constant
codeGen->instGen_Set_Reg_To_Imm(EA_PTRSIZE, tmpReg, offset);
@@ -11047,9 +11042,8 @@ regNumber emitter::emitInsTernary(instruction ins, emitAttr attr, GenTree* dst,
assert(!src1->isContained());
}
}
- bool isMulOverflow = false;
- bool isUnsignedMul = false;
- regNumber extraReg = REG_NA;
+
+ bool isMulOverflow = false;
if (dst->gtOverflowEx())
{
if (ins == INS_add)
@@ -11063,7 +11057,6 @@ regNumber emitter::emitInsTernary(instruction ins, emitAttr attr, GenTree* dst,
else if (ins == INS_mul)
{
isMulOverflow = true;
- isUnsignedMul = ((dst->gtFlags & GTF_UNSIGNED) != 0);
assert(intConst == nullptr); // overflow format doesn't support an int constant operand
}
else
@@ -11079,17 +11072,10 @@ regNumber emitter::emitInsTernary(instruction ins, emitAttr attr, GenTree* dst,
{
if (isMulOverflow)
{
- // Make sure that we have an internal register
- assert(genCountBits(dst->gtRsvdRegs) == 2);
-
- // There will be two bits set in tmpRegsMask.
- // Remove the bit for 'dst->gtRegNum' from 'tmpRegsMask'
- regMaskTP tmpRegsMask = dst->gtRsvdRegs & ~genRegMask(dst->gtRegNum);
- assert(tmpRegsMask != RBM_NONE);
- regMaskTP tmpRegMask = genFindLowestBit(tmpRegsMask); // set tmpRegMsk to a one-bit mask
- extraReg = genRegNumFromMask(tmpRegMask); // set tmpReg from that mask
+ regNumber extraReg = dst->GetSingleTempReg();
+ assert(extraReg != dst->gtRegNum);
- if (isUnsignedMul)
+ if ((dst->gtFlags & GTF_UNSIGNED) != 0)
{
if (attr == EA_4BYTE)
{
@@ -11109,7 +11095,7 @@ regNumber emitter::emitInsTernary(instruction ins, emitAttr attr, GenTree* dst,
emitIns_R_R_R(ins, attr, dst->gtRegNum, src1->gtRegNum, src2->gtRegNum);
}
- // zero-sign bit comparision to detect overflow.
+ // zero-sign bit comparison to detect overflow.
emitIns_R_I(INS_cmp, attr, extraReg, 0);
}
else
@@ -11137,7 +11123,7 @@ regNumber emitter::emitInsTernary(instruction ins, emitAttr attr, GenTree* dst,
bitShift = 63;
}
- // Sign bit comparision to detect overflow.
+ // Sign bit comparison to detect overflow.
emitIns_R_R_I(INS_cmp, attr, extraReg, dst->gtRegNum, bitShift, INS_OPTS_ASR);
}
}
diff --git a/src/jit/emitxarch.cpp b/src/jit/emitxarch.cpp
index b495d015d6..760813004c 100644
--- a/src/jit/emitxarch.cpp
+++ b/src/jit/emitxarch.cpp
@@ -332,16 +332,9 @@ bool IsXMMReg(regNumber reg)
unsigned RegEncoding(regNumber reg)
{
#ifndef LEGACY_BACKEND
- // XMM registers do not share the same reg numbers as integer registers.
- // But register encoding of integer and XMM registers is the same.
- // Therefore, subtract XMMBASE from regNumber to get the register encoding
- // in case of XMM registers.
- return (unsigned)((IsXMMReg(reg) ? reg - XMMBASE : reg) & 0x7);
-#else // LEGACY_BACKEND
- // Legacy X86: XMM registers share the same reg numbers as integer registers and
- // hence nothing to do to get reg encoding.
+ static_assert((REG_XMM0 & 0x7) == 0, "bad XMMBASE");
+#endif
return (unsigned)(reg & 0x7);
-#endif // LEGACY_BACKEND
}
// Utility routines that abstract the logic of adding REX.W, REX.R, REX.X, REX.B and REX prefixes
diff --git a/src/jit/error.h b/src/jit/error.h
index 0535601055..78f24adb38 100644
--- a/src/jit/error.h
+++ b/src/jit/error.h
@@ -80,7 +80,25 @@ extern void noWayAssertBodyConditional(
);
extern void noWayAssertBodyConditional(const char* cond, const char* file, unsigned line);
+// Define MEASURE_NOWAY to 1 to enable code to count and rank individual noway_assert calls by occurrence.
+// These asserts would be dynamically executed, but not necessarily fail. The provides some insight into
+// the dynamic prevalence of these (if not a direct measure of their cost), which exist in non-DEBUG as
+// well as DEBUG builds.
#ifdef DEBUG
+#define MEASURE_NOWAY 1
+#else // !DEBUG
+#define MEASURE_NOWAY 0
+#endif // !DEBUG
+
+#if MEASURE_NOWAY
+extern void RecordNowayAssertGlobal(const char* filename, unsigned line, const char* condStr);
+#define RECORD_NOWAY_ASSERT(condStr) RecordNowayAssertGlobal(__FILE__, __LINE__, condStr);
+#else
+#define RECORD_NOWAY_ASSERT(condStr)
+#endif
+
+#ifdef DEBUG
+
#define NO_WAY(msg) (debugError(msg, __FILE__, __LINE__), noWay())
// Used for fallback stress mode
#define NO_WAY_NOASSERT(msg) noWay()
@@ -90,6 +108,7 @@ extern void noWayAssertBodyConditional(const char* cond, const char* file, unsig
#define noway_assert(cond) \
do \
{ \
+ RECORD_NOWAY_ASSERT(#cond) \
if (!(cond)) \
{ \
noWayAssertBodyConditional(#cond, __FILE__, __LINE__); \
@@ -99,7 +118,7 @@ extern void noWayAssertBodyConditional(const char* cond, const char* file, unsig
#define NOWAY_MSG(msg) noWayAssertBodyConditional(msg, __FILE__, __LINE__)
-#else
+#else // !DEBUG
#define NO_WAY(msg) noWay()
#define BADCODE(msg) badCode()
@@ -114,6 +133,7 @@ extern void noWayAssertBodyConditional(const char* cond, const char* file, unsig
#define noway_assert(cond) \
do \
{ \
+ RECORD_NOWAY_ASSERT(#cond) \
if (!(cond)) \
{ \
noWayAssertBodyConditional(NOWAY_ASSERT_BODY_ARGUMENTS); \
@@ -123,7 +143,7 @@ extern void noWayAssertBodyConditional(const char* cond, const char* file, unsig
#define NOWAY_MSG(msg) noWayAssertBodyConditional(NOWAY_ASSERT_BODY_ARGUMENTS)
-#endif
+#endif // !DEBUG
// IMPL_LIMITATION is called when we encounter valid IL that is not
// supported by our current implementation because of various
diff --git a/src/jit/flowgraph.cpp b/src/jit/flowgraph.cpp
index 3374b8c820..0c57862768 100644
--- a/src/jit/flowgraph.cpp
+++ b/src/jit/flowgraph.cpp
@@ -3189,9 +3189,15 @@ void Compiler::fgComputePreds()
if (ehDsc->HasFilter())
{
ehDsc->ebdFilter->bbFlags |= BBF_JMP_TARGET | BBF_HAS_LABEL;
+
+ // The first block of a filter has an artifical extra refcount.
+ ehDsc->ebdFilter->bbRefs++;
}
ehDsc->ebdHndBeg->bbFlags |= BBF_JMP_TARGET | BBF_HAS_LABEL;
+
+ // The first block of a handler has an artificial extra refcount.
+ ehDsc->ebdHndBeg->bbRefs++;
}
fgModified = false;
@@ -5455,15 +5461,15 @@ unsigned Compiler::fgMakeBasicBlocks(const BYTE* codeAddr, IL_OFFSET codeSize, B
if (!impIsTailCallILPattern(tailCall, opcode, codeAddr + sz, codeEndp, isRecursive,
&isCallPopAndRet))
{
-#ifdef _TARGET_AMD64_
+#if !defined(FEATURE_CORECLR) && defined(_TARGET_AMD64_)
BADCODE3("tail call not followed by ret or pop+ret", " at offset %04X",
(IL_OFFSET)(codeAddr - codeBegp));
#else
BADCODE3("tail call not followed by ret", " at offset %04X", (IL_OFFSET)(codeAddr - codeBegp));
-#endif //_TARGET_AMD64_
+#endif // !FEATURE_CORECLR && _TARGET_AMD64_
}
-#ifdef _TARGET_AMD64_
+#if !defined(FEATURE_CORECLR) && defined(_TARGET_AMD64_)
if (isCallPopAndRet)
{
// By breaking here, we let pop and ret opcodes to be
@@ -5472,7 +5478,7 @@ unsigned Compiler::fgMakeBasicBlocks(const BYTE* codeAddr, IL_OFFSET codeSize, B
// in fgMorphCall().
break;
}
-#endif //_TARGET_AMD64_
+#endif // !FEATURE_CORECLR && _TARGET_AMD64_
}
else
{
@@ -9124,7 +9130,7 @@ void Compiler::fgSimpleLowering()
else
{
con = gtNewIconNode(arrLen->ArrLenOffset(), TYP_I_IMPL);
- con->gtRsvdRegs = 0;
+ con->gtRsvdRegs = RBM_NONE;
add = gtNewOperNode(GT_ADD, TYP_REF, arr, con);
add->gtRsvdRegs = arr->gtRsvdRegs;
@@ -12081,12 +12087,6 @@ void Compiler::fgInsertFuncletPrologBlock(BasicBlock* block)
fgExtendEHRegionBefore(block); // Update the EH table to make the prolog block the first block in the block's EH
// block.
- // fgExtendEHRegionBefore mucks with the bbRefs without updating the pred list, which we will
- // do below for this block. So, undo that change.
- assert(newHead->bbRefs > 0);
- newHead->bbRefs--;
- block->bbRefs++;
-
// Distribute the pred list between newHead and block. Incoming edges coming from outside
// the handler go to the prolog. Edges coming from with the handler are back-edges, and
// go to the existing 'block'.
@@ -12618,10 +12618,8 @@ bool Compiler::fgMightHaveLoop()
{
BitVecOps::AddElemD(&blockVecTraits, blocksSeen, block->bbNum);
- AllSuccessorIter succsEnd = block->GetAllSuccs(this).end();
- for (AllSuccessorIter succs = block->GetAllSuccs(this).begin(); succs != succsEnd; ++succs)
+ for (BasicBlock* succ : block->GetAllSuccs(this))
{
- BasicBlock* succ = (*succs);
if (BitVecOps::IsMember(&blockVecTraits, blocksSeen, succ->bbNum))
{
return true;
@@ -16569,6 +16567,7 @@ void Compiler::fgExtendEHRegionBefore(BasicBlock* block)
#endif // DEBUG
HBtab->ebdTryBeg = bPrev;
bPrev->bbFlags |= BBF_TRY_BEG | BBF_DONT_REMOVE | BBF_HAS_LABEL;
+
// clear the TryBeg flag unless it begins another try region
if (!bbIsTryBeg(block))
{
@@ -16591,6 +16590,16 @@ void Compiler::fgExtendEHRegionBefore(BasicBlock* block)
HBtab->ebdHndBeg = bPrev;
bPrev->bbFlags |= BBF_DONT_REMOVE | BBF_HAS_LABEL;
+
+#if FEATURE_EH_FUNCLETS
+ if (fgFuncletsCreated)
+ {
+ assert((block->bbFlags & BBF_FUNCLET_BEG) != 0);
+ bPrev->bbFlags |= BBF_FUNCLET_BEG;
+ block->bbFlags &= ~BBF_FUNCLET_BEG;
+ }
+#endif // FEATURE_EH_FUNCLETS
+
bPrev->bbRefs++;
// If this is a handler for a filter, the last block of the filter will end with
@@ -16630,6 +16639,16 @@ void Compiler::fgExtendEHRegionBefore(BasicBlock* block)
HBtab->ebdFilter = bPrev;
bPrev->bbFlags |= BBF_DONT_REMOVE | BBF_HAS_LABEL;
+
+#if FEATURE_EH_FUNCLETS
+ if (fgFuncletsCreated)
+ {
+ assert((block->bbFlags & BBF_FUNCLET_BEG) != 0);
+ bPrev->bbFlags |= BBF_FUNCLET_BEG;
+ block->bbFlags &= ~BBF_FUNCLET_BEG;
+ }
+#endif // FEATURE_EH_FUNCLETS
+
bPrev->bbRefs++;
}
}
@@ -17036,8 +17055,8 @@ bool Compiler::fgCheckEHCanInsertAfterBlock(BasicBlock* blk, unsigned regionInde
//
// Return Value:
// A block with the desired characteristics, so the new block will be inserted after this one.
-// If there is no suitable location, return nullptr. This should basically never happen.
-
+// If there is no suitable location, return nullptr. This should basically never happen except in the case of
+// single-block filters.
BasicBlock* Compiler::fgFindInsertPoint(unsigned regionIndex,
bool putInTryRegion,
BasicBlock* startBlk,
@@ -17069,6 +17088,13 @@ BasicBlock* Compiler::fgFindInsertPoint(unsigned regionIndex,
regionIndex, dspBool(putInTryRegion), startBlk->bbNum, (endBlk == nullptr) ? 0 : endBlk->bbNum,
(nearBlk == nullptr) ? 0 : nearBlk->bbNum, (jumpBlk == nullptr) ? 0 : jumpBlk->bbNum, dspBool(runRarely));
+ bool insertingIntoFilter = false;
+ if (!putInTryRegion)
+ {
+ EHblkDsc* const dsc = ehGetDsc(regionIndex - 1);
+ insertingIntoFilter = dsc->HasFilter() && (startBlk == dsc->ebdFilter) && (endBlk == dsc->ebdHndBeg);
+ }
+
bool reachedNear = false; // Have we reached 'nearBlk' in our search? If not, we'll keep searching.
bool inFilter = false; // Are we in a filter region that we need to skip?
BasicBlock* bestBlk =
@@ -17110,9 +17136,7 @@ BasicBlock* Compiler::fgFindInsertPoint(unsigned regionIndex,
{
// Record the fact that we entered a filter region, so we don't insert into filters...
// Unless the caller actually wanted the block inserted in this exact filter region.
- // Detect this by the fact that startBlk and endBlk point to the filter begin and end.
- if (putInTryRegion || (blk != startBlk) || (startBlk != ehGetDsc(regionIndex - 1)->ebdFilter) ||
- (endBlk != ehGetDsc(regionIndex - 1)->ebdHndBeg))
+ if (!insertingIntoFilter || (blk != startBlk))
{
inFilter = true;
}
@@ -17258,7 +17282,21 @@ BasicBlock* Compiler::fgFindInsertPoint(unsigned regionIndex,
bestBlk = goodBlk;
}
-DONE:;
+DONE:
+
+ // If we are inserting into a filter and the best block is the end of the filter region, we need to
+ // insert after its predecessor instead: the CLR ABI states that the terminal block of a filter region
+ // is its exit block. If the filter region consists of a single block, a new block cannot be inserted
+ // without either splitting the single block before inserting a new block or inserting the new block
+ // before the single block and updating the filter description such that the inserted block is marked
+ // as the entry block for the filter. This work must be done by the caller; this function returns
+ // `nullptr` to indicate this case.
+ if (insertingIntoFilter && (bestBlk == endBlk->bbPrev) && (bestBlk == startBlk))
+ {
+ assert(bestBlk != nullptr);
+ assert(bestBlk->bbJumpKind == BBJ_EHFILTERRET);
+ bestBlk = nullptr;
+ }
return bestBlk;
}
@@ -17437,6 +17475,21 @@ BasicBlock* Compiler::fgNewBBinRegion(BBjumpKinds jumpKind,
// Now find the insertion point.
afterBlk = fgFindInsertPoint(regionIndex, putInTryRegion, startBlk, endBlk, nearBlk, nullptr, runRarely);
+ // If afterBlk is nullptr, we must be inserting into a single-block filter region. Because the CLR ABI requires
+ // that control exits a filter via the last instruction in the filter range, this situation requires logically
+ // splitting the single block. In practice, we simply insert a new block at the beginning of the filter region
+ // that transfers control flow to the existing single block.
+ if (afterBlk == nullptr)
+ {
+ assert(putInFilter);
+
+ BasicBlock* newFilterEntryBlock = fgNewBBbefore(BBJ_ALWAYS, startBlk, true);
+ newFilterEntryBlock->bbJumpDest = startBlk;
+ fgAddRefPred(startBlk, newFilterEntryBlock);
+
+ afterBlk = newFilterEntryBlock;
+ }
+
_FoundAfterBlk:;
/* We have decided to insert the block after 'afterBlk'. */
@@ -20508,7 +20561,28 @@ void Compiler::fgDebugCheckBBlist(bool checkBBNum /* = false */, bool checkBBRef
}
/* Check the bbRefs */
- noway_assert(!checkBBRefs || block->bbRefs == blockRefs);
+ if (checkBBRefs)
+ {
+ if (block->bbRefs != blockRefs)
+ {
+ // Check to see if this block is the beginning of a filter or a handler and adjust the ref count
+ // appropriately.
+ for (EHblkDsc *HBtab = compHndBBtab, *HBtabEnd = &compHndBBtab[compHndBBtabCount]; HBtab != HBtabEnd;
+ HBtab++)
+ {
+ if (HBtab->ebdHndBeg == block)
+ {
+ blockRefs++;
+ }
+ if (HBtab->HasFilter() && (HBtab->ebdFilter == block))
+ {
+ blockRefs++;
+ }
+ }
+ }
+
+ assert(block->bbRefs == blockRefs);
+ }
/* Check that BBF_HAS_HANDLER is valid bbTryIndex */
if (block->hasTryIndex())
@@ -21809,8 +21883,8 @@ void Compiler::fgInvokeInlineeCompiler(GenTreeCall* call, InlineResult* inlineRe
noway_assert(opts.OptEnabled(CLFLG_INLINING));
// This is the InlineInfo struct representing a method to be inlined.
- InlineInfo inlineInfo = {nullptr};
-
+ InlineInfo inlineInfo;
+ memset(&inlineInfo, 0, sizeof(inlineInfo));
CORINFO_METHOD_HANDLE fncHandle = call->gtCallMethHnd;
inlineInfo.fncHandle = fncHandle;
@@ -21850,7 +21924,8 @@ void Compiler::fgInvokeInlineeCompiler(GenTreeCall* call, InlineResult* inlineRe
CORINFO_METHOD_HANDLE fncHandle;
InlineCandidateInfo* inlineCandidateInfo;
InlineInfo* inlineInfo;
- } param = {nullptr};
+ } param;
+ memset(&param, 0, sizeof(param));
param.pThis = this;
param.call = call;
diff --git a/src/jit/gentree.cpp b/src/jit/gentree.cpp
index c5733b81e4..a2156d035e 100644
--- a/src/jit/gentree.cpp
+++ b/src/jit/gentree.cpp
@@ -450,7 +450,7 @@ bool GenTree::IsNodeProperlySized() const
#define BASH_HASH_SIZE 211
-inline hashme(genTreeOps op1, genTreeOps op2)
+inline unsigned hashme(genTreeOps op1, genTreeOps op2)
{
return ((op1 * 104729) ^ (op2 * 56569)) % BASH_HASH_SIZE;
}
@@ -15026,390 +15026,6 @@ bool Compiler::gtComplexityExceeds(GenTreePtr* tree, unsigned limit)
}
}
-/*
-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-XX XX
-XX BasicBlock XX
-XX XX
-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-*/
-
-#if MEASURE_BLOCK_SIZE
-/* static */
-size_t BasicBlock::s_Size;
-/* static */
-size_t BasicBlock::s_Count;
-#endif // MEASURE_BLOCK_SIZE
-
-#ifdef DEBUG
-// The max # of tree nodes in any BB
-/* static */
-unsigned BasicBlock::s_nMaxTrees;
-#endif // DEBUG
-
-/*****************************************************************************
- *
- * Allocate a basic block but don't append it to the current BB list.
- */
-
-BasicBlock* Compiler::bbNewBasicBlock(BBjumpKinds jumpKind)
-{
- BasicBlock* block;
-
- /* Allocate the block descriptor and zero it out */
- assert(fgSafeBasicBlockCreation);
-
- block = new (this, CMK_BasicBlock) BasicBlock;
-
-#if MEASURE_BLOCK_SIZE
- BasicBlock::s_Count += 1;
- BasicBlock::s_Size += sizeof(*block);
-#endif
-
-#ifdef DEBUG
- // fgLookupBB() is invalid until fgInitBBLookup() is called again.
- fgBBs = (BasicBlock**)0xCDCD;
-#endif
-
- // TODO-Throughput: The following memset is pretty expensive - do something else?
- // Note that some fields have to be initialized to 0 (like bbFPStateX87)
- memset(block, 0, sizeof(*block));
-
- // scopeInfo needs to be able to differentiate between blocks which
- // correspond to some instrs (and so may have some LocalVarInfo
- // boundaries), or have been inserted by the JIT
- block->bbCodeOffs = BAD_IL_OFFSET;
- block->bbCodeOffsEnd = BAD_IL_OFFSET;
-
- /* Give the block a number, set the ancestor count and weight */
-
- ++fgBBcount;
-
- if (compIsForInlining())
- {
- block->bbNum = ++impInlineInfo->InlinerCompiler->fgBBNumMax;
- }
- else
- {
- block->bbNum = ++fgBBNumMax;
- }
-
-#ifndef LEGACY_BACKEND
- if (compRationalIRForm)
- {
- block->bbFlags |= BBF_IS_LIR;
- }
-#endif // !LEGACY_BACKEND
-
- block->bbRefs = 1;
- block->bbWeight = BB_UNITY_WEIGHT;
-
- block->bbStkTempsIn = NO_BASE_TMP;
- block->bbStkTempsOut = NO_BASE_TMP;
-
- block->bbEntryState = nullptr;
-
- /* Record the jump kind in the block */
-
- block->bbJumpKind = jumpKind;
-
- if (jumpKind == BBJ_THROW)
- {
- block->bbSetRunRarely();
- }
-
-#ifdef DEBUG
- if (verbose)
- {
- printf("New Basic Block BB%02u [%p] created.\n", block->bbNum, dspPtr(block));
- }
-#endif
-
- // We will give all the blocks var sets after the number of tracked variables
- // is determined and frozen. After that, if we dynamically create a basic block,
- // we will initialize its var sets.
- if (fgBBVarSetsInited)
- {
- VarSetOps::AssignNoCopy(this, block->bbVarUse, VarSetOps::MakeEmpty(this));
- VarSetOps::AssignNoCopy(this, block->bbVarDef, VarSetOps::MakeEmpty(this));
- VarSetOps::AssignNoCopy(this, block->bbLiveIn, VarSetOps::MakeEmpty(this));
- VarSetOps::AssignNoCopy(this, block->bbLiveOut, VarSetOps::MakeEmpty(this));
- VarSetOps::AssignNoCopy(this, block->bbScope, VarSetOps::MakeEmpty(this));
- }
- else
- {
- VarSetOps::AssignNoCopy(this, block->bbVarUse, VarSetOps::UninitVal());
- VarSetOps::AssignNoCopy(this, block->bbVarDef, VarSetOps::UninitVal());
- VarSetOps::AssignNoCopy(this, block->bbLiveIn, VarSetOps::UninitVal());
- VarSetOps::AssignNoCopy(this, block->bbLiveOut, VarSetOps::UninitVal());
- VarSetOps::AssignNoCopy(this, block->bbScope, VarSetOps::UninitVal());
- }
-
- block->bbMemoryUse = emptyMemoryKindSet;
- block->bbMemoryDef = emptyMemoryKindSet;
- block->bbMemoryLiveIn = emptyMemoryKindSet;
- block->bbMemoryLiveOut = emptyMemoryKindSet;
-
- for (MemoryKind memoryKind : allMemoryKinds())
- {
- block->bbMemorySsaPhiFunc[memoryKind] = nullptr;
- block->bbMemorySsaNumIn[memoryKind] = 0;
- block->bbMemorySsaNumOut[memoryKind] = 0;
- }
-
- // Make sure we reserve a NOT_IN_LOOP value that isn't a legal table index.
- static_assert_no_msg(MAX_LOOP_NUM < BasicBlock::NOT_IN_LOOP);
-
- block->bbNatLoopNum = BasicBlock::NOT_IN_LOOP;
-
- return block;
-}
-
-//------------------------------------------------------------------------------
-// containsStatement - return true if the block contains the given statement
-//------------------------------------------------------------------------------
-
-bool BasicBlock::containsStatement(GenTree* statement)
-{
- assert(statement->gtOper == GT_STMT);
-
- GenTree* curr = bbTreeList;
- do
- {
- if (curr == statement)
- {
- break;
- }
- curr = curr->gtNext;
- } while (curr);
- return curr != nullptr;
-}
-
-GenTreeStmt* BasicBlock::FirstNonPhiDef()
-{
- GenTreePtr stmt = bbTreeList;
- if (stmt == nullptr)
- {
- return nullptr;
- }
- GenTreePtr tree = stmt->gtStmt.gtStmtExpr;
- while ((tree->OperGet() == GT_ASG && tree->gtOp.gtOp2->OperGet() == GT_PHI) ||
- (tree->OperGet() == GT_STORE_LCL_VAR && tree->gtOp.gtOp1->OperGet() == GT_PHI))
- {
- stmt = stmt->gtNext;
- if (stmt == nullptr)
- {
- return nullptr;
- }
- tree = stmt->gtStmt.gtStmtExpr;
- }
- return stmt->AsStmt();
-}
-
-GenTreePtr BasicBlock::FirstNonPhiDefOrCatchArgAsg()
-{
- GenTreePtr stmt = FirstNonPhiDef();
- if (stmt == nullptr)
- {
- return nullptr;
- }
- GenTreePtr tree = stmt->gtStmt.gtStmtExpr;
- if ((tree->OperGet() == GT_ASG && tree->gtOp.gtOp2->OperGet() == GT_CATCH_ARG) ||
- (tree->OperGet() == GT_STORE_LCL_VAR && tree->gtOp.gtOp1->OperGet() == GT_CATCH_ARG))
- {
- stmt = stmt->gtNext;
- }
- return stmt;
-}
-
-/*****************************************************************************
- *
- * Mark a block as rarely run, we also don't want to have a loop in a
- * rarely run block, and we set it's weight to zero.
- */
-
-void BasicBlock::bbSetRunRarely()
-{
- setBBWeight(BB_ZERO_WEIGHT);
- if (bbWeight == BB_ZERO_WEIGHT)
- {
- bbFlags |= BBF_RUN_RARELY; // This block is never/rarely run
- }
-}
-
-/*****************************************************************************
- *
- * Can a BasicBlock be inserted after this without altering the flowgraph
- */
-
-bool BasicBlock::bbFallsThrough()
-{
- switch (bbJumpKind)
- {
-
- case BBJ_THROW:
- case BBJ_EHFINALLYRET:
- case BBJ_EHFILTERRET:
- case BBJ_EHCATCHRET:
- case BBJ_RETURN:
- case BBJ_ALWAYS:
- case BBJ_LEAVE:
- case BBJ_SWITCH:
- return false;
-
- case BBJ_NONE:
- case BBJ_COND:
- return true;
-
- case BBJ_CALLFINALLY:
- return ((bbFlags & BBF_RETLESS_CALL) == 0);
-
- default:
- assert(!"Unknown bbJumpKind in bbFallsThrough()");
- return true;
- }
-}
-
-unsigned BasicBlock::NumSucc(Compiler* comp)
-{
- // As described in the spec comment of NumSucc at its declaration, whether "comp" is null determines
- // whether NumSucc and GetSucc yield successors of finally blocks.
-
- switch (bbJumpKind)
- {
-
- case BBJ_THROW:
- case BBJ_RETURN:
- return 0;
-
- case BBJ_EHFILTERRET:
- if (comp == nullptr)
- {
- return 0;
- }
- else
- {
- return 1;
- }
-
- case BBJ_EHFINALLYRET:
- {
- if (comp == nullptr)
- {
- return 0;
- }
- else
- {
- // The first block of the handler is labelled with the catch type.
- BasicBlock* hndBeg = comp->fgFirstBlockOfHandler(this);
- if (hndBeg->bbCatchTyp == BBCT_FINALLY)
- {
- return comp->fgNSuccsOfFinallyRet(this);
- }
- else
- {
- assert(hndBeg->bbCatchTyp == BBCT_FAULT); // We can only BBJ_EHFINALLYRET from FINALLY and FAULT.
- // A FAULT block has no successors.
- return 0;
- }
- }
- }
- case BBJ_CALLFINALLY:
- case BBJ_ALWAYS:
- case BBJ_EHCATCHRET:
- case BBJ_LEAVE:
- case BBJ_NONE:
- return 1;
- case BBJ_COND:
- if (bbJumpDest == bbNext)
- {
- return 1;
- }
- else
- {
- return 2;
- }
- case BBJ_SWITCH:
- if (comp == nullptr)
- {
- return bbJumpSwt->bbsCount;
- }
- else
- {
- Compiler::SwitchUniqueSuccSet sd = comp->GetDescriptorForSwitch(this);
- return sd.numDistinctSuccs;
- }
-
- default:
- unreached();
- }
-}
-
-BasicBlock* BasicBlock::GetSucc(unsigned i, Compiler* comp)
-{
- // As described in the spec comment of GetSucc at its declaration, whether "comp" is null determines
- // whether NumSucc and GetSucc yield successors of finally blocks.
-
- assert(i < NumSucc(comp)); // Index bounds check.
- // printf("bbjk=%d\n", bbJumpKind);
- switch (bbJumpKind)
- {
-
- case BBJ_THROW:
- case BBJ_RETURN:
- unreached(); // Should have been covered by assert above.
-
- case BBJ_EHFILTERRET:
- {
- assert(comp != nullptr); // Or else we're not looking for successors.
- BasicBlock* result = comp->fgFirstBlockOfHandler(this);
- noway_assert(result == bbJumpDest);
- // Handler is the (sole) normal successor of the filter.
- return result;
- }
-
- case BBJ_EHFINALLYRET:
- return comp->fgSuccOfFinallyRet(this, i);
-
- case BBJ_CALLFINALLY:
- case BBJ_ALWAYS:
- case BBJ_EHCATCHRET:
- case BBJ_LEAVE:
- return bbJumpDest;
-
- case BBJ_NONE:
- return bbNext;
- case BBJ_COND:
- if (i == 0)
- {
- return bbNext;
- }
- else
- {
- assert(i == 1);
- return bbJumpDest;
- };
- case BBJ_SWITCH:
- if (comp == nullptr)
- {
- assert(i < bbJumpSwt->bbsCount); // Range check.
- return bbJumpSwt->bbsDstTab[i];
- }
- else
- {
- // Remove duplicates.
- Compiler::SwitchUniqueSuccSet sd = comp->GetDescriptorForSwitch(this);
- assert(i < sd.numDistinctSuccs); // Range check.
- return sd.nonDuplicates[i];
- }
-
- default:
- unreached();
- }
-}
-
// -------------------------------------------------------------------------
// IsRegOptional: Returns true if this gentree node is marked by lowering to
// indicate that codegen can still generate code even if it wasn't allocated
@@ -17403,3 +17019,68 @@ regMaskTP ReturnTypeDesc::GetABIReturnRegs()
return resultMask;
}
+
+#ifndef LEGACY_BACKEND
+
+//------------------------------------------------------------------------
+// The following functions manage the gtRsvdRegs set of temporary registers
+// created by LSRA during code generation.
+
+//------------------------------------------------------------------------
+// AvailableTempRegCount: return the number of available temporary registers in the (optional) given set
+// (typically, RBM_ALLINT or RBM_ALLFLOAT).
+//
+// Arguments:
+// mask - (optional) Check for available temporary registers only in this set.
+//
+// Return Value:
+// Count of available temporary registers in given set.
+//
+unsigned GenTree::AvailableTempRegCount(regMaskTP mask /* = (regMaskTP)-1 */) const
+{
+ return genCountBits(gtRsvdRegs & mask);
+}
+
+//------------------------------------------------------------------------
+// GetSingleTempReg: There is expected to be exactly one available temporary register
+// in the given mask in the gtRsvdRegs set. Get that register. No future calls to get
+// a temporary register are expected. Removes the register from the set, but only in
+// DEBUG to avoid doing unnecessary work in non-DEBUG builds.
+//
+// Arguments:
+// mask - (optional) Get an available temporary register only in this set.
+//
+// Return Value:
+// Available temporary register in given mask.
+//
+regNumber GenTree::GetSingleTempReg(regMaskTP mask /* = (regMaskTP)-1 */)
+{
+ regMaskTP availableSet = gtRsvdRegs & mask;
+ assert(genCountBits(availableSet) == 1);
+ regNumber tempReg = genRegNumFromMask(availableSet);
+ INDEBUG(gtRsvdRegs &= ~availableSet;) // Remove the register from the set, so it can't be used again.
+ return tempReg;
+}
+
+//------------------------------------------------------------------------
+// ExtractTempReg: Find the lowest number temporary register from the gtRsvdRegs set
+// that is also in the optional given mask (typically, RBM_ALLINT or RBM_ALLFLOAT),
+// and return it. Remove this register from the temporary register set, so it won't
+// be returned again.
+//
+// Arguments:
+// mask - (optional) Extract an available temporary register only in this set.
+//
+// Return Value:
+// Available temporary register in given mask.
+//
+regNumber GenTree::ExtractTempReg(regMaskTP mask /* = (regMaskTP)-1 */)
+{
+ regMaskTP availableSet = gtRsvdRegs & mask;
+ assert(genCountBits(availableSet) >= 1);
+ regMaskTP tempRegMask = genFindLowestBit(availableSet);
+ gtRsvdRegs &= ~tempRegMask;
+ return genRegNumFromMask(tempRegMask);
+}
+
+#endif // !LEGACY_BACKEND \ No newline at end of file
diff --git a/src/jit/gentree.h b/src/jit/gentree.h
index 1d52248657..d3a03ee1b7 100644
--- a/src/jit/gentree.h
+++ b/src/jit/gentree.h
@@ -733,6 +733,13 @@ public:
ValueNumPair gtVNPair;
regMaskSmall gtRsvdRegs; // set of fixed trashed registers
+
+#ifndef LEGACY_BACKEND
+ unsigned AvailableTempRegCount(regMaskTP mask = (regMaskTP)-1) const;
+ regNumber GetSingleTempReg(regMaskTP mask = (regMaskTP)-1);
+ regNumber ExtractTempReg(regMaskTP mask = (regMaskTP)-1);
+#endif // !LEGACY_BACKEND
+
#ifdef LEGACY_BACKEND
regMaskSmall gtUsedRegs; // set of used (trashed) registers
#endif // LEGACY_BACKEND
diff --git a/src/jit/importer.cpp b/src/jit/importer.cpp
index 54427ba4dd..a991598258 100644
--- a/src/jit/importer.cpp
+++ b/src/jit/importer.cpp
@@ -145,24 +145,6 @@ void Compiler::impPushOnStack(GenTreePtr tree, typeInfo ti)
}
}
-/******************************************************************************/
-// used in the inliner, where we can assume typesafe code. please don't use in the importer!!
-inline void Compiler::impPushOnStackNoType(GenTreePtr tree)
-{
- assert(verCurrentState.esStackDepth < impStkSize);
- INDEBUG(verCurrentState.esStack[verCurrentState.esStackDepth].seTypeInfo = typeInfo());
- verCurrentState.esStack[verCurrentState.esStackDepth++].val = tree;
-
- if ((tree->gtType == TYP_LONG) && (compLongUsed == false))
- {
- compLongUsed = true;
- }
- else if (((tree->gtType == TYP_FLOAT) || (tree->gtType == TYP_DOUBLE)) && (compFloatingPointUsed == false))
- {
- compFloatingPointUsed = true;
- }
-}
-
inline void Compiler::impPushNullObjRefOnStack()
{
impPushOnStack(gtNewIconNode(0, TYP_REF), typeInfo(TI_NULL));
@@ -322,20 +304,6 @@ StackEntry Compiler::impPopStack()
return verCurrentState.esStack[--verCurrentState.esStackDepth];
}
-StackEntry Compiler::impPopStack(CORINFO_CLASS_HANDLE& structType)
-{
- StackEntry ret = impPopStack();
- structType = verCurrentState.esStack[verCurrentState.esStackDepth].seTypeInfo.GetClassHandle();
- return (ret);
-}
-
-GenTreePtr Compiler::impPopStack(typeInfo& ti)
-{
- StackEntry ret = impPopStack();
- ti = ret.seTypeInfo;
- return (ret.val);
-}
-
/*****************************************************************************
*
* Peep at n'th (0-based) tree on the top of the stack.
@@ -3652,6 +3620,87 @@ GenTreePtr Compiler::impIntrinsic(GenTreePtr newobjThis,
retNode = field;
break;
}
+ case CORINFO_INTRINSIC_Span_GetItem:
+ case CORINFO_INTRINSIC_ReadOnlySpan_GetItem:
+ {
+ // Have index, stack pointer-to Span<T> s on the stack. Expand to:
+ //
+ // For Span<T>
+ // Comma
+ // BoundsCheck(index, s->_length)
+ // s->_pointer + index * sizeof(T)
+ //
+ // For ReadOnlySpan<T>
+ // Comma
+ // BoundsCheck(index, s->_length)
+ // *(s->_pointer + index * sizeof(T))
+ //
+ // Signature should show one class type parameter, which
+ // we need to examine.
+ assert(sig->sigInst.classInstCount == 1);
+ CORINFO_CLASS_HANDLE spanElemHnd = sig->sigInst.classInst[0];
+ const unsigned elemSize = info.compCompHnd->getClassSize(spanElemHnd);
+ assert(elemSize > 0);
+
+ const bool isReadOnly = (intrinsicID == CORINFO_INTRINSIC_ReadOnlySpan_GetItem);
+
+ JITDUMP("\nimpIntrinsic: Expanding %sSpan<T>.get_Item, T=%s, sizeof(T)=%u\n", isReadOnly ? "ReadOnly" : "",
+ info.compCompHnd->getClassName(spanElemHnd), elemSize);
+
+ GenTreePtr index = impPopStack().val;
+ GenTreePtr ptrToSpan = impPopStack().val;
+ GenTreePtr indexClone = nullptr;
+ GenTreePtr ptrToSpanClone = nullptr;
+
+#if defined(DEBUG)
+ if (verbose)
+ {
+ printf("with ptr-to-span\n");
+ gtDispTree(ptrToSpan);
+ printf("and index\n");
+ gtDispTree(index);
+ }
+#endif // defined(DEBUG)
+
+ // We need to use both index and ptr-to-span twice, so clone or spill.
+ index = impCloneExpr(index, &indexClone, NO_CLASS_HANDLE, (unsigned)CHECK_SPILL_ALL,
+ nullptr DEBUGARG("Span.get_Item index"));
+ ptrToSpan = impCloneExpr(ptrToSpan, &ptrToSpanClone, NO_CLASS_HANDLE, (unsigned)CHECK_SPILL_ALL,
+ nullptr DEBUGARG("Span.get_Item ptrToSpan"));
+
+ // Bounds check
+ CORINFO_FIELD_HANDLE lengthHnd = info.compCompHnd->getFieldInClass(clsHnd, 1);
+ const unsigned lengthOffset = info.compCompHnd->getFieldOffset(lengthHnd);
+ GenTreePtr length = gtNewFieldRef(TYP_INT, lengthHnd, ptrToSpan, lengthOffset, false);
+ GenTreePtr boundsCheck = new (this, GT_ARR_BOUNDS_CHECK)
+ GenTreeBoundsChk(GT_ARR_BOUNDS_CHECK, TYP_VOID, index, length, SCK_RNGCHK_FAIL);
+
+ // Element access
+ GenTreePtr indexIntPtr = impImplicitIorI4Cast(indexClone, TYP_I_IMPL);
+ GenTreePtr sizeofNode = gtNewIconNode(elemSize);
+ GenTreePtr mulNode = gtNewOperNode(GT_MUL, TYP_I_IMPL, indexIntPtr, sizeofNode);
+ CORINFO_FIELD_HANDLE ptrHnd = info.compCompHnd->getFieldInClass(clsHnd, 0);
+ const unsigned ptrOffset = info.compCompHnd->getFieldOffset(ptrHnd);
+ GenTreePtr data = gtNewFieldRef(TYP_BYREF, ptrHnd, ptrToSpanClone, ptrOffset, false);
+ GenTreePtr result = gtNewOperNode(GT_ADD, TYP_BYREF, data, mulNode);
+
+ // Prepare result
+ var_types resultType = JITtype2varType(sig->retType);
+
+ if (isReadOnly)
+ {
+ result = gtNewOperNode(GT_IND, resultType, result);
+ }
+ else
+ {
+ assert(resultType == result->TypeGet());
+ }
+
+ retNode = gtNewOperNode(GT_COMMA, resultType, boundsCheck, result);
+
+ break;
+ }
+
default:
/* Unknown intrinsic */
break;
@@ -5093,8 +5142,9 @@ void Compiler::impImportAndPushBox(CORINFO_RESOLVED_TOKEN* pResolvedToken)
impSpillSpecialSideEff();
// Now get the expression to box from the stack.
- CORINFO_CLASS_HANDLE operCls;
- GenTreePtr exprToBox = impPopStack(operCls).val;
+ StackEntry se = impPopStack();
+ CORINFO_CLASS_HANDLE operCls = se.seTypeInfo.GetClassHandle();
+ GenTreePtr exprToBox = se.val;
CorInfoHelpFunc boxHelper = info.compCompHnd->getBoxHelper(pResolvedToken->hClass);
if (boxHelper == CORINFO_HELP_BOX)
@@ -6166,6 +6216,12 @@ bool Compiler::impTailCallRetTypeCompatible(var_types callerRetType,
return true;
}
+ // If the class handles are the same and not null, the return types are compatible.
+ if ((callerRetTypeClass != nullptr) && (callerRetTypeClass == calleeRetTypeClass))
+ {
+ return true;
+ }
+
#if defined(_TARGET_AMD64_) || defined(_TARGET_ARM64_)
// Jit64 compat:
if (callerRetType == TYP_VOID)
@@ -6271,7 +6327,7 @@ bool Compiler::impIsTailCallILPattern(bool tailPrefixed,
int cntPop = 0;
OPCODE nextOpcode;
-#ifdef _TARGET_AMD64_
+#if !defined(FEATURE_CORECLR) && defined(_TARGET_AMD64_)
do
{
nextOpcode = (OPCODE)getU1LittleEndian(codeAddrOfNextOpcode);
@@ -6282,7 +6338,7 @@ bool Compiler::impIsTailCallILPattern(bool tailPrefixed,
// one pop seen so far.
#else
nextOpcode = (OPCODE)getU1LittleEndian(codeAddrOfNextOpcode);
-#endif
+#endif // !FEATURE_CORECLR && _TARGET_AMD64_
if (isCallPopAndRet)
{
@@ -6290,15 +6346,15 @@ bool Compiler::impIsTailCallILPattern(bool tailPrefixed,
*isCallPopAndRet = (nextOpcode == CEE_RET) && (cntPop == 1);
}
-#ifdef _TARGET_AMD64_
+#if !defined(FEATURE_CORECLR) && defined(_TARGET_AMD64_)
// Jit64 Compat:
// Tail call IL pattern could be either of the following
// 1) call/callvirt/calli + ret
// 2) call/callvirt/calli + pop + ret in a method returning void.
return (nextOpcode == CEE_RET) && ((cntPop == 0) || ((cntPop == 1) && (info.compRetType == TYP_VOID)));
-#else //!_TARGET_AMD64_
+#else
return (nextOpcode == CEE_RET) && (cntPop == 0);
-#endif
+#endif // !FEATURE_CORECLR && _TARGET_AMD64_
}
/*****************************************************************************
@@ -10052,7 +10108,8 @@ void Compiler::impImportBlockCode(BasicBlock* block)
/* Pop the value being assigned */
{
- StackEntry se = impPopStack(clsHnd);
+ StackEntry se = impPopStack();
+ clsHnd = se.seTypeInfo.GetClassHandle();
op1 = se.val;
tiRetVal = se.seTypeInfo;
}
@@ -11916,14 +11973,12 @@ void Compiler::impImportBlockCode(BasicBlock* block)
break;
case CEE_POP:
- if (tiVerificationNeeded)
- {
- impStackTop(0);
- }
-
+ {
/* Pull the top value from the stack */
- op1 = impPopStack(clsHnd).val;
+ StackEntry se = impPopStack();
+ clsHnd = se.seTypeInfo.GetClassHandle();
+ op1 = se.val;
/* Get hold of the type of the value being duplicated */
@@ -11974,10 +12029,11 @@ void Compiler::impImportBlockCode(BasicBlock* block)
}
/* No side effects - just throw the <BEEP> thing away */
- break;
+ }
+ break;
case CEE_DUP:
-
+ {
if (tiVerificationNeeded)
{
// Dup could start the begining of delegate creation sequence, remember that
@@ -11988,7 +12044,9 @@ void Compiler::impImportBlockCode(BasicBlock* block)
// If the expression to dup is simple, just clone it.
// Otherwise spill it to a temp, and reload the temp
// twice.
- op1 = impPopStack(tiRetVal);
+ StackEntry se = impPopStack();
+ tiRetVal = se.seTypeInfo;
+ op1 = se.val;
if (!opts.compDbgCode && !op1->IsIntegralConst(0) && !op1->IsFPZero() && !op1->IsLocal())
{
@@ -12010,8 +12068,8 @@ void Compiler::impImportBlockCode(BasicBlock* block)
assert(!(op1->gtFlags & GTF_GLOB_EFFECT) && !(op2->gtFlags & GTF_GLOB_EFFECT));
impPushOnStack(op1, tiRetVal);
impPushOnStack(op2, tiRetVal);
-
- break;
+ }
+ break;
case CEE_STIND_I1:
lclTyp = TYP_BYTE;
@@ -12928,8 +12986,10 @@ void Compiler::impImportBlockCode(BasicBlock* block)
if (opcode == CEE_LDFLD || opcode == CEE_LDFLDA)
{
- tiObj = &impStackTop().seTypeInfo;
- obj = impPopStack(objType).val;
+ tiObj = &impStackTop().seTypeInfo;
+ StackEntry se = impPopStack();
+ objType = se.seTypeInfo.GetClassHandle();
+ obj = se.val;
if (impIsThis(obj))
{
@@ -13311,8 +13371,10 @@ void Compiler::impImportBlockCode(BasicBlock* block)
typeInfo tiVal;
/* Pull the value from the stack */
- op2 = impPopStack(tiVal);
- clsHnd = tiVal.GetClassHandle();
+ StackEntry se = impPopStack();
+ op2 = se.val;
+ tiVal = se.seTypeInfo;
+ clsHnd = tiVal.GetClassHandle();
if (opcode == CEE_STFLD)
{
@@ -14552,7 +14614,7 @@ void Compiler::impImportBlockCode(BasicBlock* block)
op1 = gtNewOperNode(GT_IND, TYP_REF, op1);
op1->gtFlags |= GTF_EXCEPT | GTF_GLOB_REF;
- impPushOnStackNoType(op1);
+ impPushOnStack(op1, typeInfo());
opcode = CEE_STIND_REF;
lclTyp = TYP_REF;
goto STIND_POST_VERIFY;
@@ -14995,7 +15057,7 @@ void Compiler::impMarkLclDstNotPromotable(unsigned tmpNum, GenTreePtr src, CORIN
GenTreePtr Compiler::impAssignMultiRegTypeToVar(GenTreePtr op, CORINFO_CLASS_HANDLE hClass)
{
unsigned tmpNum = lvaGrabTemp(true DEBUGARG("Return value temp for multireg return."));
- impAssignTempGen(tmpNum, op, hClass, (unsigned)CHECK_SPILL_NONE);
+ impAssignTempGen(tmpNum, op, hClass, (unsigned)CHECK_SPILL_ALL);
GenTreePtr ret = gtNewLclvNode(tmpNum, op->gtType);
// TODO-1stClassStructs: Handle constant propagation and CSE-ing of multireg returns.
@@ -15050,7 +15112,8 @@ bool Compiler::impReturnInstruction(BasicBlock* block, int prefixFlags, OPCODE&
if (info.compRetType != TYP_VOID)
{
- StackEntry se = impPopStack(retClsHnd);
+ StackEntry se = impPopStack();
+ retClsHnd = se.seTypeInfo.GetClassHandle();
op2 = se.val;
if (!compIsForInlining())
@@ -15398,14 +15461,14 @@ bool Compiler::impReturnInstruction(BasicBlock* block, int prefixFlags, OPCODE&
// We must have imported a tailcall and jumped to RET
if (prefixFlags & PREFIX_TAILCALL)
{
-#ifndef _TARGET_AMD64_
+#if defined(FEATURE_CORECLR) || !defined(_TARGET_AMD64_)
// Jit64 compat:
// This cannot be asserted on Amd64 since we permit the following IL pattern:
// tail.call
// pop
// ret
assert(verCurrentState.esStackDepth == 0 && impOpcodeIsCallOpcode(opcode));
-#endif
+#endif // FEATURE_CORECLR || !_TARGET_AMD64_
opcode = CEE_RET; // To prevent trying to spill if CALL_SITE_BOUNDARIES
@@ -15450,7 +15513,8 @@ inline void Compiler::impReimportMarkBlock(BasicBlock* block)
void Compiler::impReimportMarkSuccessors(BasicBlock* block)
{
- for (unsigned i = 0; i < block->NumSucc(); i++)
+ const unsigned numSuccs = block->NumSucc();
+ for (unsigned i = 0; i < numSuccs; i++)
{
impReimportMarkBlock(block->GetSucc(i));
}
@@ -15625,7 +15689,8 @@ void Compiler::impImportBlock(BasicBlock* block)
JITDUMP("Marking BBF_INTERNAL block BB%02u as BBF_IMPORTED\n", block->bbNum);
block->bbFlags |= BBF_IMPORTED;
- for (unsigned i = 0; i < block->NumSucc(); i++)
+ const unsigned numSuccs = block->NumSucc();
+ for (unsigned i = 0; i < numSuccs; i++)
{
impImportBlockPending(block->GetSucc(i));
}
@@ -16052,7 +16117,8 @@ SPILLSTACK:
impReimportSpillClique(block);
// For blocks that haven't been imported yet, we still need to mark them as pending import.
- for (unsigned i = 0; i < block->NumSucc(); i++)
+ const unsigned numSuccs = block->NumSucc();
+ for (unsigned i = 0; i < numSuccs; i++)
{
BasicBlock* succ = block->GetSucc(i);
if ((succ->bbFlags & BBF_IMPORTED) == 0)
@@ -16066,7 +16132,8 @@ SPILLSTACK:
// otherwise just import the successors of block
/* Does this block jump to any other blocks? */
- for (unsigned i = 0; i < block->NumSucc(); i++)
+ const unsigned numSuccs = block->NumSucc();
+ for (unsigned i = 0; i < numSuccs; i++)
{
impImportBlockPending(block->GetSucc(i));
}
@@ -16323,7 +16390,8 @@ void Compiler::impWalkSpillCliqueFromPred(BasicBlock* block, SpillCliqueWalker*
BasicBlock* blk = node->m_blk;
FreeBlockListNode(node);
- for (unsigned succNum = 0; succNum < blk->NumSucc(); succNum++)
+ const unsigned numSuccs = blk->NumSucc();
+ for (unsigned succNum = 0; succNum < numSuccs; succNum++)
{
BasicBlock* succ = blk->GetSucc(succNum);
// If it's not already in the clique, add it, and also add it
@@ -17107,7 +17175,8 @@ void Compiler::impCheckCanInline(GenTreePtr call,
CORINFO_CONTEXT_HANDLE exactContextHnd;
InlineResult* result;
InlineCandidateInfo** ppInlineCandidateInfo;
- } param = {nullptr};
+ } param;
+ memset(&param, 0, sizeof(param));
param.pThis = this;
param.call = call;
diff --git a/src/jit/instr.cpp b/src/jit/instr.cpp
index e2435cab28..5bbfdde3bc 100644
--- a/src/jit/instr.cpp
+++ b/src/jit/instr.cpp
@@ -244,8 +244,15 @@ void CodeGen::inst_JMP(emitJumpKind jmp, BasicBlock* tgtBlock)
//
// Thus only on x86 do we need to assert that the stack level at the target block matches the current stack level.
//
- assert(tgtBlock->bbTgtStkDepth * sizeof(int) == genStackLevel || compiler->rpFrameType != FT_ESP_FRAME);
+ CLANG_FORMAT_COMMENT_ANCHOR;
+
+#ifdef UNIX_X86_ABI
+ // bbTgtStkDepth is a (pure) argument count (stack alignment padding should be excluded).
+ assert((tgtBlock->bbTgtStkDepth * sizeof(int) == (genStackLevel - curNestedAlignment)) || isFramePointerUsed());
+#else
+ assert((tgtBlock->bbTgtStkDepth * sizeof(int) == genStackLevel) || isFramePointerUsed());
#endif
+#endif // !FEATURE_FIXED_OUT_ARGS
getEmitter()->emitIns_J(emitter::emitJumpKindToIns(jmp), tgtBlock);
}
diff --git a/src/jit/jit.h b/src/jit/jit.h
index ee3f8c9117..5120449411 100644
--- a/src/jit/jit.h
+++ b/src/jit/jit.h
@@ -276,14 +276,14 @@
#define FEATURE_UNIX_AMD64_STRUCT_PASSING_ONLY(x)
#endif // defined(FEATURE_UNIX_AMD64_STRUCT_PASSING)
-#if defined(FEATURE_UNIX_AMD64_STRUCT_PASSING) || (defined(_TARGET_X86_) && !defined(LEGACY_BACKEND))
+#if defined(FEATURE_UNIX_AMD64_STRUCT_PASSING) || (!defined(_TARGET_64BIT_) && !defined(LEGACY_BACKEND))
#define FEATURE_PUT_STRUCT_ARG_STK 1
#define PUT_STRUCT_ARG_STK_ONLY_ARG(x) , x
#define PUT_STRUCT_ARG_STK_ONLY(x) x
-#else // !(defined(FEATURE_UNIX_AMD64_STRUCT_PASSING)|| (defined(_TARGET_X86_) && !defined(LEGACY_BACKEND)))
+#else // !(defined(FEATURE_UNIX_AMD64_STRUCT_PASSING)|| (!defined(_TARGET_64BIT_) && !defined(LEGACY_BACKEND)))
#define PUT_STRUCT_ARG_STK_ONLY_ARG(x)
#define PUT_STRUCT_ARG_STK_ONLY(x)
-#endif // !(defined(FEATURE_UNIX_AMD64_STRUCT_PASSING)|| (defined(_TARGET_X86_) && !defined(LEGACY_BACKEND)))
+#endif // !(defined(FEATURE_UNIX_AMD64_STRUCT_PASSING)|| (!defined(_TARGET_64BIT_) && !defined(LEGACY_BACKEND)))
#if defined(UNIX_AMD64_ABI)
#define UNIX_AMD64_ABI_ONLY_ARG(x) , x
diff --git a/src/jit/jitconfigvalues.h b/src/jit/jitconfigvalues.h
index 624ad1a191..3657696afc 100644
--- a/src/jit/jitconfigvalues.h
+++ b/src/jit/jitconfigvalues.h
@@ -279,6 +279,12 @@ CONFIG_STRING(JitTimeLogCsv, W("JitTimeLogCsv")) // If set, gather JIT throughpu
// mode must be used in internal retail builds.
CONFIG_STRING(TailCallOpt, W("TailCallOpt"))
+CONFIG_INTEGER(JitMeasureNowayAssert, W("JitMeasureNowayAssert"), 0) // Set to 1 to measure noway_assert usage. Only
+ // valid if MEASURE_NOWAY is defined.
+CONFIG_STRING(JitMeasureNowayAssertFile,
+ W("JitMeasureNowayAssertFile")) // Set to file to write noway_assert usage to a file (if not
+ // set: stdout). Only valid if MEASURE_NOWAY is defined.
+
#if defined(DEBUG) || defined(INLINE_DATA)
CONFIG_INTEGER(JitInlineDumpData, W("JitInlineDumpData"), 0)
CONFIG_INTEGER(JitInlineDumpXml, W("JitInlineDumpXml"), 0) // 1 = full xml (all methods), 2 = minimal xml (only method
diff --git a/src/jit/lclvars.cpp b/src/jit/lclvars.cpp
index 5bcb1c8f77..e64b5a1645 100644
--- a/src/jit/lclvars.cpp
+++ b/src/jit/lclvars.cpp
@@ -1459,7 +1459,7 @@ void Compiler::lvaCanPromoteStructType(CORINFO_CLASS_HANDLE typeHnd,
StructPromotionInfo->canPromote = false;
unsigned structSize = info.compCompHnd->getClassSize(typeHnd);
- if (structSize >= MaxOffset)
+ if (structSize > MaxOffset)
{
return; // struct is too large
}
diff --git a/src/jit/liveness.cpp b/src/jit/liveness.cpp
index 47950aee63..d498a6f419 100644
--- a/src/jit/liveness.cpp
+++ b/src/jit/liveness.cpp
@@ -1167,12 +1167,10 @@ class LiveVarAnalysis
}
// Additionally, union in all the live-in tracked vars of successors.
- AllSuccessorIter succsEnd = block->GetAllSuccs(m_compiler).end();
- for (AllSuccessorIter succs = block->GetAllSuccs(m_compiler).begin(); succs != succsEnd; ++succs)
+ for (BasicBlock* succ : block->GetAllSuccs(m_compiler))
{
- BasicBlock* succ = (*succs);
VarSetOps::UnionD(m_compiler, m_liveOut, succ->bbLiveIn);
- m_memoryLiveOut |= (*succs)->bbMemoryLiveIn;
+ m_memoryLiveOut |= succ->bbMemoryLiveIn;
if (succ->bbNum <= block->bbNum)
{
m_hasPossibleBackEdge = true;
diff --git a/src/jit/lsra.cpp b/src/jit/lsra.cpp
index e7c1c839d1..3718ddfb8a 100644
--- a/src/jit/lsra.cpp
+++ b/src/jit/lsra.cpp
@@ -1378,7 +1378,8 @@ void LinearScan::setBlockSequence()
assert(!"Switch with single successor");
}
- for (unsigned succIndex = 0; succIndex < block->NumSucc(compiler); succIndex++)
+ const unsigned numSuccs = block->NumSucc(compiler);
+ for (unsigned succIndex = 0; succIndex < numSuccs; succIndex++)
{
BasicBlock* succ = block->GetSucc(succIndex, compiler);
if (checkForCriticalOutEdge && succ->GetUniquePred(compiler) == nullptr)
@@ -4697,11 +4698,13 @@ void LinearScan::buildIntervals()
{
VarSetOps::DiffD(compiler, expUseSet, nextBlock->bbLiveIn);
}
- AllSuccessorIter succsEnd = block->GetAllSuccs(compiler).end();
- for (AllSuccessorIter succs = block->GetAllSuccs(compiler).begin();
- succs != succsEnd && !VarSetOps::IsEmpty(compiler, expUseSet); ++succs)
+ for (BasicBlock* succ : block->GetAllSuccs(compiler))
{
- BasicBlock* succ = (*succs);
+ if (VarSetOps::IsEmpty(compiler, expUseSet))
+ {
+ break;
+ }
+
if (isBlockVisited(succ))
{
continue;
@@ -9676,10 +9679,12 @@ void LinearScan::resolveEdge(BasicBlock* fromBlock,
// What interval is this register associated with?
// (associated with incoming reg)
- Interval* sourceIntervals[REG_COUNT] = {nullptr};
+ Interval* sourceIntervals[REG_COUNT];
+ memset(&sourceIntervals, 0, sizeof(sourceIntervals));
// Intervals for vars that need to be loaded from the stack
- Interval* stackToRegIntervals[REG_COUNT] = {nullptr};
+ Interval* stackToRegIntervals[REG_COUNT];
+ memset(&stackToRegIntervals, 0, sizeof(stackToRegIntervals));
// Get the starting insertion point for the "to" resolution
GenTreePtr insertionPoint = nullptr;
diff --git a/src/jit/lsraarm.cpp b/src/jit/lsraarm.cpp
index e35e57908a..e83f50c051 100644
--- a/src/jit/lsraarm.cpp
+++ b/src/jit/lsraarm.cpp
@@ -131,7 +131,7 @@ void Lowering::TreeNodeInfoInitLclHeap(GenTree* tree)
//
// Size? Init Memory? # temp regs
// 0 - 0
- // const and <=4 ptr words - hasPspSym ? 1 : 0
+ // const and <=4 str instr - hasPspSym ? 1 : 0
// const and <PageSize No hasPspSym ? 1 : 0
// >4 ptr words Yes hasPspSym ? 2 : 1
// Non-const Yes hasPspSym ? 2 : 1
@@ -173,16 +173,12 @@ void Lowering::TreeNodeInfoInitLclHeap(GenTree* tree)
}
else
{
- // target (regCnt) + tmp + [psp]
- info->internalIntCount = 1;
- info->isInternalRegDelayFree = true;
+ info->internalIntCount = 1;
}
}
else
{
- // target (regCnt) + tmp + [psp]
- info->internalIntCount = 1;
- info->isInternalRegDelayFree = true;
+ info->internalIntCount = 1;
}
if (hasPspSym)
@@ -194,7 +190,13 @@ void Lowering::TreeNodeInfoInitLclHeap(GenTree* tree)
else
{
// target (regCnt) + tmp + [psp]
- info->internalIntCount = hasPspSym ? 2 : 1;
+ info->internalIntCount = hasPspSym ? 2 : 1;
+ }
+
+ // If we are needed in temporary registers we should be sure that
+ // it's different from target (regCnt)
+ if (info->internalIntCount > 0)
+ {
info->isInternalRegDelayFree = true;
}
}
@@ -330,16 +332,33 @@ void Lowering::TreeNodeInfoInit(GenTree* tree)
var_types srcType = castOp->TypeGet();
emitAttr cmpSize = EA_ATTR(genTypeSize(srcType));
- // If we cannot store the comparisons in an immediate for either
- // comparing against the max or min value, then we will need to
- // reserve a temporary register.
-
- bool canStoreMaxValue = emitter::emitIns_valid_imm_for_cmp(castInfo.typeMax, INS_FLAGS_DONT_CARE);
- bool canStoreMinValue = emitter::emitIns_valid_imm_for_cmp(castInfo.typeMin, INS_FLAGS_DONT_CARE);
+ // If we cannot store data in an immediate for instructions,
+ // then we will need to reserve a temporary register.
- if (!canStoreMaxValue || !canStoreMinValue)
+ if (!castInfo.signCheckOnly) // In case of only sign check, temp regs are not needeed.
{
- info->internalIntCount = 1;
+ if (castInfo.unsignedSource || castInfo.unsignedDest)
+ {
+ // check typeMask
+ bool canStoreTypeMask = emitter::emitIns_valid_imm_for_alu(castInfo.typeMask);
+ if (!canStoreTypeMask)
+ {
+ info->internalIntCount = 1;
+ }
+ }
+ else
+ {
+ // For comparing against the max or min value
+ bool canStoreMaxValue =
+ emitter::emitIns_valid_imm_for_cmp(castInfo.typeMax, INS_FLAGS_DONT_CARE);
+ bool canStoreMinValue =
+ emitter::emitIns_valid_imm_for_cmp(castInfo.typeMin, INS_FLAGS_DONT_CARE);
+
+ if (!canStoreMaxValue || !canStoreMinValue)
+ {
+ info->internalIntCount = 1;
+ }
+ }
}
}
}
@@ -425,7 +444,8 @@ void Lowering::TreeNodeInfoInit(GenTree* tree)
if (tree->gtOverflow())
{
// Need a register different from target reg to check for overflow.
- info->internalIntCount = 2;
+ info->internalIntCount = 1;
+ info->isInternalRegDelayFree = true;
}
__fallthrough;
@@ -522,14 +542,10 @@ void Lowering::TreeNodeInfoInit(GenTree* tree)
break;
case GT_ARR_INDEX:
- info->srcCount = 2;
- info->dstCount = 1;
-
- // We need one internal register when generating code for GT_ARR_INDEX, however the
- // register allocator always may just give us the same one as it gives us for the 'dst'
- // as a workaround we will just ask for two internal registers.
- //
- info->internalIntCount = 2;
+ info->srcCount = 2;
+ info->dstCount = 1;
+ info->internalIntCount = 1;
+ info->isInternalRegDelayFree = true;
// For GT_ARR_INDEX, the lifetime of the arrObj must be extended because it is actually used multiple
// times while the result is being computed.
diff --git a/src/jit/lsraarm64.cpp b/src/jit/lsraarm64.cpp
index 3b2d465495..6de00f4bda 100644
--- a/src/jit/lsraarm64.cpp
+++ b/src/jit/lsraarm64.cpp
@@ -289,7 +289,8 @@ void Lowering::TreeNodeInfoInit(GenTree* tree)
if (tree->gtOverflow())
{
// Need a register different from target reg to check for overflow.
- info->internalIntCount = 2;
+ info->internalIntCount = 1;
+ info->isInternalRegDelayFree = true;
}
__fallthrough;
@@ -602,14 +603,10 @@ void Lowering::TreeNodeInfoInit(GenTree* tree)
break;
case GT_ARR_INDEX:
- info->srcCount = 2;
- info->dstCount = 1;
-
- // We need one internal register when generating code for GT_ARR_INDEX, however the
- // register allocator always may just give us the same one as it gives us for the 'dst'
- // as a workaround we will just ask for two internal registers.
- //
- info->internalIntCount = 2;
+ info->srcCount = 2;
+ info->dstCount = 1;
+ info->internalIntCount = 1;
+ info->isInternalRegDelayFree = true;
// For GT_ARR_INDEX, the lifetime of the arrObj must be extended because it is actually used multiple
// times while the result is being computed.
diff --git a/src/jit/morph.cpp b/src/jit/morph.cpp
index 92d5e0967e..f63496b686 100644
--- a/src/jit/morph.cpp
+++ b/src/jit/morph.cpp
@@ -60,7 +60,8 @@ GenTreePtr Compiler::fgMorphCastIntoHelper(GenTreePtr tree, int helper, GenTreeP
GenTreePtr Compiler::fgMorphIntoHelperCall(GenTreePtr tree, int helper, GenTreeArgList* args)
{
- tree->ChangeOper(GT_CALL);
+ // The helper call ought to be semantically equivalent to the original node, so preserve its VN.
+ tree->ChangeOper(GT_CALL, GenTree::PRESERVE_VN);
tree->gtFlags |= GTF_CALL;
if (args)
@@ -3384,10 +3385,19 @@ GenTreeCall* Compiler::fgMorphArgs(GenTreeCall* call)
size = (unsigned)(roundUp(info.compCompHnd->getClassSize(argx->gtArgPlace.gtArgPlaceClsHnd),
TARGET_POINTER_SIZE)) /
TARGET_POINTER_SIZE;
+ if (isHfaArg)
+ {
+ hasMultiregStructArgs = true;
+ }
+ else if (size > 1 && size <= 4)
+ {
+ hasMultiregStructArgs = true;
+ }
}
else
{
// The typical case
+ // long/double type argument(s) will be changed to GT_FIELD_LIST in lower phase
size = genTypeStSz(argx->gtType);
}
#elif defined(_TARGET_X86_)
@@ -3399,7 +3409,8 @@ GenTreeCall* Compiler::fgMorphArgs(GenTreeCall* call)
#ifdef _TARGET_ARM_
else if (isHfaArg)
{
- size = GetHfaCount(argx);
+ size = GetHfaCount(argx);
+ hasMultiregStructArgs = true;
}
#endif // _TARGET_ARM_
else // struct type
@@ -3759,14 +3770,25 @@ GenTreeCall* Compiler::fgMorphArgs(GenTreeCall* call)
}
}
-#ifndef _TARGET_X86_
- // TODO-Arm: Does this apply for _TARGET_ARM_, where structs passed by value can be split between
- // registers and stack?
+#ifdef _TARGET_64BIT_
if (size > 1)
{
hasMultiregStructArgs = true;
}
-#endif // !_TARGET_X86_
+#elif defined(_TARGET_ARM_)
+ // TODO-Arm: Need to handle the case
+ // where structs passed by value can be split between registers and stack.
+ if (size > 1 && size <= 4)
+ {
+ hasMultiregStructArgs = true;
+ }
+#ifndef LEGACY_BACKEND
+ else if (size > 4 && passUsingIntRegs)
+ {
+ NYI_ARM("Struct can be split between registers and stack");
+ }
+#endif // !LEGACY_BACKEND
+#endif // _TARGET_ARM_
}
// The 'size' value has now must have been set. (the original value of zero is an invalid value)
@@ -4058,6 +4080,9 @@ GenTreeCall* Compiler::fgMorphArgs(GenTreeCall* call)
#ifdef _TARGET_ARM_
if (fltArgRegNum > MAX_FLOAT_REG_ARG)
{
+#ifndef LEGACY_BACKEND
+ NYI_ARM("Struct split between float registers and stack");
+#endif // !LEGACY_BACKEND
// This indicates a partial enregistration of a struct type
assert(varTypeIsStruct(argx));
unsigned numRegsPartial = size - (fltArgRegNum - MAX_FLOAT_REG_ARG);
@@ -4087,6 +4112,9 @@ GenTreeCall* Compiler::fgMorphArgs(GenTreeCall* call)
#ifdef _TARGET_ARM_
if (intArgRegNum > MAX_REG_ARG)
{
+#ifndef LEGACY_BACKEND
+ NYI_ARM("Struct split between integer registers and stack");
+#endif // !LEGACY_BACKEND
// This indicates a partial enregistration of a struct type
assert((isStructArg) || argx->OperIsCopyBlkOp() ||
(argx->gtOper == GT_COMMA && (args->gtFlags & GTF_ASG)));
@@ -4145,7 +4173,7 @@ GenTreeCall* Compiler::fgMorphArgs(GenTreeCall* call)
// 'Lower' the MKREFANY tree and insert it.
noway_assert(!reMorphing);
-#ifdef _TARGET_X86_
+#ifndef _TARGET_64BIT_
// Build the mkrefany as a GT_FIELD_LIST
GenTreeFieldList* fieldList = new (this, GT_FIELD_LIST)
@@ -4156,7 +4184,7 @@ GenTreeCall* Compiler::fgMorphArgs(GenTreeCall* call)
fp->node = fieldList;
args->gtOp.gtOp1 = fieldList;
-#else // !_TARGET_X86_
+#else // _TARGET_64BIT_
// Get a new temp
// Here we don't need unsafe value cls check since the addr of temp is used only in mkrefany
@@ -4182,7 +4210,7 @@ GenTreeCall* Compiler::fgMorphArgs(GenTreeCall* call)
// EvalArgsToTemps will cause tmp to actually get loaded as the argument
call->fgArgInfo->EvalToTmp(argIndex, tmp, asg);
lvaSetVarAddrExposed(tmp);
-#endif // !_TARGET_X86_
+#endif // _TARGET_64BIT_
}
#endif // !LEGACY_BACKEND
@@ -4221,7 +4249,7 @@ GenTreeCall* Compiler::fgMorphArgs(GenTreeCall* call)
}
}
}
-#endif // defined (_TARGET_X86_) && !defined(LEGACY_BACKEND)
+#endif // _TARGET_X86_ && !LEGACY_BACKEND
#ifdef FEATURE_UNIX_AMD64_STRUCT_PASSING
if (isStructArg && !isRegArg)
@@ -4601,14 +4629,10 @@ void Compiler::fgMorphMultiregStructArgs(GenTreeCall* call)
unsigned flagsSummary = 0;
fgArgInfoPtr allArgInfo = call->fgArgInfo;
- // Currently only ARM64 is using this method to morph the MultiReg struct args
- // in the future AMD64_UNIX and for HFAs ARM32, will also use this method
- //
+ // Currently ARM64/ARM is using this method to morph the MultiReg struct args
+ // in the future AMD64_UNIX will also use this method
CLANG_FORMAT_COMMENT_ANCHOR;
-#ifdef _TARGET_ARM_
- NYI_ARM("fgMorphMultiregStructArgs");
-#endif
#ifdef _TARGET_X86_
assert(!"Logic error: no MultiregStructArgs for X86");
#endif
@@ -4704,13 +4728,13 @@ void Compiler::fgMorphMultiregStructArgs(GenTreeCall* call)
// this also forces the struct to be stack allocated into the local frame.
// For the GT_OBJ case will clone the address expression and generate two (or more)
// indirections.
-// Currently the implementation only handles ARM64 and will NYI for other architectures.
+// Currently the implementation handles ARM64/ARM and will NYI for other architectures.
//
GenTreePtr Compiler::fgMorphMultiregStructArg(GenTreePtr arg, fgArgTabEntryPtr fgEntryPtr)
{
assert(arg->TypeGet() == TYP_STRUCT);
-#ifndef _TARGET_ARM64_
+#ifndef _TARGET_ARMARCH_
NYI("fgMorphMultiregStructArg requires implementation for this target");
#endif
@@ -4766,21 +4790,36 @@ GenTreePtr Compiler::fgMorphMultiregStructArg(GenTreePtr arg, fgArgTabEntryPtr f
}
else
{
+#ifdef _TARGET_ARM64_
assert(structSize <= 2 * TARGET_POINTER_SIZE);
+#elif defined(_TARGET_ARM_)
+ assert(structSize <= 4 * TARGET_POINTER_SIZE);
+#endif
+
+#ifdef _TARGET_ARM64_
BYTE gcPtrs[2] = {TYPE_GC_NONE, TYPE_GC_NONE};
info.compCompHnd->getClassGClayout(objClass, &gcPtrs[0]);
elemCount = 2;
type[0] = getJitGCType(gcPtrs[0]);
type[1] = getJitGCType(gcPtrs[1]);
+#elif defined(_TARGET_ARM_)
+ BYTE gcPtrs[4] = {TYPE_GC_NONE, TYPE_GC_NONE, TYPE_GC_NONE, TYPE_GC_NONE};
+ elemCount = (unsigned)roundUp(structSize, TARGET_POINTER_SIZE) / TARGET_POINTER_SIZE;
+ info.compCompHnd->getClassGClayout(objClass, &gcPtrs[0]);
+ for (unsigned inx = 0; inx < elemCount; inx++)
+ {
+ type[inx] = getJitGCType(gcPtrs[inx]);
+ }
+#endif // _TARGET_ARM_
if ((argValue->OperGet() == GT_LCL_FLD) || (argValue->OperGet() == GT_LCL_VAR))
{
- // We can safely widen this to 16 bytes since we are loading from
+ elemSize = TARGET_POINTER_SIZE;
+ // We can safely widen this to aligned bytes since we are loading from
// a GT_LCL_VAR or a GT_LCL_FLD which is properly padded and
// lives in the stack frame or will be a promoted field.
//
- elemSize = TARGET_POINTER_SIZE;
- structSize = 2 * TARGET_POINTER_SIZE;
+ structSize = elemCount * TARGET_POINTER_SIZE;
}
else // we must have a GT_OBJ
{
@@ -4788,21 +4827,25 @@ GenTreePtr Compiler::fgMorphMultiregStructArg(GenTreePtr arg, fgArgTabEntryPtr f
// We need to load the struct from an arbitrary address
// and we can't read past the end of the structSize
- // We adjust the second load type here
+ // We adjust the last load type here
//
- if (structSize < 2 * TARGET_POINTER_SIZE)
+ unsigned remainingBytes = structSize % TARGET_POINTER_SIZE;
+ unsigned lastElem = elemCount - 1;
+ if (remainingBytes != 0)
{
- switch (structSize - TARGET_POINTER_SIZE)
+ switch (remainingBytes)
{
case 1:
- type[1] = TYP_BYTE;
+ type[lastElem] = TYP_BYTE;
break;
case 2:
- type[1] = TYP_SHORT;
+ type[lastElem] = TYP_SHORT;
break;
+#ifdef _TARGET_ARM64_
case 4:
- type[1] = TYP_INT;
+ type[lastElem] = TYP_INT;
break;
+#endif // _TARGET_ARM64_
default:
noway_assert(!"NYI: odd sized struct in fgMorphMultiregStructArg");
break;
@@ -4824,10 +4867,10 @@ GenTreePtr Compiler::fgMorphMultiregStructArg(GenTreePtr arg, fgArgTabEntryPtr f
assert(varNum < lvaCount);
LclVarDsc* varDsc = &lvaTable[varNum];
- // At this point any TYP_STRUCT LclVar must be a 16-byte struct
+ // At this point any TYP_STRUCT LclVar must be an aligned struct
// or an HFA struct, both which are passed by value.
//
- assert((varDsc->lvSize() == 2 * TARGET_POINTER_SIZE) || varDsc->lvIsHfa());
+ assert((varDsc->lvSize() == elemCount * TARGET_POINTER_SIZE) || varDsc->lvIsHfa());
varDsc->lvIsMultiRegArg = true;
@@ -4855,8 +4898,12 @@ GenTreePtr Compiler::fgMorphMultiregStructArg(GenTreePtr arg, fgArgTabEntryPtr f
}
else
{
+#ifdef _TARGET_ARM64_
// We must have a 16-byte struct (non-HFA)
noway_assert(elemCount == 2);
+#elif defined(_TARGET_ARM_)
+ noway_assert(elemCount <= 4);
+#endif
for (unsigned inx = 0; inx < elemCount; inx++)
{
@@ -4878,6 +4925,7 @@ GenTreePtr Compiler::fgMorphMultiregStructArg(GenTreePtr arg, fgArgTabEntryPtr f
}
}
+#ifdef _TARGET_ARM64_
// Is this LclVar a promoted struct with exactly 2 fields?
// TODO-ARM64-CQ: Support struct promoted HFA types here
if (varDsc->lvPromoted && (varDsc->lvFieldCnt == 2) && !varDsc->lvIsHfa())
@@ -4929,6 +4977,78 @@ GenTreePtr Compiler::fgMorphMultiregStructArg(GenTreePtr arg, fgArgTabEntryPtr f
//
lvaSetVarDoNotEnregister(varNum DEBUG_ARG(DNER_LocalField));
}
+#elif defined(_TARGET_ARM_)
+ // Is this LclVar a promoted struct with exactly same size?
+ if (varDsc->lvPromoted && (varDsc->lvFieldCnt == elemCount) && !varDsc->lvIsHfa())
+ {
+ // See if we have promoted fields?
+ unsigned varNums[4];
+ bool hasBadVarNum = false;
+ for (unsigned inx = 0; inx < elemCount; inx++)
+ {
+ varNums[inx] = lvaGetFieldLocal(varDsc, TARGET_POINTER_SIZE * inx);
+ if (varNums[inx] == BAD_VAR_NUM)
+ {
+ hasBadVarNum = true;
+ break;
+ }
+ }
+
+ // Did we find the promoted fields at the necessary offsets?
+ if (!hasBadVarNum)
+ {
+ LclVarDsc* varDscs[4];
+ var_types varType[4];
+ bool varIsFloat = false;
+
+ for (unsigned inx = 0; inx < elemCount; inx++)
+ {
+ varDscs[inx] = &lvaTable[varNums[inx]];
+ varType[inx] = varDscs[inx]->lvType;
+ if (varTypeIsFloating(varType[inx]))
+ {
+ // TODO-LSRA - It currently doesn't support the passing of floating point LCL_VARS in the
+ // integer
+ // registers. So for now we will use GT_LCLFLD's to pass this struct (it won't be enregistered)
+ //
+ JITDUMP("Multireg struct V%02u will be passed using GT_LCLFLD because it has float fields.\n",
+ varNum);
+ //
+ // we call lvaSetVarDoNotEnregister and do the proper transformation below.
+ //
+ varIsFloat = true;
+ break;
+ }
+ }
+
+ if (!varIsFloat)
+ {
+ unsigned offset = 0;
+ GenTreeFieldList* listEntry = nullptr;
+ // We can use the struct promoted field as arguments
+ for (unsigned inx = 0; inx < elemCount; inx++)
+ {
+ GenTreePtr lclVar = gtNewLclvNode(varNums[inx], varType[inx], varNums[inx]);
+ // Create a new tree for 'arg'
+ // replace the existing LDOBJ(ADDR(LCLVAR))
+ listEntry = new (this, GT_FIELD_LIST) GenTreeFieldList(lclVar, offset, varType[inx], listEntry);
+ if (newArg == nullptr)
+ {
+ newArg = listEntry;
+ }
+ offset += TARGET_POINTER_SIZE;
+ }
+ }
+ }
+ }
+ else
+ {
+ //
+ // We will create a list of GT_LCL_FLDs nodes to pass this struct
+ //
+ lvaSetVarDoNotEnregister(varNum DEBUG_ARG(DNER_LocalField));
+ }
+#endif // _TARGET_ARM_
}
// If we didn't set newarg to a new List Node tree
@@ -7862,7 +7982,7 @@ GenTreePtr Compiler::fgMorphCall(GenTreeCall* call)
// the call.
GenTreeStmt* nextMorphStmt = fgMorphStmt->gtNextStmt;
-#ifdef _TARGET_AMD64_
+#if !defined(FEATURE_CORECLR) && defined(_TARGET_AMD64_)
// Legacy Jit64 Compat:
// There could be any number of GT_NOPs between tail call and GT_RETURN.
// That is tail call pattern could be one of the following:
@@ -7929,7 +8049,7 @@ GenTreePtr Compiler::fgMorphCall(GenTreeCall* call)
fgRemoveStmt(compCurBB, morphStmtToRemove);
}
}
-#endif // _TARGET_AMD64_
+#endif // !FEATURE_CORECLR && _TARGET_AMD64_
// Delete GT_RETURN if any
if (nextMorphStmt != nullptr)
@@ -11416,6 +11536,20 @@ GenTreePtr Compiler::fgMorphSmpOp(GenTreePtr tree, MorphAddrContext* mac)
}
}
+ // If gtOp1 is a GT_FIELD, we need to pass down the mac if
+ // its parent is GT_ADDR, since the address of the field
+ // is part of an ongoing address computation. Otherwise
+ // op1 represents the value of the field and so any address
+ // calculations it does are in a new context.
+ if ((op1->gtOper == GT_FIELD) && (tree->gtOper != GT_ADDR))
+ {
+ subMac1 = nullptr;
+
+ // The impact of this field's value to any ongoing
+ // address computation is handled below when looking
+ // at op2.
+ }
+
tree->gtOp.gtOp1 = op1 = fgMorphTree(op1, subMac1);
#if LOCAL_ASSERTION_PROP
@@ -11496,7 +11630,6 @@ GenTreePtr Compiler::fgMorphSmpOp(GenTreePtr tree, MorphAddrContext* mac)
// (These are used to convey parent context about how addresses being calculated
// will be used; see the specification comment for MorphAddrContext for full details.)
// Assume it's an Ind context to start.
- MorphAddrContext subIndMac2(MACK_Ind);
switch (tree->gtOper)
{
case GT_ADD:
@@ -11517,6 +11650,17 @@ GenTreePtr Compiler::fgMorphSmpOp(GenTreePtr tree, MorphAddrContext* mac)
default:
break;
}
+
+ // If gtOp2 is a GT_FIELD, we must be taking its value,
+ // so it should evaluate its address in a new context.
+ if (op2->gtOper == GT_FIELD)
+ {
+ // The impact of this field's value to any ongoing
+ // address computation is handled above when looking
+ // at op1.
+ mac = nullptr;
+ }
+
tree->gtOp.gtOp2 = op2 = fgMorphTree(op2, mac);
/* Propagate the side effect flags from op2 */
@@ -13676,20 +13820,20 @@ GenTree* Compiler::fgMorphSmpOpOptional(GenTreeOp* tree)
/* Make sure we have the operator range right */
- noway_assert(GT_SUB == GT_ADD + 1);
- noway_assert(GT_MUL == GT_ADD + 2);
- noway_assert(GT_DIV == GT_ADD + 3);
- noway_assert(GT_MOD == GT_ADD + 4);
- noway_assert(GT_UDIV == GT_ADD + 5);
- noway_assert(GT_UMOD == GT_ADD + 6);
+ static_assert(GT_SUB == GT_ADD + 1, "bad oper value");
+ static_assert(GT_MUL == GT_ADD + 2, "bad oper value");
+ static_assert(GT_DIV == GT_ADD + 3, "bad oper value");
+ static_assert(GT_MOD == GT_ADD + 4, "bad oper value");
+ static_assert(GT_UDIV == GT_ADD + 5, "bad oper value");
+ static_assert(GT_UMOD == GT_ADD + 6, "bad oper value");
- noway_assert(GT_OR == GT_ADD + 7);
- noway_assert(GT_XOR == GT_ADD + 8);
- noway_assert(GT_AND == GT_ADD + 9);
+ static_assert(GT_OR == GT_ADD + 7, "bad oper value");
+ static_assert(GT_XOR == GT_ADD + 8, "bad oper value");
+ static_assert(GT_AND == GT_ADD + 9, "bad oper value");
- noway_assert(GT_LSH == GT_ADD + 10);
- noway_assert(GT_RSH == GT_ADD + 11);
- noway_assert(GT_RSZ == GT_ADD + 12);
+ static_assert(GT_LSH == GT_ADD + 10, "bad oper value");
+ static_assert(GT_RSH == GT_ADD + 11, "bad oper value");
+ static_assert(GT_RSZ == GT_ADD + 12, "bad oper value");
/* Check for a suitable operator on the RHS */
diff --git a/src/jit/optimizer.cpp b/src/jit/optimizer.cpp
index c18ebc55d0..710dac540c 100644
--- a/src/jit/optimizer.cpp
+++ b/src/jit/optimizer.cpp
@@ -7638,6 +7638,15 @@ bool Compiler::optExtractArrIndex(GenTreePtr tree, ArrIndex* result, unsigned lh
{
return false;
}
+
+ // For span we may see gtArrLen is a local var or local field.
+ // We won't try and extract those.
+ const genTreeOps arrayOp = arrBndsChk->gtArrLen->gtOper;
+
+ if ((arrayOp == GT_LCL_VAR) || (arrayOp == GT_LCL_FLD))
+ {
+ return false;
+ }
if (arrBndsChk->gtArrLen->gtGetOp1()->gtOper != GT_LCL_VAR)
{
return false;
diff --git a/src/jit/protononjit/CMakeLists.txt b/src/jit/protononjit/CMakeLists.txt
index e209e4cd36..6adf4b1b1b 100644
--- a/src/jit/protononjit/CMakeLists.txt
+++ b/src/jit/protononjit/CMakeLists.txt
@@ -13,10 +13,12 @@ if (CLR_CMAKE_PLATFORM_ARCH_I386)
remove_definitions(-D_TARGET_X86_=1)
add_definitions(-D_TARGET_ARM_)
set(JIT_ARCH_ALTJIT_SOURCES ${JIT_ARM_SOURCES})
+ set(JIT_ARCH_LINK_LIBRARIES gcinfo_arm)
elseif(CLR_CMAKE_PLATFORM_ARCH_AMD64)
remove_definitions(-D_TARGET_AMD64_=1)
add_definitions(-D_TARGET_ARM64_)
set(JIT_ARCH_ALTJIT_SOURCES ${JIT_ARM64_SOURCES})
+ set(JIT_ARCH_LINK_LIBRARIES gcinfo_arm64)
else()
clr_unknown_arch()
endif()
@@ -49,7 +51,7 @@ set_property(TARGET protononjit APPEND_STRING PROPERTY LINK_DEPENDS ${JIT_EXPORT
set(RYUJIT_LINK_LIBRARIES
utilcodestaticnohost
- gcinfo
+ ${JIT_ARCH_LINK_LIBRARIES}
)
if(CLR_CMAKE_PLATFORM_UNIX)
diff --git a/src/jit/simdcodegenxarch.cpp b/src/jit/simdcodegenxarch.cpp
index 468d302d17..940ba5f9e8 100644
--- a/src/jit/simdcodegenxarch.cpp
+++ b/src/jit/simdcodegenxarch.cpp
@@ -694,9 +694,7 @@ void CodeGen::genSIMDIntrinsicInit(GenTreeSIMD* simdNode)
ins = ins_CopyIntToFloat(TYP_INT, TYP_FLOAT);
inst_RV_RV(ins, targetReg, op1loReg, TYP_INT, emitTypeSize(TYP_INT));
- assert(simdNode->gtRsvdRegs != RBM_NONE);
- assert(genCountBits(simdNode->gtRsvdRegs) == 1);
- regNumber tmpReg = genRegNumFromMask(simdNode->gtRsvdRegs);
+ regNumber tmpReg = simdNode->GetSingleTempReg();
regNumber op1hiReg = genConsumeReg(op1hi);
ins = ins_CopyIntToFloat(TYP_INT, TYP_FLOAT);
@@ -863,9 +861,7 @@ void CodeGen::genSIMDIntrinsicInitN(GenTreeSIMD* simdNode)
// Note that we cannot use targetReg before consumed all source operands. Therefore,
// Need an internal register to stitch together all the values into a single vector
// in an XMM reg.
- assert(simdNode->gtRsvdRegs != RBM_NONE);
- assert(genCountBits(simdNode->gtRsvdRegs) == 1);
- regNumber vectorReg = genRegNumFromMask(simdNode->gtRsvdRegs);
+ regNumber vectorReg = simdNode->GetSingleTempReg();
// Zero out vectorReg if we are constructing a vector whose size is not equal to targetType vector size.
// For example in case of Vector4f we don't need to zero when using SSE2.
@@ -992,14 +988,9 @@ void CodeGen::genSIMDIntrinsicBinOp(GenTreeSIMD* simdNode)
{
// We need a temporary register that is NOT the same as the target,
// and we MAY need another.
- assert(simdNode->gtRsvdRegs != RBM_NONE);
- assert(genCountBits(simdNode->gtRsvdRegs) == 2);
-
- regMaskTP tmpRegsMask = simdNode->gtRsvdRegs;
- regMaskTP tmpReg1Mask = genFindLowestBit(tmpRegsMask);
- tmpRegsMask &= ~tmpReg1Mask;
- regNumber tmpReg = genRegNumFromMask(tmpReg1Mask);
- regNumber tmpReg2 = genRegNumFromMask(tmpRegsMask);
+ regNumber tmpReg = simdNode->ExtractTempReg();
+ regNumber tmpReg2 = simdNode->GetSingleTempReg();
+
// The register allocator guarantees the following conditions:
// - the only registers that may be the same among op1Reg, op2Reg, tmpReg
// and tmpReg2 are op1Reg and op2Reg.
@@ -1269,7 +1260,7 @@ void CodeGen::genSIMDIntrinsicRelOp(GenTreeSIMD* simdNode)
else
{
// We need one additional SIMD register to store the result of the SIMD compare.
- regNumber tmpReg1 = genRegNumFromMask(simdNode->gtRsvdRegs & RBM_ALLFLOAT);
+ regNumber tmpReg1 = simdNode->GetSingleTempReg(RBM_ALLFLOAT);
// tmpReg1 = (op1Reg == op2Reg)
// Call this value of tmpReg1 as 'compResult' for further reference below.
@@ -1305,7 +1296,7 @@ void CodeGen::genSIMDIntrinsicRelOp(GenTreeSIMD* simdNode)
{
// If we are not materializing result into a register,
// we would have reserved an int type internal register.
- intReg = genRegNumFromMask(simdNode->gtRsvdRegs & RBM_ALLINT);
+ intReg = simdNode->GetSingleTempReg(RBM_ALLINT);
}
else
{
@@ -1313,7 +1304,7 @@ void CodeGen::genSIMDIntrinsicRelOp(GenTreeSIMD* simdNode)
intReg = targetReg;
// Must have not reserved any int type internal registers.
- assert(genCountBits(simdNode->gtRsvdRegs & RBM_ALLINT) == 0);
+ assert(simdNode->AvailableTempRegCount(RBM_ALLINT) == 0);
}
inst_RV_RV(INS_pmovmskb, intReg, tmpReg1, simdType, emitActualTypeSize(simdType));
@@ -1430,16 +1421,12 @@ void CodeGen::genSIMDIntrinsicDotProduct(GenTreeSIMD* simdNode)
{
if ((compiler->getSIMDInstructionSet() == InstructionSet_SSE2) || (simdEvalType == TYP_SIMD32))
{
- assert(simdNode->gtRsvdRegs != RBM_NONE);
- assert(genCountBits(simdNode->gtRsvdRegs) == 1);
-
- tmpReg1 = genRegNumFromMask(simdNode->gtRsvdRegs);
- assert(tmpReg1 != REG_NA);
+ tmpReg1 = simdNode->GetSingleTempReg();
assert(tmpReg1 != targetReg);
}
else
{
- assert(simdNode->gtRsvdRegs == RBM_NONE);
+ assert(simdNode->AvailableTempRegCount() == 0);
}
}
else
@@ -1449,17 +1436,12 @@ void CodeGen::genSIMDIntrinsicDotProduct(GenTreeSIMD* simdNode)
if (iset == InstructionSet_SSE3_4)
{
- // Must have reserved 1 scratch register.
- assert(genCountBits(simdNode->gtRsvdRegs) == 1);
- tmpReg1 = genRegNumFromMask(simdNode->gtRsvdRegs);
+ tmpReg1 = simdNode->GetSingleTempReg();
}
else
{
- // Must have reserved 2 scratch registers.
- assert(genCountBits(simdNode->gtRsvdRegs) == 2);
- regMaskTP tmpRegMask = genFindLowestBit(simdNode->gtRsvdRegs);
- tmpReg1 = genRegNumFromMask(tmpRegMask);
- tmpReg2 = genRegNumFromMask(simdNode->gtRsvdRegs & ~tmpRegMask);
+ tmpReg1 = simdNode->ExtractTempReg();
+ tmpReg2 = simdNode->GetSingleTempReg();
}
}
@@ -1803,10 +1785,9 @@ void CodeGen::genSIMDIntrinsicGetItem(GenTreeSIMD* simdNode)
}
regNumber tmpReg = REG_NA;
- if (simdNode->gtRsvdRegs != RBM_NONE)
+ if (simdNode->AvailableTempRegCount() != 0)
{
- assert(genCountBits(simdNode->gtRsvdRegs) == 1);
- tmpReg = genRegNumFromMask(simdNode->gtRsvdRegs);
+ tmpReg = simdNode->GetSingleTempReg();
}
else
{
@@ -2011,9 +1992,7 @@ void CodeGen::genSIMDIntrinsicSetItem(GenTreeSIMD* simdNode)
if (compiler->getSIMDInstructionSet() == InstructionSet_SSE2)
{
// We need one additional int register as scratch
- assert(simdNode->gtRsvdRegs != RBM_NONE);
- assert(genCountBits(simdNode->gtRsvdRegs) == 1);
- regNumber tmpReg = genRegNumFromMask(simdNode->gtRsvdRegs);
+ regNumber tmpReg = simdNode->GetSingleTempReg();
assert(genIsValidIntReg(tmpReg));
// Move the value from xmm reg to an int reg
@@ -2103,9 +2082,7 @@ void CodeGen::genStoreIndTypeSIMD12(GenTree* treeNode)
#endif
// Need an addtional Xmm register to extract upper 4 bytes from data.
- assert(treeNode->gtRsvdRegs != RBM_NONE);
- assert(genCountBits(treeNode->gtRsvdRegs) == 1);
- regNumber tmpReg = genRegNumFromMask(treeNode->gtRsvdRegs);
+ regNumber tmpReg = treeNode->GetSingleTempReg();
genConsumeOperands(treeNode->AsOp());
@@ -2141,10 +2118,7 @@ void CodeGen::genLoadIndTypeSIMD12(GenTree* treeNode)
regNumber operandReg = genConsumeReg(op1);
// Need an addtional Xmm register to read upper 4 bytes, which is different from targetReg
- assert(treeNode->gtRsvdRegs != RBM_NONE);
- assert(genCountBits(treeNode->gtRsvdRegs) == 1);
-
- regNumber tmpReg = genRegNumFromMask(treeNode->gtRsvdRegs);
+ regNumber tmpReg = treeNode->GetSingleTempReg();
assert(tmpReg != targetReg);
// Load upper 4 bytes in tmpReg
@@ -2188,9 +2162,7 @@ void CodeGen::genStoreLclTypeSIMD12(GenTree* treeNode)
regNumber operandReg = genConsumeReg(op1);
// Need an addtional Xmm register to extract upper 4 bytes from data.
- assert(treeNode->gtRsvdRegs != RBM_NONE);
- assert(genCountBits(treeNode->gtRsvdRegs) == 1);
- regNumber tmpReg = genRegNumFromMask(treeNode->gtRsvdRegs);
+ regNumber tmpReg = treeNode->GetSingleTempReg();
// store lower 8 bytes
getEmitter()->emitIns_S_R(ins_Store(TYP_DOUBLE), EA_8BYTE, operandReg, varNum, offs);
@@ -2227,12 +2199,8 @@ void CodeGen::genLoadLclTypeSIMD12(GenTree* treeNode)
offs = treeNode->gtLclFld.gtLclOffs;
}
- // Need an additional Xmm register that is different from
- // targetReg to read upper 4 bytes.
- assert(treeNode->gtRsvdRegs != RBM_NONE);
- assert(genCountBits(treeNode->gtRsvdRegs) == 1);
-
- regNumber tmpReg = genRegNumFromMask(treeNode->gtRsvdRegs);
+ // Need an additional Xmm register that is different from targetReg to read upper 4 bytes.
+ regNumber tmpReg = treeNode->GetSingleTempReg();
assert(tmpReg != targetReg);
// Read upper 4 bytes to tmpReg
@@ -2298,9 +2266,7 @@ void CodeGen::genPutArgStkSIMD12(GenTree* treeNode)
regNumber operandReg = genConsumeReg(op1);
// Need an addtional Xmm register to extract upper 4 bytes from data.
- assert(treeNode->gtRsvdRegs != RBM_NONE);
- assert(genCountBits(treeNode->gtRsvdRegs) == 1);
- regNumber tmpReg = genRegNumFromMask(treeNode->gtRsvdRegs);
+ regNumber tmpReg = treeNode->GetSingleTempReg();
genStoreSIMD12ToStack(operandReg, tmpReg);
}
diff --git a/src/jit/ssabuilder.cpp b/src/jit/ssabuilder.cpp
index 3d74234b26..5cbe12af3f 100644
--- a/src/jit/ssabuilder.cpp
+++ b/src/jit/ssabuilder.cpp
@@ -1391,11 +1391,8 @@ void SsaBuilder::BlockRenameVariables(BasicBlock* block, SsaRenameState* pRename
*/
void SsaBuilder::AssignPhiNodeRhsVariables(BasicBlock* block, SsaRenameState* pRenameState)
{
- BasicBlock::AllSuccs allSuccs = block->GetAllSuccs(m_pCompiler);
- AllSuccessorIter allSuccsEnd = allSuccs.end();
- for (AllSuccessorIter allSuccsIter = allSuccs.begin(); allSuccsIter != allSuccsEnd; ++allSuccsIter)
+ for (BasicBlock* succ : block->GetAllSuccs(m_pCompiler))
{
- BasicBlock* succ = (*allSuccsIter);
// Walk the statements for phi nodes.
for (GenTreePtr stmt = succ->bbTreeList; stmt != nullptr && stmt->IsPhiDefnStmt(); stmt = stmt->gtNext)
{
diff --git a/src/jit/valuenum.cpp b/src/jit/valuenum.cpp
index 03bc204070..5b40122f1e 100644
--- a/src/jit/valuenum.cpp
+++ b/src/jit/valuenum.cpp
@@ -4371,10 +4371,8 @@ struct ValueNumberState
SetVisitBit(blk->bbNum, BVB_complete);
- AllSuccessorIter succsEnd = blk->GetAllSuccs(m_comp).end();
- for (AllSuccessorIter succs = blk->GetAllSuccs(m_comp).begin(); succs != succsEnd; ++succs)
+ for (BasicBlock* succ : blk->GetAllSuccs(m_comp))
{
- BasicBlock* succ = (*succs);
#ifdef DEBUG_VN_VISIT
JITDUMP(" Succ(BB%02u).\n", succ->bbNum);
#endif // DEBUG_VN_VISIT
diff --git a/src/mscorlib/Resources/Strings.resx b/src/mscorlib/Resources/Strings.resx
index cb9474fe00..791d1ca04d 100644
--- a/src/mscorlib/Resources/Strings.resx
+++ b/src/mscorlib/Resources/Strings.resx
@@ -2864,9 +2864,6 @@
<data name="NotSupported_AppX" xml:space="preserve">
<value>{0} is not supported in AppX.</value>
</data>
- <data name="NotSupported_AssemblyLoadCodeBase" xml:space="preserve">
- <value>Assembly.Load with a Codebase is not supported.</value>
- </data>
<data name="NotSupported_AssemblyLoadFromHash" xml:space="preserve">
<value>Assembly.LoadFrom with hashValue is not supported.</value>
</data>
@@ -3575,18 +3572,9 @@
<data name="LockRecursionException_RecursiveWriteNotAllowed" xml:space="preserve">
<value>Recursive write lock acquisitions not allowed in this mode.</value>
</data>
- <data name="LockRecursionException_ReadAfterWriteNotAllowed" xml:space="preserve">
- <value>A read lock may not be acquired with the write lock held in this mode.</value>
- </data>
<data name="LockRecursionException_RecursiveUpgradeNotAllowed" xml:space="preserve">
<value>Recursive upgradeable lock acquisitions not allowed in this mode.</value>
</data>
- <data name="LockRecursionException_RecursiveReadNotAllowed" xml:space="preserve">
- <value>Recursive read lock acquisitions not allowed in this mode.</value>
- </data>
- <data name="LockRecursionException_WriteAfterReadNotAllowed" xml:space="preserve">
- <value>Write lock may not be acquired with read lock held. This pattern is prone to deadlocks. Please ensure that read locks are released before taking a write lock. If an upgrade is necessary, use an upgrade lock in place of the read lock.</value>
- </data>
<data name="LockRecursionException_WriteAfterReadNotAllowed" xml:space="preserve">
<value>Write lock may not be acquired with read lock held. This pattern is prone to deadlocks. Please ensure that read locks are released before taking a write lock. If an upgrade is necessary, use an upgrade lock in place of the read lock.</value>
</data>
diff --git a/src/mscorlib/System.Private.CoreLib.csproj b/src/mscorlib/System.Private.CoreLib.csproj
index 3a0917f75e..df86533182 100644
--- a/src/mscorlib/System.Private.CoreLib.csproj
+++ b/src/mscorlib/System.Private.CoreLib.csproj
@@ -86,9 +86,11 @@
<PropertyGroup Condition="'$(OsEnvironment)' == 'Unix'">
<DebugType>portable</DebugType>
</PropertyGroup>
+
<PropertyGroup Condition="'$(TargetsOSX)' == 'true'">
<DefineConstants>PLATFORM_OSX;$(DefineConstants)</DefineConstants>
</PropertyGroup>
+
<!-- Assembly attributes -->
<PropertyGroup>
<AssemblyName>System.Private.CoreLib</AssemblyName>
@@ -379,8 +381,6 @@
<Compile Condition="'$(FeatureCominterop)' == 'true'" Include="$(BclSourcesRoot)\System\Variant.cs" />
<Compile Condition="'$(FeatureClassicCominterop)' == 'true'" Include="$(BclSourcesRoot)\System\OleAutBinder.cs" />
<Compile Include="$(BclSourcesRoot)\System\ByReference.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Span.cs" />
- <Compile Include="$(BclSourcesRoot)\System\ReadOnlySpan.cs" />
</ItemGroup>
<ItemGroup>
<Compile Include="$(BclSourcesRoot)\Internal\Runtime\Augments\EnvironmentAugments.cs" />
@@ -625,6 +625,7 @@
<Compile Condition="'$(FeatureWin32Registry)' == 'true'" Include="$(BclSourcesRoot)\Microsoft\Win32\Registry.cs" />
<Compile Condition="'$(FeatureWin32Registry)' == 'true'" Include="$(BclSourcesRoot)\Microsoft\Win32\RegistryKey.cs" />
<Compile Condition="'$(FeatureWin32Registry)' == 'true'" Include="$(BclSourcesRoot)\Microsoft\Win32\RegistryValueKind.cs" />
+ <Compile Condition="'$(FeatureWin32Registry)' == 'true'" Include="$(BclSourcesRoot)\Microsoft\Win32\RegistryView.cs" />
<Compile Condition="'$(FeatureClassicCominterop)' == 'true'" Include="$(BclSourcesRoot)\Microsoft\Win32\OAVariantLib.cs" />
</ItemGroup>
<ItemGroup>
@@ -757,4 +758,4 @@
<Win32Resource Condition="'$(GenerateNativeVersionInfo)'=='true'">$(IntermediateOutputPath)\System.Private.CoreLib.res</Win32Resource>
</PropertyGroup>
<Import Project="GenerateCompilerResponseFile.targets" />
-</Project> \ No newline at end of file
+</Project>
diff --git a/src/mscorlib/shared/Interop/Unix/System.Native/Interop.Stat.cs b/src/mscorlib/shared/Interop/Unix/System.Native/Interop.Stat.cs
index a8bc2ec7d1..cda00ac6c3 100644
--- a/src/mscorlib/shared/Interop/Unix/System.Native/Interop.Stat.cs
+++ b/src/mscorlib/shared/Interop/Unix/System.Native/Interop.Stat.cs
@@ -27,6 +27,8 @@ internal static partial class Interop
internal long MTime;
internal long CTime;
internal long BirthTime;
+ internal long Dev;
+ internal long Ino;
}
internal static class FileTypes
diff --git a/src/mscorlib/shared/Interop/Windows/Kernel32/Interop.GetCPInfo.cs b/src/mscorlib/shared/Interop/Windows/Kernel32/Interop.GetCPInfo.cs
new file mode 100644
index 0000000000..1665119420
--- /dev/null
+++ b/src/mscorlib/shared/Interop/Windows/Kernel32/Interop.GetCPInfo.cs
@@ -0,0 +1,24 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.IO;
+using System.Text;
+using System.Runtime.InteropServices;
+
+internal partial class Interop
+{
+ internal partial class Kernel32
+ {
+ internal unsafe struct CPINFO
+ {
+ internal int MaxCharSize;
+
+ internal fixed byte DefaultChar[2 /* MAX_DEFAULTCHAR */];
+ internal fixed byte LeadByte[12 /* MAX_LEADBYTES */];
+ }
+
+ [DllImport(Libraries.Kernel32)]
+ internal static extern unsafe int GetCPInfo(uint codePage, CPINFO* lpCpInfo);
+ }
+}
diff --git a/src/mscorlib/shared/System.Private.CoreLib.Shared.projitems b/src/mscorlib/shared/System.Private.CoreLib.Shared.projitems
index 6ef7fc1681..3443a2b339 100644
--- a/src/mscorlib/shared/System.Private.CoreLib.Shared.projitems
+++ b/src/mscorlib/shared/System.Private.CoreLib.Shared.projitems
@@ -169,6 +169,7 @@
<Compile Include="$(MSBuildThisFileDirectory)System\Progress.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\Random.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\RankException.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\ReadOnlySpan.cs" Condition="'$(IsProjectNLibrary)' != 'true'"/>
<Compile Include="$(MSBuildThisFileDirectory)System\Reflection\AmbiguousMatchException.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Reflection\Assembly.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Reflection\AssemblyAlgorithmIdAttribute.cs" />
@@ -282,7 +283,7 @@
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\LoadHint.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\MethodCodeType.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\MethodImplOptions.cs"/>
- <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\ReadOnlyAttribute.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\IsReadOnlyAttribute.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\ReferenceAssemblyAttribute.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\RuntimeCompatibilityAttribute.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\RuntimeFeature.cs"/>
@@ -338,6 +339,8 @@
<Compile Include="$(MSBuildThisFileDirectory)System\Security\SuppressUnmanagedCodeSecurityAttribute.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\Security\UnverifiableCodeAttribute.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\Security\VerificationException.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\Span.cs" Condition="'$(IsProjectNLibrary)' != 'true'"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\Span.NonGeneric.cs" Condition="'$(IsProjectNLibrary)' != 'true'"/>
<Compile Include="$(MSBuildThisFileDirectory)System\StackOverflowException.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\StringComparer.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\StringComparison.cs"/>
@@ -404,7 +407,6 @@
<ItemGroup>
<Compile Include="$(MSBuildThisFileDirectory)System\Diagnostics\Tracing\ActivityTracker.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Diagnostics\Tracing\EventActivityOptions.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)System\Diagnostics\Tracing\EventCounter.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Diagnostics\Tracing\EventDescriptor.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Diagnostics\Tracing\EventProvider.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Diagnostics\Tracing\EventSource.cs" />
@@ -456,6 +458,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.FileTypes.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.FlushFileBuffers.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.FormatMessage.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.GetCPInfo.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.GetFileInformationByHandleEx.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.GetFileType_SafeHandle.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.GetFullPathNameW.cs"/>
diff --git a/src/mscorlib/shared/System/CharEnumerator.cs b/src/mscorlib/shared/System/CharEnumerator.cs
index ea9915a7c4..4dbd5cd587 100644
--- a/src/mscorlib/shared/System/CharEnumerator.cs
+++ b/src/mscorlib/shared/System/CharEnumerator.cs
@@ -17,6 +17,7 @@ using System.Collections.Generic;
namespace System
{
+ [Serializable]
public sealed class CharEnumerator : IEnumerator, IEnumerator<char>, IDisposable, ICloneable
{
private String _str;
diff --git a/src/mscorlib/shared/System/Diagnostics/Tracing/EventCounter.cs b/src/mscorlib/shared/System/Diagnostics/Tracing/EventCounter.cs
deleted file mode 100644
index b1f946464e..0000000000
--- a/src/mscorlib/shared/System/Diagnostics/Tracing/EventCounter.cs
+++ /dev/null
@@ -1,436 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Threading;
-#if ES_BUILD_PCL
- using System.Threading.Tasks;
-#endif
-
-#if ES_BUILD_STANDALONE
-namespace Microsoft.Diagnostics.Tracing
-#else
-namespace System.Diagnostics.Tracing
-#endif
-{
- /// <summary>
- /// Provides the ability to collect statistics through EventSource
- /// </summary>
- public class EventCounter
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="EventCounter"/> class.
- /// </summary>
- /// <param name="name">The name.</param>
- /// <param name="eventSource">The event source.</param>
- public EventCounter(string name, EventSource eventSource)
- {
- if (name == null)
- {
- throw new ArgumentNullException(nameof(name));
- }
-
- if (eventSource == null)
- {
- throw new ArgumentNullException(nameof(eventSource));
- }
-
- InitializeBuffer();
- _name = name;
- EventCounterGroup.AddEventCounter(eventSource, this);
- }
-
- /// <summary>
- /// Writes the metric.
- /// </summary>
- /// <param name="value">The value.</param>
- public void WriteMetric(float value)
- {
- Enqueue(value);
- }
-
- #region private implementation
-
- private readonly string _name;
-
- #region Buffer Management
-
- // Values buffering
- private const int BufferedSize = 10;
- private const float UnusedBufferSlotValue = float.NegativeInfinity;
- private const int UnsetIndex = -1;
- private volatile float[] _bufferedValues;
- private volatile int _bufferedValuesIndex;
-
- private void InitializeBuffer()
- {
- _bufferedValues = new float[BufferedSize];
- for (int i = 0; i < _bufferedValues.Length; i++)
- {
- _bufferedValues[i] = UnusedBufferSlotValue;
- }
- }
-
- private void Enqueue(float value)
- {
- // It is possible that two threads read the same bufferedValuesIndex, but only one will be able to write the slot, so that is okay.
- int i = _bufferedValuesIndex;
- while (true)
- {
- float result = Interlocked.CompareExchange(ref _bufferedValues[i], value, UnusedBufferSlotValue);
- i++;
- if (_bufferedValues.Length <= i)
- {
- // It is possible that two threads both think the buffer is full, but only one get to actually flush it, the other
- // will eventually enter this code path and potentially calling Flushing on a buffer that is not full, and that's okay too.
- lock (_bufferedValues)
- {
- Flush();
- }
- i = 0;
- }
-
- if (result == UnusedBufferSlotValue)
- {
- // CompareExchange succeeded
- _bufferedValuesIndex = i;
- return;
- }
- }
- }
-
- private void Flush()
- {
- for (int i = 0; i < _bufferedValues.Length; i++)
- {
- var value = Interlocked.Exchange(ref _bufferedValues[i], UnusedBufferSlotValue);
- if (value != UnusedBufferSlotValue)
- {
- OnMetricWritten(value);
- }
- }
-
- _bufferedValuesIndex = 0;
- }
-
- #endregion // Buffer Management
-
- #region Statistics Calculation
-
- // Statistics
- private int _count;
- private float _sum;
- private float _sumSquared;
- private float _min;
- private float _max;
-
- private void OnMetricWritten(float value)
- {
- _sum += value;
- _sumSquared += value * value;
- if (_count == 0 || value > _max)
- {
- _max = value;
- }
-
- if (_count == 0 || value < _min)
- {
- _min = value;
- }
-
- _count++;
- }
-
- internal EventCounterPayload GetEventCounterPayload()
- {
- lock (_bufferedValues)
- {
- Flush();
- EventCounterPayload result = new EventCounterPayload();
- result.Name = _name;
- result.Count = _count;
- result.Mean = _sum / _count;
- result.StandardDerivation = (float)Math.Sqrt(_sumSquared / _count - _sum * _sum / _count / _count);
- result.Min = _min;
- result.Max = _max;
- ResetStatistics();
- return result;
- }
- }
-
- private void ResetStatistics()
- {
- _count = 0;
- _sum = 0;
- _sumSquared = 0;
- _min = 0;
- _max = 0;
- }
-
- #endregion // Statistics Calculation
-
- #endregion // private implementation
- }
-
- #region internal supporting classes
-
- [EventData]
- internal class EventCounterPayload : IEnumerable<KeyValuePair<string, object>>
- {
- public string Name { get; set; }
-
- public float Mean { get; set; }
-
- public float StandardDerivation { get; set; }
-
- public int Count { get; set; }
-
- public float Min { get; set; }
-
- public float Max { get; set; }
-
- public float IntervalSec { get; internal set; }
-
- #region Implementation of the IEnumerable interface
-
- public IEnumerator<KeyValuePair<string, object>> GetEnumerator()
- {
- return ForEnumeration.GetEnumerator();
- }
-
- IEnumerator IEnumerable.GetEnumerator()
- {
- return ForEnumeration.GetEnumerator();
- }
-
- private IEnumerable<KeyValuePair<string, object>> ForEnumeration
- {
- get
- {
- yield return new KeyValuePair<string, object>("Name", Name);
- yield return new KeyValuePair<string, object>("Mean", Mean);
- yield return new KeyValuePair<string, object>("StandardDerivation", StandardDerivation);
- yield return new KeyValuePair<string, object>("Count", Count);
- yield return new KeyValuePair<string, object>("Min", Min);
- yield return new KeyValuePair<string, object>("Max", Max);
- }
- }
-
- #endregion // Implementation of the IEnumerable interface
- }
-
- internal class EventCounterGroup : IDisposable
- {
- private readonly EventSource _eventSource;
- private readonly int _eventSourceIndex;
- private readonly List<EventCounter> _eventCounters;
-
- internal EventCounterGroup(EventSource eventSource, int eventSourceIndex)
- {
- _eventSource = eventSource;
- _eventSourceIndex = eventSourceIndex;
- _eventCounters = new List<EventCounter>();
- RegisterCommandCallback();
- }
-
- private void Add(EventCounter eventCounter)
- {
- _eventCounters.Add(eventCounter);
- }
-
- #region EventSource Command Processing
-
- private void RegisterCommandCallback()
- {
- _eventSource.EventCommandExecuted += OnEventSourceCommand;
- }
-
- private void OnEventSourceCommand(object sender, EventCommandEventArgs e)
- {
- if (e.Command == EventCommand.Enable || e.Command == EventCommand.Update)
- {
- string valueStr;
- float value;
- if (e.Arguments.TryGetValue("EventCounterIntervalSec", out valueStr) && float.TryParse(valueStr, out value))
- {
- EnableTimer(value);
- }
- }
- }
-
- #endregion // EventSource Command Processing
-
- #region Global EventCounterGroup Array management
-
- private static EventCounterGroup[] s_eventCounterGroups;
-
- internal static void AddEventCounter(EventSource eventSource, EventCounter eventCounter)
- {
- int eventSourceIndex = EventListener.EventSourceIndex(eventSource);
-
- EventCounterGroup.EnsureEventSourceIndexAvailable(eventSourceIndex);
- EventCounterGroup eventCounterGroup = GetEventCounterGroup(eventSource);
- eventCounterGroup.Add(eventCounter);
- }
-
- private static void EnsureEventSourceIndexAvailable(int eventSourceIndex)
- {
- if (EventCounterGroup.s_eventCounterGroups == null)
- {
- EventCounterGroup.s_eventCounterGroups = new EventCounterGroup[eventSourceIndex + 1];
- }
- else if (eventSourceIndex >= EventCounterGroup.s_eventCounterGroups.Length)
- {
- EventCounterGroup[] newEventCounterGroups = new EventCounterGroup[eventSourceIndex + 1];
- Array.Copy(EventCounterGroup.s_eventCounterGroups, 0, newEventCounterGroups, 0, EventCounterGroup.s_eventCounterGroups.Length);
- EventCounterGroup.s_eventCounterGroups = newEventCounterGroups;
- }
- }
-
- private static EventCounterGroup GetEventCounterGroup(EventSource eventSource)
- {
- int eventSourceIndex = EventListener.EventSourceIndex(eventSource);
- EventCounterGroup result = EventCounterGroup.s_eventCounterGroups[eventSourceIndex];
- if (result == null)
- {
- result = new EventCounterGroup(eventSource, eventSourceIndex);
- EventCounterGroup.s_eventCounterGroups[eventSourceIndex] = result;
- }
-
- return result;
- }
-
- #endregion // Global EventCounterGroup Array management
-
- #region Timer Processing
-
- private DateTime _timeStampSinceCollectionStarted;
- private int _pollingIntervalInMilliseconds;
- private Timer _pollingTimer;
-
- private void EnableTimer(float pollingIntervalInSeconds)
- {
- if (pollingIntervalInSeconds == 0)
- {
- if (_pollingTimer != null)
- {
- _pollingTimer.Dispose();
- _pollingTimer = null;
- }
-
- _pollingIntervalInMilliseconds = 0;
- }
- else if (_pollingIntervalInMilliseconds == 0 || pollingIntervalInSeconds < _pollingIntervalInMilliseconds)
- {
- _pollingIntervalInMilliseconds = (int)(pollingIntervalInSeconds * 1000);
- if (_pollingTimer != null)
- {
- _pollingTimer.Dispose();
- _pollingTimer = null;
- }
-
- _timeStampSinceCollectionStarted = DateTime.Now;
- _pollingTimer = new Timer(OnTimer, null, _pollingIntervalInMilliseconds, _pollingIntervalInMilliseconds);
- }
- }
-
- private void OnTimer(object state)
- {
- if (_eventSource.IsEnabled())
- {
- DateTime now = DateTime.Now;
- TimeSpan elapsed = now - _timeStampSinceCollectionStarted;
- lock (_pollingTimer)
- {
- foreach (var eventCounter in _eventCounters)
- {
- EventCounterPayload payload = eventCounter.GetEventCounterPayload();
- payload.IntervalSec = (float)elapsed.TotalSeconds;
- _eventSource.Write("EventCounters", new EventSourceOptions() { Level = EventLevel.LogAlways }, new { Payload = payload });
- }
-
-
- _timeStampSinceCollectionStarted = now;
- }
- }
- else
- {
- _pollingTimer.Dispose();
- _pollingTimer = null;
- EventCounterGroup.s_eventCounterGroups[_eventSourceIndex] = null;
- }
- }
-
- #region PCL timer hack
-
-#if ES_BUILD_PCL
- internal delegate void TimerCallback(object state);
-
- internal sealed class Timer : CancellationTokenSource, IDisposable
- {
- private int _period;
- private TimerCallback _callback;
- private object _state;
-
- internal Timer(TimerCallback callback, object state, int dueTime, int period)
- {
- _callback = callback;
- _state = state;
- _period = period;
- Schedule(dueTime);
- }
-
- private void Schedule(int dueTime)
- {
- Task.Delay(dueTime, Token).ContinueWith(OnTimer, null, CancellationToken.None, TaskContinuationOptions.ExecuteSynchronously | TaskContinuationOptions.OnlyOnRanToCompletion, TaskScheduler.Default);
- }
-
- private void OnTimer(Task t, object s)
- {
- Schedule(_period);
- _callback(_state);
- }
-
- public new void Dispose() { base.Cancel(); }
- }
-#endif
- #endregion // PCL timer hack
-
- #endregion // Timer Processing
-
- #region Implementation of the IDisposable interface
-
- private bool _disposed = false;
-
- public void Dispose()
- {
- Dispose(true);
- }
-
- protected virtual void Dispose(bool disposing)
- {
- if (_disposed)
- {
- return;
- }
-
- if (disposing)
- {
- if (_pollingTimer != null)
- {
- _pollingTimer.Dispose();
- _pollingTimer = null;
- }
- }
-
- _disposed = true;
- }
-
- #endregion // Implementation of the IDisposable interface
- }
-
- #endregion // internal supporting classes
-}
diff --git a/src/mscorlib/shared/System/Diagnostics/Tracing/EventProvider.cs b/src/mscorlib/shared/System/Diagnostics/Tracing/EventProvider.cs
index 57d550dc8c..e18574c1b4 100644
--- a/src/mscorlib/shared/System/Diagnostics/Tracing/EventProvider.cs
+++ b/src/mscorlib/shared/System/Diagnostics/Tracing/EventProvider.cs
@@ -555,21 +555,21 @@ namespace System.Diagnostics.Tracing
{
#if (!ES_BUILD_PCL && !ES_BUILD_PN && !FEATURE_PAL)
string regKey = @"\Microsoft\Windows\CurrentVersion\Winevt\Publishers\{" + m_providerId + "}";
- if (Marshal.SizeOf(typeof(IntPtr)) == 8)
- regKey = @"Software" + @"\Wow6432Node" + regKey;
+ if (System.Runtime.InteropServices.Marshal.SizeOf(typeof(IntPtr)) == 8)
+ regKey = @"HKEY_LOCAL_MACHINE\Software" + @"\Wow6432Node" + regKey;
else
- regKey = @"Software" + regKey;
+ regKey = @"HKEY_LOCAL_MACHINE\Software" + regKey;
string valueName = "ControllerData_Session_" + etwSessionId.ToString(CultureInfo.InvariantCulture);
- using (RegistryKey key = Registry.LocalMachine.OpenSubKey(regKey, writable: false))
- {
- data = key.GetValue(valueName) as byte[];
- }
-
+ // we need to assert this permission for partial trust scenarios
+#if !CORECLR
+ (new RegistryPermission(RegistryPermissionAccess.Read, regKey)).Assert();
+#endif
+ data = Microsoft.Win32.Registry.GetValue(regKey, valueName, null) as byte[];
if (data != null)
{
- // We only used the persisted data from the registry for updates.
+ // We only used the persisted data from the registry for updates.
command = ControllerCommand.Update;
return true;
}
diff --git a/src/mscorlib/src/System/ReadOnlySpan.cs b/src/mscorlib/shared/System/ReadOnlySpan.cs
index 8d0fbad0fc..8ec431f6fb 100644
--- a/src/mscorlib/src/System/ReadOnlySpan.cs
+++ b/src/mscorlib/shared/System/ReadOnlySpan.cs
@@ -20,6 +20,9 @@ namespace System
/// <summary>A byref or a native ptr.</summary>
private readonly ByReference<T> _pointer;
/// <summary>The number of elements this ReadOnlySpan contains.</summary>
+#if PROJECTN
+ [Bound]
+#endif
private readonly int _length;
/// <summary>
@@ -34,7 +37,7 @@ namespace System
if (array == null)
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array);
- _pointer = new ByReference<T>(ref JitHelpers.GetArrayData(array));
+ _pointer = new ByReference<T>(ref Unsafe.As<byte, T>(ref array.GetRawSzArrayData()));
_length = array.Length;
}
@@ -57,7 +60,7 @@ namespace System
if ((uint)start > (uint)array.Length)
ThrowHelper.ThrowArgumentOutOfRangeException();
- _pointer = new ByReference<T>(ref Unsafe.Add(ref JitHelpers.GetArrayData(array), start));
+ _pointer = new ByReference<T>(ref Unsafe.Add(ref Unsafe.As<byte, T>(ref array.GetRawSzArrayData()), start));
_length = array.Length - start;
}
@@ -81,7 +84,7 @@ namespace System
if ((uint)start > (uint)array.Length || (uint)length > (uint)(array.Length - start))
ThrowHelper.ThrowArgumentOutOfRangeException();
- _pointer = new ByReference<T>(ref Unsafe.Add(ref JitHelpers.GetArrayData(array), start));
+ _pointer = new ByReference<T>(ref Unsafe.Add(ref Unsafe.As<byte, T>(ref array.GetRawSzArrayData()), start));
_length = length;
}
@@ -164,14 +167,21 @@ namespace System
/// </exception>
public T this[int index]
{
+#if PROJECTN
+ [BoundsChecking]
+ get
+ {
+ return Unsafe.Add(ref _pointer.Value, index);
+ }
+#else
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
if ((uint)index >= (uint)_length)
ThrowHelper.ThrowIndexOutOfRangeException();
-
return Unsafe.Add(ref _pointer.Value, index);
}
+#endif
}
/// <summary>
@@ -202,7 +212,7 @@ namespace System
if ((uint)_length > (uint)destination.Length)
return false;
- SpanHelper.CopyTo<T>(ref destination.DangerousGetPinnableReference(), ref _pointer.Value, _length);
+ Span.CopyTo<T>(ref destination.DangerousGetPinnableReference(), ref _pointer.Value, _length);
return true;
}
@@ -301,7 +311,7 @@ namespace System
return Array.Empty<T>();
var destination = new T[_length];
- SpanHelper.CopyTo<T>(ref JitHelpers.GetArrayData(destination), ref _pointer.Value, _length);
+ Span.CopyTo<T>(ref Unsafe.As<byte, T>(ref destination.GetRawSzArrayData()), ref _pointer.Value, _length);
return destination;
}
diff --git a/src/mscorlib/shared/System/Runtime/CompilerServices/ReadOnlyAttribute.cs b/src/mscorlib/shared/System/Runtime/CompilerServices/IsReadOnlyAttribute.cs
index aad7310412..657df43957 100644
--- a/src/mscorlib/shared/System/Runtime/CompilerServices/ReadOnlyAttribute.cs
+++ b/src/mscorlib/shared/System/Runtime/CompilerServices/IsReadOnlyAttribute.cs
@@ -12,9 +12,9 @@ namespace System.Runtime.CompilerServices
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
[AttributeUsage(AttributeTargets.All, Inherited = false)]
- public sealed class ReadOnlyAttribute : Attribute
+ public sealed class IsReadOnlyAttribute : Attribute
{
- public ReadOnlyAttribute()
+ public IsReadOnlyAttribute()
{
}
}
diff --git a/src/mscorlib/shared/System/Runtime/CompilerServices/RuntimeFeature.cs b/src/mscorlib/shared/System/Runtime/CompilerServices/RuntimeFeature.cs
index b93c435439..110a55fd2c 100644
--- a/src/mscorlib/shared/System/Runtime/CompilerServices/RuntimeFeature.cs
+++ b/src/mscorlib/shared/System/Runtime/CompilerServices/RuntimeFeature.cs
@@ -12,7 +12,9 @@ namespace System.Runtime.CompilerServices
public static bool IsSupported(string feature)
{
// No features are supported for now.
- // These features should be added as public static readonly string fields in the same class.
+ // These features should be added as public const string fields in the same class.
+ // Example: public const string FeatureName = nameof(FeatureName);
+
return false;
}
}
diff --git a/src/mscorlib/src/System/Span.cs b/src/mscorlib/shared/System/Span.NonGeneric.cs
index 4211083def..4cdba2181a 100644
--- a/src/mscorlib/src/System/Span.cs
+++ b/src/mscorlib/shared/System/Span.NonGeneric.cs
@@ -5,11 +5,6 @@
using System.Diagnostics;
using System.Runtime;
using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using EditorBrowsableState = System.ComponentModel.EditorBrowsableState;
-using EditorBrowsableAttribute = System.ComponentModel.EditorBrowsableAttribute;
-
-#pragma warning disable 0809 //warning CS0809: Obsolete member 'Span<T>.Equals(object)' overrides non-obsolete member 'object.Equals(object)'
#if BIT64
using nuint = System.UInt64;
@@ -20,388 +15,8 @@ using nuint = System.UInt32;
namespace System
{
/// <summary>
- /// Span represents a contiguous region of arbitrary memory. Unlike arrays, it can point to either managed
- /// or native memory, or to memory allocated on the stack. It is type- and memory-safe.
+ /// Extension methods and non-generic helpers for Span and ReadOnlySpan
/// </summary>
- public struct Span<T>
- {
- /// <summary>A byref or a native ptr.</summary>
- private readonly ByReference<T> _pointer;
- /// <summary>The number of elements this Span contains.</summary>
- private readonly int _length;
-
- /// <summary>
- /// Creates a new span over the entirety of the target array.
- /// </summary>
- /// <param name="array">The target array.</param>
- /// <exception cref="System.ArgumentNullException">Thrown when <paramref name="array"/> is a null
- /// reference (Nothing in Visual Basic).</exception>
- /// <exception cref="System.ArrayTypeMismatchException">Thrown when <paramref name="array"/> is covariant and array's type is not exactly T[].</exception>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public Span(T[] array)
- {
- if (array == null)
- ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array);
- if (default(T) == null && array.GetType() != typeof(T[]))
- ThrowHelper.ThrowArrayTypeMismatchException();
-
- _pointer = new ByReference<T>(ref JitHelpers.GetArrayData(array));
- _length = array.Length;
- }
-
- /// <summary>
- /// Creates a new span over the portion of the target array beginning
- /// at 'start' index and covering the remainder of the array.
- /// </summary>
- /// <param name="array">The target array.</param>
- /// <param name="start">The index at which to begin the span.</param>
- /// <exception cref="System.ArgumentNullException">Thrown when <paramref name="array"/> is a null
- /// reference (Nothing in Visual Basic).</exception>
- /// <exception cref="System.ArrayTypeMismatchException">Thrown when <paramref name="array"/> is covariant and array's type is not exactly T[].</exception>
- /// <exception cref="System.ArgumentOutOfRangeException">
- /// Thrown when the specified <paramref name="start"/> is not in the range (&lt;0 or &gt;=Length).
- /// </exception>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public Span(T[] array, int start)
- {
- if (array == null)
- ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array);
- if (default(T) == null && array.GetType() != typeof(T[]))
- ThrowHelper.ThrowArrayTypeMismatchException();
- if ((uint)start > (uint)array.Length)
- ThrowHelper.ThrowArgumentOutOfRangeException();
-
- _pointer = new ByReference<T>(ref Unsafe.Add(ref JitHelpers.GetArrayData(array), start));
- _length = array.Length - start;
- }
-
- /// <summary>
- /// Creates a new span over the portion of the target array beginning
- /// at 'start' index and ending at 'end' index (exclusive).
- /// </summary>
- /// <param name="array">The target array.</param>
- /// <param name="start">The index at which to begin the span.</param>
- /// <param name="length">The number of items in the span.</param>
- /// <exception cref="System.ArgumentNullException">Thrown when <paramref name="array"/> is a null
- /// reference (Nothing in Visual Basic).</exception>
- /// <exception cref="System.ArrayTypeMismatchException">Thrown when <paramref name="array"/> is covariant and array's type is not exactly T[].</exception>
- /// <exception cref="System.ArgumentOutOfRangeException">
- /// Thrown when the specified <paramref name="start"/> or end index is not in the range (&lt;0 or &gt;=Length).
- /// </exception>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public Span(T[] array, int start, int length)
- {
- if (array == null)
- ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array);
- if (default(T) == null && array.GetType() != typeof(T[]))
- ThrowHelper.ThrowArrayTypeMismatchException();
- if ((uint)start > (uint)array.Length || (uint)length > (uint)(array.Length - start))
- ThrowHelper.ThrowArgumentOutOfRangeException();
-
- _pointer = new ByReference<T>(ref Unsafe.Add(ref JitHelpers.GetArrayData(array), start));
- _length = length;
- }
-
- /// <summary>
- /// Creates a new span over the target unmanaged buffer. Clearly this
- /// is quite dangerous, because we are creating arbitrarily typed T's
- /// out of a void*-typed block of memory. And the length is not checked.
- /// But if this creation is correct, then all subsequent uses are correct.
- /// </summary>
- /// <param name="pointer">An unmanaged pointer to memory.</param>
- /// <param name="length">The number of <typeparamref name="T"/> elements the memory contains.</param>
- /// <exception cref="System.ArgumentException">
- /// Thrown when <typeparamref name="T"/> is reference type or contains pointers and hence cannot be stored in unmanaged memory.
- /// </exception>
- /// <exception cref="System.ArgumentOutOfRangeException">
- /// Thrown when the specified <paramref name="length"/> is negative.
- /// </exception>
- [CLSCompliant(false)]
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public unsafe Span(void* pointer, int length)
- {
- if (RuntimeHelpers.IsReferenceOrContainsReferences<T>())
- ThrowHelper.ThrowInvalidTypeWithPointersNotSupported(typeof(T));
- if (length < 0)
- ThrowHelper.ThrowArgumentOutOfRangeException();
-
- _pointer = new ByReference<T>(ref Unsafe.As<byte, T>(ref *(byte*)pointer));
- _length = length;
- }
-
- /// <summary>
- /// Create a new span over a portion of a regular managed object. This can be useful
- /// if part of a managed object represents a "fixed array." This is dangerous because neither the
- /// <paramref name="length"/> is checked, nor <paramref name="obj"/> being null, nor the fact that
- /// "rawPointer" actually lies within <paramref name="obj"/>.
- /// </summary>
- /// <param name="obj">The managed object that contains the data to span over.</param>
- /// <param name="objectData">A reference to data within that object.</param>
- /// <param name="length">The number of <typeparamref name="T"/> elements the memory contains.</param>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static Span<T> DangerousCreate(object obj, ref T objectData, int length) => new Span<T>(ref objectData, length);
-
- // Constructor for internal use only.
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- internal Span(ref T ptr, int length)
- {
- Debug.Assert(length >= 0);
-
- _pointer = new ByReference<T>(ref ptr);
- _length = length;
- }
-
- /// <summary>
- /// Returns a reference to the 0th element of the Span. If the Span is empty, returns a reference to the location where the 0th element
- /// would have been stored. Such a reference can be used for pinning but must never be dereferenced.
- /// </summary>
- public ref T DangerousGetPinnableReference()
- {
- return ref _pointer.Value;
- }
-
- /// <summary>
- /// The number of items in the span.
- /// </summary>
- public int Length => _length;
-
- /// <summary>
- /// Returns true if Length is 0.
- /// </summary>
- public bool IsEmpty => _length == 0;
-
- /// <summary>
- /// Returns a reference to specified element of the Span.
- /// </summary>
- /// <param name="index"></param>
- /// <returns></returns>
- /// <exception cref="System.IndexOutOfRangeException">
- /// Thrown when index less than 0 or index greater than or equal to Length
- /// </exception>
- public ref T this[int index]
- {
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- get
- {
- if ((uint)index >= (uint)_length)
- ThrowHelper.ThrowIndexOutOfRangeException();
-
- return ref Unsafe.Add(ref _pointer.Value, index);
- }
- }
-
- /// <summary>
- /// Clears the contents of this span.
- /// </summary>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public void Clear()
- {
- if (RuntimeHelpers.IsReferenceOrContainsReferences<T>())
- {
- SpanHelper.ClearWithReferences(ref Unsafe.As<T, IntPtr>(ref _pointer.Value), (nuint)_length * (nuint)(Unsafe.SizeOf<T>() / sizeof(nuint)));
- }
- else
- {
- SpanHelper.ClearWithoutReferences(ref Unsafe.As<T, byte>(ref _pointer.Value), (nuint)_length * (nuint)Unsafe.SizeOf<T>());
- }
- }
-
- /// <summary>
- /// Fills the contents of this span with the given value.
- /// </summary>
- public void Fill(T value)
- {
- if (Unsafe.SizeOf<T>() == 1)
- {
- uint length = (uint)_length;
- if (length == 0)
- return;
-
- T tmp = value; // Avoid taking address of the "value" argument. It would regress performance of the loop below.
- Unsafe.InitBlockUnaligned(ref Unsafe.As<T, byte>(ref _pointer.Value), Unsafe.As<T, byte>(ref tmp), length);
- }
- else
- {
- // Do all math as nuint to avoid unnecessary 64->32->64 bit integer truncations
- nuint length = (uint)_length;
- if (length == 0)
- return;
-
- ref T r = ref DangerousGetPinnableReference();
-
- // TODO: Create block fill for value types of power of two sizes e.g. 2,4,8,16
-
- nuint elementSize = (uint)Unsafe.SizeOf<T>();
- nuint i = 0;
- for (; i < (length & ~(nuint)7); i += 8)
- {
- Unsafe.AddByteOffset<T>(ref r, (i + 0) * elementSize) = value;
- Unsafe.AddByteOffset<T>(ref r, (i + 1) * elementSize) = value;
- Unsafe.AddByteOffset<T>(ref r, (i + 2) * elementSize) = value;
- Unsafe.AddByteOffset<T>(ref r, (i + 3) * elementSize) = value;
- Unsafe.AddByteOffset<T>(ref r, (i + 4) * elementSize) = value;
- Unsafe.AddByteOffset<T>(ref r, (i + 5) * elementSize) = value;
- Unsafe.AddByteOffset<T>(ref r, (i + 6) * elementSize) = value;
- Unsafe.AddByteOffset<T>(ref r, (i + 7) * elementSize) = value;
- }
- if (i < (length & ~(nuint)3))
- {
- Unsafe.AddByteOffset<T>(ref r, (i + 0) * elementSize) = value;
- Unsafe.AddByteOffset<T>(ref r, (i + 1) * elementSize) = value;
- Unsafe.AddByteOffset<T>(ref r, (i + 2) * elementSize) = value;
- Unsafe.AddByteOffset<T>(ref r, (i + 3) * elementSize) = value;
- i += 4;
- }
- for (; i < length; i++)
- {
- Unsafe.AddByteOffset<T>(ref r, i * elementSize) = value;
- }
- }
- }
-
- /// <summary>
- /// Copies the contents of this span into destination span. If the source
- /// and destinations overlap, this method behaves as if the original values in
- /// a temporary location before the destination is overwritten.
- /// </summary>
- /// <param name="destination">The span to copy items into.</param>
- /// <exception cref="System.ArgumentException">
- /// Thrown when the destination Span is shorter than the source Span.
- /// </exception>
- public void CopyTo(Span<T> destination)
- {
- if (!TryCopyTo(destination))
- ThrowHelper.ThrowArgumentException_DestinationTooShort();
- }
-
- /// <summary>
- /// Copies the contents of this span into destination span. If the source
- /// and destinations overlap, this method behaves as if the original values in
- /// a temporary location before the destination is overwritten.
- /// </summary>
- /// <param name="destination">The span to copy items into.</param>
- /// <returns>If the destination span is shorter than the source span, this method
- /// return false and no data is written to the destination.</returns>
- public bool TryCopyTo(Span<T> destination)
- {
- if ((uint)_length > (uint)destination.Length)
- return false;
-
- SpanHelper.CopyTo<T>(ref destination._pointer.Value, ref _pointer.Value, _length);
- return true;
- }
-
- /// <summary>
- /// Returns true if left and right point at the same memory and have the same length. Note that
- /// this does *not* check to see if the *contents* are equal.
- /// </summary>
- public static bool operator ==(Span<T> left, Span<T> right)
- {
- return left._length == right._length && Unsafe.AreSame<T>(ref left._pointer.Value, ref right._pointer.Value);
- }
-
- /// <summary>
- /// Returns false if left and right point at the same memory and have the same length. Note that
- /// this does *not* check to see if the *contents* are equal.
- /// </summary>
- public static bool operator !=(Span<T> left, Span<T> right) => !(left == right);
-
- /// <summary>
- /// This method is not supported as spans cannot be boxed. To compare two spans, use operator==.
- /// <exception cref="System.NotSupportedException">
- /// Always thrown by this method.
- /// </exception>
- /// </summary>
- [Obsolete("Equals() on Span will always throw an exception. Use == instead.")]
- [EditorBrowsable(EditorBrowsableState.Never)]
- public override bool Equals(object obj)
- {
- throw new NotSupportedException(SR.NotSupported_CannotCallEqualsOnSpan);
- }
-
- /// <summary>
- /// This method is not supported as spans cannot be boxed.
- /// <exception cref="System.NotSupportedException">
- /// Always thrown by this method.
- /// </exception>
- /// </summary>
- [Obsolete("GetHashCode() on Span will always throw an exception.")]
- [EditorBrowsable(EditorBrowsableState.Never)]
- public override int GetHashCode()
- {
- throw new NotSupportedException(SR.NotSupported_CannotCallGetHashCodeOnSpan);
- }
-
- /// <summary>
- /// Defines an implicit conversion of an array to a <see cref="Span{T}"/>
- /// </summary>
- public static implicit operator Span<T>(T[] array) => new Span<T>(array);
-
- /// <summary>
- /// Defines an implicit conversion of a <see cref="ArraySegment{T}"/> to a <see cref="Span{T}"/>
- /// </summary>
- public static implicit operator Span<T>(ArraySegment<T> arraySegment) => new Span<T>(arraySegment.Array, arraySegment.Offset, arraySegment.Count);
-
- /// <summary>
- /// Defines an implicit conversion of a <see cref="Span{T}"/> to a <see cref="ReadOnlySpan{T}"/>
- /// </summary>
- public static implicit operator ReadOnlySpan<T>(Span<T> span) => new ReadOnlySpan<T>(ref span._pointer.Value, span._length);
-
- /// <summary>
- /// Forms a slice out of the given span, beginning at 'start'.
- /// </summary>
- /// <param name="start">The index at which to begin this slice.</param>
- /// <exception cref="System.ArgumentOutOfRangeException">
- /// Thrown when the specified <paramref name="start"/> index is not in range (&lt;0 or &gt;=Length).
- /// </exception>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public Span<T> Slice(int start)
- {
- if ((uint)start > (uint)_length)
- ThrowHelper.ThrowArgumentOutOfRangeException();
-
- return new Span<T>(ref Unsafe.Add(ref _pointer.Value, start), _length - start);
- }
-
- /// <summary>
- /// Forms a slice out of the given span, beginning at 'start', of given length
- /// </summary>
- /// <param name="start">The index at which to begin this slice.</param>
- /// <param name="length">The desired length for the slice (exclusive).</param>
- /// <exception cref="System.ArgumentOutOfRangeException">
- /// Thrown when the specified <paramref name="start"/> or end index is not in range (&lt;0 or &gt;=Length).
- /// </exception>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public Span<T> Slice(int start, int length)
- {
- if ((uint)start > (uint)_length || (uint)length > (uint)(_length - start))
- ThrowHelper.ThrowArgumentOutOfRangeException();
-
- return new Span<T>(ref Unsafe.Add(ref _pointer.Value, start), length);
- }
-
- /// <summary>
- /// Copies the contents of this span into a new array. This heap
- /// allocates, so should generally be avoided, however it is sometimes
- /// necessary to bridge the gap with APIs written in terms of arrays.
- /// </summary>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public T[] ToArray()
- {
- if (_length == 0)
- return Array.Empty<T>();
-
- var destination = new T[_length];
- SpanHelper.CopyTo<T>(ref JitHelpers.GetArrayData(destination), ref _pointer.Value, _length);
- return destination;
- }
-
- // <summary>
- /// Returns an empty <see cref="Span{T}"/>
- /// </summary>
- public static Span<T> Empty => default(Span<T>);
- }
-
public static class Span
{
/// <summary>
@@ -508,12 +123,9 @@ namespace System
if (text == null)
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.text);
- return new ReadOnlySpan<char>(ref text.GetFirstCharRef(), text.Length);
+ return new ReadOnlySpan<char>(ref text.GetRawStringData(), text.Length);
}
- }
- internal static class SpanHelper
- {
internal static unsafe void CopyTo<T>(ref T destination, ref T source, int elementsCount)
{
if (Unsafe.AreSame(ref destination, ref source))
@@ -553,12 +165,12 @@ namespace System
if (byteLength == 0)
return;
-#if AMD64
+#if AMD64 && CORECLR
if (byteLength > 4096) goto PInvoke;
Unsafe.InitBlockUnaligned(ref b, 0, (uint)byteLength);
return;
-#else // AMD64
- // TODO: Optimize this method on X86 machine
+#else
+ // TODO: Optimize other platforms to be on par with AMD64 CoreCLR
// Note: It's important that this switch handles lengths at least up to 22.
// See notes below near the main loop for why.
@@ -860,7 +472,7 @@ namespace System
}
return;
-#endif // AMD64
+#endif
PInvoke:
RuntimeImports.RhZeroMemory(ref b, byteLength);
diff --git a/src/mscorlib/shared/System/Span.cs b/src/mscorlib/shared/System/Span.cs
new file mode 100644
index 0000000000..82ea35f670
--- /dev/null
+++ b/src/mscorlib/shared/System/Span.cs
@@ -0,0 +1,413 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Diagnostics;
+using System.Runtime;
+using System.Runtime.CompilerServices;
+using EditorBrowsableState = System.ComponentModel.EditorBrowsableState;
+using EditorBrowsableAttribute = System.ComponentModel.EditorBrowsableAttribute;
+
+#pragma warning disable 0809 //warning CS0809: Obsolete member 'Span<T>.Equals(object)' overrides non-obsolete member 'object.Equals(object)'
+
+#if BIT64
+using nuint = System.UInt64;
+#else
+using nuint = System.UInt32;
+#endif
+
+namespace System
+{
+ /// <summary>
+ /// Span represents a contiguous region of arbitrary memory. Unlike arrays, it can point to either managed
+ /// or native memory, or to memory allocated on the stack. It is type- and memory-safe.
+ /// </summary>
+ public struct Span<T>
+ {
+ /// <summary>A byref or a native ptr.</summary>
+ private readonly ByReference<T> _pointer;
+ /// <summary>The number of elements this Span contains.</summary>
+#if PROJECTN
+ [Bound]
+#endif
+ private readonly int _length;
+
+ /// <summary>
+ /// Creates a new span over the entirety of the target array.
+ /// </summary>
+ /// <param name="array">The target array.</param>
+ /// <exception cref="System.ArgumentNullException">Thrown when <paramref name="array"/> is a null
+ /// reference (Nothing in Visual Basic).</exception>
+ /// <exception cref="System.ArrayTypeMismatchException">Thrown when <paramref name="array"/> is covariant and array's type is not exactly T[].</exception>
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public Span(T[] array)
+ {
+ if (array == null)
+ ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array);
+ if (default(T) == null && array.GetType() != typeof(T[]))
+ ThrowHelper.ThrowArrayTypeMismatchException();
+
+ _pointer = new ByReference<T>(ref Unsafe.As<byte, T>(ref array.GetRawSzArrayData()));
+ _length = array.Length;
+ }
+
+ /// <summary>
+ /// Creates a new span over the portion of the target array beginning
+ /// at 'start' index and covering the remainder of the array.
+ /// </summary>
+ /// <param name="array">The target array.</param>
+ /// <param name="start">The index at which to begin the span.</param>
+ /// <exception cref="System.ArgumentNullException">Thrown when <paramref name="array"/> is a null
+ /// reference (Nothing in Visual Basic).</exception>
+ /// <exception cref="System.ArrayTypeMismatchException">Thrown when <paramref name="array"/> is covariant and array's type is not exactly T[].</exception>
+ /// <exception cref="System.ArgumentOutOfRangeException">
+ /// Thrown when the specified <paramref name="start"/> is not in the range (&lt;0 or &gt;=Length).
+ /// </exception>
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public Span(T[] array, int start)
+ {
+ if (array == null)
+ ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array);
+ if (default(T) == null && array.GetType() != typeof(T[]))
+ ThrowHelper.ThrowArrayTypeMismatchException();
+ if ((uint)start > (uint)array.Length)
+ ThrowHelper.ThrowArgumentOutOfRangeException();
+
+ _pointer = new ByReference<T>(ref Unsafe.Add(ref Unsafe.As<byte, T>(ref array.GetRawSzArrayData()), start));
+ _length = array.Length - start;
+ }
+
+ /// <summary>
+ /// Creates a new span over the portion of the target array beginning
+ /// at 'start' index and ending at 'end' index (exclusive).
+ /// </summary>
+ /// <param name="array">The target array.</param>
+ /// <param name="start">The index at which to begin the span.</param>
+ /// <param name="length">The number of items in the span.</param>
+ /// <exception cref="System.ArgumentNullException">Thrown when <paramref name="array"/> is a null
+ /// reference (Nothing in Visual Basic).</exception>
+ /// <exception cref="System.ArrayTypeMismatchException">Thrown when <paramref name="array"/> is covariant and array's type is not exactly T[].</exception>
+ /// <exception cref="System.ArgumentOutOfRangeException">
+ /// Thrown when the specified <paramref name="start"/> or end index is not in the range (&lt;0 or &gt;=Length).
+ /// </exception>
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public Span(T[] array, int start, int length)
+ {
+ if (array == null)
+ ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array);
+ if (default(T) == null && array.GetType() != typeof(T[]))
+ ThrowHelper.ThrowArrayTypeMismatchException();
+ if ((uint)start > (uint)array.Length || (uint)length > (uint)(array.Length - start))
+ ThrowHelper.ThrowArgumentOutOfRangeException();
+
+ _pointer = new ByReference<T>(ref Unsafe.Add(ref Unsafe.As<byte, T>(ref array.GetRawSzArrayData()), start));
+ _length = length;
+ }
+
+ /// <summary>
+ /// Creates a new span over the target unmanaged buffer. Clearly this
+ /// is quite dangerous, because we are creating arbitrarily typed T's
+ /// out of a void*-typed block of memory. And the length is not checked.
+ /// But if this creation is correct, then all subsequent uses are correct.
+ /// </summary>
+ /// <param name="pointer">An unmanaged pointer to memory.</param>
+ /// <param name="length">The number of <typeparamref name="T"/> elements the memory contains.</param>
+ /// <exception cref="System.ArgumentException">
+ /// Thrown when <typeparamref name="T"/> is reference type or contains pointers and hence cannot be stored in unmanaged memory.
+ /// </exception>
+ /// <exception cref="System.ArgumentOutOfRangeException">
+ /// Thrown when the specified <paramref name="length"/> is negative.
+ /// </exception>
+ [CLSCompliant(false)]
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public unsafe Span(void* pointer, int length)
+ {
+ if (RuntimeHelpers.IsReferenceOrContainsReferences<T>())
+ ThrowHelper.ThrowInvalidTypeWithPointersNotSupported(typeof(T));
+ if (length < 0)
+ ThrowHelper.ThrowArgumentOutOfRangeException();
+
+ _pointer = new ByReference<T>(ref Unsafe.As<byte, T>(ref *(byte*)pointer));
+ _length = length;
+ }
+
+ /// <summary>
+ /// Create a new span over a portion of a regular managed object. This can be useful
+ /// if part of a managed object represents a "fixed array." This is dangerous because neither the
+ /// <paramref name="length"/> is checked, nor <paramref name="obj"/> being null, nor the fact that
+ /// "rawPointer" actually lies within <paramref name="obj"/>.
+ /// </summary>
+ /// <param name="obj">The managed object that contains the data to span over.</param>
+ /// <param name="objectData">A reference to data within that object.</param>
+ /// <param name="length">The number of <typeparamref name="T"/> elements the memory contains.</param>
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static Span<T> DangerousCreate(object obj, ref T objectData, int length) => new Span<T>(ref objectData, length);
+
+ // Constructor for internal use only.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ internal Span(ref T ptr, int length)
+ {
+ Debug.Assert(length >= 0);
+
+ _pointer = new ByReference<T>(ref ptr);
+ _length = length;
+ }
+
+ /// <summary>
+ /// Returns a reference to the 0th element of the Span. If the Span is empty, returns a reference to the location where the 0th element
+ /// would have been stored. Such a reference can be used for pinning but must never be dereferenced.
+ /// </summary>
+ public ref T DangerousGetPinnableReference()
+ {
+ return ref _pointer.Value;
+ }
+
+ /// <summary>
+ /// The number of items in the span.
+ /// </summary>
+ public int Length => _length;
+
+ /// <summary>
+ /// Returns true if Length is 0.
+ /// </summary>
+ public bool IsEmpty => _length == 0;
+
+ /// <summary>
+ /// Returns a reference to specified element of the Span.
+ /// </summary>
+ /// <param name="index"></param>
+ /// <returns></returns>
+ /// <exception cref="System.IndexOutOfRangeException">
+ /// Thrown when index less than 0 or index greater than or equal to Length
+ /// </exception>
+ public ref T this[int index]
+ {
+#if PROJECTN
+ [BoundsChecking]
+ get
+ {
+ return ref Unsafe.Add(ref _pointer.Value, index);
+ }
+#else
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ get
+ {
+ if ((uint)index >= (uint)_length)
+ ThrowHelper.ThrowIndexOutOfRangeException();
+ return ref Unsafe.Add(ref _pointer.Value, index);
+ }
+#endif
+ }
+
+ /// <summary>
+ /// Clears the contents of this span.
+ /// </summary>
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public void Clear()
+ {
+ if (RuntimeHelpers.IsReferenceOrContainsReferences<T>())
+ {
+ Span.ClearWithReferences(ref Unsafe.As<T, IntPtr>(ref _pointer.Value), (nuint)_length * (nuint)(Unsafe.SizeOf<T>() / sizeof(nuint)));
+ }
+ else
+ {
+ Span.ClearWithoutReferences(ref Unsafe.As<T, byte>(ref _pointer.Value), (nuint)_length * (nuint)Unsafe.SizeOf<T>());
+ }
+ }
+
+ /// <summary>
+ /// Fills the contents of this span with the given value.
+ /// </summary>
+ public void Fill(T value)
+ {
+ if (Unsafe.SizeOf<T>() == 1)
+ {
+ uint length = (uint)_length;
+ if (length == 0)
+ return;
+
+ T tmp = value; // Avoid taking address of the "value" argument. It would regress performance of the loop below.
+ Unsafe.InitBlockUnaligned(ref Unsafe.As<T, byte>(ref _pointer.Value), Unsafe.As<T, byte>(ref tmp), length);
+ }
+ else
+ {
+ // Do all math as nuint to avoid unnecessary 64->32->64 bit integer truncations
+ nuint length = (uint)_length;
+ if (length == 0)
+ return;
+
+ ref T r = ref DangerousGetPinnableReference();
+
+ // TODO: Create block fill for value types of power of two sizes e.g. 2,4,8,16
+
+ nuint elementSize = (uint)Unsafe.SizeOf<T>();
+ nuint i = 0;
+ for (; i < (length & ~(nuint)7); i += 8)
+ {
+ Unsafe.AddByteOffset<T>(ref r, (i + 0) * elementSize) = value;
+ Unsafe.AddByteOffset<T>(ref r, (i + 1) * elementSize) = value;
+ Unsafe.AddByteOffset<T>(ref r, (i + 2) * elementSize) = value;
+ Unsafe.AddByteOffset<T>(ref r, (i + 3) * elementSize) = value;
+ Unsafe.AddByteOffset<T>(ref r, (i + 4) * elementSize) = value;
+ Unsafe.AddByteOffset<T>(ref r, (i + 5) * elementSize) = value;
+ Unsafe.AddByteOffset<T>(ref r, (i + 6) * elementSize) = value;
+ Unsafe.AddByteOffset<T>(ref r, (i + 7) * elementSize) = value;
+ }
+ if (i < (length & ~(nuint)3))
+ {
+ Unsafe.AddByteOffset<T>(ref r, (i + 0) * elementSize) = value;
+ Unsafe.AddByteOffset<T>(ref r, (i + 1) * elementSize) = value;
+ Unsafe.AddByteOffset<T>(ref r, (i + 2) * elementSize) = value;
+ Unsafe.AddByteOffset<T>(ref r, (i + 3) * elementSize) = value;
+ i += 4;
+ }
+ for (; i < length; i++)
+ {
+ Unsafe.AddByteOffset<T>(ref r, i * elementSize) = value;
+ }
+ }
+ }
+
+ /// <summary>
+ /// Copies the contents of this span into destination span. If the source
+ /// and destinations overlap, this method behaves as if the original values in
+ /// a temporary location before the destination is overwritten.
+ /// </summary>
+ /// <param name="destination">The span to copy items into.</param>
+ /// <exception cref="System.ArgumentException">
+ /// Thrown when the destination Span is shorter than the source Span.
+ /// </exception>
+ public void CopyTo(Span<T> destination)
+ {
+ if (!TryCopyTo(destination))
+ ThrowHelper.ThrowArgumentException_DestinationTooShort();
+ }
+
+ /// <summary>
+ /// Copies the contents of this span into destination span. If the source
+ /// and destinations overlap, this method behaves as if the original values in
+ /// a temporary location before the destination is overwritten.
+ /// </summary>
+ /// <param name="destination">The span to copy items into.</param>
+ /// <returns>If the destination span is shorter than the source span, this method
+ /// return false and no data is written to the destination.</returns>
+ public bool TryCopyTo(Span<T> destination)
+ {
+ if ((uint)_length > (uint)destination.Length)
+ return false;
+
+ Span.CopyTo<T>(ref destination._pointer.Value, ref _pointer.Value, _length);
+ return true;
+ }
+
+ /// <summary>
+ /// Returns true if left and right point at the same memory and have the same length. Note that
+ /// this does *not* check to see if the *contents* are equal.
+ /// </summary>
+ public static bool operator ==(Span<T> left, Span<T> right)
+ {
+ return left._length == right._length && Unsafe.AreSame<T>(ref left._pointer.Value, ref right._pointer.Value);
+ }
+
+ /// <summary>
+ /// Returns false if left and right point at the same memory and have the same length. Note that
+ /// this does *not* check to see if the *contents* are equal.
+ /// </summary>
+ public static bool operator !=(Span<T> left, Span<T> right) => !(left == right);
+
+ /// <summary>
+ /// This method is not supported as spans cannot be boxed. To compare two spans, use operator==.
+ /// <exception cref="System.NotSupportedException">
+ /// Always thrown by this method.
+ /// </exception>
+ /// </summary>
+ [Obsolete("Equals() on Span will always throw an exception. Use == instead.")]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override bool Equals(object obj)
+ {
+ throw new NotSupportedException(SR.NotSupported_CannotCallEqualsOnSpan);
+ }
+
+ /// <summary>
+ /// This method is not supported as spans cannot be boxed.
+ /// <exception cref="System.NotSupportedException">
+ /// Always thrown by this method.
+ /// </exception>
+ /// </summary>
+ [Obsolete("GetHashCode() on Span will always throw an exception.")]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override int GetHashCode()
+ {
+ throw new NotSupportedException(SR.NotSupported_CannotCallGetHashCodeOnSpan);
+ }
+
+ /// <summary>
+ /// Defines an implicit conversion of an array to a <see cref="Span{T}"/>
+ /// </summary>
+ public static implicit operator Span<T>(T[] array) => new Span<T>(array);
+
+ /// <summary>
+ /// Defines an implicit conversion of a <see cref="ArraySegment{T}"/> to a <see cref="Span{T}"/>
+ /// </summary>
+ public static implicit operator Span<T>(ArraySegment<T> arraySegment) => new Span<T>(arraySegment.Array, arraySegment.Offset, arraySegment.Count);
+
+ /// <summary>
+ /// Defines an implicit conversion of a <see cref="Span{T}"/> to a <see cref="ReadOnlySpan{T}"/>
+ /// </summary>
+ public static implicit operator ReadOnlySpan<T>(Span<T> span) => new ReadOnlySpan<T>(ref span._pointer.Value, span._length);
+
+ /// <summary>
+ /// Forms a slice out of the given span, beginning at 'start'.
+ /// </summary>
+ /// <param name="start">The index at which to begin this slice.</param>
+ /// <exception cref="System.ArgumentOutOfRangeException">
+ /// Thrown when the specified <paramref name="start"/> index is not in range (&lt;0 or &gt;=Length).
+ /// </exception>
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public Span<T> Slice(int start)
+ {
+ if ((uint)start > (uint)_length)
+ ThrowHelper.ThrowArgumentOutOfRangeException();
+
+ return new Span<T>(ref Unsafe.Add(ref _pointer.Value, start), _length - start);
+ }
+
+ /// <summary>
+ /// Forms a slice out of the given span, beginning at 'start', of given length
+ /// </summary>
+ /// <param name="start">The index at which to begin this slice.</param>
+ /// <param name="length">The desired length for the slice (exclusive).</param>
+ /// <exception cref="System.ArgumentOutOfRangeException">
+ /// Thrown when the specified <paramref name="start"/> or end index is not in range (&lt;0 or &gt;=Length).
+ /// </exception>
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public Span<T> Slice(int start, int length)
+ {
+ if ((uint)start > (uint)_length || (uint)length > (uint)(_length - start))
+ ThrowHelper.ThrowArgumentOutOfRangeException();
+
+ return new Span<T>(ref Unsafe.Add(ref _pointer.Value, start), length);
+ }
+
+ /// <summary>
+ /// Copies the contents of this span into a new array. This heap
+ /// allocates, so should generally be avoided, however it is sometimes
+ /// necessary to bridge the gap with APIs written in terms of arrays.
+ /// </summary>
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public T[] ToArray()
+ {
+ if (_length == 0)
+ return Array.Empty<T>();
+
+ var destination = new T[_length];
+ Span.CopyTo<T>(ref Unsafe.As<byte, T>(ref destination.GetRawSzArrayData()), ref _pointer.Value, _length);
+ return destination;
+ }
+
+ // <summary>
+ /// Returns an empty <see cref="Span{T}"/>
+ /// </summary>
+ public static Span<T> Empty => default(Span<T>);
+ }
+}
diff --git a/src/mscorlib/shared/System/Text/StringBuilder.cs b/src/mscorlib/shared/System/Text/StringBuilder.cs
index df1a889823..3a06114bff 100644
--- a/src/mscorlib/shared/System/Text/StringBuilder.cs
+++ b/src/mscorlib/shared/System/Text/StringBuilder.cs
@@ -1081,67 +1081,56 @@ namespace System.Text
return this;
}
- // Append joined values with a separator between each value.
- public unsafe StringBuilder AppendJoin<T>(char separator, params T[] values)
- {
- // Defer argument validation to the internal function
- return AppendJoinCore(&separator, 1, values);
- }
+
+ #region AppendJoin
- public unsafe StringBuilder AppendJoin<T>(string separator, params T[] values)
+ public unsafe StringBuilder AppendJoin(string separator, params object[] values)
{
separator = separator ?? string.Empty;
fixed (char* pSeparator = separator)
{
- // Defer argument validation to the internal function
return AppendJoinCore(pSeparator, separator.Length, values);
}
}
- public unsafe StringBuilder AppendJoin<T>(char separator, IEnumerable<T> values)
+ public unsafe StringBuilder AppendJoin<T>(string separator, IEnumerable<T> values)
{
- // Defer argument validation to the internal function
- return AppendJoinCore(&separator, 1, values);
+ separator = separator ?? string.Empty;
+ fixed (char* pSeparator = separator)
+ {
+ return AppendJoinCore(pSeparator, separator.Length, values);
+ }
}
- public unsafe StringBuilder AppendJoin<T>(string separator, IEnumerable<T> values)
+ public unsafe StringBuilder AppendJoin(string separator, params string[] values)
{
separator = separator ?? string.Empty;
fixed (char* pSeparator = separator)
{
- // Defer argument validation to the internal function
return AppendJoinCore(pSeparator, separator.Length, values);
}
}
- private unsafe StringBuilder AppendJoinCore<T>(char* separator, int separatorLength, params T[] values)
+ public unsafe StringBuilder AppendJoin(char separator, params object[] values)
{
- if (values == null)
- throw new ArgumentNullException(nameof(values));
- Contract.Ensures(Contract.Result<StringBuilder>() != null);
-
- if (values.Length == 0)
- return this;
+ return AppendJoinCore(&separator, 1, values);
+ }
- var value = values[0];
- if (value != null)
- Append(value.ToString());
+ public unsafe StringBuilder AppendJoin<T>(char separator, IEnumerable<T> values)
+ {
+ return AppendJoinCore(&separator, 1, values);
+ }
- for (var i = 1; i < values.Length; i++)
- {
- Append(separator, separatorLength);
- value = values[i];
- if (value != null)
- Append(value.ToString());
- }
- return this;
+ public unsafe StringBuilder AppendJoin(char separator, params string[] values)
+ {
+ return AppendJoinCore(&separator, 1, values);
}
+
private unsafe StringBuilder AppendJoinCore<T>(char* separator, int separatorLength, IEnumerable<T> values)
{
if (values == null)
- throw new ArgumentNullException(nameof(values));
- Contract.Ensures(Contract.Result<StringBuilder>() != null);
+ ThrowHelper.ThrowArgumentNullException(ExceptionArgument.values);
using (var en = values.GetEnumerator())
{
@@ -1163,6 +1152,29 @@ namespace System.Text
return this;
}
+ private unsafe StringBuilder AppendJoinCore<T>(char* separator, int separatorLength, T[] values)
+ {
+ if (values == null)
+ ThrowHelper.ThrowArgumentNullException(ExceptionArgument.values);
+
+ if (values.Length == 0)
+ return this;
+
+ if (values[0] != null)
+ Append(values[0].ToString());
+
+ for (var i = 1; i < values.Length; i++)
+ {
+ Append(separator, separatorLength);
+ if (values[i] != null)
+ Append(values[i].ToString());
+ }
+ return this;
+ }
+
+ #endregion
+
+
/*====================================Insert====================================
**
==============================================================================*/
diff --git a/src/mscorlib/shared/System/Threading/Tasks/TaskExtensions.cs b/src/mscorlib/shared/System/Threading/Tasks/TaskExtensions.cs
index 1098299517..97f2013d79 100644
--- a/src/mscorlib/shared/System/Threading/Tasks/TaskExtensions.cs
+++ b/src/mscorlib/shared/System/Threading/Tasks/TaskExtensions.cs
@@ -21,7 +21,7 @@ namespace System.Threading.Tasks
// it completed successfully. Return its inner task to avoid unnecessary wrapping, or if the inner
// task is null, return a canceled task to match the same semantics as CreateUnwrapPromise.
return
- !task.IsRanToCompletion ? Task.CreateUnwrapPromise<VoidTaskResult>(task, lookForOce: false) :
+ !task.IsCompletedSuccessfully ? Task.CreateUnwrapPromise<VoidTaskResult>(task, lookForOce: false) :
task.Result ??
Task.FromCanceled(new CancellationToken(true));
}
@@ -40,7 +40,7 @@ namespace System.Threading.Tasks
// it completed successfully. Return its inner task to avoid unnecessary wrapping, or if the inner
// task is null, return a canceled task to match the same semantics as CreateUnwrapPromise.
return
- !task.IsRanToCompletion ? Task.CreateUnwrapPromise<TResult>(task, lookForOce: false) :
+ !task.IsCompletedSuccessfully ? Task.CreateUnwrapPromise<TResult>(task, lookForOce: false) :
task.Result ??
Task.FromCanceled<TResult>(new CancellationToken(true));
}
diff --git a/src/mscorlib/src/Microsoft/Win32/Registry.cs b/src/mscorlib/src/Microsoft/Win32/Registry.cs
index aa2dd9b396..d0dbb0ff7f 100644
--- a/src/mscorlib/src/Microsoft/Win32/Registry.cs
+++ b/src/mscorlib/src/Microsoft/Win32/Registry.cs
@@ -2,12 +2,142 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Runtime.InteropServices;
+using System.Runtime.Versioning;
+
namespace Microsoft.Win32
{
+ /**
+ * Registry encapsulation. Contains members representing all top level system
+ * keys.
+ *
+ * @security(checkClassLinking=on)
+ */
+ //This class contains only static members and does not need to be serializable.
internal static class Registry
{
- public static readonly RegistryKey CurrentUser = RegistryKey.CurrentUser;
- public static readonly RegistryKey LocalMachine = RegistryKey.LocalMachine;
+ /**
+ * Current User Key.
+ *
+ * This key should be used as the root for all user specific settings.
+ */
+ public static readonly RegistryKey CurrentUser = RegistryKey.GetBaseKey(RegistryKey.HKEY_CURRENT_USER);
+
+ /**
+ * Local Machine Key.
+ *
+ * This key should be used as the root for all machine specific settings.
+ */
+ public static readonly RegistryKey LocalMachine = RegistryKey.GetBaseKey(RegistryKey.HKEY_LOCAL_MACHINE);
+
+ /**
+ * Classes Root Key.
+ *
+ * This is the root key of class information.
+ */
+ public static readonly RegistryKey ClassesRoot = RegistryKey.GetBaseKey(RegistryKey.HKEY_CLASSES_ROOT);
+
+ /**
+ * Users Root Key.
+ *
+ * This is the root of users.
+ */
+ public static readonly RegistryKey Users = RegistryKey.GetBaseKey(RegistryKey.HKEY_USERS);
+
+ /**
+ * Performance Root Key.
+ *
+ * This is where dynamic performance data is stored on NT.
+ */
+ public static readonly RegistryKey PerformanceData = RegistryKey.GetBaseKey(RegistryKey.HKEY_PERFORMANCE_DATA);
+
+ /**
+ * Current Config Root Key.
+ *
+ * This is where current configuration information is stored.
+ */
+ public static readonly RegistryKey CurrentConfig = RegistryKey.GetBaseKey(RegistryKey.HKEY_CURRENT_CONFIG);
+
+ //
+ // Following function will parse a keyName and returns the basekey for it.
+ // It will also store the subkey name in the out parameter.
+ // If the keyName is not valid, we will throw ArgumentException.
+ // The return value shouldn't be null.
+ //
+ private static RegistryKey GetBaseKeyFromKeyName(string keyName, out string subKeyName)
+ {
+ if (keyName == null)
+ {
+ throw new ArgumentNullException(nameof(keyName));
+ }
+
+ string basekeyName;
+ int i = keyName.IndexOf('\\');
+ if (i != -1)
+ {
+ basekeyName = keyName.Substring(0, i).ToUpper(System.Globalization.CultureInfo.InvariantCulture);
+ }
+ else
+ {
+ basekeyName = keyName.ToUpper(System.Globalization.CultureInfo.InvariantCulture);
+ }
+ RegistryKey basekey = null;
+
+ switch (basekeyName)
+ {
+ case "HKEY_CURRENT_USER":
+ basekey = Registry.CurrentUser;
+ break;
+ case "HKEY_LOCAL_MACHINE":
+ basekey = Registry.LocalMachine;
+ break;
+ case "HKEY_CLASSES_ROOT":
+ basekey = Registry.ClassesRoot;
+ break;
+ case "HKEY_USERS":
+ basekey = Registry.Users;
+ break;
+ case "HKEY_PERFORMANCE_DATA":
+ basekey = Registry.PerformanceData;
+ break;
+ case "HKEY_CURRENT_CONFIG":
+ basekey = Registry.CurrentConfig;
+ break;
+ default:
+ throw new ArgumentException(SR.Format(SR.Arg_RegInvalidKeyName, nameof(keyName)));
+ }
+ if (i == -1 || i == keyName.Length)
+ {
+ subKeyName = string.Empty;
+ }
+ else
+ {
+ subKeyName = keyName.Substring(i + 1, keyName.Length - i - 1);
+ }
+ return basekey;
+ }
+
+ public static object GetValue(string keyName, string valueName, object defaultValue)
+ {
+ string subKeyName;
+ RegistryKey basekey = GetBaseKeyFromKeyName(keyName, out subKeyName);
+ BCLDebug.Assert(basekey != null, "basekey can't be null.");
+ RegistryKey key = basekey.OpenSubKey(subKeyName);
+ if (key == null)
+ { // if the key doesn't exist, do nothing
+ return null;
+ }
+ try
+ {
+ return key.GetValue(valueName, defaultValue);
+ }
+ finally
+ {
+ key.Close();
+ }
+ }
}
}
diff --git a/src/mscorlib/src/Microsoft/Win32/RegistryKey.cs b/src/mscorlib/src/Microsoft/Win32/RegistryKey.cs
index e39b95903e..521ea65e10 100644
--- a/src/mscorlib/src/Microsoft/Win32/RegistryKey.cs
+++ b/src/mscorlib/src/Microsoft/Win32/RegistryKey.cs
@@ -2,6 +2,28 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+
+/*
+ Note on transaction support:
+ Eventually we will want to add support for NT's transactions to our
+ RegistryKey API's (possibly Whidbey M3?). When we do this, here's
+ the list of API's we need to make transaction-aware:
+
+ RegCreateKeyEx
+ RegDeleteKey
+ RegDeleteValue
+ RegEnumKeyEx
+ RegEnumValue
+ RegOpenKeyEx
+ RegQueryInfoKey
+ RegQueryValueEx
+ RegSetValueEx
+
+ We can ignore RegConnectRegistry (remote registry access doesn't yet have
+ transaction support) and RegFlushKey. RegCloseKey doesn't require any
+ additional work. .
+ */
+
/*
Note on ACL support:
The key thing to note about ACL's is you set them on a kernel object like a
@@ -30,28 +52,34 @@ using Microsoft.Win32.SafeHandles;
using System;
using System.Buffers;
using System.Collections.Generic;
-using System.Diagnostics;
+using System.Diagnostics.Contracts;
using System.IO;
+using System.Text;
namespace Microsoft.Win32
{
/**
* Registry encapsulation. To get an instance of a RegistryKey use the
* Registry class's static members then call OpenSubKey.
+ *
+ * @see Registry
+ * @security(checkDllCalls=off)
+ * @security(checkClassLinking=on)
*/
internal sealed class RegistryKey : MarshalByRefObject, IDisposable
{
- // Use the public Registry.CurrentUser
- internal static readonly RegistryKey CurrentUser =
- GetBaseKey(new IntPtr(unchecked((int)0x80000001)), "HKEY_CURRENT_USER");
-
- // Use the public Registry.LocalMachine
- internal static readonly RegistryKey LocalMachine =
- GetBaseKey(new IntPtr(unchecked((int)0x80000002)), "HKEY_LOCAL_MACHINE");
-
// We could use const here, if C# supported ELEMENT_TYPE_I fully.
- private static readonly IntPtr HKEY_CURRENT_USER = new IntPtr(unchecked((int)0x80000001));
- private static readonly IntPtr HKEY_LOCAL_MACHINE = new IntPtr(unchecked((int)0x80000002));
+ internal static readonly IntPtr HKEY_CLASSES_ROOT = new IntPtr(unchecked((int)0x80000000));
+ internal static readonly IntPtr HKEY_CURRENT_USER = new IntPtr(unchecked((int)0x80000001));
+ internal static readonly IntPtr HKEY_LOCAL_MACHINE = new IntPtr(unchecked((int)0x80000002));
+ internal static readonly IntPtr HKEY_USERS = new IntPtr(unchecked((int)0x80000003));
+ internal static readonly IntPtr HKEY_PERFORMANCE_DATA = new IntPtr(unchecked((int)0x80000004));
+ internal static readonly IntPtr HKEY_CURRENT_CONFIG = new IntPtr(unchecked((int)0x80000005));
+
+ // Dirty indicates that we have munged data that should be potentially
+ // written to disk.
+ //
+ private const int STATE_DIRTY = 0x0001;
// SystemKey indicates that this is a "SYSTEMKEY" and shouldn't be "opened"
// or "closed".
@@ -62,6 +90,20 @@ namespace Microsoft.Win32
//
private const int STATE_WRITEACCESS = 0x0004;
+ // Indicates if this key is for HKEY_PERFORMANCE_DATA
+ private const int STATE_PERF_DATA = 0x0008;
+
+ // Names of keys. This array must be in the same order as the HKEY values listed above.
+ //
+ private static readonly String[] hkeyNames = new String[] {
+ "HKEY_CLASSES_ROOT",
+ "HKEY_CURRENT_USER",
+ "HKEY_LOCAL_MACHINE",
+ "HKEY_USERS",
+ "HKEY_PERFORMANCE_DATA",
+ "HKEY_CURRENT_CONFIG",
+ };
+
// MSDN defines the following limits for registry key names & values:
// Key Name: 255 characters
// Value name: 16,383 Unicode characters
@@ -71,7 +113,31 @@ namespace Microsoft.Win32
private volatile SafeRegistryHandle hkey = null;
private volatile int state = 0;
- private volatile string keyName;
+ private volatile String keyName;
+ private volatile bool remoteKey = false;
+ private volatile RegistryKeyPermissionCheck checkMode;
+ private volatile RegistryView regView = RegistryView.Default;
+
+ /**
+ * RegistryInternalCheck values. Useful only for CheckPermission
+ */
+ private enum RegistryInternalCheck
+ {
+ CheckSubKeyWritePermission = 0,
+ CheckSubKeyReadPermission = 1,
+ CheckSubKeyCreatePermission = 2,
+ CheckSubTreeReadPermission = 3,
+ CheckSubTreeWritePermission = 4,
+ CheckSubTreeReadWritePermission = 5,
+ CheckValueWritePermission = 6,
+ CheckValueCreatePermission = 7,
+ CheckValueReadPermission = 8,
+ CheckKeyReadPermission = 9,
+ CheckSubTreePermission = 10,
+ CheckOpenSubKeyWithWritablePermission = 11,
+ CheckOpenSubKeyPermission = 12
+ };
+
/**
* Creates a RegistryKey.
@@ -82,10 +148,12 @@ namespace Microsoft.Win32
* The remoteKey flag when set to true indicates that we are dealing with registry entries
* on a remote machine and requires the program making these calls to have full trust.
*/
- private RegistryKey(SafeRegistryHandle hkey, bool writable, bool systemkey)
+ private RegistryKey(SafeRegistryHandle hkey, bool writable, bool systemkey, bool remoteKey, bool isPerfData, RegistryView view)
{
this.hkey = hkey;
keyName = "";
+ this.remoteKey = remoteKey;
+ regView = view;
if (systemkey)
{
state |= STATE_SYSTEMKEY;
@@ -94,6 +162,17 @@ namespace Microsoft.Win32
{
state |= STATE_WRITEACCESS;
}
+ if (isPerfData)
+ state |= STATE_PERF_DATA;
+ ValidateKeyView(view);
+ }
+
+ /**
+ * Closes this key, flushes it to disk if the contents have been modified.
+ */
+ public void Close()
+ {
+ Dispose(true);
}
private void Dispose(bool disposing)
@@ -115,6 +194,21 @@ namespace Microsoft.Win32
hkey = null;
}
}
+ else if (disposing && IsPerfDataKey())
+ {
+ // System keys should never be closed. However, we want to call RegCloseKey
+ // on HKEY_PERFORMANCE_DATA when called from PerformanceCounter.CloseSharedResources
+ // (i.e. when disposing is true) so that we release the PERFLIB cache and cause it
+ // to be refreshed (by re-reading the registry) when accessed subsequently.
+ // This is the only way we can see the just installed perf counter.
+ // NOTE: since HKEY_PERFORMANCE_DATA is process wide, there is inherent race condition in closing
+ // the key asynchronously. While Vista is smart enough to rebuild the PERFLIB resources
+ // in this situation the down level OSes are not. We have a small window between
+ // the dispose below and usage elsewhere (other threads). This is By Design.
+ // This is less of an issue when OS > NT5 (i.e Vista & higher), we can close the perfkey
+ // (to release & refresh PERFLIB resources) and the OS will rebuild PERFLIB as necessary.
+ SafeRegistryHandle.RegCloseKey(RegistryKey.HKEY_PERFORMANCE_DATA);
+ }
}
}
@@ -123,13 +217,13 @@ namespace Microsoft.Win32
Dispose(true);
}
- public void DeleteValue(string name, bool throwOnMissingValue)
+ public void DeleteValue(String name, bool throwOnMissingValue)
{
EnsureWriteable();
int errorCode = Win32Native.RegDeleteValue(hkey, name);
//
- // From windows 2003 server, if the name is too long we will get error code ERROR_FILENAME_EXCED_RANGE
+ // From windows 2003 server, if the name is too long we will get error code ERROR_FILENAME_EXCED_RANGE
// This still means the name doesn't exist. We need to be consistent with previous OS.
//
if (errorCode == Win32Native.ERROR_FILE_NOT_FOUND || errorCode == Win32Native.ERROR_FILENAME_EXCED_RANGE)
@@ -138,44 +232,77 @@ namespace Microsoft.Win32
{
ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_RegSubKeyValueAbsent);
}
-
// Otherwise, just return giving no indication to the user.
// (For compatibility)
}
-
// We really should throw an exception here if errorCode was bad,
// but we can't for compatibility reasons.
- Debug.Assert(errorCode == 0, "RegDeleteValue failed. Here's your error code: " + errorCode);
+ BCLDebug.Correctness(errorCode == 0, "RegDeleteValue failed. Here's your error code: " + errorCode);
+ }
+
+ /**
+ * Retrieves a new RegistryKey that represents the requested key. Valid
+ * values are:
+ *
+ * HKEY_CLASSES_ROOT,
+ * HKEY_CURRENT_USER,
+ * HKEY_LOCAL_MACHINE,
+ * HKEY_USERS,
+ * HKEY_PERFORMANCE_DATA,
+ * HKEY_CURRENT_CONFIG,
+ * HKEY_DYN_DATA.
+ *
+ * @param hKey HKEY_* to open.
+ *
+ * @return the RegistryKey requested.
+ */
+ internal static RegistryKey GetBaseKey(IntPtr hKey)
+ {
+ return GetBaseKey(hKey, RegistryView.Default);
}
- private static RegistryKey GetBaseKey(IntPtr hKey, string keyName)
+ internal static RegistryKey GetBaseKey(IntPtr hKey, RegistryView view)
{
- SafeRegistryHandle srh = new SafeRegistryHandle(hKey, ownsHandle: false);
+ int index = ((int)hKey) & 0x0FFFFFFF;
+ BCLDebug.Assert(index >= 0 && index < hkeyNames.Length, "index is out of range!");
+ BCLDebug.Assert((((int)hKey) & 0xFFFFFFF0) == 0x80000000, "Invalid hkey value!");
+
+ bool isPerf = hKey == HKEY_PERFORMANCE_DATA;
+ // only mark the SafeHandle as ownsHandle if the key is HKEY_PERFORMANCE_DATA.
+ SafeRegistryHandle srh = new SafeRegistryHandle(hKey, isPerf);
- RegistryKey key = new RegistryKey(srh, true, true);
- key.keyName = keyName;
+ RegistryKey key = new RegistryKey(srh, true, true, false, isPerf, view);
+ key.checkMode = RegistryKeyPermissionCheck.Default;
+ key.keyName = hkeyNames[index];
return key;
}
- /// <summary>
- /// Retrieves a subkey or null if the operation failed.
- /// </summary>
- /// <param name="writable">True to open writable, otherwise opens the key read-only.</param>
+ /**
+ * Retrieves a subkey. If readonly is <b>true</b>, then the subkey is opened with
+ * read-only access.
+ *
+ * @param name Name or path of subkey to open.
+ * @param readonly Set to <b>true</b> if you only need readonly access.
+ *
+ * @return the Subkey requested, or <b>null</b> if the operation failed.
+ */
public RegistryKey OpenSubKey(string name, bool writable)
{
ValidateKeyName(name);
EnsureNotDisposed();
+ name = FixupName(name); // Fixup multiple slashes to a single slash
SafeRegistryHandle result = null;
int ret = Win32Native.RegOpenKeyEx(hkey,
name,
0,
- writable ? Win32Native.KEY_READ | Win32Native.KEY_WRITE : Win32Native.KEY_READ,
+ GetRegistryKeyAccess(writable) | (int)regView,
out result);
if (ret == 0 && !result.IsInvalid)
{
- RegistryKey key = new RegistryKey(result, writable, false);
+ RegistryKey key = new RegistryKey(result, writable, false, remoteKey, false, regView);
+ key.checkMode = GetSubKeyPermissonCheck(writable);
key.keyName = keyName + "\\" + name;
return key;
}
@@ -191,6 +318,41 @@ namespace Microsoft.Win32
return null;
}
+ // This required no security checks. This is to get around the Deleting SubKeys which only require
+ // write permission. They call OpenSubKey which required read. Now instead call this function w/o security checks
+ internal RegistryKey InternalOpenSubKey(String name, bool writable)
+ {
+ ValidateKeyName(name);
+ EnsureNotDisposed();
+
+ SafeRegistryHandle result = null;
+ int ret = Win32Native.RegOpenKeyEx(hkey,
+ name,
+ 0,
+ GetRegistryKeyAccess(writable) | (int)regView,
+ out result);
+
+ if (ret == 0 && !result.IsInvalid)
+ {
+ RegistryKey key = new RegistryKey(result, writable, false, remoteKey, false, regView);
+ key.keyName = keyName + "\\" + name;
+ return key;
+ }
+ return null;
+ }
+
+ /**
+ * Returns a subkey with read only permissions.
+ *
+ * @param name Name or path of subkey to open.
+ *
+ * @return the Subkey requested, or <b>null</b> if the operation failed.
+ */
+ public RegistryKey OpenSubKey(String name)
+ {
+ return OpenSubKey(name, false);
+ }
+
/// <summary>
/// Retrieves an array of strings containing all the subkey names.
/// </summary>
@@ -319,6 +481,22 @@ namespace Microsoft.Win32
}
/**
+ * Retrieves the specified value. <b>null</b> is returned if the value
+ * doesn't exist.
+ *
+ * Note that <var>name</var> can be null or "", at which point the
+ * unnamed or default value of this Registry key is returned, if any.
+ *
+ * @param name Name of value to retrieve.
+ *
+ * @return the data associated with the value.
+ */
+ public Object GetValue(String name)
+ {
+ return InternalGetValue(name, null, false, true);
+ }
+
+ /**
* Retrieves the specified value. <i>defaultValue</i> is returned if the value doesn't exist.
*
* Note that <var>name</var> can be null or "", at which point the
@@ -333,11 +511,30 @@ namespace Microsoft.Win32
*
* @return the data associated with the value.
*/
- public object GetValue(string name, object defaultValue = null, bool doNotExpand = false)
+ public Object GetValue(String name, Object defaultValue)
{
- EnsureNotDisposed();
+ return InternalGetValue(name, defaultValue, false, true);
+ }
+
+ public Object GetValue(String name, Object defaultValue, RegistryValueOptions options)
+ {
+ if (options < RegistryValueOptions.None || options > RegistryValueOptions.DoNotExpandEnvironmentNames)
+ {
+ throw new ArgumentException(SR.Format(SR.Arg_EnumIllegalVal, (int)options), nameof(options));
+ }
+ bool doNotExpand = (options == RegistryValueOptions.DoNotExpandEnvironmentNames);
+ return InternalGetValue(name, defaultValue, doNotExpand, true);
+ }
+
+ internal Object InternalGetValue(String name, Object defaultValue, bool doNotExpand, bool checkSecurity)
+ {
+ if (checkSecurity)
+ {
+ // Name can be null! It's the most common use of RegQueryValueEx
+ EnsureNotDisposed();
+ }
- object data = defaultValue;
+ Object data = defaultValue;
int type = 0;
int datasize = 0;
@@ -345,20 +542,54 @@ namespace Microsoft.Win32
if (ret != 0)
{
- // For stuff like ERROR_FILE_NOT_FOUND, we want to return null (data).
- // Some OS's returned ERROR_MORE_DATA even in success cases, so we
- // want to continue on through the function.
- if (ret != Win32Native.ERROR_MORE_DATA)
- return data;
+ if (IsPerfDataKey())
+ {
+ int size = 65000;
+ int sizeInput = size;
+
+ int r;
+ byte[] blob = new byte[size];
+ while (Win32Native.ERROR_MORE_DATA == (r = Win32Native.RegQueryValueEx(hkey, name, null, ref type, blob, ref sizeInput)))
+ {
+ if (size == Int32.MaxValue)
+ {
+ // ERROR_MORE_DATA was returned however we cannot increase the buffer size beyond Int32.MaxValue
+ Win32Error(r, name);
+ }
+ else if (size > (Int32.MaxValue / 2))
+ {
+ // at this point in the loop "size * 2" would cause an overflow
+ size = Int32.MaxValue;
+ }
+ else
+ {
+ size *= 2;
+ }
+ sizeInput = size;
+ blob = new byte[size];
+ }
+ if (r != 0)
+ Win32Error(r, name);
+ return blob;
+ }
+ else
+ {
+ // For stuff like ERROR_FILE_NOT_FOUND, we want to return null (data).
+ // Some OS's returned ERROR_MORE_DATA even in success cases, so we
+ // want to continue on through the function.
+ if (ret != Win32Native.ERROR_MORE_DATA)
+ return data;
+ }
}
if (datasize < 0)
{
// unexpected code path
- Debug.Assert(false, "[InternalGetValue] RegQueryValue returned ERROR_SUCCESS but gave a negative datasize");
+ BCLDebug.Assert(false, "[InternalGetValue] RegQueryValue returned ERROR_SUCCESS but gave a negative datasize");
datasize = 0;
}
+
switch (type)
{
case Win32Native.REG_NONE:
@@ -378,7 +609,7 @@ namespace Microsoft.Win32
goto case Win32Native.REG_BINARY;
}
long blob = 0;
- Debug.Assert(datasize == 8, "datasize==8");
+ BCLDebug.Assert(datasize == 8, "datasize==8");
// Here, datasize must be 8 when calling this
ret = Win32Native.RegQueryValueEx(hkey, name, null, ref type, ref blob, ref datasize);
@@ -393,7 +624,7 @@ namespace Microsoft.Win32
goto case Win32Native.REG_QWORD;
}
int blob = 0;
- Debug.Assert(datasize == 4, "datasize==4");
+ BCLDebug.Assert(datasize == 4, "datasize==4");
// Here, datasize must be four when calling this
ret = Win32Native.RegQueryValueEx(hkey, name, null, ref type, ref blob, ref datasize);
@@ -420,13 +651,13 @@ namespace Microsoft.Win32
ret = Win32Native.RegQueryValueEx(hkey, name, null, ref type, blob, ref datasize);
if (blob.Length > 0 && blob[blob.Length - 1] == (char)0)
{
- data = new string(blob, 0, blob.Length - 1);
+ data = new String(blob, 0, blob.Length - 1);
}
else
{
// in the very unlikely case the data is missing null termination,
// pass in the whole char[] to prevent truncating a character
- data = new string(blob);
+ data = new String(blob);
}
}
break;
@@ -451,17 +682,17 @@ namespace Microsoft.Win32
if (blob.Length > 0 && blob[blob.Length - 1] == (char)0)
{
- data = new string(blob, 0, blob.Length - 1);
+ data = new String(blob, 0, blob.Length - 1);
}
else
{
// in the very unlikely case the data is missing null termination,
// pass in the whole char[] to prevent truncating a character
- data = new string(blob);
+ data = new String(blob);
}
if (!doNotExpand)
- data = Environment.ExpandEnvironmentVariables((string)data);
+ data = Environment.ExpandEnvironmentVariables((String)data);
}
break;
case Win32Native.REG_MULTI_SZ:
@@ -502,7 +733,8 @@ namespace Microsoft.Win32
blob[blob.Length - 1] = (char)0;
}
- IList<string> strings = new List<string>();
+
+ IList<String> strings = new List<String>();
int cur = 0;
int len = blob.Length;
@@ -516,28 +748,28 @@ namespace Microsoft.Win32
if (nextNull < len)
{
- Debug.Assert(blob[nextNull] == (char)0, "blob[nextNull] should be 0");
+ BCLDebug.Assert(blob[nextNull] == (char)0, "blob[nextNull] should be 0");
if (nextNull - cur > 0)
{
- strings.Add(new string(blob, cur, nextNull - cur));
+ strings.Add(new String(blob, cur, nextNull - cur));
}
else
{
// we found an empty string. But if we're at the end of the data,
// it's just the extra null terminator.
if (nextNull != len - 1)
- strings.Add(string.Empty);
+ strings.Add(String.Empty);
}
}
else
{
- strings.Add(new string(blob, cur, len - cur));
+ strings.Add(new String(blob, cur, len - cur));
}
cur = nextNull + 1;
}
- data = new string[strings.Count];
- strings.CopyTo((string[])data, 0);
+ data = new String[strings.Count];
+ strings.CopyTo((String[])data, 0);
}
break;
case Win32Native.REG_LINK:
@@ -560,10 +792,26 @@ namespace Microsoft.Win32
private bool IsPerfDataKey()
{
- return false;
+ return (state & STATE_PERF_DATA) != 0;
+ }
+
+ private void SetDirty()
+ {
+ state |= STATE_DIRTY;
+ }
+
+ /**
+ * Sets the specified value.
+ *
+ * @param name Name of value to store data in.
+ * @param value Data to store.
+ */
+ public void SetValue(String name, Object value)
+ {
+ SetValue(name, value, RegistryValueKind.Unknown);
}
- public unsafe void SetStringValue(string name, string value)
+ public unsafe void SetValue(String name, Object value, RegistryValueKind valueKind)
{
if (value == null)
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.value);
@@ -573,17 +821,167 @@ namespace Microsoft.Win32
throw new ArgumentException(SR.Arg_RegValStrLenBug);
}
+ if (!Enum.IsDefined(typeof(RegistryValueKind), valueKind))
+ throw new ArgumentException(SR.Arg_RegBadKeyKind, nameof(valueKind));
+
EnsureWriteable();
- int result = Win32Native.RegSetValueEx(hkey,
- name,
- 0,
- RegistryValueKind.String,
- value,
- checked(value.Length * 2 + 2));
+ if (valueKind == RegistryValueKind.Unknown)
+ {
+ // this is to maintain compatibility with the old way of autodetecting the type.
+ // SetValue(string, object) will come through this codepath.
+ valueKind = CalculateValueKind(value);
+ }
+
+ int ret = 0;
+ try
+ {
+ switch (valueKind)
+ {
+ case RegistryValueKind.ExpandString:
+ case RegistryValueKind.String:
+ {
+ String data = value.ToString();
+ ret = Win32Native.RegSetValueEx(hkey,
+ name,
+ 0,
+ valueKind,
+ data,
+ checked(data.Length * 2 + 2));
+ break;
+ }
+
+ case RegistryValueKind.MultiString:
+ {
+ // Other thread might modify the input array after we calculate the buffer length.
+ // Make a copy of the input array to be safe.
+ string[] dataStrings = (string[])(((string[])value).Clone());
+ int sizeInBytes = 0;
+
+ // First determine the size of the array
+ //
+ for (int i = 0; i < dataStrings.Length; i++)
+ {
+ if (dataStrings[i] == null)
+ {
+ ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_RegSetStrArrNull);
+ }
+ sizeInBytes = checked(sizeInBytes + (dataStrings[i].Length + 1) * 2);
+ }
+ sizeInBytes = checked(sizeInBytes + 2);
+
+ byte[] basePtr = new byte[sizeInBytes];
+ fixed (byte* b = basePtr)
+ {
+ IntPtr currentPtr = new IntPtr((void*)b);
+
+ // Write out the strings...
+ //
+ for (int i = 0; i < dataStrings.Length; i++)
+ {
+ // Assumes that the Strings are always null terminated.
+ String.InternalCopy(dataStrings[i], currentPtr, (checked(dataStrings[i].Length * 2)));
+ currentPtr = new IntPtr((long)currentPtr + (checked(dataStrings[i].Length * 2)));
+ *(char*)(currentPtr.ToPointer()) = '\0';
+ currentPtr = new IntPtr((long)currentPtr + 2);
+ }
+
+ *(char*)(currentPtr.ToPointer()) = '\0';
+ currentPtr = new IntPtr((long)currentPtr + 2);
+
+ ret = Win32Native.RegSetValueEx(hkey,
+ name,
+ 0,
+ RegistryValueKind.MultiString,
+ basePtr,
+ sizeInBytes);
+ }
+ break;
+ }
+
+ case RegistryValueKind.None:
+ case RegistryValueKind.Binary:
+ byte[] dataBytes = (byte[])value;
+ ret = Win32Native.RegSetValueEx(hkey,
+ name,
+ 0,
+ (valueKind == RegistryValueKind.None ? Win32Native.REG_NONE : RegistryValueKind.Binary),
+ dataBytes,
+ dataBytes.Length);
+ break;
+
+ case RegistryValueKind.DWord:
+ {
+ // We need to use Convert here because we could have a boxed type cannot be
+ // unboxed and cast at the same time. I.e. ((int)(object)(short) 5) will fail.
+ int data = Convert.ToInt32(value, System.Globalization.CultureInfo.InvariantCulture);
+
+ ret = Win32Native.RegSetValueEx(hkey,
+ name,
+ 0,
+ RegistryValueKind.DWord,
+ ref data,
+ 4);
+ break;
+ }
- if (result != 0)
- Win32Error(result, null);
+ case RegistryValueKind.QWord:
+ {
+ long data = Convert.ToInt64(value, System.Globalization.CultureInfo.InvariantCulture);
+
+ ret = Win32Native.RegSetValueEx(hkey,
+ name,
+ 0,
+ RegistryValueKind.QWord,
+ ref data,
+ 8);
+ break;
+ }
+ }
+ }
+ catch (OverflowException)
+ {
+ ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_RegSetMismatchedKind);
+ }
+ catch (InvalidOperationException)
+ {
+ ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_RegSetMismatchedKind);
+ }
+ catch (FormatException)
+ {
+ ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_RegSetMismatchedKind);
+ }
+ catch (InvalidCastException)
+ {
+ ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_RegSetMismatchedKind);
+ }
+
+ if (ret == 0)
+ {
+ SetDirty();
+ }
+ else
+ Win32Error(ret, null);
+ }
+
+ private RegistryValueKind CalculateValueKind(Object value)
+ {
+ // This logic matches what used to be in SetValue(string name, object value) in the v1.0 and v1.1 days.
+ // Even though we could add detection for an int64 in here, we want to maintain compatibility with the
+ // old behavior.
+ if (value is Int32)
+ return RegistryValueKind.DWord;
+ else if (value is Array)
+ {
+ if (value is byte[])
+ return RegistryValueKind.Binary;
+ else if (value is String[])
+ return RegistryValueKind.MultiString;
+ else
+ throw new ArgumentException(SR.Format(SR.Arg_RegSetBadArrType, value.GetType().Name));
+ }
+ else
+ return RegistryValueKind.String;
}
/**
@@ -591,7 +989,7 @@ namespace Microsoft.Win32
*
* @return a string representing the key.
*/
- public override string ToString()
+ public override String ToString()
{
EnsureNotDisposed();
return keyName;
@@ -604,7 +1002,7 @@ namespace Microsoft.Win32
* error, and depending on the error, insert a string into the message
* gotten from the ResourceManager.
*/
- internal void Win32Error(int errorCode, string str)
+ internal void Win32Error(int errorCode, String str)
{
switch (errorCode)
{
@@ -613,6 +1011,27 @@ namespace Microsoft.Win32
throw new UnauthorizedAccessException(SR.Format(SR.UnauthorizedAccess_RegistryKeyGeneric_Key, str));
else
throw new UnauthorizedAccessException();
+
+ case Win32Native.ERROR_INVALID_HANDLE:
+ /**
+ * For normal RegistryKey instances we dispose the SafeRegHandle and throw IOException.
+ * However, for HKEY_PERFORMANCE_DATA (on a local or remote machine) we avoid disposing the
+ * SafeRegHandle and only throw the IOException. This is to workaround reentrancy issues
+ * in PerformanceCounter.NextValue() where the API could throw {NullReference, ObjectDisposed, ArgumentNull}Exception
+ * on reentrant calls because of this error code path in RegistryKey
+ *
+ * Normally we'd make our caller synchronize access to a shared RegistryKey instead of doing something like this,
+ * however we shipped PerformanceCounter.NextValue() un-synchronized in v2.0RTM and customers have taken a dependency on
+ * this behavior (being able to simultaneously query multiple remote-machine counters on multiple threads, instead of
+ * having serialized access).
+ */
+ if (!IsPerfDataKey())
+ {
+ hkey.SetHandleAsInvalid();
+ hkey = null;
+ }
+ goto default;
+
case Win32Native.ERROR_FILE_NOT_FOUND:
throw new IOException(SR.Arg_RegKeyNotFound, errorCode);
@@ -621,6 +1040,76 @@ namespace Microsoft.Win32
}
}
+ internal static String FixupName(String name)
+ {
+ BCLDebug.Assert(name != null, "[FixupName]name!=null");
+ if (name.IndexOf('\\') == -1)
+ return name;
+
+ StringBuilder sb = new StringBuilder(name);
+ FixupPath(sb);
+ int temp = sb.Length - 1;
+ if (temp >= 0 && sb[temp] == '\\') // Remove trailing slash
+ sb.Length = temp;
+ return sb.ToString();
+ }
+
+
+ private static void FixupPath(StringBuilder path)
+ {
+ Contract.Requires(path != null);
+ int length = path.Length;
+ bool fixup = false;
+ char markerChar = (char)0xFFFF;
+
+ int i = 1;
+ while (i < length - 1)
+ {
+ if (path[i] == '\\')
+ {
+ i++;
+ while (i < length)
+ {
+ if (path[i] == '\\')
+ {
+ path[i] = markerChar;
+ i++;
+ fixup = true;
+ }
+ else
+ break;
+ }
+ }
+ i++;
+ }
+
+ if (fixup)
+ {
+ i = 0;
+ int j = 0;
+ while (i < length)
+ {
+ if (path[i] == markerChar)
+ {
+ i++;
+ continue;
+ }
+ path[j] = path[i];
+ i++;
+ j++;
+ }
+ path.Length += j - i;
+ }
+ }
+
+ private bool ContainsRegistryValue(string name)
+ {
+ int type = 0;
+ int datasize = 0;
+ int retval = Win32Native.RegQueryValueEx(hkey, name, null, ref type, (byte[])null, ref datasize);
+ return retval == 0;
+ }
+
private void EnsureNotDisposed()
{
if (hkey == null)
@@ -638,8 +1127,41 @@ namespace Microsoft.Win32
}
}
+ private static int GetRegistryKeyAccess(bool isWritable)
+ {
+ int winAccess;
+ if (!isWritable)
+ {
+ winAccess = Win32Native.KEY_READ;
+ }
+ else
+ {
+ winAccess = Win32Native.KEY_READ | Win32Native.KEY_WRITE;
+ }
+
+ return winAccess;
+ }
+
+ private RegistryKeyPermissionCheck GetSubKeyPermissonCheck(bool subkeyWritable)
+ {
+ if (checkMode == RegistryKeyPermissionCheck.Default)
+ {
+ return checkMode;
+ }
+
+ if (subkeyWritable)
+ {
+ return RegistryKeyPermissionCheck.ReadWriteSubTree;
+ }
+ else
+ {
+ return RegistryKeyPermissionCheck.ReadSubTree;
+ }
+ }
+
static private void ValidateKeyName(string name)
{
+ Contract.Ensures(name != null);
if (name == null)
{
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.name);
@@ -660,9 +1182,33 @@ namespace Microsoft.Win32
ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_RegKeyStrLenBug);
}
+ static private void ValidateKeyView(RegistryView view)
+ {
+ if (view != RegistryView.Default && view != RegistryView.Registry32 && view != RegistryView.Registry64)
+ {
+ ThrowHelper.ThrowArgumentException(ExceptionResource.Argument_InvalidRegistryViewCheck, ExceptionArgument.view);
+ }
+ }
+
// Win32 constants for error handling
private const int FORMAT_MESSAGE_IGNORE_INSERTS = 0x00000200;
private const int FORMAT_MESSAGE_FROM_SYSTEM = 0x00001000;
private const int FORMAT_MESSAGE_ARGUMENT_ARRAY = 0x00002000;
}
+
+ [Flags]
+ internal enum RegistryValueOptions
+ {
+ None = 0,
+ DoNotExpandEnvironmentNames = 1
+ }
+
+ // the name for this API is meant to mimic FileMode, which has similar values
+
+ internal enum RegistryKeyPermissionCheck
+ {
+ Default = 0,
+ ReadSubTree = 1,
+ ReadWriteSubTree = 2
+ }
}
diff --git a/src/mscorlib/src/Microsoft/Win32/RegistryValueKind.cs b/src/mscorlib/src/Microsoft/Win32/RegistryValueKind.cs
index 90c880b278..6e2a4f3b6e 100644
--- a/src/mscorlib/src/Microsoft/Win32/RegistryValueKind.cs
+++ b/src/mscorlib/src/Microsoft/Win32/RegistryValueKind.cs
@@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+
namespace Microsoft.Win32
{
internal enum RegistryValueKind
@@ -12,11 +13,8 @@ namespace Microsoft.Win32
DWord = Win32Native.REG_DWORD,
MultiString = Win32Native.REG_MULTI_SZ,
QWord = Win32Native.REG_QWORD,
- Unknown = 0,
-
- // REG_NONE is defined as zero but BCL, mistakingly overrode this value.
- // Now instead of using Win32Native.REG_NONE we use "-1" and play games internally.
- None = unchecked((int)0xFFFFFFFF),
- }
+ Unknown = 0, // REG_NONE is defined as zero but BCL
+ None = unchecked((int)0xFFFFFFFF), // mistakingly overrode this value.
+ } // Now instead of using Win32Native.REG_NONE we use "-1" and play games internally.
}
diff --git a/src/mscorlib/src/Microsoft/Win32/RegistryView.cs b/src/mscorlib/src/Microsoft/Win32/RegistryView.cs
new file mode 100644
index 0000000000..e4158656a8
--- /dev/null
+++ b/src/mscorlib/src/Microsoft/Win32/RegistryView.cs
@@ -0,0 +1,22 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+//
+//
+//
+// Implements Microsoft.Win32.RegistryView
+//
+// ======================================================================================
+
+using System;
+
+namespace Microsoft.Win32
+{
+ internal enum RegistryView
+ {
+ Default = 0, // 0x0000 operate on the default registry view
+ Registry64 = Win32Native.KEY_WOW64_64KEY, // 0x0100 operate on the 64-bit registry view
+ Registry32 = Win32Native.KEY_WOW64_32KEY, // 0x0200 operate on the 32-bit registry view
+ };
+}
diff --git a/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeRegistryHandle.cs b/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeRegistryHandle.cs
index 1215000ec5..64dbb2c638 100644
--- a/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeRegistryHandle.cs
+++ b/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeRegistryHandle.cs
@@ -2,9 +2,19 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+//
+//
+//
+// Implements Microsoft.Win32.SafeHandles.SafeRegistryHandle
+//
+// ======================================================================================
+
using System;
using System.Security;
using System.Runtime.InteropServices;
+using System.Runtime.CompilerServices;
+using System.Runtime.ConstrainedExecution;
+using System.Runtime.Versioning;
namespace Microsoft.Win32.SafeHandles
{
diff --git a/src/mscorlib/src/System/Collections/Generic/Dictionary.cs b/src/mscorlib/src/System/Collections/Generic/Dictionary.cs
index 409b23b541..e360eef897 100644
--- a/src/mscorlib/src/System/Collections/Generic/Dictionary.cs
+++ b/src/mscorlib/src/System/Collections/Generic/Dictionary.cs
@@ -48,6 +48,7 @@ namespace System.Collections.Generic
using System.Collections;
using System.Diagnostics;
using System.Diagnostics.Contracts;
+ using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
/// <summary>
@@ -428,8 +429,7 @@ namespace System.Collections.Generic
if (buckets == null) Initialize(0);
int hashCode = comparer.GetHashCode(key) & 0x7FFFFFFF;
- int targetBucket = hashCode % buckets.Length;
-
+ int targetBucket = hashCode % buckets.Length;
#if FEATURE_RANDOMIZED_STRING_HASHING
int collisionCount = 0;
#endif
@@ -452,7 +452,6 @@ namespace System.Collections.Generic
return false;
}
-
#if FEATURE_RANDOMIZED_STRING_HASHING
collisionCount++;
#endif
@@ -599,27 +598,40 @@ namespace System.Collections.Generic
int hashCode = comparer.GetHashCode(key) & 0x7FFFFFFF;
int bucket = hashCode % buckets.Length;
int last = -1;
- for (int i = buckets[bucket]; i >= 0; last = i, i = entries[i].next)
+ int i = buckets[bucket];
+ while (i >= 0)
{
- if (entries[i].hashCode == hashCode && comparer.Equals(entries[i].key, key))
+ ref Entry entry = ref entries[i];
+
+ if (entry.hashCode == hashCode && comparer.Equals(entry.key, key))
{
if (last < 0)
{
- buckets[bucket] = entries[i].next;
+ buckets[bucket] = entry.next;
}
else
{
- entries[last].next = entries[i].next;
+ entries[last].next = entry.next;
+ }
+ entry.hashCode = -1;
+ entry.next = freeList;
+
+ if (RuntimeHelpers.IsReferenceOrContainsReferences<TKey>())
+ {
+ entry.key = default(TKey);
+ }
+ if (RuntimeHelpers.IsReferenceOrContainsReferences<TValue>())
+ {
+ entry.value = default(TValue);
}
- entries[i].hashCode = -1;
- entries[i].next = freeList;
- entries[i].key = default(TKey);
- entries[i].value = default(TValue);
freeList = i;
freeCount++;
version++;
return true;
}
+
+ last = i;
+ i = entry.next;
}
}
return false;
@@ -640,30 +652,43 @@ namespace System.Collections.Generic
int hashCode = comparer.GetHashCode(key) & 0x7FFFFFFF;
int bucket = hashCode % buckets.Length;
int last = -1;
- for (int i = buckets[bucket]; i >= 0; last = i, i = entries[i].next)
+ int i = buckets[bucket];
+ while (i >= 0)
{
- if (entries[i].hashCode == hashCode && comparer.Equals(entries[i].key, key))
+ ref Entry entry = ref entries[i];
+
+ if (entry.hashCode == hashCode && comparer.Equals(entry.key, key))
{
if (last < 0)
{
- buckets[bucket] = entries[i].next;
+ buckets[bucket] = entry.next;
}
else
{
- entries[last].next = entries[i].next;
+ entries[last].next = entry.next;
}
- value = entries[i].value;
+ value = entry.value;
- entries[i].hashCode = -1;
- entries[i].next = freeList;
- entries[i].key = default(TKey);
- entries[i].value = default(TValue);
+ entry.hashCode = -1;
+ entry.next = freeList;
+
+ if (RuntimeHelpers.IsReferenceOrContainsReferences<TKey>())
+ {
+ entry.key = default(TKey);
+ }
+ if (RuntimeHelpers.IsReferenceOrContainsReferences<TValue>())
+ {
+ entry.value = default(TValue);
+ }
freeList = i;
freeCount++;
version++;
return true;
}
+
+ last = i;
+ i = entry.next;
}
}
value = default(TValue);
@@ -955,13 +980,13 @@ namespace System.Collections.Generic
// dictionary.count+1 could be negative if dictionary.count is Int32.MaxValue
while ((uint)index < (uint)dictionary.count)
{
- if (dictionary.entries[index].hashCode >= 0)
+ ref Entry entry = ref dictionary.entries[index++];
+
+ if (entry.hashCode >= 0)
{
- current = new KeyValuePair<TKey, TValue>(dictionary.entries[index].key, dictionary.entries[index].value);
- index++;
+ current = new KeyValuePair<TKey, TValue>(entry.key, entry.value);
return true;
}
- index++;
}
index = dictionary.count + 1;
@@ -1231,13 +1256,13 @@ namespace System.Collections.Generic
while ((uint)index < (uint)dictionary.count)
{
- if (dictionary.entries[index].hashCode >= 0)
+ ref Entry entry = ref dictionary.entries[index++];
+
+ if (entry.hashCode >= 0)
{
- currentKey = dictionary.entries[index].key;
- index++;
+ currentKey = entry.key;
return true;
}
- index++;
}
index = dictionary.count + 1;
@@ -1459,13 +1484,13 @@ namespace System.Collections.Generic
while ((uint)index < (uint)dictionary.count)
{
- if (dictionary.entries[index].hashCode >= 0)
+ ref Entry entry = ref dictionary.entries[index++];
+
+ if (entry.hashCode >= 0)
{
- currentValue = dictionary.entries[index].value;
- index++;
+ currentValue = entry.value;
return true;
}
- index++;
}
index = dictionary.count + 1;
currentValue = default(TValue);
diff --git a/src/mscorlib/src/System/Collections/Generic/List.cs b/src/mscorlib/src/System/Collections/Generic/List.cs
index 67d1668aad..4e480885ef 100644
--- a/src/mscorlib/src/System/Collections/Generic/List.cs
+++ b/src/mscorlib/src/System/Collections/Generic/List.cs
@@ -350,6 +350,7 @@ namespace System.Collections.Generic
// Clears the contents of List.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Clear()
{
if (RuntimeHelpers.IsReferenceOrContainsReferences<T>())
diff --git a/src/mscorlib/src/System/Delegate.cs b/src/mscorlib/src/System/Delegate.cs
index de0ff6532c..75ec57a003 100644
--- a/src/mscorlib/src/System/Delegate.cs
+++ b/src/mscorlib/src/System/Delegate.cs
@@ -179,7 +179,10 @@ namespace System
else
return unchecked((int)((long)this._methodPtrAux));
*/
- return GetType().GetHashCode();
+ if (_methodPtrAux.IsNull())
+ return ( _target != null ? RuntimeHelpers.GetHashCode(_target) * 33 : 0) + GetType().GetHashCode();
+ else
+ return GetType().GetHashCode();
}
public static Delegate Combine(Delegate a, Delegate b)
diff --git a/src/mscorlib/src/System/Environment.cs b/src/mscorlib/src/System/Environment.cs
index b9070ae713..dddbdc242d 100644
--- a/src/mscorlib/src/System/Environment.cs
+++ b/src/mscorlib/src/System/Environment.cs
@@ -820,7 +820,7 @@ namespace System
}
else
{
- environmentKey.SetStringValue(variable, value);
+ environmentKey.SetValue(variable, value);
}
}
}
diff --git a/src/mscorlib/src/System/Globalization/CompareInfo.cs b/src/mscorlib/src/System/Globalization/CompareInfo.cs
index 285a81d906..b2c2208db7 100644
--- a/src/mscorlib/src/System/Globalization/CompareInfo.cs
+++ b/src/mscorlib/src/System/Globalization/CompareInfo.cs
@@ -752,7 +752,6 @@ namespace System.Globalization
return IndexOfCore(source, new string(value, 1), startIndex, count, options, null);
}
-
public unsafe virtual int IndexOf(string source, string value, int startIndex, int count, CompareOptions options)
{
// Validate inputs
@@ -802,6 +801,53 @@ namespace System.Globalization
return IndexOfCore(source, value, startIndex, count, options, null);
}
+ // The following IndexOf overload is mainly used by String.Replace. This overload assumes the parameters are already validated
+ // and the caller is passing a valid matchLengthPtr pointer.
+ internal unsafe int IndexOf(string source, string value, int startIndex, int count, CompareOptions options, int* matchLengthPtr)
+ {
+ Debug.Assert(source != null);
+ Debug.Assert(value != null);
+ Debug.Assert(startIndex >= 0);
+ Debug.Assert(matchLengthPtr != null);
+ *matchLengthPtr = 0;
+
+ if (source.Length == 0)
+ {
+ if (value.Length == 0)
+ {
+ return 0;
+ }
+ return -1;
+ }
+
+ if (startIndex >= source.Length)
+ {
+ return -1;
+ }
+
+ if (options == CompareOptions.OrdinalIgnoreCase)
+ {
+ int res = IndexOfOrdinal(source, value, startIndex, count, ignoreCase: true);
+ if (res >= 0)
+ {
+ *matchLengthPtr = value.Length;
+ }
+ return res;
+ }
+
+ if (_invariantMode)
+ {
+ int res = IndexOfOrdinal(source, value, startIndex, count, ignoreCase: (options & (CompareOptions.IgnoreCase | CompareOptions.OrdinalIgnoreCase)) != 0);
+ if (res >= 0)
+ {
+ *matchLengthPtr = value.Length;
+ }
+ return res;
+ }
+
+ return IndexOfCore(source, value, startIndex, count, options, matchLengthPtr);
+ }
+
internal int IndexOfOrdinal(string source, string value, int startIndex, int count, bool ignoreCase)
{
if (_invariantMode)
diff --git a/src/mscorlib/src/System/Globalization/HijriCalendar.Win32.cs b/src/mscorlib/src/System/Globalization/HijriCalendar.Win32.cs
index 4ba95c8fa8..869b809bff 100644
--- a/src/mscorlib/src/System/Globalization/HijriCalendar.Win32.cs
+++ b/src/mscorlib/src/System/Globalization/HijriCalendar.Win32.cs
@@ -42,41 +42,54 @@ namespace System.Globalization
int hijriAdvance = 0;
Microsoft.Win32.RegistryKey key = null;
- using (key = Registry.CurrentUser.OpenSubKey(InternationalRegKey, writable: false))
+ try
{
- if (key == null)
- return 0;
+ // Open in read-only mode.
+ // Use InternalOpenSubKey so that we avoid the security check.
+ key = RegistryKey.GetBaseKey(RegistryKey.HKEY_CURRENT_USER).OpenSubKey(InternationalRegKey, false);
+ }
+ //If this fails for any reason, we'll just return 0.
+ catch (ObjectDisposedException) { return 0; }
+ catch (ArgumentException) { return 0; }
- Object value = key.GetValue(HijriAdvanceRegKeyEntry);
- if (value == null)
- {
- return (0);
- }
- String str = value.ToString();
- if (String.Compare(str, 0, HijriAdvanceRegKeyEntry, 0, HijriAdvanceRegKeyEntry.Length, StringComparison.OrdinalIgnoreCase) == 0)
+ if (key != null)
+ {
+ try
{
- if (str.Length == HijriAdvanceRegKeyEntry.Length)
- hijriAdvance = -1;
- else
+ Object value = key.InternalGetValue(HijriAdvanceRegKeyEntry, null, false, false);
+ if (value == null)
{
- str = str.Substring(HijriAdvanceRegKeyEntry.Length);
- try
+ return (0);
+ }
+ String str = value.ToString();
+ if (String.Compare(str, 0, HijriAdvanceRegKeyEntry, 0, HijriAdvanceRegKeyEntry.Length, StringComparison.OrdinalIgnoreCase) == 0)
+ {
+ if (str.Length == HijriAdvanceRegKeyEntry.Length)
+ hijriAdvance = -1;
+ else
{
- int advance = Int32.Parse(str.ToString(), CultureInfo.InvariantCulture);
- if ((advance >= MinAdvancedHijri) && (advance <= MaxAdvancedHijri))
+ str = str.Substring(HijriAdvanceRegKeyEntry.Length);
+ try
{
- hijriAdvance = advance;
+ int advance = Int32.Parse(str.ToString(), CultureInfo.InvariantCulture);
+ if ((advance >= MinAdvancedHijri) && (advance <= MaxAdvancedHijri))
+ {
+ hijriAdvance = advance;
+ }
}
+ // If we got garbage from registry just ignore it.
+ // hijriAdvance = 0 because of declaraction assignment up above.
+ catch (ArgumentException) { }
+ catch (FormatException) { }
+ catch (OverflowException) { }
}
- // If we got garbage from registry just ignore it.
- // hijriAdvance = 0 because of declaraction assignment up above.
- catch (ArgumentException) { }
- catch (FormatException) { }
- catch (OverflowException) { }
}
}
+ finally
+ {
+ key.Close();
+ }
}
-
return (hijriAdvance);
}
}
diff --git a/src/mscorlib/src/System/Globalization/JapaneseCalendar.Win32.cs b/src/mscorlib/src/System/Globalization/JapaneseCalendar.Win32.cs
index fe8b1b5896..a83c4fad9e 100644
--- a/src/mscorlib/src/System/Globalization/JapaneseCalendar.Win32.cs
+++ b/src/mscorlib/src/System/Globalization/JapaneseCalendar.Win32.cs
@@ -36,30 +36,30 @@ namespace System.Globalization
try
{
- using (RegistryKey key = Registry.LocalMachine.OpenSubKey(c_japaneseErasHive, writable: false))
+ // Need to access registry
+ RegistryKey key = RegistryKey.GetBaseKey(RegistryKey.HKEY_LOCAL_MACHINE).OpenSubKey(c_japaneseErasHive, false);
+
+ // Abort if we didn't find anything
+ if (key == null) return null;
+
+ // Look up the values in our reg key
+ String[] valueNames = key.GetValueNames();
+ if (valueNames != null && valueNames.Length > 0)
{
- // Abort if we didn't find anything
- if (key == null) return null;
+ registryEraRanges = new EraInfo[valueNames.Length];
- // Look up the values in our reg key
- String[] valueNames = key.GetValueNames();
- if (valueNames != null && valueNames.Length > 0)
+ // Loop through the registry and read in all the values
+ for (int i = 0; i < valueNames.Length; i++)
{
- registryEraRanges = new EraInfo[valueNames.Length];
-
- // Loop through the registry and read in all the values
- for (int i = 0; i < valueNames.Length; i++)
- {
- // See if the era is a valid date
- EraInfo era = GetEraFromValue(valueNames[i], key.GetValue(valueNames[i]).ToString());
+ // See if the era is a valid date
+ EraInfo era = GetEraFromValue(valueNames[i], key.GetValue(valueNames[i]).ToString());
- // continue if not valid
- if (era == null) continue;
+ // continue if not valid
+ if (era == null) continue;
- // Remember we found one.
- registryEraRanges[iFoundEras] = era;
- iFoundEras++;
- }
+ // Remember we found one.
+ registryEraRanges[iFoundEras] = era;
+ iFoundEras++;
}
}
}
diff --git a/src/mscorlib/src/System/IO/Stream.cs b/src/mscorlib/src/System/IO/Stream.cs
index 92fe374f19..65cc4ddcb9 100644
--- a/src/mscorlib/src/System/IO/Stream.cs
+++ b/src/mscorlib/src/System/IO/Stream.cs
@@ -522,14 +522,14 @@ namespace System.IO
// If the wait has already completed, run the task.
if (asyncWaiter.IsCompleted)
{
- Debug.Assert(asyncWaiter.IsRanToCompletion, "The semaphore wait should always complete successfully.");
+ Debug.Assert(asyncWaiter.IsCompletedSuccessfully, "The semaphore wait should always complete successfully.");
RunReadWriteTask(readWriteTask);
}
else // Otherwise, wait for our turn, and then run the task.
{
asyncWaiter.ContinueWith((t, state) =>
{
- Debug.Assert(t.IsRanToCompletion, "The semaphore wait should always complete successfully.");
+ Debug.Assert(t.IsCompletedSuccessfully, "The semaphore wait should always complete successfully.");
var rwt = (ReadWriteTask)state;
rwt._stream.RunReadWriteTask(rwt); // RunReadWriteTask(readWriteTask);
}, readWriteTask, default(CancellationToken), TaskContinuationOptions.ExecuteSynchronously, TaskScheduler.Default);
diff --git a/src/mscorlib/src/System/Reflection/Assembly.CoreCLR.cs b/src/mscorlib/src/System/Reflection/Assembly.CoreCLR.cs
index 82966dba60..708f79b64f 100644
--- a/src/mscorlib/src/System/Reflection/Assembly.CoreCLR.cs
+++ b/src/mscorlib/src/System/Reflection/Assembly.CoreCLR.cs
@@ -101,14 +101,20 @@ namespace System.Reflection
{
Contract.Ensures(Contract.Result<Assembly>() != null);
Contract.Ensures(!Contract.Result<Assembly>().ReflectionOnly);
-
+
+ AssemblyName modifiedAssemblyRef = null;
if (assemblyRef != null && assemblyRef.CodeBase != null)
{
- throw new NotSupportedException(SR.NotSupported_AssemblyLoadCodeBase);
+ modifiedAssemblyRef = (AssemblyName)assemblyRef.Clone();
+ modifiedAssemblyRef.CodeBase = null;
}
-
+ else
+ {
+ modifiedAssemblyRef = assemblyRef;
+ }
+
StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
- return RuntimeAssembly.InternalLoadAssemblyName(assemblyRef, null, null, ref stackMark, true /*thrownOnFileNotFound*/, false /*forIntrospection*/);
+ return RuntimeAssembly.InternalLoadAssemblyName(modifiedAssemblyRef, null, null, ref stackMark, true /*thrownOnFileNotFound*/, false /*forIntrospection*/);
}
// Locate an assembly by its name. The name can be strong or
@@ -119,13 +125,19 @@ namespace System.Reflection
Contract.Ensures(Contract.Result<Assembly>() != null);
Contract.Ensures(!Contract.Result<Assembly>().ReflectionOnly);
+ AssemblyName modifiedAssemblyRef = null;
if (assemblyRef != null && assemblyRef.CodeBase != null)
{
- throw new NotSupportedException(SR.NotSupported_AssemblyLoadCodeBase);
+ modifiedAssemblyRef = (AssemblyName)assemblyRef.Clone();
+ modifiedAssemblyRef.CodeBase = null;
+ }
+ else
+ {
+ modifiedAssemblyRef = assemblyRef;
}
StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
- return RuntimeAssembly.InternalLoadAssemblyName(assemblyRef, null, null, ref stackMark, true /*thrownOnFileNotFound*/, false /*forIntrospection*/, ptrLoadContextBinder);
+ return RuntimeAssembly.InternalLoadAssemblyName(modifiedAssemblyRef, null, null, ref stackMark, true /*thrownOnFileNotFound*/, false /*forIntrospection*/, ptrLoadContextBinder);
}
// Loads the assembly with a COFF based IMAGE containing
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/TaskAwaiter.cs b/src/mscorlib/src/System/Runtime/CompilerServices/TaskAwaiter.cs
index e2fa6caa2d..c35658e54c 100644
--- a/src/mscorlib/src/System/Runtime/CompilerServices/TaskAwaiter.cs
+++ b/src/mscorlib/src/System/Runtime/CompilerServices/TaskAwaiter.cs
@@ -146,7 +146,7 @@ namespace System.Runtime.CompilerServices
task.NotifyDebuggerOfWaitCompletionIfNecessary();
// And throw an exception if the task is faulted or canceled.
- if (!task.IsRanToCompletion) ThrowForNonSuccess(task);
+ if (!task.IsCompletedSuccessfully) ThrowForNonSuccess(task);
}
/// <summary>Throws an exception to handle a task that completed in a state other than RanToCompletion.</summary>
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/jithelpers.cs b/src/mscorlib/src/System/Runtime/CompilerServices/jithelpers.cs
index b86835f778..d5201350ec 100644
--- a/src/mscorlib/src/System/Runtime/CompilerServices/jithelpers.cs
+++ b/src/mscorlib/src/System/Runtime/CompilerServices/jithelpers.cs
@@ -216,14 +216,7 @@ namespace System.Runtime.CompilerServices
private extern static bool IsAddressInStack(IntPtr ptr);
#endif
- static internal bool ByRefLessThan<T>(ref T refA, ref T refB)
- {
- // The body of this function will be replaced by the EE with unsafe code!!!
- // See getILIntrinsicImplementation for how this happens.
- throw new InvalidOperationException();
- }
-
- static internal ref T GetArrayData<T>(T[] array)
+ static internal ref byte GetRawSzArrayData(this Array array)
{
// The body of this function will be replaced by the EE with unsafe code!!!
// See getILIntrinsicImplementation for how this happens.
diff --git a/src/mscorlib/src/System/Runtime/InteropServices/Marshal.cs b/src/mscorlib/src/System/Runtime/InteropServices/Marshal.cs
index 248e0d5778..6fb631121b 100644
--- a/src/mscorlib/src/System/Runtime/InteropServices/Marshal.cs
+++ b/src/mscorlib/src/System/Runtime/InteropServices/Marshal.cs
@@ -824,6 +824,9 @@ namespace System.Runtime.InteropServices
}
[MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public static extern /* struct _EXCEPTION_POINTERS* */ IntPtr GetExceptionPointers();
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
public static extern int GetExceptionCode();
diff --git a/src/mscorlib/src/System/String.Manipulation.cs b/src/mscorlib/src/System/String.Manipulation.cs
index 33e341c58e..b71ffa2f63 100644
--- a/src/mscorlib/src/System/String.Manipulation.cs
+++ b/src/mscorlib/src/System/String.Manipulation.cs
@@ -1022,8 +1022,10 @@ namespace System
{
if (oldValue == null)
throw new ArgumentNullException(nameof(oldValue));
+ if (oldValue.Length == 0)
+ throw new ArgumentException(SR.Argument_StringZeroLength, nameof(oldValue));
- // If they asked to replace oldValue with a null, replace all occurences
+ // If they asked to replace oldValue with a null, replace all occurrences
// with the empty string.
if (newValue == null)
newValue = string.Empty;
@@ -1037,10 +1039,11 @@ namespace System
int matchLength = 0;
bool hasDoneAnyReplacements = false;
+ CompareInfo ci = referenceCulture.CompareInfo;
do
{
- index = referenceCulture.CompareInfo.IndexOfCore(this, oldValue, startIndex, m_stringLength - startIndex, options, &matchLength);
+ index = ci.IndexOf(this, oldValue, startIndex, m_stringLength - startIndex, options, &matchLength);
if (index >= 0)
{
// append the unmodified portion of string
diff --git a/src/mscorlib/src/System/String.cs b/src/mscorlib/src/System/String.cs
index f3a4d0f197..0a17c1ee24 100644
--- a/src/mscorlib/src/System/String.cs
+++ b/src/mscorlib/src/System/String.cs
@@ -876,7 +876,7 @@ namespace System
}
}
- internal ref char GetFirstCharRef()
+ internal ref char GetRawStringData()
{
return ref m_firstChar;
}
diff --git a/src/mscorlib/src/System/Threading/Tasks/Task.cs b/src/mscorlib/src/System/Threading/Tasks/Task.cs
index 8e2e6a4cb0..0a9248cba8 100644
--- a/src/mscorlib/src/System/Threading/Tasks/Task.cs
+++ b/src/mscorlib/src/System/Threading/Tasks/Task.cs
@@ -1467,8 +1467,7 @@ namespace System.Threading.Tasks
return (flags & TASK_STATE_COMPLETED_MASK) != 0;
}
- // For use in InternalWait -- marginally faster than (Task.Status == TaskStatus.RanToCompletion)
- internal bool IsRanToCompletion
+ public bool IsCompletedSuccessfully
{
get { return (m_stateFlags & TASK_STATE_COMPLETED_MASK) == TASK_STATE_RAN_TO_COMPLETION; }
}
diff --git a/src/mscorlib/src/System/Threading/Tasks/TaskContinuation.cs b/src/mscorlib/src/System/Threading/Tasks/TaskContinuation.cs
index 848a0ecbc2..de222352c9 100644
--- a/src/mscorlib/src/System/Threading/Tasks/TaskContinuation.cs
+++ b/src/mscorlib/src/System/Threading/Tasks/TaskContinuation.cs
@@ -320,7 +320,7 @@ namespace System.Threading.Tasks
// activation criteria of the TaskContinuationOptions.
TaskContinuationOptions options = m_options;
bool isRightKind =
- completedTask.IsRanToCompletion ?
+ completedTask.IsCompletedSuccessfully ?
(options & TaskContinuationOptions.NotOnRanToCompletion) == 0 :
(completedTask.IsCanceled ?
(options & TaskContinuationOptions.NotOnCanceled) == 0 :
diff --git a/src/mscorlib/src/System/Threading/Tasks/future.cs b/src/mscorlib/src/System/Threading/Tasks/future.cs
index 26c2388e6b..bf9000ea00 100644
--- a/src/mscorlib/src/System/Threading/Tasks/future.cs
+++ b/src/mscorlib/src/System/Threading/Tasks/future.cs
@@ -374,7 +374,7 @@ namespace System.Threading.Tasks
{
get
{
- return IsRanToCompletion ? "" + m_result : SR.TaskT_DebuggerNoResult;
+ return IsCompletedSuccessfully ? "" + m_result : SR.TaskT_DebuggerNoResult;
}
}
@@ -491,10 +491,10 @@ namespace System.Threading.Tasks
if (waitCompletionNotification) NotifyDebuggerOfWaitCompletionIfNecessary();
// Throw an exception if appropriate.
- if (!IsRanToCompletion) ThrowIfExceptional(includeTaskCanceledExceptions: true);
+ if (!IsCompletedSuccessfully) ThrowIfExceptional(includeTaskCanceledExceptions: true);
// We shouldn't be here if the result has not been set.
- Debug.Assert(IsRanToCompletion, "Task<T>.Result getter: Expected result to have been set.");
+ Debug.Assert(IsCompletedSuccessfully, "Task<T>.Result getter: Expected result to have been set.");
return m_result;
}
diff --git a/src/mscorlib/src/System/ThrowHelper.cs b/src/mscorlib/src/System/ThrowHelper.cs
index 4dcf8d4511..ff76738e8e 100644
--- a/src/mscorlib/src/System/ThrowHelper.cs
+++ b/src/mscorlib/src/System/ThrowHelper.cs
@@ -416,6 +416,7 @@ namespace System
type,
stateMachine,
pHandle,
+ values
}
//
diff --git a/src/mscorlib/src/System/TimeZoneInfo.Win32.cs b/src/mscorlib/src/System/TimeZoneInfo.Win32.cs
index b6585bd0a0..4f740bd355 100644
--- a/src/mscorlib/src/System/TimeZoneInfo.Win32.cs
+++ b/src/mscorlib/src/System/TimeZoneInfo.Win32.cs
@@ -398,7 +398,7 @@ namespace System
baseOffset = baseOffset + match.Rule.BaseUtcOffsetDelta;
if (match.Rule.HasDaylightSaving)
{
- isDaylightSavings = GetIsDaylightSavingsFromUtc(time, timeYear, match.Offset, match.Rule, out isAmbiguousLocalDst, Local);
+ isDaylightSavings = GetIsDaylightSavingsFromUtc(time, timeYear, match.Offset, match.Rule, null, out isAmbiguousLocalDst, Local);
baseOffset += (isDaylightSavings ? match.Rule.DaylightDelta : TimeSpan.Zero /* FUTURE: rule.StandardDelta */);
}
}
@@ -576,8 +576,8 @@ namespace System
// read LastEntry {(yearN, 1, 1) - MaxValue }
// read the FirstEntry and LastEntry key values (ex: "1980", "2038")
- int first = (int)dynamicKey.GetValue(FirstEntryValue, -1);
- int last = (int)dynamicKey.GetValue(LastEntryValue, -1);
+ int first = (int)dynamicKey.GetValue(FirstEntryValue, -1, RegistryValueOptions.None);
+ int last = (int)dynamicKey.GetValue(LastEntryValue, -1, RegistryValueOptions.None);
if (first == -1 || last == -1 || first > last)
{
@@ -587,7 +587,7 @@ namespace System
// read the first year entry
Win32Native.RegistryTimeZoneInformation dtzi;
- byte[] regValue = dynamicKey.GetValue(first.ToString(CultureInfo.InvariantCulture)) as byte[];
+ byte[] regValue = dynamicKey.GetValue(first.ToString(CultureInfo.InvariantCulture), null, RegistryValueOptions.None) as byte[];
if (regValue == null || regValue.Length != RegByteLength)
{
rules = null;
@@ -620,7 +620,7 @@ namespace System
// read the middle year entries
for (int i = first + 1; i < last; i++)
{
- regValue = dynamicKey.GetValue(i.ToString(CultureInfo.InvariantCulture)) as byte[];
+ regValue = dynamicKey.GetValue(i.ToString(CultureInfo.InvariantCulture), null, RegistryValueOptions.None) as byte[];
if (regValue == null || regValue.Length != RegByteLength)
{
rules = null;
@@ -640,7 +640,7 @@ namespace System
}
// read the last year entry
- regValue = dynamicKey.GetValue(last.ToString(CultureInfo.InvariantCulture)) as byte[];
+ regValue = dynamicKey.GetValue(last.ToString(CultureInfo.InvariantCulture), null, RegistryValueOptions.None) as byte[];
dtzi = new Win32Native.RegistryTimeZoneInformation(regValue);
if (regValue == null || regValue.Length != RegByteLength)
{
@@ -719,7 +719,7 @@ namespace System
}
Win32Native.RegistryTimeZoneInformation registryTimeZoneInfo;
- byte[] regValue = key.GetValue(TimeZoneInfoValue) as byte[];
+ byte[] regValue = key.GetValue(TimeZoneInfoValue, null, RegistryValueOptions.None) as byte[];
if (regValue == null || regValue.Length != RegByteLength) return false;
registryTimeZoneInfo = new Win32Native.RegistryTimeZoneInformation(regValue);
@@ -756,7 +756,7 @@ namespace System
//
if (result)
{
- string registryStandardName = key.GetValue(StandardValue, string.Empty) as string;
+ string registryStandardName = key.GetValue(StandardValue, string.Empty, RegistryValueOptions.None) as string;
result = string.Equals(registryStandardName, timeZone.StandardName, StringComparison.Ordinal);
}
return result;
@@ -884,9 +884,9 @@ namespace System
daylightName = string.Empty;
// read the MUI_ registry keys
- string displayNameMuiResource = key.GetValue(MuiDisplayValue, string.Empty) as string;
- string standardNameMuiResource = key.GetValue(MuiStandardValue, string.Empty) as string;
- string daylightNameMuiResource = key.GetValue(MuiDaylightValue, string.Empty) as string;
+ string displayNameMuiResource = key.GetValue(MuiDisplayValue, string.Empty, RegistryValueOptions.None) as string;
+ string standardNameMuiResource = key.GetValue(MuiStandardValue, string.Empty, RegistryValueOptions.None) as string;
+ string daylightNameMuiResource = key.GetValue(MuiDaylightValue, string.Empty, RegistryValueOptions.None) as string;
// try to load the strings from the native resource DLL(s)
if (!string.IsNullOrEmpty(displayNameMuiResource))
@@ -907,15 +907,15 @@ namespace System
// fallback to using the standard registry keys
if (string.IsNullOrEmpty(displayName))
{
- displayName = key.GetValue(DisplayValue, string.Empty) as string;
+ displayName = key.GetValue(DisplayValue, string.Empty, RegistryValueOptions.None) as string;
}
if (string.IsNullOrEmpty(standardName))
{
- standardName = key.GetValue(StandardValue, string.Empty) as string;
+ standardName = key.GetValue(StandardValue, string.Empty, RegistryValueOptions.None) as string;
}
if (string.IsNullOrEmpty(daylightName))
{
- daylightName = key.GetValue(DaylightValue, string.Empty) as string;
+ daylightName = key.GetValue(DaylightValue, string.Empty, RegistryValueOptions.None) as string;
}
return true;
@@ -964,7 +964,7 @@ namespace System
}
Win32Native.RegistryTimeZoneInformation defaultTimeZoneInformation;
- byte[] regValue = key.GetValue(TimeZoneInfoValue) as byte[];
+ byte[] regValue = key.GetValue(TimeZoneInfoValue, null, RegistryValueOptions.None) as byte[];
if (regValue == null || regValue.Length != RegByteLength)
{
// the registry value could not be cast to a byte array
diff --git a/src/mscorlib/src/System/TimeZoneInfo.cs b/src/mscorlib/src/System/TimeZoneInfo.cs
index 29ea33a8ad..8ed7e229c0 100644
--- a/src/mscorlib/src/System/TimeZoneInfo.cs
+++ b/src/mscorlib/src/System/TimeZoneInfo.cs
@@ -172,10 +172,11 @@ namespace System
DateTime adjustedTime = ConvertTime(dateTimeOffset, this).DateTime;
bool isAmbiguous = false;
- AdjustmentRule rule = GetAdjustmentRuleForAmbiguousOffsets(adjustedTime);
+ int? ruleIndex;
+ AdjustmentRule rule = GetAdjustmentRuleForAmbiguousOffsets(adjustedTime, out ruleIndex);
if (rule != null && rule.HasDaylightSaving)
{
- DaylightTimeStruct daylightTime = GetDaylightTime(adjustedTime.Year, rule);
+ DaylightTimeStruct daylightTime = GetDaylightTime(adjustedTime.Year, rule, ruleIndex);
isAmbiguous = GetIsAmbiguousTime(adjustedTime, rule, daylightTime);
}
@@ -232,10 +233,11 @@ namespace System
}
bool isAmbiguous = false;
- AdjustmentRule rule = GetAdjustmentRuleForAmbiguousOffsets(adjustedTime);
+ int? ruleIndex;
+ AdjustmentRule rule = GetAdjustmentRuleForAmbiguousOffsets(adjustedTime, out ruleIndex);
if (rule != null && rule.HasDaylightSaving)
{
- DaylightTimeStruct daylightTime = GetDaylightTime(adjustedTime.Year, rule);
+ DaylightTimeStruct daylightTime = GetDaylightTime(adjustedTime.Year, rule, ruleIndex);
isAmbiguous = GetIsAmbiguousTime(adjustedTime, rule, daylightTime);
}
@@ -263,15 +265,15 @@ namespace System
}
// note the time is already adjusted
- private AdjustmentRule GetAdjustmentRuleForAmbiguousOffsets(DateTime adjustedTime)
+ private AdjustmentRule GetAdjustmentRuleForAmbiguousOffsets(DateTime adjustedTime, out int? ruleIndex)
{
- AdjustmentRule rule = GetAdjustmentRuleForTime(adjustedTime);
+ AdjustmentRule rule = GetAdjustmentRuleForTime(adjustedTime, out ruleIndex);
if (rule != null && rule.NoDaylightTransitions && !rule.HasDaylightSaving)
{
// When using NoDaylightTransitions rules, each rule is only for one offset.
// When looking for the Daylight savings rules, and we found the non-DST rule,
// then we get the rule right before this rule.
- return GetPreviousAdjustmentRule(rule);
+ return GetPreviousAdjustmentRule(rule, ruleIndex);
}
return rule;
@@ -282,12 +284,23 @@ namespace System
/// If the specified rule is the first AdjustmentRule, or it isn't in _adjustmentRules,
/// then the specified rule is returned.
/// </summary>
- private AdjustmentRule GetPreviousAdjustmentRule(AdjustmentRule rule)
+ private AdjustmentRule GetPreviousAdjustmentRule(AdjustmentRule rule, int? ruleIndex)
{
+ Debug.Assert(rule.NoDaylightTransitions, "GetPreviousAdjustmentRule should only be used with NoDaylightTransitions rules.");
+
+ if (ruleIndex.HasValue && 0 < ruleIndex.Value && ruleIndex.Value < _adjustmentRules.Length)
+ {
+ return _adjustmentRules[ruleIndex.Value - 1];
+ }
+
AdjustmentRule result = rule;
for (int i = 1; i < _adjustmentRules.Length; i++)
{
- if (rule.Equals(_adjustmentRules[i]))
+ // use ReferenceEquals here instead of AdjustmentRule.Equals because
+ // ReferenceEquals is much faster. This is safe because all the callers
+ // of GetPreviousAdjustmentRule pass in a rule that was retrieved from
+ // _adjustmentRules. A different approach will be needed if this ever changes.
+ if (ReferenceEquals(rule, _adjustmentRules[i]))
{
result = _adjustmentRules[i - 1];
break;
@@ -407,10 +420,11 @@ namespace System
dateTime.Kind == DateTimeKind.Utc ? ConvertTime(dateTime, s_utcTimeZone, this, flags, cachedData) :
dateTime;
- AdjustmentRule rule = GetAdjustmentRuleForTime(adjustedTime);
+ int? ruleIndex;
+ AdjustmentRule rule = GetAdjustmentRuleForTime(adjustedTime, out ruleIndex);
if (rule != null && rule.HasDaylightSaving)
{
- DaylightTimeStruct daylightTime = GetDaylightTime(adjustedTime.Year, rule);
+ DaylightTimeStruct daylightTime = GetDaylightTime(adjustedTime.Year, rule, ruleIndex);
return GetIsAmbiguousTime(adjustedTime, rule, daylightTime);
}
return false;
@@ -492,10 +506,11 @@ namespace System
//
// handle the normal cases...
//
- AdjustmentRule rule = GetAdjustmentRuleForTime(adjustedTime);
+ int? ruleIndex;
+ AdjustmentRule rule = GetAdjustmentRuleForTime(adjustedTime, out ruleIndex);
if (rule != null && rule.HasDaylightSaving)
{
- DaylightTimeStruct daylightTime = GetDaylightTime(adjustedTime.Year, rule);
+ DaylightTimeStruct daylightTime = GetDaylightTime(adjustedTime.Year, rule, ruleIndex);
return GetIsDaylightSavings(adjustedTime, rule, daylightTime, flags);
}
else
@@ -515,11 +530,12 @@ namespace System
(dateTime.Kind == DateTimeKind.Local && s_cachedData.GetCorrespondingKind(this) == DateTimeKind.Local))
{
// only check Unspecified and (Local when this TimeZoneInfo instance is Local)
- AdjustmentRule rule = GetAdjustmentRuleForTime(dateTime);
+ int? ruleIndex;
+ AdjustmentRule rule = GetAdjustmentRuleForTime(dateTime, out ruleIndex);
if (rule != null && rule.HasDaylightSaving)
{
- DaylightTimeStruct daylightTime = GetDaylightTime(dateTime.Year, rule);
+ DaylightTimeStruct daylightTime = GetDaylightTime(dateTime.Year, rule, ruleIndex);
isInvalid = GetIsInvalidTime(dateTime, rule, daylightTime);
}
else
@@ -661,7 +677,8 @@ namespace System
// performance for the normal case at the expense of the 'ArgumentException'
// case and Loss-less Local special cases.
//
- AdjustmentRule sourceRule = sourceTimeZone.GetAdjustmentRuleForTime(dateTime);
+ int? sourceRuleIndex;
+ AdjustmentRule sourceRule = sourceTimeZone.GetAdjustmentRuleForTime(dateTime, out sourceRuleIndex);
TimeSpan sourceOffset = sourceTimeZone.BaseUtcOffset;
if (sourceRule != null)
@@ -670,7 +687,7 @@ namespace System
if (sourceRule.HasDaylightSaving)
{
bool sourceIsDaylightSavings = false;
- DaylightTimeStruct sourceDaylightTime = sourceTimeZone.GetDaylightTime(dateTime.Year, sourceRule);
+ DaylightTimeStruct sourceDaylightTime = sourceTimeZone.GetDaylightTime(dateTime.Year, sourceRule, sourceRuleIndex);
// 'dateTime' might be in an invalid time range since it is in an AdjustmentRule
// period that supports DST
@@ -1048,10 +1065,19 @@ namespace System
_supportsDaylightSavingTime = (bool)info.GetValue("SupportsDaylightSavingTime", typeof(bool));
}
- private AdjustmentRule GetAdjustmentRuleForTime(DateTime dateTime, bool dateTimeisUtc = false)
+ private AdjustmentRule GetAdjustmentRuleForTime(DateTime dateTime, out int? ruleIndex)
+ {
+ AdjustmentRule result = GetAdjustmentRuleForTime(dateTime, dateTimeisUtc: false, ruleIndex: out ruleIndex);
+ Debug.Assert(result == null || ruleIndex.HasValue, "If an AdjustmentRule was found, ruleIndex should also be set.");
+
+ return result;
+ }
+
+ private AdjustmentRule GetAdjustmentRuleForTime(DateTime dateTime, bool dateTimeisUtc, out int? ruleIndex)
{
if (_adjustmentRules == null || _adjustmentRules.Length == 0)
{
+ ruleIndex = null;
return null;
}
@@ -1076,6 +1102,7 @@ namespace System
int compareResult = CompareAdjustmentRuleToDateTime(rule, previousRule, dateTime, date, dateTimeisUtc);
if (compareResult == 0)
{
+ ruleIndex = median;
return rule;
}
else if (compareResult < 0)
@@ -1088,6 +1115,7 @@ namespace System
}
}
+ ruleIndex = null;
return null;
}
@@ -1199,7 +1227,7 @@ namespace System
/// <summary>
/// Helper function that returns a DaylightTime from a year and AdjustmentRule.
/// </summary>
- private DaylightTimeStruct GetDaylightTime(int year, AdjustmentRule rule)
+ private DaylightTimeStruct GetDaylightTime(int year, AdjustmentRule rule, int? ruleIndex)
{
TimeSpan delta = rule.DaylightDelta;
DateTime startTime;
@@ -1211,7 +1239,7 @@ namespace System
// Convert the UTC times into adjusted time zone times.
// use the previous rule to calculate the startTime, since the DST change happens w.r.t. the previous rule
- AdjustmentRule previousRule = GetPreviousAdjustmentRule(rule);
+ AdjustmentRule previousRule = GetPreviousAdjustmentRule(rule, ruleIndex);
startTime = ConvertFromUtc(rule.DateStart, previousRule.DaylightDelta, previousRule.BaseUtcOffsetDelta);
endTime = ConvertFromUtc(rule.DateEnd, rule.DaylightDelta, rule.BaseUtcOffsetDelta);
@@ -1301,12 +1329,12 @@ namespace System
/// <summary>
/// Gets the offset that should be used to calculate DST start times from a UTC time.
/// </summary>
- private TimeSpan GetDaylightSavingsStartOffsetFromUtc(TimeSpan baseUtcOffset, AdjustmentRule rule)
+ private TimeSpan GetDaylightSavingsStartOffsetFromUtc(TimeSpan baseUtcOffset, AdjustmentRule rule, int? ruleIndex)
{
if (rule.NoDaylightTransitions)
{
// use the previous rule to calculate the startTime, since the DST change happens w.r.t. the previous rule
- AdjustmentRule previousRule = GetPreviousAdjustmentRule(rule);
+ AdjustmentRule previousRule = GetPreviousAdjustmentRule(rule, ruleIndex);
return baseUtcOffset + previousRule.BaseUtcOffsetDelta + previousRule.DaylightDelta;
}
else
@@ -1328,7 +1356,7 @@ namespace System
/// Helper function that checks if a given dateTime is in Daylight Saving Time (DST).
/// This function assumes the dateTime is in UTC and AdjustmentRule is in a different time zone.
/// </summary>
- private static bool GetIsDaylightSavingsFromUtc(DateTime time, int year, TimeSpan utc, AdjustmentRule rule, out bool isAmbiguousLocalDst, TimeZoneInfo zone)
+ private static bool GetIsDaylightSavingsFromUtc(DateTime time, int year, TimeSpan utc, AdjustmentRule rule, int? ruleIndex, out bool isAmbiguousLocalDst, TimeZoneInfo zone)
{
isAmbiguousLocalDst = false;
@@ -1338,7 +1366,7 @@ namespace System
}
// Get the daylight changes for the year of the specified time.
- DaylightTimeStruct daylightTime = zone.GetDaylightTime(year, rule);
+ DaylightTimeStruct daylightTime = zone.GetDaylightTime(year, rule, ruleIndex);
// The start and end times represent the range of universal times that are in DST for that year.
// Within that there is an ambiguous hour, usually right at the end, but at the beginning in
@@ -1352,14 +1380,20 @@ namespace System
// Note we handle the similar case when rule year start with daylight saving and previous year end with daylight saving.
bool ignoreYearAdjustment = false;
- TimeSpan dstStartOffset = zone.GetDaylightSavingsStartOffsetFromUtc(utc, rule);
+ TimeSpan dstStartOffset = zone.GetDaylightSavingsStartOffsetFromUtc(utc, rule, ruleIndex);
DateTime startTime;
if (rule.IsStartDateMarkerForBeginningOfYear() && daylightTime.Start.Year > DateTime.MinValue.Year)
{
- AdjustmentRule previousYearRule = zone.GetAdjustmentRuleForTime(new DateTime(daylightTime.Start.Year - 1, 12, 31));
+ int? previousYearRuleIndex;
+ AdjustmentRule previousYearRule = zone.GetAdjustmentRuleForTime(
+ new DateTime(daylightTime.Start.Year - 1, 12, 31),
+ out previousYearRuleIndex);
if (previousYearRule != null && previousYearRule.IsEndDateMarkerForEndOfYear())
{
- DaylightTimeStruct previousDaylightTime = zone.GetDaylightTime(daylightTime.Start.Year - 1, previousYearRule);
+ DaylightTimeStruct previousDaylightTime = zone.GetDaylightTime(
+ daylightTime.Start.Year - 1,
+ previousYearRule,
+ previousYearRuleIndex);
startTime = previousDaylightTime.Start - utc - previousYearRule.BaseUtcOffsetDelta;
ignoreYearAdjustment = true;
}
@@ -1377,7 +1411,10 @@ namespace System
DateTime endTime;
if (rule.IsEndDateMarkerForEndOfYear() && daylightTime.End.Year < DateTime.MaxValue.Year)
{
- AdjustmentRule nextYearRule = zone.GetAdjustmentRuleForTime(new DateTime(daylightTime.End.Year + 1, 1, 1));
+ int? nextYearRuleIndex;
+ AdjustmentRule nextYearRule = zone.GetAdjustmentRuleForTime(
+ new DateTime(daylightTime.End.Year + 1, 1, 1),
+ out nextYearRuleIndex);
if (nextYearRule != null && nextYearRule.IsStartDateMarkerForBeginningOfYear())
{
if (nextYearRule.IsEndDateMarkerForEndOfYear())
@@ -1387,7 +1424,10 @@ namespace System
}
else
{
- DaylightTimeStruct nextdaylightTime = zone.GetDaylightTime(daylightTime.End.Year + 1, nextYearRule);
+ DaylightTimeStruct nextdaylightTime = zone.GetDaylightTime(
+ daylightTime.End.Year + 1,
+ nextYearRule,
+ nextYearRuleIndex);
endTime = nextdaylightTime.End - utc - nextYearRule.BaseUtcOffsetDelta - nextYearRule.DaylightDelta;
}
ignoreYearAdjustment = true;
@@ -1644,14 +1684,15 @@ namespace System
private static TimeSpan GetUtcOffset(DateTime time, TimeZoneInfo zone, TimeZoneInfoOptions flags)
{
TimeSpan baseOffset = zone.BaseUtcOffset;
- AdjustmentRule rule = zone.GetAdjustmentRuleForTime(time);
+ int? ruleIndex;
+ AdjustmentRule rule = zone.GetAdjustmentRuleForTime(time, out ruleIndex);
if (rule != null)
{
baseOffset = baseOffset + rule.BaseUtcOffsetDelta;
if (rule.HasDaylightSaving)
{
- DaylightTimeStruct daylightTime = zone.GetDaylightTime(time.Year, rule);
+ DaylightTimeStruct daylightTime = zone.GetDaylightTime(time.Year, rule, ruleIndex);
bool isDaylightSavings = GetIsDaylightSavings(time, rule, daylightTime, flags);
baseOffset += (isDaylightSavings ? rule.DaylightDelta : TimeSpan.Zero /* FUTURE: rule.StandardDelta */);
}
@@ -1690,21 +1731,24 @@ namespace System
isAmbiguousLocalDst = false;
TimeSpan baseOffset = zone.BaseUtcOffset;
int year;
+ int? ruleIndex;
AdjustmentRule rule;
if (time > s_maxDateOnly)
{
- rule = zone.GetAdjustmentRuleForTime(DateTime.MaxValue);
+ rule = zone.GetAdjustmentRuleForTime(DateTime.MaxValue, out ruleIndex);
year = 9999;
}
else if (time < s_minDateOnly)
{
- rule = zone.GetAdjustmentRuleForTime(DateTime.MinValue);
+ rule = zone.GetAdjustmentRuleForTime(DateTime.MinValue, out ruleIndex);
year = 1;
}
else
{
- rule = zone.GetAdjustmentRuleForTime(time, dateTimeisUtc: true);
+ rule = zone.GetAdjustmentRuleForTime(time, dateTimeisUtc: true, ruleIndex: out ruleIndex);
+ Debug.Assert(rule == null || ruleIndex.HasValue,
+ "If GetAdjustmentRuleForTime returned an AdjustmentRule, ruleIndex should also be set.");
// As we get the associated rule using the adjusted targetTime, we should use the adjusted year (targetTime.Year) too as after adding the baseOffset,
// sometimes the year value can change if the input datetime was very close to the beginning or the end of the year. Examples of such cases:
@@ -1719,7 +1763,7 @@ namespace System
baseOffset = baseOffset + rule.BaseUtcOffsetDelta;
if (rule.HasDaylightSaving)
{
- isDaylightSavings = GetIsDaylightSavingsFromUtc(time, year, zone._baseUtcOffset, rule, out isAmbiguousLocalDst, zone);
+ isDaylightSavings = GetIsDaylightSavingsFromUtc(time, year, zone._baseUtcOffset, rule, ruleIndex, out isAmbiguousLocalDst, zone);
baseOffset += (isDaylightSavings ? rule.DaylightDelta : TimeSpan.Zero /* FUTURE: rule.StandardDelta */);
}
}
diff --git a/src/pal/CMakeLists.txt b/src/pal/CMakeLists.txt
index 8e3228b622..c687d832df 100644
--- a/src/pal/CMakeLists.txt
+++ b/src/pal/CMakeLists.txt
@@ -2,12 +2,7 @@ cmake_minimum_required(VERSION 2.8.12.2)
project(COREPAL)
-if (WIN32)
- set(FEATURE_EVENT_TRACE 1)
-endif()
-if(CLR_CMAKE_PLATFORM_LINUX AND CLR_CMAKE_TARGET_ARCH_AMD64)
- set(FEATURE_EVENT_TRACE 1)
-endif()
+include(../../clrfeatures.cmake)
include_directories(${COREPAL_SOURCE_DIR}/inc)
include_directories(${COREPAL_SOURCE_DIR}/src)
diff --git a/src/pal/inc/pal.h b/src/pal/inc/pal.h
index 8430ea9899..35c9a51f43 100644
--- a/src/pal/inc/pal.h
+++ b/src/pal/inc/pal.h
@@ -487,9 +487,12 @@ PAL_NotifyRuntimeStarted(VOID);
static const int MAX_DEBUGGER_TRANSPORT_PIPE_NAME_LENGTH = 64;
PALIMPORT
-void
+VOID
PALAPI
-PAL_GetTransportPipeName(char *name, DWORD id, const char *suffix);
+PAL_GetTransportPipeName(
+ OUT char *name,
+ IN DWORD id,
+ IN const char *suffix);
PALIMPORT
void
@@ -1780,8 +1783,6 @@ typedef struct _CONTEXT {
ULONG SegSs;
UCHAR ExtendedRegisters[MAXIMUM_SUPPORTED_EXTENSION];
-
- ULONG ResumeEsp;
} CONTEXT, *PCONTEXT, *LPCONTEXT;
// To support saving and loading xmm register context we need to know the offset in the ExtendedRegisters
@@ -4823,6 +4824,161 @@ RegisterEventSourceW (
#endif // !UNICODE
//
+// NUMA related APIs
+//
+
+typedef enum _PROCESSOR_CACHE_TYPE {
+ CacheUnified,
+ CacheInstruction,
+ CacheData,
+ CacheTrace
+} PROCESSOR_CACHE_TYPE;
+
+typedef struct _PROCESSOR_NUMBER {
+ WORD Group;
+ BYTE Number;
+ BYTE Reserved;
+} PROCESSOR_NUMBER, *PPROCESSOR_NUMBER;
+
+typedef enum _LOGICAL_PROCESSOR_RELATIONSHIP {
+ RelationProcessorCore,
+ RelationNumaNode,
+ RelationCache,
+ RelationProcessorPackage,
+ RelationGroup,
+ RelationAll = 0xffff
+} LOGICAL_PROCESSOR_RELATIONSHIP;
+
+typedef ULONG_PTR KAFFINITY;
+
+#define ANYSIZE_ARRAY 1
+
+typedef struct _GROUP_AFFINITY {
+ KAFFINITY Mask;
+ WORD Group;
+ WORD Reserved[3];
+} GROUP_AFFINITY, *PGROUP_AFFINITY;
+
+typedef struct _PROCESSOR_GROUP_INFO {
+ BYTE MaximumProcessorCount;
+ BYTE ActiveProcessorCount;
+ BYTE Reserved[38];
+ KAFFINITY ActiveProcessorMask;
+} PROCESSOR_GROUP_INFO, *PPROCESSOR_GROUP_INFO;
+
+typedef struct _PROCESSOR_RELATIONSHIP {
+ BYTE Flags;
+ BYTE EfficiencyClass;
+ BYTE Reserved[21];
+ WORD GroupCount;
+ GROUP_AFFINITY GroupMask[ANYSIZE_ARRAY];
+} PROCESSOR_RELATIONSHIP, *PPROCESSOR_RELATIONSHIP;
+
+typedef struct _GROUP_RELATIONSHIP {
+ WORD MaximumGroupCount;
+ WORD ActiveGroupCount;
+ BYTE Reserved[20];
+ PROCESSOR_GROUP_INFO GroupInfo[ANYSIZE_ARRAY];
+} GROUP_RELATIONSHIP, *PGROUP_RELATIONSHIP;
+
+typedef struct _NUMA_NODE_RELATIONSHIP {
+ DWORD NodeNumber;
+ BYTE Reserved[20];
+ GROUP_AFFINITY GroupMask;
+} NUMA_NODE_RELATIONSHIP, *PNUMA_NODE_RELATIONSHIP;
+
+typedef struct _CACHE_RELATIONSHIP {
+ BYTE Level;
+ BYTE Associativity;
+ WORD LineSize;
+ DWORD CacheSize;
+ PROCESSOR_CACHE_TYPE Type;
+ BYTE Reserved[20];
+ GROUP_AFFINITY GroupMask;
+} CACHE_RELATIONSHIP, *PCACHE_RELATIONSHIP;
+
+typedef struct _SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX {
+ LOGICAL_PROCESSOR_RELATIONSHIP Relationship;
+ DWORD Size;
+ union {
+ PROCESSOR_RELATIONSHIP Processor;
+ NUMA_NODE_RELATIONSHIP NumaNode;
+ CACHE_RELATIONSHIP Cache;
+ GROUP_RELATIONSHIP Group;
+ };
+} SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX, *PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX;
+
+
+PALIMPORT
+BOOL
+PALAPI
+GetNumaHighestNodeNumber(
+ OUT PULONG HighestNodeNumber
+);
+
+PALIMPORT
+BOOL
+PALAPI
+GetNumaProcessorNodeEx(
+ IN PPROCESSOR_NUMBER Processor,
+ OUT PUSHORT NodeNumber
+);
+
+PALIMPORT
+LPVOID
+PALAPI
+VirtualAllocExNuma(
+ IN HANDLE hProcess,
+ IN OPTIONAL LPVOID lpAddress,
+ IN SIZE_T dwSize,
+ IN DWORD flAllocationType,
+ IN DWORD flProtect,
+ IN DWORD nndPreferred
+);
+
+PALIMPORT
+BOOL
+PALAPI
+GetLogicalProcessorInformationEx(
+ IN LOGICAL_PROCESSOR_RELATIONSHIP RelationshipType,
+ OUT OPTIONAL PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX Buffer,
+ IN OUT PDWORD ReturnedLength
+);
+
+PALIMPORT
+BOOL
+PALAPI
+SetThreadGroupAffinity(
+ IN HANDLE hThread,
+ IN const GROUP_AFFINITY *GroupAffinity,
+ OUT OPTIONAL PGROUP_AFFINITY PreviousGroupAffinity
+);
+
+PALIMPORT
+BOOL
+PALAPI
+GetThreadGroupAffinity(
+ IN HANDLE hThread,
+ OUT PGROUP_AFFINITY GroupAffinity
+);
+
+PALIMPORT
+VOID
+PALAPI
+GetCurrentProcessorNumberEx(
+ OUT PPROCESSOR_NUMBER ProcNumber
+);
+
+PALIMPORT
+BOOL
+PALAPI
+GetProcessAffinityMask(
+ IN HANDLE hProcess,
+ OUT PDWORD_PTR lpProcessAffinityMask,
+ OUT PDWORD_PTR lpSystemAffinityMask
+);
+
+//
// The types of events that can be logged.
//
#define EVENTLOG_SUCCESS 0x0000
@@ -5145,6 +5301,7 @@ inline WCHAR *PAL_wcsstr(WCHAR *_S, const WCHAR *_P)
}
#endif
+#if !__has_builtin(_rotl)
/*++
Function:
_rotl
@@ -5162,12 +5319,15 @@ unsigned int __cdecl _rotl(unsigned int value, int shift)
retval = (value << shift) | (value >> (sizeof(int) * CHAR_BIT - shift));
return retval;
}
+#endif // !__has_builtin(_rotl)
// On 64 bit unix, make the long an int.
#ifdef BIT64
#define _lrotl _rotl
#endif // BIT64
+#if !__has_builtin(_rotr)
+
/*++
Function:
_rotr
@@ -5186,6 +5346,8 @@ unsigned int __cdecl _rotr(unsigned int value, int shift)
return retval;
}
+#endif // !__has_builtin(_rotr)
+
PALIMPORT int __cdecl abs(int);
#ifndef PAL_STDCPP_COMPAT
PALIMPORT LONG __cdecl labs(LONG);
diff --git a/src/pal/inc/pal_mstypes.h b/src/pal/inc/pal_mstypes.h
index 0ca2871f2b..0aa35ae1e5 100644
--- a/src/pal/inc/pal_mstypes.h
+++ b/src/pal/inc/pal_mstypes.h
@@ -556,7 +556,7 @@ typedef LONG_PTR SSIZE_T, *PSSIZE_T;
#endif
#ifndef SSIZE_T_MIN
-#define SSIZE_T_MIN I64(-9223372036854775808)
+#define SSIZE_T_MIN I64(0x8000000000000000)
#endif
#ifndef PAL_STDCPP_COMPAT
diff --git a/src/pal/inc/rt/intsafe.h b/src/pal/inc/rt/intsafe.h
index 4ed70e7423..6e28175e22 100644
--- a/src/pal/inc/rt/intsafe.h
+++ b/src/pal/inc/rt/intsafe.h
@@ -18,26 +18,6 @@
#include <specstrings.h> // for IN, etc.
-
-#if defined(_AMD64_)
-#ifdef __cplusplus
-extern "C" {
-#endif
-#define UnsignedMultiply128 _umul128
-ULONG64
-UnsignedMultiply128 (
- IN ULONG64 Multiplier,
- IN ULONG64 Multiplicand,
- OUT ULONG64 *HighProduct
- );
-#ifdef _MSC_VER
-#pragma intrinsic(_umul128)
-#endif // _MSC_VER
-#ifdef __cplusplus
-}
-#endif
-#endif // _AMD64_
-
#define INTSAFE_E_ARITHMETIC_OVERFLOW ((HRESULT)0x80070216L) // 0x216 = 534 = ERROR_ARITHMETIC_OVERFLOW
#ifndef LOWORD
@@ -1402,23 +1382,6 @@ UIntMult(
}
//
-// UINT_PTR multiplication
-//
-#ifdef _WIN64
-#define UIntPtrMult ULongLongMult
-#else
-__inline
-HRESULT
-UIntPtrMult(
- IN UINT_PTR ulMultiplicand,
- IN UINT_PTR ulMultiplier,
- OUT UINT_PTR* pulResult)
-{
- return UIntMult((UINT)ulMultiplicand, (UINT)ulMultiplier, (UINT*)pulResult);
-}
-#endif // _WIN64
-
-//
// ULONG multiplication
//
__inline
@@ -1434,24 +1397,6 @@ ULongMult(
}
//
-// ULONG_PTR multiplication
-//
-#ifdef _WIN64
-#define ULongPtrMult ULongLongMult
-#else
-__inline
-HRESULT
-ULongPtrMult(
- IN ULONG_PTR ulMultiplicand,
- IN ULONG_PTR ulMultiplier,
- OUT ULONG_PTR* pulResult)
-{
- return ULongMult((ULONG)ulMultiplicand, (ULONG)ulMultiplier, (ULONG*)pulResult);
-}
-#endif // _WIN64
-
-
-//
// DWORD multiplication
//
#define DWordMult ULongMult
@@ -1461,114 +1406,4 @@ ULongPtrMult(
//
#define DWordPtrMult ULongPtrMult
-//
-// size_t multiplication
-//
-#define SizeTMult UIntPtrMult
-
-//
-// SIZE_T multiplication
-//
-#define SIZETMult ULongPtrMult
-
-//
-// ULONGLONG multiplication
-//
-__inline
-HRESULT
-ULongLongMult(
- IN ULONGLONG ullMultiplicand,
- IN ULONGLONG ullMultiplier,
- OUT ULONGLONG* pullResult)
-{
- HRESULT hr = INTSAFE_E_ARITHMETIC_OVERFLOW;
-#ifdef _AMD64_
- ULONGLONG u64ResultHigh;
- ULONGLONG u64ResultLow;
-
- *pullResult = ULONGLONG_ERROR;
-
- u64ResultLow = UnsignedMultiply128(ullMultiplicand, ullMultiplier, &u64ResultHigh);
- if (u64ResultHigh == 0)
- {
- *pullResult = u64ResultLow;
- hr = S_OK;
- }
-#else
- // 64x64 into 128 is like 32.32 x 32.32.
- //
- // a.b * c.d = a*(c.d) + .b*(c.d) = a*c + a*.d + .b*c + .b*.d
- // back in non-decimal notation where A=a*2^32 and C=c*2^32:
- // A*C + A*d + b*C + b*d
- // So there are four components to add together.
- // result = (a*c*2^64) + (a*d*2^32) + (b*c*2^32) + (b*d)
- //
- // a * c must be 0 or there would be bits in the high 64-bits
- // a * d must be less than 2^32 or there would be bits in the high 64-bits
- // b * c must be less than 2^32 or there would be bits in the high 64-bits
- // then there must be no overflow of the resulting values summed up.
-
- ULONG dw_a;
- ULONG dw_b;
- ULONG dw_c;
- ULONG dw_d;
- ULONGLONG ad = 0;
- ULONGLONG bc = 0;
- ULONGLONG bd = 0;
- ULONGLONG ullResult = 0;
-
- *pullResult = ULONGLONG_ERROR;
-
- dw_a = (ULONG)(ullMultiplicand >> 32);
- dw_c = (ULONG)(ullMultiplier >> 32);
-
- // common case -- if high dwords are both zero, no chance for overflow
- if ((dw_a == 0) && (dw_c == 0))
- {
- dw_b = (DWORD)ullMultiplicand;
- dw_d = (DWORD)ullMultiplier;
-
- *pullResult = (((ULONGLONG)dw_b) * (ULONGLONG)dw_d);
- hr = S_OK;
- }
- else
- {
- // a * c must be 0 or there would be bits set in the high 64-bits
- if ((dw_a == 0) ||
- (dw_c == 0))
- {
- dw_d = (DWORD)ullMultiplier;
-
- // a * d must be less than 2^32 or there would be bits set in the high 64-bits
- ad = (((ULONGLONG)dw_a) * (ULONGLONG)dw_d);
- if ((ad & HIDWORD_MASK) == 0)
- {
- dw_b = (DWORD)ullMultiplicand;
-
- // b * c must be less than 2^32 or there would be bits set in the high 64-bits
- bc = (((ULONGLONG)dw_b) * (ULONGLONG)dw_c);
- if ((bc & HIDWORD_MASK) == 0)
- {
- // now sum them all up checking for overflow.
- // shifting is safe because we already checked for overflow above
- if (SUCCEEDED(ULongLongAdd(bc << 32, ad << 32, &ullResult)))
- {
- // b * d
- bd = (((ULONGLONG)dw_b) * (ULONGLONG)dw_d);
-
- if (SUCCEEDED(ULongLongAdd(ullResult, bd, &ullResult)))
- {
- *pullResult = ullResult;
- hr = S_OK;
- }
- }
- }
- }
- }
- }
-#endif // _AMD64_
-
- return hr;
-}
-
#endif // _INTSAFE_H_INCLUDED_
diff --git a/src/pal/inc/rt/palrt.h b/src/pal/inc/rt/palrt.h
index 51f90b9163..d1c2209d30 100644
--- a/src/pal/inc/rt/palrt.h
+++ b/src/pal/inc/rt/palrt.h
@@ -252,7 +252,7 @@ inline void *__cdecl operator new(size_t, void *_P)
#define STDMETHODCALLTYPE __stdcall
#define STDMETHODVCALLTYPE __cdecl
-#define STDAPICALLTYPE __stdcall
+#define STDAPICALLTYPE __cdecl
#define STDAPIVCALLTYPE __cdecl
#define STDMETHODIMP HRESULT STDMETHODCALLTYPE
diff --git a/src/pal/prebuilt/inc/mscoree.h b/src/pal/prebuilt/inc/mscoree.h
index 12d2172a85..29f7b261d3 100644
--- a/src/pal/prebuilt/inc/mscoree.h
+++ b/src/pal/prebuilt/inc/mscoree.h
@@ -112,8 +112,13 @@ typedef interface ICLRRuntimeHost ICLRRuntimeHost;
#define __ICLRRuntimeHost2_FWD_DEFINED__
typedef interface ICLRRuntimeHost2 ICLRRuntimeHost2;
-#endif /* __ICLRRuntimeHost2_FWD_DEFINED__ */
+#endif /* __ICLRRuntimeHost4_FWD_DEFINED__ */
+#ifndef __ICLRRuntimeHost4_FWD_DEFINED__
+#define __ICLRRuntimeHost4_FWD_DEFINED__
+typedef interface ICLRRuntimeHost4 ICLRRuntimeHost4;
+
+#endif /* __ICLRRuntimeHost4_FWD_DEFINED__ */
#ifndef __ICLRExecutionManager_FWD_DEFINED__
#define __ICLRExecutionManager_FWD_DEFINED__
@@ -254,6 +259,7 @@ EXTERN_GUID(IID_ICLRErrorReportingManager, 0x980d2f1a, 0xbf79, 0x4c08, 0x81, 0x2
EXTERN_GUID(IID_ICLRErrorReportingManager2, 0xc68f63b1, 0x4d8b, 0x4e0b, 0x95, 0x64, 0x9d, 0x2e, 0xfe, 0x2f, 0xa1, 0x8c);
EXTERN_GUID(IID_ICLRRuntimeHost, 0x90F1A06C, 0x7712, 0x4762, 0x86, 0xB5, 0x7A, 0x5E, 0xBA, 0x6B, 0xDB, 0x02);
EXTERN_GUID(IID_ICLRRuntimeHost2, 0x712AB73F, 0x2C22, 0x4807, 0xAD, 0x7E, 0xF5, 0x01, 0xD7, 0xb7, 0x2C, 0x2D);
+EXTERN_GUID(IID_ICLRRuntimeHost4, 0x64F6D366, 0xD7C2, 0x4F1F, 0xB4, 0xB2, 0xE8, 0x16, 0x0C, 0xAC, 0x43, 0xAF);
EXTERN_GUID(IID_ICLRExecutionManager, 0x1000A3E7, 0xB420, 0x4620, 0xAE, 0x30, 0xFB, 0x19, 0xB5, 0x87, 0xAD, 0x1D);
EXTERN_GUID(IID_ITypeName, 0xB81FF171, 0x20F3, 0x11d2, 0x8d, 0xcc, 0x00, 0xa0, 0xc9, 0xb0, 0x05, 0x22);
EXTERN_GUID(IID_ITypeNameBuilder, 0xB81FF171, 0x20F3, 0x11d2, 0x8d, 0xcc, 0x00, 0xa0, 0xc9, 0xb0, 0x05, 0x23);
@@ -1819,6 +1825,14 @@ EXTERN_C const IID IID_ICLRRuntimeHost2;
};
+ MIDL_INTERFACE("64F6D366-D7C2-4F1F-B4B2-E8160CAC43AF")
+ ICLRRuntimeHost4 : public ICLRRuntimeHost2
+ {
+ virtual HRESULT STDMETHODCALLTYPE UnloadAppDomain2(
+ /* [in] */ DWORD dwAppDomainId,
+ /* [in] */ BOOL fWaitUntilDone,
+ /* [out] */ int *pLatchedExitCode) = 0;
+ };
#else /* C style interface */
diff --git a/src/pal/src/CMakeLists.txt b/src/pal/src/CMakeLists.txt
index 5314cdf86b..145c2c9ed9 100644
--- a/src/pal/src/CMakeLists.txt
+++ b/src/pal/src/CMakeLists.txt
@@ -181,6 +181,7 @@ set(SOURCES
misc/sysinfo.cpp
misc/time.cpp
misc/utils.cpp
+ numa/numa.cpp
objmgr/palobjbase.cpp
objmgr/shmobject.cpp
objmgr/shmobjectmanager.cpp
@@ -372,6 +373,12 @@ if(CMAKE_SYSTEM_NAME STREQUAL NetBSD)
)
endif(CMAKE_SYSTEM_NAME STREQUAL NetBSD)
+if(HAVE_NUMA_H)
+ target_link_libraries(coreclrpal
+ numa
+ )
+endif(HAVE_NUMA_H)
+
add_subdirectory(examples)
if(FEATURE_EVENT_TRACE)
diff --git a/src/pal/src/arch/amd64/processor.cpp b/src/pal/src/arch/amd64/processor.cpp
index 298d685c98..0ab7992286 100644
--- a/src/pal/src/arch/amd64/processor.cpp
+++ b/src/pal/src/arch/amd64/processor.cpp
@@ -65,7 +65,7 @@ extern "C" unsigned int XmmYmmStateSupport()
"end:\n" \
: "=a"(eax) /* output in eax */ \
: /* no inputs */ \
- : "eax", "ebx", "ecx", "edx" /* registers that are clobbered */
+ : "ebx", "ecx", "edx" /* registers that are clobbered */
);
// Check OS has enabled both XMM and YMM state support
return ((eax & 0x06) == 0x06) ? 1 : 0;
diff --git a/src/pal/src/arch/i386/asmconstants.h b/src/pal/src/arch/i386/asmconstants.h
index d947cb8bcd..ff763ef16b 100644
--- a/src/pal/src/arch/i386/asmconstants.h
+++ b/src/pal/src/arch/i386/asmconstants.h
@@ -28,4 +28,3 @@
#define CONTEXT_Xmm5 CONTEXT_Xmm4+16
#define CONTEXT_Xmm6 CONTEXT_Xmm5+16
#define CONTEXT_Xmm7 CONTEXT_Xmm6+16
-#define CONTEXT_ResumeEsp CONTEXT_ExtendedRegisters+512
diff --git a/src/pal/src/arch/i386/context2.S b/src/pal/src/arch/i386/context2.S
index 6c31b074cc..cf7581da49 100644
--- a/src/pal/src/arch/i386/context2.S
+++ b/src/pal/src/arch/i386/context2.S
@@ -42,7 +42,6 @@ LEAF_ENTRY CONTEXT_CaptureContext, _TEXT
mov [eax + CONTEXT_Ebp], ebp
lea ebx, [esp + 12]
mov [eax + CONTEXT_Esp], ebx
- mov [eax + CONTEXT_ResumeEsp], ebx
mov ebx, [esp + 8]
mov [eax + CONTEXT_Eip], ebx
@@ -115,7 +114,7 @@ LOCAL_LABEL(Done_Restore_CONTEXT_FLOATING_POINT):
LOCAL_LABEL(Done_Restore_CONTEXT_EXTENDED_REGISTERS):
// Restore Stack
- mov esp, [eax + CONTEXT_ResumeEsp]
+ mov esp, [eax + CONTEXT_Esp]
// Create a minimal frame
push DWORD PTR [eax + CONTEXT_Eip]
diff --git a/src/pal/src/arch/i386/exceptionhelper.S b/src/pal/src/arch/i386/exceptionhelper.S
index bf44124479..b9ceffcc13 100644
--- a/src/pal/src/arch/i386/exceptionhelper.S
+++ b/src/pal/src/arch/i386/exceptionhelper.S
@@ -23,7 +23,7 @@ LEAF_ENTRY ThrowExceptionFromContextInternal, _TEXT
mov eax, [esp + 8] // ebx: CONTEXT *
mov ebp, [eax + CONTEXT_Ebp]
- mov esp, [eax + CONTEXT_ResumeEsp]
+ mov esp, [eax + CONTEXT_Esp]
mov ebx, [eax + CONTEXT_Ebx]
mov esi, [eax + CONTEXT_Esi]
mov edi, [eax + CONTEXT_Edi]
diff --git a/src/pal/src/arch/i386/signalhandlerhelper.cpp b/src/pal/src/arch/i386/signalhandlerhelper.cpp
index 3369abe093..a7d418a788 100644
--- a/src/pal/src/arch/i386/signalhandlerhelper.cpp
+++ b/src/pal/src/arch/i386/signalhandlerhelper.cpp
@@ -70,7 +70,6 @@ void ExecuteHandlerOnOriginalStack(int code, siginfo_t *siginfo, void *context,
// We don't care about the other registers state since the stack unwinding restores
// them for the target frame directly from the signal context.
context2.Esp = (size_t)sp;
- context2.ResumeEsp = (size_t)sp;
context2.Ebp = (size_t)fp;
context2.Eip = (size_t)signal_handler_worker;
diff --git a/src/pal/src/config.h.in b/src/pal/src/config.h.in
index ab5fa0341d..7f37f42222 100644
--- a/src/pal/src/config.h.in
+++ b/src/pal/src/config.h.in
@@ -20,6 +20,9 @@
#cmakedefine01 HAVE_RUNETYPE_H
#cmakedefine01 HAVE_SYS_SYSCTL_H
#cmakedefine01 HAVE_GNU_LIBNAMES_H
+#cmakedefine01 HAVE_PRCTL_H
+#cmakedefine01 HAVE_NUMA_H
+#cmakedefine01 HAVE_PTHREAD_NP_H
#cmakedefine01 HAVE_KQUEUE
#cmakedefine01 HAVE_GETPWUID_R
@@ -32,6 +35,8 @@
#cmakedefine01 HAVE_PTHREAD_GETATTR_NP
#cmakedefine01 HAVE_PTHREAD_GETCPUCLOCKID
#cmakedefine01 HAVE_PTHREAD_SIGQUEUE
+#cmakedefine01 HAVE_PTHREAD_GETAFFINITY_NP
+#cmakedefine01 HAVE_CPUSET_T
#cmakedefine01 HAVE_SIGRETURN
#cmakedefine01 HAVE__THREAD_SYS_SIGRETURN
#cmakedefine01 HAVE_COPYSIGN
@@ -56,6 +61,7 @@
#cmakedefine01 HAS_SYSV_SEMAPHORES
#cmakedefine01 HAS_PTHREAD_MUTEXES
#cmakedefine01 HAVE_TTRACE
+#cmakedefine01 HAVE_SCHED_GETAFFINITY
#cmakedefine HAVE_UNW_GET_SAVE_LOC
#cmakedefine HAVE_UNW_GET_ACCESSORS
#cmakedefine01 HAVE_XSWDEV
@@ -97,6 +103,7 @@
#cmakedefine01 HAVE_CLOCK_MONOTONIC_COARSE
#cmakedefine01 HAVE_MACH_ABSOLUTE_TIME
#cmakedefine01 HAVE_CLOCK_THREAD_CPUTIME
+#cmakedefine01 HAVE_PTHREAD_CONDATTR_SETCLOCK
#cmakedefine01 STATVFS64_PROTOTYPE_BROKEN
#cmakedefine01 HAVE_MMAP_DEV_ZERO
#cmakedefine01 MMAP_ANON_IGNORES_PROTECTION
diff --git a/src/pal/src/configure.cmake b/src/pal/src/configure.cmake
index 4d78f54423..b5b98d5b2d 100644
--- a/src/pal/src/configure.cmake
+++ b/src/pal/src/configure.cmake
@@ -34,6 +34,9 @@ check_include_files(lwp.h HAVE_LWP_H)
check_include_files(libunwind.h HAVE_LIBUNWIND_H)
check_include_files(runetype.h HAVE_RUNETYPE_H)
check_include_files(semaphore.h HAVE_SEMAPHORE_H)
+check_include_files(sys/prctl.h HAVE_PRCTL_H)
+check_include_files(numa.h HAVE_NUMA_H)
+check_include_files(pthread_np.h HAVE_PTHREAD_NP_H)
if(NOT CMAKE_SYSTEM_NAME STREQUAL FreeBSD AND NOT CMAKE_SYSTEM_NAME STREQUAL NetBSD)
set(CMAKE_REQUIRED_FLAGS "-ldl")
@@ -68,6 +71,7 @@ check_library_exists(${PTHREAD_LIBRARY} pthread_attr_get_np "" HAVE_PTHREAD_ATTR
check_library_exists(${PTHREAD_LIBRARY} pthread_getattr_np "" HAVE_PTHREAD_GETATTR_NP)
check_library_exists(${PTHREAD_LIBRARY} pthread_getcpuclockid "" HAVE_PTHREAD_GETCPUCLOCKID)
check_library_exists(${PTHREAD_LIBRARY} pthread_sigqueue "" HAVE_PTHREAD_SIGQUEUE)
+check_library_exists(${PTHREAD_LIBRARY} pthread_getaffinity_np "" HAVE_PTHREAD_GETAFFINITY_NP)
check_function_exists(sigreturn HAVE_SIGRETURN)
check_function_exists(_thread_sys_sigreturn HAVE__THREAD_SYS_SIGRETURN)
@@ -118,6 +122,14 @@ int main(int argc, char **argv) {
}" HAVE_UNW_GET_ACCESSORS)
set(CMAKE_REQUIRED_LIBRARIES)
+check_cxx_source_compiles("
+#include <pthread_np.h>
+int main(int argc, char **argv) {
+ cpuset_t cpuSet;
+
+ return 0;
+}" HAVE_CPUSET_T)
+
check_struct_has_member ("struct stat" st_atimespec "sys/types.h;sys/stat.h" HAVE_STAT_TIMESPEC)
check_struct_has_member ("struct stat" st_atimensec "sys/types.h;sys/stat.h" HAVE_STAT_NSEC)
check_struct_has_member ("struct tm" tm_gmtoff time.h HAVE_TM_GMTOFF)
@@ -405,6 +417,9 @@ int main()
exit(ret);
}" HAVE_CLOCK_MONOTONIC)
+
+check_library_exists(pthread pthread_condattr_setclock "" HAVE_PTHREAD_CONDATTR_SETCLOCK)
+
check_cxx_source_runs("
#include <stdlib.h>
#include <time.h>
diff --git a/src/pal/src/exception/seh-unwind.cpp b/src/pal/src/exception/seh-unwind.cpp
index 1f20ee0cad..ba43c2e725 100644
--- a/src/pal/src/exception/seh-unwind.cpp
+++ b/src/pal/src/exception/seh-unwind.cpp
@@ -155,7 +155,6 @@ static void UnwindContextToWinContext(unw_cursor_t *cursor, CONTEXT *winContext)
#elif defined(_X86_)
unw_get_reg(cursor, UNW_REG_IP, (unw_word_t *) &winContext->Eip);
unw_get_reg(cursor, UNW_REG_SP, (unw_word_t *) &winContext->Esp);
- unw_get_reg(cursor, UNW_REG_SP, (unw_word_t *) &winContext->ResumeEsp);
unw_get_reg(cursor, UNW_X86_EBP, (unw_word_t *) &winContext->Ebp);
unw_get_reg(cursor, UNW_X86_EBX, (unw_word_t *) &winContext->Ebx);
unw_get_reg(cursor, UNW_X86_ESI, (unw_word_t *) &winContext->Esi);
diff --git a/src/pal/src/file/disk.cpp b/src/pal/src/file/disk.cpp
index 08880c9c20..e5d6f831dd 100644
--- a/src/pal/src/file/disk.cpp
+++ b/src/pal/src/file/disk.cpp
@@ -68,6 +68,7 @@ GetDiskFreeSpaceW(
PathCharString dirNameBufferPathString;
size_t length;
char * dirNameBuffer;
+ const char * dirName;
int size;
PERF_ENTRY(GetDiskFreeSpaceW);
@@ -125,7 +126,7 @@ GetDiskFreeSpaceW(
if ( size != 0 )
{
FILEDosToUnixPathA( dirNameBuffer );
- statfsRetVal = statfs( dirNameBuffer, &fsInfoBuffer );
+ dirName = dirNameBuffer;
}
else
{
@@ -136,9 +137,11 @@ GetDiskFreeSpaceW(
}
else
{
- statfsRetVal = statfs( "/", &fsInfoBuffer );
+ dirName = "/";
}
+ statfsRetVal = statfs( dirName, &fsInfoBuffer );
+
if ( statfsRetVal == 0 )
{
*lpBytesPerSector = fsInfoBuffer.f_bsize;
diff --git a/src/pal/src/file/file.cpp b/src/pal/src/file/file.cpp
index d70e62bd52..a4ad20db32 100644
--- a/src/pal/src/file/file.cpp
+++ b/src/pal/src/file/file.cpp
@@ -2999,8 +2999,11 @@ OUT PLARGE_INTEGER lpFileSize)
&dwFileSizeHigh
);
- lpFileSize->u.LowPart = dwFileSizeLow;
- lpFileSize->u.HighPart = dwFileSizeHigh;
+ if (NO_ERROR == palError)
+ {
+ lpFileSize->u.LowPart = dwFileSizeLow;
+ lpFileSize->u.HighPart = dwFileSizeHigh;
+ }
}
else
{
diff --git a/src/pal/src/include/pal/dbgmsg.h b/src/pal/src/include/pal/dbgmsg.h
index 7a49fc0ad6..052c6fa775 100644
--- a/src/pal/src/include/pal/dbgmsg.h
+++ b/src/pal/src/include/pal/dbgmsg.h
@@ -194,7 +194,7 @@ typedef enum
#ifdef FEATURE_PAL_SXS
DCI_SXS,
#endif // FEATURE_PAL_SXS
-
+ DCI_NUMA,
DCI_LAST
} DBG_CHANNEL_ID;
diff --git a/src/pal/src/include/pal/numa.h b/src/pal/src/include/pal/numa.h
new file mode 100644
index 0000000000..4fb2308a7d
--- /dev/null
+++ b/src/pal/src/include/pal/numa.h
@@ -0,0 +1,39 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/*++
+
+
+
+Module Name:
+
+ include/pal/numa.h
+
+Abstract:
+
+ Header file for the NUMA functions.
+
+
+
+--*/
+
+#ifndef _PAL_NUMA_H_
+#define _PAL_NUMA_H_
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif // __cplusplus
+
+BOOL
+NUMASupportInitialize();
+
+VOID
+NUMASupportCleanup();
+
+#ifdef __cplusplus
+}
+#endif // __cplusplus
+
+#endif /* _PAL_CRITSECT_H_ */
diff --git a/src/pal/src/include/pal/process.h b/src/pal/src/include/pal/process.h
index 990aec5b21..63ef5c52ec 100644
--- a/src/pal/src/include/pal/process.h
+++ b/src/pal/src/include/pal/process.h
@@ -121,6 +121,21 @@ Abstract
VOID PROCProcessUnlock(VOID);
/*++
+Function
+ PROCAbortInitialize()
+
+Abstract
+ Initialize the process abort crash dump program file path and
+ name. Doing all of this ahead of time so nothing is allocated
+ or copied in PROCAbort/signal handler.
+
+Return
+ TRUE - succeeds, FALSE - fails
+
+--*/
+BOOL PROCAbortInitialize();
+
+/*++
Function:
PROCAbort()
@@ -130,7 +145,7 @@ Function:
Does not return
--*/
PAL_NORETURN
-void PROCAbort();
+VOID PROCAbort();
/*++
Function:
@@ -141,7 +156,7 @@ Function:
(no return value)
--*/
-void PROCNotifyProcessShutdown();
+VOID PROCNotifyProcessShutdown();
/*++
Function:
diff --git a/src/pal/src/init/pal.cpp b/src/pal/src/init/pal.cpp
index fa94922325..2fdafe4f8c 100644
--- a/src/pal/src/init/pal.cpp
+++ b/src/pal/src/init/pal.cpp
@@ -42,6 +42,7 @@ SET_DEFAULT_DEBUG_CHANNEL(PAL); // some headers have code with asserts, so do th
#include "pal/debug.h"
#include "pal/locale.h"
#include "pal/init.h"
+#include "pal/numa.h"
#include "pal/stackstring.hpp"
#if HAVE_MACH_EXCEPTIONS
@@ -523,6 +524,12 @@ Initialize(
goto CLEANUP15;
}
+ if (FALSE == NUMASupportInitialize())
+ {
+ ERROR("Unable to initialize NUMA support\n");
+ goto CLEANUP15;
+ }
+
TRACE("First-time PAL initialization complete.\n");
init_count++;
@@ -548,6 +555,7 @@ Initialize(
}
goto done;
+ NUMASupportCleanup();
/* No cleanup required for CRTInitStdStreams */
CLEANUP15:
FILECleanupStdHandles();
@@ -650,6 +658,12 @@ PAL_InitializeCoreCLR(const char *szExePath)
return ERROR_DLL_INIT_FAILED;
}
+ if (!PROCAbortInitialize())
+ {
+ printf("PROCAbortInitialize FAILED %d (%s)\n", errno, strerror(errno));
+ return ERROR_GEN_FAILURE;
+ }
+
if (!InitializeFlushProcessWriteBuffers())
{
return ERROR_GEN_FAILURE;
diff --git a/src/pal/src/map/map.cpp b/src/pal/src/map/map.cpp
index f3ec47b846..5fdb6fda38 100644
--- a/src/pal/src/map/map.cpp
+++ b/src/pal/src/map/map.cpp
@@ -44,6 +44,13 @@ using namespace CorUnix;
SET_DEFAULT_DEBUG_CHANNEL(VIRTUAL);
+#include "pal/utils.h"
+
+// This is temporary until #10981 merges.
+// There will be an equivalent but opposite temporary fix in #10981 which
+// will trigger a merge conflict to be sure both of these workarounds are removed
+#define GetVirtualPageSize() VIRTUAL_PAGE_SIZE
+
//
// The mapping critical section guards access to the list
// of currently mapped views. If a thread needs to access
@@ -2012,14 +2019,14 @@ BOOL MAPGetRegionInfo(LPVOID lpAddress,
real_map_sz = pView->NumberOfBytesToMap;
#endif
- MappedSize = ((real_map_sz-1) & ~VIRTUAL_PAGE_MASK) + VIRTUAL_PAGE_SIZE;
+ MappedSize = ALIGN_UP(real_map_sz, GetVirtualPageSize());
if ( real_map_addr <= lpAddress &&
(VOID *)((UINT_PTR)real_map_addr+MappedSize) > lpAddress )
{
if (lpBuffer)
{
- SIZE_T regionSize = MappedSize + (UINT_PTR) real_map_addr -
- ((UINT_PTR) lpAddress & ~VIRTUAL_PAGE_MASK);
+ SIZE_T regionSize = MappedSize + (UINT_PTR) real_map_addr -
+ ALIGN_DOWN((UINT_PTR)lpAddress, GetVirtualPageSize());
lpBuffer->BaseAddress = lpAddress;
lpBuffer->AllocationProtect = 0;
@@ -2241,7 +2248,9 @@ MAPmmapAndRecord(
PAL_ERROR palError = NO_ERROR;
LPVOID pvBaseAddress = NULL;
- pvBaseAddress = mmap(addr, len, prot, flags, fd, offset);
+ off_t adjust = offset & (GetVirtualPageSize() - 1);
+
+ pvBaseAddress = mmap(static_cast<char *>(addr) - adjust, len + adjust, prot, flags, fd, offset - adjust);
if (MAP_FAILED == pvBaseAddress)
{
ERROR_(LOADER)( "mmap failed with code %d: %s.\n", errno, strerror( errno ) );
@@ -2368,14 +2377,6 @@ void * MAPMapPEFile(HANDLE hFile)
goto done;
}
- //this code requires that the file alignment be the same as the page alignment
- if (ntHeader.OptionalHeader.FileAlignment < VIRTUAL_PAGE_SIZE)
- {
- ERROR_(LOADER)( "Optional header file alignment is bad\n" );
- palError = ERROR_INVALID_PARAMETER;
- goto done;
- }
-
//This doesn't read the entire NT header (the optional header technically has a variable length. But I
//don't need more directories.
@@ -2416,7 +2417,7 @@ void * MAPMapPEFile(HANDLE hFile)
{
//if we're forcing relocs, create an anonymous mapping at the preferred base. Only create the
//mapping if we can create it at the specified address.
- pForceRelocBase = mmap( (void*)preferredBase, VIRTUAL_PAGE_SIZE, PROT_NONE, MAP_ANON|MAP_FIXED|MAP_PRIVATE, -1, 0 );
+ pForceRelocBase = mmap( (void*)preferredBase, GetVirtualPageSize(), PROT_NONE, MAP_ANON|MAP_FIXED|MAP_PRIVATE, -1, 0 );
if (pForceRelocBase == MAP_FAILED)
{
TRACE_(LOADER)("Attempt to take preferred base of %p to force relocation failed\n", (void*)preferredBase);
@@ -2445,7 +2446,7 @@ void * MAPMapPEFile(HANDLE hFile)
// First try to reserve virtual memory using ExecutableAllcator. This allows all PE images to be
// near each other and close to the coreclr library which also allows the runtime to generate
// more efficient code (by avoiding usage of jump stubs).
- loadedBase = ReserveMemoryFromExecutableAllocator(pThread, virtualSize);
+ loadedBase = ReserveMemoryFromExecutableAllocator(pThread, ALIGN_UP(virtualSize, GetVirtualPageSize()));
if (loadedBase == NULL)
{
// MAC64 requires we pass MAP_SHARED (or MAP_PRIVATE) flags - otherwise, the call is failed.
@@ -2468,7 +2469,7 @@ void * MAPMapPEFile(HANDLE hFile)
if (forceRelocs)
{
_ASSERTE(((SIZE_T)loadedBase) != preferredBase);
- munmap(pForceRelocBase, VIRTUAL_PAGE_SIZE); // now that we've forced relocation, let the original address mapping go
+ munmap(pForceRelocBase, GetVirtualPageSize()); // now that we've forced relocation, let the original address mapping go
}
if (((SIZE_T)loadedBase) != preferredBase)
{
@@ -2484,7 +2485,7 @@ void * MAPMapPEFile(HANDLE hFile)
//separately.
size_t headerSize;
- headerSize = VIRTUAL_PAGE_SIZE; // if there are lots of sections, this could be wrong
+ headerSize = GetVirtualPageSize(); // if there are lots of sections, this could be wrong
//first, map the PE header to the first page in the image. Get pointers to the section headers
palError = MAPmmapAndRecord(pFileObject, loadedBase,
@@ -2519,10 +2520,8 @@ void * MAPMapPEFile(HANDLE hFile)
goto doneReleaseMappingCriticalSection;
}
- void* prevSectionBase;
- prevSectionBase = loadedBase; // the first "section" for our purposes is the header
- size_t prevSectionSizeInMemory;
- prevSectionSizeInMemory = headerSize;
+ void* prevSectionEnd;
+ prevSectionEnd = (char*)loadedBase + headerSize; // the first "section" for our purposes is the header
for (unsigned i = 0; i < numSections; ++i)
{
//for each section, map the section of the file to the correct virtual offset. Gather the
@@ -2532,12 +2531,13 @@ void * MAPMapPEFile(HANDLE hFile)
IMAGE_SECTION_HEADER &currentHeader = firstSection[i];
void* sectionBase = (char*)loadedBase + currentHeader.VirtualAddress;
+ void* sectionBaseAligned = ALIGN_DOWN(sectionBase, GetVirtualPageSize());
// Validate the section header
if ( (sectionBase < loadedBase) // Did computing the section base overflow?
|| ((char*)sectionBase + currentHeader.SizeOfRawData < (char*)sectionBase) // Does the section overflow?
|| ((char*)sectionBase + currentHeader.SizeOfRawData > (char*)loadedBase + virtualSize) // Does the section extend past the end of the image as the header stated?
- || ((char*)prevSectionBase + prevSectionSizeInMemory > sectionBase) // Does this section overlap the previous one?
+ || (prevSectionEnd > sectionBase) // Does this section overlap the previous one?
)
{
ERROR_(LOADER)( "section %d is corrupt\n", i );
@@ -2552,13 +2552,12 @@ void * MAPMapPEFile(HANDLE hFile)
}
// Is there space between the previous section and this one? If so, add a PROT_NONE mapping to cover it.
- if ((char*)prevSectionBase + prevSectionSizeInMemory < sectionBase)
+ if (prevSectionEnd < sectionBaseAligned)
{
- char* gapBase = (char*)prevSectionBase + prevSectionSizeInMemory;
palError = MAPRecordMapping(pFileObject,
loadedBase,
- (void*)gapBase,
- (char*)sectionBase - gapBase,
+ prevSectionEnd,
+ (char*)sectionBaseAligned - (char*)prevSectionEnd,
PROT_NONE);
if (NO_ERROR != palError)
{
@@ -2602,20 +2601,18 @@ void * MAPMapPEFile(HANDLE hFile)
}
#endif // _DEBUG
- prevSectionBase = sectionBase;
- prevSectionSizeInMemory = (currentHeader.SizeOfRawData + VIRTUAL_PAGE_MASK) & ~VIRTUAL_PAGE_MASK; // round up to page boundary
+ prevSectionEnd = ALIGN_UP((char*)sectionBase + currentHeader.SizeOfRawData, GetVirtualPageSize()); // round up to page boundary
}
// Is there space after the last section and before the end of the mapped image? If so, add a PROT_NONE mapping to cover it.
char* imageEnd;
imageEnd = (char*)loadedBase + virtualSize; // actually, points just after the mapped end
- if ((char*)prevSectionBase + prevSectionSizeInMemory < imageEnd)
+ if (prevSectionEnd < imageEnd)
{
- char* gapBase = (char*)prevSectionBase + prevSectionSizeInMemory;
palError = MAPRecordMapping(pFileObject,
loadedBase,
- (void*)gapBase,
- imageEnd - gapBase,
+ prevSectionEnd,
+ (char*)imageEnd - (char*)prevSectionEnd,
PROT_NONE);
if (NO_ERROR != palError)
{
diff --git a/src/pal/src/map/virtual.cpp b/src/pal/src/map/virtual.cpp
index 4a55de9891..7e00843b7a 100644
--- a/src/pal/src/map/virtual.cpp
+++ b/src/pal/src/map/virtual.cpp
@@ -92,6 +92,7 @@ namespace VirtualMemoryLogging
Commit = 0x30,
Decommit = 0x40,
Release = 0x50,
+ Reset = 0x60,
};
// Indicates that the attempted operation has failed
@@ -810,6 +811,58 @@ static BOOL VIRTUALStoreAllocationInfo(
/******
*
+ * VIRTUALResetMemory() - Helper function that resets the memory
+ *
+ *
+ */
+static LPVOID VIRTUALResetMemory(
+ IN CPalThread *pthrCurrent, /* Currently executing thread */
+ IN LPVOID lpAddress, /* Region to reserve or commit */
+ IN SIZE_T dwSize) /* Size of Region */
+{
+ LPVOID pRetVal = NULL;
+ UINT_PTR StartBoundary;
+ SIZE_T MemSize;
+
+ TRACE( "Resetting the memory now..\n");
+
+ StartBoundary = (UINT_PTR)lpAddress & ~VIRTUAL_PAGE_MASK;
+ // Add the sizes, and round down to the nearest page boundary.
+ MemSize = ( ((UINT_PTR)lpAddress + dwSize + VIRTUAL_PAGE_MASK) & ~VIRTUAL_PAGE_MASK ) -
+ StartBoundary;
+
+ int st;
+#if HAVE_MADV_FREE
+ // Try to use MADV_FREE if supported. It tells the kernel that the application doesn't
+ // need the pages in the range. Freeing the pages can be delayed until a memory pressure
+ // occurs.
+ st = madvise((LPVOID)StartBoundary, MemSize, MADV_FREE);
+ if (st != 0)
+#endif
+ {
+ // In case the MADV_FREE is not supported, use MADV_DONTNEED
+ st = madvise((LPVOID)StartBoundary, MemSize, MADV_DONTNEED);
+ }
+
+ if (st == 0)
+ {
+ pRetVal = lpAddress;
+ }
+
+ LogVaOperation(
+ VirtualMemoryLogging::VirtualOperation::Reset,
+ lpAddress,
+ dwSize,
+ 0,
+ 0,
+ pRetVal,
+ pRetVal != NULL);
+
+ return pRetVal;
+}
+
+/******
+ *
* VIRTUALReserveMemory() - Helper function that actually reserves the memory.
*
* NOTE: I call SetLastError in here, because many different error states
@@ -837,8 +890,6 @@ static LPVOID VIRTUALReserveMemory(
MemSize = ( ((UINT_PTR)lpAddress + dwSize + VIRTUAL_PAGE_MASK) & ~VIRTUAL_PAGE_MASK ) -
StartBoundary;
- InternalEnterCriticalSection(pthrCurrent, &virtual_critsec);
-
// If this is a request for special executable (JIT'ed) memory then, first of all,
// try to get memory from the executable memory allocator to satisfy the request.
if (((flAllocationType & MEM_RESERVE_EXECUTABLE) != 0) && (lpAddress == NULL))
@@ -881,7 +932,6 @@ static LPVOID VIRTUALReserveMemory(
pRetVal,
pRetVal != NULL);
- InternalLeaveCriticalSection(pthrCurrent, &virtual_critsec);
return pRetVal;
}
@@ -1211,7 +1261,7 @@ VirtualAlloc(
}
/* Test for un-supported flags. */
- if ( ( flAllocationType & ~( MEM_COMMIT | MEM_RESERVE | MEM_TOP_DOWN | MEM_RESERVE_EXECUTABLE ) ) != 0 )
+ if ( ( flAllocationType & ~( MEM_COMMIT | MEM_RESERVE | MEM_RESET | MEM_TOP_DOWN | MEM_RESERVE_EXECUTABLE ) ) != 0 )
{
ASSERT( "flAllocationType can be one, or any combination of MEM_COMMIT, \
MEM_RESERVE, MEM_TOP_DOWN, or MEM_RESERVE_EXECUTABLE.\n" );
@@ -1240,6 +1290,26 @@ VirtualAlloc(
NULL,
TRUE);
+ if ( flAllocationType & MEM_RESET )
+ {
+ if ( flAllocationType != MEM_RESET )
+ {
+ ASSERT( "MEM_RESET cannot be used with any other allocation flags in flAllocationType.\n" );
+ pthrCurrent->SetLastError( ERROR_INVALID_PARAMETER );
+ goto done;
+ }
+
+ InternalEnterCriticalSection(pthrCurrent, &virtual_critsec);
+ pRetVal = VIRTUALResetMemory( pthrCurrent, lpAddress, dwSize );
+ InternalLeaveCriticalSection(pthrCurrent, &virtual_critsec);
+
+ if ( !pRetVal )
+ {
+ /* Error messages are already displayed, just leave. */
+ goto done;
+ }
+ }
+
if ( flAllocationType & MEM_RESERVE )
{
InternalEnterCriticalSection(pthrCurrent, &virtual_critsec);
@@ -1280,7 +1350,6 @@ done:
return pRetVal;
}
-
/*++
Function:
VirtualFree
diff --git a/src/pal/src/misc/sysinfo.cpp b/src/pal/src/misc/sysinfo.cpp
index fff051818f..70fe3e65d2 100644
--- a/src/pal/src/misc/sysinfo.cpp
+++ b/src/pal/src/misc/sysinfo.cpp
@@ -94,6 +94,39 @@ SET_DEFAULT_DEBUG_CHANNEL(MISC);
#endif
#endif // __APPLE__
+/*++
+Function:
+ GetNumberOfProcessors
+
+Return number of processors available for the current process
+--*/
+int GetNumberOfProcessors()
+{
+ int nrcpus = 0;
+
+#if HAVE_SYSCONF
+ nrcpus = sysconf(_SC_NPROCESSORS_ONLN);
+ if (nrcpus < 1)
+ {
+ ASSERT("sysconf failed for _SC_NPROCESSORS_ONLN (%d)\n", errno);
+ }
+#elif HAVE_SYSCTL
+ int rc;
+ size_t sz;
+ int mib[2];
+
+ sz = sizeof(nrcpus);
+ mib[0] = CTL_HW;
+ mib[1] = HW_NCPU;
+ rc = sysctl(mib, 2, &nrcpus, &sz, NULL, 0);
+ if (rc != 0)
+ {
+ ASSERT("sysctl failed for HW_NCPU (%d)\n", errno);
+ }
+#endif // HAVE_SYSCONF
+
+ return nrcpus;
+}
/*++
Function:
@@ -137,27 +170,7 @@ GetSystemInfo(
lpSystemInfo->dwPageSize = pagesize;
lpSystemInfo->dwActiveProcessorMask_PAL_Undefined = 0;
-#if HAVE_SYSCONF
- nrcpus = sysconf(_SC_NPROCESSORS_ONLN);
- if (nrcpus < 1)
- {
- ASSERT("sysconf failed for _SC_NPROCESSORS_ONLN (%d)\n", errno);
- }
-#elif HAVE_SYSCTL
- int rc;
- size_t sz;
- int mib[2];
-
- sz = sizeof(nrcpus);
- mib[0] = CTL_HW;
- mib[1] = HW_NCPU;
- rc = sysctl(mib, 2, &nrcpus, &sz, NULL, 0);
- if (rc != 0)
- {
- ASSERT("sysctl failed for HW_NCPU (%d)\n", errno);
- }
-#endif // HAVE_SYSCONF
-
+ nrcpus = GetNumberOfProcessors();
TRACE("dwNumberOfProcessors=%d\n", nrcpus);
lpSystemInfo->dwNumberOfProcessors = nrcpus;
diff --git a/src/pal/src/numa/numa.cpp b/src/pal/src/numa/numa.cpp
new file mode 100644
index 0000000000..549c10a71f
--- /dev/null
+++ b/src/pal/src/numa/numa.cpp
@@ -0,0 +1,692 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/*++
+
+
+
+Module Name:
+
+ numa.cpp
+
+Abstract:
+
+ Implementation of NUMA related APIs
+
+--*/
+
+#include "pal/dbgmsg.h"
+SET_DEFAULT_DEBUG_CHANNEL(NUMA);
+
+#include "pal/palinternal.h"
+#include "pal/dbgmsg.h"
+#include "pal/numa.h"
+#include "pal/corunix.hpp"
+#include "pal/thread.hpp"
+
+#if HAVE_NUMA_H
+#include <numa.h>
+#include <numaif.h>
+#endif
+
+#if HAVE_PTHREAD_NP_H
+#include <pthread_np.h>
+#endif
+
+#include <pthread.h>
+
+using namespace CorUnix;
+
+#if HAVE_CPUSET_T
+typedef cpuset_t cpu_set_t;
+#endif
+
+int GetNumberOfProcessors();
+
+// CPU affinity descriptor
+struct CpuAffinity
+{
+ // NUMA node
+ BYTE Node;
+ // CPU number relative to the group the CPU is in
+ BYTE Number;
+ // CPU group
+ WORD Group;
+};
+
+// Array mapping global CPU index to its affinity
+CpuAffinity *g_cpuToAffinity = NULL;
+
+// Array mapping CPU group and index in the group to the global CPU index
+short *g_groupAndIndexToCpu = NULL;
+// Array mapping CPU group to the corresponding affinity mask of the CPUs in the group
+KAFFINITY *g_groupToCpuMask = NULL;
+// Array mapping CPU group to the number of processors in the group
+BYTE *g_groupToCpuCount = NULL;
+
+// Total number of processors in the system
+int g_cpuCount = 0;
+// Total number of CPU groups
+int g_groupCount = 0;
+// The highest NUMA node available
+int g_highestNumaNode = 0;
+
+static const int MaxCpusPerGroup = 8 * sizeof(KAFFINITY);
+static const WORD NO_GROUP = 0xffff;
+
+/*++
+Function:
+ AllocateLookupArrays
+
+Allocate CPU and group lookup arrays
+--*/
+VOID
+AllocateLookupArrays()
+{
+ g_groupAndIndexToCpu = (short*)malloc(g_groupCount * MaxCpusPerGroup * sizeof(short));
+ g_cpuToAffinity = (CpuAffinity*)malloc(g_cpuCount * sizeof(CpuAffinity));
+ g_groupToCpuMask = (KAFFINITY*)malloc(g_groupCount * sizeof(KAFFINITY));
+ g_groupToCpuCount = (BYTE*)malloc(g_groupCount * sizeof(BYTE));
+
+ memset(g_groupAndIndexToCpu, 0xff, g_groupCount * MaxCpusPerGroup * sizeof(short));
+ memset(g_cpuToAffinity, 0xff, g_cpuCount * sizeof(CpuAffinity));
+ memset(g_groupToCpuMask, 0, g_groupCount * sizeof(KAFFINITY));
+ memset(g_groupToCpuCount, 0, g_groupCount * sizeof(BYTE));
+}
+
+/*++
+Function:
+ FreeLookupArrays
+
+Free CPU and group lookup arrays
+--*/
+VOID
+FreeLookupArrays()
+{
+ free(g_groupAndIndexToCpu);
+ free(g_cpuToAffinity);
+ free(g_groupToCpuMask);
+ free(g_groupToCpuCount);
+
+ g_groupAndIndexToCpu = NULL;
+ g_cpuToAffinity = NULL;
+ g_groupToCpuMask = NULL;
+ g_groupToCpuCount = NULL;
+}
+
+/*++
+Function:
+ GetFullAffinityMask
+
+Get affinity mask for the specified number of processors with all
+the processors enabled.
+--*/
+KAFFINITY GetFullAffinityMask(int cpuCount)
+{
+ return ((KAFFINITY)1 << (cpuCount)) - 1;
+}
+
+/*++
+Function:
+ NUMASupportInitialize
+
+Initialize data structures for getting and setting thread affinities to processors and
+querying NUMA related processor information.
+On systems with no NUMA support, it behaves as if there was a single NUMA node with
+a single group of processors.
+--*/
+BOOL
+NUMASupportInitialize()
+{
+#if HAVE_NUMA_H
+ if (numa_available() != -1)
+ {
+ struct bitmask *mask = numa_allocate_cpumask();
+ int numaNodesCount = numa_max_node() + 1;
+
+ g_cpuCount = numa_num_possible_cpus();
+ g_groupCount = 0;
+
+ for (int i = 0; i < numaNodesCount; i++)
+ {
+ int st = numa_node_to_cpus(i, mask);
+ // The only failure that can happen is that the mask is not large enough
+ // but that cannot happen since the mask was allocated by numa_allocate_cpumask
+ _ASSERTE(st == 0);
+ unsigned int nodeCpuCount = numa_bitmask_weight(mask);
+ unsigned int nodeGroupCount = (nodeCpuCount + MaxCpusPerGroup - 1) / MaxCpusPerGroup;
+ g_groupCount += nodeGroupCount;
+ }
+
+ AllocateLookupArrays();
+
+ WORD currentGroup = 0;
+ int currentGroupCpus = 0;
+
+ for (int i = 0; i < numaNodesCount; i++)
+ {
+ int st = numa_node_to_cpus(i, mask);
+ // The only failure that can happen is that the mask is not large enough
+ // but that cannot happen since the mask was allocated by numa_allocate_cpumask
+ _ASSERTE(st == 0);
+ unsigned int nodeCpuCount = numa_bitmask_weight(mask);
+ unsigned int nodeGroupCount = (nodeCpuCount + MaxCpusPerGroup - 1) / MaxCpusPerGroup;
+ for (int j = 0; j < g_cpuCount; j++)
+ {
+ if (numa_bitmask_isbitset(mask, j))
+ {
+ if (currentGroupCpus == MaxCpusPerGroup)
+ {
+ g_groupToCpuCount[currentGroup] = MaxCpusPerGroup;
+ g_groupToCpuMask[currentGroup] = GetFullAffinityMask(MaxCpusPerGroup);
+ currentGroupCpus = 0;
+ currentGroup++;
+ }
+ g_cpuToAffinity[j].Node = i;
+ g_cpuToAffinity[j].Group = currentGroup;
+ g_cpuToAffinity[j].Number = currentGroupCpus;
+ g_groupAndIndexToCpu[currentGroup * MaxCpusPerGroup + currentGroupCpus] = j;
+ currentGroupCpus++;
+ }
+ }
+
+ if (currentGroupCpus != 0)
+ {
+ g_groupToCpuCount[currentGroup] = currentGroupCpus;
+ g_groupToCpuMask[currentGroup] = GetFullAffinityMask(currentGroupCpus);
+ currentGroupCpus = 0;
+ currentGroup++;
+ }
+ }
+
+ numa_free_cpumask(mask);
+
+ g_highestNumaNode = numa_max_node();
+ }
+ else
+#endif // HAVE_NUMA_H
+ {
+ // No NUMA
+ g_cpuCount = GetNumberOfProcessors();
+ g_groupCount = 1;
+ g_highestNumaNode = 0;
+
+ AllocateLookupArrays();
+ }
+
+ return TRUE;
+}
+
+/*++
+Function:
+ NUMASupportCleanup
+
+Cleanup of the NUMA support data structures
+--*/
+VOID
+NUMASupportCleanup()
+{
+ FreeLookupArrays();
+}
+
+/*++
+Function:
+ GetNumaHighestNodeNumber
+
+See MSDN doc.
+--*/
+BOOL
+PALAPI
+GetNumaHighestNodeNumber(
+ OUT PULONG HighestNodeNumber
+)
+{
+ PERF_ENTRY(GetNumaHighestNodeNumber);
+ ENTRY("GetNumaHighestNodeNumber(HighestNodeNumber=%p)\n", HighestNodeNumber);
+ *HighestNodeNumber = (ULONG)g_highestNumaNode;
+
+ BOOL success = TRUE;
+
+ LOGEXIT("GetNumaHighestNodeNumber returns BOOL %d\n", success);
+ PERF_EXIT(GetNumaHighestNodeNumber);
+
+ return success;
+}
+
+/*++
+Function:
+ GetNumaProcessorNodeEx
+
+See MSDN doc.
+--*/
+BOOL
+PALAPI
+GetNumaProcessorNodeEx(
+ IN PPROCESSOR_NUMBER Processor,
+ OUT PUSHORT NodeNumber
+)
+{
+ PERF_ENTRY(GetNumaProcessorNodeEx);
+ ENTRY("GetNumaProcessorNodeEx(Processor=%p, NodeNumber=%p)\n", Processor, NodeNumber);
+
+ BOOL success = FALSE;
+
+ if ((Processor->Group < g_groupCount) &&
+ (Processor->Number < MaxCpusPerGroup) &&
+ (Processor->Reserved == 0))
+ {
+ short cpu = g_groupAndIndexToCpu[Processor->Group * MaxCpusPerGroup + Processor->Number];
+ if (cpu != -1)
+ {
+ *NodeNumber = g_cpuToAffinity[cpu].Node;
+ success = TRUE;
+ }
+ }
+
+ if (!success)
+ {
+ *NodeNumber = 0xffff;
+ SetLastError(ERROR_INVALID_PARAMETER);
+ }
+
+ LOGEXIT("GetNumaProcessorNodeEx returns BOOL %d\n", success);
+ PERF_EXIT(GetNumaProcessorNodeEx);
+
+ return success;
+}
+
+/*++
+Function:
+ GetLogicalProcessorInformationEx
+
+See MSDN doc.
+--*/
+BOOL
+PALAPI
+GetLogicalProcessorInformationEx(
+ IN LOGICAL_PROCESSOR_RELATIONSHIP RelationshipType,
+ OUT OPTIONAL PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX Buffer,
+ IN OUT PDWORD ReturnedLength
+)
+{
+ PERF_ENTRY(GetLogicalProcessorInformationEx);
+ ENTRY("GetLogicalProcessorInformationEx(RelationshipType=%d, Buffer=%p, ReturnedLength=%p)\n", RelationshipType, Buffer, ReturnedLength);
+
+ BOOL success = FALSE;
+
+ if (RelationshipType == RelationGroup)
+ {
+ size_t requiredSize = __builtin_offsetof(SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX, Group);
+ requiredSize += __builtin_offsetof(GROUP_RELATIONSHIP, GroupInfo);
+ requiredSize += g_groupCount * sizeof(PROCESSOR_GROUP_INFO);
+
+ if (*ReturnedLength >= requiredSize)
+ {
+ Buffer->Relationship = RelationGroup;
+ Buffer->Size = requiredSize;
+ Buffer->Group.MaximumGroupCount = g_groupCount;
+ Buffer->Group.ActiveGroupCount = g_groupCount;
+ for (int i = 0; i < g_groupCount; i++)
+ {
+ Buffer->Group.GroupInfo[i].MaximumProcessorCount = MaxCpusPerGroup;
+ Buffer->Group.GroupInfo[i].ActiveProcessorCount = g_groupToCpuCount[i];
+ Buffer->Group.GroupInfo[i].ActiveProcessorMask = g_groupToCpuMask[i];
+ }
+
+ success = TRUE;
+ }
+ else
+ {
+ SetLastError(ERROR_INSUFFICIENT_BUFFER);
+ }
+
+ *ReturnedLength = requiredSize;
+ }
+ else
+ {
+ // We only support the group relationship
+ SetLastError(ERROR_INVALID_PARAMETER);
+ }
+
+ LOGEXIT("GetLogicalProcessorInformationEx returns BOOL %d\n", success);
+ PERF_EXIT(GetLogicalProcessorInformationEx);
+
+ return success;
+}
+
+/*++
+Function:
+ GetThreadGroupAffinityInternal
+
+Get the group affinity for the specified pthread
+--*/
+BOOL
+GetThreadGroupAffinityInternal(
+ IN pthread_t thread,
+ OUT PGROUP_AFFINITY GroupAffinity
+)
+{
+ BOOL success = FALSE;
+
+#if HAVE_PTHREAD_GETAFFINITY_NP
+ cpu_set_t cpuSet;
+
+ int st = pthread_getaffinity_np(thread, sizeof(cpu_set_t), &cpuSet);
+
+ if (st == 0)
+ {
+ WORD group = NO_GROUP;
+ KAFFINITY mask = 0;
+
+ for (int i = 0; i < g_cpuCount; i++)
+ {
+ if (CPU_ISSET(i, &cpuSet))
+ {
+ WORD g = g_cpuToAffinity[i].Group;
+ // Unless the thread affinity was already set by SetThreadGroupAffinity, it is possible that
+ // the current thread has affinity with processors from multiple groups. So we report just the
+ // first group we find.
+ if (group == NO_GROUP || g == group)
+ {
+ group = g;
+ mask |= ((KAFFINITY)1) << g_cpuToAffinity[i].Number;
+ }
+ }
+ }
+
+ GroupAffinity->Group = group;
+ GroupAffinity->Mask = mask;
+ success = TRUE;
+ }
+ else
+ {
+ SetLastError(ERROR_GEN_FAILURE);
+ }
+#else // HAVE_PTHREAD_GETAFFINITY_NP
+ // There is no API to manage thread affinity, so let's return a group affinity
+ // with all the CPUs on the system.
+ GroupAffinity->Group = 0;
+ GroupAffinity->Mask = GetFullAffinityMask(g_cpuCount);
+ success = TRUE;
+#endif // HAVE_PTHREAD_GETAFFINITY_NP
+
+ return success;
+}
+
+/*++
+Function:
+ GetThreadGroupAffinity
+
+See MSDN doc.
+--*/
+BOOL
+PALAPI
+GetThreadGroupAffinity(
+ IN HANDLE hThread,
+ OUT PGROUP_AFFINITY GroupAffinity
+)
+{
+ PERF_ENTRY(GetThreadGroupAffinity);
+ ENTRY("GetThreadGroupAffinity(hThread=%p, GroupAffinity=%p)\n", hThread, GroupAffinity);
+
+ CPalThread *palThread = InternalGetCurrentThread();
+
+ BOOL success = GetThreadGroupAffinityInternal(palThread->GetPThreadSelf(), GroupAffinity);
+
+ LOGEXIT("GetThreadGroupAffinity returns BOOL %d\n", success);
+ PERF_EXIT(GetThreadGroupAffinity);
+
+ return success;
+}
+
+
+/*++
+Function:
+ SetThreadGroupAffinity
+
+See MSDN doc.
+--*/
+BOOL
+PALAPI
+SetThreadGroupAffinity(
+ IN HANDLE hThread,
+ IN const GROUP_AFFINITY *GroupAffinity,
+ OUT OPTIONAL PGROUP_AFFINITY PreviousGroupAffinity
+)
+{
+ PERF_ENTRY(SetThreadGroupAffinity);
+ ENTRY("SetThreadGroupAffinity(hThread=%p, GroupAffinity=%p, PreviousGroupAffinity=%p)\n", hThread, GroupAffinity, PreviousGroupAffinity);
+
+ CPalThread *palThread = InternalGetCurrentThread();
+
+ pthread_t thread = palThread->GetPThreadSelf();
+
+ if (PreviousGroupAffinity != NULL)
+ {
+ GetThreadGroupAffinityInternal(thread, PreviousGroupAffinity);
+ }
+
+#if HAVE_PTHREAD_GETAFFINITY_NP
+ int groupStartIndex = GroupAffinity->Group * MaxCpusPerGroup;
+ KAFFINITY mask = 1;
+ cpu_set_t cpuSet;
+ CPU_ZERO(&cpuSet);
+
+ for (int i = 0; i < MaxCpusPerGroup; i++, mask <<= 1)
+ {
+ if (GroupAffinity->Mask & mask)
+ {
+ int cpu = g_groupAndIndexToCpu[groupStartIndex + i];
+ if (cpu != -1)
+ {
+ CPU_SET(cpu, &cpuSet);
+ }
+ }
+ }
+
+ int st = pthread_setaffinity_np(thread, sizeof(cpu_set_t), &cpuSet);
+
+ if (st == -1)
+ {
+ switch (errno)
+ {
+ case EINVAL:
+ // There is no processor in the mask that is allowed to execute the process
+ SetLastError(ERROR_INVALID_PARAMETER);
+ break;
+ case EPERM:
+ SetLastError(ERROR_ACCESS_DENIED);
+ break;
+ default:
+ SetLastError(ERROR_GEN_FAILURE);
+ break;
+ }
+ }
+
+ BOOL success = (st == 0);
+#else // HAVE_PTHREAD_GETAFFINITY_NP
+ // There is no API to manage thread affinity, so let's ignore the request
+ BOOL success = TRUE;
+#endif // HAVE_PTHREAD_GETAFFINITY_NP
+
+ LOGEXIT("SetThreadGroupAffinity returns BOOL %d\n", success);
+ PERF_EXIT(SetThreadGroupAffinity);
+
+ return success;
+}
+
+/*++
+Function:
+ GetCurrentProcessorNumberEx
+
+See MSDN doc.
+--*/
+VOID
+PALAPI
+GetCurrentProcessorNumberEx(
+ OUT PPROCESSOR_NUMBER ProcNumber
+)
+{
+ PERF_ENTRY(GetCurrentProcessorNumberEx);
+ ENTRY("GetCurrentProcessorNumberEx(ProcNumber=%p\n", ProcNumber);
+
+ DWORD cpu = GetCurrentProcessorNumber();
+ _ASSERTE(cpu < g_cpuCount);
+ ProcNumber->Group = g_cpuToAffinity[cpu].Group;
+ ProcNumber->Number = g_cpuToAffinity[cpu].Number;
+
+ LOGEXIT("GetCurrentProcessorNumberEx\n");
+ PERF_EXIT(GetCurrentProcessorNumberEx);
+}
+
+/*++
+Function:
+ GetProcessAffinityMask
+
+See MSDN doc.
+--*/
+BOOL
+PALAPI
+GetProcessAffinityMask(
+ IN HANDLE hProcess,
+ OUT PDWORD_PTR lpProcessAffinityMask,
+ OUT PDWORD_PTR lpSystemAffinityMask
+)
+{
+ PERF_ENTRY(GetProcessAffinityMask);
+ ENTRY("GetProcessAffinityMask(hProcess=%p, lpProcessAffinityMask=%p, lpSystemAffinityMask=%p\n", hProcess, lpProcessAffinityMask, lpSystemAffinityMask);
+
+ BOOL success = FALSE;
+
+ if (hProcess == GetCurrentProcess())
+ {
+ DWORD_PTR systemMask = GetFullAffinityMask(g_cpuCount);
+
+#if HAVE_SCHED_GETAFFINITY
+ int pid = getpid();
+ cpu_set_t cpuSet;
+ int st = sched_getaffinity(pid, sizeof(cpu_set_t), &cpuSet);
+ if (st == 0)
+ {
+ WORD group = NO_GROUP;
+ DWORD_PTR processMask = 0;
+
+ for (int i = 0; i < g_cpuCount; i++)
+ {
+ if (CPU_ISSET(i, &cpuSet))
+ {
+ WORD g = g_cpuToAffinity[i].Group;
+ if (group == NO_GROUP || g == group)
+ {
+ group = g;
+ processMask |= ((DWORD_PTR)1) << g_cpuToAffinity[i].Number;
+ }
+ else
+ {
+ // The process has affinity in more than one group, in such case
+ // the function needs to return zero in both masks.
+ processMask = 0;
+ systemMask = 0;
+ group = NO_GROUP;
+ break;
+ }
+ }
+ }
+
+ success = TRUE;
+
+ *lpProcessAffinityMask = processMask;
+ *lpSystemAffinityMask = systemMask;
+ }
+ else
+ {
+ // We should not get any of the errors that the sched_getaffinity can return since none
+ // of them applies for the current thread, so this is an unexpected kind of failure.
+ SetLastError(ERROR_GEN_FAILURE);
+ }
+#else // HAVE_SCHED_GETAFFINITY
+ // There is no API to manage thread affinity, so let's return both affinity masks
+ // with all the CPUs on the system set.
+ *lpSystemAffinityMask = systemMask;
+ *lpProcessAffinityMask = systemMask;
+
+ success = TRUE;
+#endif // HAVE_SCHED_GETAFFINITY
+ }
+ else
+ {
+ // PAL supports getting affinity mask for the current process only
+ SetLastError(ERROR_INVALID_PARAMETER);
+ }
+
+ LOGEXIT("GetProcessAffinityMask returns BOOL %d\n", success);
+ PERF_EXIT(GetProcessAffinityMask);
+
+ return success;
+}
+
+/*++
+Function:
+ VirtualAllocExNuma
+
+See MSDN doc.
+--*/
+LPVOID
+PALAPI
+VirtualAllocExNuma(
+ IN HANDLE hProcess,
+ IN OPTIONAL LPVOID lpAddress,
+ IN SIZE_T dwSize,
+ IN DWORD flAllocationType,
+ IN DWORD flProtect,
+ IN DWORD nndPreferred
+)
+{
+ PERF_ENTRY(VirtualAllocExNuma);
+ ENTRY("VirtualAllocExNuma(hProcess=%p, lpAddress=%p, dwSize=%u, flAllocationType=%#x, flProtect=%#x, nndPreferred=%d\n",
+ hProcess, lpAddress, dwSize, flAllocationType, flProtect, nndPreferred);
+
+ LPVOID result = NULL;
+
+ if (hProcess == GetCurrentProcess())
+ {
+ if (nndPreferred <= g_highestNumaNode)
+ {
+ result = VirtualAlloc(lpAddress, dwSize, flAllocationType, flProtect);
+#if HAVE_NUMA_H
+ if (result != NULL)
+ {
+ int nodeMaskLength = (g_highestNumaNode + 1 + sizeof(unsigned long) - 1) / sizeof(unsigned long);
+ unsigned long *nodeMask = new unsigned long[nodeMaskLength];
+
+ memset(nodeMask, 0, nodeMaskLength);
+
+ int index = nndPreferred / sizeof(unsigned long);
+ int mask = ((unsigned long)1) << (nndPreferred & (sizeof(unsigned long) - 1));
+ nodeMask[index] = mask;
+
+ int st = mbind(result, dwSize, MPOL_PREFERRED, nodeMask, g_highestNumaNode, 0);
+ free(nodeMask);
+ _ASSERTE(st == 0);
+ // If the mbind fails, we still return the allocated memory since the nndPreferred is just a hint
+ }
+#endif // HAVE_NUMA_H
+ }
+ else
+ {
+ // The specified node number is larger than the maximum available one
+ SetLastError(ERROR_INVALID_PARAMETER);
+ }
+ }
+ else
+ {
+ // PAL supports allocating from the current process virtual space only
+ SetLastError(ERROR_INVALID_PARAMETER);
+ }
+
+ LOGEXIT("VirtualAllocExNuma returns %p\n", result);
+ PERF_EXIT(VirtualAllocExNuma);
+
+ return result;
+}
diff --git a/src/pal/src/synchmgr/synchmanager.cpp b/src/pal/src/synchmgr/synchmanager.cpp
index 3aec140474..d836a177bb 100644
--- a/src/pal/src/synchmgr/synchmanager.cpp
+++ b/src/pal/src/synchmgr/synchmanager.cpp
@@ -450,7 +450,7 @@ namespace CorUnix
if (dwTimeout != INFINITE)
{
// Calculate absolute timeout
- palErr = GetAbsoluteTimeout(dwTimeout, &tsAbsTmo);
+ palErr = GetAbsoluteTimeout(dwTimeout, &tsAbsTmo, /*fPreferMonotonicClock*/ TRUE);
if (NO_ERROR != palErr)
{
ERROR("Failed to convert timeout to absolute timeout\n");
@@ -1572,7 +1572,7 @@ namespace CorUnix
ptnwdWorkerThreadNativeData =
&pSynchManager->m_pthrWorker->synchronizationInfo.m_tnwdNativeData;
- palErr = GetAbsoluteTimeout(WorkerThreadTerminationTimeout, &tsAbsTmo);
+ palErr = GetAbsoluteTimeout(WorkerThreadTerminationTimeout, &tsAbsTmo, /*fPreferMonotonicClock*/ TRUE);
if (NO_ERROR != palErr)
{
ERROR("Failed to convert timeout to absolute timeout\n");
@@ -4078,6 +4078,9 @@ namespace CorUnix
int iRet;
const int MaxUnavailableResourceRetries = 10;
int iEagains;
+ pthread_condattr_t attrs;
+ pthread_condattr_t *attrsPtr = nullptr;
+
m_shridWaitAwakened = RawSharedObjectAlloc(sizeof(DWORD),
DefaultSharedPool);
if (NULLSharedID == m_shridWaitAwakened)
@@ -4096,6 +4099,36 @@ namespace CorUnix
VolatileStore<DWORD>(pdwWaitState, TWS_ACTIVE);
m_tsThreadState = TS_STARTING;
+#if HAVE_CLOCK_MONOTONIC && HAVE_PTHREAD_CONDATTR_SETCLOCK
+ attrsPtr = &attrs;
+ iRet = pthread_condattr_init(&attrs);
+ if (0 != iRet)
+ {
+ ERROR("Failed to initialize thread synchronization condition attribute "
+ "[error=%d (%s)]\n", iRet, strerror(iRet));
+ if (ENOMEM == iRet)
+ {
+ palErr = ERROR_NOT_ENOUGH_MEMORY;
+ }
+ else
+ {
+ palErr = ERROR_INTERNAL_ERROR;
+ }
+ goto IPrC_exit;
+ }
+
+ // Ensure that the pthread_cond_timedwait will use CLOCK_MONOTONIC
+ iRet = pthread_condattr_setclock(&attrs, CLOCK_MONOTONIC);
+ if (0 != iRet)
+ {
+ ERROR("Failed set thread synchronization condition timed wait clock "
+ "[error=%d (%s)]\n", iRet, strerror(iRet));
+ palErr = ERROR_INTERNAL_ERROR;
+ pthread_condattr_destroy(&attrs);
+ goto IPrC_exit;
+ }
+#endif // HAVE_CLOCK_MONOTONIC && HAVE_PTHREAD_CONDATTR_SETCLOCK
+
iEagains = 0;
Mutex_retry:
iRet = pthread_mutex_init(&m_tnwdNativeData.mutex, NULL);
@@ -4121,7 +4154,9 @@ namespace CorUnix
iEagains = 0;
Cond_retry:
- iRet = pthread_cond_init(&m_tnwdNativeData.cond, NULL);
+
+ iRet = pthread_cond_init(&m_tnwdNativeData.cond, attrsPtr);
+
if (0 != iRet)
{
ERROR("Failed creating thread synchronization condition "
@@ -4146,6 +4181,10 @@ namespace CorUnix
m_tnwdNativeData.fInitialized = true;
IPrC_exit:
+ if (attrsPtr != nullptr)
+ {
+ pthread_condattr_destroy(attrsPtr);
+ }
if (NO_ERROR != palErr)
{
m_tsThreadState = TS_FAILED;
@@ -4515,27 +4554,37 @@ namespace CorUnix
Converts a relative timeout to an absolute one.
--*/
- PAL_ERROR CPalSynchronizationManager::GetAbsoluteTimeout(DWORD dwTimeout, struct timespec * ptsAbsTmo)
+ PAL_ERROR CPalSynchronizationManager::GetAbsoluteTimeout(DWORD dwTimeout, struct timespec * ptsAbsTmo, BOOL fPreferMonotonicClock)
{
PAL_ERROR palErr = NO_ERROR;
int iRet;
-#if HAVE_WORKING_CLOCK_GETTIME
- // Not every platform implements a (working) clock_gettime
- iRet = clock_gettime(CLOCK_REALTIME, ptsAbsTmo);
-#elif HAVE_WORKING_GETTIMEOFDAY
- // Not every platform implements a (working) gettimeofday
- struct timeval tv;
- iRet = gettimeofday(&tv, NULL);
- if (0 == iRet)
+#if HAVE_CLOCK_MONOTONIC && HAVE_PTHREAD_CONDATTR_SETCLOCK
+ if (fPreferMonotonicClock)
{
- ptsAbsTmo->tv_sec = tv.tv_sec;
- ptsAbsTmo->tv_nsec = tv.tv_usec * tccMicroSecondsToNanoSeconds;
+ iRet = clock_gettime(CLOCK_MONOTONIC, ptsAbsTmo);
}
+ else
+ {
+#endif
+#if HAVE_WORKING_CLOCK_GETTIME
+ // Not every platform implements a (working) clock_gettime
+ iRet = clock_gettime(CLOCK_REALTIME, ptsAbsTmo);
+#elif HAVE_WORKING_GETTIMEOFDAY
+ // Not every platform implements a (working) gettimeofday
+ struct timeval tv;
+ iRet = gettimeofday(&tv, NULL);
+ if (0 == iRet)
+ {
+ ptsAbsTmo->tv_sec = tv.tv_sec;
+ ptsAbsTmo->tv_nsec = tv.tv_usec * tccMicroSecondsToNanoSeconds;
+ }
#else
- #error "Don't know how to get hi-res current time on this platform"
+ #error "Don't know how to get hi-res current time on this platform"
#endif // HAVE_WORKING_CLOCK_GETTIME, HAVE_WORKING_GETTIMEOFDAY
-
+#if HAVE_CLOCK_MONOTONIC && HAVE_PTHREAD_CONDATTR_SETCLOCK
+ }
+#endif
if (0 == iRet)
{
ptsAbsTmo->tv_sec += dwTimeout / tccSecondsToMillieSeconds;
diff --git a/src/pal/src/synchmgr/synchmanager.hpp b/src/pal/src/synchmgr/synchmanager.hpp
index fdef82e936..883d5b8b61 100644
--- a/src/pal/src/synchmgr/synchmanager.hpp
+++ b/src/pal/src/synchmgr/synchmanager.hpp
@@ -1015,7 +1015,8 @@ namespace CorUnix
static PAL_ERROR GetAbsoluteTimeout(
DWORD dwTimeout,
- struct timespec * ptsAbsTmo);
+ struct timespec * ptsAbsTmo,
+ BOOL fPreferMonotonicClock);
};
}
diff --git a/src/pal/src/synchobj/mutex.cpp b/src/pal/src/synchobj/mutex.cpp
index d929eaa472..692f5e2ade 100644
--- a/src/pal/src/synchobj/mutex.cpp
+++ b/src/pal/src/synchobj/mutex.cpp
@@ -859,7 +859,7 @@ MutexTryAcquireLockResult MutexHelpers::TryAcquireLock(pthread_mutex_t *mutex, D
default:
{
struct timespec timeoutTime;
- PAL_ERROR palError = CPalSynchronizationManager::GetAbsoluteTimeout(timeoutMilliseconds, &timeoutTime);
+ PAL_ERROR palError = CPalSynchronizationManager::GetAbsoluteTimeout(timeoutMilliseconds, &timeoutTime, /*fPreferMonotonicClock*/ FALSE);
_ASSERTE(palError == NO_ERROR);
lockResult = pthread_mutex_timedlock(mutex, &timeoutTime);
break;
diff --git a/src/pal/src/thread/context.cpp b/src/pal/src/thread/context.cpp
index 04a6fe5aaf..cc794d5f69 100644
--- a/src/pal/src/thread/context.cpp
+++ b/src/pal/src/thread/context.cpp
@@ -506,8 +506,6 @@ void CONTEXTFromNativeContext(const native_context_t *native, LPCONTEXT lpContex
// although the pc value retrived from native context might not have set the least bit.
// This becomes especially problematic if the context is on the JIT_WRITEBARRIER.
lpContext->Pc |= 0x1;
-#elif defined(_X86_)
- lpContext->ResumeEsp = MCREG_Esp(native->uc_mcontext);
#endif
}
@@ -978,7 +976,6 @@ CONTEXT_GetThreadContextFromThreadState(
lpContext->Esi = pState->esi;
lpContext->Ebp = pState->ebp;
lpContext->Esp = pState->esp;
- lpContext->ResumeEsp = pState->esp;
lpContext->SegSs = pState->ss;
lpContext->EFlags = pState->eflags;
lpContext->Eip = pState->eip;
diff --git a/src/pal/src/thread/process.cpp b/src/pal/src/thread/process.cpp
index 050665ce7c..2a93d3c57d 100644
--- a/src/pal/src/thread/process.cpp
+++ b/src/pal/src/thread/process.cpp
@@ -49,12 +49,17 @@ SET_DEFAULT_DEBUG_CHANNEL(PROCESS); // some headers have code with asserts, so d
#include <sys/types.h>
#include <sys/stat.h>
#include <signal.h>
+#if HAVE_PRCTL_H
+#include <sys/prctl.h>
+#include <sys/syscall.h>
+#endif
#include <sys/wait.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <debugmacrosext.h>
#include <semaphore.h>
#include <stdint.h>
+#include <dlfcn.h>
#ifdef __APPLE__
#include <sys/sysctl.h>
@@ -67,6 +72,8 @@ SET_DEFAULT_DEBUG_CHANNEL(PROCESS); // some headers have code with asserts, so d
#include <kvm.h>
#endif
+extern char *g_szCoreCLRPath;
+
using namespace CorUnix;
CObjectType CorUnix::otProcess(
@@ -87,18 +94,6 @@ CObjectType CorUnix::otProcess(
CObjectType::NoOwner
);
-static
-DWORD
-PALAPI
-StartupHelperThread(
- LPVOID p);
-
-static
-BOOL
-GetProcessIdDisambiguationKey(
- IN DWORD processId,
- OUT UINT64 *disambiguationKey);
-
//
// Helper memory page used by the FlushProcessWriteBuffers
//
@@ -153,6 +148,9 @@ DWORD gSID = (DWORD) -1;
// Function to call during PAL/process shutdown/abort
Volatile<PSHUTDOWN_CALLBACK> g_shutdownCallback = nullptr;
+// Crash dump generating program arguments. Initialized in PROCAbortInitialize().
+char* g_argvCreateDump[8] = { nullptr };
+
//
// Key used for associating CPalThread's with the underlying pthread
// (through pthread_setspecific)
@@ -172,22 +170,30 @@ enum FILETYPE
FILE_DIR /*Directory*/
};
+static
+DWORD
+PALAPI
+StartupHelperThread(
+ LPVOID p);
+
+static
+BOOL
+GetProcessIdDisambiguationKey(
+ IN DWORD processId,
+ OUT UINT64 *disambiguationKey);
+
PAL_ERROR
PROCGetProcessStatus(
CPalThread *pThread,
HANDLE hProcess,
PROCESS_STATE *pps,
- DWORD *pdwExitCode
- );
+ DWORD *pdwExitCode);
-static BOOL getFileName(LPCWSTR lpApplicationName, LPWSTR lpCommandLine,
- PathCharString& lpFileName);
-static char ** buildArgv(LPCWSTR lpCommandLine, PathCharString& lpAppPath,
- UINT *pnArg, BOOL prependLoader);
+static BOOL getFileName(LPCWSTR lpApplicationName, LPWSTR lpCommandLine, PathCharString& lpFileName);
+static char ** buildArgv(LPCWSTR lpCommandLine, PathCharString& lpAppPath, UINT *pnArg, BOOL prependLoader);
static BOOL getPath(PathCharString& lpFileName, PathCharString& lpPathFileName);
static int checkFileType(LPCSTR lpFileName);
-static BOOL PROCEndProcess(HANDLE hProcess, UINT uExitCode,
- BOOL bTerminateUnconditionally);
+static BOOL PROCEndProcess(HANDLE hProcess, UINT uExitCode, BOOL bTerminateUnconditionally);
ProcessModules *GetProcessModulesFromHandle(IN HANDLE hProcess, OUT LPDWORD lpCount);
ProcessModules *CreateProcessModules(IN DWORD dwProcessId, OUT LPDWORD lpCount);
@@ -1382,7 +1388,7 @@ static BOOL PROCEndProcess(HANDLE hProcess, UINT uExitCode, BOOL bTerminateUncon
// (1) it doesn't run atexit handlers
// (2) can invoke CrashReporter or produce a coredump,
// which is appropriate for TerminateProcess calls
- abort();
+ PROCAbort();
}
else
{
@@ -2081,9 +2087,12 @@ GetProcessIdDisambiguationKey(DWORD processId, UINT64 *disambiguationKey)
Builds the transport pipe names from the process id.
--*/
-void
+VOID
PALAPI
-PAL_GetTransportPipeName(char *name, DWORD id, const char *suffix)
+PAL_GetTransportPipeName(
+ OUT char *name,
+ IN DWORD id,
+ IN const char *suffix)
{
UINT64 disambiguationKey = 0;
BOOL ret = GetProcessIdDisambiguationKey(id, &disambiguationKey);
@@ -2829,7 +2838,7 @@ Return
None
--*/
-void
+VOID
DestroyProcessModules(IN ProcessModules *listHead)
{
for (ProcessModules *entry = listHead; entry != NULL; )
@@ -2841,7 +2850,7 @@ DestroyProcessModules(IN ProcessModules *listHead)
}
/*++
-Function:
+Function
PROCNotifyProcessShutdown
Calls the abort handler to do any shutdown cleanup. Call be called
@@ -2850,7 +2859,8 @@ Function:
(no return value)
--*/
__attribute__((destructor))
-void PROCNotifyProcessShutdown()
+VOID
+PROCNotifyProcessShutdown()
{
// Call back into the coreclr to clean up the debugger transport pipes
PSHUTDOWN_CALLBACK callback = InterlockedExchangePointer(&g_shutdownCallback, NULL);
@@ -2861,6 +2871,101 @@ void PROCNotifyProcessShutdown()
}
/*++
+Function
+ PROCAbortInitialize()
+
+Abstract
+ Initialize the process abort crash dump program file path and
+ name. Doing all of this ahead of time so nothing is allocated
+ or copied in PROCAbort/signal handler.
+
+Return
+ TRUE - succeeds, FALSE - fails
+
+--*/
+BOOL
+PROCAbortInitialize()
+{
+ char* enabled = getenv("COMPlus_DbgEnableMiniDump");
+ if (enabled != nullptr && _stricmp(enabled, "1") == 0)
+ {
+ if (g_szCoreCLRPath == nullptr)
+ {
+ return FALSE;
+ }
+ const char* DumpGeneratorName = "createdump";
+ int programLen = strlen(g_szCoreCLRPath) + strlen(DumpGeneratorName) + 1;
+ char* program = (char*)InternalMalloc(programLen);
+ if (program == nullptr)
+ {
+ return FALSE;
+ }
+ if (strcpy_s(program, programLen, g_szCoreCLRPath) != SAFECRT_SUCCESS)
+ {
+ return FALSE;
+ }
+ char *last = strrchr(program, '/');
+ if (last != nullptr)
+ {
+ *(last + 1) = '\0';
+ }
+ else
+ {
+ program[0] = '\0';
+ }
+ if (strcat_s(program, programLen, DumpGeneratorName) != SAFECRT_SUCCESS)
+ {
+ return FALSE;
+ }
+ char* pidarg = (char*)InternalMalloc(128);
+ if (pidarg == nullptr)
+ {
+ return FALSE;
+ }
+ if (sprintf_s(pidarg, 128, "%d", gPID) == -1)
+ {
+ return FALSE;
+ }
+ const char** argv = (const char**)g_argvCreateDump;
+ *argv++ = program;
+
+ char* envvar = getenv("COMPlus_DbgMiniDumpName");
+ if (envvar != nullptr)
+ {
+ *argv++ = "--name";
+ *argv++ = envvar;
+ }
+
+ envvar = getenv("COMPlus_DbgMiniDumpType");
+ if (envvar != nullptr)
+ {
+ if (strcmp(envvar, "1") == 0)
+ {
+ *argv++ = "--normal";
+ }
+ else if (strcmp(envvar, "2") == 0)
+ {
+ *argv++ = "--withheap";
+ }
+ else if (strcmp(envvar, "3") == 0)
+ {
+ *argv++ = "--triage";
+ }
+ }
+
+ envvar = getenv("COMPlus_CreateDumpDiagnostics");
+ if (envvar != nullptr && strcmp(envvar, "1") == 0)
+ {
+ *argv++ = "--diag";
+ }
+
+ *argv++ = pidarg;
+ *argv = nullptr;
+ }
+ return TRUE;
+}
+
+/*++
Function:
PROCAbort()
@@ -2870,10 +2975,51 @@ Function:
Does not return
--*/
PAL_NORETURN
-void
+VOID
PROCAbort()
{
+ // Do any shutdown cleanup before aborting or creating a core dump
PROCNotifyProcessShutdown();
+
+#if HAVE_PRCTL_H
+ // If enabled, launch the create minidump utility and wait until it completes
+ if (g_argvCreateDump[0] != nullptr)
+ {
+ // Fork the core dump child process.
+ pid_t childpid = fork();
+
+ // If error, write an error to trace log and abort
+ if (childpid == -1)
+ {
+ ERROR("PROCAbort: fork() FAILED %d (%s)\n", errno, strerror(errno));
+ }
+ else if (childpid == 0)
+ {
+ // Child process
+ if (execve(g_argvCreateDump[0], g_argvCreateDump, palEnvironment) == -1)
+ {
+ ERROR("PROCAbort: execve FAILED %d (%s)\n", errno, strerror(errno));
+ }
+ }
+ else
+ {
+ // Gives the child process permission to use /proc/<pid>/mem and ptrace
+ if (prctl(PR_SET_PTRACER, childpid, 0, 0, 0) == -1)
+ {
+ ERROR("PROCAbort: prctl() FAILED %d (%s)\n", errno, strerror(errno));
+ }
+ // Parent waits until the child process is done
+ int wstatus;
+ int result = waitpid(childpid, &wstatus, 0);
+ if (result != childpid)
+ {
+ ERROR("PROCAbort: waitpid FAILED result %d wstatus %d errno %d (%s)\n",
+ result, wstatus, errno, strerror(errno));
+ }
+ }
+ }
+#endif // HAVE_PRCTL_H
+ // Abort the process after waiting for the core dump to complete
abort();
}
@@ -2886,7 +3032,8 @@ Abstract
Return
TRUE if it succeeded, FALSE otherwise
--*/
-BOOL InitializeFlushProcessWriteBuffers()
+BOOL
+InitializeFlushProcessWriteBuffers()
{
// Verify that the s_helperPage is really aligned to the VIRTUAL_PAGE_SIZE
_ASSERTE((((SIZE_T)s_helperPage) & (VIRTUAL_PAGE_SIZE - 1)) == 0);
@@ -3273,7 +3420,7 @@ Parameter
pThread: Thread object
--*/
-void
+VOID
CorUnix::PROCAddThread(
CPalThread *pCurrentThread,
CPalThread *pTargetThread
@@ -3306,7 +3453,7 @@ Parameter
(no return value)
--*/
-void
+VOID
CorUnix::PROCRemoveThread(
CPalThread *pCurrentThread,
CPalThread *pTargetThread
@@ -3376,7 +3523,7 @@ Return
--*/
INT
CorUnix::PROCGetNumberOfThreads(
- void)
+ VOID)
{
return g_dwThreadCount;
}
@@ -3479,7 +3626,7 @@ Note:
This function is used in ExitThread and TerminateProcess
--*/
-void
+VOID
CorUnix::TerminateCurrentProcessNoExit(BOOL bTerminateUnconditionally)
{
BOOL locked;
diff --git a/src/strongname/api/strongnamecoreclr.cpp b/src/strongname/api/strongnamecoreclr.cpp
index b02cde3dd9..2b9b4b82cf 100644
--- a/src/strongname/api/strongnamecoreclr.cpp
+++ b/src/strongname/api/strongnamecoreclr.cpp
@@ -39,15 +39,15 @@ FunctionPointer ApiShim(LPCSTR szApiName)
// Shim APIs, passing off into the desktop VM
//
-IExecutionEngine * __stdcall SnIEE()
+IExecutionEngine* SnIEE()
{
- typedef IExecutionEngine * ( __stdcall *IEEFn_t)();
+ typedef IExecutionEngine* (* IEEFn_t)();
return ApiShim<IEEFn_t>("IEE")();
}
-STDAPI SnGetCorSystemDirectory(SString& pbuffer)
+HRESULT SnGetCorSystemDirectory(SString& pbuffer)
{
- typedef HRESULT (__stdcall *GetCorSystemDirectoryFn_t)(SString&);
+ typedef HRESULT (*GetCorSystemDirectoryFn_t)(SString&);
return ApiShim<GetCorSystemDirectoryFn_t>("GetCORSystemDirectory")(pbuffer);
}
diff --git a/src/unwinder/i386/unwinder_i386.cpp b/src/unwinder/i386/unwinder_i386.cpp
index 55f0766a7f..f221020752 100644
--- a/src/unwinder/i386/unwinder_i386.cpp
+++ b/src/unwinder/i386/unwinder_i386.cpp
@@ -105,21 +105,7 @@ OOPStackUnwinderX86::VirtualUnwind(
ENUM_CALLEE_SAVED_REGISTERS();
#undef CALLEE_SAVED_REGISTER
- SIZE_T paramSize = codeInfo.GetCodeManager()->GetStackParameterSize(&codeInfo);
- SIZE_T paddingSize = 0;
-
-#ifdef UNIX_X86_ABI
- // On UNIX_X86_ABI, function call may have stack alignment padding.
- if (paramSize % 16 != 0)
- {
- paddingSize += 16 - (paramSize % 16);
- }
-#endif // UNIX_X86_ABI
-
- ContextRecord->Esp = rd.SP - paramSize;
- ContextRecord->ResumeEsp = ExecutionManager::IsManagedCode((PCODE) rd.ControlPC)
- ? rd.SP + paddingSize
- : ContextRecord->Esp;
+ ContextRecord->Esp = rd.SP - codeInfo.GetCodeManager()->GetStackParameterSize(&codeInfo);
ContextRecord->Eip = rd.ControlPC;
// For x86, the value of Establisher Frame Pointer is Caller SP
diff --git a/src/utilcode/pedecoder.cpp b/src/utilcode/pedecoder.cpp
index 79fe244bda..3b3c937419 100644
--- a/src/utilcode/pedecoder.cpp
+++ b/src/utilcode/pedecoder.cpp
@@ -263,9 +263,6 @@ CHECK PEDecoder::CheckNTHeaders() const
CHECK(CheckAligned((UINT)VAL32(pNT->OptionalHeader.FileAlignment), 512));
CHECK(CheckAligned((UINT)VAL32(pNT->OptionalHeader.SectionAlignment), VAL32(pNT->OptionalHeader.FileAlignment)));
- // INVESTIGATE: this doesn't seem to be necessary on Win64 - why??
- //CHECK(CheckAligned((UINT)VAL32(pNT->OptionalHeader.SectionAlignment), OS_PAGE_SIZE));
- CHECK(CheckAligned((UINT)VAL32(pNT->OptionalHeader.SectionAlignment), 0x1000)); // for base relocs logic
CHECK(CheckAligned((UINT)VAL32(pNT->OptionalHeader.SizeOfImage), VAL32(pNT->OptionalHeader.SectionAlignment)));
CHECK(CheckAligned((UINT)VAL32(pNT->OptionalHeader.SizeOfHeaders), VAL32(pNT->OptionalHeader.FileAlignment)));
diff --git a/src/utilcode/util.cpp b/src/utilcode/util.cpp
index c215a49213..a8786def92 100644
--- a/src/utilcode/util.cpp
+++ b/src/utilcode/util.cpp
@@ -728,7 +728,7 @@ BYTE * ClrVirtualAllocWithinRange(const BYTE *pMinAddr,
//******************************************************************************
// NumaNodeInfo
//******************************************************************************
-#if !defined(FEATURE_REDHAWK) && !defined(FEATURE_PAL)
+#if !defined(FEATURE_REDHAWK)
/*static*/ NumaNodeInfo::PGNHNN NumaNodeInfo::m_pGetNumaHighestNodeNumber = NULL;
/*static*/ NumaNodeInfo::PVAExN NumaNodeInfo::m_pVirtualAllocExNuma = NULL;
@@ -748,15 +748,19 @@ BYTE * ClrVirtualAllocWithinRange(const BYTE *pMinAddr,
/*static*/ BOOL NumaNodeInfo::m_enableGCNumaAware = FALSE;
/*static*/ BOOL NumaNodeInfo::InitNumaNodeInfoAPI()
{
-#if !defined(FEATURE_REDHAWK) && !defined(FEATURE_PAL)
+#if !defined(FEATURE_REDHAWK)
//check for numa support if multiple heaps are used
ULONG highest = 0;
if (CLRConfig::GetConfigValue(CLRConfig::UNSUPPORTED_GCNumaAware) == 0)
return FALSE;
+#ifndef FEATURE_PAL
// check if required APIs are supported
HMODULE hMod = GetModuleHandleW(WINDOWS_KERNEL32_DLLNAME_W);
+#else
+ HMODULE hMod = GetCLRModule();
+#endif
if (hMod == NULL)
return FALSE;
@@ -795,7 +799,7 @@ BYTE * ClrVirtualAllocWithinRange(const BYTE *pMinAddr,
//******************************************************************************
// NumaNodeInfo
//******************************************************************************
-#if !defined(FEATURE_REDHAWK) && !defined(FEATURE_PAL)
+#if !defined(FEATURE_REDHAWK)
/*static*/ CPUGroupInfo::PGLPIEx CPUGroupInfo::m_pGetLogicalProcessorInformationEx = NULL;
/*static*/ CPUGroupInfo::PSTGA CPUGroupInfo::m_pSetThreadGroupAffinity = NULL;
/*static*/ CPUGroupInfo::PGTGA CPUGroupInfo::m_pGetThreadGroupAffinity = NULL;
@@ -848,8 +852,12 @@ BYTE * ClrVirtualAllocWithinRange(const BYTE *pMinAddr,
}
CONTRACTL_END;
-#if !defined(FEATURE_REDHAWK) && defined(_TARGET_AMD64_) && !defined(FEATURE_PAL)
+#if !defined(FEATURE_REDHAWK) && defined(_TARGET_AMD64_)
+#ifndef FEATURE_PAL
HMODULE hMod = GetModuleHandleW(WINDOWS_KERNEL32_DLLNAME_W);
+#else
+ HMODULE hMod = GetCLRModule();
+#endif
if (hMod == NULL)
return FALSE;
@@ -869,17 +877,19 @@ BYTE * ClrVirtualAllocWithinRange(const BYTE *pMinAddr,
if (m_pGetCurrentProcessorNumberEx == NULL)
return FALSE;
+#ifndef FEATURE_PAL
m_pGetSystemTimes = (PGST)GetProcAddress(hMod, "GetSystemTimes");
if (m_pGetSystemTimes == NULL)
return FALSE;
-
+#endif
+
return TRUE;
#else
return FALSE;
#endif
}
-#if !defined(FEATURE_REDHAWK) && defined(_TARGET_AMD64_) && !defined(FEATURE_PAL)
+#if !defined(FEATURE_REDHAWK) && defined(_TARGET_AMD64_)
// Calculate greatest common divisor
DWORD GCD(DWORD u, DWORD v)
{
@@ -910,7 +920,7 @@ DWORD LCM(DWORD u, DWORD v)
}
CONTRACTL_END;
-#if !defined(FEATURE_REDHAWK) && defined(_TARGET_AMD64_) && !defined(FEATURE_PAL)
+#if !defined(FEATURE_REDHAWK) && defined(_TARGET_AMD64_)
BYTE *bBuffer = NULL;
SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX *pSLPIEx = NULL;
SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX *pRecord = NULL;
@@ -985,7 +995,7 @@ DWORD LCM(DWORD u, DWORD v)
{
LIMITED_METHOD_CONTRACT;
-#if !defined(FEATURE_REDHAWK) && defined(_TARGET_AMD64_) && !defined(FEATURE_PAL)
+#if !defined(FEATURE_REDHAWK) && defined(_TARGET_AMD64_)
WORD begin = 0;
WORD nr_proc = 0;
@@ -1012,7 +1022,7 @@ DWORD LCM(DWORD u, DWORD v)
}
CONTRACTL_END;
-#if !defined(FEATURE_REDHAWK) && defined(_TARGET_AMD64_) && !defined(FEATURE_PAL)
+#if !defined(FEATURE_REDHAWK) && defined(_TARGET_AMD64_)
BOOL enableGCCPUGroups = CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_GCCpuGroup) != 0;
BOOL threadUseAllCpuGroups = CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_Thread_UseAllCpuGroups) != 0;
@@ -1095,7 +1105,7 @@ retry:
{
LIMITED_METHOD_CONTRACT;
-#if !defined(FEATURE_REDHAWK) && defined(_TARGET_AMD64_) && !defined(FEATURE_PAL)
+#if !defined(FEATURE_REDHAWK) && defined(_TARGET_AMD64_)
WORD bTemp = 0;
WORD bDiff = processor_number - bTemp;
@@ -1126,7 +1136,7 @@ retry:
}
CONTRACTL_END;
-#if !defined(FEATURE_REDHAWK) && defined(_TARGET_AMD64_) && !defined(FEATURE_PAL)
+#if !defined(FEATURE_REDHAWK) && defined(_TARGET_AMD64_)
// m_enableGCCPUGroups and m_threadUseAllCpuGroups must be TRUE
_ASSERTE(m_enableGCCPUGroups && m_threadUseAllCpuGroups);
@@ -1147,7 +1157,7 @@ retry:
#endif
}
-#if !defined(FEATURE_REDHAWK) && !defined(FEATURE_PAL)
+#if !defined(FEATURE_REDHAWK)
//Lock ThreadStore before calling this function, so that updates of weights/counts are consistent
/*static*/ void CPUGroupInfo::ChooseCPUGroupAffinity(GROUP_AFFINITY *gf)
{
diff --git a/src/vm/CMakeLists.txt b/src/vm/CMakeLists.txt
index 26fcacf4af..da1aa8fe62 100644
--- a/src/vm/CMakeLists.txt
+++ b/src/vm/CMakeLists.txt
@@ -317,6 +317,7 @@ if(CLR_CMAKE_TARGET_ARCH_AMD64)
${ARCH_SOURCES_DIR}/JitHelpers_FastWriteBarriers.asm
${ARCH_SOURCES_DIR}/JitHelpers_InlineGetAppDomain.asm
${ARCH_SOURCES_DIR}/JitHelpers_InlineGetThread.asm
+ ${ARCH_SOURCES_DIR}/JitHelpers_SingleAppDomain.asm
${ARCH_SOURCES_DIR}/JitHelpers_Slow.asm
${ARCH_SOURCES_DIR}/PInvokeStubs.asm
${ARCH_SOURCES_DIR}/RedirectedHandledJITCase.asm
@@ -363,6 +364,7 @@ else(WIN32)
${ARCH_SOURCES_DIR}/getstate.S
${ARCH_SOURCES_DIR}/jithelpers_fast.S
${ARCH_SOURCES_DIR}/jithelpers_fastwritebarriers.S
+ ${ARCH_SOURCES_DIR}/jithelpers_singleappdomain.S
${ARCH_SOURCES_DIR}/jithelpers_slow.S
${ARCH_SOURCES_DIR}/pinvokestubs.S
${ARCH_SOURCES_DIR}/theprestubamd64.S
diff --git a/src/vm/amd64/JitHelpers_SingleAppDomain.asm b/src/vm/amd64/JitHelpers_SingleAppDomain.asm
new file mode 100644
index 0000000000..f1b267435a
--- /dev/null
+++ b/src/vm/amd64/JitHelpers_SingleAppDomain.asm
@@ -0,0 +1,64 @@
+; Licensed to the .NET Foundation under one or more agreements.
+; The .NET Foundation licenses this file to you under the MIT license.
+; See the LICENSE file in the project root for more information.
+
+; ==++==
+;
+
+;
+; ==--==
+; ***********************************************************************
+; File: JitHelpers_SingleAppDomain.asm
+;
+; Notes: JIT Static access helpers when coreclr host specifies single
+; appdomain flag
+; ***********************************************************************
+
+include AsmMacros.inc
+include asmconstants.inc
+
+; Min amount of stack space that a nested function should allocate.
+MIN_SIZE equ 28h
+
+extern JIT_GetSharedNonGCStaticBase_Helper:proc
+extern JIT_GetSharedGCStaticBase_Helper:proc
+
+LEAF_ENTRY JIT_GetSharedNonGCStaticBase_SingleAppDomain, _TEXT
+ ; If class is not initialized, bail to C++ helper
+ test byte ptr [rcx + OFFSETOF__DomainLocalModule__m_pDataBlob + rdx], 1
+ jz CallHelper
+ mov rax, rcx
+ REPRET
+
+ align 16
+ CallHelper:
+ ; Tail call JIT_GetSharedNonGCStaticBase_Helper
+ jmp JIT_GetSharedNonGCStaticBase_Helper
+LEAF_END JIT_GetSharedNonGCStaticBase_SingleAppDomain, _TEXT
+
+LEAF_ENTRY JIT_GetSharedNonGCStaticBaseNoCtor_SingleAppDomain, _TEXT
+ mov rax, rcx
+ ret
+LEAF_END JIT_GetSharedNonGCStaticBaseNoCtor_SingleAppDomain, _TEXT
+
+LEAF_ENTRY JIT_GetSharedGCStaticBase_SingleAppDomain, _TEXT
+ ; If class is not initialized, bail to C++ helper
+ test byte ptr [rcx + OFFSETOF__DomainLocalModule__m_pDataBlob + rdx], 1
+ jz CallHelper
+
+ mov rax, [rcx + OFFSETOF__DomainLocalModule__m_pGCStatics]
+ REPRET
+
+ align 16
+ CallHelper:
+ ; Tail call Jit_GetSharedGCStaticBase_Helper
+ jmp JIT_GetSharedGCStaticBase_Helper
+LEAF_END JIT_GetSharedGCStaticBase_SingleAppDomain, _TEXT
+
+LEAF_ENTRY JIT_GetSharedGCStaticBaseNoCtor_SingleAppDomain, _TEXT
+ mov rax, [rcx + OFFSETOF__DomainLocalModule__m_pGCStatics]
+ ret
+LEAF_END JIT_GetSharedGCStaticBaseNoCtor_SingleAppDomain, _TEXT
+
+ end
+
diff --git a/src/vm/amd64/jithelpers_singleappdomain.S b/src/vm/amd64/jithelpers_singleappdomain.S
new file mode 100644
index 0000000000..307d86b7fe
--- /dev/null
+++ b/src/vm/amd64/jithelpers_singleappdomain.S
@@ -0,0 +1,49 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+.intel_syntax noprefix
+#include "unixasmmacros.inc"
+#include "asmconstants.h"
+
+//
+// JIT Static access helpers when coreclr host specifies single
+// appdomain flag
+//
+
+LEAF_ENTRY JIT_GetSharedNonGCStaticBase_SingleAppDomain, _TEXT
+ // If class is not initialized, bail to C++ helper
+ test byte ptr [rdi + OFFSETOF__DomainLocalModule__m_pDataBlob + rsi], 1
+ jz CallHelper
+ mov rax, rdi
+ rep ret
+
+.balign 16
+CallHelper:
+ // Tail call JIT_GetSharedNonGCStaticBase_Helper
+ jmp C_FUNC(JIT_GetSharedNonGCStaticBase_Helper)
+LEAF_END_MARKED JIT_GetSharedNonGCStaticBase_SingleAppDomain, _TEXT
+
+LEAF_ENTRY JIT_GetSharedNonGCStaticBaseNoCtor_SingleAppDomain, _TEXT
+ mov rax, rdi
+ ret
+LEAF_END JIT_GetSharedNonGCStaticBaseNoCtor_SingleAppDomain, _TEXT
+
+LEAF_ENTRY JIT_GetSharedGCStaticBase_SingleAppDomain, _TEXT
+ // If class is not initialized, bail to C++ helper
+ test byte ptr [rdi + OFFSETOF__DomainLocalModule__m_pDataBlob + rsi], 1
+ jz CallHelper1
+
+ mov rax, [rdi + OFFSETOF__DomainLocalModule__m_pGCStatics]
+ rep ret
+
+.balign 16
+CallHelper1:
+ // Tail call Jit_GetSharedGCStaticBase_Helper
+ jmp C_FUNC(JIT_GetSharedGCStaticBase_Helper)
+LEAF_END JIT_GetSharedGCStaticBase_SingleAppDomain, _TEXT
+
+LEAF_ENTRY JIT_GetSharedGCStaticBaseNoCtor_SingleAppDomain, _TEXT
+ mov rax, [rdi + OFFSETOF__DomainLocalModule__m_pGCStatics]
+ ret
+LEAF_END JIT_GetSharedGCStaticBaseNoCtor_SingleAppDomain, _TEXT
diff --git a/src/vm/amd64/unixstubs.cpp b/src/vm/amd64/unixstubs.cpp
index 2904149084..76d3cf1890 100644
--- a/src/vm/amd64/unixstubs.cpp
+++ b/src/vm/amd64/unixstubs.cpp
@@ -37,7 +37,7 @@ extern "C"
" mov %%edx, 12(%[result])\n" \
: "=a"(eax) /*output in eax*/\
: "a"(arg), [result]"r"(result) /*inputs - arg in eax, result in any register*/\
- : "eax", "rbx", "ecx", "edx", "memory" /* registers that are clobbered, *result is clobbered */
+ : "rbx", "ecx", "edx", "memory" /* registers that are clobbered, *result is clobbered */
);
return eax;
}
@@ -52,7 +52,7 @@ extern "C"
" mov %%edx, 12(%[result])\n" \
: "=a"(eax) /*output in eax*/\
: "c"(arg1), "a"(arg2), [result]"r"(result) /*inputs - arg1 in ecx, arg2 in eax, result in any register*/\
- : "eax", "rbx", "ecx", "edx", "memory" /* registers that are clobbered, *result is clobbered */
+ : "rbx", "edx", "memory" /* registers that are clobbered, *result is clobbered */
);
return eax;
}
@@ -63,7 +63,7 @@ extern "C"
__asm(" xgetbv\n" \
: "=a"(eax) /*output in eax*/\
: "c"(0) /*inputs - 0 in ecx*/\
- : "eax", "edx" /* registers that are clobbered*/
+ : "edx" /* registers that are clobbered*/
);
// check OS has enabled both XMM and YMM state support
return ((eax & 0x06) == 0x06) ? 1 : 0;
diff --git a/src/vm/appdomain.cpp b/src/vm/appdomain.cpp
index 5bfb12fc6b..bd05991ea2 100644
--- a/src/vm/appdomain.cpp
+++ b/src/vm/appdomain.cpp
@@ -741,7 +741,7 @@ BaseDomain::BaseDomain()
#ifndef CROSSGEN_COMPILE
// Note that m_handleStore is overridden by app domains
- m_handleStore = GCHandleTableUtilities::GetGCHandleTable()->GetGlobalHandleStore();
+ m_handleStore = GCHandleUtilities::GetGCHandleManager()->GetGlobalHandleStore();
#else
m_handleStore = NULL;
#endif
@@ -4273,11 +4273,16 @@ void AppDomain::Init()
// default domain cannot be unloaded.
if (GetId().m_dwId == DefaultADID)
{
- m_handleStore = GCHandleTableUtilities::GetGCHandleTable()->GetGlobalHandleStore();
+ m_handleStore = GCHandleUtilities::GetGCHandleManager()->GetGlobalHandleStore();
}
else
{
- m_handleStore = GCHandleTableUtilities::GetGCHandleTable()->CreateHandleStore((void*)(uintptr_t)m_dwIndex.m_dwIndex);
+ m_handleStore = GCHandleUtilities::GetGCHandleManager()->CreateHandleStore((void*)(uintptr_t)m_dwIndex.m_dwIndex);
+ }
+
+ if (!m_handleStore)
+ {
+ COMPlusThrowOM();
}
#endif // CROSSGEN_COMPILE
@@ -4578,9 +4583,9 @@ void AppDomain::Terminate()
BaseDomain::Terminate();
- if (m_handleStore)
+ if (m_handleStore)
{
- GCHandleTableUtilities::GetGCHandleTable()->DestroyHandleStore(m_handleStore);
+ GCHandleUtilities::GetGCHandleManager()->DestroyHandleStore(m_handleStore);
m_handleStore = NULL;
}
@@ -4679,7 +4684,8 @@ OBJECTREF AppDomain::GetExposedObject()
obj = (APPDOMAINREF) AllocateObject(pMT);
obj->SetDomain(this);
- if(StoreFirstObjectInHandle(m_ExposedObject, (OBJECTREF) obj) == FALSE) {
+ if (!StoreFirstObjectInHandle(m_ExposedObject, (OBJECTREF) obj))
+ {
obj = (APPDOMAINREF) GetRawExposedObject();
_ASSERTE(obj);
}
@@ -9197,8 +9203,8 @@ void AppDomain::ClearGCHandles()
// Keep async pin handles alive by moving them to default domain
HandleAsyncPinHandles();
- // Remove our handle table as a source of GC roots
- GCHandleTableUtilities::GetGCHandleTable()->UprootHandleStore(m_handleStore);
+ // Remove our handle store as a source of GC roots
+ m_handleStore->Uproot();
}
// When an AD is unloaded, we will release all objects in this AD.
@@ -9247,15 +9253,13 @@ void AppDomain::ClearGCRoots()
// this point, so only need to synchronize the preemptive mode threads.
ExecutionManager::Unload(GetLoaderAllocator());
- IGCHandleTable* pHandleTable = GCHandleTableUtilities::GetGCHandleTable();
-
while ((pThread = ThreadStore::GetAllThreadList(pThread, 0, 0)) != NULL)
{
// Delete the thread local static store
pThread->DeleteThreadStaticData(this);
// <TODO>@TODO: A pre-allocated AppDomainUnloaded exception might be better.</TODO>
- if (pHandleTable->ContainsHandle(m_handleStore, pThread->m_LastThrownObjectHandle))
+ if (m_handleStore->ContainsHandle(pThread->m_LastThrownObjectHandle))
{
// Never delete a handle to a preallocated exception object.
if (!CLRException::IsPreallocatedExceptionHandle(pThread->m_LastThrownObjectHandle))
diff --git a/src/vm/appdomain.hpp b/src/vm/appdomain.hpp
index 898e50f1c2..a5bd00d36b 100644
--- a/src/vm/appdomain.hpp
+++ b/src/vm/appdomain.hpp
@@ -28,7 +28,7 @@
#include "ilstubcache.h"
#include "testhookmgr.h"
#include "gcheaputilities.h"
-#include "gchandletableutilities.h"
+#include "gchandleutilities.h"
#include "../binder/inc/applicationcontext.hpp"
#include "rejit.h"
@@ -1245,8 +1245,13 @@ public:
{
WRAPPER_NO_CONTRACT;
- IGCHandleTable *pHandleTable = GCHandleTableUtilities::GetGCHandleTable();
- return pHandleTable->CreateHandleOfType(m_handleStore, OBJECTREFToObject(object), type);
+ OBJECTHANDLE hnd = m_handleStore->CreateHandleOfType(OBJECTREFToObject(object), type);
+ if (!hnd)
+ {
+ COMPlusThrowOM();
+ }
+
+ return hnd;
}
OBJECTHANDLE CreateHandle(OBJECTREF object)
@@ -1319,7 +1324,7 @@ public:
{
CONTRACTL
{
- THROWS;
+ NOTHROW;
GC_NOTRIGGER;
MODE_COOPERATIVE;
}
@@ -1339,14 +1344,19 @@ public:
{
CONTRACTL
{
- THROWS;
+ NOTHROW;
GC_NOTRIGGER;
MODE_COOPERATIVE;
}
CONTRACTL_END;
- IGCHandleTable *pHandleTable = GCHandleTableUtilities::GetGCHandleTable();
- return pHandleTable->CreateDependentHandle(m_handleStore, OBJECTREFToObject(primary), OBJECTREFToObject(secondary));
+ OBJECTHANDLE hnd = m_handleStore->CreateDependentHandle(OBJECTREFToObject(primary), OBJECTREFToObject(secondary));
+ if (!hnd)
+ {
+ COMPlusThrowOM();
+ }
+
+ return hnd;
}
#endif // DACCESS_COMPILE && !CROSSGEN_COMPILE
@@ -1402,7 +1412,7 @@ protected:
CLRPrivBinderCoreCLR *m_pTPABinderContext; // Reference to the binding context that holds TPA list details
- void* m_handleStore;
+ IGCHandleStore* m_handleStore;
// The large heap handle table.
LargeHeapHandleTable *m_pLargeHeapHandleTable;
diff --git a/src/vm/argdestination.h b/src/vm/argdestination.h
index 8a3fb4fdf2..8ab0a5664b 100644
--- a/src/vm/argdestination.h
+++ b/src/vm/argdestination.h
@@ -30,6 +30,9 @@ public:
LIMITED_METHOD_CONTRACT;
#if defined(UNIX_AMD64_ABI) && defined(FEATURE_UNIX_AMD64_STRUCT_PASSING)
_ASSERTE((argLocDescForStructInRegs != NULL) || (offset != TransitionBlock::StructInRegsOffset));
+#elif defined(_TARGET_ARM64_)
+ // This assert is not interesting on arm64. argLocDescForStructInRegs could be
+ // initialized if the args are being enregistered.
#else
_ASSERTE(argLocDescForStructInRegs == NULL);
#endif
@@ -42,6 +45,46 @@ public:
return dac_cast<PTR_VOID>(dac_cast<TADDR>(m_base) + m_offset);
}
+#if defined(_TARGET_ARM64_)
+#ifndef DACCESS_COMPILE
+
+ // Returns true if the ArgDestination represents an HFA struct
+ bool IsHFA()
+ {
+ return m_argLocDescForStructInRegs != NULL;
+ }
+
+ // Copy struct argument into registers described by the current ArgDestination.
+ // Arguments:
+ // src = source data of the structure
+ // fieldBytes - size of the structure
+ void CopyHFAStructToRegister(void *src, int fieldBytes)
+ {
+ // We are either copying either a float or double HFA and need to
+ // enregister each field.
+
+ int floatRegCount = m_argLocDescForStructInRegs->m_cFloatReg;
+ bool typeFloat = m_argLocDescForStructInRegs->m_isSinglePrecision;
+ void* dest = this->GetDestinationAddress();
+
+ if (typeFloat)
+ {
+ for (int i = 0; i < floatRegCount; ++i)
+ {
+ // Copy 4 bytes on 8 bytes alignment
+ *((UINT64*)dest + i) = *((UINT32*)src + i);
+ }
+ }
+ else
+ {
+ // We can just do a memcpy.
+ memcpyNoGCRefs(dest, src, fieldBytes);
+ }
+ }
+
+#endif // !DACCESS_COMPILE
+#endif // defined(_TARGET_ARM64_)
+
#if defined(UNIX_AMD64_ABI) && defined(FEATURE_UNIX_AMD64_STRUCT_PASSING)
// Returns true if the ArgDestination represents a struct passed in registers.
diff --git a/src/vm/arm64/asmconstants.h b/src/vm/arm64/asmconstants.h
index b0300ca324..12b72f9249 100644
--- a/src/vm/arm64/asmconstants.h
+++ b/src/vm/arm64/asmconstants.h
@@ -167,5 +167,11 @@ ASMCONSTANTS_C_ASSERT(ResolveCacheElem__target == offsetof(ResolveCacheElem, tar
ASMCONSTANTS_C_ASSERT(ResolveCacheElem__pNext == offsetof(ResolveCacheElem, pNext));
#endif // CROSSGEN_COMPILE
+#define DomainLocalModule__m_pDataBlob 0x30
+#define DomainLocalModule__m_pGCStatics 0x20
+ASMCONSTANTS_C_ASSERT(DomainLocalModule__m_pDataBlob == offsetof(DomainLocalModule, m_pDataBlob));
+ASMCONSTANTS_C_ASSERT(DomainLocalModule__m_pGCStatics == offsetof(DomainLocalModule, m_pGCStatics));
+
+
#undef ASMCONSTANTS_RUNTIME_ASSERT
#undef ASMCONSTANTS_C_ASSERT
diff --git a/src/vm/arm64/asmhelpers.S b/src/vm/arm64/asmhelpers.S
index ef6b5cfffe..15b8057ed6 100644
--- a/src/vm/arm64/asmhelpers.S
+++ b/src/vm/arm64/asmhelpers.S
@@ -1192,9 +1192,9 @@ NESTED_END StubDispatchFixupStub, _TEXT
// On exit:
// buffer pointed to by x1 on entry contains the float or double argument as appropriate
//
- LEAF_ENTRY getFPReturn
+LEAF_ENTRY getFPReturn, _TEXT
str d0, [x1]
- LEAF_END
+LEAF_END getFPReturn, _TEXT
// ------------------------------------------------------------------
// Function used by COM interop to set floating point return value (since it's not in the same
@@ -1208,7 +1208,64 @@ NESTED_END StubDispatchFixupStub, _TEXT
// s0 : float result if x0 == 4
// d0 : double result if x0 == 8
//
- LEAF_ENTRY setFPReturn
+LEAF_ENTRY setFPReturn, _TEXT
fmov d0, x1
- LEAF_END
+LEAF_END setFPReturn, _TEXT
#endif
+
+//
+// JIT Static access helpers when coreclr host specifies single appdomain flag
+//
+
+// ------------------------------------------------------------------
+// void* JIT_GetSharedNonGCStaticBase(SIZE_T moduleDomainID, DWORD dwClassDomainID)
+
+LEAF_ENTRY JIT_GetSharedNonGCStaticBase_SingleAppDomain, _TEXT
+ // If class is not initialized, bail to C++ helper
+ add x2, x0, #DomainLocalModule__m_pDataBlob
+ ldrb w2, [x2, w1, UXTW]
+ tst w2, #1
+ beq LOCAL_LABEL(JIT_GetSharedNonGCStaticBase_SingleAppDomain_CallHelper)
+
+ ret lr
+
+LOCAL_LABEL(JIT_GetSharedNonGCStaticBase_SingleAppDomain_CallHelper):
+ // Tail call JIT_GetSharedNonGCStaticBase_Helper
+ b C_FUNC(JIT_GetSharedNonGCStaticBase_Helper)
+LEAF_END JIT_GetSharedNonGCStaticBase_SingleAppDomain, _TEXT
+
+
+// ------------------------------------------------------------------
+// void* JIT_GetSharedNonGCStaticBaseNoCtor(SIZE_T moduleDomainID, DWORD dwClassDomainID)
+
+LEAF_ENTRY JIT_GetSharedNonGCStaticBaseNoCtor_SingleAppDomain, _TEXT
+ ret lr
+LEAF_END JIT_GetSharedNonGCStaticBaseNoCtor_SingleAppDomain, _TEXT
+
+
+// ------------------------------------------------------------------
+// void* JIT_GetSharedGCStaticBase(SIZE_T moduleDomainID, DWORD dwClassDomainID)
+
+LEAF_ENTRY JIT_GetSharedGCStaticBase_SingleAppDomain, _TEXT
+ // If class is not initialized, bail to C++ helper
+ add x2, x0, #DomainLocalModule__m_pDataBlob
+ ldrb w2, [x2, w1, UXTW]
+ tst w2, #1
+ beq LOCAL_LABEL(JIT_GetSharedGCStaticBase_SingleAppDomain_CallHelper)
+
+ ldr x0, [x0, #DomainLocalModule__m_pGCStatics]
+ ret lr
+
+LOCAL_LABEL(JIT_GetSharedGCStaticBase_SingleAppDomain_CallHelper):
+ // Tail call Jit_GetSharedGCStaticBase_Helper
+ b C_FUNC(JIT_GetSharedGCStaticBase_Helper)
+LEAF_END JIT_GetSharedGCStaticBase_SingleAppDomain, _TEXT
+
+
+// ------------------------------------------------------------------
+// void* JIT_GetSharedGCStaticBaseNoCtor(SIZE_T moduleDomainID, DWORD dwClassDomainID)
+
+LEAF_ENTRY JIT_GetSharedGCStaticBaseNoCtor_SingleAppDomain, _TEXT
+ ldr x0, [x0, #DomainLocalModule__m_pGCStatics]
+ ret lr
+LEAF_END JIT_GetSharedGCStaticBaseNoCtor_SingleAppDomain, _TEXT
diff --git a/src/vm/arm64/asmhelpers.asm b/src/vm/arm64/asmhelpers.asm
index e8b16ded6a..24b26eb1c9 100644
--- a/src/vm/arm64/asmhelpers.asm
+++ b/src/vm/arm64/asmhelpers.asm
@@ -52,6 +52,9 @@
IMPORT $g_GCShadowEnd
#endif // WRITE_BARRIER_CHECK
+ IMPORT JIT_GetSharedNonGCStaticBase_Helper
+ IMPORT JIT_GetSharedGCStaticBase_Helper
+
TEXTAREA
;; LPVOID __stdcall GetCurrentIP(void);
@@ -1326,5 +1329,62 @@ Fail
LEAF_END
#endif
+;
+; JIT Static access helpers when coreclr host specifies single appdomain flag
+;
+
+; ------------------------------------------------------------------
+; void* JIT_GetSharedNonGCStaticBase(SIZE_T moduleDomainID, DWORD dwClassDomainID)
+
+ LEAF_ENTRY JIT_GetSharedNonGCStaticBase_SingleAppDomain
+ ; If class is not initialized, bail to C++ helper
+ add x2, x0, #DomainLocalModule__m_pDataBlob
+ ldrb w2, [x2, w1]
+ tst w2, #1
+ beq CallHelper1
+
+ ret lr
+
+CallHelper1
+ ; Tail call JIT_GetSharedNonGCStaticBase_Helper
+ b JIT_GetSharedNonGCStaticBase_Helper
+ LEAF_END
+
+
+; ------------------------------------------------------------------
+; void* JIT_GetSharedNonGCStaticBaseNoCtor(SIZE_T moduleDomainID, DWORD dwClassDomainID)
+
+ LEAF_ENTRY JIT_GetSharedNonGCStaticBaseNoCtor_SingleAppDomain
+ ret lr
+ LEAF_END
+
+
+; ------------------------------------------------------------------
+; void* JIT_GetSharedGCStaticBase(SIZE_T moduleDomainID, DWORD dwClassDomainID)
+
+ LEAF_ENTRY JIT_GetSharedGCStaticBase_SingleAppDomain
+ ; If class is not initialized, bail to C++ helper
+ add x2, x0, #DomainLocalModule__m_pDataBlob
+ ldrb w2, [x2, w1]
+ tst w2, #1
+ beq CallHelper2
+
+ ldr x0, [x0, #DomainLocalModule__m_pGCStatics]
+ ret lr
+
+CallHelper2
+ ; Tail call Jit_GetSharedGCStaticBase_Helper
+ b JIT_GetSharedGCStaticBase_Helper
+ LEAF_END
+
+
+; ------------------------------------------------------------------
+; void* JIT_GetSharedGCStaticBaseNoCtor(SIZE_T moduleDomainID, DWORD dwClassDomainID)
+
+ LEAF_ENTRY JIT_GetSharedGCStaticBaseNoCtor_SingleAppDomain
+ ldr x0, [x0, #DomainLocalModule__m_pGCStatics]
+ ret lr
+ LEAF_END
+
; Must be at very end of file
END
diff --git a/src/vm/arm64/stubs.cpp b/src/vm/arm64/stubs.cpp
index f56f6ab625..0c7eb4dfba 100644
--- a/src/vm/arm64/stubs.cpp
+++ b/src/vm/arm64/stubs.cpp
@@ -15,6 +15,11 @@
#include "virtualcallstub.h"
#include "jitinterface.h"
+EXTERN_C void JIT_GetSharedNonGCStaticBase_SingleAppDomain();
+EXTERN_C void JIT_GetSharedNonGCStaticBaseNoCtor_SingleAppDomain();
+EXTERN_C void JIT_GetSharedGCStaticBase_SingleAppDomain();
+EXTERN_C void JIT_GetSharedGCStaticBaseNoCtor_SingleAppDomain();
+
#ifndef DACCESS_COMPILE
//-----------------------------------------------------------------------
// InstructionFormat for B.cond
@@ -1078,10 +1083,18 @@ void JIT_TailCall()
_ASSERTE(!"ARM64:NYI");
}
+#if !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE)
void InitJITHelpers1()
{
- return;
+ if(IsSingleAppDomain())
+ {
+ SetJitHelperFunction(CORINFO_HELP_GETSHARED_GCSTATIC_BASE, JIT_GetSharedGCStaticBase_SingleAppDomain);
+ SetJitHelperFunction(CORINFO_HELP_GETSHARED_NONGCSTATIC_BASE, JIT_GetSharedNonGCStaticBase_SingleAppDomain);
+ SetJitHelperFunction(CORINFO_HELP_GETSHARED_GCSTATIC_BASE_NOCTOR, JIT_GetSharedGCStaticBaseNoCtor_SingleAppDomain);
+ SetJitHelperFunction(CORINFO_HELP_GETSHARED_NONGCSTATIC_BASE_NOCTOR,JIT_GetSharedNonGCStaticBaseNoCtor_SingleAppDomain);
+ }
}
+#endif // !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE)
EXTERN_C void __stdcall ProfileEnterNaked(UINT_PTR clientData)
{
diff --git a/src/vm/assembly.cpp b/src/vm/assembly.cpp
index 75430644c3..92c1ebd817 100644
--- a/src/vm/assembly.cpp
+++ b/src/vm/assembly.cpp
@@ -1849,10 +1849,7 @@ HRESULT RunMain(MethodDesc *pFD ,
else
{
*pParam->piRetVal = (INT32)threadStart.Call_RetArgSlot(&stackVar);
- if (pParam->stringArgs == NULL)
- {
- SetLatchedExitCode(*pParam->piRetVal);
- }
+ SetLatchedExitCode(*pParam->piRetVal);
}
GCPROTECT_END();
diff --git a/src/vm/callingconvention.h b/src/vm/callingconvention.h
index cde2ba465a..b707b4bc8c 100644
--- a/src/vm/callingconvention.h
+++ b/src/vm/callingconvention.h
@@ -34,21 +34,26 @@ BOOL IsRetBuffPassedAsFirstArg();
// and possibly on to the stack as well.
struct ArgLocDesc
{
- int m_idxFloatReg; // First floating point register used (or -1)
- int m_cFloatReg; // Count of floating point registers used (or 0)
+ int m_idxFloatReg; // First floating point register used (or -1)
+ int m_cFloatReg; // Count of floating point registers used (or 0)
- int m_idxGenReg; // First general register used (or -1)
- int m_cGenReg; // Count of general registers used (or 0)
+ int m_idxGenReg; // First general register used (or -1)
+ int m_cGenReg; // Count of general registers used (or 0)
- int m_idxStack; // First stack slot used (or -1)
- int m_cStack; // Count of stack slots used (or 0)
+ int m_idxStack; // First stack slot used (or -1)
+ int m_cStack; // Count of stack slots used (or 0)
#if defined(UNIX_AMD64_ABI) && defined(FEATURE_UNIX_AMD64_STRUCT_PASSING)
- EEClass* m_eeClass; // For structs passed in register, it points to the EEClass of the struct
+ EEClass* m_eeClass; // For structs passed in register, it points to the EEClass of the struct
#endif // UNIX_AMD64_ABI && FEATURE_UNIX_AMD64_STRUCT_PASSING
+#if defined(_TARGET_ARM64_)
+ bool m_isSinglePrecision; // For determining if HFA is single or double
+ // precision
+#endif // defined(_TARGET_ARM64_)
+
#if defined(_TARGET_ARM_)
BOOL m_fRequires64BitAlignment; // True if the argument should always be aligned (in registers or on the stack
#endif
@@ -70,6 +75,9 @@ struct ArgLocDesc
#if defined(_TARGET_ARM_)
m_fRequires64BitAlignment = FALSE;
#endif
+#if defined(_TARGET_ARM64_)
+ m_isSinglePrecision = FALSE;
+#endif // defined(_TARGET_ARM64_)
#if defined(UNIX_AMD64_ABI) && defined(FEATURE_UNIX_AMD64_STRUCT_PASSING)
m_eeClass = NULL;
#endif
@@ -490,7 +498,7 @@ public:
ArgLocDesc* GetArgLocDescForStructInRegs()
{
-#if defined(UNIX_AMD64_ABI) && defined(FEATURE_UNIX_AMD64_STRUCT_PASSING)
+#if (defined(UNIX_AMD64_ABI) && defined(FEATURE_UNIX_AMD64_STRUCT_PASSING)) || defined (_TARGET_ARM64_)
return m_hasArgLocDescForStructInRegs ? &m_argLocDescForStructInRegs : NULL;
#else
return NULL;
@@ -556,7 +564,10 @@ public:
if (!m_argTypeHandle.IsNull() && m_argTypeHandle.IsHFA())
{
CorElementType type = m_argTypeHandle.GetHFAType();
- pLoc->m_cFloatReg = (type == ELEMENT_TYPE_R4)? GetArgSize()/sizeof(float): GetArgSize()/sizeof(double);
+ bool isFloatType = (type == ELEMENT_TYPE_R4);
+
+ pLoc->m_cFloatReg = isFloatType ? GetArgSize()/sizeof(float): GetArgSize()/sizeof(double);
+ pLoc->m_isSinglePrecision = isFloatType;
}
else
{
@@ -639,7 +650,7 @@ protected:
CorElementType m_argType;
int m_argSize;
TypeHandle m_argTypeHandle;
-#if defined(_TARGET_AMD64_) && defined(UNIX_AMD64_ABI) && defined(FEATURE_UNIX_AMD64_STRUCT_PASSING)
+#if (defined(_TARGET_AMD64_) && defined(UNIX_AMD64_ABI) && defined(FEATURE_UNIX_AMD64_STRUCT_PASSING)) || defined(_TARGET_ARM64_)
ArgLocDesc m_argLocDescForStructInRegs;
bool m_hasArgLocDescForStructInRegs;
#endif // _TARGET_AMD64_ && UNIX_AMD64_ABI && FEATURE_UNIX_AMD64_STRUCT_PASSING
@@ -1103,7 +1114,9 @@ int ArgIteratorTemplate<ARGITERATOR_BASE>::GetNextOffset()
// Handle HFAs: packed structures of 1-4 floats or doubles that are passed in FP argument
// registers if possible.
if (thValueType.IsHFA())
+ {
fFloatingPoint = true;
+ }
#endif
break;
@@ -1255,7 +1268,17 @@ int ArgIteratorTemplate<ARGITERATOR_BASE>::GetNextOffset()
if (thValueType.IsHFA())
{
CorElementType type = thValueType.GetHFAType();
+ bool isFloatType = (type == ELEMENT_TYPE_R4);
+
cFPRegs = (type == ELEMENT_TYPE_R4)? (argSize/sizeof(float)): (argSize/sizeof(double));
+
+ m_argLocDescForStructInRegs.Init();
+ m_argLocDescForStructInRegs.m_cFloatReg = cFPRegs;
+ m_argLocDescForStructInRegs.m_idxFloatReg = m_idxFPReg;
+
+ m_argLocDescForStructInRegs.m_isSinglePrecision = isFloatType;
+
+ m_hasArgLocDescForStructInRegs = true;
}
else
{
diff --git a/src/vm/ceemain.cpp b/src/vm/ceemain.cpp
index 6b0c0dfbba..9cce46d2f0 100644
--- a/src/vm/ceemain.cpp
+++ b/src/vm/ceemain.cpp
@@ -869,7 +869,7 @@ void EEStartupHelper(COINITIEE fFlags)
// Initialize remoting
- if (!GCHandleTableUtilities::GetGCHandleTable()->Initialize())
+ if (!GCHandleUtilities::GetGCHandleManager()->Initialize())
{
IfFailGo(E_OUTOFMEMORY);
}
@@ -1880,7 +1880,7 @@ part2:
#ifdef SHOULD_WE_CLEANUP
if (!g_fFastExitProcess)
{
- GCHandleTableUtilities::GetGCHandleTable()->Shutdown();
+ GCHandleUtilities::GetGCHandleManager()->Shutdown();
}
#endif /* SHOULD_WE_CLEANUP */
@@ -2386,7 +2386,7 @@ BOOL CanRunManagedCode(LoaderLockCheck::kind checkKind, HINSTANCE hInst /*= 0*/)
// no longer maintains a ref count since the EE doesn't support being
// unloaded and re-loaded. It simply ensures the EE has been started.
// ---------------------------------------------------------------------------
-HRESULT STDMETHODCALLTYPE CoInitializeEE(DWORD fFlags)
+HRESULT STDAPICALLTYPE CoInitializeEE(DWORD fFlags)
{
CONTRACTL
{
@@ -2417,7 +2417,7 @@ HRESULT STDMETHODCALLTYPE CoInitializeEE(DWORD fFlags)
// Description:
// Must be called by client on shut down in order to free up the system.
// ---------------------------------------------------------------------------
-void STDMETHODCALLTYPE CoUninitializeEE(BOOL fIsDllUnloading)
+void STDAPICALLTYPE CoUninitializeEE(BOOL fIsDllUnloading)
{
LIMITED_METHOD_CONTRACT;
//BEGIN_ENTRYPOINT_VOIDRET;
@@ -2483,17 +2483,17 @@ void InitializeGarbageCollector()
IGCToCLR* gcToClr = nullptr;
#endif
- IGCHandleTable *pGcHandleTable;
+ IGCHandleManager *pGcHandleManager;
IGCHeap *pGCHeap;
- if (!InitializeGarbageCollector(gcToClr, &pGCHeap, &pGcHandleTable, &g_gc_dac_vars))
+ if (!InitializeGarbageCollector(gcToClr, &pGCHeap, &pGcHandleManager, &g_gc_dac_vars))
{
ThrowOutOfMemory();
}
assert(pGCHeap != nullptr);
g_pGCHeap = pGCHeap;
- g_pGCHandleTable = pGcHandleTable;
+ g_pGCHandleManager = pGcHandleManager;
g_gcDacGlobals = &g_gc_dac_vars;
// Apparently the Windows linker removes global variables if they are never
diff --git a/src/vm/codeman.cpp b/src/vm/codeman.cpp
index 73b4c06565..a30e70e7fa 100644
--- a/src/vm/codeman.cpp
+++ b/src/vm/codeman.cpp
@@ -3177,8 +3177,8 @@ void EEJitManager::RemoveJitData (CodeHeader * pCHdr, size_t GCinfo_len, size_t
LCGMethodResolver * pResolver = pMD->AsDynamicMethodDesc()->GetLCGMethodResolver();
- // Clear the pointer only if it matches what we are about to free. There may be cases where the JIT is reentered and
- // the method JITed multiple times.
+ // Clear the pointer only if it matches what we are about to free.
+ // There can be cases where the JIT is reentered and we JITed the method multiple times.
if (pResolver->m_recordCodePointer == codeStart)
pResolver->m_recordCodePointer = NULL;
}
@@ -4885,7 +4885,7 @@ void ExecutionManager::Unload(LoaderAllocator *pLoaderAllocator)
*/
StackwalkCache::Invalidate(pLoaderAllocator);
- JumpStubCache * pJumpStubCache = (JumpStubCache *)pLoaderAllocator->m_pJumpStubCache;
+ JumpStubCache * pJumpStubCache = (JumpStubCache *) pLoaderAllocator->m_pJumpStubCache;
if (pJumpStubCache != NULL)
{
delete pJumpStubCache;
@@ -4954,18 +4954,33 @@ PCODE ExecutionManager::jumpStub(MethodDesc* pMD, PCODE target,
PCODE jumpStub = NULL;
if (pLoaderAllocator == NULL)
+ {
pLoaderAllocator = pMD->GetLoaderAllocatorForCode();
+ }
_ASSERTE(pLoaderAllocator != NULL);
- bool isLCG = pMD && pMD->IsLCGMethod();
+ bool isLCG = pMD && pMD->IsLCGMethod();
+ LCGMethodResolver * pResolver = nullptr;
+ JumpStubCache * pJumpStubCache = (JumpStubCache *) pLoaderAllocator->m_pJumpStubCache;
- CrstHolder ch(&m_JumpStubCrst);
+ if (isLCG)
+ {
+ pResolver = pMD->AsDynamicMethodDesc()->GetLCGMethodResolver();
+ pJumpStubCache = pResolver->m_pJumpStubCache;
+ }
- JumpStubCache * pJumpStubCache = (JumpStubCache *)pLoaderAllocator->m_pJumpStubCache;
+ CrstHolder ch(&m_JumpStubCrst);
if (pJumpStubCache == NULL)
{
pJumpStubCache = new JumpStubCache();
- pLoaderAllocator->m_pJumpStubCache = pJumpStubCache;
+ if (isLCG)
+ {
+ pResolver->m_pJumpStubCache = pJumpStubCache;
+ }
+ else
+ {
+ pLoaderAllocator->m_pJumpStubCache = pJumpStubCache;
+ }
}
if (isLCG)
@@ -5018,9 +5033,19 @@ PCODE ExecutionManager::getNextJumpStub(MethodDesc* pMD, PCODE target,
POSTCONDITION(RETVAL != NULL);
} CONTRACT_END;
- BYTE * jumpStub = NULL;
- bool isLCG = pMD && pMD->IsLCGMethod();
- JumpStubBlockHeader ** ppHead = isLCG ? &(pMD->AsDynamicMethodDesc()->GetLCGMethodResolver()->m_jumpStubBlock) : &(((JumpStubCache *)(pLoaderAllocator->m_pJumpStubCache))->m_pBlocks);
+ DWORD numJumpStubs = DEFAULT_JUMPSTUBS_PER_BLOCK; // a block of 32 JumpStubs
+ BYTE * jumpStub = NULL;
+ bool isLCG = pMD && pMD->IsLCGMethod();
+ JumpStubCache * pJumpStubCache = (JumpStubCache *) pLoaderAllocator->m_pJumpStubCache;
+
+ if (isLCG)
+ {
+ LCGMethodResolver * pResolver;
+ pResolver = pMD->AsDynamicMethodDesc()->GetLCGMethodResolver();
+ pJumpStubCache = pResolver->m_pJumpStubCache;
+ }
+
+ JumpStubBlockHeader ** ppHead = &(pJumpStubCache->m_pBlocks);
JumpStubBlockHeader * curBlock = *ppHead;
// allocate a new jumpstub from 'curBlock' if it is not fully allocated
@@ -5039,7 +5064,6 @@ PCODE ExecutionManager::getNextJumpStub(MethodDesc* pMD, PCODE target,
goto DONE;
}
}
-
curBlock = curBlock->m_next;
}
@@ -5047,6 +5071,24 @@ PCODE ExecutionManager::getNextJumpStub(MethodDesc* pMD, PCODE target,
if (isLCG)
{
+ // For LCG we request a small block of 4 jumpstubs, because we can not share them
+ // with any other methods and very frequently our method only needs one jump stub.
+ // Using 4 gives a request size of (32 + 4*12) or 80 bytes.
+ // Also note that request sizes are rounded up to a multiples of 16.
+ // The request size is calculated into 'blockSize' in allocJumpStubBlock.
+ // For x64 the value of BACK_TO_BACK_JUMP_ALLOCATE_SIZE is 12 bytes
+ // and the sizeof(JumpStubBlockHeader) is 32.
+ //
+
+ numJumpStubs = 4;
+
+#ifdef _TARGET_AMD64_
+ // Note this these values are not requirements, instead we are
+ // just confirming the values that are mentioned in the comments.
+ _ASSERTE(BACK_TO_BACK_JUMP_ALLOCATE_SIZE == 12);
+ _ASSERTE(sizeof(JumpStubBlockHeader) == 32);
+#endif
+
// Increment counter of LCG jump stub block allocations
m_LCG_JumpStubBlockAllocCount++;
}
@@ -5056,9 +5098,12 @@ PCODE ExecutionManager::getNextJumpStub(MethodDesc* pMD, PCODE target,
m_normal_JumpStubBlockAllocCount++;
}
- // allocJumpStubBlock will allocate from the LoaderCodeHeap for normal methods and HostCodeHeap for LCG methods
- // this can throw an OM exception
- curBlock = ExecutionManager::GetEEJitManager()->allocJumpStubBlock(pMD, DEFAULT_JUMPSTUBS_PER_BLOCK, loAddr, hiAddr, pLoaderAllocator);
+ // allocJumpStubBlock will allocate from the LoaderCodeHeap for normal methods
+ // and will alocate from a HostCodeHeap for LCG methods.
+ //
+ // note that this can throw an OOM exception
+
+ curBlock = ExecutionManager::GetEEJitManager()->allocJumpStubBlock(pMD, numJumpStubs, loAddr, hiAddr, pLoaderAllocator);
jumpStub = (BYTE *) curBlock + sizeof(JumpStubBlockHeader) + ((size_t) curBlock->m_used * BACK_TO_BACK_JUMP_ALLOCATE_SIZE);
@@ -5078,25 +5123,16 @@ DONE:
emitBackToBackJump(jumpStub, (void*) target);
- if (isLCG)
- {
- // always get a new jump stub for LCG method
- // We don't share jump stubs among different LCG methods so that the jump stubs used
- // by every LCG method can be cleaned up individually
- // There is not much benefit to share jump stubs within one LCG method anyway.
- }
- else
- {
- JumpStubCache * pJumpStubCache = (JumpStubCache *)pLoaderAllocator->m_pJumpStubCache;
- _ASSERTE(pJumpStubCache != NULL);
+ // We always add the new jumpstub to the jumpStubCache
+ //
+ _ASSERTE(pJumpStubCache != NULL);
- JumpStubEntry entry;
+ JumpStubEntry entry;
- entry.m_target = target;
- entry.m_jumpStub = (PCODE)jumpStub;
+ entry.m_target = target;
+ entry.m_jumpStub = (PCODE)jumpStub;
- pJumpStubCache->m_Table.Add(entry);
- }
+ pJumpStubCache->m_Table.Add(entry);
curBlock->m_used++; // record that we have used up one more jumpStub in the block
@@ -5556,9 +5592,9 @@ BOOL NativeImageJitManager::JitCodeToMethodInfo(RangeSection * pRangeSection,
g_IBCLogger.LogMethodCodeAccess(*ppMethodDesc);
}
- //Get the function entry that corresponds to the real method desc.
+ // Get the function entry that corresponds to the real method desc.
_ASSERTE((RelativePc >= RUNTIME_FUNCTION__BeginAddress(FunctionEntry)));
-
+
if (pCodeInfo)
{
pCodeInfo->m_relOffset = (DWORD)
diff --git a/src/vm/codeman.h b/src/vm/codeman.h
index 5fbddea875..9d7ed4d62f 100644
--- a/src/vm/codeman.h
+++ b/src/vm/codeman.h
@@ -1490,6 +1490,7 @@ private:
static unsigned m_LCG_JumpStubBlockAllocCount;
static unsigned m_LCG_JumpStubBlockFullCount;
+public:
struct JumpStubCache
{
JumpStubCache()
diff --git a/src/vm/compile.cpp b/src/vm/compile.cpp
index 09925cd219..91615851c7 100644
--- a/src/vm/compile.cpp
+++ b/src/vm/compile.cpp
@@ -3140,8 +3140,8 @@ HRESULT NGenModulePdbWriter::WritePDBData()
SString dllPath = pLoadedLayout->GetPath();
if (!dllPath.EndsWithCaseInsensitive(L".ni.dll") && !dllPath.EndsWithCaseInsensitive(L".ni.exe"))
{
- SString::Iterator fileNameStart = dllPath.Begin();
- dllPath.FindBack(fileNameStart, '\\');
+ SString::Iterator fileNameStart = dllPath.End();
+ dllPath.FindBack(fileNameStart, DIRECTORY_SEPARATOR_STR_W);
SString::Iterator ext = dllPath.End();
dllPath.FindBack(ext, '.');
diff --git a/src/vm/corhost.cpp b/src/vm/corhost.cpp
index 75adbada94..fd27a7a4e7 100644
--- a/src/vm/corhost.cpp
+++ b/src/vm/corhost.cpp
@@ -75,7 +75,7 @@ SVAL_IMPL_INIT(ECustomDumpFlavor, CCLRErrorReportingManager, g_ECustomDumpFlavor
#ifndef DACCESS_COMPILE
extern void STDMETHODCALLTYPE EEShutDown(BOOL fIsDllUnloading);
-extern HRESULT STDMETHODCALLTYPE CoInitializeEE(DWORD fFlags);
+extern HRESULT STDAPICALLTYPE CoInitializeEE(DWORD fFlags);
extern void PrintToStdOutA(const char *pszString);
extern void PrintToStdOutW(const WCHAR *pwzString);
extern BOOL g_fEEHostedStartup;
@@ -1201,6 +1201,11 @@ HRESULT GetCLRRuntimeHost(REFIID riid, IUnknown **ppUnk)
STDMETHODIMP CorHost2::UnloadAppDomain(DWORD dwDomainId, BOOL fWaitUntilDone)
{
+ return UnloadAppDomain2(dwDomainId, fWaitUntilDone, nullptr);
+}
+
+STDMETHODIMP CorHost2::UnloadAppDomain2(DWORD dwDomainId, BOOL fWaitUntilDone, int *pLatchedExitCode)
+{
WRAPPER_NO_CONTRACT;
STATIC_CONTRACT_SO_TOLERANT;
@@ -1249,14 +1254,23 @@ STDMETHODIMP CorHost2::UnloadAppDomain(DWORD dwDomainId, BOOL fWaitUntilDone)
}
END_ENTRYPOINT_NOTHROW;
+ if (pLatchedExitCode)
+ {
+ *pLatchedExitCode = GetLatchedExitCode();
+ }
+
return hr;
}
- else
- return CorRuntimeHostBase::UnloadAppDomain(dwDomainId, fWaitUntilDone);
+ return CorRuntimeHostBase::UnloadAppDomain2(dwDomainId, fWaitUntilDone, pLatchedExitCode);
}
-HRESULT CorRuntimeHostBase::UnloadAppDomain(DWORD dwDomainId, BOOL fSync)
+HRESULT CorRuntimeHostBase::UnloadAppDomain(DWORD dwDomainId, BOOL fWaitUntilDone)
+{
+ return UnloadAppDomain2(dwDomainId, fWaitUntilDone, nullptr);
+}
+
+HRESULT CorRuntimeHostBase::UnloadAppDomain2(DWORD dwDomainId, BOOL fWaitUntilDone, int *pLatchedExitCode)
{
CONTRACTL
{
@@ -1282,7 +1296,7 @@ HRESULT CorRuntimeHostBase::UnloadAppDomain(DWORD dwDomainId, BOOL fSync)
//
// However, for a thread that holds the loader lock, unloading the appDomain is
// not a supported scenario. Thus, we should not be ending up in this code
- // path for the FAULT violation.
+ // path for the FAULT violation.
//
// Hence, the CONTRACT_VIOLATION below for overriding the FORBID_FAULT
// for this scope only.
@@ -1292,18 +1306,23 @@ HRESULT CorRuntimeHostBase::UnloadAppDomain(DWORD dwDomainId, BOOL fSync)
)
{
return HOST_E_CLRNOTAVAILABLE;
- }
+ }
}
-
+
BEGIN_ENTRYPOINT_NOTHROW;
// We do not use BEGIN_EXTERNAL_ENTRYPOINT here because
// we do not want to setup Thread. Process may be OOM, and we want Unload
// to work.
- hr = AppDomain::UnloadById(ADID(dwDomainId), fSync);
+ hr = AppDomain::UnloadById(ADID(dwDomainId), fWaitUntilDone);
END_ENTRYPOINT_NOTHROW;
+ if (pLatchedExitCode)
+ {
+ *pLatchedExitCode = GetLatchedExitCode();
+ }
+
return hr;
}
@@ -1404,6 +1423,14 @@ HRESULT CorHost2::QueryInterface(REFIID riid, void **ppUnk)
*ppUnk = static_cast<ICLRRuntimeHost2 *>(this);
}
+ else if (riid == IID_ICLRRuntimeHost4)
+ {
+ ULONG version = 4;
+ if (m_Version == 0)
+ FastInterlockCompareExchange((LONG*)&m_Version, version, 0);
+
+ *ppUnk = static_cast<ICLRRuntimeHost4 *>(this);
+ }
else if (riid == IID_ICLRExecutionManager)
{
ULONG version = 2;
diff --git a/src/vm/dynamicmethod.cpp b/src/vm/dynamicmethod.cpp
index 3eec125247..2a61f97afd 100644
--- a/src/vm/dynamicmethod.cpp
+++ b/src/vm/dynamicmethod.cpp
@@ -917,7 +917,7 @@ void LCGMethodResolver::Reset()
m_DynamicStringLiterals = NULL;
m_recordCodePointer = NULL;
m_UsedIndCellList = NULL;
- m_jumpStubBlock = NULL;
+ m_pJumpStubCache = NULL;
m_next = NULL;
m_Code = NULL;
}
@@ -1035,19 +1035,24 @@ void LCGMethodResolver::Destroy(BOOL fDomainUnload)
m_recordCodePointer = NULL;
}
- JumpStubBlockHeader* current = m_jumpStubBlock;
- JumpStubBlockHeader* next;
- while (current)
+ if (m_pJumpStubCache != NULL)
{
- next = current->m_next;
+ JumpStubBlockHeader* current = m_pJumpStubCache->m_pBlocks;
+ while (current)
+ {
+ JumpStubBlockHeader* next = current->m_next;
+
+ HostCodeHeap *pHeap = current->GetHostCodeHeap();
+ LOG((LF_BCL, LL_INFO1000, "Level3 - Resolver {0x%p} - Release reference to heap {%p, vt(0x%x)} \n", current, pHeap, *(size_t*)pHeap));
+ pHeap->m_pJitManager->FreeCodeMemory(pHeap, current);
- HostCodeHeap *pHeap = current->GetHostCodeHeap();
- LOG((LF_BCL, LL_INFO1000, "Level3 - Resolver {0x%p} - Release reference to heap {%p, vt(0x%x)} \n", current, pHeap, *(size_t*)pHeap));
- pHeap->m_pJitManager->FreeCodeMemory(pHeap, current);
+ current = next;
+ }
+ m_pJumpStubCache->m_pBlocks = NULL;
- current = next;
+ delete m_pJumpStubCache;
+ m_pJumpStubCache = NULL;
}
- m_jumpStubBlock = NULL;
if (m_managedResolver)
{
diff --git a/src/vm/dynamicmethod.h b/src/vm/dynamicmethod.h
index a96200ba4f..f9a92b0af0 100644
--- a/src/vm/dynamicmethod.h
+++ b/src/vm/dynamicmethod.h
@@ -107,6 +107,7 @@ class LCGMethodResolver : public DynamicResolver
friend class ExecutionManager;
friend class EEJitManager;
friend class HostCodeHeap;
+ friend struct ExecutionManager::JumpStubCache;
public:
void Destroy(BOOL fDomainUnload = FALSE);
@@ -162,7 +163,7 @@ private:
ChunkAllocator m_jitTempData;
DynamicStringLiteral* m_DynamicStringLiterals;
IndCellList * m_UsedIndCellList; // list to keep track of all the indirection cells used by the jitted code
- JumpStubBlockHeader* m_jumpStubBlock;
+ ExecutionManager::JumpStubCache * m_pJumpStubCache;
}; // class LCGMethodResolver
//---------------------------------------------------------------------------------------
diff --git a/src/vm/ecalllist.h b/src/vm/ecalllist.h
index 6ed29b8611..5c3e5f82ba 100644
--- a/src/vm/ecalllist.h
+++ b/src/vm/ecalllist.h
@@ -946,6 +946,7 @@ FCFuncStart(gInteropMarshalFuncs)
FCFuncElement("DestroyStructure", MarshalNative::DestroyStructure)
FCFuncElement("UnsafeAddrOfPinnedArrayElement", MarshalNative::FCUnsafeAddrOfPinnedArrayElement)
FCFuncElement("GetExceptionCode", ExceptionNative::GetExceptionCode)
+ FCFuncElement("GetExceptionPointers", ExceptionNative::GetExceptionPointers)
QCFuncElement("GetHINSTANCE", COMModule::GetHINSTANCE)
FCFuncElement("OffsetOfHelper", MarshalNative::OffsetOfHelper)
diff --git a/src/vm/eetwain.cpp b/src/vm/eetwain.cpp
index 2886daa8f6..4a02be7b82 100644
--- a/src/vm/eetwain.cpp
+++ b/src/vm/eetwain.cpp
@@ -4368,7 +4368,6 @@ bool EECodeManager::EnumGcRefs( PREGDISPLAY pContext,
}
}
-
bool willContinueExecution = !(flags & ExecutionAborted);
unsigned pushedSize = 0;
@@ -4663,60 +4662,69 @@ bool EECodeManager::EnumGcRefs( PREGDISPLAY pContext,
/* Process the untracked frame variable table */
- count = info.untrackedCnt;
- int lastStkOffs = 0;
- while (count-- > 0)
+#if defined(WIN64EXCEPTIONS) // funclets
+ // Filters are the only funclet that run during the 1st pass, and must have
+ // both the leaf and the parent frame reported. In order to avoid double
+ // reporting of the untracked variables, do not report them for the filter.
+ if (!pCodeInfo->GetJitManager()->IsFilterFunclet(pCodeInfo))
+#endif // WIN64EXCEPTIONS
{
- int stkOffs = fastDecodeSigned(table);
- stkOffs = lastStkOffs - stkOffs;
- lastStkOffs = stkOffs;
-
- _ASSERTE(0 == ~OFFSET_MASK % sizeof(void*));
-
- lowBits = OFFSET_MASK & stkOffs;
- stkOffs &= ~OFFSET_MASK;
-
- ptrAddr = argBase + stkOffs;
- if (info.doubleAlign && stkOffs >= int(info.stackSize - sizeof(void*))) {
- // We encode the arguments as if they were ESP based variables even though they aren't
- // If this frame would have ben an ESP based frame, This fake frame is one DWORD
- // smaller than the real frame because it did not push EBP but the real frame did.
- // Thus to get the correct EBP relative offset we have to ajust by info.stackSize-sizeof(void*)
- ptrAddr = EBP + (stkOffs-(info.stackSize - sizeof(void*)));
- }
+ count = info.untrackedCnt;
+ int lastStkOffs = 0;
+ while (count-- > 0)
+ {
+ int stkOffs = fastDecodeSigned(table);
+ stkOffs = lastStkOffs - stkOffs;
+ lastStkOffs = stkOffs;
+
+ _ASSERTE(0 == ~OFFSET_MASK % sizeof(void*));
+
+ lowBits = OFFSET_MASK & stkOffs;
+ stkOffs &= ~OFFSET_MASK;
+
+ ptrAddr = argBase + stkOffs;
+ if (info.doubleAlign && stkOffs >= int(info.stackSize - sizeof(void*))) {
+ // We encode the arguments as if they were ESP based variables even though they aren't
+ // If this frame would have ben an ESP based frame, This fake frame is one DWORD
+ // smaller than the real frame because it did not push EBP but the real frame did.
+ // Thus to get the correct EBP relative offset we have to ajust by info.stackSize-sizeof(void*)
+ ptrAddr = EBP + (stkOffs-(info.stackSize - sizeof(void*)));
+ }
#ifdef _DEBUG
- if (dspPtr)
- {
- printf(" Untracked %s%s local at [E",
- (lowBits & pinned_OFFSET_FLAG) ? "pinned " : "",
- (lowBits & byref_OFFSET_FLAG) ? "byref" : "");
+ if (dspPtr)
+ {
+ printf(" Untracked %s%s local at [E",
+ (lowBits & pinned_OFFSET_FLAG) ? "pinned " : "",
+ (lowBits & byref_OFFSET_FLAG) ? "byref" : "");
- int dspOffs = ptrAddr;
- char frameType;
+ int dspOffs = ptrAddr;
+ char frameType;
- if (info.ebpFrame) {
- dspOffs -= EBP;
- frameType = 'B';
- }
- else {
- dspOffs -= ESP;
- frameType = 'S';
+ if (info.ebpFrame) {
+ dspOffs -= EBP;
+ frameType = 'B';
+ }
+ else {
+ dspOffs -= ESP;
+ frameType = 'S';
+ }
+
+ if (dspOffs < 0)
+ printf("%cP-%02XH]: ", frameType, -dspOffs);
+ else
+ printf("%cP+%02XH]: ", frameType, +dspOffs);
}
+#endif
- if (dspOffs < 0)
- printf("%cP-%02XH]: ", frameType, -dspOffs);
- else
- printf("%cP+%02XH]: ", frameType, +dspOffs);
+ _ASSERTE((pinned_OFFSET_FLAG == GC_CALL_PINNED) &&
+ (byref_OFFSET_FLAG == GC_CALL_INTERIOR));
+ pCallBack(hCallBack, (OBJECTREF*)(size_t)ptrAddr, lowBits | CHECK_APP_DOMAIN
+ DAC_ARG(DacSlotLocation(info.ebpFrame ? REGI_EBP : REGI_ESP,
+ info.ebpFrame ? EBP - ptrAddr : ptrAddr - ESP,
+ true)));
}
-#endif
- _ASSERTE((pinned_OFFSET_FLAG == GC_CALL_PINNED) &&
- (byref_OFFSET_FLAG == GC_CALL_INTERIOR));
- pCallBack(hCallBack, (OBJECTREF*)(size_t)ptrAddr, lowBits | CHECK_APP_DOMAIN
- DAC_ARG(DacSlotLocation(info.ebpFrame ? REGI_EBP : REGI_ESP,
- info.ebpFrame ? EBP - ptrAddr : ptrAddr - ESP,
- true)));
}
#if VERIFY_GC_TABLES
diff --git a/src/vm/exceptionhandling.cpp b/src/vm/exceptionhandling.cpp
index 31b85bdb0a..7030ef5e91 100644
--- a/src/vm/exceptionhandling.cpp
+++ b/src/vm/exceptionhandling.cpp
@@ -135,7 +135,7 @@ void FixContext(PCONTEXT pContextRecord)
#ifdef _TARGET_X86_
size_t resumeSp = EECodeManager::GetResumeSp(pContextRecord);
- FIXUPREG(ResumeEsp, resumeSp);
+ FIXUPREG(Esp, resumeSp);
#endif // _TARGET_X86_
#undef FIXUPREG
@@ -1011,6 +1011,10 @@ ProcessCLRException(IN PEXCEPTION_RECORD pExceptionRecord
CEHelper::SetupCorruptionSeverityForActiveException((STState == ExceptionTracker::STS_FirstRethrowFrame), (pTracker->GetPreviousExceptionTracker() != NULL),
CEHelper::ShouldTreatActiveExceptionAsNonCorrupting());
}
+
+ // Failfast if exception indicates corrupted process state
+ if (pTracker->GetCorruptionSeverity() == ProcessCorrupting)
+ EEPOLICY_HANDLE_FATAL_ERROR(pExceptionRecord->ExceptionCode);
}
#endif // FEATURE_CORRUPTING_EXCEPTIONS
@@ -1071,9 +1075,11 @@ ProcessCLRException(IN PEXCEPTION_RECORD pExceptionRecord
CLRUnwindStatus status;
+#ifdef USE_PER_FRAME_PINVOKE_INIT
// Refer to comment in ProcessOSExceptionNotification about ICF and codegen difference.
- ARM_ONLY(InlinedCallFrame *pICFSetAsLimitFrame = NULL;)
-
+ InlinedCallFrame *pICFSetAsLimitFrame = NULL;
+#endif // USE_PER_FRAME_PINVOKE_INIT
+
status = pTracker->ProcessOSExceptionNotification(
pExceptionRecord,
pContextRecord,
@@ -1081,7 +1087,11 @@ ProcessCLRException(IN PEXCEPTION_RECORD pExceptionRecord
dwExceptionFlags,
sf,
pThread,
- STState ARM_ARG((PVOID)pICFSetAsLimitFrame));
+ STState
+#ifdef USE_PER_FRAME_PINVOKE_INIT
+ , (PVOID)pICFSetAsLimitFrame
+#endif // USE_PER_FRAME_PINVOKE_INIT
+ );
if (FirstPassComplete == status)
{
@@ -1184,7 +1194,7 @@ ProcessCLRException(IN PEXCEPTION_RECORD pExceptionRecord
CONSISTENCY_CHECK(pLimitFrame > dac_cast<PTR_VOID>(GetSP(pContextRecord)));
-#if defined(_TARGET_ARM_)
+#ifdef USE_PER_FRAME_PINVOKE_INIT
if (pICFSetAsLimitFrame != NULL)
{
_ASSERTE(pICFSetAsLimitFrame == pLimitFrame);
@@ -1196,7 +1206,7 @@ ProcessCLRException(IN PEXCEPTION_RECORD pExceptionRecord
// the next pinvoke callsite does not see the frame as active.
pICFSetAsLimitFrame->Reset();
}
-#endif // defined(_TARGET_ARM_)
+#endif // USE_PER_FRAME_PINVOKE_INIT
pThread->SetFrame(pLimitFrame);
@@ -1653,7 +1663,11 @@ CLRUnwindStatus ExceptionTracker::ProcessOSExceptionNotification(
DWORD dwExceptionFlags,
StackFrame sf,
Thread* pThread,
- StackTraceState STState ARM_ARG(PVOID pICFSetAsLimitFrame))
+ StackTraceState STState
+#ifdef USE_PER_FRAME_PINVOKE_INIT
+ , PVOID pICFSetAsLimitFrame
+#endif // USE_PER_FRAME_PINVOKE_INIT
+)
{
CONTRACTL
{
@@ -1719,10 +1733,10 @@ CLRUnwindStatus ExceptionTracker::ProcessOSExceptionNotification(
this->m_EnclosingClauseInfoForGCReporting.SetEnclosingClauseCallerSP(uCallerSP);
}
-#if defined(_TARGET_ARM_)
+#ifdef USE_PER_FRAME_PINVOKE_INIT
// Refer to detailed comment below.
PTR_Frame pICFForUnwindTarget = NULL;
-#endif // defined(_TARGET_ARM_)
+#endif // USE_PER_FRAME_PINVOKE_INIT
CheckForRudeAbort(pThread, fIsFirstPass);
@@ -1751,7 +1765,7 @@ CLRUnwindStatus ExceptionTracker::ProcessOSExceptionNotification(
while (((UINT_PTR)pFrame) < uCallerSP)
{
-#if defined(_TARGET_ARM_)
+#ifdef USE_PER_FRAME_PINVOKE_INIT
// InlinedCallFrames (ICF) are allocated, initialized and linked to the Frame chain
// by the code generated by the JIT for a method containing a PInvoke.
//
@@ -1956,7 +1970,7 @@ lExit:
if (fTargetUnwind && (status == SecondPassComplete))
{
-#if defined(_TARGET_ARM_)
+#ifdef USE_PER_FRAME_PINVOKE_INIT
// If we have got a ICF to set as the LimitFrame, do that now.
// The Frame chain is still intact and would be updated using
// the LimitFrame (done after the catch handler returns).
@@ -1968,7 +1982,7 @@ lExit:
m_pLimitFrame = pICFForUnwindTarget;
pICFSetAsLimitFrame = (PVOID)pICFForUnwindTarget;
}
-#endif // _TARGET_ARM_
+#endif // USE_PER_FRAME_PINVOKE_INIT
// Since second pass is complete and we have reached
// the frame containing the catch funclet, reset the enclosing
diff --git a/src/vm/exceptionhandling.h b/src/vm/exceptionhandling.h
index 97f1526621..6d1f2b42a8 100644
--- a/src/vm/exceptionhandling.h
+++ b/src/vm/exceptionhandling.h
@@ -10,6 +10,11 @@
#ifdef WIN64EXCEPTIONS
+#if defined(_TARGET_ARM_) || defined(_TARGET_X86_)
+#define USE_PER_FRAME_PINVOKE_INIT
+#endif // _TARGET_ARM_ || _TARGET_X86_
+
+
// This address lies in the NULL pointer partition of the process memory.
// Accessing it will result in AV.
#define INVALID_RESUME_ADDRESS 0x000000000000bad0
@@ -203,7 +208,11 @@ public:
DWORD dwExceptionFlags,
StackFrame sf,
Thread* pThread,
- StackTraceState STState ARM_ARG(PVOID pICFSetAsLimitFrame));
+ StackTraceState STState
+#ifdef USE_PER_FRAME_PINVOKE_INIT
+ , PVOID pICFSetAsLimitFrame
+#endif // USE_PER_FRAME_PINVOKE_INIT
+ );
CLRUnwindStatus ProcessExplicitFrame(
CrawlFrame* pcfThisFrame,
diff --git a/src/vm/exstate.cpp b/src/vm/exstate.cpp
index c598412547..0dc902a1f1 100644
--- a/src/vm/exstate.cpp
+++ b/src/vm/exstate.cpp
@@ -102,7 +102,7 @@ void ThreadExceptionState::FreeAllStackTraces()
}
}
-void ThreadExceptionState::ClearThrowablesForUnload(void* handleStore)
+void ThreadExceptionState::ClearThrowablesForUnload(IGCHandleStore* handleStore)
{
WRAPPER_NO_CONTRACT;
@@ -112,13 +112,11 @@ void ThreadExceptionState::ClearThrowablesForUnload(void* handleStore)
ExInfo* pNode = &m_currentExInfo;
#endif // WIN64EXCEPTIONS
- IGCHandleTable *pHandleTable = GCHandleTableUtilities::GetGCHandleTable();
-
for ( ;
pNode != NULL;
pNode = pNode->m_pPrevNestedInfo)
{
- if (pHandleTable->ContainsHandle(handleStore, pNode->m_hThrowable))
+ if (handleStore->ContainsHandle(pNode->m_hThrowable))
{
pNode->DestroyExceptionHandle();
}
diff --git a/src/vm/exstate.h b/src/vm/exstate.h
index 104c76c77b..ba2ce2dba5 100644
--- a/src/vm/exstate.h
+++ b/src/vm/exstate.h
@@ -56,7 +56,7 @@ class ThreadExceptionState
public:
void FreeAllStackTraces();
- void ClearThrowablesForUnload(void* handleStore);
+ void ClearThrowablesForUnload(IGCHandleStore* handleStore);
#ifdef _DEBUG
typedef enum
diff --git a/src/vm/frames.h b/src/vm/frames.h
index 747cbd6d68..681e566e2b 100644
--- a/src/vm/frames.h
+++ b/src/vm/frames.h
@@ -2330,11 +2330,7 @@ public:
virtual void GcScanRoots(promote_func *fn, ScanContext* sc);
#ifdef _TARGET_X86_
- virtual void UpdateRegDisplay(const PREGDISPLAY pRD)
- {
- WRAPPER_NO_CONTRACT;
- UpdateRegDisplayHelper(pRD, 0);
- }
+ virtual void UpdateRegDisplay(const PREGDISPLAY pRD);
#endif
virtual ETransitionType GetTransitionType()
diff --git a/src/vm/gcenv.ee.cpp b/src/vm/gcenv.ee.cpp
index 54c7991ee9..63c4ffea10 100644
--- a/src/vm/gcenv.ee.cpp
+++ b/src/vm/gcenv.ee.cpp
@@ -1275,9 +1275,17 @@ void GCToEEInterface::StompWriteBarrier(WriteBarrierParameters* args)
// We need to make sure that other threads executing checked write barriers
// will see the g_card_table update before g_lowest/highest_address updates.
// Otherwise, the checked write barrier may AV accessing the old card table
- // with address that it does not cover. Write barriers access card table
- // without memory barriers for performance reasons, so we need to flush
- // the store buffers here.
+ // with address that it does not cover.
+ //
+ // Even x86's total store ordering is insufficient here because threads reading
+ // g_card_table do so via the instruction cache, whereas g_lowest/highest_address
+ // are read via the data cache.
+ //
+ // The g_card_table update is covered by section 8.1.3 of the Intel Software
+ // Development Manual, Volume 3A (System Programming Guide, Part 1), about
+ // "cross-modifying code": We need all _executing_ threads to invalidate
+ // their instruction cache, which FlushProcessWriteBuffers achieves by sending
+ // an IPI (inter-process interrupt).
FlushProcessWriteBuffers();
g_lowest_address = args->lowest_address;
diff --git a/src/vm/gcenv.os.cpp b/src/vm/gcenv.os.cpp
index 6c08558e03..77be88c96d 100644
--- a/src/vm/gcenv.os.cpp
+++ b/src/vm/gcenv.os.cpp
@@ -329,11 +329,7 @@ bool GCToOSInterface::GetCurrentProcessAffinityMask(uintptr_t* processMask, uint
{
LIMITED_METHOD_CONTRACT;
-#ifndef FEATURE_PAL
return !!::GetProcessAffinityMask(GetCurrentProcess(), (PDWORD_PTR)processMask, (PDWORD_PTR)systemMask);
-#else
- return false;
-#endif
}
// Get number of processors assigned to the current process
@@ -700,3 +696,208 @@ void CLRCriticalSection::Leave()
WRAPPER_NO_CONTRACT;
UnsafeLeaveCriticalSection(&m_cs);
}
+
+// An implementatino of GCEvent that delegates to
+// a CLREvent, which in turn delegates to the PAL. This event
+// is also host-aware.
+class GCEvent::Impl
+{
+private:
+ CLREvent m_event;
+
+public:
+ Impl() = default;
+
+ bool IsValid()
+ {
+ WRAPPER_NO_CONTRACT;
+
+ return !!m_event.IsValid();
+ }
+
+ void CloseEvent()
+ {
+ WRAPPER_NO_CONTRACT;
+
+ assert(m_event.IsValid());
+ m_event.CloseEvent();
+ }
+
+ void Set()
+ {
+ WRAPPER_NO_CONTRACT;
+
+ assert(m_event.IsValid());
+ m_event.Set();
+ }
+
+ void Reset()
+ {
+ WRAPPER_NO_CONTRACT;
+
+ assert(m_event.IsValid());
+ m_event.Reset();
+ }
+
+ uint32_t Wait(uint32_t timeout, bool alertable)
+ {
+ WRAPPER_NO_CONTRACT;
+
+ assert(m_event.IsValid());
+ return m_event.Wait(timeout, alertable);
+ }
+
+ bool CreateAutoEvent(bool initialState)
+ {
+ CONTRACTL {
+ NOTHROW;
+ GC_NOTRIGGER;
+ } CONTRACTL_END;
+
+ return !!m_event.CreateAutoEventNoThrow(initialState);
+ }
+
+ bool CreateManualEvent(bool initialState)
+ {
+ CONTRACTL {
+ NOTHROW;
+ GC_NOTRIGGER;
+ } CONTRACTL_END;
+
+ return !!m_event.CreateManualEventNoThrow(initialState);
+ }
+
+ bool CreateOSAutoEvent(bool initialState)
+ {
+ CONTRACTL {
+ NOTHROW;
+ GC_NOTRIGGER;
+ } CONTRACTL_END;
+
+ return !!m_event.CreateOSAutoEventNoThrow(initialState);
+ }
+
+ bool CreateOSManualEvent(bool initialState)
+ {
+ CONTRACTL {
+ NOTHROW;
+ GC_NOTRIGGER;
+ } CONTRACTL_END;
+
+ return !!m_event.CreateOSManualEventNoThrow(initialState);
+ }
+};
+
+GCEvent::GCEvent()
+ : m_impl(nullptr)
+{
+}
+
+void GCEvent::CloseEvent()
+{
+ WRAPPER_NO_CONTRACT;
+
+ assert(m_impl != nullptr);
+ m_impl->CloseEvent();
+}
+
+void GCEvent::Set()
+{
+ WRAPPER_NO_CONTRACT;
+
+ assert(m_impl != nullptr);
+ m_impl->Set();
+}
+
+void GCEvent::Reset()
+{
+ WRAPPER_NO_CONTRACT;
+
+ assert(m_impl != nullptr);
+ m_impl->Reset();
+}
+
+uint32_t GCEvent::Wait(uint32_t timeout, bool alertable)
+{
+ WRAPPER_NO_CONTRACT;
+
+ assert(m_impl != nullptr);
+ return m_impl->Wait(timeout, alertable);
+}
+
+bool GCEvent::CreateManualEventNoThrow(bool initialState)
+{
+ CONTRACTL {
+ NOTHROW;
+ GC_NOTRIGGER;
+ } CONTRACTL_END;
+
+ assert(m_impl == nullptr);
+ NewHolder<GCEvent::Impl> event = new (nothrow) GCEvent::Impl();
+ if (!event)
+ {
+ return false;
+ }
+
+ event->CreateManualEvent(initialState);
+ m_impl = event.Extract();
+ return true;
+}
+
+bool GCEvent::CreateAutoEventNoThrow(bool initialState)
+{
+ CONTRACTL {
+ NOTHROW;
+ GC_NOTRIGGER;
+ } CONTRACTL_END;
+
+ assert(m_impl == nullptr);
+ NewHolder<GCEvent::Impl> event = new (nothrow) GCEvent::Impl();
+ if (!event)
+ {
+ return false;
+ }
+
+ event->CreateAutoEvent(initialState);
+ m_impl = event.Extract();
+ return IsValid();
+}
+
+bool GCEvent::CreateOSAutoEventNoThrow(bool initialState)
+{
+ CONTRACTL {
+ NOTHROW;
+ GC_NOTRIGGER;
+ } CONTRACTL_END;
+
+ assert(m_impl == nullptr);
+ NewHolder<GCEvent::Impl> event = new (nothrow) GCEvent::Impl();
+ if (!event)
+ {
+ return false;
+ }
+
+ event->CreateOSAutoEvent(initialState);
+ m_impl = event.Extract();
+ return IsValid();
+}
+
+bool GCEvent::CreateOSManualEventNoThrow(bool initialState)
+{
+ CONTRACTL {
+ NOTHROW;
+ GC_NOTRIGGER;
+ } CONTRACTL_END;
+
+ assert(m_impl == nullptr);
+ NewHolder<GCEvent::Impl> event = new (nothrow) GCEvent::Impl();
+ if (!event)
+ {
+ return false;
+ }
+
+ event->CreateOSManualEvent(initialState);
+ m_impl = event.Extract();
+ return IsValid();
+}
+
diff --git a/src/vm/gchandletableutilities.h b/src/vm/gchandletableutilities.h
deleted file mode 100644
index 6e32add8ac..0000000000
--- a/src/vm/gchandletableutilities.h
+++ /dev/null
@@ -1,354 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-#ifndef _GCHANDLETABLEUTILITIES_H_
-#define _GCHANDLETABLEUTILITIES_H_
-
-#include "gcinterface.h"
-
-#ifdef FEATURE_COMINTEROP
-#include <weakreference.h>
-#endif
-
-extern "C" IGCHandleTable* g_pGCHandleTable;
-
-class GCHandleTableUtilities
-{
-public:
- // Retrieves the GC handle table.
- static IGCHandleTable* GetGCHandleTable()
- {
- LIMITED_METHOD_CONTRACT;
-
- assert(g_pGCHandleTable != nullptr);
- return g_pGCHandleTable;
- }
-
-private:
- // This class should never be instantiated.
- GCHandleTableUtilities() = delete;
-};
-
-void ValidateHandleAndAppDomain(OBJECTHANDLE handle);
-
-// Given a handle, returns an OBJECTREF for the object it refers to.
-inline OBJECTREF ObjectFromHandle(OBJECTHANDLE handle)
-{
- _ASSERTE(handle);
-
-#ifdef _DEBUG_IMPL
- ValidateHandleAndAppDomain(handle);
-#endif // _DEBUG_IMPL
-
- // Wrap the raw OBJECTREF and return it
- return UNCHECKED_OBJECTREF_TO_OBJECTREF(*PTR_UNCHECKED_OBJECTREF(handle));
-}
-
-// Quick inline check for whether a handle is null
-inline BOOL IsHandleNullUnchecked(OBJECTHANDLE handle)
-{
- LIMITED_METHOD_CONTRACT;
-
- return (handle == NULL || (*(_UNCHECKED_OBJECTREF *)handle) == NULL);
-}
-
-inline BOOL ObjectHandleIsNull(OBJECTHANDLE handle)
-{
- LIMITED_METHOD_CONTRACT;
-
- return *(Object **)handle == NULL;
-}
-
-#ifndef DACCESS_COMPILE
-
-// Handle creation convenience functions
-
-inline OBJECTHANDLE CreateHandle(void* table, OBJECTREF object)
-{
- return GCHandleTableUtilities::GetGCHandleTable()->CreateHandleOfType(table, OBJECTREFToObject(object), HNDTYPE_DEFAULT);
-}
-
-inline OBJECTHANDLE CreateWeakHandle(void* table, OBJECTREF object)
-{
- return GCHandleTableUtilities::GetGCHandleTable()->CreateHandleOfType(table, OBJECTREFToObject(object), HNDTYPE_WEAK_DEFAULT);
-}
-
-inline OBJECTHANDLE CreateShortWeakHandle(void* table, OBJECTREF object)
-{
- return GCHandleTableUtilities::GetGCHandleTable()->CreateHandleOfType(table, OBJECTREFToObject(object), HNDTYPE_WEAK_SHORT);
-}
-
-inline OBJECTHANDLE CreateLongWeakHandle(void* table, OBJECTREF object)
-{
- return GCHandleTableUtilities::GetGCHandleTable()->CreateHandleOfType(table, OBJECTREFToObject(object), HNDTYPE_WEAK_LONG);
-}
-
-inline OBJECTHANDLE CreateStrongHandle(void* table, OBJECTREF object)
-{
- return GCHandleTableUtilities::GetGCHandleTable()->CreateHandleOfType(table, OBJECTREFToObject(object), HNDTYPE_STRONG);
-}
-
-inline OBJECTHANDLE CreatePinningHandle(void* table, OBJECTREF object)
-{
- return GCHandleTableUtilities::GetGCHandleTable()->CreateHandleOfType(table, OBJECTREFToObject(object), HNDTYPE_PINNED);
-}
-
-inline OBJECTHANDLE CreateAsyncPinningHandle(void* table, OBJECTREF object)
-{
- return GCHandleTableUtilities::GetGCHandleTable()->CreateHandleOfType(table, OBJECTREFToObject(object), HNDTYPE_ASYNCPINNED);
-}
-
-inline OBJECTHANDLE CreateRefcountedHandle(void* table, OBJECTREF object)
-{
- return GCHandleTableUtilities::GetGCHandleTable()->CreateHandleOfType(table, OBJECTREFToObject(object), HNDTYPE_REFCOUNTED);
-}
-
-inline OBJECTHANDLE CreateSizedRefHandle(void* table, OBJECTREF object)
-{
- return GCHandleTableUtilities::GetGCHandleTable()->CreateHandleOfType(table, OBJECTREFToObject(object), HNDTYPE_SIZEDREF);
-}
-
-inline OBJECTHANDLE CreateSizedRefHandle(void* table, OBJECTREF object, int heapToAffinitizeTo)
-{
- return GCHandleTableUtilities::GetGCHandleTable()->CreateHandleOfType(table, OBJECTREFToObject(object), HNDTYPE_SIZEDREF, heapToAffinitizeTo);
-}
-
-// Global handle creation convenience functions
-
-inline OBJECTHANDLE CreateGlobalHandle(OBJECTREF object)
-{
- CONDITIONAL_CONTRACT_VIOLATION(ModeViolation, object == NULL);
- return GCHandleTableUtilities::GetGCHandleTable()->CreateGlobalHandleOfType(OBJECTREFToObject(object), HNDTYPE_DEFAULT);
-}
-
-inline OBJECTHANDLE CreateGlobalWeakHandle(OBJECTREF object)
-{
- return GCHandleTableUtilities::GetGCHandleTable()->CreateGlobalHandleOfType(OBJECTREFToObject(object), HNDTYPE_WEAK_DEFAULT);
-}
-
-inline OBJECTHANDLE CreateGlobalShortWeakHandle(OBJECTREF object)
-{
- CONDITIONAL_CONTRACT_VIOLATION(ModeViolation, object == NULL);
- return GCHandleTableUtilities::GetGCHandleTable()->CreateGlobalHandleOfType(OBJECTREFToObject(object), HNDTYPE_WEAK_SHORT);
-}
-
-inline OBJECTHANDLE CreateGlobalLongWeakHandle(OBJECTREF object)
-{
- return GCHandleTableUtilities::GetGCHandleTable()->CreateGlobalHandleOfType(OBJECTREFToObject(object), HNDTYPE_WEAK_LONG);
-}
-
-inline OBJECTHANDLE CreateGlobalStrongHandle(OBJECTREF object)
-{
- CONDITIONAL_CONTRACT_VIOLATION(ModeViolation, object == NULL);
- return GCHandleTableUtilities::GetGCHandleTable()->CreateGlobalHandleOfType(OBJECTREFToObject(object), HNDTYPE_STRONG);
-}
-
-inline OBJECTHANDLE CreateGlobalPinningHandle(OBJECTREF object)
-{
- return GCHandleTableUtilities::GetGCHandleTable()->CreateGlobalHandleOfType(OBJECTREFToObject(object), HNDTYPE_PINNED);
-}
-
-inline OBJECTHANDLE CreateGlobalRefcountedHandle(OBJECTREF object)
-{
- return GCHandleTableUtilities::GetGCHandleTable()->CreateGlobalHandleOfType(OBJECTREFToObject(object), HNDTYPE_REFCOUNTED);
-}
-
-// Special handle creation convenience functions
-
-#ifdef FEATURE_COMINTEROP
-inline OBJECTHANDLE CreateWinRTWeakHandle(void* table, OBJECTREF object, IWeakReference* pWinRTWeakReference)
-{
- return GCHandleTableUtilities::GetGCHandleTable()->CreateHandleWithExtraInfo(table,
- OBJECTREFToObject(object),
- HNDTYPE_WEAK_WINRT,
- (void*)pWinRTWeakReference);
-}
-#endif // FEATURE_COMINTEROP
-
-// Creates a variable-strength handle
-inline OBJECTHANDLE CreateVariableHandle(void* table, OBJECTREF object, uint32_t type)
-{
- return GCHandleTableUtilities::GetGCHandleTable()->CreateHandleWithExtraInfo(table,
- OBJECTREFToObject(object),
- HNDTYPE_VARIABLE,
- (void*)((uintptr_t)type));
-}
-
-// Handle destruction convenience functions
-
-inline void DestroyHandle(OBJECTHANDLE handle)
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- MODE_ANY;
- CAN_TAKE_LOCK;
- SO_TOLERANT;
- }
- CONTRACTL_END;
-
- GCHandleTableUtilities::GetGCHandleTable()->DestroyHandleOfType(handle, HNDTYPE_DEFAULT);
-}
-
-inline void DestroyWeakHandle(OBJECTHANDLE handle)
-{
- GCHandleTableUtilities::GetGCHandleTable()->DestroyHandleOfType(handle, HNDTYPE_WEAK_DEFAULT);
-}
-
-inline void DestroyShortWeakHandle(OBJECTHANDLE handle)
-{
- GCHandleTableUtilities::GetGCHandleTable()->DestroyHandleOfType(handle, HNDTYPE_WEAK_SHORT);
-}
-
-inline void DestroyLongWeakHandle(OBJECTHANDLE handle)
-{
- GCHandleTableUtilities::GetGCHandleTable()->DestroyHandleOfType(handle, HNDTYPE_WEAK_LONG);
-}
-
-inline void DestroyStrongHandle(OBJECTHANDLE handle)
-{
- GCHandleTableUtilities::GetGCHandleTable()->DestroyHandleOfType(handle, HNDTYPE_STRONG);
-}
-
-inline void DestroyPinningHandle(OBJECTHANDLE handle)
-{
- GCHandleTableUtilities::GetGCHandleTable()->DestroyHandleOfType(handle, HNDTYPE_PINNED);
-}
-
-inline void DestroyAsyncPinningHandle(OBJECTHANDLE handle)
-{
- GCHandleTableUtilities::GetGCHandleTable()->DestroyHandleOfType(handle, HNDTYPE_ASYNCPINNED);
-}
-
-inline void DestroyRefcountedHandle(OBJECTHANDLE handle)
-{
- GCHandleTableUtilities::GetGCHandleTable()->DestroyHandleOfType(handle, HNDTYPE_REFCOUNTED);
-}
-
-inline void DestroyDependentHandle(OBJECTHANDLE handle)
-{
- GCHandleTableUtilities::GetGCHandleTable()->DestroyHandleOfType(handle, HNDTYPE_DEPENDENT);
-}
-
-inline void DestroyVariableHandle(OBJECTHANDLE handle)
-{
- GCHandleTableUtilities::GetGCHandleTable()->DestroyHandleOfType(handle, HNDTYPE_VARIABLE);
-}
-
-inline void DestroyGlobalHandle(OBJECTHANDLE handle)
-{
- GCHandleTableUtilities::GetGCHandleTable()->DestroyHandleOfType(handle, HNDTYPE_DEFAULT);
-}
-
-inline void DestroyGlobalWeakHandle(OBJECTHANDLE handle)
-{
- GCHandleTableUtilities::GetGCHandleTable()->DestroyHandleOfType(handle, HNDTYPE_WEAK_DEFAULT);
-}
-
-inline void DestroyGlobalShortWeakHandle(OBJECTHANDLE handle)
-{
- GCHandleTableUtilities::GetGCHandleTable()->DestroyHandleOfType(handle, HNDTYPE_WEAK_SHORT);
-}
-
-inline void DestroyGlobalLongWeakHandle(OBJECTHANDLE handle)
-{
- GCHandleTableUtilities::GetGCHandleTable()->DestroyHandleOfType(handle, HNDTYPE_WEAK_LONG);
-}
-
-inline void DestroyGlobalStrongHandle(OBJECTHANDLE handle)
-{
- GCHandleTableUtilities::GetGCHandleTable()->DestroyHandleOfType(handle, HNDTYPE_STRONG);
-}
-
-inline void DestroyGlobalPinningHandle(OBJECTHANDLE handle)
-{
- GCHandleTableUtilities::GetGCHandleTable()->DestroyHandleOfType(handle, HNDTYPE_PINNED);
-}
-
-inline void DestroyGlobalRefcountedHandle(OBJECTHANDLE handle)
-{
- GCHandleTableUtilities::GetGCHandleTable()->DestroyHandleOfType(handle, HNDTYPE_REFCOUNTED);
-}
-
-inline void DestroyTypedHandle(OBJECTHANDLE handle)
-{
- GCHandleTableUtilities::GetGCHandleTable()->DestroyHandleOfUnknownType(handle);
-}
-
-#ifdef FEATURE_COMINTEROP
-inline void DestroyWinRTWeakHandle(OBJECTHANDLE handle)
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- MODE_ANY;
- CAN_TAKE_LOCK;
- SO_TOLERANT;
- }
- CONTRACTL_END;
-
- // Release the WinRT weak reference if we have one. We're assuming that this will not reenter the
- // runtime, since if we are pointing at a managed object, we should not be using HNDTYPE_WEAK_WINRT
- // but rather HNDTYPE_WEAK_SHORT or HNDTYPE_WEAK_LONG.
- void* pExtraInfo = GCHandleTableUtilities::GetGCHandleTable()->GetExtraInfoFromHandle(handle);
- IWeakReference* pWinRTWeakReference = reinterpret_cast<IWeakReference*>(pExtraInfo);
- if (pWinRTWeakReference != nullptr)
- {
- pWinRTWeakReference->Release();
- }
-
- GCHandleTableUtilities::GetGCHandleTable()->DestroyHandleOfType(handle, HNDTYPE_WEAK_WINRT);
-}
-#endif
-
-// Handle holders/wrappers
-
-#ifndef FEATURE_REDHAWK
-typedef Wrapper<OBJECTHANDLE, DoNothing<OBJECTHANDLE>, DestroyHandle> OHWrapper;
-typedef Wrapper<OBJECTHANDLE, DoNothing<OBJECTHANDLE>, DestroyPinningHandle, NULL> PinningHandleHolder;
-typedef Wrapper<OBJECTHANDLE, DoNothing<OBJECTHANDLE>, DestroyAsyncPinningHandle, NULL> AsyncPinningHandleHolder;
-typedef Wrapper<OBJECTHANDLE, DoNothing<OBJECTHANDLE>, DestroyRefcountedHandle> RefCountedOHWrapper;
-
-typedef Holder<OBJECTHANDLE, DoNothing<OBJECTHANDLE>, DestroyLongWeakHandle> LongWeakHandleHolder;
-typedef Holder<OBJECTHANDLE, DoNothing<OBJECTHANDLE>, DestroyGlobalStrongHandle> GlobalStrongHandleHolder;
-typedef Holder<OBJECTHANDLE, DoNothing<OBJECTHANDLE>, DestroyGlobalShortWeakHandle> GlobalShortWeakHandleHolder;
-
-class RCOBJECTHANDLEHolder : public RefCountedOHWrapper
-{
-public:
- FORCEINLINE RCOBJECTHANDLEHolder(OBJECTHANDLE p = NULL) : RefCountedOHWrapper(p)
- {
- LIMITED_METHOD_CONTRACT;
- }
- FORCEINLINE void operator=(OBJECTHANDLE p)
- {
- WRAPPER_NO_CONTRACT;
-
- RefCountedOHWrapper::operator=(p);
- }
-};
-
-class OBJECTHANDLEHolder : public OHWrapper
-{
-public:
- FORCEINLINE OBJECTHANDLEHolder(OBJECTHANDLE p = NULL) : OHWrapper(p)
- {
- LIMITED_METHOD_CONTRACT;
- }
- FORCEINLINE void operator=(OBJECTHANDLE p)
- {
- WRAPPER_NO_CONTRACT;
-
- OHWrapper::operator=(p);
- }
-};
-
-#endif // !FEATURE_REDHAWK
-
-#endif // !DACCESS_COMPILE
-
-#endif // _GCHANDLETABLEUTILITIES_H_
-
diff --git a/src/vm/gchandleutilities.h b/src/vm/gchandleutilities.h
new file mode 100644
index 0000000000..665c1da453
--- /dev/null
+++ b/src/vm/gchandleutilities.h
@@ -0,0 +1,495 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+#ifndef _GCHANDLEUTILITIES_H_
+#define _GCHANDLEUTILITIES_H_
+
+#include "gcinterface.h"
+
+#ifdef FEATURE_COMINTEROP
+#include <weakreference.h>
+#endif
+
+extern "C" IGCHandleManager* g_pGCHandleManager;
+
+class GCHandleUtilities
+{
+public:
+ // Retrieves the GC handle table.
+ static IGCHandleManager* GetGCHandleManager()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ assert(g_pGCHandleManager != nullptr);
+ return g_pGCHandleManager;
+ }
+
+private:
+ // This class should never be instantiated.
+ GCHandleUtilities() = delete;
+};
+
+void ValidateObjectAndAppDomain(OBJECTREF objRef, ADIndex appDomainIndex);
+void ValidateHandleAssignment(OBJECTHANDLE handle, OBJECTREF objRef);
+
+// Given a handle, returns an OBJECTREF for the object it refers to.
+inline OBJECTREF ObjectFromHandle(OBJECTHANDLE handle)
+{
+ _ASSERTE(handle);
+
+#ifdef _DEBUG_IMPL
+ DWORD context = (DWORD)GCHandleUtilities::GetGCHandleManager()->GetHandleContext(handle);
+ OBJECTREF objRef = ObjectToOBJECTREF(*(Object**)handle);
+
+ ValidateObjectAndAppDomain(objRef, ADIndex(context));
+#endif // _DEBUG_IMPL
+
+ // Wrap the raw OBJECTREF and return it
+ return UNCHECKED_OBJECTREF_TO_OBJECTREF(*PTR_UNCHECKED_OBJECTREF(handle));
+}
+
+// Quick inline check for whether a handle is null
+inline BOOL IsHandleNullUnchecked(OBJECTHANDLE handle)
+{
+ LIMITED_METHOD_CONTRACT;
+
+ return (handle == NULL || (*(_UNCHECKED_OBJECTREF *)handle) == NULL);
+}
+
+inline BOOL ObjectHandleIsNull(OBJECTHANDLE handle)
+{
+ LIMITED_METHOD_CONTRACT;
+
+ return *(Object **)handle == NULL;
+}
+
+#ifndef DACCESS_COMPILE
+
+// Handle creation convenience functions
+
+inline OBJECTHANDLE CreateHandle(IGCHandleStore* store, OBJECTREF object)
+{
+ OBJECTHANDLE hnd = store->CreateHandleOfType(OBJECTREFToObject(object), HNDTYPE_DEFAULT);
+ if (!hnd)
+ {
+ COMPlusThrowOM();
+ }
+
+ return hnd;
+}
+
+inline OBJECTHANDLE CreateWeakHandle(IGCHandleStore* store, OBJECTREF object)
+{
+ OBJECTHANDLE hnd = store->CreateHandleOfType(OBJECTREFToObject(object), HNDTYPE_WEAK_DEFAULT);
+ if (!hnd)
+ {
+ COMPlusThrowOM();
+ }
+
+ return hnd;
+}
+
+inline OBJECTHANDLE CreateShortWeakHandle(IGCHandleStore* store, OBJECTREF object)
+{
+ OBJECTHANDLE hnd = store->CreateHandleOfType(OBJECTREFToObject(object), HNDTYPE_WEAK_SHORT);
+ if (!hnd)
+ {
+ COMPlusThrowOM();
+ }
+
+ return hnd;
+}
+
+inline OBJECTHANDLE CreateLongWeakHandle(IGCHandleStore* store, OBJECTREF object)
+{
+ OBJECTHANDLE hnd = store->CreateHandleOfType(OBJECTREFToObject(object), HNDTYPE_WEAK_LONG);
+ if (!hnd)
+ {
+ COMPlusThrowOM();
+ }
+
+ return hnd;
+}
+
+inline OBJECTHANDLE CreateStrongHandle(IGCHandleStore* store, OBJECTREF object)
+{
+ OBJECTHANDLE hnd = store->CreateHandleOfType(OBJECTREFToObject(object), HNDTYPE_STRONG);
+ if (!hnd)
+ {
+ COMPlusThrowOM();
+ }
+
+ return hnd;
+}
+
+inline OBJECTHANDLE CreatePinningHandle(IGCHandleStore* store, OBJECTREF object)
+{
+ OBJECTHANDLE hnd = store->CreateHandleOfType(OBJECTREFToObject(object), HNDTYPE_PINNED);
+ if (!hnd)
+ {
+ COMPlusThrowOM();
+ }
+
+ return hnd;
+}
+
+inline OBJECTHANDLE CreateAsyncPinningHandle(IGCHandleStore* store, OBJECTREF object)
+{
+ OBJECTHANDLE hnd = store->CreateHandleOfType(OBJECTREFToObject(object), HNDTYPE_ASYNCPINNED);
+ if (!hnd)
+ {
+ COMPlusThrowOM();
+ }
+
+ return hnd;
+}
+
+inline OBJECTHANDLE CreateRefcountedHandle(IGCHandleStore* store, OBJECTREF object)
+{
+ OBJECTHANDLE hnd = store->CreateHandleOfType(OBJECTREFToObject(object), HNDTYPE_REFCOUNTED);
+ if (!hnd)
+ {
+ COMPlusThrowOM();
+ }
+
+ return hnd;
+}
+
+inline OBJECTHANDLE CreateSizedRefHandle(IGCHandleStore* store, OBJECTREF object)
+{
+ OBJECTHANDLE hnd = store->CreateHandleOfType(OBJECTREFToObject(object), HNDTYPE_SIZEDREF);
+ if (!hnd)
+ {
+ COMPlusThrowOM();
+ }
+
+ return hnd;
+}
+
+inline OBJECTHANDLE CreateSizedRefHandle(IGCHandleStore* store, OBJECTREF object, int heapToAffinitizeTo)
+{
+ OBJECTHANDLE hnd = store->CreateHandleOfType(OBJECTREFToObject(object), HNDTYPE_SIZEDREF, heapToAffinitizeTo);
+ if (!hnd)
+ {
+ COMPlusThrowOM();
+ }
+
+ return hnd;
+}
+
+// Global handle creation convenience functions
+
+inline OBJECTHANDLE CreateGlobalHandle(OBJECTREF object)
+{
+ CONDITIONAL_CONTRACT_VIOLATION(ModeViolation, object == NULL);
+ OBJECTHANDLE hnd = GCHandleUtilities::GetGCHandleManager()->CreateGlobalHandleOfType(OBJECTREFToObject(object), HNDTYPE_DEFAULT);
+ if (!hnd)
+ {
+ COMPlusThrowOM();
+ }
+
+ return hnd;
+}
+
+inline OBJECTHANDLE CreateGlobalWeakHandle(OBJECTREF object)
+{
+ OBJECTHANDLE hnd = GCHandleUtilities::GetGCHandleManager()->CreateGlobalHandleOfType(OBJECTREFToObject(object), HNDTYPE_WEAK_DEFAULT);
+ if (!hnd)
+ {
+ COMPlusThrowOM();
+ }
+
+ return hnd;
+}
+
+inline OBJECTHANDLE CreateGlobalShortWeakHandle(OBJECTREF object)
+{
+ CONDITIONAL_CONTRACT_VIOLATION(ModeViolation, object == NULL);
+ OBJECTHANDLE hnd = GCHandleUtilities::GetGCHandleManager()->CreateGlobalHandleOfType(OBJECTREFToObject(object), HNDTYPE_WEAK_SHORT);
+ if (!hnd)
+ {
+ COMPlusThrowOM();
+ }
+
+ return hnd;
+}
+
+inline OBJECTHANDLE CreateGlobalLongWeakHandle(OBJECTREF object)
+{
+ OBJECTHANDLE hnd = GCHandleUtilities::GetGCHandleManager()->CreateGlobalHandleOfType(OBJECTREFToObject(object), HNDTYPE_WEAK_LONG);
+ if (!hnd)
+ {
+ COMPlusThrowOM();
+ }
+
+ return hnd;
+}
+
+inline OBJECTHANDLE CreateGlobalStrongHandle(OBJECTREF object)
+{
+ CONDITIONAL_CONTRACT_VIOLATION(ModeViolation, object == NULL);
+ OBJECTHANDLE hnd = GCHandleUtilities::GetGCHandleManager()->CreateGlobalHandleOfType(OBJECTREFToObject(object), HNDTYPE_STRONG);
+ if (!hnd)
+ {
+ COMPlusThrowOM();
+ }
+
+ return hnd;
+}
+
+inline OBJECTHANDLE CreateGlobalPinningHandle(OBJECTREF object)
+{
+ OBJECTHANDLE hnd = GCHandleUtilities::GetGCHandleManager()->CreateGlobalHandleOfType(OBJECTREFToObject(object), HNDTYPE_PINNED);
+ if (!hnd)
+ {
+ COMPlusThrowOM();
+ }
+
+ return hnd;
+}
+
+inline OBJECTHANDLE CreateGlobalRefcountedHandle(OBJECTREF object)
+{
+ OBJECTHANDLE hnd = GCHandleUtilities::GetGCHandleManager()->CreateGlobalHandleOfType(OBJECTREFToObject(object), HNDTYPE_REFCOUNTED);
+ if (!hnd)
+ {
+ COMPlusThrowOM();
+ }
+
+ return hnd;
+}
+
+// Special handle creation convenience functions
+
+#ifdef FEATURE_COMINTEROP
+inline OBJECTHANDLE CreateWinRTWeakHandle(IGCHandleStore* store, OBJECTREF object, IWeakReference* pWinRTWeakReference)
+{
+ OBJECTHANDLE hnd = store->CreateHandleWithExtraInfo(OBJECTREFToObject(object), HNDTYPE_WEAK_WINRT, (void*)pWinRTWeakReference);
+ if (!hnd)
+ {
+ COMPlusThrowOM();
+ }
+
+ return hnd;
+}
+#endif // FEATURE_COMINTEROP
+
+// Creates a variable-strength handle
+inline OBJECTHANDLE CreateVariableHandle(IGCHandleStore* store, OBJECTREF object, uint32_t type)
+{
+ OBJECTHANDLE hnd = store->CreateHandleWithExtraInfo(OBJECTREFToObject(object), HNDTYPE_VARIABLE, (void*)((uintptr_t)type));
+ if (!hnd)
+ {
+ COMPlusThrowOM();
+ }
+
+ return hnd;
+}
+
+// Handle object manipulation convenience functions
+
+inline void StoreObjectInHandle(OBJECTHANDLE handle, OBJECTREF object)
+{
+ ValidateHandleAssignment(handle, object);
+
+ GCHandleUtilities::GetGCHandleManager()->StoreObjectInHandle(handle, OBJECTREFToObject(object));
+}
+
+inline bool StoreFirstObjectInHandle(OBJECTHANDLE handle, OBJECTREF object)
+{
+ ValidateHandleAssignment(handle, object);
+
+ return GCHandleUtilities::GetGCHandleManager()->StoreObjectInHandleIfNull(handle, OBJECTREFToObject(object));
+}
+
+inline void* InterlockedCompareExchangeObjectInHandle(OBJECTHANDLE handle, OBJECTREF object, OBJECTREF comparandObject)
+{
+ ValidateHandleAssignment(handle, object);
+
+ return GCHandleUtilities::GetGCHandleManager()->InterlockedCompareExchangeObjectInHandle(handle, OBJECTREFToObject(object), OBJECTREFToObject(comparandObject));
+}
+
+inline void ResetOBJECTHANDLE(OBJECTHANDLE handle)
+{
+ GCHandleUtilities::GetGCHandleManager()->StoreObjectInHandle(handle, NULL);
+}
+
+// Handle destruction convenience functions
+
+inline void DestroyHandle(OBJECTHANDLE handle)
+{
+ CONTRACTL
+ {
+ NOTHROW;
+ GC_NOTRIGGER;
+ MODE_ANY;
+ CAN_TAKE_LOCK;
+ SO_TOLERANT;
+ }
+ CONTRACTL_END;
+
+ GCHandleUtilities::GetGCHandleManager()->DestroyHandleOfType(handle, HNDTYPE_DEFAULT);
+}
+
+inline void DestroyWeakHandle(OBJECTHANDLE handle)
+{
+ GCHandleUtilities::GetGCHandleManager()->DestroyHandleOfType(handle, HNDTYPE_WEAK_DEFAULT);
+}
+
+inline void DestroyShortWeakHandle(OBJECTHANDLE handle)
+{
+ GCHandleUtilities::GetGCHandleManager()->DestroyHandleOfType(handle, HNDTYPE_WEAK_SHORT);
+}
+
+inline void DestroyLongWeakHandle(OBJECTHANDLE handle)
+{
+ GCHandleUtilities::GetGCHandleManager()->DestroyHandleOfType(handle, HNDTYPE_WEAK_LONG);
+}
+
+inline void DestroyStrongHandle(OBJECTHANDLE handle)
+{
+ GCHandleUtilities::GetGCHandleManager()->DestroyHandleOfType(handle, HNDTYPE_STRONG);
+}
+
+inline void DestroyPinningHandle(OBJECTHANDLE handle)
+{
+ GCHandleUtilities::GetGCHandleManager()->DestroyHandleOfType(handle, HNDTYPE_PINNED);
+}
+
+inline void DestroyAsyncPinningHandle(OBJECTHANDLE handle)
+{
+ GCHandleUtilities::GetGCHandleManager()->DestroyHandleOfType(handle, HNDTYPE_ASYNCPINNED);
+}
+
+inline void DestroyRefcountedHandle(OBJECTHANDLE handle)
+{
+ GCHandleUtilities::GetGCHandleManager()->DestroyHandleOfType(handle, HNDTYPE_REFCOUNTED);
+}
+
+inline void DestroyDependentHandle(OBJECTHANDLE handle)
+{
+ GCHandleUtilities::GetGCHandleManager()->DestroyHandleOfType(handle, HNDTYPE_DEPENDENT);
+}
+
+inline void DestroyVariableHandle(OBJECTHANDLE handle)
+{
+ GCHandleUtilities::GetGCHandleManager()->DestroyHandleOfType(handle, HNDTYPE_VARIABLE);
+}
+
+inline void DestroyGlobalHandle(OBJECTHANDLE handle)
+{
+ GCHandleUtilities::GetGCHandleManager()->DestroyHandleOfType(handle, HNDTYPE_DEFAULT);
+}
+
+inline void DestroyGlobalWeakHandle(OBJECTHANDLE handle)
+{
+ GCHandleUtilities::GetGCHandleManager()->DestroyHandleOfType(handle, HNDTYPE_WEAK_DEFAULT);
+}
+
+inline void DestroyGlobalShortWeakHandle(OBJECTHANDLE handle)
+{
+ GCHandleUtilities::GetGCHandleManager()->DestroyHandleOfType(handle, HNDTYPE_WEAK_SHORT);
+}
+
+inline void DestroyGlobalLongWeakHandle(OBJECTHANDLE handle)
+{
+ GCHandleUtilities::GetGCHandleManager()->DestroyHandleOfType(handle, HNDTYPE_WEAK_LONG);
+}
+
+inline void DestroyGlobalStrongHandle(OBJECTHANDLE handle)
+{
+ GCHandleUtilities::GetGCHandleManager()->DestroyHandleOfType(handle, HNDTYPE_STRONG);
+}
+
+inline void DestroyGlobalPinningHandle(OBJECTHANDLE handle)
+{
+ GCHandleUtilities::GetGCHandleManager()->DestroyHandleOfType(handle, HNDTYPE_PINNED);
+}
+
+inline void DestroyGlobalRefcountedHandle(OBJECTHANDLE handle)
+{
+ GCHandleUtilities::GetGCHandleManager()->DestroyHandleOfType(handle, HNDTYPE_REFCOUNTED);
+}
+
+inline void DestroyTypedHandle(OBJECTHANDLE handle)
+{
+ GCHandleUtilities::GetGCHandleManager()->DestroyHandleOfUnknownType(handle);
+}
+
+#ifdef FEATURE_COMINTEROP
+inline void DestroyWinRTWeakHandle(OBJECTHANDLE handle)
+{
+ CONTRACTL
+ {
+ NOTHROW;
+ GC_NOTRIGGER;
+ MODE_ANY;
+ CAN_TAKE_LOCK;
+ SO_TOLERANT;
+ }
+ CONTRACTL_END;
+
+ // Release the WinRT weak reference if we have one. We're assuming that this will not reenter the
+ // runtime, since if we are pointing at a managed object, we should not be using HNDTYPE_WEAK_WINRT
+ // but rather HNDTYPE_WEAK_SHORT or HNDTYPE_WEAK_LONG.
+ void* pExtraInfo = GCHandleUtilities::GetGCHandleManager()->GetExtraInfoFromHandle(handle);
+ IWeakReference* pWinRTWeakReference = reinterpret_cast<IWeakReference*>(pExtraInfo);
+ if (pWinRTWeakReference != nullptr)
+ {
+ pWinRTWeakReference->Release();
+ }
+
+ GCHandleUtilities::GetGCHandleManager()->DestroyHandleOfType(handle, HNDTYPE_WEAK_WINRT);
+}
+#endif
+
+// Handle holders/wrappers
+
+#ifndef FEATURE_REDHAWK
+typedef Wrapper<OBJECTHANDLE, DoNothing<OBJECTHANDLE>, DestroyHandle> OHWrapper;
+typedef Wrapper<OBJECTHANDLE, DoNothing<OBJECTHANDLE>, DestroyPinningHandle, NULL> PinningHandleHolder;
+typedef Wrapper<OBJECTHANDLE, DoNothing<OBJECTHANDLE>, DestroyAsyncPinningHandle, NULL> AsyncPinningHandleHolder;
+typedef Wrapper<OBJECTHANDLE, DoNothing<OBJECTHANDLE>, DestroyRefcountedHandle> RefCountedOHWrapper;
+
+typedef Holder<OBJECTHANDLE, DoNothing<OBJECTHANDLE>, DestroyLongWeakHandle> LongWeakHandleHolder;
+typedef Holder<OBJECTHANDLE, DoNothing<OBJECTHANDLE>, DestroyGlobalStrongHandle> GlobalStrongHandleHolder;
+typedef Holder<OBJECTHANDLE, DoNothing<OBJECTHANDLE>, DestroyGlobalShortWeakHandle> GlobalShortWeakHandleHolder;
+typedef Holder<OBJECTHANDLE, DoNothing<OBJECTHANDLE>, ResetOBJECTHANDLE> ObjectInHandleHolder;
+
+class RCOBJECTHANDLEHolder : public RefCountedOHWrapper
+{
+public:
+ FORCEINLINE RCOBJECTHANDLEHolder(OBJECTHANDLE p = NULL) : RefCountedOHWrapper(p)
+ {
+ LIMITED_METHOD_CONTRACT;
+ }
+ FORCEINLINE void operator=(OBJECTHANDLE p)
+ {
+ WRAPPER_NO_CONTRACT;
+
+ RefCountedOHWrapper::operator=(p);
+ }
+};
+
+class OBJECTHANDLEHolder : public OHWrapper
+{
+public:
+ FORCEINLINE OBJECTHANDLEHolder(OBJECTHANDLE p = NULL) : OHWrapper(p)
+ {
+ LIMITED_METHOD_CONTRACT;
+ }
+ FORCEINLINE void operator=(OBJECTHANDLE p)
+ {
+ WRAPPER_NO_CONTRACT;
+
+ OHWrapper::operator=(p);
+ }
+};
+
+#endif // !FEATURE_REDHAWK
+
+#endif // !DACCESS_COMPILE
+
+#endif // _GCHANDLEUTILITIES_H_
+
diff --git a/src/vm/gcheaputilities.cpp b/src/vm/gcheaputilities.cpp
index e15558335e..cd7afede70 100644
--- a/src/vm/gcheaputilities.cpp
+++ b/src/vm/gcheaputilities.cpp
@@ -25,7 +25,7 @@ uint32_t* g_card_bundle_table = nullptr;
// This is the global GC heap, maintained by the VM.
GPTR_IMPL(IGCHeap, g_pGCHeap);
-IGCHandleTable* g_pGCHandleTable = nullptr;
+IGCHandleManager* g_pGCHandleManager = nullptr;
GcDacVars g_gc_dac_vars;
GPTR_IMPL(GcDacVars, g_gcDacGlobals);
@@ -40,17 +40,12 @@ bool g_sw_ww_enabled_for_gc_heap = false;
gc_alloc_context g_global_alloc_context = {};
// Debug-only validation for handle.
-void ValidateHandleAndAppDomain(OBJECTHANDLE handle)
+
+void ValidateObjectAndAppDomain(OBJECTREF objRef, ADIndex appDomainIndex)
{
#ifdef _DEBUG_IMPL
- OBJECTREF objRef = ObjectToOBJECTREF(*(Object**)handle);
VALIDATEOBJECTREF(objRef);
- IGCHandleTable *pHandleTable = GCHandleTableUtilities::GetGCHandleTable();
-
- DWORD context = (DWORD)pHandleTable->GetHandleContext(handle);
-
- ADIndex appDomainIndex = ADIndex(context);
AppDomain *domain = SystemDomain::GetAppDomainAtIndex(appDomainIndex);
// Access to a handle in an unloaded domain is not allowed
@@ -72,3 +67,25 @@ void ValidateHandleAndAppDomain(OBJECTHANDLE handle)
#endif // CHECK_APP_DOMAIN_LEAKS
#endif // _DEBUG_IMPL
}
+
+void ValidateHandleAssignment(OBJECTHANDLE handle, OBJECTREF objRef)
+{
+#ifdef _DEBUG_IMPL
+ _ASSERTE(handle);
+
+#ifdef DEBUG_DestroyedHandleValue
+ // Verify that we are not trying to access a freed handle.
+ _ASSERTE("Attempt to access destroyed handle." && *(_UNCHECKED_OBJECTREF*)handle != DEBUG_DestroyedHandleValue);
+#endif
+
+ ADIndex appDomainIndex = HndGetHandleADIndex(handle);
+
+ AppDomain *unloadingDomain = SystemDomain::AppDomainBeingUnloaded();
+ if (unloadingDomain && unloadingDomain->GetIndex() == appDomainIndex && unloadingDomain->NoAccessToHandleTable())
+ {
+ _ASSERTE (!"Access to a handle in unloaded domain is not allowed");
+ }
+
+ ValidateObjectAndAppDomain(objRef, appDomainIndex);
+#endif // _DEBUG_IMPL
+} \ No newline at end of file
diff --git a/src/vm/gdbjit.cpp b/src/vm/gdbjit.cpp
index fe8e211e5b..ace6b76d97 100644
--- a/src/vm/gdbjit.cpp
+++ b/src/vm/gdbjit.cpp
@@ -1095,7 +1095,7 @@ ClassTypeInfo::ClassTypeInfo(TypeHandle typeHandle, int num_members, FunctionMem
{
case ELEMENT_TYPE_VALUETYPE:
case ELEMENT_TYPE_CLASS:
- m_type_size = pMT->IsValueType() ? typeHandle.GetSize() : typeHandle.AsMethodTable()->GetClass()->GetSize();
+ m_type_size = pMT->IsValueType() ? typeHandle.GetSize() : typeHandle.AsMethodTable()->GetBaseSize();
break;
case ELEMENT_TYPE_ARRAY:
case ELEMENT_TYPE_SZARRAY:
diff --git a/src/vm/hosting.cpp b/src/vm/hosting.cpp
index 620b9d6800..d47bc28238 100644
--- a/src/vm/hosting.cpp
+++ b/src/vm/hosting.cpp
@@ -444,6 +444,11 @@ LPVOID EEHeapAllocInProcessHeap(DWORD dwFlags, SIZE_T dwBytes)
WRAPPER_NO_CONTRACT;
STATIC_CONTRACT_SO_TOLERANT;
+#ifdef _DEBUG
+ // Check whether (indispensable) implicit casting in ClrAllocInProcessHeapBootstrap is safe.
+ static FastAllocInProcessHeapFunc pFunc = EEHeapAllocInProcessHeap;
+#endif
+
static HANDLE ProcessHeap = NULL;
// We need to guarentee a very small stack consumption in allocating. And we can't allow
@@ -506,6 +511,11 @@ BOOL EEHeapFreeInProcessHeap(DWORD dwFlags, LPVOID lpMem)
}
CONTRACTL_END;
+#ifdef _DEBUG
+ // Check whether (indispensable) implicit casting in ClrFreeInProcessHeapBootstrap is safe.
+ static FastFreeInProcessHeapFunc pFunc = EEHeapFreeInProcessHeap;
+#endif
+
// Take a look at comment in EEHeapFree and EEHeapAllocInProcessHeap, obviously someone
// needs to take a little time to think more about this code.
//CONTRACT_VIOLATION(SOToleranceViolation);
diff --git a/src/vm/i386/asmhelpers.S b/src/vm/i386/asmhelpers.S
index 98525aceee..75f4a26a80 100644
--- a/src/vm/i386/asmhelpers.S
+++ b/src/vm/i386/asmhelpers.S
@@ -439,6 +439,7 @@ NESTED_ENTRY OnHijackTripThread, _TEXT, NoHandler
sub esp,12
push esp
+ CHECK_STACK_ALIGNMENT
call C_FUNC(OnHijackWorker)
// unused space for floating point state
@@ -474,6 +475,7 @@ NESTED_ENTRY OnHijackFPTripThread, _TEXT, NoHandler
fstp QWORD PTR [esp]
push esp
+ CHECK_STACK_ALIGNMENT
call C_FUNC(OnHijackWorker)
// restore top of the floating point stack
@@ -752,8 +754,10 @@ NESTED_ENTRY StubDispatchFixupStub, _TEXT, NoHandler
mov esi, esp
- push 0
- push 0
+.att_syntax
+ pushl $0
+ pushl $0
+.intel_syntax noprefix
push eax // siteAddrForRegisterIndirect (for tailcalls)
push esi // pTransitionBlock
@@ -784,8 +788,10 @@ NESTED_ENTRY ExternalMethodFixupStub, _TEXT_ NoHandler
// EAX is return address into CORCOMPILE_EXTERNAL_METHOD_THUNK. Subtract 5 to get start address.
sub eax, 5
- push 0
- push 0
+.att_syntax
+ pushl $0
+ pushl $0
+.intel_syntax noprefix
push eax
@@ -811,6 +817,14 @@ PATCH_LABEL ExternalMethodFixupPatchLabel
NESTED_END ExternalMethodFixupStub, _TEXT
#ifdef FEATURE_READYTORUN
+NESTED_ENTRY DynamicHelperArgsStub, _TEXT, NoHandler
+ .cfi_def_cfa_offset 16
+ CHECK_STACK_ALIGNMENT
+ call eax
+ add esp, 12
+ ret
+NESTED_END DynamicHelperArgsStub, _TEXT
+
// ==========================================================================
NESTED_ENTRY DelayLoad_MethodCall, _TEXT, NoHandler
STUB_PROLOG_2_HIDDEN_ARGS
@@ -967,6 +981,7 @@ NESTED_ENTRY DelayLoad_Helper\suffix, _TEXT, NoHandler
push eax // indirection cell address.
push esi // pTransitionBlock
+ CHECK_STACK_ALIGNMENT
call C_FUNC(DynamicHelperWorker)
test eax,eax
jnz LOCAL_LABEL(TailCallDelayLoad_Helper\suffix)
diff --git a/src/vm/i386/cgenx86.cpp b/src/vm/i386/cgenx86.cpp
index 4c83265ff4..14909b93e5 100644
--- a/src/vm/i386/cgenx86.cpp
+++ b/src/vm/i386/cgenx86.cpp
@@ -331,7 +331,6 @@ void TransitionFrame::UpdateRegDisplayHelper(const PREGDISPLAY pRD, UINT cbStack
pRD->pCurrentContext->Eip = *PTR_PCODE(pRD->PCTAddr);;
pRD->pCurrentContext->Esp = CallerSP;
- pRD->pCurrentContext->ResumeEsp = CallerSP + cbStackPop;
UpdateRegDisplayFromCalleeSavedRegisters(pRD, regs);
ClearRegDisplayArgumentAndScratchRegisters(pRD);
@@ -384,7 +383,7 @@ void HelperMethodFrame::UpdateRegDisplay(const PREGDISPLAY pRD)
#endif // DACCESS_COMPILE
pRD->pCurrentContext->Eip = pRD->ControlPC = m_MachState.GetRetAddr();
- pRD->pCurrentContext->Esp = pRD->pCurrentContext->ResumeEsp = pRD->SP = (DWORD) m_MachState.esp();
+ pRD->pCurrentContext->Esp = pRD->SP = (DWORD) m_MachState.esp();
#define CALLEE_SAVED_REGISTER(regname) pRD->pCurrentContext->regname = *((DWORD*) m_MachState.p##regname());
ENUM_CALLEE_SAVED_REGISTERS();
@@ -689,7 +688,6 @@ void InlinedCallFrame::UpdateRegDisplay(const PREGDISPLAY pRD)
pRD->pCurrentContext->Eip = *PTR_PCODE(pRD->PCTAddr);
pRD->pCurrentContext->Esp = (DWORD) dac_cast<TADDR>(m_pCallSiteSP);
- pRD->pCurrentContext->ResumeEsp = (DWORD) dac_cast<TADDR>(m_pCallSiteSP) + stackArgSize;
pRD->pCurrentContext->Ebp = (DWORD) m_pCalleeSavedFP;
ClearRegDisplayArgumentAndScratchRegisters(pRD);
@@ -829,7 +827,7 @@ void HijackFrame::UpdateRegDisplay(const PREGDISPLAY pRD)
pRD->IsCallerSPValid = FALSE; // Don't add usage of this field. This is only temporary.
pRD->pCurrentContext->Eip = *PTR_PCODE(pRD->PCTAddr);
- pRD->pCurrentContext->Esp = pRD->pCurrentContext->ResumeEsp = (DWORD)(pRD->PCTAddr + sizeof(TADDR));
+ pRD->pCurrentContext->Esp = (DWORD)(pRD->PCTAddr + sizeof(TADDR));
#define RESTORE_REG(reg) { pRD->pCurrentContext->reg = m_Args->reg; pRD->pCurrentContextPointers->reg = &m_Args->reg; }
#define CALLEE_SAVED_REGISTER(reg) RESTORE_REG(reg)
@@ -908,7 +906,7 @@ void TailCallFrame::UpdateRegDisplay(const PREGDISPLAY pRD)
pRD->IsCallerSPValid = FALSE; // Don't add usage of this field. This is only temporary.
pRD->pCurrentContext->Eip = *PTR_PCODE(pRD->PCTAddr);
- pRD->pCurrentContext->Esp = pRD->pCurrentContext->ResumeEsp = (DWORD)(pRD->PCTAddr + sizeof(TADDR));
+ pRD->pCurrentContext->Esp = (DWORD)(pRD->PCTAddr + sizeof(TADDR));
UpdateRegDisplayFromCalleeSavedRegisters(pRD, &m_regs);
ClearRegDisplayArgumentAndScratchRegisters(pRD);
@@ -934,6 +932,14 @@ void TailCallFrame::UpdateRegDisplay(const PREGDISPLAY pRD)
RETURN;
}
+#ifdef FEATURE_READYTORUN
+void DynamicHelperFrame::UpdateRegDisplay(const PREGDISPLAY pRD)
+{
+ WRAPPER_NO_CONTRACT;
+ UpdateRegDisplayHelper(pRD, 0);
+}
+#endif // FEATURE_READYTORUN
+
//------------------------------------------------------------------------
// This is declared as returning WORD instead of PRD_TYPE because of
// header issues with cgencpu.h including dbginterface.h.
@@ -1878,23 +1884,47 @@ PCODE DynamicHelpers::CreateReturnIndirConst(LoaderAllocator * pAllocator, TADDR
END_DYNAMIC_HELPER_EMIT();
}
+EXTERN_C VOID DynamicHelperArgsStub();
+
PCODE DynamicHelpers::CreateHelperWithTwoArgs(LoaderAllocator * pAllocator, TADDR arg, PCODE target)
{
+#ifdef UNIX_X86_ABI
+ BEGIN_DYNAMIC_HELPER_EMIT(18);
+#else
BEGIN_DYNAMIC_HELPER_EMIT(12);
+#endif
+#ifdef UNIX_X86_ABI
+ // sub esp, 8
+ *p++ = 0x83;
+ *p++ = 0xec;
+ *p++ = 0x8;
+#else
// pop eax
*p++ = 0x58;
+#endif
// push arg
*p++ = 0x68;
*(INT32 *)p = arg;
p += 4;
+#ifdef UNIX_X86_ABI
+ // mov eax, target
+ *p++ = 0xB8;
+ *(INT32 *)p = target;
+ p += 4;
+#else
// push eax
*p++ = 0x50;
+#endif
*p++ = X86_INSTR_JMP_REL32; // jmp rel32
+#ifdef UNIX_X86_ABI
+ *(INT32 *)p = rel32UsingJumpStub((INT32 *)p, (PCODE)DynamicHelperArgsStub);
+#else
*(INT32 *)p = rel32UsingJumpStub((INT32 *)p, target);
+#endif
p += 4;
END_DYNAMIC_HELPER_EMIT();
@@ -1902,10 +1932,21 @@ PCODE DynamicHelpers::CreateHelperWithTwoArgs(LoaderAllocator * pAllocator, TADD
PCODE DynamicHelpers::CreateHelperWithTwoArgs(LoaderAllocator * pAllocator, TADDR arg, TADDR arg2, PCODE target)
{
+#ifdef UNIX_X86_ABI
+ BEGIN_DYNAMIC_HELPER_EMIT(23);
+#else
BEGIN_DYNAMIC_HELPER_EMIT(17);
+#endif
+#ifdef UNIX_X86_ABI
+ // sub esp, 4
+ *p++ = 0x83;
+ *p++ = 0xec;
+ *p++ = 0x4;
+#else
// pop eax
*p++ = 0x58;
+#endif
// push arg
*p++ = 0x68;
@@ -1917,11 +1958,22 @@ PCODE DynamicHelpers::CreateHelperWithTwoArgs(LoaderAllocator * pAllocator, TADD
*(INT32 *)p = arg2;
p += 4;
+#ifdef UNIX_X86_ABI
+ // mov eax, target
+ *p++ = 0xB8;
+ *(INT32 *)p = target;
+ p += 4;
+#else
// push eax
*p++ = 0x50;
+#endif
*p++ = X86_INSTR_JMP_REL32; // jmp rel32
+#ifdef UNIX_X86_ABI
+ *(INT32 *)p = rel32UsingJumpStub((INT32 *)p, (PCODE)DynamicHelperArgsStub);
+#else
*(INT32 *)p = rel32UsingJumpStub((INT32 *)p, target);
+#endif
p += 4;
END_DYNAMIC_HELPER_EMIT();
diff --git a/src/vm/i386/ehhelpers.S b/src/vm/i386/ehhelpers.S
index 43ef37fa24..7516db5019 100644
--- a/src/vm/i386/ehhelpers.S
+++ b/src/vm/i386/ehhelpers.S
@@ -100,4 +100,4 @@ NESTED_ENTRY CallEHFilterFunclet, _TEXT, NoHandler
ret 16
-NESTED_END CallEHFunclet, _TEXT
+NESTED_END CallEHFilterFunclet, _TEXT
diff --git a/src/vm/i386/excepx86.cpp b/src/vm/i386/excepx86.cpp
index 2c863b2ec3..8c65db75a7 100644
--- a/src/vm/i386/excepx86.cpp
+++ b/src/vm/i386/excepx86.cpp
@@ -1088,6 +1088,11 @@ CPFH_RealFirstPassHandler( // ExceptionContinueSearch, etc.
// of the active exception.
CEHelper::SetupCorruptionSeverityForActiveException(bRethrownException, bNestedException,
CEHelper::ShouldTreatActiveExceptionAsNonCorrupting());
+
+ // Failfast if exception indicates corrupted process state
+ if (pExInfo->GetCorruptionSeverity() == ProcessCorrupting)
+ EEPOLICY_HANDLE_FATAL_ERROR(exceptionCode);
+
END_SO_INTOLERANT_CODE;
}
#endif // FEATURE_CORRUPTING_EXCEPTIONS
@@ -3703,6 +3708,13 @@ AdjustContextForVirtualStub(
pExceptionRecord->ExceptionAddress = (PVOID)callsite;
SetIP(pContext, callsite);
+#ifdef HAVE_GCCOVER
+ // Modify LastAVAddress saved in thread to distinguish between fake & real AV
+ // See comments in IsGcMarker in file excep.cpp for more details
+ pThread->SetLastAVAddress((LPVOID)GetIP(pContext));
+#endif
+
+
// put ESP back to what it was before the call.
SetSP(pContext, dac_cast<PCODE>(dac_cast<PTR_BYTE>(GetSP(pContext)) + sizeof(void*)));
diff --git a/src/vm/i386/gmsx86.cpp b/src/vm/i386/gmsx86.cpp
index 840a50d045..2852b924ab 100644
--- a/src/vm/i386/gmsx86.cpp
+++ b/src/vm/i386/gmsx86.cpp
@@ -1295,10 +1295,10 @@ void LazyMachState::unwindLazyState(LazyMachState* baseState,
ctx.Esi = lazyState->_esi = baseState->_esi;
ctx.Ebx = lazyState->_ebx = baseState->_ebx;
- nonVolRegPtrs.Edi = &(lazyState->_edi);
- nonVolRegPtrs.Esi = &(lazyState->_esi);
- nonVolRegPtrs.Ebx = &(lazyState->_ebx);
- nonVolRegPtrs.Ebp = &(lazyState->_ebp);
+ nonVolRegPtrs.Edi = &(baseState->_edi);
+ nonVolRegPtrs.Esi = &(baseState->_esi);
+ nonVolRegPtrs.Ebx = &(baseState->_ebx);
+ nonVolRegPtrs.Ebp = &(baseState->_ebp);
PCODE pvControlPc;
diff --git a/src/vm/jitinterface.cpp b/src/vm/jitinterface.cpp
index 338c274014..5ef7700896 100644
--- a/src/vm/jitinterface.cpp
+++ b/src/vm/jitinterface.cpp
@@ -6921,18 +6921,7 @@ bool getILIntrinsicImplementation(MethodDesc * ftn,
return true;
}
}
- else if (tk == MscorlibBinder::GetMethod(METHOD__JIT_HELPERS__BYREF_LESSTHAN)->GetMemberDef())
- {
- // Compare the two arguments
- static const BYTE ilcode[] = { CEE_LDARG_0, CEE_LDARG_1, CEE_PREFIX1, (CEE_CLT & 0xFF), CEE_RET };
- methInfo->ILCode = const_cast<BYTE*>(ilcode);
- methInfo->ILCodeSize = sizeof(ilcode);
- methInfo->maxStack = 2;
- methInfo->EHcount = 0;
- methInfo->options = (CorInfoOptions)0;
- return true;
- }
- else if (tk == MscorlibBinder::GetMethod(METHOD__JIT_HELPERS__GET_ARRAY_DATA)->GetMemberDef())
+ else if (tk == MscorlibBinder::GetMethod(METHOD__JIT_HELPERS__GET_RAW_SZ_ARRAY_DATA)->GetMemberDef())
{
mdToken tokArrayPinningHelper = MscorlibBinder::GetField(FIELD__ARRAY_PINNING_HELPER__M_ARRAY_DATA)->GetMemberDef();
@@ -8634,7 +8623,7 @@ CorInfoIntrinsics CEEInfo::getIntrinsicID(CORINFO_METHOD_HANDLE methodHnd,
else
{
MethodTable * pMT = method->GetMethodTable();
- if (pMT->IsByRefLike() && pMT->GetModule()->IsSystem())
+ if (pMT->GetModule()->IsSystem() && pMT->IsByRefLike())
{
if (pMT->HasSameTypeDefAs(g_pByReferenceClass))
{
@@ -8648,10 +8637,25 @@ CorInfoIntrinsics CEEInfo::getIntrinsicID(CORINFO_METHOD_HANDLE methodHnd,
_ASSERTE(strcmp(method->GetName(), "get_Value") == 0);
result = CORINFO_INTRINSIC_ByReference_Value;
}
- *pMustExpand = true;
+ if (pMustExpand != nullptr)
+ {
+ *pMustExpand = true;
+ }
+ }
+ else if (pMT->HasSameTypeDefAs(MscorlibBinder::GetClass(CLASS__SPAN)))
+ {
+ if (method->HasSameMethodDefAs(MscorlibBinder::GetMethod(METHOD__SPAN__GET_ITEM)))
+ {
+ result = CORINFO_INTRINSIC_Span_GetItem;
+ }
+ }
+ else if (pMT->HasSameTypeDefAs(MscorlibBinder::GetClass(CLASS__READONLY_SPAN)))
+ {
+ if (method->HasSameMethodDefAs(MscorlibBinder::GetMethod(METHOD__READONLY_SPAN__GET_ITEM)))
+ {
+ result = CORINFO_INTRINSIC_ReadOnlySpan_GetItem;
+ }
}
-
- // TODO-SPAN: Span<T> intrinsics for optimizations
}
}
diff --git a/src/vm/jitinterfacegen.cpp b/src/vm/jitinterfacegen.cpp
index ce4c1e90e3..8d1c8cdf67 100644
--- a/src/vm/jitinterfacegen.cpp
+++ b/src/vm/jitinterfacegen.cpp
@@ -61,6 +61,11 @@ extern "C" void* JIT_GetSharedNonGCStaticBaseNoCtor_Slow(SIZE_T moduleDomainID,
extern "C" void* JIT_GetSharedGCStaticBase_Slow(SIZE_T moduleDomainID, DWORD dwModuleClassID);
extern "C" void* JIT_GetSharedGCStaticBaseNoCtor_Slow(SIZE_T moduleDomainID, DWORD dwModuleClassID);
+extern "C" void* JIT_GetSharedNonGCStaticBase_SingleAppDomain(SIZE_T moduleDomainID, DWORD dwModuleClassID);
+extern "C" void* JIT_GetSharedNonGCStaticBaseNoCtor_SingleAppDomain(SIZE_T moduleDomainID, DWORD dwModuleClassID);
+extern "C" void* JIT_GetSharedGCStaticBase_SingleAppDomain(SIZE_T moduleDomainID, DWORD dwModuleClassID);
+extern "C" void* JIT_GetSharedGCStaticBaseNoCtor_SingleAppDomain(SIZE_T moduleDomainID, DWORD dwModuleClassID);
+
#ifdef _TARGET_AMD64_
extern WriteBarrierManager g_WriteBarrierManager;
#endif // _TARGET_AMD64_
@@ -283,7 +288,17 @@ void InitJITHelpers1()
SetJitHelperFunction(CORINFO_HELP_MON_ENTER_STATIC, JIT_MonEnterStatic_Slow);
SetJitHelperFunction(CORINFO_HELP_MON_EXIT_STATIC, JIT_MonExitStatic_Slow);
}
+#endif
+ if(IsSingleAppDomain())
+ {
+ SetJitHelperFunction(CORINFO_HELP_GETSHARED_GCSTATIC_BASE, JIT_GetSharedGCStaticBase_SingleAppDomain);
+ SetJitHelperFunction(CORINFO_HELP_GETSHARED_NONGCSTATIC_BASE, JIT_GetSharedNonGCStaticBase_SingleAppDomain);
+ SetJitHelperFunction(CORINFO_HELP_GETSHARED_GCSTATIC_BASE_NOCTOR, JIT_GetSharedGCStaticBaseNoCtor_SingleAppDomain);
+ SetJitHelperFunction(CORINFO_HELP_GETSHARED_NONGCSTATIC_BASE_NOCTOR,JIT_GetSharedNonGCStaticBaseNoCtor_SingleAppDomain);
+ }
+#ifndef FEATURE_IMPLICIT_TLS
+ else
if (gAppDomainTLSIndex >= TLS_MINIMUM_AVAILABLE)
{
SetJitHelperFunction(CORINFO_HELP_GETSHARED_GCSTATIC_BASE, JIT_GetSharedGCStaticBase_Slow);
diff --git a/src/vm/method.cpp b/src/vm/method.cpp
index a72b07b404..77a6a0d37f 100644
--- a/src/vm/method.cpp
+++ b/src/vm/method.cpp
@@ -2404,7 +2404,7 @@ BOOL MethodDesc::IsFCallOrIntrinsic()
if (IsFCall() || IsArray())
return TRUE;
- // Intrinsic methods on ByReference<T> or Span<T>
+ // Intrinsic methods on ByReference<T>, Span<T>, or ReadOnlySpan<T>
MethodTable * pMT = GetMethodTable();
if (pMT->IsByRefLike() && pMT->GetModule()->IsSystem())
return TRUE;
diff --git a/src/vm/methodtable.h b/src/vm/methodtable.h
index d5cb5ba866..df60fca09d 100644
--- a/src/vm/methodtable.h
+++ b/src/vm/methodtable.h
@@ -414,19 +414,13 @@ struct MethodTableWriteableData
};
DWORD m_dwFlags; // Lot of empty bits here.
-private:
/*
* m_hExposedClassObject is LoaderAllocator slot index to
- * a RuntimeType instance for this class. But
- * do NOT use it for Arrays or remoted objects! All arrays of objects
- * share the same MethodTable/EEClass.
- * @GENERICS: this used to live in EEClass but now lives here because it is per-instantiation data
- * only set in code:MethodTable.GetManagedClassObject
+ * a RuntimeType instance for this class.
*/
LOADERHANDLE m_hExposedClassObject;
#ifdef _DEBUG
-public:
// to avoid verify same method table too many times when it's not changing, we cache the GC count
// on which the method table is verified. When fast GC STRESS is turned on, we only verify the MT if
// current GC count is bigger than the number. Note most thing which will invalidate a MT will require a
diff --git a/src/vm/methodtable.inl b/src/vm/methodtable.inl
index c762512bf1..9b72d24d0f 100644
--- a/src/vm/methodtable.inl
+++ b/src/vm/methodtable.inl
@@ -1770,10 +1770,6 @@ FORCEINLINE OBJECTREF MethodTable::GetManagedClassObjectIfExists()
return NULL;
}
- // Only code:MethodTable::GetManagedClassObject sets m_pExposedClassObject and it insures that
- // remoted objects and arrays don't get in.
- _ASSERTE(!IsArray() && !IsTransparentProxy());
-
COMPILER_ASSUME(retVal != NULL);
return retVal;
}
diff --git a/src/vm/mscorlib.h b/src/vm/mscorlib.h
index 244b6900ba..87927f687d 100644
--- a/src/vm/mscorlib.h
+++ b/src/vm/mscorlib.h
@@ -653,7 +653,9 @@ DEFINE_CLASS(NULLABLE, System, Nullable`1)
DEFINE_CLASS(BYREFERENCE, System, ByReference`1)
DEFINE_CLASS(SPAN, System, Span`1)
+DEFINE_METHOD(SPAN, GET_ITEM, get_Item, NoSig)
DEFINE_CLASS(READONLY_SPAN, System, ReadOnlySpan`1)
+DEFINE_METHOD(READONLY_SPAN, GET_ITEM, get_Item, NoSig)
// Keep this in sync with System.Globalization.NumberFormatInfo
DEFINE_CLASS_U(Globalization, NumberFormatInfo, NumberFormatInfo)
@@ -805,8 +807,7 @@ DEFINE_METHOD(JIT_HELPERS, UNSAFE_ENUM_CAST, UnsafeEnumCast, NoSi
DEFINE_METHOD(JIT_HELPERS, UNSAFE_ENUM_CAST_LONG, UnsafeEnumCastLong, NoSig)
DEFINE_METHOD(JIT_HELPERS, UNSAFE_CAST_TO_STACKPTR,UnsafeCastToStackPointer, NoSig)
#endif // _DEBUG
-DEFINE_METHOD(JIT_HELPERS, BYREF_LESSTHAN, ByRefLessThan, NoSig)
-DEFINE_METHOD(JIT_HELPERS, GET_ARRAY_DATA, GetArrayData, NoSig)
+DEFINE_METHOD(JIT_HELPERS, GET_RAW_SZ_ARRAY_DATA, GetRawSzArrayData, NoSig)
DEFINE_CLASS(UNSAFE, CompilerServices, Unsafe)
DEFINE_METHOD(UNSAFE, AS_POINTER, AsPointer, NoSig)
diff --git a/src/vm/object.cpp b/src/vm/object.cpp
index 1725ef7db4..3e3f6d120a 100644
--- a/src/vm/object.cpp
+++ b/src/vm/object.cpp
@@ -1592,6 +1592,14 @@ void STDCALL CopyValueClassArgUnchecked(ArgDestination *argDest, void* src, Meth
return;
}
+#elif defined(_TARGET_ARM64_)
+
+ if (argDest->IsHFA())
+ {
+ argDest->CopyHFAStructToRegister(src, pMT->GetAlignedNumInstanceFieldBytes());
+ return;
+ }
+
#endif // UNIX_AMD64_ABI && FEATURE_UNIX_AMD64_STRUCT_PASSING
// destOffset is only valid for Nullable<T> passed in registers
_ASSERTE(destOffset == 0);
diff --git a/src/vm/object.h b/src/vm/object.h
index fad5f74f39..cb3743cdb9 100644
--- a/src/vm/object.h
+++ b/src/vm/object.h
@@ -634,10 +634,10 @@ class Object
LIMITED_METHOD_CONTRACT;
SUPPORTS_DAC;
- // lose GC marking bit and the pinning bit
+ // lose GC marking bit and the reserved bit
// A method table pointer should always be aligned. During GC we set the least
- // significant bit for marked objects and we set the second to least significant
- // bit for pinned objects. So if we want the actual MT pointer during a GC
+ // significant bit for marked objects, and the second to least significant
+ // bit is reserved. So if we want the actual MT pointer during a GC
// we must zero out the lowest 2 bits.
return dac_cast<PTR_MethodTable>((dac_cast<TADDR>(m_pMethTab)) & ~((UINT_PTR)3));
}
@@ -3012,8 +3012,8 @@ class SafeBuffer : SafeHandle
public:
static FCDECL1(UINT, SizeOfType, ReflectClassBaseObject* typeUNSAFE);
static FCDECL1(UINT, AlignedSizeOfType, ReflectClassBaseObject* typeUNSAFE);
- static FCDECL3(void, PtrToStructure, BYTE* ptr, FC_TypedByRef structure, UINT32 sizeofT);
- static FCDECL3(void, StructureToPtr, FC_TypedByRef structure, BYTE* ptr, UINT32 sizeofT);
+ static FCDECL3_IVI(void, PtrToStructure, BYTE* ptr, FC_TypedByRef structure, UINT32 sizeofT);
+ static FCDECL3_VII(void, StructureToPtr, FC_TypedByRef structure, BYTE* ptr, UINT32 sizeofT);
};
#ifdef USE_CHECKED_OBJECTREFS
diff --git a/src/vm/peimagelayout.cpp b/src/vm/peimagelayout.cpp
index fb2ce5760c..24166817bb 100644
--- a/src/vm/peimagelayout.cpp
+++ b/src/vm/peimagelayout.cpp
@@ -155,6 +155,17 @@ void PEImageLayout::ApplyBaseRelocations()
{
PIMAGE_BASE_RELOCATION r = (PIMAGE_BASE_RELOCATION)(dir + dirPos);
+ COUNT_T fixupsSize = VAL32(r->SizeOfBlock);
+
+ USHORT *fixups = (USHORT *) (r + 1);
+
+ _ASSERTE(fixupsSize > sizeof(IMAGE_BASE_RELOCATION));
+ _ASSERTE((fixupsSize - sizeof(IMAGE_BASE_RELOCATION)) % 2 == 0);
+
+ COUNT_T fixupsCount = (fixupsSize - sizeof(IMAGE_BASE_RELOCATION)) / 2;
+
+ _ASSERTE((BYTE *)(fixups + fixupsCount) <= (BYTE *)(dir + dirSize));
+
DWORD rva = VAL32(r->VirtualAddress);
BYTE * pageAddress = (BYTE *)GetBase() + rva;
@@ -172,7 +183,9 @@ void PEImageLayout::ApplyBaseRelocations()
dwOldProtection = 0;
}
- IMAGE_SECTION_HEADER *pSection = RvaToSection(rva);
+ USHORT fixup = VAL16(fixups[0]);
+
+ IMAGE_SECTION_HEADER *pSection = RvaToSection(rva + (fixup & 0xfff));
PREFIX_ASSUME(pSection != NULL);
pWriteableRegion = (BYTE*)GetRvaData(VAL32(pSection->VirtualAddress));
@@ -199,17 +212,6 @@ void PEImageLayout::ApplyBaseRelocations()
}
}
- COUNT_T fixupsSize = VAL32(r->SizeOfBlock);
-
- USHORT *fixups = (USHORT *) (r + 1);
-
- _ASSERTE(fixupsSize > sizeof(IMAGE_BASE_RELOCATION));
- _ASSERTE((fixupsSize - sizeof(IMAGE_BASE_RELOCATION)) % 2 == 0);
-
- COUNT_T fixupsCount = (fixupsSize - sizeof(IMAGE_BASE_RELOCATION)) / 2;
-
- _ASSERTE((BYTE *)(fixups + fixupsCount) <= (BYTE *)(dir + dirSize));
-
for (COUNT_T fixupIndex = 0; fixupIndex < fixupsCount; fixupIndex++)
{
USHORT fixup = VAL16(fixups[fixupIndex]);
diff --git a/src/vm/safehandle.cpp b/src/vm/safehandle.cpp
index 828b221025..d79c5a749a 100644
--- a/src/vm/safehandle.cpp
+++ b/src/vm/safehandle.cpp
@@ -483,7 +483,7 @@ FCIMPL1(UINT, SafeBuffer::AlignedSizeOfType, ReflectClassBaseObject* typeUNSAFE)
}
FCIMPLEND
-FCIMPL3(void, SafeBuffer::PtrToStructure, BYTE* ptr, FC_TypedByRef structure, UINT32 sizeofT)
+FCIMPL3_IVI(void, SafeBuffer::PtrToStructure, BYTE* ptr, FC_TypedByRef structure, UINT32 sizeofT)
{
FCALL_CONTRACT;
@@ -494,7 +494,7 @@ FCIMPL3(void, SafeBuffer::PtrToStructure, BYTE* ptr, FC_TypedByRef structure, UI
}
FCIMPLEND
-FCIMPL3(void, SafeBuffer::StructureToPtr, FC_TypedByRef structure, BYTE* ptr, UINT32 sizeofT)
+FCIMPL3_VII(void, SafeBuffer::StructureToPtr, FC_TypedByRef structure, BYTE* ptr, UINT32 sizeofT)
{
FCALL_CONTRACT;
diff --git a/src/vm/siginfo.cpp b/src/vm/siginfo.cpp
index b9955eca68..82aef45026 100644
--- a/src/vm/siginfo.cpp
+++ b/src/vm/siginfo.cpp
@@ -1199,7 +1199,10 @@ TypeHandle SigPointer::GetTypeHandleThrowing(
PREFIX_ASSUME(pZapSigContext != NULL);
pModule = pZapSigContext->GetZapSigModule()->GetModuleFromIndex(ix);
- if (pModule != NULL)
+
+ // For ReadyToRunCompilation we return a null TypeHandle when we reference a non-local module
+ //
+ if ((pModule != NULL) && pModule->IsInCurrentVersionBubble())
{
thRet = psig.GetTypeHandleThrowing(pModule,
pTypeContext,
diff --git a/src/vm/stubhelpers.cpp b/src/vm/stubhelpers.cpp
index 0a5c143bf4..db593c66e9 100644
--- a/src/vm/stubhelpers.cpp
+++ b/src/vm/stubhelpers.cpp
@@ -182,7 +182,7 @@ void StubHelpers::ProcessByrefValidationList()
#endif // VERIFY_HEAP
-FCIMPL1(double, StubHelpers::DateMarshaler__ConvertToNative, INT64 managedDate)
+FCIMPL1_V(double, StubHelpers::DateMarshaler__ConvertToNative, INT64 managedDate)
{
FCALL_CONTRACT;
diff --git a/src/vm/stubhelpers.h b/src/vm/stubhelpers.h
index f7577d7a44..31693be38a 100644
--- a/src/vm/stubhelpers.h
+++ b/src/vm/stubhelpers.h
@@ -46,7 +46,7 @@ public:
// PInvoke stub helpers
//-------------------------------------------------------
- static FCDECL1(double, DateMarshaler__ConvertToNative, INT64 managedDate);
+ static FCDECL1_V(double, DateMarshaler__ConvertToNative, INT64 managedDate);
static FCDECL1_V(INT64, DateMarshaler__ConvertToManaged, double nativeDate);
static FCDECL4(void, ValueClassMarshaler__ConvertToNative, LPVOID pDest, LPVOID pSrc, MethodTable* pMT, OBJECTREF *ppCleanupWorkListOnStack);
diff --git a/src/vm/threads.cpp b/src/vm/threads.cpp
index a126d1c816..c36232ecb5 100644
--- a/src/vm/threads.cpp
+++ b/src/vm/threads.cpp
@@ -5074,7 +5074,7 @@ void Thread::SafeUpdateLastThrownObject(void)
{
EX_TRY
{
- IGCHandleTable *pHandleTable = GCHandleTableUtilities::GetGCHandleTable();
+ IGCHandleManager *pHandleTable = GCHandleUtilities::GetGCHandleManager();
// Creating a duplicate handle here ensures that the AD of the last thrown object
// matches the domain of the current throwable.
diff --git a/src/vm/threads.h b/src/vm/threads.h
index a055f2e9e0..34fca24c4f 100644
--- a/src/vm/threads.h
+++ b/src/vm/threads.h
@@ -143,7 +143,7 @@
#include "mscoree.h"
#include "appdomainstack.h"
#include "gcheaputilities.h"
-#include "gchandletableutilities.h"
+#include "gchandleutilities.h"
#include "gcinfotypes.h"
#include <clrhost.h>
@@ -6735,30 +6735,29 @@ public:
Thread::TriggersGC(GetThread()); \
} while(0)
+#else // ENABLE_CONTRACTS_IMPL
+
+#define BEGINFORBIDGC()
+#define ENDFORBIDGC()
+#define TRIGGERSGC_NOSTOMP() ANNOTATION_GC_TRIGGERS
+#define TRIGGERSGC() ANNOTATION_GC_TRIGGERS
+
+#endif // ENABLE_CONTRACTS_IMPL
inline BOOL GC_ON_TRANSITIONS(BOOL val) {
WRAPPER_NO_CONTRACT;
+#ifdef _DEBUG
Thread* thread = GetThread();
if (thread == 0)
return(FALSE);
BOOL ret = thread->m_GCOnTransitionsOK;
thread->m_GCOnTransitionsOK = val;
return(ret);
+#else // _DEBUG
+ return FALSE;
+#endif // !_DEBUG
}
-#else // _DEBUG_IMPL
-
-#define BEGINFORBIDGC()
-#define ENDFORBIDGC()
-#define TRIGGERSGC_NOSTOMP() ANNOTATION_GC_TRIGGERS
-#define TRIGGERSGC() ANNOTATION_GC_TRIGGERS
-
-inline BOOL GC_ON_TRANSITIONS(BOOL val) {
- return FALSE;
-}
-
-#endif // _DEBUG_IMPL
-
#ifdef _DEBUG
inline void ENABLESTRESSHEAP() {
WRAPPER_NO_CONTRACT;
diff --git a/src/vm/threadsuspend.cpp b/src/vm/threadsuspend.cpp
index ab1f2bbff5..65495940ed 100644
--- a/src/vm/threadsuspend.cpp
+++ b/src/vm/threadsuspend.cpp
@@ -7181,7 +7181,7 @@ void ThreadSuspend::RestartEE(BOOL bFinishedGC, BOOL SuspendSucceded)
//
// Any threads that are waiting in WaitUntilGCComplete will continue now.
//
- GCHeapUtilities::GetGCHeap()->GetWaitForGCEvent()->Set();
+ GCHeapUtilities::GetGCHeap()->SetWaitForGCEvent();
_ASSERTE(IsGCSpecialThread() || ThreadStore::HoldingThreadStore());
ResumeRuntime(bFinishedGC, SuspendSucceded);
@@ -7307,7 +7307,7 @@ retry_for_debugger:
//
// First, we reset the event that we're about to tell other threads to wait for.
//
- GCHeapUtilities::GetGCHeap()->GetWaitForGCEvent()->Reset();
+ GCHeapUtilities::GetGCHeap()->ResetWaitForGCEvent();
//
// Remember that we're the one doing the GC. Actually, maybe we're not doing a GC -
diff --git a/src/vm/typedesc.cpp b/src/vm/typedesc.cpp
index 9d84c01488..d05cb558bc 100644
--- a/src/vm/typedesc.cpp
+++ b/src/vm/typedesc.cpp
@@ -837,6 +837,12 @@ OBJECTREF ParamTypeDesc::GetManagedClassObject()
pLoaderAllocator->ClearHandle(hExposedClassObject);
}
+ if (OwnsTemplateMethodTable())
+ {
+ // Set the handle on template methodtable as well to make Object.GetType for arrays take the fast path
+ EnsureWritablePages(m_TemplateMT.GetValue()->GetWriteableDataForWrite())->m_hExposedClassObject = m_hExposedClassObject;
+ }
+
// Log the TypeVarTypeDesc access
g_IBCLogger.LogTypeMethodTableWriteableAccess(&th);
diff --git a/src/vm/util.cpp b/src/vm/util.cpp
index 70ed0e27ca..da7d18c390 100644
--- a/src/vm/util.cpp
+++ b/src/vm/util.cpp
@@ -2525,12 +2525,12 @@ HMODULE CLRGetCurrentModuleHandle()
#endif // !FEATURE_PAL
-extern LPVOID EEHeapAllocInProcessHeap(DWORD dwFlags, SIZE_T dwBytes);
-extern BOOL EEHeapFreeInProcessHeap(DWORD dwFlags, LPVOID lpMem);
-extern void ShutdownRuntimeWithoutExiting(int exitCode);
-extern BOOL IsRuntimeStarted(DWORD *pdwStartupFlags);
+LPVOID EEHeapAllocInProcessHeap(DWORD dwFlags, SIZE_T dwBytes);
+BOOL EEHeapFreeInProcessHeap(DWORD dwFlags, LPVOID lpMem);
+void ShutdownRuntimeWithoutExiting(int exitCode);
+BOOL IsRuntimeStarted(DWORD *pdwStartupFlags);
-void * __stdcall GetCLRFunction(LPCSTR FunctionName)
+void *GetCLRFunction(LPCSTR FunctionName)
{
void* func = NULL;
diff --git a/src/zap/zapimage.cpp b/src/zap/zapimage.cpp
index cb69ba9f96..27b46520be 100644
--- a/src/zap/zapimage.cpp
+++ b/src/zap/zapimage.cpp
@@ -1545,8 +1545,8 @@ void ZapImage::OutputTables()
SetSizeOfStackCommit(m_ModuleDecoder.GetSizeOfStackCommit());
}
-#if defined(FEATURE_PAL)
- // PAL library requires native image sections to align to page bounaries.
+#if defined(FEATURE_PAL) && !defined(BIT64)
+ // To minimize wasted VA space on 32 bit systems align file to page bounaries (presumed to be 4K).
SetFileAlignment(0x1000);
#elif defined(_TARGET_ARM_) && defined(FEATURE_CORESYSTEM)
if (!IsReadyToRunCompilation())
diff --git a/src/zap/zapwriter.cpp b/src/zap/zapwriter.cpp
index e1a0c27864..d91a5653b1 100644
--- a/src/zap/zapwriter.cpp
+++ b/src/zap/zapwriter.cpp
@@ -55,7 +55,13 @@ void ZapWriter::Initialize()
m_FileAlignment = 0x200;
}
+#if defined(FEATURE_PAL) && defined(BIT64)
+#define SECTION_ALIGNMENT m_FileAlignment
+#define PAL_MAX_PAGE_SIZE 0x10000
+#else
#define SECTION_ALIGNMENT 0x1000
+#define PAL_MAX_PAGE_SIZE 0
+#endif
void ZapWriter::Save(IStream * pStream)
{
@@ -119,7 +125,7 @@ void ZapWriter::ComputeRVAs()
pPhysicalSection->m_dwFilePos = dwFilePos;
- dwPos = AlignUp(dwPos, SECTION_ALIGNMENT);
+ dwPos = AlignUp(dwPos, SECTION_ALIGNMENT) + PAL_MAX_PAGE_SIZE;
pPhysicalSection->SetRVA(dwPos);
DWORD dwEndOfRawData = dwPos;
@@ -193,7 +199,7 @@ void ZapWriter::SaveContent()
WritePad(dwAlignedFilePos - dwFilePos);
dwFilePos = dwAlignedFilePos;
- dwPos = AlignUp(dwPos, SECTION_ALIGNMENT);
+ dwPos = AlignUp(dwPos, SECTION_ALIGNMENT) + PAL_MAX_PAGE_SIZE;
if (m_fWritingRelocs)
{
diff --git a/tests/arm64/Tests.lst b/tests/arm64/Tests.lst
index ee641ef23f..53801cb072 100644
--- a/tests/arm64/Tests.lst
+++ b/tests/arm64/Tests.lst
@@ -76801,7 +76801,7 @@ RelativePath=Regressions\coreclr\GitHub_7685\Test7685\Test7685.cmd
WorkingDir=Regressions\coreclr\GitHub_7685\Test7685
Expected=0
MaxAllowedDurationSeconds=600
-Categories=EXPECTED_FAIL;10107;NEW
+Categories=EXPECTED_PASS;NEW
HostStyle=0
[Generated921.cmd_9903]
diff --git a/tests/helixprep.proj b/tests/helixprep.proj
index 91aa4861d7..22c5935ce1 100644
--- a/tests/helixprep.proj
+++ b/tests/helixprep.proj
@@ -7,10 +7,8 @@
<PropertyGroup>
<DiscoveryDirectory>$(TestWorkingDir)</DiscoveryDirectory>
- <CoreRootDir Condition="'$(RuntimeID)' == '' ">$(CORE_ROOT)</CoreRootDir>
- <CoreRootDir Condition="'$(RuntimeID)' != '' ">$(CORE_OVERLAY)</CoreRootDir>
- <CoreRootName Condition="'$(RuntimeID)' == '' ">Core_Root_Windows_NT-$(__BuildArch)</CoreRootName>
- <CoreRootName Condition="'$(RuntimeID)' != '' ">Core_Root_$(RuntimeID)</CoreRootName>
+ <CoreRootDir>$(CORE_ROOT)</CoreRootDir>
+ <CoreRootName>Core_Root_$(RuntimeID)</CoreRootName>
</PropertyGroup>
<ItemGroup>
@@ -73,9 +71,10 @@
<!-- Generate wrapper .cmd file for an Xunit wrapper -->
<Target Name="GenerateWrapperCmd"
- Condition="'$(RuntimeID)' == '' ">
+ Condition="'$(TargetsWindows)' == 'true' ">
<PropertyGroup>
+ <CmdCrossgenVar Condition="'$(Crossgen)' == 'true'">set RunCrossGen=true</CrossgenVar>
<WrapperCmdContents>
<![CDATA[
@ECHO OFF
@@ -83,6 +82,7 @@ setlocal ENABLEDELAYEDEXPANSION
pushd %~dp0
set CORE_ROOT=%HELIX_CORRELATION_PAYLOAD%
+$(CmdCrossgenVar)
ECHO BEGIN EXECUTION
ECHO %HELIX_CORRELATION_PAYLOAD%\CoreRun.exe %HELIX_WORKITEM_PAYLOAD%\xunit.console.netcore.exe %HELIX_WORKITEM_PAYLOAD%\$(ProjectName) -noshadow -xml testResults.xml -notrait category=outerloop -notrait category=failing
@@ -104,13 +104,13 @@ EXIT /B %ERRORLEVEL%
</Target>
<Target Name="GenerateWrapperSh"
- Condition="'$(RuntimeID)' != '' ">
+ Condition="'$(TargetsWindows)' != 'true' ">
<!-- Need to force in Unix line endings for Shell script -->
<PropertyGroup>
<WrapperShContents>#!/bin/sh%0a</WrapperShContents>
<WrapperShContents>$(WrapperShContents)%0a</WrapperShContents>
- <WrapperShContents>$(WrapperShContents)export CORE_ROOT="$HELIX_CORRELATION_PAYLOAD"%0a</WrapperShContents>
+ <WrapperShContents>$(WrapperShContents)export CORE_ROOT="%24HELIX_CORRELATION_PAYLOAD"%0a</WrapperShContents>
<WrapperShContents>$(WrapperShContents)%0a</WrapperShContents>
<WrapperShContents>$(WrapperShContents)for scriptFilePath in %24(find . -type f -iname '%2A.sh' ! -iname "runtests.sh" | sort)%0a</WrapperShContents>
<WrapperShContents>$(WrapperShContents)do%0a</WrapperShContents>
@@ -118,6 +118,33 @@ EXIT /B %ERRORLEVEL%
<WrapperShContents>$(WrapperShContents) chmod +x "%24scriptFilePath"%0a</WrapperShContents>
<WrapperShContents>$(WrapperShContents)done%0a</WrapperShContents>
<WrapperShContents>$(WrapperShContents)%0a</WrapperShContents>
+
+ <!-- Crossgen FX assemblies, if running R2R tests.
+ TODO - remove this when we build tests on Linux -->
+ <WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents)export RunCrossGen=true%0a</WrapperShContents>
+ <WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents)overlayDir=%24CORE_ROOT%0a</WrapperShContents>
+ <WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents)if [ ! -f %24overlayDir/crossgenCompleted.mrk ]%3B then%0a</WrapperShContents>
+ <WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents) filesToPrecompile=%24(find -L %24overlayDir -iname \%2A.dll -not -iname \%2A.ni.dll -not -iname \%2A-ms-win-\%2A -type f )%0a</WrapperShContents>
+ <WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents) for fileToPrecompile in %24{filesToPrecompile}%0a</WrapperShContents>
+ <WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents) do%0a</WrapperShContents>
+ <WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents) filename=%24{fileToPrecompile}%0a</WrapperShContents>
+ <WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents) echo Precompiling %24filename%0a</WrapperShContents>
+ <WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents) %24overlayDir/crossgen /Platform_Assemblies_Paths %24overlayDir %24filename 1> %24filename.stdout 2>%24filename.stderr%0a</WrapperShContents>
+ <WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents) exitCode=%24%3F%0a</WrapperShContents>
+ <WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents) if [ %24exitCode != 0 ]%3B then%0a</WrapperShContents>
+ <WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents) if grep -q -e '(COR_E_ASSEMBLYEXPECTED)' %24filename.stderr%3B then%0a</WrapperShContents>
+ <WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents) printf "\n\t%24filename is not a managed assembly.\n\n"%0a</WrapperShContents>
+ <WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents) else%0a</WrapperShContents>
+ <WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents) echo Unable to precompile %24filename.%0a</WrapperShContents>
+ <WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents) fi%0a</WrapperShContents>
+ <WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents) fi%0a</WrapperShContents>
+ <WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents) rm %24filename.stdout%0a</WrapperShContents>
+ <WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents) rm %24filename.stderr%0a</WrapperShContents>
+ <WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents) done%0a</WrapperShContents>
+ <WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents) touch %24overlayDir/crossgenCompleted.mrk%0a</WrapperShContents>
+ <WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents)fi%0a</WrapperShContents>
+ <WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents)%0a</WrapperShContents>
+
<WrapperShContents>$(WrapperShContents)echo BEGIN EXECUTION%0a</WrapperShContents>
<WrapperShContents>$(WrapperShContents)echo "%24{HELIX_CORRELATION_PAYLOAD}/corerun" %24HELIX_WORKITEM_PAYLOAD/xunit.console.netcore.exe %24HELIX_WORKITEM_PAYLOAD/$(ProjectName) -noshadow -xml testResults.xml -notrait category=outerloop -notrait category=failing%0a</WrapperShContents>
<WrapperShContents>$(WrapperShContents)"%24{HELIX_CORRELATION_PAYLOAD}/corerun" %24HELIX_WORKITEM_PAYLOAD/xunit.console.netcore.exe %24HELIX_WORKITEM_PAYLOAD/$(ProjectName) -noshadow -xml testResults.xml -notrait category=outerloop -notrait category=failing%0a</WrapperShContents>
diff --git a/tests/issues.targets b/tests/issues.targets
index 9f8b2b3dd4..0592888bb3 100644
--- a/tests/issues.targets
+++ b/tests/issues.targets
@@ -187,6 +187,12 @@
<ExcludeList Include="$(XunitTestBinBase)\Loader\classloader\TypeGeneratorTests\TypeGeneratorTest683\Generated683\*">
<Issue>6707</Issue>
</ExcludeList>
+ <ExcludeList Include="$(XunitTestBinBase)\JIT\Methodical\tailcall_v4\smallFrame\smallFrame.cmd">
+ <Issue>9880</Issue>
+ </ExcludeList>
+ <ExcludeList Include="$(XunitTestBinBase)JIT\opt\Tailcall\TailcallVerifyWithPrefix\TailcallVerifyWithPrefix.cmd">
+ <Issue>9880</Issue>
+ </ExcludeList>
</ItemGroup>
<!-- The following are x86 failures -->
@@ -204,9 +210,6 @@
<ExcludeList Include="$(XunitTestBinBase)\GC\LargeMemory\API\gc\suppressfinalize\suppressfinalize.cmd">
<Issue>3392, test is useful to have because it can be run manually when making changes to the GC that can have effects in OOM scenarios, but not appropriate to run on our current test infrastructure.</Issue>
</ExcludeList>
- <ExcludeList Include="$(XunitTestBinBase)\JIT\Methodical\tailcall_v4\smallFrame\smallFrame.cmd">
- <Issue>tail. call pop ret is only supported on amd64</Issue>
- </ExcludeList>
<ExcludeList Include="$(XunitTestBinBase)\JIT\opt\Tailcall\TailcallVerifyWithPrefix\TailcallVerifyWithPrefix.cmd">
<Issue>2420. x86 JIT doesn't support implicit tail call optimization or tail. call pop ret sequence</Issue>
</ExcludeList>
@@ -409,7 +412,7 @@
<!-- The following are tests that fail on non-Windows, which we must not run when building against packages -->
- <ItemGroup Condition="'$(XunitTestBinBase)' != '' and '$(BuildTestsAgainstPackages)' == 'true' and '$(RuntimeID)' != ''">
+ <ItemGroup Condition="'$(XunitTestBinBase)' != '' and '$(BuildTestsAgainstPackages)' == 'true' and '$(TargetsWindows)' != 'true'">
<ExcludeList Include="$(XunitTestBinBase)\CoreMangLib\cti\system\byte\ByteToString3\ByteToString3.cmd">
<Issue>needs triage</Issue>
</ExcludeList>
@@ -434,6 +437,9 @@
<ExcludeList Include="$(XunitTestBinBase)\CoreMangLib\cti\system\multicastdelegate\MulticastDelegateCtor\MulticastDelegateCtor.cmd">
<Issue>needs triage</Issue>
</ExcludeList>
+ <ExcludeList Include="$(XunitTestBinBase)\CoreMangLib\cti\system\reflection\emit\DynMethodJumpStubTests\DynMethodJumpStubTests\DynMethodJumpStubTests.cmd">
+ <Issue>needs triage</Issue>
+ </ExcludeList>
<ExcludeList Include="$(XunitTestBinBase)\CoreMangLib\cti\system\runtime\interopservices\marshal\MarshalGetLastWin32Error_PSC\MarshalGetLastWin32Error_PSC.cmd">
<Issue>needs triage</Issue>
</ExcludeList>
@@ -1133,6 +1139,9 @@
<ExcludeList Include="$(XunitTestBinBase)\JIT\Regression\Dev11\dev10_865840\dev10_865840\dev10_865840.cmd">
<Issue>needs triage</Issue>
</ExcludeList>
+ <ExcludeList Include="$(XunitTestBinBase)\JIT\Regression\JITBlue\DevDiv_255294\DevDiv_255294\DevDiv_255294.cmd">
+ <Issue>11142</Issue>
+ </ExcludeList>
<ExcludeList Include="$(XunitTestBinBase)\JIT\Regression\VS-ia64-JIT\V1.2-Beta1\b302509\b302509\b302509.cmd">
<Issue>needs triage</Issue>
</ExcludeList>
diff --git a/tests/publishdependency.targets b/tests/publishdependency.targets
index eec373fb3c..6d1c6bdc78 100644
--- a/tests/publishdependency.targets
+++ b/tests/publishdependency.targets
@@ -23,11 +23,6 @@
</ItemGroup>
<ItemGroup>
- <NonWindowsProjectLockJsonFiles Include="@(CoreRootProjectLockJsonFiles)"/>
- <NonWindowsProjectLockJsonFiles Include="$(SourceDir)Common\build_against_pkg_dependencies\project.lock.json"/>
- </ItemGroup>
-
- <ItemGroup>
<RefProjectLockJsonFiles Include="$(SourceDir)Common\targeting_pack_ref\project.lock.json"/>
</ItemGroup>
@@ -36,7 +31,7 @@
</ItemGroup>
<ItemGroup>
- <CrossGenFiles Include="..\packages\runtime.$(MinOSForArch)-$(PackagePlatform).Microsoft.NETCore.Runtime.CoreCLR\$(CoreClrPackageVersion)\tools\crossgen.exe"/>
+ <CrossGenFiles Include="..\packages\runtime.$(TargetRid).Microsoft.NETCore.Runtime.CoreCLR\$(CoreClrPackageVersion)\tools\crossgen*"/>
</ItemGroup>
<PropertyGroup>
@@ -57,7 +52,7 @@
<PrereleaseResolveNuGetPackageAssets AllowFallbackOnTargetSelection="false"
IncludeFrameworkReferences="false"
NuGetPackagesDirectory="$(PackagesDir)"
- RuntimeIdentifier="$(TestNugetRuntimeId)"
+ RuntimeIdentifier="$(TargetRid)"
ProjectLanguage="$(Language)"
ProjectLockFile="%(CoreRootProjectLockJsonFiles.Identity)"
TargetMonikers="@(TestTargetFramework)">
@@ -90,70 +85,6 @@
</Copy>
</Target>
- <Target Name="CopyNonWindowsDependecyToCoreRoot"
- Inputs="@(NonWindowsProjectLockJsonFiles)"
- Outputs="$(CORE_OVERLAY)\*.*">
-
- <MSBuild Projects="$(SourceDir)Common\test_runtime\test_runtime.csproj"/>
-
- <MSBuild Projects="$(SourceDir)Common\test_dependencies\test_dependencies.csproj"/>
-
- <MSBuild Projects="$(SourceDir)Common\build_against_pkg_dependencies\build_against_pkg_dependencies.csproj"/>
-
- <!-- This will use the overridden PrereleaseResolveNuGetPackageAssets, which outputs copy local items
- for the xunit wrapper projects -->
- <PrereleaseResolveNuGetPackageAssets AllowFallbackOnTargetSelection="true"
- IncludeFrameworkReferences="false"
- NuGetPackagesDirectory="$(PackagesDir)"
- RuntimeIdentifier="$(RuntimeId)"
- ProjectLanguage="$(Language)"
- ProjectLockFile="%(NonWindowsProjectLockJsonFiles.Identity)"
- TargetMonikers="@(TestTargetFramework)">
- <Output TaskParameter="ResolvedAnalyzers" ItemName="Analyzer" />
- <Output TaskParameter="ResolvedReferences" ItemName="Reference" />
- <Output TaskParameter="ResolvedCopyLocalItems" ItemName="RunTimeCopyLocal" />
- </PrereleaseResolveNuGetPackageAssets>
- <ItemGroup>
- <RunTimeDependecyExclude Include="$(CORE_OVERLAY)\**\*.*" />
- <RunTimeDependecyExcludeFiles Include="@(RunTimeDependecyExclude -> '%(FileName)%(Extension)')" />
- <RunTimeDependecyExcludeFiles Include="@(RunTimeDependecyExclude -> '%(FileName).ni%(Extension)')" />
- <RunTimeDependecyExcludeFiles Include="@(RunTimeDependecyExclude -> '%(FileName).pdb')" />
- <AllResolvedRuntimeDependencies Include="@(RunTimeCopyLocal -> '%(FileName)%(Extension)')">
- <File>%(Identity)</File>
- </AllResolvedRuntimeDependencies>
- <RunTimeDependecyCopyLocalFile Include="@(AllResolvedRuntimeDependencies)" Exclude="@(RunTimeDependecyExcludeFiles)"/>
- <RunTimeDependecyCopyLocal Include="@(RunTimeDependecyCopyLocalFile -> '%(File)')" />
- <RunTimeDependecyCopyLocal Include="$(TargetingPackPath)/*" />
- </ItemGroup>
-
- <Copy
- SourceFiles="@(RunTimeDependecyCopyLocal)"
- DestinationFolder="$(CORE_OVERLAY)"
- SkipUnchangedFiles="$(SkipCopyUnchangedFiles)"
- OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
- Retries="$(CopyRetryCount)"
- RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
- UseHardlinksIfPossible="$(CreateHardLinksForCopyFilesToOutputDirectoryIfPossible)">
- <Output TaskParameter="DestinationFiles" ItemName="FileWrites" />
- </Copy>
-
- <ItemGroup>
- <NonWindowsCrossGenFiles Include="..\packages\runtime.$(RuntimeID).Microsoft.NETCore.Runtime.CoreCLR\$(CoreClrPackageVersion)\tools\crossgen"/>
- </ItemGroup>
-
- <Copy
- SourceFiles="@(NonWindowsCrossGenFiles)"
- DestinationFolder="$(CORE_OVERLAY)"
- SkipUnchangedFiles="$(SkipCopyUnchangedFiles)"
- OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
- Retries="$(CopyRetryCount)"
- RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
- UseHardlinksIfPossible="$(CreateHardLinksForCopyFilesToOutputDirectoryIfPossible)">
- <Output TaskParameter="DestinationFiles" ItemName="FileWrites" />
- </Copy>
-
- </Target>
-
<Target Name="CopyDependencyToRef"
Inputs="@(RefProjectLockJsonFiles)"
Outputs="$(RefDestination)\*.*">
@@ -165,7 +96,7 @@
<PrereleaseResolveNuGetPackageAssets AllowFallbackOnTargetSelection="true"
IncludeFrameworkReferences="false"
NuGetPackagesDirectory="$(PackagesDir)"
- RuntimeIdentifier="$(TestNugetRuntimeId)"
+ RuntimeIdentifier="$(TargetRid)"
ProjectLanguage="$(Language)"
ProjectLockFile="%(RefProjectLockJsonFiles.Identity)"
TargetMonikers="@(TestTargetFramework)">
@@ -197,7 +128,7 @@
<PrereleaseResolveNuGetPackageAssets AllowFallbackOnTargetSelection="true"
IncludeFrameworkReferences="false"
NuGetPackagesDirectory="$(PackagesDir)"
- RuntimeIdentifier="$(TestNugetRuntimeId)"
+ RuntimeIdentifier="$(TargetRid)"
ProjectLanguage="$(Language)"
ProjectLockFile="%(ProductProjectLockJsonFiles.Identity)"
TargetMonikers="@(TestTargetFramework)">
@@ -219,6 +150,7 @@
</Target>
<Target Name="CopyCrossgenToProduct"
+ AfterTargets="CopyDependencyToProduct"
Outputs="$(ProductDestination)\crossgen.exe;$(CORE_OVERLAY)\crossgen.exe">
<Copy
diff --git a/tests/runtest.proj b/tests/runtest.proj
index 58d3744a38..9ebe5c00b6 100644
--- a/tests/runtest.proj
+++ b/tests/runtest.proj
@@ -216,7 +216,7 @@ namespace $([System.String]::Copy($(Category)).Replace(".","_").Replace("\","").
</ItemGroup>
<PropertyGroup>
- <TestExecutableReplacement Condition="'$(RuntimeID)' != '' ">testExecutable = testExecutable.Replace("\\", "/")%3B</TestExecutableReplacement>
+ <TestExecutableReplacement Condition="'$(TargetsWindows)' != 'true' ">testExecutable = testExecutable.Replace("\\", "/")%3B</TestExecutableReplacement>
</PropertyGroup>
<ItemGroup>
@@ -323,23 +323,22 @@ namespace $([System.String]::Copy($(Category)).Replace(".","_").Replace("\","").
<Import Project="tests.targets" />
<Import Project="publishdependency.targets" />
+ <PropertyGroup>
+ <TargetRid Condition="'$(RuntimeId)' != ''">$(RuntimeId)</TargetRid>
+ <TargetRid Condition="'$(RuntimeId)' == ''">$(TestNugetRuntimeId)</TargetRid>
+ </PropertyGroup>
+
<Target Name="CreateTestOverlay">
<MSBuild Projects="$(MSBuildProjectFile)"
Targets="CopyDependecyToCoreRoot"
- Properties="Language=C#" />
- </Target>
-
- <Target Name="CreateNonWindowsTestOverlay">
- <MSBuild Projects="$(MSBuildProjectFile)"
- Targets="CopyNonWindowsDependecyToCoreRoot"
- Properties="Language=C#;NonWindowsRuntimeId=$(NonWindowsRuntimeId)" />
+ Properties="Language=C#;TargetRid=$(TargetRid)" />
</Target>
<Target Name="BinPlaceRef">
<!-- Copy mscorlib.dll from TargetingPack to bin/Product/ref, if we're building against packages -->
<MSBuild Projects="$(MSBuildProjectFile)"
Targets="CopyDependencyToRef"
- Properties="Language=C#"
+ Properties="Language=C#;TargetRid=$(TargetRid)"
Condition=" '$(BuildTestsAgainstPackages)'=='true' " />
</Target>
@@ -347,7 +346,7 @@ namespace $([System.String]::Copy($(Category)).Replace(".","_").Replace("\","").
<!-- Copy test dependencies to bin/Product, if we're building against packages -->
<MSBuild Projects="$(MSBuildProjectFile)"
Targets="CopyDependencyToProduct"
- Properties="Language=C#"
+ Properties="Language=C#;TargetRid=$(TargetRid)"
Condition=" '$(BuildTestsAgainstPackages)'=='true' " />
</Target>
diff --git a/tests/scripts/arm32_ci_script.sh b/tests/scripts/arm32_ci_script.sh
index 3124cc89ce..209ab39869 100755
--- a/tests/scripts/arm32_ci_script.sh
+++ b/tests/scripts/arm32_ci_script.sh
@@ -289,7 +289,7 @@ function cross_build_coreclr_with_docker {
# Cross building coreclr with rootfs in Docker
(set +x; echo "Start cross build coreclr for $__buildArch $__linuxCodeName")
- __buildCmd="./build.sh $__buildArch cross $__verboseFlag $__skipMscorlib $__buildConfig -rebuild clang3.9"
+ __buildCmd="./build.sh $__buildArch cross $__verboseFlag $__skipMscorlib $__buildConfig -rebuild"
$__dockerCmd $__buildCmd
sudo chown -R $(id -u -n) ./bin
}
diff --git a/tests/scripts/arm32_ci_test.sh b/tests/scripts/arm32_ci_test.sh
index 33a951e324..2f0b03150b 100755
--- a/tests/scripts/arm32_ci_test.sh
+++ b/tests/scripts/arm32_ci_test.sh
@@ -97,7 +97,7 @@ if [ "$__abi" == "armel" ]; then
mkdir -p ${__ROOTFS_DIR}
tar -zxf mic-output/tizen.tar.gz -C ${__ROOTFS_DIR}
apt-get update
- apt-get -y -qq --force-yes install --reinstall qemu binfmt-support qemu-user-static
+ apt-get -y -qq --force-yes --reinstall install qemu binfmt-support qemu-user-static
__qemuARM=$(which qemu-arm-static)
cp $__qemuARM ${CORECLR_DIR}/cross/rootfs/armel/usr/bin/
cp $__qemuARM ${__ROOTFS_DIR}/usr/bin/
@@ -112,6 +112,11 @@ mount -o bind /dev/pts ${__ROOTFS_DIR}/dev/pts
mount -o bind /sys ${__ROOTFS_DIR}/sys
mount -o bind ${CORECLR_DIR} ${__ROOTFS_DIR}${ARM_CHROOT_HOME_DIR}
+# Test environment emulation using docker and qemu has some problem to use lttng library.
+# We should remove libcoreclrtraceptprovider.so to avoid test hang.
+rm -f -v ${__ROOTFS_DIR}${ARM_CHROOT_HOME_DIR}/bin/Product/${__buildDirName}/libcoreclrtraceptprovider.so
+rm -f -v ${__ROOTFS_DIR}${ARM_CHROOT_HOME_DIR}/bin/CoreFxBinDir/libcoreclrtraceptprovider.so
+
chroot ${__ROOTFS_DIR} /bin/bash -x <<EOF
cd ${ARM_CHROOT_HOME_DIR}
./tests/runtest.sh --sequential\
diff --git a/tests/scripts/run-xunit-perf.cmd b/tests/scripts/run-xunit-perf.cmd
index bad1f93a40..7895b3f16e 100644
--- a/tests/scripts/run-xunit-perf.cmd
+++ b/tests/scripts/run-xunit-perf.cmd
@@ -2,179 +2,332 @@
@rem The .NET Foundation licenses this file to you under the MIT license.
@rem See the LICENSE file in the project root for more information.
-@setlocal
@echo off
-Setlocal EnableDelayedExpansion
-
-rem Set defaults for the file extension, architecture and configuration
-set CORECLR_REPO=%CD%
-set TEST_FILE_EXT=exe
-set TEST_ARCH=x64
-set TEST_ARCHITECTURE=x64
-set TEST_CONFIG=Release
-
-goto :ARGLOOP
-
-
-:SETUP
-
-IF /I [%TEST_ARCHITECTURE%] == [x86jit32] (
- set TEST_ARCH=x86
-) ELSE (
- set TEST_ARCH=%TEST_ARCHITECTURE%
-)
-
-set CORECLR_OVERLAY=%CORECLR_REPO%\bin\tests\Windows_NT.%TEST_ARCH%.%TEST_CONFIG%\Tests\Core_Root
-set RUNLOG=%CORECLR_REPO%\bin\Logs\perfrun.log
-
-if NOT EXIST %CORECLR_OVERLAY% (
- echo Can't find test overlay directory '%CORECLR_OVERLAY%'
- echo Please build and run Release CoreCLR tests
- exit /B 1
-)
-
-@echo --- setting up sandbox
-
-if exist sandbox rd /s /q sandbox
-if exist sandbox echo ERROR: Failed to remove the sandbox folder& exit /b 1
-if not exist sandbox mkdir sandbox
-if not exist sandbox echo ERROR: Failed to create the sandbox folder& exit /b 1
-pushd sandbox
-
-@rem stage stuff we need
-
-@rem xunit and perf
-"%CORECLR_REPO%\Tools\dotnetcli\dotnet.exe" restore "%CORECLR_REPO%\tests\src\Common\PerfHarness\project.json"
-"%CORECLR_REPO%\Tools\dotnetcli\dotnet.exe" publish "%CORECLR_REPO%\tests\src\Common\PerfHarness\project.json" -c Release -o %CORECLR_REPO%\sandbox
-xcopy /sy %CORECLR_REPO%\packages\Microsoft.Diagnostics.Tracing.TraceEvent\1.0.0-alpha-experimental\lib\native\* . >> %RUNLOG%
-xcopy /sy %CORECLR_REPO%\bin\tests\Windows_NT.%TEST_ARCH%.%TEST_CONFIG%\Tests\Core_Root\* . >> %RUNLOG%
-
-@rem find and stage the tests
-for /R %CORECLR_PERF% %%T in (*.%TEST_FILE_EXT%) do (
- call :DOIT %%T
-)
-
-@rem optionally upload results to benchview
-if not [%BENCHVIEW_PATH%] == [] (
- py "%BENCHVIEW_PATH%\submission.py" measurement.json ^
- --build ..\build.json ^
- --machine-data ..\machinedata.json ^
- --metadata ..\submission-metadata.json ^
- --group "CoreCLR" ^
- --type "%RUN_TYPE%" ^
- --config-name "%TEST_CONFIG%" ^
- --config Configuration "%TEST_CONFIG%" ^
- --config OS "Windows_NT" ^
- --arch "%TEST_ARCHITECTURE%" ^
- --machinepool "PerfSnake"
- py "%BENCHVIEW_PATH%\upload.py" submission.json --container coreclr
-)
-
-goto :EOF
-
-:DOIT
-set BENCHNAME=%~n1
-set BENCHDIR=%~p1
-set PERFOUT=perf-%BENCHNAME%
-set XMLOUT=%PERFOUT%-summary.xml
-
-echo --- Running %BENCHNAME%
-
-@rem copy benchmark and any input files
-
-xcopy /s %1 . >> %RUNLOG%
-xcopy /s %BENCHDIR%*.txt . >> %RUNLOG%
-
-set CORE_ROOT=%CORECLR_REPO%\sandbox
-
-@rem setup additional environment variables
-if DEFINED TEST_ENV (
- if EXIST !TEST_ENV! (
- call %TEST_ENV%
+@if defined _echo echo on
+
+setlocal
+ set ERRORLEVEL=
+ set BENCHVIEW_RUN_TYPE=local
+ set CORECLR_REPO=%CD%
+ set TEST_FILE_EXT=exe
+ set TEST_ARCH=x64
+ set TEST_ARCHITECTURE=x64
+ set TEST_CONFIG=Release
+ set IS_SCENARIO_TEST=
+ set USAGE_DISPLAYED=
+
+ call :parse_command_line_arguments %*
+ if defined USAGE_DISPLAYED exit /b %ERRORLEVEL%
+
+ call :set_test_architecture || exit /b 1
+ call :verify_core_overlay || exit /b 1
+ call :set_perf_run_log || exit /b 1
+ call :setup_sandbox || exit /b 1
+
+ call :run_cmd "%CORECLR_REPO%\Tools\dotnetcli\dotnet.exe" restore "%CORECLR_REPO%\tests\src\Common\PerfHarness\project.json" || exit /b 1
+ call :run_cmd "%CORECLR_REPO%\Tools\dotnetcli\dotnet.exe" publish "%CORECLR_REPO%\tests\src\Common\PerfHarness\project.json" -c Release -o "%CORECLR_REPO%\sandbox" || exit /b 1
+
+ rem TODO: Remove the version of the package to copy. e.g.) if multiple version exist, then error out?
+ call :run_cmd xcopy /sy "%CORECLR_REPO%\packages\Microsoft.Diagnostics.Tracing.TraceEvent\1.0.3-alpha-experimental\lib\native"\* . >> %RUNLOG% || exit /b 1
+ call :run_cmd xcopy /sy "%CORECLR_REPO%\bin\tests\Windows_NT.%TEST_ARCH%.%TEST_CONFIG%\Tests\Core_Root"\* . >> %RUNLOG% || exit /b 1
+
+ rem find and stage the tests
+ set /A "LV_FAILURES=0"
+ for /R %CORECLR_PERF% %%T in (*.%TEST_FILE_EXT%) do (
+ rem Skip known failures
+ call :run_benchmark %%T || (
+ set /A "LV_FAILURES+=1"
)
-)
-
-corerun.exe PerfHarness.dll %WORKSPACE%\sandbox\%BENCHNAME%.%TEST_FILE_EXT% --perf:runid Perf > %BENCHNAME%.out
-
-@rem optionally generate results for benchview
-if not [%BENCHVIEW_PATH%] == [] (
- py "%BENCHVIEW_PATH%\measurement.py" xunit "Perf-%BENCHNAME%.xml" --better desc --drop-first-value --append
- REM Save off the results to the root directory for recovery later in Jenkins
- xcopy Perf-%BENCHNAME%*.xml %CORECLR_REPO%\
- xcopy Perf-%BENCHNAME%*.etl %CORECLR_REPO%\
-) else (
- type %XMLOUT% | findstr "test name"
- type %XMLOUT% | findstr Duration
- type %XMLOUT% | findstr InstRetired
-)
-
-goto :EOF
-
-:ARGLOOP
-IF /I [%1] == [-testBinLoc] (
-set CORECLR_PERF=%CORECLR_REPO%\%2
-shift
-shift
-goto :ARGLOOP
-)
-IF /I [%1] == [-runtype] (
-set RUN_TYPE=%2
-shift
-shift
-goto :ARGLOOP
-)
-IF /I [%1] == [-library] (
-set TEST_FILE_EXT=dll
-shift
-goto :ARGLOOP
-)
-IF /I [%1] == [-uploadtobenchview] (
-set BENCHVIEW_PATH=%2
-shift
-shift
-goto :ARGLOOP
-)
-IF /I [%1] == [-arch] (
-set TEST_ARCHITECTURE=%2
-shift
-shift
-goto :ARGLOOP
-)
-IF /I [%1] == [-testEnv] (
-set TEST_ENV=%2
-shift
-shift
-goto :ARGLOOP
-)
-IF /I [%1] == [-configuration] (
-set TEST_CONFIG=%2
-shift
-shift
-goto :ARGLOOP
-)
-if /I [%1] == [-?] (
-goto :USAGE
-)
-if /I [%1] == [-help] (
-goto :USAGE
-)
-
-if [%CORECLR_PERF%] == [] (
-goto :USAGE
-)
-
-goto :SETUP
+ )
+
+ rem optionally upload results to benchview
+ if not [%BENCHVIEW_PATH%] == [] (
+ call :upload_to_benchview || exit /b 1
+ )
+
+ rem Numbers are limited to 32-bits of precision (Int32.MAX == 2^32 - 1).
+ if %LV_FAILURES% NEQ 0 (
+ call :print_error %LV_FAILURES% benchmarks has failed.
+ exit /b %LV_FAILURES%
+ )
+
+ exit /b %ERRORLEVEL%
+
+:run_benchmark
+rem ****************************************************************************
+rem Executes the xUnit Performance benchmarks
+rem ****************************************************************************
+setlocal
+ set BENCHNAME=%~n1
+ set BENCHDIR=%~p1
+ set PERFOUT=perf-%BENCHNAME%
+ set XMLOUT=%PERFOUT%.xml
+
+ rem copy benchmark and any input files
+ call :run_cmd xcopy /s %~1 . >> %RUNLOG% || exit /b 1
+ if exist "%BENCHDIR%*.txt" (
+ call :run_cmd xcopy /s %BENCHDIR%*.txt . >> %RUNLOG% || exit /b 1
+ )
+
+ set CORE_ROOT=%CORECLR_REPO%\sandbox
+
+ rem setup additional environment variables
+ if DEFINED TEST_ENV (
+ if EXIST "%TEST_ENV%" (
+ call "%TEST_ENV%"
+ )
+ )
+
+ set BENCHNAME_LOG_FILE_NAME=%BENCHNAME%.log
+ if defined IS_SCENARIO_TEST (
+ call :run_cmd corerun.exe "%CORECLR_REPO%\sandbox\%BENCHNAME%.%TEST_FILE_EXT%" --perf:runid Perf 1>"%BENCHNAME_LOG_FILE_NAME%" 2>&1
+ ) else (
+ call :run_cmd corerun.exe PerfHarness.dll "%CORECLR_REPO%\sandbox\%BENCHNAME%.%TEST_FILE_EXT%" --perf:runid Perf 1>"%BENCHNAME_LOG_FILE_NAME%" 2>&1
+ )
+
+ IF %ERRORLEVEL% NEQ 0 (
+ call :print_error corerun.exe exited with %ERRORLEVEL% code.
+ if exist "%BENCHNAME_LOG_FILE_NAME%" type "%BENCHNAME_LOG_FILE_NAME%"
+ exit /b 1
+ )
+
+ rem optionally generate results for benchview
+ if not [%BENCHVIEW_PATH%] == [] (
+ call :generate_results_for_benchview || exit /b 1
+ ) else (
+ type "%XMLOUT%" | findstr /i /c:"test name"
+ )
+
+ rem Save off the results to the root directory for recovery later in Jenkins
+ call :run_cmd xcopy "Perf-%BENCHNAME%*.xml" "%CORECLR_REPO%\" || exit /b 1
+ call :run_cmd xcopy "Perf-%BENCHNAME%*.etl" "%CORECLR_REPO%\" || exit /b 1
+
+ exit /b 0
+
+:parse_command_line_arguments
+rem ****************************************************************************
+rem Parses the script's command line arguments.
+rem ****************************************************************************
+ IF /I [%~1] == [-testBinLoc] (
+ set CORECLR_PERF=%CORECLR_REPO%\%~2
+ shift
+ shift
+ goto :parse_command_line_arguments
+ )
+ IF /I [%~1] == [-scenarioTest] (
+ set IS_SCENARIO_TEST=1
+ shift
+ goto :parse_command_line_arguments
+ )
+ IF /I [%~1] == [-runtype] (
+ set BENCHVIEW_RUN_TYPE=%~2
+ shift
+ shift
+ goto :parse_command_line_arguments
+ )
+ IF /I [%~1] == [-library] (
+ set TEST_FILE_EXT=dll
+ shift
+ goto :parse_command_line_arguments
+ )
+ IF /I [%~1] == [-uploadtobenchview] (
+ set BENCHVIEW_PATH=%~2
+ shift
+ shift
+ goto :parse_command_line_arguments
+ )
+ IF /I [%~1] == [-arch] (
+ set TEST_ARCHITECTURE=%~2
+ shift
+ shift
+ goto :parse_command_line_arguments
+ )
+ IF /I [%~1] == [-testEnv] (
+ set TEST_ENV=%~2
+ shift
+ shift
+ goto :parse_command_line_arguments
+ )
+ IF /I [%~1] == [-configuration] (
+ set TEST_CONFIG=%~2
+ shift
+ shift
+ goto :parse_command_line_arguments
+ )
+
+ if /I [%~1] == [-?] (
+ call :USAGE
+ exit /b 0
+ )
+ if /I [%~1] == [-help] (
+ call :USAGE
+ exit /b 0
+ )
+ if [%CORECLR_PERF%] == [] (
+ call :USAGE
+ )
+
+ exit /b %ERRORLEVEL%
+
+:set_test_architecture
+rem ****************************************************************************
+rem Sets the test architecture.
+rem ****************************************************************************
+ IF /I [%TEST_ARCHITECTURE%] == [x86jit32] (
+ set TEST_ARCH=x86
+ ) ELSE (
+ set TEST_ARCH=%TEST_ARCHITECTURE%
+ )
+ exit /b 0
+
+:verify_core_overlay
+rem ****************************************************************************
+rem Verify that the Core_Root folder exist.
+rem ****************************************************************************
+ set CORECLR_OVERLAY=%CORECLR_REPO%\bin\tests\Windows_NT.%TEST_ARCH%.%TEST_CONFIG%\Tests\Core_Root
+ if NOT EXIST "%CORECLR_OVERLAY%" (
+ call :print_error Can't find test overlay directory '%CORECLR_OVERLAY%'. Please build and run Release CoreCLR tests.
+ exit /B 1
+ )
+ exit /b 0
+
+:set_perf_run_log
+rem ****************************************************************************
+rem Sets the script's output log file.
+rem ****************************************************************************
+ if NOT EXIST "%CORECLR_REPO%\bin\Logs" (
+ call :print_error Cannot find the Logs folder '%CORECLR_REPO%\bin\Logs'.
+ exit /b 1
+ )
+ set RUNLOG=%CORECLR_REPO%\bin\Logs\perfrun.log
+ exit /b 0
+
+:setup_sandbox
+rem ****************************************************************************
+rem Creates the sandbox folder used by the script to copy binaries locally,
+rem and execute benchmarks.
+rem ****************************************************************************
+ if exist sandbox rd /s /q sandbox
+ if exist sandbox call :print_error Failed to remove the sandbox folder& exit /b 1
+ if not exist sandbox mkdir sandbox
+ if not exist sandbox call :print_error Failed to create the sandbox folder& exit /b 1
+ cd sandbox
+ exit /b 0
+
+:generate_results_for_benchview
+rem ****************************************************************************
+rem Generates results for BenchView, by appending new data to the existing
+rem measurement.json file.
+rem ****************************************************************************
+ set BENCHVIEW_MEASUREMENT_PARSER=xunit
+ if defined IS_SCENARIO_TEST set BENCHVIEW_MEASUREMENT_PARSER=xunitscenario
+
+ set LV_MEASUREMENT_ARGS=
+ set LV_MEASUREMENT_ARGS=%LV_MEASUREMENT_ARGS% %BENCHVIEW_MEASUREMENT_PARSER%
+ set LV_MEASUREMENT_ARGS=%LV_MEASUREMENT_ARGS% "Perf-%BENCHNAME%.xml"
+ set LV_MEASUREMENT_ARGS=%LV_MEASUREMENT_ARGS% --better desc
+ set LV_MEASUREMENT_ARGS=%LV_MEASUREMENT_ARGS% --drop-first-value
+ set LV_MEASUREMENT_ARGS=%LV_MEASUREMENT_ARGS% --append
+ call :run_cmd py.exe "%BENCHVIEW_PATH%\measurement.py" %LV_MEASUREMENT_ARGS%
+ IF %ERRORLEVEL% NEQ 0 (
+ call :print_error Failed to generate BenchView measurement data.
+ exit /b 1
+ )
+endlocal& exit /b %ERRORLEVEL%
+
+:upload_to_benchview
+rem ****************************************************************************
+rem Generates BenchView's submission data and upload it
+rem ****************************************************************************
+setlocal
+ set LV_SUBMISSION_ARGS=
+ set LV_SUBMISSION_ARGS=%LV_SUBMISSION_ARGS% --build ..\build.json
+ set LV_SUBMISSION_ARGS=%LV_SUBMISSION_ARGS% --machine-data ..\machinedata.json
+ set LV_SUBMISSION_ARGS=%LV_SUBMISSION_ARGS% --metadata ..\submission-metadata.json
+ set LV_SUBMISSION_ARGS=%LV_SUBMISSION_ARGS% --group "CoreCLR"
+ set LV_SUBMISSION_ARGS=%LV_SUBMISSION_ARGS% --type "%BENCHVIEW_RUN_TYPE%"
+ set LV_SUBMISSION_ARGS=%LV_SUBMISSION_ARGS% --config-name "%TEST_CONFIG%"
+ set LV_SUBMISSION_ARGS=%LV_SUBMISSION_ARGS% --config Configuration "%TEST_CONFIG%"
+ set LV_SUBMISSION_ARGS=%LV_SUBMISSION_ARGS% --config OS "Windows_NT"
+ set LV_SUBMISSION_ARGS=%LV_SUBMISSION_ARGS% --arch "%TEST_ARCHITECTURE%"
+ set LV_SUBMISSION_ARGS=%LV_SUBMISSION_ARGS% --machinepool "PerfSnake"
+ call :run_cmd py.exe "%BENCHVIEW_PATH%\submission.py" measurement.json %LV_SUBMISSION_ARGS%
+ IF %ERRORLEVEL% NEQ 0 (
+ call :print_error Creating BenchView submission data failed.
+ exit /b 1
+ )
+
+ call :run_cmd py.exe "%BENCHVIEW_PATH%\upload.py" submission.json --container coreclr
+ IF %ERRORLEVEL% NEQ 0 (
+ call :print_error Uploading to BenchView failed.
+ exit /b 1
+ )
+ exit /b %ERRORLEVEL%
:USAGE
-echo run-xunit-perf.cmd -testBinLoc ^<path_to_tests^> [-library] [-arch] ^<x86^|x64^> [-configuration] ^<Release^|Debug^> [-uploadToBenchview] ^<path_to_benchview_tools^> [-runtype] ^<rolling^|private^>
-
-echo For the path to the tests you can pass a parent directory and the script will grovel for
-echo all tests in subdirectories and run them.
-echo The library flag denotes whether the tests are build as libraries (.dll) or an executable (.exe)
-echo Architecture defaults to x64 and configuration defaults to release.
-echo -uploadtoBenchview is used to specify a path to the Benchview tooling and when this flag is
-echo set we will upload the results of the tests to the coreclr container in benchviewupload.
-echo Runtype sets the runtype that we upload to Benchview, rolling for regular runs, and private for
-echo PRs.
-
-goto :EOF
+rem ****************************************************************************
+rem Script's usage.
+rem ****************************************************************************
+ set USAGE_DISPLAYED=1
+ echo run-xunit-perf.cmd -testBinLoc ^<path_to_tests^> [-library] [-arch] ^<x86^|x64^> [-configuration] ^<Release^|Debug^> [-uploadToBenchview] ^<path_to_benchview_tools^> [-runtype] ^<rolling^|private^> [-scenarioTest]
+ echo/
+ echo For the path to the tests you can pass a parent directory and the script will grovel for
+ echo all tests in subdirectories and run them.
+ echo The library flag denotes whether the tests are build as libraries (.dll) or an executable (.exe)
+ echo Architecture defaults to x64 and configuration defaults to release.
+ echo -uploadtoBenchview is used to specify a path to the Benchview tooling and when this flag is
+ echo set we will upload the results of the tests to the coreclr container in benchviewupload.
+ echo Runtype sets the runtype that we upload to Benchview, rolling for regular runs, and private for
+ echo PRs.
+ echo -scenarioTest should be included if you are running a scenario benchmark.
+ exit /b %ERRORLEVEL%
+
+:print_error
+rem ****************************************************************************
+rem Function wrapper that unifies how errors are output by the script.
+rem Functions output to the standard error.
+rem ****************************************************************************
+ echo [%DATE%][%TIME:~0,-3%][ERROR] %* 1>&2
+ exit /b %ERRORLEVEL%
+
+:print_to_console
+rem ****************************************************************************
+rem Sends text to the console screen, no matter what (even when the script's
+rem output is redirected). This can be useful to provide information on where
+rem the script is executing.
+rem ****************************************************************************
+ if defined _debug (
+ echo [%DATE%][%TIME:~0,-3%] %* >CON
+ )
+ echo [%DATE%][%TIME:~0,-3%] %*
+ exit /b %ERRORLEVEL%
+
+:run_cmd
+rem ****************************************************************************
+rem Function wrapper used to send the command line being executed to the
+rem console screen, before the command is executed.
+rem ****************************************************************************
+ if "%~1" == "" (
+ call :print_error No command was specified.
+ exit /b 1
+ )
+
+ call :print_to_console $ %*
+ call %*
+ exit /b %ERRORLEVEL%
+
+:skip_failures
+rem ****************************************************************************
+rem Skip known failures
+rem ****************************************************************************
+ IF /I [%TEST_ARCHITECTURE%] == [x86jit32] (
+ IF /I "%~1" == "CscBench" (
+ rem https://github.com/dotnet/coreclr/issues/11088
+ exit /b 1
+ )
+ IF /I "%~1" == "SciMark2" (
+ rem https://github.com/dotnet/coreclr/issues/11089
+ exit /b 1
+ )
+ )
+ exit /b 0
diff --git a/tests/scripts/x86_ci_script.sh b/tests/scripts/x86_ci_script.sh
index 1f82c3010c..99a959616b 100755
--- a/tests/scripts/x86_ci_script.sh
+++ b/tests/scripts/x86_ci_script.sh
@@ -37,13 +37,13 @@ __buildDirName="$__buildOS.$__buildArch.$__buildConfig"
set -x
set -e
-__dockerImage="hseok82/dotnet-buildtools-prereqs:ubuntu1604_cross_prereqs_v3_x86"
+__dockerImage="hseok82/dotnet-buildtools-prereqs:ubuntu-16.04-crossx86-ef0ac75-20175511035548"
# Begin cross build
# We cannot build nuget package yet
__dockerEnvironmentSet="-e ROOTFS_DIR=/crossrootfs/x86"
__currentWorkingDir=`pwd`
-__dockerCmd="docker run -i --rm ${__dockerEnvironmentVariable} -v $__currentWorkingDir:/opt/code -w /opt/code $__dockerImage"
+__dockerCmd="docker run -i --rm ${__dockerEnvironmentSet} -v $__currentWorkingDir:/opt/code -w /opt/code $__dockerImage"
__buildCmd="./build.sh x86 cross skipnuget $__buildConfig"
$__dockerCmd $__buildCmd
diff --git a/tests/src/Common/PerfHarness/project.json b/tests/src/Common/PerfHarness/project.json
index d920190d11..a1ecb2867e 100644
--- a/tests/src/Common/PerfHarness/project.json
+++ b/tests/src/Common/PerfHarness/project.json
@@ -12,7 +12,7 @@
"type": "platform",
"version": "1.1.0"
},
- "xunit.performance.api": "1.0.0-alpha-build0049"
+ "xunit.performance.api": "1.0.0-beta-build0003"
}
}
}
diff --git a/tests/src/Common/build_against_pkg_dependencies/project.json b/tests/src/Common/build_against_pkg_dependencies/project.json
index 501dfec274..327340f11d 100644
--- a/tests/src/Common/build_against_pkg_dependencies/project.json
+++ b/tests/src/Common/build_against_pkg_dependencies/project.json
@@ -1,10 +1,10 @@
{
"dependencies": {
- "Microsoft.NETCore.ILAsm": "2.0.0-preview1-25212-04",
- "Microsoft.NETCore.ILDAsm": "2.0.0-preview1-25212-04",
- "Microsoft.NETCore.Jit": "2.0.0-preview1-25212-04",
- "Microsoft.NETCore.Runtime.CoreCLR": "2.0.0-preview1-25212-04",
- "Microsoft.NETCore.TestHost": "2.0.0-preview1-25212-04"
+ "Microsoft.NETCore.ILAsm": "2.0.0-preview1-25221-01",
+ "Microsoft.NETCore.ILDAsm": "2.0.0-preview1-25221-01",
+ "Microsoft.NETCore.Jit": "2.0.0-preview1-25221-01",
+ "Microsoft.NETCore.Runtime.CoreCLR": "2.0.0-preview1-25221-01",
+ "Microsoft.NETCore.TestHost": "2.0.0-preview1-25221-01"
},
"frameworks": {
"netcoreapp2.0": {
@@ -15,6 +15,8 @@
}
},
"runtimes": {
+ "win-x64": {},
+ "win-x86": {},
"win7-x86": {},
"win7-x64": {},
"win10-arm64": {},
@@ -22,6 +24,7 @@
"ubuntu.16.04-x64": {},
"ubuntu.16.10-x64": {},
"osx.10.12-x64": {},
+ "osx-x64": {},
"centos.7-x64": {},
"rhel.7-x64": {},
"debian.8-x64": {},
diff --git a/tests/src/Common/external/external.depproj b/tests/src/Common/external/external.depproj
index 3f7890601d..5a16122cdb 100644
--- a/tests/src/Common/external/external.depproj
+++ b/tests/src/Common/external/external.depproj
@@ -24,9 +24,6 @@
<PackageToInclude Include="xunit.extensibility.core"/>
<PackageToInclude Include="xunit.extensibility.execution"/>
<PackageToInclude Include="xunit.runner.utility"/>
- <PackageToInclude Include="Microsoft.DotNet.xunit.performance"/>
- <PackageToInclude Include="Microsoft.DotNet.xunit.performance.analysis"/>
- <PackageToInclude Include="Microsoft.DotNet.xunit.performance.runner.Windows"/>
<PackageToInclude Include="xunit.performance.api"/>
<PackageToInclude Include="xunit.performance.core"/>
<PackageToInclude Include="xunit.performance.execution"/>
@@ -37,7 +34,7 @@
<PackageToInclude Include="Microsoft.CodeAnalysis.Common"/>
<PackageToInclude Include="Microsoft.CodeAnalysis.Compilers"/>
<PackageToInclude Include="Microsoft.CodeAnalysis.CSharp"/>
- <PackageToInclude Include="Microsoft.CodeAnalysis.VisualBasic"/>
+ <PackageToInclude Include="Microsoft.CodeAnalysis.VisualBasic"/>
<PackageToInclude Include="$(XUnitRunnerPackageId)" />
</ItemGroup>
@@ -48,7 +45,7 @@
Text="Error: looks the package $(PackagesDir)$(XUnitRunnerPackageId)\$(XUnitPackageVersion) not restored or missing xunit.console.exe."
/>
<ItemGroup>
- <ReferenceCopyLocalPaths
+ <ReferenceCopyLocalPaths
Include="$(PackagesDir)$(XUnitRunnerPackageId)\$(XUnitPackageVersion)\tools\*.*"
Exclude="$(PackagesDir)$(XUnitRunnerPackageId)\$(XUnitPackageVersion)\tools\xunit.console.exe.config"
>
diff --git a/tests/src/Common/external/project.json b/tests/src/Common/external/project.json
index 63cdc04254..12c986a98b 100644
--- a/tests/src/Common/external/project.json
+++ b/tests/src/Common/external/project.json
@@ -1,10 +1,10 @@
{
"dependencies": {
"Microsoft.CodeAnalysis.Compilers": "1.1.1",
- "xunit.performance.api": "1.0.0-alpha-build0049",
- "xunit.performance.core": "1.0.0-alpha-build0049",
- "xunit.performance.execution": "1.0.0-alpha-build0049",
- "xunit.performance.metrics": "1.0.0-alpha-build0049",
+ "xunit.performance.api": "1.0.0-beta-build0003",
+ "xunit.performance.core": "1.0.0-beta-build0003",
+ "xunit.performance.execution": "1.0.0-beta-build0003",
+ "xunit.performance.metrics": "1.0.0-beta-build0003",
"Microsoft.Diagnostics.Tracing.TraceEvent": "1.0.3-alpha-experimental",
"Newtonsoft.Json": "9.0.1",
"xunit": "2.2.0-beta2-build3300",
@@ -23,4 +23,4 @@
"win7-x86": {},
"win7-x64": {}
}
-} \ No newline at end of file
+}
diff --git a/tests/src/Common/netcoreapp/project.json b/tests/src/Common/netcoreapp/project.json
index 2fae8dd6c6..ca40b18d1e 100644
--- a/tests/src/Common/netcoreapp/project.json
+++ b/tests/src/Common/netcoreapp/project.json
@@ -1,7 +1,7 @@
{
"dependencies": {
"Microsoft.NETCore.App": "2.0.0-beta-001494-00",
- "System.Runtime.CompilerServices.Unsafe": "4.4.0-preview1-25210-01"
+ "System.Runtime.CompilerServices.Unsafe": "4.4.0-preview1-25221-01"
},
"frameworks": {
"netcoreapp2.0": {}
diff --git a/tests/src/Common/targeting_pack_ref/project.json b/tests/src/Common/targeting_pack_ref/project.json
index ea49ba346a..0754b74690 100644
--- a/tests/src/Common/targeting_pack_ref/project.json
+++ b/tests/src/Common/targeting_pack_ref/project.json
@@ -1,6 +1,6 @@
{
"dependencies": {
- "Microsoft.TargetingPack.Private.CoreCLR": "2.0.0-preview1-25212-04"
+ "Microsoft.TargetingPack.Private.CoreCLR": "2.0.0-preview1-25221-01"
},
"frameworks": {
"netcoreapp1.1": {
diff --git a/tests/src/Common/test_dependencies/project.json b/tests/src/Common/test_dependencies/project.json
index 89a5d6b6eb..4477c687e0 100644
--- a/tests/src/Common/test_dependencies/project.json
+++ b/tests/src/Common/test_dependencies/project.json
@@ -1,9 +1,10 @@
{
"dependencies": {
- "Microsoft.NETCore.Platforms": "2.0.0-preview1-25210-01",
- "Microsoft.Private.CoreFx.NETCoreApp": "4.4.0-preview1-25210-01",
- "System.Memory": "4.4.0-preview1-25210-01",
- "System.Runtime.CompilerServices.Unsafe": "4.4.0-preview1-25210-01"
+ "Microsoft.NETCore.Platforms": "2.0.0-preview1-25221-01",
+ "Microsoft.Private.CoreFx.NETCoreApp": "4.4.0-preview1-25221-01",
+ "System.Memory": "4.4.0-preview1-25221-01",
+ "System.Runtime.CompilerServices.Unsafe": "4.4.0-preview1-25221-01",
+ "System.Security.Permissions": "4.4.0-preview1-25221-01"
},
"frameworks": {
"netcoreapp2.0": {
@@ -15,12 +16,15 @@
}
},
"runtimes": {
+ "win-x64": {},
+ "win-x86": {},
"win7-x86": {},
"win7-x64": {},
"ubuntu.14.04-x64": {},
"ubuntu.16.04-x64": {},
"ubuntu.16.10-x64": {},
"osx.10.12-x64": {},
+ "osx-x64": {},
"centos.7-x64": {},
"rhel.7-x64": {},
"debian.8-x64": {},
diff --git a/tests/src/Common/test_runtime/project.json b/tests/src/Common/test_runtime/project.json
index 0f82a117e8..575d75d089 100644
--- a/tests/src/Common/test_runtime/project.json
+++ b/tests/src/Common/test_runtime/project.json
@@ -1,6 +1,6 @@
{
"dependencies": {
- "Microsoft.NETCore.Platforms": "2.0.0-preview1-25210-01",
+ "Microsoft.NETCore.Platforms": "2.0.0-preview1-25221-01",
"Microsoft.DotNet.CoreCLR.TestDependencies": "1.0.0-prerelease",
"jit-dasm": "0.0.1.4",
"cijobs": "0.0.1.2",
@@ -15,15 +15,19 @@
}
},
"runtimes": {
+ "win-x64": {},
+ "win-x86": {},
"win7-x86": {},
"win7-x64": {},
"ubuntu.14.04-x64": {},
"ubuntu.16.04-x64": {},
"ubuntu.16.10-x64": {},
"osx.10.12-x64": {},
+ "osx-x64": {},
"centos.7-x64": {},
"rhel.7-x64": {},
"debian.8-x64": {},
- "fedora.24-x64": {}
+ "fedora.24-x64": {},
+ "linux-x64": {}
}
}
diff --git a/tests/src/CoreMangLib/cti/system/delegate/delegateequals1.cs b/tests/src/CoreMangLib/cti/system/delegate/delegateequals1.cs
index ca99d679c8..b94fa69872 100644
--- a/tests/src/CoreMangLib/cti/system/delegate/delegateequals1.cs
+++ b/tests/src/CoreMangLib/cti/system/delegate/delegateequals1.cs
Binary files differ
diff --git a/tests/src/CoreMangLib/cti/system/delegate/delegategethashcode1.cs b/tests/src/CoreMangLib/cti/system/delegate/delegategethashcode1.cs
index 8c77c9b77a..05ba3629b1 100644
--- a/tests/src/CoreMangLib/cti/system/delegate/delegategethashcode1.cs
+++ b/tests/src/CoreMangLib/cti/system/delegate/delegategethashcode1.cs
Binary files differ
diff --git a/tests/src/CoreMangLib/cti/system/delegate/delegategetinvocationlist1.cs b/tests/src/CoreMangLib/cti/system/delegate/delegategetinvocationlist1.cs
index 3f1d311172..b0396aaea8 100644
--- a/tests/src/CoreMangLib/cti/system/delegate/delegategetinvocationlist1.cs
+++ b/tests/src/CoreMangLib/cti/system/delegate/delegategetinvocationlist1.cs
Binary files differ
diff --git a/tests/src/CoreMangLib/cti/system/delegate/delegateremove.cs b/tests/src/CoreMangLib/cti/system/delegate/delegateremove.cs
index aba475d184..f75ec6f2b0 100644
--- a/tests/src/CoreMangLib/cti/system/delegate/delegateremove.cs
+++ b/tests/src/CoreMangLib/cti/system/delegate/delegateremove.cs
Binary files differ
diff --git a/tests/src/CoreMangLib/cti/system/delegate/delegateremoveimpl.cs b/tests/src/CoreMangLib/cti/system/delegate/delegateremoveimpl.cs
index d06e82a12a..8325a4e455 100644
--- a/tests/src/CoreMangLib/cti/system/delegate/delegateremoveimpl.cs
+++ b/tests/src/CoreMangLib/cti/system/delegate/delegateremoveimpl.cs
Binary files differ
diff --git a/tests/src/GC/API/GC/GetGenerationWR2.csproj b/tests/src/GC/API/GC/GetGenerationWR2.csproj
index edafe56ca9..438bbd0cfc 100644
--- a/tests/src/GC/API/GC/GetGenerationWR2.csproj
+++ b/tests/src/GC/API/GC/GetGenerationWR2.csproj
@@ -10,7 +10,7 @@
<OutputType>Exe</OutputType>
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
- <GCStressIncompatible Condition="'$(Platform)' == 'x86'">true</GCStressIncompatible>
+ <GCStressIncompatible>true</GCStressIncompatible>
<CLRTestExecutionArguments></CLRTestExecutionArguments>
</PropertyGroup>
diff --git a/tests/src/GC/Stress/Framework/ReliabilityConfiguration.cs b/tests/src/GC/Stress/Framework/ReliabilityConfiguration.cs
index f5fe8dbb8e..6be9e66f41 100644
--- a/tests/src/GC/Stress/Framework/ReliabilityConfiguration.cs
+++ b/tests/src/GC/Stress/Framework/ReliabilityConfiguration.cs
@@ -413,11 +413,22 @@ public class ReliabilityConfig : IEnumerable, IEnumerator
case RFConfigOptions.RFConfigOptions_Test_MinMaxTestsUseCPUCount:
if (GetTrueFalseOptionValue(currentXML.Value, RFConfigOptions.RFConfigOptions_Test_MinMaxTestsUseCPUCount))
{
- int CPUCount = Convert.ToInt32(Environment.GetEnvironmentVariable("NUMBER_OF_PROCESSORS"));
- if (CPUCount <= 0)
- throw new Exception("Invalid Value when reading NUMBER_OF_PROCESSORS: {0}" + CPUCount);
- _curTestSet.MinTestsRunning = CPUCount;
- _curTestSet.MaxTestsRunning = (int)(CPUCount * 1.5);
+ string numProcessors = Environment.GetEnvironmentVariable("NUMBER_OF_PROCESSORS");
+ int cpuCount;
+ if (numProcessors == null)
+ {
+ Console.WriteLine("NUMBER_OF_PROCESSORS environment variable not supplied, falling back to Environment");
+ cpuCount = Environment.ProcessorCount;
+ }
+ else
+ {
+ cpuCount = Convert.ToInt32(Environment.GetEnvironmentVariable("NUMBER_OF_PROCESSORS"));
+ }
+
+ if (cpuCount <= 0)
+ throw new Exception("Invalid Value when reading processor count: " + cpuCount);
+ _curTestSet.MinTestsRunning = cpuCount;
+ _curTestSet.MaxTestsRunning = (int)(cpuCount * 1.5);
}
break;
case RFConfigOptions.RFConfigOptions_Test_SuppressConsoleOutputFromTests:
diff --git a/tests/src/GC/Stress/Framework/ReliabilityFramework.cs b/tests/src/GC/Stress/Framework/ReliabilityFramework.cs
index 6aaeddf2f2..cb7bcabbca 100644
--- a/tests/src/GC/Stress/Framework/ReliabilityFramework.cs
+++ b/tests/src/GC/Stress/Framework/ReliabilityFramework.cs
@@ -35,23 +35,54 @@ using System.Runtime.Loader;
internal class CustomAssemblyResolver : AssemblyLoadContext
{
- protected override Assembly Load(AssemblyName assemblyName)
+ private string _frameworkPath;
+ private string _testsPath;
+
+ public CustomAssemblyResolver()
{
- Console.WriteLine("\nCustomAssemblyLoader: Got request to load {0}\n", assemblyName.ToString());
+ Console.WriteLine("CustomAssemblyResolver initializing");
+ _frameworkPath = Environment.GetEnvironmentVariable("BVT_ROOT");
+ if (_frameworkPath == null)
+ {
+ Console.WriteLine("CustomAssemblyResolver: BVT_ROOT not set");
+ _frameworkPath = Environment.GetEnvironmentVariable("CORE_ROOT");
+ }
- string strBVTRoot = Environment.GetEnvironmentVariable("BVT_ROOT");
- if (String.IsNullOrEmpty(strBVTRoot))
- strBVTRoot = Path.Combine(Directory.GetCurrentDirectory(), "Tests");
+ if (_frameworkPath == null)
+ {
+ Console.WriteLine("CustomAssemblyResolver: CORE_ROOT not set");
+ _frameworkPath = Directory.GetCurrentDirectory();
+ }
+
+ Console.WriteLine("CustomAssemblyResolver: looking for framework libraries at path: {0}", _frameworkPath);
+ string stressFrameworkDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
+ Console.WriteLine("CustomAssemblyResolver: currently executing assembly is at path: {0}", stressFrameworkDir);
+ _testsPath = Path.Combine(stressFrameworkDir, "Tests");
+ Console.WriteLine("CustomAssemblyResolver: looking for tests in dir: {0}", _testsPath);
+ }
+
+ protected override Assembly Load(AssemblyName assemblyName)
+ {
+ Console.WriteLine("CustomAssemblyLoader: Got request to load {0}", assemblyName.ToString());
- string strPath = Path.Combine(strBVTRoot, assemblyName.Name + ".exe");
+ string strPath;
+ if (assemblyName.Name.StartsWith("System."))
+ {
+ Console.WriteLine("CustomAssemblyLoader: this looks like a framework assembly");
+ strPath = Path.Combine(_frameworkPath, assemblyName.Name + ".dll");
+ }
+ else
+ {
+ Console.WriteLine("CustomAssemblyLoader: this looks like a test");
+ strPath = Path.Combine(_testsPath, assemblyName.Name + ".exe");
+ }
- Console.WriteLine("Incoming AssemblyName: {0}\n", assemblyName.ToString());
- Console.WriteLine("Trying to Load: {0}\n", strPath);
- Console.WriteLine("Computed AssemblyName: {0}\n", GetAssemblyName(strPath).ToString());
+ Console.WriteLine("Incoming AssemblyName: {0}", assemblyName.ToString());
+ Console.WriteLine("Trying to Load: {0}", strPath);
+ Console.WriteLine("Computed AssemblyName: {0}", GetAssemblyName(strPath).ToString());
Assembly asmLoaded = LoadFromAssemblyPath(strPath);
- //Console.WriteLine("Loaded {0} from {1}", asmLoaded.FullName, asmLoaded.Location);
- Console.WriteLine("Loaded {0}", asmLoaded.FullName);
+ Console.WriteLine("Loaded {0} from {1}", asmLoaded.FullName, asmLoaded.Location);
return asmLoaded;
}
@@ -217,7 +248,7 @@ public class ReliabilityFramework
if (eTemp == null)
{
rf._logger.WriteToInstrumentationLog(null, LoggingLevels.Tests, String.Format("Exception while running tests: {0}", e));
- Console.WriteLine("There was an exception while attempting to run the tests: See Instrumentation Log for details");
+ Console.WriteLine("There was an exception while attempting to run the tests: See Instrumentation Log for details. (Exception: {0})", e);
}
}
}
@@ -529,6 +560,7 @@ public class ReliabilityFramework
return (99);
}
+#if !PROJECTK_BUILD
[DllImport("kernel32.dll")]
private extern static void DebugBreak();
@@ -537,6 +569,7 @@ public class ReliabilityFramework
[DllImport("kernel32.dll")]
private extern static void OutputDebugString(string debugStr);
+#endif
/// <summary>
/// Checks to see if we should block all execution due to a fatal error
@@ -558,12 +591,20 @@ public class ReliabilityFramework
}
internal static void MyDebugBreak(string extraData)
{
+#if !PROJECTK_BUILD
if (IsDebuggerPresent())
{
OutputDebugString(String.Format("\r\n\r\n\r\nRELIABILITYFRAMEWORK DEBUGBREAK: Breaking in because test throw an exception ({0})\r\n\r\n\r\n", extraData));
DebugBreak();
}
else
+#else
+ if (Debugger.IsAttached)
+ {
+ Console.WriteLine(string.Format("DebugBreak: breaking in because test threw an exception: {0}", extraData));
+ Debugger.Break();
+ }
+#endif
{
// We need to stop the process now,
// but all the threads are still running
@@ -669,7 +710,7 @@ public class ReliabilityFramework
ourPageFaultsCounter = new PerformanceCounter("Process", "Page Faults/sec", myProcessName);
}
}
-#endif
+#endif
/// <summary>
/// Calculates the total number of tests to be run based upon the maximum
/// number of loops & number of tests in the current test set.
@@ -1017,7 +1058,7 @@ public class ReliabilityFramework
test.TestStarted();
StartTestWorker(test);
-#else
+#else
try
{
if (curTestSet.AppDomainLoaderMode == AppDomainLoaderMode.Lazy)
@@ -1062,7 +1103,7 @@ public class ReliabilityFramework
{
HandleOom(e, "StartTest");
}
-#endif
+#endif
}
/// <summary>
@@ -1439,7 +1480,7 @@ public class ReliabilityFramework
{
SignalTestFinished(daTest);
}
-#endif
+#endif
break;
}
}
@@ -1531,15 +1572,31 @@ public class ReliabilityFramework
{
RunCommands(test.PreCommands, "pre", test);
+ List<string> newPaths = new List<string>(paths);
+ string bvtRoot = Environment.GetEnvironmentVariable("BVT_ROOT");
+ if (bvtRoot != null)
+ {
+ newPaths.Add(bvtRoot);
+ }
+
+ string coreRoot = Environment.GetEnvironmentVariable("CORE_ROOT");
+ if (coreRoot != null)
+ {
+ newPaths.Add(coreRoot);
+ }
+
+ string thisRoot = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Tests");
+ newPaths.Add(thisRoot);
+
switch (test.TestStartMode)
{
case TestStartModeEnum.ProcessLoader:
- TestPreLoader_Process(test, paths);
+ TestPreLoader_Process(test, newPaths.ToArray());
break;
case TestStartModeEnum.AppDomainLoader:
#if PROJECTK_BUILD
Console.WriteLine("Appdomain mode is NOT supported for ProjectK");
-#else
+#else
TestPreLoader_AppDomain(test, paths);
#endif
break;
@@ -1688,21 +1745,30 @@ public class ReliabilityFramework
{
Console.WriteLine("Preloading for process mode");
+ Console.WriteLine("basepath: {0}, asm: {1}", test.BasePath, test.Assembly);
+ foreach (var path in paths)
+ {
+ Console.WriteLine(" path: {0}", path);
+ }
string realpath = ReliabilityConfig.ConvertPotentiallyRelativeFilenameToFullPath(test.BasePath, test.Assembly);
Debug.Assert(test.TestObject == null);
+ Console.WriteLine("Real path: {0}", realpath);
if (File.Exists(realpath))
{
test.TestObject = realpath;
}
else if (File.Exists((string)test.Assembly))
{
+ Console.WriteLine("asm path: {0}", test.Assembly);
test.TestObject = test.Assembly;
}
else
{
foreach (string path in paths)
{
+ Console.WriteLine("Candidate path: {0}", path);
string fullPath = ReliabilityConfig.ConvertPotentiallyRelativeFilenameToFullPath(path, (string)test.Assembly);
+ Console.WriteLine("Candidate full path: {0}", fullPath);
if (File.Exists(fullPath))
{
test.TestObject = fullPath;
@@ -1710,6 +1776,7 @@ public class ReliabilityFramework
}
}
}
+
if (test.TestObject == null)
{
Console.WriteLine("Couldn't find path for {0}", test.Assembly);
@@ -1740,7 +1807,7 @@ public class ReliabilityFramework
test.EntryPointMethod = methodInfo;
}
-#endif
+#endif
}
#if !PROJECTK_BUILD
@@ -1902,6 +1969,7 @@ Thanks for contributing to CLR Stress!
{
try
{
+#if !PROJECTK_BUILD
// Record the failure to the database
string arguments = String.Format("//b //nologo %SCRIPTSDIR%\\record.js -i %STRESSID% -a LOG_FAILED_TEST -k \"FAILED {0}\"", test.RefOrID);
ProcessStartInfo psi = new ProcessStartInfo("cscript.exe", Environment.ExpandEnvironmentVariables(arguments));
@@ -1916,6 +1984,7 @@ Thanks for contributing to CLR Stress!
Console.WriteLine("//b //nologo record.js -i %STRESSID% -a LOG_FAILED_TEST -k \"{0}\"", test.RefOrID);
}
p.Dispose();
+#endif
}
catch
{
diff --git a/tests/src/Interop/StringMarshalling/LPSTR/CMakeLists.txt b/tests/src/Interop/StringMarshalling/LPSTR/CMakeLists.txt
index aa3fd76ff6..3d30d825b7 100755..100644
--- a/tests/src/Interop/StringMarshalling/LPSTR/CMakeLists.txt
+++ b/tests/src/Interop/StringMarshalling/LPSTR/CMakeLists.txt
@@ -7,4 +7,4 @@ add_library (LPSTRTestNative SHARED ${SOURCES})
target_link_libraries(LPSTRTestNative ${LINK_LIBRARIES_ADDITIONAL})
# add the install targets
-install (TARGETS LPSTRTestNative DESTINATION bin) \ No newline at end of file
+install (TARGETS LPSTRTestNative DESTINATION bin)
diff --git a/tests/src/Interop/StringMarshalling/LPSTR/LPSTRTest.cs b/tests/src/Interop/StringMarshalling/LPSTR/LPSTRTest.cs
index f704791cfd..12cff70438 100755..100644
--- a/tests/src/Interop/StringMarshalling/LPSTR/LPSTRTest.cs
+++ b/tests/src/Interop/StringMarshalling/LPSTR/LPSTRTest.cs
Binary files differ
diff --git a/tests/src/Interop/StringMarshalling/LPSTR/LPSTRTest.csproj b/tests/src/Interop/StringMarshalling/LPSTR/LPSTRTest.csproj
index 88a0330578..d78ecb19e6 100755..100644
--- a/tests/src/Interop/StringMarshalling/LPSTR/LPSTRTest.csproj
+++ b/tests/src/Interop/StringMarshalling/LPSTR/LPSTRTest.csproj
@@ -39,4 +39,4 @@
</ProjectReference>
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-</Project> \ No newline at end of file
+</Project>
diff --git a/tests/src/Interop/StringMarshalling/LPSTR/LPSTRTestNative.cpp b/tests/src/Interop/StringMarshalling/LPSTR/LPSTRTestNative.cpp
index b440c52ef5..b440c52ef5 100755..100644
--- a/tests/src/Interop/StringMarshalling/LPSTR/LPSTRTestNative.cpp
+++ b/tests/src/Interop/StringMarshalling/LPSTR/LPSTRTestNative.cpp
diff --git a/tests/src/Interop/StringMarshalling/LPSTR/PinvokeDef.cs b/tests/src/Interop/StringMarshalling/LPSTR/PinvokeDef.cs
index ce8455f9fa..31d0ebaf73 100755..100644
--- a/tests/src/Interop/StringMarshalling/LPSTR/PinvokeDef.cs
+++ b/tests/src/Interop/StringMarshalling/LPSTR/PinvokeDef.cs
@@ -70,4 +70,4 @@ namespace NativeDefs
[DllImport(NativeBinaryName)]
public static extern bool ReverseP_MarshalStrB_Out(Del_MarshalStrB_Out d);
}
-} \ No newline at end of file
+}
diff --git a/tests/src/Interop/StringMarshalling/LPTSTR/CMakeLists.txt b/tests/src/Interop/StringMarshalling/LPTSTR/CMakeLists.txt
index f99a6e5ab7..f99a6e5ab7 100755..100644
--- a/tests/src/Interop/StringMarshalling/LPTSTR/CMakeLists.txt
+++ b/tests/src/Interop/StringMarshalling/LPTSTR/CMakeLists.txt
diff --git a/tests/src/Interop/StringMarshalling/LPTSTR/LPTSTRTest.cs b/tests/src/Interop/StringMarshalling/LPTSTR/LPTSTRTest.cs
index cc7369f155..cc7369f155 100755..100644
--- a/tests/src/Interop/StringMarshalling/LPTSTR/LPTSTRTest.cs
+++ b/tests/src/Interop/StringMarshalling/LPTSTR/LPTSTRTest.cs
Binary files differ
diff --git a/tests/src/Interop/StringMarshalling/LPTSTR/LPTSTRTestNative.cpp b/tests/src/Interop/StringMarshalling/LPTSTR/LPTSTRTestNative.cpp
index bc3fa07ae6..15b6038e74 100755..100644
--- a/tests/src/Interop/StringMarshalling/LPTSTR/LPTSTRTestNative.cpp
+++ b/tests/src/Interop/StringMarshalling/LPTSTR/LPTSTRTestNative.cpp
@@ -100,24 +100,24 @@ extern "C" DLL_EXPORT LPWSTR MarshalPointer_Out(/*[out]*/ LPWSTR *s)
return ReturnString();
}
-typedef LPTSTR (__stdcall * Test_Del_MarshalStrB_InOut)(/*[in,out]*/ LPTSTR s);
-extern "C" DLL_EXPORT BOOL NATIVEAPI ReverseP_MarshalStrB_InOut(Test_Del_MarshalStrB_InOut d, /*[in]*/ LPCTSTR s)
+typedef LPWSTR (__stdcall * Test_Del_MarshalStrB_InOut)(/*[in,out]*/ LPWSTR s);
+extern "C" DLL_EXPORT BOOL NATIVEAPI ReverseP_MarshalStrB_InOut(Test_Del_MarshalStrB_InOut d, /*[in]*/ LPCWSTR s)
{
- LPTSTR ret = d((LPTSTR)s);
- LPTSTR expectedret =(LPTSTR)W("Native");
- LPTSTR expectedstr = (LPTSTR)W("m");
+ LPWSTR ret = d((LPWSTR)s);
+ LPWSTR expectedret =(LPWSTR)W("Native");
+ LPWSTR expectedstr = (LPWSTR)W("m");
- size_t lenret = _tcslen(ret);
- size_t lenexpectedret = _tcslen(expectedret);
- if((lenret != lenexpectedret)||(_tcsncmp(ret,expectedret,lenret)!=0))
+ size_t lenret = wcslen(ret);
+ size_t lenexpectedret = wcslen(expectedret);
+ if((lenret != lenexpectedret)||(wcsncmp(ret,expectedret,lenret)!=0))
{
printf("Error in ReverseP_MarshalStrB_InOut, Returned value didn't match\n");
return FALSE;
}
- size_t lenstr = _tcslen(s);
- size_t lenexpectedstr = _tcslen(expectedstr);
- if((lenstr != lenexpectedstr)||(_tcsncmp(s,expectedstr,lenstr)!=0))
+ size_t lenstr = wcslen(s);
+ size_t lenexpectedstr = wcslen(expectedstr);
+ if((lenstr != lenexpectedstr)||(wcsncmp(s,expectedstr,lenstr)!=0))
{
printf("Error in ReverseP_MarshalStrB_InOut, Changed value didn't reflect on native side.\n");
return FALSE;
@@ -126,25 +126,25 @@ extern "C" DLL_EXPORT BOOL NATIVEAPI ReverseP_MarshalStrB_InOut(Test_Del_Marshal
return TRUE;
}
-typedef LPTSTR (__cdecl * Test_Del_MarshalStrB_Out)(/*[out]*/ LPTSTR * s);
+typedef LPWSTR (__cdecl * Test_Del_MarshalStrB_Out)(/*[out]*/ LPWSTR * s);
extern "C" DLL_EXPORT BOOL NATIVEAPI ReverseP_MarshalStrB_Out(Test_Del_MarshalStrB_Out d)
{
- LPTSTR s;
- LPTSTR ret = d((LPTSTR*)&s);
- LPTSTR expectedret = (LPTSTR)W("Native");
- LPTSTR expectedstr = (LPTSTR)W("Managed");
-
- size_t lenret = _tcslen(ret);
- size_t lenexpectedret = _tcslen(expectedret);
- if((lenret != lenexpectedret)||(_tcsncmp(ret,expectedret,lenret)!=0))
+ LPWSTR s;
+ LPWSTR ret = d((LPWSTR*)&s);
+ LPWSTR expectedret = (LPWSTR)W("Native");
+ LPWSTR expectedstr = (LPWSTR)W("Managed");
+
+ size_t lenret = wcslen(ret);
+ size_t lenexpectedret = wcslen(expectedret);
+ if((lenret != lenexpectedret)||(wcsncmp(ret,expectedret,lenret)!=0))
{
printf("Error in ReverseP_MarshalStrB_Out, Returned value didn't match\n");
return FALSE;
}
- size_t lenstr = _tcslen(s);
- size_t lenexpectedstr = _tcslen(expectedstr);
- if((lenstr != lenexpectedstr)||(_tcsncmp(s,expectedstr,lenstr)!=0))
+ size_t lenstr = wcslen(s);
+ size_t lenexpectedstr = wcslen(expectedstr);
+ if((lenstr != lenexpectedstr)||(wcsncmp(s,expectedstr,lenstr)!=0))
{
printf("Error in ReverseP_MarshalStrB_Out, Changed value didn't reflect on native side.\n");
return FALSE;
diff --git a/tests/src/Interop/StringMarshalling/LPTSTR/LPTSTRTestPInvokeDef.cs b/tests/src/Interop/StringMarshalling/LPTSTR/LPTSTRTestPInvokeDef.cs
index f54397ba6b..f54397ba6b 100755..100644
--- a/tests/src/Interop/StringMarshalling/LPTSTR/LPTSTRTestPInvokeDef.cs
+++ b/tests/src/Interop/StringMarshalling/LPTSTR/LPTSTRTestPInvokeDef.cs
diff --git a/tests/src/Interop/common/xplatform.h b/tests/src/Interop/common/xplatform.h
index 36c4e56f02..370ebe8d12 100644
--- a/tests/src/Interop/common/xplatform.h
+++ b/tests/src/Interop/common/xplatform.h
@@ -194,7 +194,9 @@ int wcsncpy_s(LPWSTR strDestination, size_t size1, LPCWSTR strSource)
}
-int wmemcmp(LPWSTR str1, LPWSTR str2,size_t len)
+#define wcsncmp wmemcmp
+
+int wmemcmp(LPCWSTR str1, LPCWSTR str2,size_t len)
{
// < 0 str1 less than str2
// 0 str1 identical to str2
diff --git a/tests/src/JIT/CheckProjects/CheckProjects.cs b/tests/src/JIT/CheckProjects/CheckProjects.cs
index dc44d2e634..be42ab9cfe 100644
--- a/tests/src/JIT/CheckProjects/CheckProjects.cs
+++ b/tests/src/JIT/CheckProjects/CheckProjects.cs
@@ -52,9 +52,9 @@ internal class ScanProjectFiles
if (binIndex < 0)
{
- Console.WriteLine("CORE_ROOT must be set to full path to repo test dir; was '{0}'.",
- coreRoot);
- return -1;
+ Console.WriteLine("No bin directory found in CORE_ROOT path `{0}`," +
+ " so no checking will be performed.", coreRoot);
+ return 100;
}
string repoRoot = coreRoot.Substring(0, binIndex);
@@ -78,8 +78,8 @@ internal class ScanProjectFiles
if (!Directory.Exists(projectRoot))
{
- Console.WriteLine("Project directory does not exist");
- return -1;
+ Console.WriteLine("Project directory does not exist, so no checking will be performed.");
+ return 100;
}
DirectoryInfo projectRootDir = new DirectoryInfo(projectRoot);
diff --git a/tests/src/JIT/Directed/pinvoke/calli_excep.il b/tests/src/JIT/Directed/pinvoke/calli_excep.il
index 157643f70c..87683448a6 100644
--- a/tests/src/JIT/Directed/pinvoke/calli_excep.il
+++ b/tests/src/JIT/Directed/pinvoke/calli_excep.il
@@ -33,7 +33,7 @@
int32 V_1)
.try
{
- ldc.i4 0xc0000005
+ ldc.i4 0xC0000017
ldc.i4.0
dup
dup
@@ -44,7 +44,7 @@
calli void (unsigned int32, unsigned int32, unsigned int32, native uint)
leave.s IL_001d
} // end .try
- catch [mscorlib]System.AccessViolationException
+ catch [mscorlib]System.OutOfMemoryException
{
IL_000f: stloc.0
IL_0010: ldloc.0
diff --git a/tests/src/JIT/Performance/CodeQuality/Span/Indexer.cs b/tests/src/JIT/Performance/CodeQuality/Span/Indexer.cs
new file mode 100644
index 0000000000..4a7264ba92
--- /dev/null
+++ b/tests/src/JIT/Performance/CodeQuality/Span/Indexer.cs
@@ -0,0 +1,1021 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Text;
+using Xunit;
+using Microsoft.Xunit.Performance;
+
+[assembly: OptimizeForBenchmarks]
+[assembly: MeasureInstructionsRetired]
+
+namespace Span
+{
+ class Sink
+ {
+ [MethodImpl(MethodImplOptions.NoInlining)]
+ public static Sink NewSink() { return new Sink(); }
+
+ public byte b;
+ public int i;
+ }
+
+ [AttributeUsage(AttributeTargets.Method, Inherited = false)]
+ class CategoryAttribute : Attribute
+ {
+ public CategoryAttribute(string name)
+ {
+ _name = name;
+ }
+ string _name;
+ public string Name => _name;
+ }
+
+ public class IndexerBench
+ {
+ const int Iterations = 1000000;
+ const int DefaultLength = 1024;
+ const byte Expected = 70;
+ static bool HasFailure = false;
+
+ [Benchmark(InnerIterationCount = Iterations)]
+ [InlineData(DefaultLength)]
+ [Category("Indexer in-loop bounds check elimination")]
+ public static void Ref(int length)
+ {
+ byte[] a = GetData(length);
+
+ Invoke((int innerIterationCount) =>
+ {
+ Span<byte> s = new Span<byte>(a);
+ byte result = 0;
+ for (int i = 0; i < innerIterationCount; ++i)
+ {
+ result = TestRef(s);
+ }
+ return result;
+ },
+ "Ref({0})", length);
+ }
+
+ [MethodImpl(MethodImplOptions.NoInlining)]
+ static byte TestRef(Span<byte> data)
+ {
+ ref byte p = ref data.DangerousGetPinnableReference();
+ int length = data.Length;
+ byte x = 0;
+
+ for (var idx = 0; idx < length; idx++)
+ {
+ x ^= Unsafe.Add(ref p, idx);
+ }
+
+ return x;
+ }
+
+ [Benchmark(InnerIterationCount = Iterations)]
+ [InlineData(DefaultLength)]
+ [Category("Indexer in-loop bounds check elimination")]
+ public static void Fixed1(int length)
+ {
+ byte[] a = GetData(length);
+
+ Invoke((int innerIterationCount) =>
+ {
+ Span<byte> s = new Span<byte>(a);
+ byte result = 0;
+ for (int i = 0; i < innerIterationCount; ++i)
+ {
+ result = TestFixed1(s);
+ }
+ return result;
+ },
+ "Fixed1({0})", length);
+ }
+
+ [MethodImpl(MethodImplOptions.NoInlining)]
+ static unsafe byte TestFixed1(Span<byte> data)
+ {
+ fixed (byte* pData = &data.DangerousGetPinnableReference())
+ {
+ int length = data.Length;
+ byte x = 0;
+ byte* p = pData;
+
+ for (var idx = 0; idx < length; idx++)
+ {
+ x ^= *(p + idx);
+ }
+
+ return x;
+ }
+ }
+
+ [Benchmark(InnerIterationCount = Iterations)]
+ [InlineData(DefaultLength)]
+ [Category("Indexer in-loop bounds check elimination")]
+ public static void Fixed2(int length)
+ {
+ byte[] a = GetData(length);
+
+ Invoke((int innerIterationCount) =>
+ {
+ Span<byte> s = new Span<byte>(a);
+ byte result = 0;
+ for (int i = 0; i < innerIterationCount; ++i)
+ {
+ result = TestFixed2(s);
+ }
+ return result;
+ },
+ "Fixed2({0})", length);
+ }
+
+ [MethodImpl(MethodImplOptions.NoInlining)]
+ static unsafe byte TestFixed2(Span<byte> data)
+ {
+ fixed (byte* pData = &data.DangerousGetPinnableReference())
+ {
+ int length = data.Length;
+ byte x = 0;
+
+ for (var idx = 0; idx < length; idx++)
+ {
+ x ^= pData[idx];
+ }
+
+ return x;
+ }
+ }
+
+ [Benchmark(InnerIterationCount = Iterations)]
+ [InlineData(DefaultLength)]
+ [Category("Indexer in-loop bounds check elimination")]
+ public static void Indexer1(int length)
+ {
+ byte[] a = GetData(length);
+
+ Invoke((int innerIterationCount) =>
+ {
+ Span<byte> s = new Span<byte>(a);
+ byte result = 0;
+ for (int i = 0; i < innerIterationCount; ++i)
+ {
+ result = TestIndexer1(s);
+ }
+ return result;
+ },
+ "Indexer1({0})", length);
+ }
+
+ [MethodImpl(MethodImplOptions.NoInlining)]
+ static byte TestIndexer1(Span<byte> data)
+ {
+ int length = data.Length;
+ byte x = 0;
+
+ for (var idx = 0; idx < length; idx++)
+ {
+ x ^= data[idx];
+ }
+
+ return x;
+ }
+
+ [Benchmark(InnerIterationCount = Iterations)]
+ [InlineData(DefaultLength)]
+ [Category("Indexer in-loop bounds check elimination")]
+ public static void Indexer2(int length)
+ {
+ byte[] a = GetData(length);
+
+ Invoke((int innerIterationCount) =>
+ {
+ Span<byte> s = new Span<byte>(a);
+ byte result = 0;
+ for (int i = 0; i < innerIterationCount; ++i)
+ {
+ result = TestIndexer2(s);
+ }
+ return result;
+ },
+ "Indexer2({0})", length);
+ }
+
+ [MethodImpl(MethodImplOptions.NoInlining)]
+ static byte TestIndexer2(Span<byte> data)
+ {
+ byte x = 0;
+
+ for (var idx = 0; idx < data.Length; idx++)
+ {
+ x ^= data[idx];
+ }
+
+ return x;
+ }
+
+ [Benchmark(InnerIterationCount = Iterations)]
+ [InlineData(DefaultLength)]
+ [Category("Indexer in-loop bounds check elimination")]
+ public static void Indexer3(int length)
+ {
+ byte[] a = GetData(length);
+
+ Invoke((int innerIterationCount) =>
+ {
+ Span<byte> s = new Span<byte>(a);
+ byte result = 0;
+ for (int i = 0; i < innerIterationCount; ++i)
+ {
+ result = TestIndexer3(s);
+ }
+ return result;
+ },
+ "Indexer3({0})", length);
+ }
+
+ [MethodImpl(MethodImplOptions.NoInlining)]
+ static byte TestIndexer3(Span<byte> data)
+ {
+ Span<byte> data2 = data;
+
+ byte x = 0;
+
+ for (var idx = 0; idx < data2.Length; idx++)
+ {
+ x ^= data2[idx];
+ }
+
+ return x;
+ }
+
+ [Benchmark(InnerIterationCount=Iterations / 10)]
+ [InlineData(DefaultLength)]
+ [Category("Indexer in-loop bounds check elimination")]
+ public static void Indexer4(int length)
+ {
+ byte[] a = GetData(length);
+
+ Invoke((int innerIterationCount) =>
+ {
+ Span<byte> s = new Span<byte>(a);
+ byte result = 0;
+ int inner = Math.Max(1, (innerIterationCount / 10));
+ for (int i = 0; i < inner ; ++i)
+ {
+ result = TestIndexer4(s, 10);
+ }
+ return result;
+ },
+ "Indexer4({0})", length);
+ }
+
+ [MethodImpl(MethodImplOptions.NoInlining)]
+ static byte TestIndexer4(Span<byte> data, int iterations)
+ {
+ byte x = 0;
+ int length = data.Length;
+
+ // This does more or less the same work as TestIndexer1
+ // but is expressed as a loop nest.
+ for (int i = 0; i < iterations; i++)
+ {
+ x = 0;
+
+ for (var idx = 0; idx < length; idx++)
+ {
+ x ^= data[idx];
+ }
+ }
+
+ return x;
+ }
+
+ [Benchmark(InnerIterationCount = Iterations)]
+ [InlineData(DefaultLength)]
+ [Category("Indexer in-loop bounds check elimination")]
+ public static void Indexer5(int length)
+ {
+ byte[] a = GetData(length);
+ int z = 0;
+
+ Invoke((int innerIterationCount) =>
+ {
+ Span<byte> s = new Span<byte>(a);
+ byte result = 0;
+ for (int i = 0; i < innerIterationCount; ++i)
+ {
+ result = TestIndexer5(s, out z);
+ }
+ return result;
+ },
+ "Indexer5({0})", length);
+ }
+
+ [MethodImpl(MethodImplOptions.NoInlining)]
+ static byte TestIndexer5(Span<byte> data, out int z)
+ {
+ byte x = 0;
+ z = -1;
+
+ // Write to z here should not be able to modify
+ // the span.
+ for (var idx = 0; idx < data.Length; idx++)
+ {
+ x ^= data[idx];
+ z = idx;
+ }
+
+ return x;
+ }
+
+ [Benchmark(InnerIterationCount = Iterations)]
+ [InlineData(DefaultLength)]
+ [Category("Indexer in-loop bounds check elimination")]
+ public static void Indexer6(int length)
+ {
+ byte[] a = GetData(length);
+
+ Invoke((int innerIterationCount) =>
+ {
+ Span<byte> s = new Span<byte>(a);
+ byte result = 0;
+ for (int i = 0; i < innerIterationCount; ++i)
+ {
+ result = TestIndexer6(s);
+ }
+ return result;
+ },
+ "Indexer6({0})", length);
+ }
+
+ [MethodImpl(MethodImplOptions.NoInlining)]
+ static byte TestIndexer6(Span<byte> data)
+ {
+ byte x = 0;
+ Sink s = Sink.NewSink();
+
+ // Write to s.i here should not be able to modify
+ // the span.
+ for (var idx = 0; idx < data.Length; idx++)
+ {
+ x ^= data[idx];
+ s.i = 0;
+ }
+
+ return x;
+ }
+
+ [Benchmark(InnerIterationCount = Iterations)]
+ [InlineData(DefaultLength)]
+ [Category("Indexer in-loop bounds check elimination")]
+ public static void ReadOnlyIndexer1(int length)
+ {
+ byte[] a = GetData(length);
+
+ Invoke((int innerIterationCount) =>
+ {
+ ReadOnlySpan<byte> s = new ReadOnlySpan<byte>(a);
+ byte result = 0;
+ for (int i = 0; i < innerIterationCount; ++i)
+ {
+ result = TestReadOnlyIndexer1(s);
+ }
+ return result;
+ },
+ "ReadOnlyIndexer1({0})", length);
+ }
+
+ [MethodImpl(MethodImplOptions.NoInlining)]
+ static byte TestReadOnlyIndexer1(ReadOnlySpan<byte> data)
+ {
+ int length = data.Length;
+ byte x = 0;
+
+ for (var idx = 0; idx < length; idx++)
+ {
+ x ^= data[idx];
+ }
+
+ return x;
+ }
+
+ [Benchmark(InnerIterationCount = Iterations)]
+ [InlineData(DefaultLength)]
+ [Category("Indexer in-loop bounds check elimination")]
+ public static void ReadOnlyIndexer2(int length)
+ {
+ byte[] a = GetData(length);
+
+ Invoke((int innerIterationCount) =>
+ {
+ ReadOnlySpan<byte> s = new ReadOnlySpan<byte>(a);
+ byte result = 0;
+ for (int i = 0; i < innerIterationCount; ++i)
+ {
+ result = TestReadOnlyIndexer2(s);
+ }
+ return result;
+ },
+ "ReadOnlyIndexer2({0})", length);
+ }
+
+ [MethodImpl(MethodImplOptions.NoInlining)]
+ static byte TestReadOnlyIndexer2(ReadOnlySpan<byte> data)
+ {
+ byte x = 0;
+
+ for (var idx = 0; idx < data.Length; idx++)
+ {
+ x ^= data[idx];
+ }
+
+ return x;
+ }
+
+ [Benchmark(InnerIterationCount = Iterations)]
+ [InlineData(DefaultLength)]
+ [Category("Indexer in-loop bounds check elimination w/ writes")]
+ public static void WriteViaIndexer1(int length)
+ {
+ byte[] a = GetData(length);
+
+ Invoke((int innerIterationCount) =>
+ {
+ Span<byte> s = new Span<byte>(a);
+ byte result = 0;
+ for (int i = 0; i < innerIterationCount; ++i)
+ {
+ result = TestWriteViaIndexer1(s);
+ }
+ return result;
+ },
+ "WriteViaIndexer1({0})", length);
+ }
+
+ [MethodImpl(MethodImplOptions.NoInlining)]
+ static byte TestWriteViaIndexer1(Span<byte> data)
+ {
+ byte q = data[0];
+
+ for (var idx = 1; idx < data.Length; idx++)
+ {
+ data[0] ^= data[idx];
+ }
+
+ byte x = data[0];
+ data[0] = q;
+
+ return x;
+ }
+
+ [Benchmark(InnerIterationCount = Iterations)]
+ [InlineData(DefaultLength)]
+ [Category("Indexer in-loop bounds check elimination w/ writes")]
+ public static void WriteViaIndexer2(int length)
+ {
+ byte[] a = GetData(length);
+
+ Invoke((int innerIterationCount) =>
+ {
+ Span<byte> s = new Span<byte>(a);
+ byte result = 0;
+ for (int i = 0; i < innerIterationCount; ++i)
+ {
+ result = TestWriteViaIndexer2(s, 0, length);
+ }
+ return result;
+ },
+ "WriteViaIndexer2({0})", length);
+ }
+
+ [MethodImpl(MethodImplOptions.NoInlining)]
+ static byte TestWriteViaIndexer2(Span<byte> data, int start, int end)
+ {
+ byte x = 0;
+
+ for (var idx = start; idx < end; idx++)
+ {
+ // Bounds checks are redundant
+ byte b = data[idx];
+ x ^= b;
+ data[idx] = b;
+ }
+
+ return x;
+ }
+
+ [Benchmark(InnerIterationCount = Iterations)]
+ [InlineData(DefaultLength)]
+ [Category("Span known size bounds check elimination")]
+ public static void KnownSizeArray(int length)
+ {
+ if (length != 1024)
+ {
+ throw new Exception("test requires 1024 byte length");
+ }
+
+ Invoke((int innerIterationCount) =>
+ {
+ byte result = TestKnownSizeArray(innerIterationCount);
+ return result;
+ },
+ "KnownSizeArray({0})", length);
+ }
+
+ [MethodImpl(MethodImplOptions.NoInlining)]
+ static byte TestKnownSizeArray(int innerIterationCount)
+ {
+ byte[] a = new byte[1024];
+ SetData(a);
+ Span<byte> data = new Span<byte>(a);
+ byte x = 0;
+
+ for (int i = 0; i < innerIterationCount; i++)
+ {
+ x = 0;
+ for (var idx = 0; idx < data.Length; idx++)
+ {
+ x ^= data[idx];
+ }
+ }
+
+ return x;
+ }
+
+ [Benchmark(InnerIterationCount = Iterations)]
+ [InlineData(DefaultLength)]
+ [Category("Span known size bounds check elimination")]
+ public static void KnownSizeCtor(int length)
+ {
+ if (length < 1024)
+ {
+ throw new Exception("test requires at least 1024 byte length");
+ }
+
+ byte[] a = GetData(length);
+
+ Invoke((int innerIterationCount) =>
+ {
+ byte result = TestKnownSizeCtor(a, innerIterationCount);
+ return result;
+ },
+ "KnownSizeCtor({0})", length);
+ }
+
+ [MethodImpl(MethodImplOptions.NoInlining)]
+ static byte TestKnownSizeCtor(byte[] a, int innerIterationCount)
+ {
+ Span<byte> data = new Span<byte>(a, 0, 1024);
+ byte x = 0;
+
+ for (int i = 0; i < innerIterationCount; i++)
+ {
+ x = 0;
+ for (var idx = 0; idx < data.Length; idx++)
+ {
+ x ^= data[idx];
+ }
+ }
+
+ return x;
+ }
+
+ [Benchmark(InnerIterationCount = Iterations)]
+ [InlineData(DefaultLength)]
+ [Category("Span known size bounds check elimination")]
+ public static void KnownSizeCtor2(int length)
+ {
+ if (length < 1024)
+ {
+ throw new Exception("test requires at least 1024 byte length");
+ }
+
+ byte[] a = GetData(length);
+
+ Invoke((int innerIterationCount) =>
+ {
+ byte result = TestKnownSizeCtor2(a, innerIterationCount);
+ return result;
+ },
+ "KnownSizeCtor2({0})", length);
+ }
+
+ [MethodImpl(MethodImplOptions.NoInlining)]
+ static byte TestKnownSizeCtor2(byte[] a, int innerIterationCount)
+ {
+ Span<byte> data1 = new Span<byte>(a, 0, 512);
+ Span<byte> data2 = new Span<byte>(a, 512, 512);
+ byte x = 0;
+
+ for (int i = 0; i < innerIterationCount; i++)
+ {
+ x = 0;
+ for (var idx = 0; idx < data1.Length; idx++)
+ {
+ x ^= data1[idx];
+ }
+ for (var idx = 0; idx < data2.Length; idx++)
+ {
+ x ^= data2[idx];
+ }
+ }
+
+ return x;
+ }
+
+ [Benchmark(InnerIterationCount = Iterations)]
+ [InlineData(DefaultLength)]
+ [Category("Same index in-loop redundant bounds check elimination")]
+ public static void SameIndex1(int length)
+ {
+ byte[] a = GetData(length);
+
+ Invoke((int innerIterationCount) =>
+ {
+ Span<byte> s = new Span<byte>(a);
+ byte result = 0;
+ for (int i = 0; i < innerIterationCount; ++i)
+ {
+ result = TestSameIndex1(s, 0, length);
+ }
+ return result;
+ },
+ "SameIndex1({0})", length);
+ }
+
+ [MethodImpl(MethodImplOptions.NoInlining)]
+ static byte TestSameIndex1(Span<byte> data, int start, int end)
+ {
+ byte x = 0;
+ byte y = 0;
+
+ for (var idx = start; idx < end; idx++)
+ {
+ x ^= data[idx];
+ y ^= data[idx];
+ }
+
+ byte t = (byte)(y ^ x ^ y);
+
+ return t;
+ }
+
+ [Benchmark(InnerIterationCount = Iterations)]
+ [InlineData(DefaultLength)]
+ [Category("Same index in-loop redundant bounds check elimination")]
+ public static void SameIndex2(int length)
+ {
+ byte[] a = GetData(length);
+
+ Invoke((int innerIterationCount) =>
+ {
+ Span<byte> s = new Span<byte>(a);
+ byte result = 0;
+ for (int i = 0; i < innerIterationCount; ++i)
+ {
+ result = TestSameIndex2(s, ref s[0], 0, length);
+ }
+ return result;
+ },
+ "SameIndex2({0})", length);
+ }
+
+ [MethodImpl(MethodImplOptions.NoInlining)]
+ static byte TestSameIndex2(Span<byte> data, ref byte b, int start, int end)
+ {
+ byte x = 0;
+ byte y = 0;
+ byte ye = 121;
+ byte q = data[0];
+
+ for (var idx = start; idx < end; idx++)
+ {
+ // Bounds check is redundant, but values are not CSEs.
+ x ^= data[idx];
+ b = 1;
+ y ^= data[idx];
+ }
+
+ byte t = (byte)(y ^ x ^ ye);
+ data[0] = q;
+
+ return t;
+ }
+
+ [Benchmark(InnerIterationCount = Iterations)]
+ [InlineData(DefaultLength)]
+ [Category("Covered index in-loop redundant bounds check elimination")]
+ public static void CoveredIndex1(int length)
+ {
+ if (length < 100)
+ {
+ throw new Exception("test requires at least 100 byte length");
+ }
+
+ byte[] a = GetData(length);
+
+ Invoke((int innerIterationCount) =>
+ {
+ Span<byte> s = new Span<byte>(a);
+ byte result = 0;
+ for (int i = 0; i < innerIterationCount; ++i)
+ {
+ result = TestCoveredIndex1(s, 0, length);
+ }
+ return result;
+ },
+ "CoveredIndex1({0})", length);
+ }
+
+ [MethodImpl(MethodImplOptions.NoInlining)]
+ static byte TestCoveredIndex1(Span<byte> data, int start, int end)
+ {
+ byte x = 0;
+ byte y = 0;
+
+ for (var idx = start; idx < end - 100; idx++)
+ {
+ x ^= data[idx + 100];
+ y ^= data[idx];
+ }
+
+ for (var idx = end - 100; idx < end; idx++)
+ {
+ y ^= data[idx];
+ x ^= data[idx - 100];
+ }
+
+ byte r = (byte)(x ^ y ^ x);
+
+ return r;
+ }
+
+ [Benchmark(InnerIterationCount = Iterations)]
+ [InlineData(DefaultLength)]
+ [Category("Covered index in-loop redundant bounds check elimination")]
+ public static void CoveredIndex2(int length)
+ {
+ byte[] a = GetData(length);
+
+ Invoke((int innerIterationCount) =>
+ {
+ Span<byte> s = new Span<byte>(a);
+ byte result = 0;
+ for (int i = 0; i < innerIterationCount; ++i)
+ {
+ result = TestCoveredIndex2(s, 0, length);
+ }
+ return result;
+ },
+ "CoveredIndex2({0})", length);
+ }
+
+ [MethodImpl(MethodImplOptions.NoInlining)]
+ static byte TestCoveredIndex2(Span<byte> data, int start, int end)
+ {
+ byte x = 0;
+ byte y = 0;
+
+ for (var idx = start; idx < end; idx++)
+ {
+ x ^= data[idx];
+
+ if (idx != 100)
+ {
+ // Should be able to eliminate this bounds check
+ y ^= data[0];
+ }
+ }
+
+ byte r = (byte)(y ^ x ^ y);
+
+ return r;
+ }
+
+ [Benchmark(InnerIterationCount = Iterations)]
+ [InlineData(DefaultLength)]
+ [Category("Covered index in-loop redundant bounds check elimination")]
+ public static void CoveredIndex3(int length)
+ {
+ if (length < 50)
+ {
+ throw new Exception("test requires at least 100 byte length");
+ }
+
+ byte[] a = GetData(length);
+
+ Invoke((int innerIterationCount) =>
+ {
+ Span<byte> s = new Span<byte>(a);
+ byte result = 0;
+ for (int i = 0; i < innerIterationCount; ++i)
+ {
+ result = TestCoveredIndex3(s, 0, length);
+ }
+ return result;
+ },
+ "CoveredIndex3({0})", length);
+ }
+
+ [MethodImpl(MethodImplOptions.NoInlining)]
+ static byte TestCoveredIndex3(Span<byte> data, int start, int end)
+ {
+ byte x = 0;
+ byte y = 0;
+ byte z = 0;
+
+ for (var idx = start; idx < end; idx++)
+ {
+ x ^= data[idx];
+
+ if (idx != 100)
+ {
+ y ^= data[50];
+ // Should be able to eliminate this bounds check
+ z ^= data[25];
+ }
+ }
+
+ byte r = (byte)(z ^ y ^ x ^ y ^ z);
+
+ return r;
+ }
+
+ // Invoke routine to abstract away the difference between running under xunit-perf vs running from the
+ // command line. Inner loop to be measured is taken as an Func<int, byte>, and invoked passing the number
+ // of iterations that the inner loop should execute.
+ static void Invoke(Func<int, byte> innerLoop, string nameFormat, params object[] nameArgs)
+ {
+ if (IsXunitInvocation)
+ {
+ foreach (var iteration in Benchmark.Iterations)
+ using (iteration.StartMeasurement())
+ innerLoop((int)Benchmark.InnerIterationCount);
+ }
+ else
+ {
+ if (DoWarmUp)
+ {
+ // Run some warm-up iterations before measuring
+ innerLoop(CommandLineInnerIterationCount);
+ // Clear the flag since we're now warmed up (caller will
+ // reset it before calling new code)
+ DoWarmUp = false;
+ }
+
+ // Now do the timed run of the inner loop.
+ Stopwatch sw = Stopwatch.StartNew();
+ byte check = innerLoop(CommandLineInnerIterationCount);
+ sw.Stop();
+
+ // Print result.
+ string name = String.Format(nameFormat, nameArgs);
+ double timeInMs = sw.Elapsed.TotalMilliseconds;
+ Console.Write("{0,25}: {1,7:F2}ms", name, timeInMs);
+
+ bool failed = (check != Expected);
+ if (failed)
+ {
+ Console.Write(" -- failed to validate, got {0} expected {1}", check, Expected);
+ HasFailure = true;
+ }
+ Console.WriteLine();
+ }
+ }
+
+ static byte[] GetData(int size)
+ {
+ byte[] data = new byte[size];
+ SetData(data);
+ return data;
+ }
+
+ static void SetData(byte[] data)
+ {
+ Random Rnd = new Random(42);
+ Rnd.NextBytes(data);
+ }
+
+ static bool IsXunitInvocation = true;
+ static int CommandLineInnerIterationCount = 1;
+ static bool DoWarmUp;
+
+ public static void Usage()
+ {
+ Console.WriteLine(" pass -bench for benchmark mode w/default iterations");
+ Console.WriteLine(" pass [#iterations] for benchmark mode w/iterations");
+ Console.WriteLine();
+ }
+
+ public static int Main(string[] args)
+ {
+ if (args.Length > 0)
+ {
+ if (args[0].Equals("-bench"))
+ {
+ CommandLineInnerIterationCount = Iterations;
+ }
+ else
+ {
+ bool parsed = Int32.TryParse(args[0], out CommandLineInnerIterationCount);
+ if (!parsed)
+ {
+ Usage();
+ return -1;
+ }
+ }
+
+ Console.WriteLine("Running as command line perf test: {0} iterations",
+ CommandLineInnerIterationCount);
+ Console.WriteLine();
+ }
+ else
+ {
+ Console.WriteLine("Running as correctness test: {0} iterations",
+ CommandLineInnerIterationCount);
+ Usage();
+ }
+
+ // When we call into Invoke, it'll need to know this isn't xunit-perf running
+ IsXunitInvocation = false;
+
+ // Discover what tests to run via reflection
+ TypeInfo t = typeof(IndexerBench).GetTypeInfo();
+
+ var testsByCategory = new Dictionary<string, List<MethodInfo>>();
+
+ // Do a first pass to find out what categories of benchmarks we have.
+ foreach(MethodInfo m in t.DeclaredMethods)
+ {
+ BenchmarkAttribute benchAttr = m.GetCustomAttribute<BenchmarkAttribute>();
+ if (benchAttr != null)
+ {
+ string category = "none";
+ CategoryAttribute categoryAttr = m.GetCustomAttribute<CategoryAttribute>();
+ if (categoryAttr != null)
+ {
+ category = categoryAttr.Name;
+ }
+
+ List<MethodInfo> tests = null;
+
+ if (!testsByCategory.ContainsKey(category))
+ {
+ tests = new List<MethodInfo>();
+ testsByCategory.Add(category, tests);
+ }
+ else
+ {
+ tests = testsByCategory[category];
+ }
+
+ tests.Add(m);
+ }
+ }
+
+ foreach(string categoryName in testsByCategory.Keys)
+ {
+ Console.WriteLine("**** {0} ****", categoryName);
+
+ foreach(MethodInfo m in testsByCategory[categoryName])
+ {
+ // Request a warm-up iteration before measuring this benchmark method.
+ DoWarmUp = true;
+
+ // Get the benchmark to measure as a delegate taking the number of inner-loop iterations to run
+ var invokeMethod = m.CreateDelegate(typeof(Action<int>)) as Action<int>;
+
+ // All the benchmarks methods in this test use [InlineData] to specify how many times and with
+ // what arguments they should be run.
+ foreach (InlineDataAttribute dataAttr in m.GetCustomAttributes<InlineDataAttribute>())
+ {
+ foreach (object[] data in dataAttr.GetData(m))
+ {
+ // All the benchmark methods in this test take a single int parameter
+ invokeMethod((int)data[0]);
+ }
+ }
+ }
+
+ Console.WriteLine();
+ }
+
+ if (HasFailure)
+ {
+ Console.WriteLine("Some tests failed validation");
+ return -1;
+ }
+
+ return 100;
+ }
+ }
+}
diff --git a/tests/src/JIT/Performance/CodeQuality/Span/Indexer.csproj b/tests/src/JIT/Performance/CodeQuality/Span/Indexer.csproj
new file mode 100644
index 0000000000..a871713d1d
--- /dev/null
+++ b/tests/src/JIT/Performance/CodeQuality/Span/Indexer.csproj
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <!-- Always use latest Roslyn compiler -->
+ <Import Project="..\..\..\..\..\..\Tools\net46\roslyn\build\Microsoft.Net.Compilers.props"/>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetTargetMoniker>.NETStandard,Version=v1.4</NuGetTargetMoniker>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup>
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Indexer.cs" />
+ </ItemGroup>
+ <PropertyGroup>
+ <ProjectJson>$(JitPackagesConfigFileDirectory)benchmark\project.json</ProjectJson>
+ <ProjectLockJson>$(JitPackagesConfigFileDirectory)benchmark\project.lock.json</ProjectLockJson>
+ </PropertyGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/Performance/RunBenchmarks/RunBenchmarks.cs b/tests/src/JIT/Performance/RunBenchmarks/RunBenchmarks.cs
index d5920e4b3f..a1ffb56777 100644
--- a/tests/src/JIT/Performance/RunBenchmarks/RunBenchmarks.cs
+++ b/tests/src/JIT/Performance/RunBenchmarks/RunBenchmarks.cs
@@ -70,11 +70,11 @@
//
using System;
-using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
+using System.Linq;
using System.Xml;
-using System.Xml.XPath;
+using System.Xml.Linq;
using System.IO;
namespace BenchmarkConsoleApplication
@@ -497,115 +497,6 @@ namespace BenchmarkConsoleApplication
}
}
- // XML processing, select a single node given root node and xpath field name.
-
- public XmlNode SelectSingleNode
- (
- XmlNode node,
- string xpath
- )
- {
-#if DESKTOP
- return node.SelectSingleNode(xpath);
-#else
- return XmlDocumentXPathExtensions.SelectSingleNode(node, xpath);
-#endif
- }
-
- // XML processing, get a string field value given a node and xpath field name.
- // Can be optional field.
-
- public string GetField
- (
- XmlNode node,
- string xpath,
- bool optional = false
- )
- {
- XmlNode fieldNode = SelectSingleNode(node, xpath);
- if (fieldNode == null)
- {
- if (optional)
- {
- return "";
- }
- throw new Exception("missing field: " + xpath);
- }
-
- return fieldNode.InnerText;
- }
-
- // XML processing, get a boolean field value given a node and xpath field name.
- // Can be optional field.
-
- public bool GetBooleanField
- (
- XmlNode node,
- string xpath,
- bool optional = false
- )
- {
- string value = GetField(node, xpath, optional);
-
- if (value == "true")
- return true;
- if (value == "false")
- return false;
- if (optional)
- return false;
-
- throw new Exception("bad boolean value: " + value);
- }
-
- // XML processing, get an integer field value given a node and xpath field name.
- // Can be optional field.
-
- public int GetIntegerField
- (
- XmlNode node,
- string xpath,
- bool optional = false
- )
- {
- string value = GetField(node, xpath, optional);
-
- if (value != "")
- {
- int number = Int32.Parse(value);
- return number;
- }
- if (optional)
- return 0;
-
- throw new Exception("bad integer value: " + value);
- }
-
- // XML processing, select a list of nodes given root node and xpath field name.
-
- public XmlNodeList SelectNodes
- (
- XmlNode node,
- string xpath
- )
- {
-#if DESKTOP
- return node.SelectNodes(xpath);
-#else
- return XmlDocumentXPathExtensions.SelectNodes(node, xpath);
-#endif
- }
-
- // XML processing, get a list of nodes given root node and xpath field name.
-
- public XmlNodeList GetList
- (
- XmlNode node,
- string xpath
- )
- {
- return SelectNodes(node, xpath);
- }
-
// Exit benchmark system with specified exit code.
public int Exit(int exitCode)
@@ -657,6 +548,45 @@ namespace BenchmarkConsoleApplication
return platformSpecificDirectoryName;
}
+ public static bool GetBool
+ (
+ XElement node,
+ string name,
+ bool optional = true
+ )
+ {
+ string value = node.Element(name)?.Value;
+
+ if (value == "true")
+ return true;
+ if (value == "false")
+ return false;
+ if (optional)
+ return false;
+
+ throw new Exception("bad boolean value: " + value);
+ }
+
+ public static int GetInteger
+ (
+ XElement node,
+ string name,
+ bool optional = true
+ )
+ {
+ string value = node.Element(name)?.Value;
+
+ if (value != "")
+ {
+ int number = Int32.Parse(value);
+ return number;
+ }
+ if (optional)
+ return 0;
+
+ throw new Exception("bad integer value: " + value);
+ }
+
// Build list of benchmarks by reading in and processing .XML file.
public void BuildBenchmarksList()
@@ -691,9 +621,7 @@ namespace BenchmarkConsoleApplication
// Load XML description of benchmarks.
- XmlDocument benchmarkXml = new XmlDocument();
- var xmlFile = new FileStream(benchmarkXmlFullFileName, FileMode.Open, FileAccess.Read);
- benchmarkXml.Load(xmlFile);
+ XElement benchmarkXml = XElement.Load(benchmarkXmlFullFileName);
// Get root directory for benchmark system. Command line argument overrides
// specification in benchmark control file.
@@ -701,7 +629,7 @@ namespace BenchmarkConsoleApplication
benchmarkRootDirectoryName = Controls.BenchmarksRootDirectory;
if (benchmarkRootDirectoryName == "")
{
- benchmarkRootDirectoryName = GetField(benchmarkXml.DocumentElement, "benchmark-root-directory");
+ benchmarkRootDirectoryName =
Controls.BenchmarksRootDirectory = benchmarkRootDirectoryName;
}
benchmarkRootDirectoryName = PlatformSpecificDirectoryName(benchmarkRootDirectoryName);
@@ -709,26 +637,26 @@ namespace BenchmarkConsoleApplication
// Process each benchmark suite in the list of benchmark suites.
- XmlNodeList benchmarkSuiteList = GetList(benchmarkXml.DocumentElement, "benchmark-suite");
- foreach (XmlNode benchmarkSuite in benchmarkSuiteList)
+ var benchmarkSuiteList = from e in benchmarkXml.Descendants("benchmark-suite") select e;
+ foreach (XElement benchmarkSuite in benchmarkSuiteList)
{
- benchmarkSuiteName = GetField(benchmarkSuite, "name");
+ benchmarkSuiteName = benchmarkSuite.Element("name").Value;
//Process each benchmark in benchmark suite.
- XmlNodeList benchmarkList = GetList(benchmarkSuite, "benchmark");
- foreach (XmlNode benchmark in benchmarkList)
+ var benchmarkList = from e in benchmarkSuite.Descendants("benchmark") select e;
+ foreach (XElement benchmark in benchmarkList)
{
- benchmarkName = GetField(benchmark, "name");
- benchmarkDirectoryName = GetField(benchmark, "directory", OptionalField);
+ benchmarkName = benchmark.Element("name").Value;
+ benchmarkDirectoryName = benchmark.Element("directory")?.Value ?? "";
benchmarkDirectoryName = PlatformSpecificDirectoryName(benchmarkDirectoryName);
- benchmarkExecutableName = GetField(benchmark, "executable");
- benchmarkArgs = GetField(benchmark, "args", OptionalField);
- useSSE = GetBooleanField(benchmark, "useSSE", OptionalField);
- useAVX = GetBooleanField(benchmark, "useAVX", OptionalField);
- expectedResults = GetIntegerField(benchmark, "expected-results", OptionalField);
- doRunInShell = GetBooleanField(benchmark, "run-in-shell", OptionalField);
- tags = GetField(benchmark, "tags", OptionalField);
+ benchmarkExecutableName = benchmark.Element("executable").Value;
+ benchmarkArgs = benchmark.Element("args")?.Value ?? "";
+ useSSE = GetBool(benchmark, "useSSE");
+ useAVX = GetBool(benchmark, "useAVX");
+ doRunInShell = GetBool(benchmark, "run-in-shell");
+ expectedResults = GetInteger(benchmark, "expected-results");
+ tags = benchmark.Element("tags")?.Value ?? "";
AddBenchmark(benchmarkName, benchmarkSuiteName, tags, benchmarkDirectoryName,
benchmarkExecutableName, benchmarkArgs, doRunInShell, useSSE, useAVX, expectedResults);
}
diff --git a/tests/src/JIT/Regression/JitBlue/DevDiv_397793/DevDiv_397793.il b/tests/src/JIT/Regression/JitBlue/DevDiv_397793/DevDiv_397793.il
new file mode 100644
index 0000000000..95d40b6bed
--- /dev/null
+++ b/tests/src/JIT/Regression/JitBlue/DevDiv_397793/DevDiv_397793.il
@@ -0,0 +1,147 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+.assembly extern mscorlib{}
+.assembly ILGEN_MODULE{}
+
+// This test originally failed compilation during CSE due to value numbers that were discarded during remorphing.
+// The arguments to and return value from `ILGEN_METHOD` are not meaningful; it is enough that this function
+// compiles successfully.
+
+.class ILGEN_CLASS
+{
+ .method static float32 ILGEN_METHOD(int16, char, char, native int)
+ {
+ .maxstack 65535
+ .locals init (int8, native unsigned int, int64, int8, bool, unsigned int64, char, float64, int64, native int, float32, int64, int64, unsigned int16)
+
+ IL_0000: ldloc 0x000d
+ IL_0004: not
+ IL_0005: ldloc.s 0x06
+ IL_0007: cgt.un
+ IL_0009: ldloc.s 0x06
+ IL_000b: clt.un
+ IL_000d: conv.r4
+ IL_000e: ldloc.s 0x08
+ IL_0010: conv.r.un
+ IL_0011: mul
+ IL_0012: conv.i8
+ IL_0013: ldloc.s 0x03
+ IL_0015: conv.u1
+ IL_0016: not
+ IL_0017: ldloc.s 0x00
+ IL_0019: ldloc.s 0x07
+ IL_001b: neg
+ IL_001c: conv.u1
+ IL_001d: xor
+ IL_001e: sub
+ IL_001f: ldloc 0x000c
+ IL_0023: neg
+ IL_0024: conv.i8
+ IL_0025: ldloc.s 0x07
+ IL_0027: neg
+ IL_0028: conv.u8
+ IL_0029: conv.i8
+ IL_002a: ldc.i4 0x2487c9b5
+ IL_002f: conv.i8
+ IL_0030: rem.un
+ IL_0031: ldloc.s 0x09
+ IL_0033: conv.i8
+ IL_0034: ldloc.s 0x01
+ IL_0036: neg
+ IL_0037: not
+ IL_0038: ldloc 0x0006
+ IL_003c: mul
+ IL_003d: shr.un
+ IL_003e: add
+ IL_003f: ldloc.s 0x0b
+ IL_0041: conv.i4
+ IL_0042: shr.un
+ IL_0043: ldarg.s 0x03
+ IL_0045: conv.i4
+ IL_0046: ldloc.s 0x00
+ IL_0048: clt
+ IL_004a: neg
+ IL_004b: ldloc.s 0x09
+ IL_004d: pop
+ IL_004e: conv.r.un
+ IL_004f: conv.u8
+ IL_0050: ldloc.s 0x05
+ IL_0052: mul
+ IL_0053: ldloc.s 0x0c
+ IL_0055: conv.i8
+ IL_0056: not
+ IL_0057: cgt.un
+ IL_0059: neg
+ IL_005a: nop
+ IL_005b: shl
+ IL_005c: ldc.i8 0x6ddee7e52bcb7a50
+ IL_0065: ldloc 0x0004
+ IL_0069: shr.un
+ IL_006a: pop
+ IL_006b: and
+ IL_006c: conv.u2
+ IL_006d: add
+ IL_006e: ldarg.s 0x02
+ IL_0070: not
+ IL_0071: neg
+ IL_0072: pop
+ IL_0073: ldarg.s 0x01
+ IL_0075: ldloc 0x0008
+ IL_0079: ldloc 0x000b
+ IL_007d: clt
+ IL_007f: conv.r.un
+ IL_0080: pop
+ IL_0081: ldloc 0x000c
+ IL_0085: not
+ IL_0086: ldloc.s 0x0c
+ IL_0088: conv.u8
+ IL_0089: mul
+ IL_008a: ldloc 0x000b
+ IL_008e: add
+ IL_008f: ldloc 0x0002
+ IL_0093: ldloc.s 0x0b
+ IL_0095: rem
+ IL_0096: ldc.i8 0xfe6f83985a745065
+ IL_009f: add
+ IL_00a0: neg
+ IL_00a1: cgt.un
+ IL_00a3: shr
+ IL_00a4: conv.u8
+ IL_00a5: nop
+ IL_00a6: neg
+ IL_00a7: neg
+ IL_00a8: pop
+ IL_00a9: shr
+ IL_00aa: nop
+ IL_00ab: conv.r.un
+ IL_00ac: ret
+ }
+
+ .method public static int32 Main()
+ {
+ .entrypoint
+
+ .try
+ {
+ ldc.i4 0
+ ldc.i4 0
+ ldc.i4 0
+ ldc.i4 0
+ conv.i
+ call float32 ILGEN_CLASS::ILGEN_METHOD(int16, char, char, native int)
+ pop
+ leave done
+ }
+ catch [mscorlib]System.Exception
+ {
+ pop
+ leave done
+ }
+
+ done:
+ ldc.i4 100
+ ret
+ }
+}
diff --git a/tests/src/JIT/Regression/JitBlue/DevDiv_397793/DevDiv_397793.ilproj b/tests/src/JIT/Regression/JitBlue/DevDiv_397793/DevDiv_397793.ilproj
new file mode 100644
index 0000000000..c722432ef9
--- /dev/null
+++ b/tests/src/JIT/Regression/JitBlue/DevDiv_397793/DevDiv_397793.ilproj
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <AssemblyName>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "></PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "></PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>PdbOnly</DebugType>
+ <Optimize>True</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="DevDiv_397793.il" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/Regression/JitBlue/DevDiv_406160/DevDiv_406160.il b/tests/src/JIT/Regression/JitBlue/DevDiv_406160/DevDiv_406160.il
new file mode 100644
index 0000000000..a7eaea4def
--- /dev/null
+++ b/tests/src/JIT/Regression/JitBlue/DevDiv_406160/DevDiv_406160.il
@@ -0,0 +1,83 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+
+// Metadata version: v4.0.30319
+.assembly extern System.Runtime
+{
+ .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) // .?_....:
+ .ver 4:2:0:0
+}
+.assembly extern System.Console
+{
+ .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A ) // .?_....:
+ .ver 4:1:0:0
+}
+.assembly DevDiv_406160
+{
+}
+
+.class private auto ansi beforefieldinit Bug.Program
+ extends [System.Runtime]System.Object
+{
+ .method static char ILGEN_METHOD(int16, unsigned int16, native unsigned int)
+ {
+ .maxstack 65535
+ .locals init (bool, int64, native unsigned int)
+ IL_0000: ldarg.s 0x00
+ IL_0002: ldc.i4.1
+ IL_0015: clt
+ IL_001b: starg.s 0x00
+ IL_001d: ldloc 0x0001
+ IL_0067: ldc.i8 0xc3ec93cfd869ae83
+ IL_0072: ldc.r8 float64(0xb47a62a75e195a1c)
+ IL_007c: conv.ovf.u8
+ IL_007d: ldc.i4.1
+ IL_0081: conv.ovf.i8.un
+ IL_0088: div.un
+ IL_0089: add.ovf.un
+ IL_008c: ldloc 0x0001
+ IL_009a: ldc.i8 0x97a27f9613c909c1
+ IL_00a3: dup
+ IL_00a4: clt
+ IL_00a6: shr.un
+ IL_00a7: xor
+ IL_00a8: ldarg.s 0x00
+ IL_00aa: conv.ovf.u8.un
+ IL_00ab: and
+ IL_00ac: ldloc.s 0x01
+ IL_00ae: and
+ IL_00af: conv.ovf.i2.un
+ IL_00b0: xor
+ IL_00cd: conv.i4
+ IL_00ce: ret
+ }
+
+ .method public hidebysig static int32 Main() cil managed
+ {
+ .entrypoint
+ // Code size 22 (0x16)
+ .maxstack 8
+ IL_0001: ldc.i4.0
+ IL_0002: ldc.i4.0
+ IL_0003: ldc.i4.0
+ IL_0004: call char Bug.Program::ILGEN_METHOD(int16, unsigned int16, native unsigned int)
+ IL_0005: pop
+ IL_0009: ldstr "Pass"
+ IL_000e: call void [System.Console]System.Console::WriteLine(string)
+ IL_0013: ldc.i4.s 100
+ IL_0015: ret
+ } // end of method Program::Main
+
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [System.Runtime]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method Program::.ctor
+
+} // end of class Bug.Program \ No newline at end of file
diff --git a/tests/src/JIT/Regression/JitBlue/DevDiv_406160/DevDiv_406160.ilproj b/tests/src/JIT/Regression/JitBlue/DevDiv_406160/DevDiv_406160.ilproj
new file mode 100644
index 0000000000..310db80682
--- /dev/null
+++ b/tests/src/JIT/Regression/JitBlue/DevDiv_406160/DevDiv_406160.ilproj
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <AssemblyName>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType>None</DebugType>
+ <Optimize>True</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="DevDiv_406160.il" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/Regression/JitBlue/GitHub_10940/GitHub_10940.cs b/tests/src/JIT/Regression/JitBlue/GitHub_10940/GitHub_10940.cs
new file mode 100644
index 0000000000..2a72bd8a85
--- /dev/null
+++ b/tests/src/JIT/Regression/JitBlue/GitHub_10940/GitHub_10940.cs
@@ -0,0 +1,58 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Runtime.CompilerServices;
+
+// This test checks whether or not the JIT properly spills side effects in the importer when dumping multi-reg values
+// to temps. If the JIT does not do so correctly, the calls to GetString() and GetDecimal() will be reordered and the
+// test will fail with exit code 0; if it does do so correctly, the calls will not be reordered and the test will
+// pass.
+
+class Test
+{
+ abstract class ValueSourceBase
+ {
+ public abstract string GetString();
+ public abstract decimal GetDecimal();
+ public abstract int GetReturnValue();
+ }
+
+ class ValueSource : ValueSourceBase
+ {
+ int rv;
+
+ public override string GetString()
+ {
+ rv = 0;
+ return "";
+ }
+
+ public override decimal GetDecimal()
+ {
+ rv = 100;
+ return 0;
+ }
+
+ public override int GetReturnValue()
+ {
+ return rv;
+ }
+ }
+
+ Test(string s, decimal d)
+ {
+ }
+
+ [MethodImpl(MethodImplOptions.NoInlining)]
+ static int M(ValueSourceBase vs)
+ {
+ new Test(vs.GetString(), vs.GetDecimal());
+ return vs.GetReturnValue();
+ }
+
+ static int Main()
+ {
+ return M(new ValueSource());
+ }
+}
diff --git a/tests/src/JIT/Regression/JitBlue/GitHub_10940/GitHub_10940.csproj b/tests/src/JIT/Regression/JitBlue/GitHub_10940/GitHub_10940.csproj
new file mode 100644
index 0000000000..ef69a3b429
--- /dev/null
+++ b/tests/src/JIT/Regression/JitBlue/GitHub_10940/GitHub_10940.csproj
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <AssemblyName>$(MSBuildProjectName)</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <PropertyGroup>
+ <DebugType></DebugType>
+ <Optimize>True</Optimize>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="GitHub_10940.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+ <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' ">
+ </PropertyGroup>
+</Project>
diff --git a/tests/src/JIT/config/benchmark+roslyn/project.json b/tests/src/JIT/config/benchmark+roslyn/project.json
index 7940c4038d..18907a1214 100644
--- a/tests/src/JIT/config/benchmark+roslyn/project.json
+++ b/tests/src/JIT/config/benchmark+roslyn/project.json
@@ -1,20 +1,20 @@
{
"dependencies": {
"Microsoft.CodeAnalysis.Compilers": "1.1.1",
- "xunit.performance.api": "1.0.0-alpha-build0049",
- "xunit.performance.core": "1.0.0-alpha-build0049",
- "xunit.performance.execution": "1.0.0-alpha-build0049",
- "xunit.performance.metrics": "1.0.0-alpha-build0049",
+ "xunit.performance.api": "1.0.0-beta-build0003",
+ "xunit.performance.core": "1.0.0-beta-build0003",
+ "xunit.performance.execution": "1.0.0-beta-build0003",
+ "xunit.performance.metrics": "1.0.0-beta-build0003",
"Microsoft.Diagnostics.Tracing.TraceEvent": "1.0.3-alpha-experimental",
- "Microsoft.NETCore.Platforms": "2.0.0-preview1-25210-01",
+ "Microsoft.NETCore.Platforms": "2.0.0-preview1-25221-01",
"System.Console": "4.4.0-beta-24913-02",
"System.Dynamic.Runtime": "4.4.0-beta-24913-02",
"System.Linq": "4.4.0-beta-24913-02",
"System.IO.FileSystem": "4.4.0-beta-24913-02",
- "System.Numerics.Vectors": "4.4.0-preview1-25210-01",
+ "System.Numerics.Vectors": "4.4.0-preview1-25221-01",
"System.Reflection": "4.4.0-beta-24913-02",
"System.Reflection.Extensions": "4.4.0-beta-24913-02",
- "System.Reflection.TypeExtensions": "4.4.0-preview1-25210-01",
+ "System.Reflection.TypeExtensions": "4.4.0-preview1-25221-01",
"System.Runtime": "4.4.0-beta-24913-02",
"System.Runtime.Extensions": "4.4.0-beta-24913-02",
"System.Runtime.Numerics": "4.4.0-beta-24913-02",
diff --git a/tests/src/JIT/config/benchmark+serialize/project.json b/tests/src/JIT/config/benchmark+serialize/project.json
index 49d20c2118..b71701f9ef 100644
--- a/tests/src/JIT/config/benchmark+serialize/project.json
+++ b/tests/src/JIT/config/benchmark+serialize/project.json
@@ -1,11 +1,11 @@
{
"dependencies": {
- "xunit.performance.api": "1.0.0-alpha-build0049",
- "xunit.performance.core": "1.0.0-alpha-build0049",
- "xunit.performance.execution": "1.0.0-alpha-build0049",
- "xunit.performance.metrics": "1.0.0-alpha-build0049",
+ "xunit.performance.api": "1.0.0-beta-build0003",
+ "xunit.performance.core": "1.0.0-beta-build0003",
+ "xunit.performance.execution": "1.0.0-beta-build0003",
+ "xunit.performance.metrics": "1.0.0-beta-build0003",
"Microsoft.Diagnostics.Tracing.TraceEvent": "1.0.3-alpha-experimental",
- "Microsoft.NETCore.Platforms": "2.0.0-preview1-25210-01",
+ "Microsoft.NETCore.Platforms": "2.0.0-preview1-25221-01",
"Newtonsoft.Json": "7.0.1",
"System.Console": "4.4.0-beta-24913-02",
"System.IO": "4.4.0-beta-24913-02",
@@ -15,7 +15,7 @@
"System.Dynamic.Runtime": "4.4.0-beta-24913-02",
"System.Reflection": "4.4.0-beta-24913-02",
"System.Reflection.Extensions": "4.4.0-beta-24913-02",
- "System.Reflection.TypeExtensions": "4.4.0-preview1-25210-01",
+ "System.Reflection.TypeExtensions": "4.4.0-preview1-25221-01",
"System.Runtime": "4.4.0-beta-24913-02",
"System.Runtime.Serialization.Json": "4.4.0-beta-24913-02",
"System.Runtime.Serialization.Primitives": "4.4.0-beta-24913-02",
diff --git a/tests/src/JIT/config/benchmark/project.json b/tests/src/JIT/config/benchmark/project.json
index e42976a2d8..aac92ecc0b 100644
--- a/tests/src/JIT/config/benchmark/project.json
+++ b/tests/src/JIT/config/benchmark/project.json
@@ -1,23 +1,24 @@
{
"dependencies": {
- "xunit.performance.api": "1.0.0-alpha-build0049",
- "xunit.performance.core": "1.0.0-alpha-build0049",
- "xunit.performance.execution": "1.0.0-alpha-build0049",
- "xunit.performance.metrics": "1.0.0-alpha-build0049",
+ "xunit.performance.api": "1.0.0-beta-build0003",
+ "xunit.performance.core": "1.0.0-beta-build0003",
+ "xunit.performance.execution": "1.0.0-beta-build0003",
+ "xunit.performance.metrics": "1.0.0-beta-build0003",
"Microsoft.Diagnostics.Tracing.TraceEvent": "1.0.3-alpha-experimental",
- "Microsoft.NETCore.Platforms": "2.0.0-preview1-25210-01",
+ "Microsoft.NETCore.Platforms": "2.0.0-preview1-25221-01",
"System.Collections.NonGeneric": "4.4.0-beta-24913-02",
"System.Console": "4.4.0-beta-24913-02",
"System.IO.FileSystem": "4.4.0-beta-24913-02",
"System.Linq": "4.4.0-beta-24913-02",
"System.Linq.Parallel": "4.4.0-beta-24913-02",
"System.Linq.Expressions": "4.4.0-beta-24913-02",
- "System.Memory": "4.4.0-preview1-25210-01",
- "System.Numerics.Vectors": "4.4.0-preview1-25210-01",
+ "System.Memory": "4.4.0-preview1-25221-01",
+ "System.Numerics.Vectors": "4.4.0-preview1-25221-01",
"System.Reflection": "4.4.0-beta-24913-02",
"System.Reflection.Extensions": "4.4.0-beta-24913-02",
- "System.Reflection.TypeExtensions": "4.4.0-preview1-25210-01",
+ "System.Reflection.TypeExtensions": "4.4.0-preview1-25221-01",
"System.Runtime": "4.4.0-beta-24913-02",
+ "System.Runtime.CompilerServices.Unsafe": "4.4.0-preview1-25221-01",
"System.Runtime.Extensions": "4.4.0-beta-24913-02",
"System.Runtime.Numerics": "4.4.0-beta-24913-02",
"System.Text.RegularExpressions": "4.4.0-beta-24913-02",
@@ -27,8 +28,6 @@
"System.Threading.ThreadPool": "4.4.0-beta-24913-02",
"System.Diagnostics.Process": "4.4.0-beta-24913-02",
"System.Xml.XmlDocument": "4.4.0-beta-24913-02",
- "System.Xml.XPath": "4.4.0-beta-24913-02",
- "System.Xml.XPath.XmlDocument": "4.4.0-beta-24913-02",
"xunit": "2.2.0-beta2-build3300",
"xunit.console.netcore": "1.0.2-prerelease-00177",
"xunit.runner.utility": "2.2.0-beta2-build3300"
diff --git a/tests/src/JIT/jit64/hfa/main/dll/hfa_native.h b/tests/src/JIT/jit64/hfa/main/dll/hfa_native.h
index 814ae4a6f6..7cfdb2820f 100644
--- a/tests/src/JIT/jit64/hfa/main/dll/hfa_native.h
+++ b/tests/src/JIT/jit64/hfa/main/dll/hfa_native.h
@@ -1,11 +1,20 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+#if !defined(_MSC_VER)
+#if __i386__
+#define __stdcall __attribute__((stdcall))
+#else // __i386__
+#define __stdcall
+#endif // !__i386__
+#endif // !defined(_MSC_VER)
#if defined(_MSC_VER)
#define HFADLL_API extern "C" __declspec(dllexport)
+#define HFADLL_CALLCONV
#else
#define HFADLL_API extern "C" __attribute__((visibility("default")))
+#define HFADLL_CALLCONV __stdcall
#endif
@@ -102,13 +111,13 @@ const FLOATTYPE EXPECTED_SUM_HFA11 = static_cast<FLOATTYPE>(66);
const FLOATTYPE EXPECTED_SUM_HFA19 = static_cast<FLOATTYPE>(190);
#endif
-HFADLL_API FLOATTYPE get_EXPECTED_SUM_HFA01() {return EXPECTED_SUM_HFA01;}
-HFADLL_API FLOATTYPE get_EXPECTED_SUM_HFA02() {return EXPECTED_SUM_HFA02;}
-HFADLL_API FLOATTYPE get_EXPECTED_SUM_HFA03() {return EXPECTED_SUM_HFA03;}
-HFADLL_API FLOATTYPE get_EXPECTED_SUM_HFA05() {return EXPECTED_SUM_HFA05;}
-HFADLL_API FLOATTYPE get_EXPECTED_SUM_HFA08() {return EXPECTED_SUM_HFA08;}
-HFADLL_API FLOATTYPE get_EXPECTED_SUM_HFA11() {return EXPECTED_SUM_HFA11;}
-HFADLL_API FLOATTYPE get_EXPECTED_SUM_HFA19() {return EXPECTED_SUM_HFA19;}
+HFADLL_API FLOATTYPE HFADLL_CALLCONV get_EXPECTED_SUM_HFA01() {return EXPECTED_SUM_HFA01;}
+HFADLL_API FLOATTYPE HFADLL_CALLCONV get_EXPECTED_SUM_HFA02() {return EXPECTED_SUM_HFA02;}
+HFADLL_API FLOATTYPE HFADLL_CALLCONV get_EXPECTED_SUM_HFA03() {return EXPECTED_SUM_HFA03;}
+HFADLL_API FLOATTYPE HFADLL_CALLCONV get_EXPECTED_SUM_HFA05() {return EXPECTED_SUM_HFA05;}
+HFADLL_API FLOATTYPE HFADLL_CALLCONV get_EXPECTED_SUM_HFA08() {return EXPECTED_SUM_HFA08;}
+HFADLL_API FLOATTYPE HFADLL_CALLCONV get_EXPECTED_SUM_HFA11() {return EXPECTED_SUM_HFA11;}
+HFADLL_API FLOATTYPE HFADLL_CALLCONV get_EXPECTED_SUM_HFA19() {return EXPECTED_SUM_HFA19;}
@@ -116,13 +125,13 @@ HFADLL_API FLOATTYPE get_EXPECTED_SUM_HFA19() {return EXPECTED_SUM_HFA19;}
// init Methods
// ---------------------------------------------------
-HFADLL_API void init_HFA01(HFA01& hfa);
-HFADLL_API void init_HFA02(HFA02& hfa);
-HFADLL_API void init_HFA03(HFA03& hfa);
-HFADLL_API void init_HFA05(HFA05& hfa);
-HFADLL_API void init_HFA08(HFA08& hfa);
-HFADLL_API void init_HFA11(HFA11& hfa);
-HFADLL_API void init_HFA19(HFA19& hfa);
+HFADLL_API void HFADLL_CALLCONV init_HFA01(HFA01& hfa);
+HFADLL_API void HFADLL_CALLCONV init_HFA02(HFA02& hfa);
+HFADLL_API void HFADLL_CALLCONV init_HFA03(HFA03& hfa);
+HFADLL_API void HFADLL_CALLCONV init_HFA05(HFA05& hfa);
+HFADLL_API void HFADLL_CALLCONV init_HFA08(HFA08& hfa);
+HFADLL_API void HFADLL_CALLCONV init_HFA11(HFA11& hfa);
+HFADLL_API void HFADLL_CALLCONV init_HFA19(HFA19& hfa);
@@ -130,13 +139,13 @@ HFADLL_API void init_HFA19(HFA19& hfa);
// identity methods
// --------------------------------------------------------------
-HFADLL_API HFA01 identity_HFA01(HFA01 hfa);
-HFADLL_API HFA02 identity_HFA02(HFA02 hfa);
-HFADLL_API HFA03 identity_HFA03(HFA03 hfa);
-HFADLL_API HFA05 identity_HFA05(HFA05 hfa);
-HFADLL_API HFA08 identity_HFA08(HFA08 hfa);
-HFADLL_API HFA11 identity_HFA11(HFA11 hfa);
-HFADLL_API HFA19 identity_HFA19(HFA19 hfa);
+HFADLL_API HFA01 HFADLL_CALLCONV identity_HFA01(HFA01 hfa);
+HFADLL_API HFA02 HFADLL_CALLCONV identity_HFA02(HFA02 hfa);
+HFADLL_API HFA03 HFADLL_CALLCONV identity_HFA03(HFA03 hfa);
+HFADLL_API HFA05 HFADLL_CALLCONV identity_HFA05(HFA05 hfa);
+HFADLL_API HFA08 HFADLL_CALLCONV identity_HFA08(HFA08 hfa);
+HFADLL_API HFA11 HFADLL_CALLCONV identity_HFA11(HFA11 hfa);
+HFADLL_API HFA19 HFADLL_CALLCONV identity_HFA19(HFA19 hfa);
@@ -144,13 +153,13 @@ HFADLL_API HFA19 identity_HFA19(HFA19 hfa);
// get methods
// --------------------------------------------------------------
-HFADLL_API HFA01 get_HFA01();
-HFADLL_API HFA02 get_HFA02();
-HFADLL_API HFA03 get_HFA03();
-HFADLL_API HFA05 get_HFA05();
-HFADLL_API HFA08 get_HFA08();
-HFADLL_API HFA11 get_HFA11();
-HFADLL_API HFA19 get_HFA19();
+HFADLL_API HFA01 HFADLL_CALLCONV get_HFA01();
+HFADLL_API HFA02 HFADLL_CALLCONV get_HFA02();
+HFADLL_API HFA03 HFADLL_CALLCONV get_HFA03();
+HFADLL_API HFA05 HFADLL_CALLCONV get_HFA05();
+HFADLL_API HFA08 HFADLL_CALLCONV get_HFA08();
+HFADLL_API HFA11 HFADLL_CALLCONV get_HFA11();
+HFADLL_API HFA19 HFADLL_CALLCONV get_HFA19();
@@ -158,53 +167,53 @@ HFADLL_API HFA19 get_HFA19();
// sum Methods
// ---------------------------------------------------
-HFADLL_API FLOATTYPE sum_HFA01(HFA01 hfa);
-HFADLL_API FLOATTYPE sum_HFA02(HFA02 hfa);
-HFADLL_API FLOATTYPE sum_HFA03(HFA03 hfa);
-HFADLL_API FLOATTYPE sum_HFA05(HFA05 hfa);
-HFADLL_API FLOATTYPE sum_HFA08(HFA08 hfa);
-HFADLL_API FLOATTYPE sum_HFA11(HFA11 hfa);
-HFADLL_API FLOATTYPE sum_HFA19(HFA19 hfa);
-
-HFADLL_API FLOATTYPE sum3_HFA01(float v1, __int64 v2, HFA01 hfa);
-HFADLL_API FLOATTYPE sum3_HFA02(float v1, __int64 v2, HFA02 hfa);
-HFADLL_API FLOATTYPE sum3_HFA03(float v1, __int64 v2, HFA03 hfa);
-HFADLL_API FLOATTYPE sum3_HFA05(float v1, __int64 v2, HFA05 hfa);
-HFADLL_API FLOATTYPE sum3_HFA08(float v1, __int64 v2, HFA08 hfa);
-HFADLL_API FLOATTYPE sum3_HFA11(float v1, __int64 v2, HFA11 hfa);
-HFADLL_API FLOATTYPE sum3_HFA19(float v1, __int64 v2, HFA19 hfa);
-
-HFADLL_API FLOATTYPE sum5_HFA01(__int64 v1, double v2, short v3, signed char v4, HFA01 hfa);
-HFADLL_API FLOATTYPE sum5_HFA02(__int64 v1, double v2, short v3, signed char v4, HFA02 hfa);
-HFADLL_API FLOATTYPE sum5_HFA03(__int64 v1, double v2, short v3, signed char v4, HFA03 hfa);
-HFADLL_API FLOATTYPE sum5_HFA05(__int64 v1, double v2, short v3, signed char v4, HFA05 hfa);
-HFADLL_API FLOATTYPE sum5_HFA08(__int64 v1, double v2, short v3, signed char v4, HFA08 hfa);
-HFADLL_API FLOATTYPE sum5_HFA11(__int64 v1, double v2, short v3, signed char v4, HFA11 hfa);
-HFADLL_API FLOATTYPE sum5_HFA19(__int64 v1, double v2, short v3, signed char v4, HFA19 hfa);
-
-HFADLL_API FLOATTYPE sum8_HFA01(float v1, double v2, __int64 v3, signed char v4, double v5, HFA01 hfa);
-HFADLL_API FLOATTYPE sum8_HFA02(float v1, double v2, __int64 v3, signed char v4, double v5, HFA02 hfa);
-HFADLL_API FLOATTYPE sum8_HFA03(float v1, double v2, __int64 v3, signed char v4, double v5, HFA03 hfa);
-HFADLL_API FLOATTYPE sum8_HFA05(float v1, double v2, __int64 v3, signed char v4, double v5, HFA05 hfa);
-HFADLL_API FLOATTYPE sum8_HFA08(float v1, double v2, __int64 v3, signed char v4, double v5, HFA08 hfa);
-HFADLL_API FLOATTYPE sum8_HFA11(float v1, double v2, __int64 v3, signed char v4, double v5, HFA11 hfa);
-HFADLL_API FLOATTYPE sum8_HFA19(float v1, double v2, __int64 v3, signed char v4, double v5, HFA19 hfa);
-
-HFADLL_API FLOATTYPE sum11_HFA01(double v1, float v2, float v3, int v4, float v5, __int64 v6, double v7, float v8, HFA01 hfa);
-HFADLL_API FLOATTYPE sum11_HFA02(double v1, float v2, float v3, int v4, float v5, __int64 v6, double v7, float v8, HFA02 hfa);
-HFADLL_API FLOATTYPE sum11_HFA03(double v1, float v2, float v3, int v4, float v5, __int64 v6, double v7, float v8, HFA03 hfa);
-HFADLL_API FLOATTYPE sum11_HFA05(double v1, float v2, float v3, int v4, float v5, __int64 v6, double v7, float v8, HFA05 hfa);
-HFADLL_API FLOATTYPE sum11_HFA08(double v1, float v2, float v3, int v4, float v5, __int64 v6, double v7, float v8, HFA08 hfa);
-HFADLL_API FLOATTYPE sum11_HFA11(double v1, float v2, float v3, int v4, float v5, __int64 v6, double v7, float v8, HFA11 hfa);
-HFADLL_API FLOATTYPE sum11_HFA19(double v1, float v2, float v3, int v4, float v5, __int64 v6, double v7, float v8, HFA19 hfa);
-
-HFADLL_API FLOATTYPE sum19_HFA01(float v1, double v2, float v3, double v4, float v5, double v6, float v7, double v8, float v9, double v10, float v11, double v12, float v13, HFA01 hfa);
-HFADLL_API FLOATTYPE sum19_HFA02(float v1, double v2, float v3, double v4, float v5, double v6, float v7, double v8, float v9, double v10, float v11, double v12, float v13, HFA02 hfa);
-HFADLL_API FLOATTYPE sum19_HFA03(float v1, double v2, float v3, double v4, float v5, double v6, float v7, double v8, float v9, double v10, float v11, double v12, float v13, HFA03 hfa);
-HFADLL_API FLOATTYPE sum19_HFA05(float v1, double v2, float v3, double v4, float v5, double v6, float v7, double v8, float v9, double v10, float v11, double v12, float v13, HFA05 hfa);
-HFADLL_API FLOATTYPE sum19_HFA08(float v1, double v2, float v3, double v4, float v5, double v6, float v7, double v8, float v9, double v10, float v11, double v12, float v13, HFA08 hfa);
-HFADLL_API FLOATTYPE sum19_HFA11(float v1, double v2, float v3, double v4, float v5, double v6, float v7, double v8, float v9, double v10, float v11, double v12, float v13, HFA11 hfa);
-HFADLL_API FLOATTYPE sum19_HFA19(float v1, double v2, float v3, double v4, float v5, double v6, float v7, double v8, float v9, double v10, float v11, double v12, float v13, HFA19 hfa);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV sum_HFA01(HFA01 hfa);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV sum_HFA02(HFA02 hfa);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV sum_HFA03(HFA03 hfa);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV sum_HFA05(HFA05 hfa);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV sum_HFA08(HFA08 hfa);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV sum_HFA11(HFA11 hfa);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV sum_HFA19(HFA19 hfa);
+
+HFADLL_API FLOATTYPE HFADLL_CALLCONV sum3_HFA01(float v1, __int64 v2, HFA01 hfa);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV sum3_HFA02(float v1, __int64 v2, HFA02 hfa);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV sum3_HFA03(float v1, __int64 v2, HFA03 hfa);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV sum3_HFA05(float v1, __int64 v2, HFA05 hfa);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV sum3_HFA08(float v1, __int64 v2, HFA08 hfa);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV sum3_HFA11(float v1, __int64 v2, HFA11 hfa);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV sum3_HFA19(float v1, __int64 v2, HFA19 hfa);
+
+HFADLL_API FLOATTYPE HFADLL_CALLCONV sum5_HFA01(__int64 v1, double v2, short v3, signed char v4, HFA01 hfa);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV sum5_HFA02(__int64 v1, double v2, short v3, signed char v4, HFA02 hfa);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV sum5_HFA03(__int64 v1, double v2, short v3, signed char v4, HFA03 hfa);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV sum5_HFA05(__int64 v1, double v2, short v3, signed char v4, HFA05 hfa);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV sum5_HFA08(__int64 v1, double v2, short v3, signed char v4, HFA08 hfa);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV sum5_HFA11(__int64 v1, double v2, short v3, signed char v4, HFA11 hfa);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV sum5_HFA19(__int64 v1, double v2, short v3, signed char v4, HFA19 hfa);
+
+HFADLL_API FLOATTYPE HFADLL_CALLCONV sum8_HFA01(float v1, double v2, __int64 v3, signed char v4, double v5, HFA01 hfa);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV sum8_HFA02(float v1, double v2, __int64 v3, signed char v4, double v5, HFA02 hfa);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV sum8_HFA03(float v1, double v2, __int64 v3, signed char v4, double v5, HFA03 hfa);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV sum8_HFA05(float v1, double v2, __int64 v3, signed char v4, double v5, HFA05 hfa);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV sum8_HFA08(float v1, double v2, __int64 v3, signed char v4, double v5, HFA08 hfa);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV sum8_HFA11(float v1, double v2, __int64 v3, signed char v4, double v5, HFA11 hfa);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV sum8_HFA19(float v1, double v2, __int64 v3, signed char v4, double v5, HFA19 hfa);
+
+HFADLL_API FLOATTYPE HFADLL_CALLCONV sum11_HFA01(double v1, float v2, float v3, int v4, float v5, __int64 v6, double v7, float v8, HFA01 hfa);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV sum11_HFA02(double v1, float v2, float v3, int v4, float v5, __int64 v6, double v7, float v8, HFA02 hfa);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV sum11_HFA03(double v1, float v2, float v3, int v4, float v5, __int64 v6, double v7, float v8, HFA03 hfa);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV sum11_HFA05(double v1, float v2, float v3, int v4, float v5, __int64 v6, double v7, float v8, HFA05 hfa);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV sum11_HFA08(double v1, float v2, float v3, int v4, float v5, __int64 v6, double v7, float v8, HFA08 hfa);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV sum11_HFA11(double v1, float v2, float v3, int v4, float v5, __int64 v6, double v7, float v8, HFA11 hfa);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV sum11_HFA19(double v1, float v2, float v3, int v4, float v5, __int64 v6, double v7, float v8, HFA19 hfa);
+
+HFADLL_API FLOATTYPE HFADLL_CALLCONV sum19_HFA01(float v1, double v2, float v3, double v4, float v5, double v6, float v7, double v8, float v9, double v10, float v11, double v12, float v13, HFA01 hfa);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV sum19_HFA02(float v1, double v2, float v3, double v4, float v5, double v6, float v7, double v8, float v9, double v10, float v11, double v12, float v13, HFA02 hfa);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV sum19_HFA03(float v1, double v2, float v3, double v4, float v5, double v6, float v7, double v8, float v9, double v10, float v11, double v12, float v13, HFA03 hfa);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV sum19_HFA05(float v1, double v2, float v3, double v4, float v5, double v6, float v7, double v8, float v9, double v10, float v11, double v12, float v13, HFA05 hfa);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV sum19_HFA08(float v1, double v2, float v3, double v4, float v5, double v6, float v7, double v8, float v9, double v10, float v11, double v12, float v13, HFA08 hfa);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV sum19_HFA11(float v1, double v2, float v3, double v4, float v5, double v6, float v7, double v8, float v9, double v10, float v11, double v12, float v13, HFA11 hfa);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV sum19_HFA19(float v1, double v2, float v3, double v4, float v5, double v6, float v7, double v8, float v9, double v10, float v11, double v12, float v13, HFA19 hfa);
@@ -212,53 +221,53 @@ HFADLL_API FLOATTYPE sum19_HFA19(float v1, double v2, float v3, double v4, floa
// sverage Methods
// ---------------------------------------------------
-HFADLL_API FLOATTYPE average_HFA01(HFA01 hfa);
-HFADLL_API FLOATTYPE average_HFA02(HFA02 hfa);
-HFADLL_API FLOATTYPE average_HFA03(HFA03 hfa);
-HFADLL_API FLOATTYPE average_HFA05(HFA05 hfa);
-HFADLL_API FLOATTYPE average_HFA08(HFA08 hfa);
-HFADLL_API FLOATTYPE average_HFA11(HFA11 hfa);
-HFADLL_API FLOATTYPE average_HFA19(HFA19 hfa);
-
-HFADLL_API FLOATTYPE average3_HFA01(HFA01 hfa1, HFA01 hfa2, HFA01 hfa3);
-HFADLL_API FLOATTYPE average3_HFA02(HFA02 hfa1, HFA02 hfa2, HFA02 hfa3);
-HFADLL_API FLOATTYPE average3_HFA03(HFA03 hfa1, HFA03 hfa2, HFA03 hfa3);
-HFADLL_API FLOATTYPE average3_HFA05(HFA05 hfa1, HFA05 hfa2, HFA05 hfa3);
-HFADLL_API FLOATTYPE average3_HFA08(HFA08 hfa1, HFA08 hfa2, HFA08 hfa3);
-HFADLL_API FLOATTYPE average3_HFA11(HFA11 hfa1, HFA11 hfa2, HFA11 hfa3);
-HFADLL_API FLOATTYPE average3_HFA19(HFA19 hfa1, HFA19 hfa2, HFA19 hfa3);
-
-HFADLL_API FLOATTYPE average5_HFA01(HFA01 hfa1, HFA01 hfa2, HFA01 hfa3, HFA01 hfa4, HFA01 hfa5);
-HFADLL_API FLOATTYPE average5_HFA02(HFA02 hfa1, HFA02 hfa2, HFA02 hfa3, HFA02 hfa4, HFA02 hfa5);
-HFADLL_API FLOATTYPE average5_HFA03(HFA03 hfa1, HFA03 hfa2, HFA03 hfa3, HFA03 hfa4, HFA03 hfa5);
-HFADLL_API FLOATTYPE average5_HFA05(HFA05 hfa1, HFA05 hfa2, HFA05 hfa3, HFA05 hfa4, HFA05 hfa5);
-HFADLL_API FLOATTYPE average5_HFA08(HFA08 hfa1, HFA08 hfa2, HFA08 hfa3, HFA08 hfa4, HFA08 hfa5);
-HFADLL_API FLOATTYPE average5_HFA11(HFA11 hfa1, HFA11 hfa2, HFA11 hfa3, HFA11 hfa4, HFA11 hfa5);
-HFADLL_API FLOATTYPE average5_HFA19(HFA19 hfa1, HFA19 hfa2, HFA19 hfa3, HFA19 hfa4, HFA19 hfa5);
-
-HFADLL_API FLOATTYPE average8_HFA01(HFA01 hfa1, HFA01 hfa2, HFA01 hfa3, HFA01 hfa4, HFA01 hfa5, HFA01 hfa6, HFA01 hfa7, HFA01 hfa8);
-HFADLL_API FLOATTYPE average8_HFA02(HFA02 hfa1, HFA02 hfa2, HFA02 hfa3, HFA02 hfa4, HFA02 hfa5, HFA02 hfa6, HFA02 hfa7, HFA02 hfa8);
-HFADLL_API FLOATTYPE average8_HFA03(HFA03 hfa1, HFA03 hfa2, HFA03 hfa3, HFA03 hfa4, HFA03 hfa5, HFA03 hfa6, HFA03 hfa7, HFA03 hfa8);
-HFADLL_API FLOATTYPE average8_HFA05(HFA05 hfa1, HFA05 hfa2, HFA05 hfa3, HFA05 hfa4, HFA05 hfa5, HFA05 hfa6, HFA05 hfa7, HFA05 hfa8);
-HFADLL_API FLOATTYPE average8_HFA08(HFA08 hfa1, HFA08 hfa2, HFA08 hfa3, HFA08 hfa4, HFA08 hfa5, HFA08 hfa6, HFA08 hfa7, HFA08 hfa8);
-HFADLL_API FLOATTYPE average8_HFA11(HFA11 hfa1, HFA11 hfa2, HFA11 hfa3, HFA11 hfa4, HFA11 hfa5, HFA11 hfa6, HFA11 hfa7, HFA11 hfa8);
-HFADLL_API FLOATTYPE average8_HFA19(HFA19 hfa1, HFA19 hfa2, HFA19 hfa3, HFA19 hfa4, HFA19 hfa5, HFA19 hfa6, HFA19 hfa7, HFA19 hfa8);
-
-HFADLL_API FLOATTYPE average11_HFA01(HFA01 hfa1, HFA01 hfa2, HFA01 hfa3, HFA01 hfa4, HFA01 hfa5, HFA01 hfa6, HFA01 hfa7, HFA01 hfa8, HFA01 hfa9, HFA01 hfa10, HFA01 hfa11);
-HFADLL_API FLOATTYPE average11_HFA02(HFA02 hfa1, HFA02 hfa2, HFA02 hfa3, HFA02 hfa4, HFA02 hfa5, HFA02 hfa6, HFA02 hfa7, HFA02 hfa8, HFA02 hfa9, HFA02 hfa10, HFA02 hfa11);
-HFADLL_API FLOATTYPE average11_HFA03(HFA03 hfa1, HFA03 hfa2, HFA03 hfa3, HFA03 hfa4, HFA03 hfa5, HFA03 hfa6, HFA03 hfa7, HFA03 hfa8, HFA03 hfa9, HFA03 hfa10, HFA03 hfa11);
-HFADLL_API FLOATTYPE average11_HFA05(HFA05 hfa1, HFA05 hfa2, HFA05 hfa3, HFA05 hfa4, HFA05 hfa5, HFA05 hfa6, HFA05 hfa7, HFA05 hfa8, HFA05 hfa9, HFA05 hfa10, HFA05 hfa11);
-HFADLL_API FLOATTYPE average11_HFA08(HFA08 hfa1, HFA08 hfa2, HFA08 hfa3, HFA08 hfa4, HFA08 hfa5, HFA08 hfa6, HFA08 hfa7, HFA08 hfa8, HFA08 hfa9, HFA08 hfa10, HFA08 hfa11);
-HFADLL_API FLOATTYPE average11_HFA11(HFA11 hfa1, HFA11 hfa2, HFA11 hfa3, HFA11 hfa4, HFA11 hfa5, HFA11 hfa6, HFA11 hfa7, HFA11 hfa8, HFA11 hfa9, HFA11 hfa10, HFA11 hfa11);
-HFADLL_API FLOATTYPE average11_HFA19(HFA19 hfa1, HFA19 hfa2, HFA19 hfa3, HFA19 hfa4, HFA19 hfa5, HFA19 hfa6, HFA19 hfa7, HFA19 hfa8, HFA19 hfa9, HFA19 hfa10, HFA19 hfa11);
-
-HFADLL_API FLOATTYPE average19_HFA01(HFA01 hfa1, HFA01 hfa2, HFA01 hfa3, HFA01 hfa4, HFA01 hfa5, HFA01 hfa6, HFA01 hfa7, HFA01 hfa8, HFA01 hfa9, HFA01 hfa10, HFA01 hfa11, HFA01 hfa12, HFA01 hfa13, HFA01 hfa14, HFA01 hfa15, HFA01 hfa16, HFA01 hfa17, HFA01 hfa18, HFA01 hfa19);
-HFADLL_API FLOATTYPE average19_HFA02(HFA02 hfa1, HFA02 hfa2, HFA02 hfa3, HFA02 hfa4, HFA02 hfa5, HFA02 hfa6, HFA02 hfa7, HFA02 hfa8, HFA02 hfa9, HFA02 hfa10, HFA02 hfa11, HFA02 hfa12, HFA02 hfa13, HFA02 hfa14, HFA02 hfa15, HFA02 hfa16, HFA02 hfa17, HFA02 hfa18, HFA02 hfa19);
-HFADLL_API FLOATTYPE average19_HFA03(HFA03 hfa1, HFA03 hfa2, HFA03 hfa3, HFA03 hfa4, HFA03 hfa5, HFA03 hfa6, HFA03 hfa7, HFA03 hfa8, HFA03 hfa9, HFA03 hfa10, HFA03 hfa11, HFA03 hfa12, HFA03 hfa13, HFA03 hfa14, HFA03 hfa15, HFA03 hfa16, HFA03 hfa17, HFA03 hfa18, HFA03 hfa19);
-HFADLL_API FLOATTYPE average19_HFA05(HFA05 hfa1, HFA05 hfa2, HFA05 hfa3, HFA05 hfa4, HFA05 hfa5, HFA05 hfa6, HFA05 hfa7, HFA05 hfa8, HFA05 hfa9, HFA05 hfa10, HFA05 hfa11, HFA05 hfa12, HFA05 hfa13, HFA05 hfa14, HFA05 hfa15, HFA05 hfa16, HFA05 hfa17, HFA05 hfa18, HFA05 hfa19);
-HFADLL_API FLOATTYPE average19_HFA08(HFA08 hfa1, HFA08 hfa2, HFA08 hfa3, HFA08 hfa4, HFA08 hfa5, HFA08 hfa6, HFA08 hfa7, HFA08 hfa8, HFA08 hfa9, HFA08 hfa10, HFA08 hfa11, HFA08 hfa12, HFA08 hfa13, HFA08 hfa14, HFA08 hfa15, HFA08 hfa16, HFA08 hfa17, HFA08 hfa18, HFA08 hfa19);
-HFADLL_API FLOATTYPE average19_HFA11(HFA11 hfa1, HFA11 hfa2, HFA11 hfa3, HFA11 hfa4, HFA11 hfa5, HFA11 hfa6, HFA11 hfa7, HFA11 hfa8, HFA11 hfa9, HFA11 hfa10, HFA11 hfa11, HFA11 hfa12, HFA11 hfa13, HFA11 hfa14, HFA11 hfa15, HFA11 hfa16, HFA11 hfa17, HFA11 hfa18, HFA11 hfa19);
-HFADLL_API FLOATTYPE average19_HFA19(HFA19 hfa1, HFA19 hfa2, HFA19 hfa3, HFA19 hfa4, HFA19 hfa5, HFA19 hfa6, HFA19 hfa7, HFA19 hfa8, HFA19 hfa9, HFA19 hfa10, HFA19 hfa11, HFA19 hfa12, HFA19 hfa13, HFA19 hfa14, HFA19 hfa15, HFA19 hfa16, HFA19 hfa17, HFA19 hfa18, HFA19 hfa19);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV average_HFA01(HFA01 hfa);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV average_HFA02(HFA02 hfa);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV average_HFA03(HFA03 hfa);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV average_HFA05(HFA05 hfa);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV average_HFA08(HFA08 hfa);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV average_HFA11(HFA11 hfa);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV average_HFA19(HFA19 hfa);
+
+HFADLL_API FLOATTYPE HFADLL_CALLCONV average3_HFA01(HFA01 hfa1, HFA01 hfa2, HFA01 hfa3);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV average3_HFA02(HFA02 hfa1, HFA02 hfa2, HFA02 hfa3);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV average3_HFA03(HFA03 hfa1, HFA03 hfa2, HFA03 hfa3);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV average3_HFA05(HFA05 hfa1, HFA05 hfa2, HFA05 hfa3);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV average3_HFA08(HFA08 hfa1, HFA08 hfa2, HFA08 hfa3);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV average3_HFA11(HFA11 hfa1, HFA11 hfa2, HFA11 hfa3);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV average3_HFA19(HFA19 hfa1, HFA19 hfa2, HFA19 hfa3);
+
+HFADLL_API FLOATTYPE HFADLL_CALLCONV average5_HFA01(HFA01 hfa1, HFA01 hfa2, HFA01 hfa3, HFA01 hfa4, HFA01 hfa5);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV average5_HFA02(HFA02 hfa1, HFA02 hfa2, HFA02 hfa3, HFA02 hfa4, HFA02 hfa5);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV average5_HFA03(HFA03 hfa1, HFA03 hfa2, HFA03 hfa3, HFA03 hfa4, HFA03 hfa5);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV average5_HFA05(HFA05 hfa1, HFA05 hfa2, HFA05 hfa3, HFA05 hfa4, HFA05 hfa5);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV average5_HFA08(HFA08 hfa1, HFA08 hfa2, HFA08 hfa3, HFA08 hfa4, HFA08 hfa5);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV average5_HFA11(HFA11 hfa1, HFA11 hfa2, HFA11 hfa3, HFA11 hfa4, HFA11 hfa5);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV average5_HFA19(HFA19 hfa1, HFA19 hfa2, HFA19 hfa3, HFA19 hfa4, HFA19 hfa5);
+
+HFADLL_API FLOATTYPE HFADLL_CALLCONV average8_HFA01(HFA01 hfa1, HFA01 hfa2, HFA01 hfa3, HFA01 hfa4, HFA01 hfa5, HFA01 hfa6, HFA01 hfa7, HFA01 hfa8);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV average8_HFA02(HFA02 hfa1, HFA02 hfa2, HFA02 hfa3, HFA02 hfa4, HFA02 hfa5, HFA02 hfa6, HFA02 hfa7, HFA02 hfa8);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV average8_HFA03(HFA03 hfa1, HFA03 hfa2, HFA03 hfa3, HFA03 hfa4, HFA03 hfa5, HFA03 hfa6, HFA03 hfa7, HFA03 hfa8);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV average8_HFA05(HFA05 hfa1, HFA05 hfa2, HFA05 hfa3, HFA05 hfa4, HFA05 hfa5, HFA05 hfa6, HFA05 hfa7, HFA05 hfa8);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV average8_HFA08(HFA08 hfa1, HFA08 hfa2, HFA08 hfa3, HFA08 hfa4, HFA08 hfa5, HFA08 hfa6, HFA08 hfa7, HFA08 hfa8);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV average8_HFA11(HFA11 hfa1, HFA11 hfa2, HFA11 hfa3, HFA11 hfa4, HFA11 hfa5, HFA11 hfa6, HFA11 hfa7, HFA11 hfa8);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV average8_HFA19(HFA19 hfa1, HFA19 hfa2, HFA19 hfa3, HFA19 hfa4, HFA19 hfa5, HFA19 hfa6, HFA19 hfa7, HFA19 hfa8);
+
+HFADLL_API FLOATTYPE HFADLL_CALLCONV average11_HFA01(HFA01 hfa1, HFA01 hfa2, HFA01 hfa3, HFA01 hfa4, HFA01 hfa5, HFA01 hfa6, HFA01 hfa7, HFA01 hfa8, HFA01 hfa9, HFA01 hfa10, HFA01 hfa11);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV average11_HFA02(HFA02 hfa1, HFA02 hfa2, HFA02 hfa3, HFA02 hfa4, HFA02 hfa5, HFA02 hfa6, HFA02 hfa7, HFA02 hfa8, HFA02 hfa9, HFA02 hfa10, HFA02 hfa11);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV average11_HFA03(HFA03 hfa1, HFA03 hfa2, HFA03 hfa3, HFA03 hfa4, HFA03 hfa5, HFA03 hfa6, HFA03 hfa7, HFA03 hfa8, HFA03 hfa9, HFA03 hfa10, HFA03 hfa11);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV average11_HFA05(HFA05 hfa1, HFA05 hfa2, HFA05 hfa3, HFA05 hfa4, HFA05 hfa5, HFA05 hfa6, HFA05 hfa7, HFA05 hfa8, HFA05 hfa9, HFA05 hfa10, HFA05 hfa11);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV average11_HFA08(HFA08 hfa1, HFA08 hfa2, HFA08 hfa3, HFA08 hfa4, HFA08 hfa5, HFA08 hfa6, HFA08 hfa7, HFA08 hfa8, HFA08 hfa9, HFA08 hfa10, HFA08 hfa11);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV average11_HFA11(HFA11 hfa1, HFA11 hfa2, HFA11 hfa3, HFA11 hfa4, HFA11 hfa5, HFA11 hfa6, HFA11 hfa7, HFA11 hfa8, HFA11 hfa9, HFA11 hfa10, HFA11 hfa11);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV average11_HFA19(HFA19 hfa1, HFA19 hfa2, HFA19 hfa3, HFA19 hfa4, HFA19 hfa5, HFA19 hfa6, HFA19 hfa7, HFA19 hfa8, HFA19 hfa9, HFA19 hfa10, HFA19 hfa11);
+
+HFADLL_API FLOATTYPE HFADLL_CALLCONV average19_HFA01(HFA01 hfa1, HFA01 hfa2, HFA01 hfa3, HFA01 hfa4, HFA01 hfa5, HFA01 hfa6, HFA01 hfa7, HFA01 hfa8, HFA01 hfa9, HFA01 hfa10, HFA01 hfa11, HFA01 hfa12, HFA01 hfa13, HFA01 hfa14, HFA01 hfa15, HFA01 hfa16, HFA01 hfa17, HFA01 hfa18, HFA01 hfa19);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV average19_HFA02(HFA02 hfa1, HFA02 hfa2, HFA02 hfa3, HFA02 hfa4, HFA02 hfa5, HFA02 hfa6, HFA02 hfa7, HFA02 hfa8, HFA02 hfa9, HFA02 hfa10, HFA02 hfa11, HFA02 hfa12, HFA02 hfa13, HFA02 hfa14, HFA02 hfa15, HFA02 hfa16, HFA02 hfa17, HFA02 hfa18, HFA02 hfa19);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV average19_HFA03(HFA03 hfa1, HFA03 hfa2, HFA03 hfa3, HFA03 hfa4, HFA03 hfa5, HFA03 hfa6, HFA03 hfa7, HFA03 hfa8, HFA03 hfa9, HFA03 hfa10, HFA03 hfa11, HFA03 hfa12, HFA03 hfa13, HFA03 hfa14, HFA03 hfa15, HFA03 hfa16, HFA03 hfa17, HFA03 hfa18, HFA03 hfa19);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV average19_HFA05(HFA05 hfa1, HFA05 hfa2, HFA05 hfa3, HFA05 hfa4, HFA05 hfa5, HFA05 hfa6, HFA05 hfa7, HFA05 hfa8, HFA05 hfa9, HFA05 hfa10, HFA05 hfa11, HFA05 hfa12, HFA05 hfa13, HFA05 hfa14, HFA05 hfa15, HFA05 hfa16, HFA05 hfa17, HFA05 hfa18, HFA05 hfa19);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV average19_HFA08(HFA08 hfa1, HFA08 hfa2, HFA08 hfa3, HFA08 hfa4, HFA08 hfa5, HFA08 hfa6, HFA08 hfa7, HFA08 hfa8, HFA08 hfa9, HFA08 hfa10, HFA08 hfa11, HFA08 hfa12, HFA08 hfa13, HFA08 hfa14, HFA08 hfa15, HFA08 hfa16, HFA08 hfa17, HFA08 hfa18, HFA08 hfa19);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV average19_HFA11(HFA11 hfa1, HFA11 hfa2, HFA11 hfa3, HFA11 hfa4, HFA11 hfa5, HFA11 hfa6, HFA11 hfa7, HFA11 hfa8, HFA11 hfa9, HFA11 hfa10, HFA11 hfa11, HFA11 hfa12, HFA11 hfa13, HFA11 hfa14, HFA11 hfa15, HFA11 hfa16, HFA11 hfa17, HFA11 hfa18, HFA11 hfa19);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV average19_HFA19(HFA19 hfa1, HFA19 hfa2, HFA19 hfa3, HFA19 hfa4, HFA19 hfa5, HFA19 hfa6, HFA19 hfa7, HFA19 hfa8, HFA19 hfa9, HFA19 hfa10, HFA19 hfa11, HFA19 hfa12, HFA19 hfa13, HFA19 hfa14, HFA19 hfa15, HFA19 hfa16, HFA19 hfa17, HFA19 hfa18, HFA19 hfa19);
@@ -267,29 +276,29 @@ HFADLL_API FLOATTYPE average19_HFA19(HFA19 hfa1, HFA19 hfa2, HFA19 hfa3, HFA19
// add Methods
// ---------------------------------------------------
-HFADLL_API FLOATTYPE add01_HFA01(HFA01 hfa1, float v1, HFA01 hfa2, int v2, HFA01 hfa3, short v3, double v4, HFA01 hfa4, HFA01 hfa5, float v5, __int64 v6, float v7, HFA01 hfa6, float v8, HFA01 hfa7);
-HFADLL_API FLOATTYPE add01_HFA02(HFA02 hfa1, float v1, HFA02 hfa2, int v2, HFA02 hfa3, short v3, double v4, HFA02 hfa4, HFA02 hfa5, float v5, __int64 v6, float v7, HFA02 hfa6, float v8, HFA02 hfa7);
-HFADLL_API FLOATTYPE add01_HFA03(HFA03 hfa1, float v1, HFA03 hfa2, int v2, HFA03 hfa3, short v3, double v4, HFA03 hfa4, HFA03 hfa5, float v5, __int64 v6, float v7, HFA03 hfa6, float v8, HFA03 hfa7);
-HFADLL_API FLOATTYPE add01_HFA05(HFA05 hfa1, float v1, HFA05 hfa2, int v2, HFA05 hfa3, short v3, double v4, HFA05 hfa4, HFA05 hfa5, float v5, __int64 v6, float v7, HFA05 hfa6, float v8, HFA05 hfa7);
-HFADLL_API FLOATTYPE add01_HFA08(HFA08 hfa1, float v1, HFA08 hfa2, int v2, HFA08 hfa3, short v3, double v4, HFA08 hfa4, HFA08 hfa5, float v5, __int64 v6, float v7, HFA08 hfa6, float v8, HFA08 hfa7);
-HFADLL_API FLOATTYPE add01_HFA11(HFA11 hfa1, float v1, HFA11 hfa2, int v2, HFA11 hfa3, short v3, double v4, HFA11 hfa4, HFA11 hfa5, float v5, __int64 v6, float v7, HFA11 hfa6, float v8, HFA11 hfa7);
-HFADLL_API FLOATTYPE add01_HFA19(HFA19 hfa1, float v1, HFA19 hfa2, int v2, HFA19 hfa3, short v3, double v4, HFA19 hfa4, HFA19 hfa5, float v5, __int64 v6, float v7, HFA19 hfa6, float v8, HFA19 hfa7);
-HFADLL_API FLOATTYPE add01_HFA00(HFA03 hfa1, float v1, HFA02 hfa2, int v2, HFA19 hfa3, short v3, double v4, HFA05 hfa4, HFA08 hfa5, float v5, __int64 v6, float v7, HFA11 hfa6, float v8, HFA01 hfa7);
-
-HFADLL_API FLOATTYPE add02_HFA01(HFA01 hfa1, HFA01 hfa2, __int64 v1, short v2, float v3, int v4, double v5, float v6, HFA01 hfa3, double v7, float v8, HFA01 hfa4, short v9, HFA01 hfa5, float v10, HFA01 hfa6, HFA01 hfa7);
-HFADLL_API FLOATTYPE add02_HFA02(HFA02 hfa1, HFA02 hfa2, __int64 v1, short v2, float v3, int v4, double v5, float v6, HFA02 hfa3, double v7, float v8, HFA02 hfa4, short v9, HFA02 hfa5, float v10, HFA02 hfa6, HFA02 hfa7);
-HFADLL_API FLOATTYPE add02_HFA03(HFA03 hfa1, HFA03 hfa2, __int64 v1, short v2, float v3, int v4, double v5, float v6, HFA03 hfa3, double v7, float v8, HFA03 hfa4, short v9, HFA03 hfa5, float v10, HFA03 hfa6, HFA03 hfa7);
-HFADLL_API FLOATTYPE add02_HFA05(HFA05 hfa1, HFA05 hfa2, __int64 v1, short v2, float v3, int v4, double v5, float v6, HFA05 hfa3, double v7, float v8, HFA05 hfa4, short v9, HFA05 hfa5, float v10, HFA05 hfa6, HFA05 hfa7);
-HFADLL_API FLOATTYPE add02_HFA08(HFA08 hfa1, HFA08 hfa2, __int64 v1, short v2, float v3, int v4, double v5, float v6, HFA08 hfa3, double v7, float v8, HFA08 hfa4, short v9, HFA08 hfa5, float v10, HFA08 hfa6, HFA08 hfa7);
-HFADLL_API FLOATTYPE add02_HFA11(HFA11 hfa1, HFA11 hfa2, __int64 v1, short v2, float v3, int v4, double v5, float v6, HFA11 hfa3, double v7, float v8, HFA11 hfa4, short v9, HFA11 hfa5, float v10, HFA11 hfa6, HFA11 hfa7);
-HFADLL_API FLOATTYPE add02_HFA19(HFA19 hfa1, HFA19 hfa2, __int64 v1, short v2, float v3, int v4, double v5, float v6, HFA19 hfa3, double v7, float v8, HFA19 hfa4, short v9, HFA19 hfa5, float v10, HFA19 hfa6, HFA19 hfa7);
-HFADLL_API FLOATTYPE add02_HFA00(HFA01 hfa1, HFA05 hfa2, __int64 v1, short v2, float v3, int v4, double v5, float v6, HFA03 hfa3, double v7, float v8, HFA11 hfa4, short v9, HFA19 hfa5, float v10, HFA08 hfa6, HFA02 hfa7);
-
-HFADLL_API FLOATTYPE add03_HFA01(float v1, signed char v2, HFA01 hfa1, double v3, signed char v4, HFA01 hfa2, __int64 v5, short v6, int v7, HFA01 hfa3, HFA01 hfa4, float v8, HFA01 hfa5, float v9, HFA01 hfa6, float v10, HFA01 hfa7);
-HFADLL_API FLOATTYPE add03_HFA02(float v1, signed char v2, HFA02 hfa1, double v3, signed char v4, HFA02 hfa2, __int64 v5, short v6, int v7, HFA02 hfa3, HFA02 hfa4, float v8, HFA02 hfa5, float v9, HFA02 hfa6, float v10, HFA02 hfa7);
-HFADLL_API FLOATTYPE add03_HFA03(float v1, signed char v2, HFA03 hfa1, double v3, signed char v4, HFA03 hfa2, __int64 v5, short v6, int v7, HFA03 hfa3, HFA03 hfa4, float v8, HFA03 hfa5, float v9, HFA03 hfa6, float v10, HFA03 hfa7);
-HFADLL_API FLOATTYPE add03_HFA05(float v1, signed char v2, HFA05 hfa1, double v3, signed char v4, HFA05 hfa2, __int64 v5, short v6, int v7, HFA05 hfa3, HFA05 hfa4, float v8, HFA05 hfa5, float v9, HFA05 hfa6, float v10, HFA05 hfa7);
-HFADLL_API FLOATTYPE add03_HFA08(float v1, signed char v2, HFA08 hfa1, double v3, signed char v4, HFA08 hfa2, __int64 v5, short v6, int v7, HFA08 hfa3, HFA08 hfa4, float v8, HFA08 hfa5, float v9, HFA08 hfa6, float v10, HFA08 hfa7);
-HFADLL_API FLOATTYPE add03_HFA11(float v1, signed char v2, HFA11 hfa1, double v3, signed char v4, HFA11 hfa2, __int64 v5, short v6, int v7, HFA11 hfa3, HFA11 hfa4, float v8, HFA11 hfa5, float v9, HFA11 hfa6, float v10, HFA11 hfa7);
-HFADLL_API FLOATTYPE add03_HFA19(float v1, signed char v2, HFA19 hfa1, double v3, signed char v4, HFA19 hfa2, __int64 v5, short v6, int v7, HFA19 hfa3, HFA19 hfa4, float v8, HFA19 hfa5, float v9, HFA19 hfa6, float v10, HFA19 hfa7);
-HFADLL_API FLOATTYPE add03_HFA00(float v1, signed char v2, HFA08 hfa1, double v3, signed char v4, HFA19 hfa2, __int64 v5, short v6, int v7, HFA03 hfa3, HFA01 hfa4, float v8, HFA11 hfa5, float v9, HFA02 hfa6, float v10, HFA05 hfa7);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV add01_HFA01(HFA01 hfa1, float v1, HFA01 hfa2, int v2, HFA01 hfa3, short v3, double v4, HFA01 hfa4, HFA01 hfa5, float v5, __int64 v6, float v7, HFA01 hfa6, float v8, HFA01 hfa7);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV add01_HFA02(HFA02 hfa1, float v1, HFA02 hfa2, int v2, HFA02 hfa3, short v3, double v4, HFA02 hfa4, HFA02 hfa5, float v5, __int64 v6, float v7, HFA02 hfa6, float v8, HFA02 hfa7);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV add01_HFA03(HFA03 hfa1, float v1, HFA03 hfa2, int v2, HFA03 hfa3, short v3, double v4, HFA03 hfa4, HFA03 hfa5, float v5, __int64 v6, float v7, HFA03 hfa6, float v8, HFA03 hfa7);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV add01_HFA05(HFA05 hfa1, float v1, HFA05 hfa2, int v2, HFA05 hfa3, short v3, double v4, HFA05 hfa4, HFA05 hfa5, float v5, __int64 v6, float v7, HFA05 hfa6, float v8, HFA05 hfa7);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV add01_HFA08(HFA08 hfa1, float v1, HFA08 hfa2, int v2, HFA08 hfa3, short v3, double v4, HFA08 hfa4, HFA08 hfa5, float v5, __int64 v6, float v7, HFA08 hfa6, float v8, HFA08 hfa7);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV add01_HFA11(HFA11 hfa1, float v1, HFA11 hfa2, int v2, HFA11 hfa3, short v3, double v4, HFA11 hfa4, HFA11 hfa5, float v5, __int64 v6, float v7, HFA11 hfa6, float v8, HFA11 hfa7);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV add01_HFA19(HFA19 hfa1, float v1, HFA19 hfa2, int v2, HFA19 hfa3, short v3, double v4, HFA19 hfa4, HFA19 hfa5, float v5, __int64 v6, float v7, HFA19 hfa6, float v8, HFA19 hfa7);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV add01_HFA00(HFA03 hfa1, float v1, HFA02 hfa2, int v2, HFA19 hfa3, short v3, double v4, HFA05 hfa4, HFA08 hfa5, float v5, __int64 v6, float v7, HFA11 hfa6, float v8, HFA01 hfa7);
+
+HFADLL_API FLOATTYPE HFADLL_CALLCONV add02_HFA01(HFA01 hfa1, HFA01 hfa2, __int64 v1, short v2, float v3, int v4, double v5, float v6, HFA01 hfa3, double v7, float v8, HFA01 hfa4, short v9, HFA01 hfa5, float v10, HFA01 hfa6, HFA01 hfa7);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV add02_HFA02(HFA02 hfa1, HFA02 hfa2, __int64 v1, short v2, float v3, int v4, double v5, float v6, HFA02 hfa3, double v7, float v8, HFA02 hfa4, short v9, HFA02 hfa5, float v10, HFA02 hfa6, HFA02 hfa7);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV add02_HFA03(HFA03 hfa1, HFA03 hfa2, __int64 v1, short v2, float v3, int v4, double v5, float v6, HFA03 hfa3, double v7, float v8, HFA03 hfa4, short v9, HFA03 hfa5, float v10, HFA03 hfa6, HFA03 hfa7);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV add02_HFA05(HFA05 hfa1, HFA05 hfa2, __int64 v1, short v2, float v3, int v4, double v5, float v6, HFA05 hfa3, double v7, float v8, HFA05 hfa4, short v9, HFA05 hfa5, float v10, HFA05 hfa6, HFA05 hfa7);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV add02_HFA08(HFA08 hfa1, HFA08 hfa2, __int64 v1, short v2, float v3, int v4, double v5, float v6, HFA08 hfa3, double v7, float v8, HFA08 hfa4, short v9, HFA08 hfa5, float v10, HFA08 hfa6, HFA08 hfa7);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV add02_HFA11(HFA11 hfa1, HFA11 hfa2, __int64 v1, short v2, float v3, int v4, double v5, float v6, HFA11 hfa3, double v7, float v8, HFA11 hfa4, short v9, HFA11 hfa5, float v10, HFA11 hfa6, HFA11 hfa7);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV add02_HFA19(HFA19 hfa1, HFA19 hfa2, __int64 v1, short v2, float v3, int v4, double v5, float v6, HFA19 hfa3, double v7, float v8, HFA19 hfa4, short v9, HFA19 hfa5, float v10, HFA19 hfa6, HFA19 hfa7);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV add02_HFA00(HFA01 hfa1, HFA05 hfa2, __int64 v1, short v2, float v3, int v4, double v5, float v6, HFA03 hfa3, double v7, float v8, HFA11 hfa4, short v9, HFA19 hfa5, float v10, HFA08 hfa6, HFA02 hfa7);
+
+HFADLL_API FLOATTYPE HFADLL_CALLCONV add03_HFA01(float v1, signed char v2, HFA01 hfa1, double v3, signed char v4, HFA01 hfa2, __int64 v5, short v6, int v7, HFA01 hfa3, HFA01 hfa4, float v8, HFA01 hfa5, float v9, HFA01 hfa6, float v10, HFA01 hfa7);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV add03_HFA02(float v1, signed char v2, HFA02 hfa1, double v3, signed char v4, HFA02 hfa2, __int64 v5, short v6, int v7, HFA02 hfa3, HFA02 hfa4, float v8, HFA02 hfa5, float v9, HFA02 hfa6, float v10, HFA02 hfa7);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV add03_HFA03(float v1, signed char v2, HFA03 hfa1, double v3, signed char v4, HFA03 hfa2, __int64 v5, short v6, int v7, HFA03 hfa3, HFA03 hfa4, float v8, HFA03 hfa5, float v9, HFA03 hfa6, float v10, HFA03 hfa7);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV add03_HFA05(float v1, signed char v2, HFA05 hfa1, double v3, signed char v4, HFA05 hfa2, __int64 v5, short v6, int v7, HFA05 hfa3, HFA05 hfa4, float v8, HFA05 hfa5, float v9, HFA05 hfa6, float v10, HFA05 hfa7);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV add03_HFA08(float v1, signed char v2, HFA08 hfa1, double v3, signed char v4, HFA08 hfa2, __int64 v5, short v6, int v7, HFA08 hfa3, HFA08 hfa4, float v8, HFA08 hfa5, float v9, HFA08 hfa6, float v10, HFA08 hfa7);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV add03_HFA11(float v1, signed char v2, HFA11 hfa1, double v3, signed char v4, HFA11 hfa2, __int64 v5, short v6, int v7, HFA11 hfa3, HFA11 hfa4, float v8, HFA11 hfa5, float v9, HFA11 hfa6, float v10, HFA11 hfa7);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV add03_HFA19(float v1, signed char v2, HFA19 hfa1, double v3, signed char v4, HFA19 hfa2, __int64 v5, short v6, int v7, HFA19 hfa3, HFA19 hfa4, float v8, HFA19 hfa5, float v9, HFA19 hfa6, float v10, HFA19 hfa7);
+HFADLL_API FLOATTYPE HFADLL_CALLCONV add03_HFA00(float v1, signed char v2, HFA08 hfa1, double v3, signed char v4, HFA19 hfa2, __int64 v5, short v6, int v7, HFA03 hfa3, HFA01 hfa4, float v8, HFA11 hfa5, float v9, HFA02 hfa6, float v10, HFA05 hfa7);
diff --git a/tests/src/Loader/classloader/methodoverriding/regressions/549411/exploit.csproj b/tests/src/Loader/classloader/methodoverriding/regressions/549411/exploit.csproj
index 1ebf6ee1d0..0f191d122f 100644
--- a/tests/src/Loader/classloader/methodoverriding/regressions/549411/exploit.csproj
+++ b/tests/src/Loader/classloader/methodoverriding/regressions/549411/exploit.csproj
@@ -12,7 +12,6 @@
<OutputType>Exe</OutputType>
<CLRTestKind>BuildAndRun</CLRTestKind>
<CLRTestPriority>0</CLRTestPriority>
- <GCStressIncompatible Condition="'$(Platform)' == 'x86'">true</GCStressIncompatible>
</PropertyGroup>
<ItemGroup>
diff --git a/tests/src/NuGet.Config b/tests/src/NuGet.Config
index 51701f05f6..0922300baf 100644
--- a/tests/src/NuGet.Config
+++ b/tests/src/NuGet.Config
@@ -7,7 +7,7 @@
<clear/>
<add key="myget.org dotnet-core" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" />
<add key="myget.org nugetbuild" value="https://www.myget.org/F/nugetbuild/api/v3/index.json" />
- <add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
+ <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
</packageSources>
<activePackageSource>
<add key="All" value="(Aggregate source)" />
diff --git a/tests/src/Regressions/coreclr/GitHub_7685/test7685.cs b/tests/src/Regressions/coreclr/GitHub_7685/test7685.cs
index a1d35bc11c..77b25dc59c 100644
--- a/tests/src/Regressions/coreclr/GitHub_7685/test7685.cs
+++ b/tests/src/Regressions/coreclr/GitHub_7685/test7685.cs
@@ -6,28 +6,100 @@ using System.Reflection;
public class Test7685
{
- static RectangleF argumentInDStuff;
-
+ static RectangleF passedFloatStruct;
+ static RectangleD passedDoubleStruct;
+ static RectangleI passedIntStruct;
+ static RectangleLLarge passedLongLargeStruct;
+ static RectangleLSmall passedLongSmallStruct;
+ static RectangleNestedF passedNestedSmallFStruct;
+
public static int Main()
{
int iRetVal = 100;
- var r = new RectangleF(1.2f, 3.4f, 5.6f, 7.8f);
- typeof(Test7685).GetTypeInfo().GetDeclaredMethod("DoStuff").Invoke(null, new object[] { r });
+ var rF = new RectangleF(1.2f, 3.4f, 5.6f, 7.8f);
+ var rD = new RectangleD(1.7E+3d, 4.5d, 500.1d, 60.0d);
+ var rI = new RectangleI(100, -2, 3, 64);
+ var rLSmall = new RectangleLSmall(11231L);
+ var rLLarge = new RectangleLLarge(1L, 20041L, 22L, 88L);
+ var rNestedFSmall = new RectangleNestedF(1.2f, 3.4f, 5.6f, 7.8f);
+
+ typeof(Test7685).GetTypeInfo().GetDeclaredMethod("DoStuffF").Invoke(null, new object[] { rF });
+ typeof(Test7685).GetTypeInfo().GetDeclaredMethod("DoStuffD").Invoke(null, new object[] { rD });
+ typeof(Test7685).GetTypeInfo().GetDeclaredMethod("DoStuffI").Invoke(null, new object[] { rI });
+ typeof(Test7685).GetTypeInfo().GetDeclaredMethod("DoStuffLSmall").Invoke(null, new object[] { rLSmall });
+ typeof(Test7685).GetTypeInfo().GetDeclaredMethod("DoStuffLLarge").Invoke(null, new object[] { rLLarge });
+ typeof(Test7685).GetTypeInfo().GetDeclaredMethod("DoStuffNestedF").Invoke(null, new object[] { rNestedFSmall });
- if (!RectangleF.Equals(ref argumentInDStuff, ref r))
+ if (!RectangleF.Equals(ref passedFloatStruct, ref rF))
{
- TestLibrary.Logging.WriteLine($"Error: passing struct with floats via reflection. Callee received {argumentInDStuff} instead of {r}");
+ TestLibrary.Logging.WriteLine($"Error: passing struct with floats via reflection. Callee received {passedFloatStruct} instead of {rF}");
iRetVal = 0;
}
+
+ if (!RectangleD.Equals(ref passedDoubleStruct, ref rD))
+ {
+ TestLibrary.Logging.WriteLine($"Error: passing struct with doubles via reflection. Callee received {passedDoubleStruct} instead of {rD}");
+ iRetVal = 1;
+ }
+
+ if (!RectangleI.Equals(ref passedIntStruct, ref rI))
+ {
+ TestLibrary.Logging.WriteLine($"Error: passing struct with ints via reflection. Callee received {passedIntStruct} instead of {rI}");
+ iRetVal = 2;
+ }
+
+ if (!RectangleLSmall.Equals(ref passedLongSmallStruct, ref rLSmall))
+ {
+ TestLibrary.Logging.WriteLine($"Error: passing struct with a long via reflection. Callee received {passedLongSmallStruct} instead of {rLSmall}");
+ iRetVal = 3;
+ }
+
+ if (!RectangleLLarge.Equals(ref passedLongLargeStruct, ref rLLarge))
+ {
+ TestLibrary.Logging.WriteLine($"Error: passing struct with longs via reflection. Callee received {passedLongLargeStruct} instead of {rLLarge}");
+ iRetVal = 4;
+ }
+
+ if (!RectangleNestedF.Equals(ref passedNestedSmallFStruct, ref rNestedFSmall))
+ {
+ TestLibrary.Logging.WriteLine($"Error: passing struct with longs via reflection. Callee received {passedNestedSmallFStruct} instead of {rNestedFSmall}");
+ iRetVal = 5;
+ }
return iRetVal;
}
- public static void DoStuff(RectangleF r)
+ public static void DoStuffF(RectangleF r)
+ {
+ passedFloatStruct = r;
+ }
+
+ public static void DoStuffD(RectangleD r)
+ {
+ passedDoubleStruct = r;
+ }
+
+ public static void DoStuffI(RectangleI r)
+ {
+ passedIntStruct = r;
+ }
+
+ public static void DoStuffLSmall(RectangleLSmall r)
{
- argumentInDStuff = r;
+ passedLongSmallStruct = r;
}
+
+ public static void DoStuffLLarge(RectangleLLarge r)
+ {
+ passedLongLargeStruct = r;
+ }
+
+ public static void DoStuffNestedF(RectangleNestedF r)
+ {
+ passedNestedSmallFStruct = r;
+ }
+
}
public struct RectangleF
@@ -46,3 +118,106 @@ public struct RectangleF
public override string ToString() => $"[{_x}, {_y}, {_width}, {_height}]";
}
+
+public struct RectangleFSmall
+{
+ public float _x, _y;
+
+ public RectangleFSmall(float x, float y)
+ {
+ _x = x; _y = y;
+ }
+
+ public static bool Equals(ref RectangleFSmall r1, ref RectangleFSmall r2)
+ {
+ return (r2._x == r1._x) && (r2._y == r1._y);
+ }
+
+ public override string ToString() => $"[{_x}, {_y}]";
+}
+
+public struct RectangleD
+{
+ private double _x, _y, _width, _height;
+
+ public RectangleD(double x, double y, double width, double height)
+ {
+ _x = x; _y = y; _width = width; _height = height;
+ }
+
+ public static bool Equals(ref RectangleD r1, ref RectangleD r2)
+ {
+ return (r2._x == r1._x) && (r2._y == r1._y) && (r2._width == r1._width) && (r2._height == r1._height);
+ }
+
+ public override string ToString() => $"[{_x}, {_y}, {_width}, {_height}]";
+}
+
+public struct RectangleI
+{
+ private int _x, _y, _width, _height;
+
+ public RectangleI(int x, int y, int width, int height)
+ {
+ _x = x; _y = y; _width = width; _height = height;
+ }
+
+ public static bool Equals(ref RectangleI r1, ref RectangleI r2)
+ {
+ return (r2._x == r1._x) && (r2._y == r1._y) && (r2._width == r1._width) && (r2._height == r1._height);
+ }
+
+ public override string ToString() => $"[{_x}, {_y}, {_width}, {_height}]";
+}
+
+public struct RectangleLSmall
+{
+ private long _x;
+
+ public RectangleLSmall(long x)
+ {
+ _x = x;
+ }
+
+ public static bool Equals(ref RectangleLSmall r1, ref RectangleLSmall r2)
+ {
+ return (r2._x == r1._x);
+ }
+
+ public override string ToString() => $"[{_x}]";
+}
+
+public struct RectangleLLarge
+{
+ private long _x, _y, _width, _height;
+
+ public RectangleLLarge(long x, long y, long width, long height)
+ {
+ _x = x; _y = y; _width = width; _height = height;
+ }
+
+ public static bool Equals(ref RectangleLLarge r1, ref RectangleLLarge r2)
+ {
+ return (r2._x == r1._x) && (r2._y == r1._y) && (r2._width == r1._width) && (r2._height == r1._height);
+ }
+
+ public override string ToString() => $"[{_x}, {_y}, {_width}, {_height}]";
+}
+
+public struct RectangleNestedF
+{
+ private RectangleFSmall first, second;
+
+ public RectangleNestedF(float x, float y, float width, float height)
+ {
+ first = new RectangleFSmall(x, y);
+ second = new RectangleFSmall(width, height);
+ }
+
+ public static bool Equals(ref RectangleNestedF r1, ref RectangleNestedF r2)
+ {
+ return (r1.first._x == r2.first._x) && (r1.first._y == r2.first._y) && (r1.second._x == r2.second._x) && (r1.second._y == r2.second._y);
+ }
+
+ public override string ToString() => $"[{first._x}, {first._y}, {second._x}, {second._y}]";
+} \ No newline at end of file
diff --git a/tests/src/TestWrappersConfig/project.json b/tests/src/TestWrappersConfig/project.json
index 93e73880a2..56585e12b7 100644
--- a/tests/src/TestWrappersConfig/project.json
+++ b/tests/src/TestWrappersConfig/project.json
@@ -1,6 +1,6 @@
{
"dependencies": {
- "Microsoft.NETCore.Platforms": "2.0.0-preview1-25210-01",
+ "Microsoft.NETCore.Platforms": "2.0.0-preview1-25221-01",
"xunit": "2.2.0-beta2-build3300",
"xunit.assert": "2.2.0-beta2-build3300",
"xunit.core": "2.2.0-beta2-build3300",
diff --git a/tests/src/baseservices/multidimmarray/rank1array.il b/tests/src/baseservices/multidimmarray/rank1array.il
new file mode 100644
index 0000000000..3f36483e81
--- /dev/null
+++ b/tests/src/baseservices/multidimmarray/rank1array.il
@@ -0,0 +1,160 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+// Tests that SzArray is castable to multidimensional array of rank 1 with zero lower bounds
+// and that the MdArray methods can operate on such `this`.
+// We cast an SzArray to MdArray, call methods on it, and validate the SzArray was updated
+// at the expected memory locations.
+
+.assembly extern mscorlib { }
+
+.assembly rank1array
+{
+}
+
+.module rank1array.exe
+.subsystem 0x0003
+.corflags 0x00000001
+
+.method public hidebysig static int32 Main () cil managed
+{
+ .locals init(
+ [0] int32[] szArray,
+ [1] int32[0...] mdArray
+ )
+
+ .maxstack 8
+ .entrypoint
+
+ ldc.i4.2
+ newarr int32
+ stloc.0
+
+ // SzArray is castable to MdArray rank 1 with zero lower bounds
+ ldloc.0
+ castclass int32[0...]
+ stloc.1
+
+ ldloc.1
+ ldc.i4.0
+ ldc.i4 0x4d2
+ call instance void int32[0...]::Set(int32, int32)
+
+ // The call to Set had better updated the memory location we expect
+ ldloc.0
+ ldc.i4.0
+ ldelem.i4
+ ldc.i4 0x4d2
+ ceq
+ brtrue SetOK
+ ldc.i4.1
+ ret
+
+SetOK:
+ ldloc.1
+ ldc.i4.0
+ call instance int32 int32[0...]::Get(int32)
+ ldc.i4 0x4d2
+ ceq
+ brtrue GetOK
+ ldc.i4.2
+ ret
+
+GetOK:
+ ldloc.1
+ ldc.i4.1
+ call instance int32& int32[0...]::Address(int32)
+ ldc.i4 42
+ stind.i4
+
+ // The call to Address had better given us the memory location we expect
+ ldloc.0
+ ldc.i4.1
+ ldelem.i4
+ ldc.i4 42
+ ceq
+ brtrue AddressOK
+ ldc.i4.3
+ ret
+
+AddressOK:
+
+ // We can also cast through type-size-equivalence
+ ldc.i4.0
+ newarr int32
+ isinst uint32[0...]
+ brtrue SizeEquivalenceOK
+ ldc.i4.4
+ ret
+
+SizeEquivalenceOK:
+
+ // We follow all the size equivalence rules though
+ ldc.i4.0
+ newarr float32
+ isinst uint32[0...]
+ brfalse SizeEquivalenceNegativeOK
+ ldc.i4.5
+ ret
+
+SizeEquivalenceNegativeOK:
+
+ // String -> object casts
+ ldc.i4.0
+ newarr string
+ isinst object[0...]
+ brtrue StringObjectCastOK
+ ldc.i4.6
+ ret
+
+StringObjectCastOK:
+
+ // Object -> string negative cast
+ ldc.i4.0
+ newarr object
+ isinst string[0...]
+ brfalse ObjectStringNegativeOK
+ ldc.i4.7
+ ret
+
+ObjectStringNegativeOK:
+
+ // MdArray of rank 1 is also castable to SzArray
+ ldc.i4.0
+ newobj instance void int32[0...]::.ctor(int32)
+ isinst int32[]
+ brtrue MdSzArrayOK
+ ldc.i4.8
+ ret
+
+MdSzArrayOK:
+
+ // "newobj instance void int32[0...]::.ctor(int32)" actually gives you int[]
+ ldc.i4.1
+ newobj instance void int32[0...]::.ctor(int32)
+ call instance class [mscorlib]System.Type class [mscorlib]System.Object::GetType()
+ ldtoken int32[]
+ call class [mscorlib]System.Type class [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
+ ceq
+ brtrue Int32ArrayRank1IsInt32SzArray
+ ldc.i4 9
+ ret
+
+Int32ArrayRank1IsInt32SzArray:
+
+ // int32[] and int32[0..] are still different types though
+ ldtoken int32[]
+ call class [mscorlib]System.Type class [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
+ ldtoken int32[0...]
+ call class [mscorlib]System.Type class [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
+ ceq
+ brfalse DifferentTypes
+ ldc.i4 10
+ ret
+
+DifferentTypes:
+
+ ldc.i4 100
+ ret
+}
diff --git a/tests/src/baseservices/multidimmarray/rank1array.ilproj b/tests/src/baseservices/multidimmarray/rank1array.ilproj
new file mode 100644
index 0000000000..6679689a66
--- /dev/null
+++ b/tests/src/baseservices/multidimmarray/rank1array.ilproj
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <AssemblyName>rank1array</AssemblyName>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{405DB174-DAB1-4095-BC2D-B64E38E94B8B}</ProjectGuid>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <OutputType>Exe</OutputType>
+ <CLRTestKind>BuildAndRun</CLRTestKind>
+ <CLRTestPriority>0</CLRTestPriority>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+
+ <ItemGroup>
+ <Compile Include="rank1array.il" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+</Project>
diff --git a/tests/src/performance/linkbench/assets/MusicStore/MusicStoreReflection.xml b/tests/src/performance/linkbench/assets/MusicStore/MusicStoreReflection.xml
new file mode 100644
index 0000000000..3673c65e60
--- /dev/null
+++ b/tests/src/performance/linkbench/assets/MusicStore/MusicStoreReflection.xml
@@ -0,0 +1,27 @@
+<linker>
+ <!--- Called by Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions:.cctor -->
+ <assembly fullname="System.Linq.Queryable">
+ <type fullname="System.Linq.Queryable" required="true" />
+ </assembly>
+
+ <assembly fullname="System.Linq.Expressions">
+ <!--- Called by System.Linq.Expressions.Expression:CreateLambda -->
+ <type fullname="System.Linq.Expressions.Expression`1" required="true" />
+ <!--- Called by [System.Linq.Expressions]System.Runtime.CompilerServices.CallSite<>.CreateCustomNoMatchDelegate and [System.Linq.Expressions]System.Runtime.CompilerServices.CallSite<>.CreateCustomUpdateDelegate-->
+ <type fullname="System.Runtime.CompilerServices.CallSiteOps" required="true" />
+ <!--- Called by [System.Linq.Expressions]System.Runtime.CompilerServices.CallSiteBinder.Stitch -->
+ <type fullname="System.Runtime.CompilerServices.CallSite" required="true" />
+ <!--- Called by [System.Linq.Expressions]System.Runtime.CompilerServices.CallSiteBinder.Stitch -->
+ <type fullname="System.Runtime.CompilerServices.CallSite`1" required="true" />
+ <!--- Called by [System.Linq.Expressions]System.Runtime.CompilerServices.CallSite`1.MakeUpdateDelegate -->
+ <type fullname="System.Dynamic.UpdateDelegates" required="true" />
+ <!--- Called by [System.Linq.Expressions]System.Dynamic.DynamicObject.MetaDynamic.BindBinaryOperation -->
+ <type fullname="System.Dynamic.DynamicObject" required="true" />
+ </assembly>
+
+ <assembly fullname="System.ComponentModel.TypeConverter">
+ <type fullname="System.ComponentModel.StringConverter" required="true" />
+ <type fullname="System.ComponentModel.BooleanConverter" required="true" />
+ <type fullname="System.ComponentModel.CollectionConverter" required="true" />
+ </assembly>
+</linker>
diff --git a/tests/src/performance/linkbench/assets/Roslyn/RoslynRoots.txt b/tests/src/performance/linkbench/assets/Roslyn/RoslynRoots.txt
new file mode 100644
index 0000000000..10f149e1c5
--- /dev/null
+++ b/tests/src/performance/linkbench/assets/Roslyn/RoslynRoots.txt
@@ -0,0 +1,3 @@
+Microsoft.CodeAnalysis
+Microsoft.CodeAnalysis.CSharp
+System.Private.CoreLib
diff --git a/tests/src/performance/linkbench/assets/Roslyn/RoslynRoots.xml b/tests/src/performance/linkbench/assets/Roslyn/RoslynRoots.xml
new file mode 100644
index 0000000000..afc1ce6922
--- /dev/null
+++ b/tests/src/performance/linkbench/assets/Roslyn/RoslynRoots.xml
@@ -0,0 +1,5 @@
+<linker>
+ <assembly fullname="csc">
+ <type fullname="*" required="true" />
+ </assembly>
+</linker>
diff --git a/tests/src/performance/linkbench/assets/Roslyn/illinkcsproj b/tests/src/performance/linkbench/assets/Roslyn/illinkcsproj
new file mode 100644
index 0000000000..1247c5e715
--- /dev/null
+++ b/tests/src/performance/linkbench/assets/Roslyn/illinkcsproj
@@ -0,0 +1,9 @@
+<Project Sdk="Microsoft.NET.Sdk">
+ <PropertyGroup>
+ <TargetFramework>netcoreapp2.0</TargetFramework>
+ <RuntimeIdentifiers>win7-x86;win7-x64</RuntimeIdentifiers>
+ </PropertyGroup>
+ <ItemGroup>
+ <PackageReference Include="ILLink.Tasks" Version="0.1.0-preview" />
+ </ItemGroup>
+</Project>
diff --git a/tests/src/performance/linkbench/linkbench.cs b/tests/src/performance/linkbench/linkbench.cs
new file mode 100644
index 0000000000..3d29957f90
--- /dev/null
+++ b/tests/src/performance/linkbench/linkbench.cs
@@ -0,0 +1,372 @@
+using System;
+using System.Diagnostics;
+using System.Collections.Generic;
+using System.IO;
+using System.Reflection;
+using System.Runtime.Loader;
+using System.Text;
+using System.Globalization;
+using System.Linq;
+using System.Xml.Linq;
+using Microsoft.Xunit.Performance;
+using Microsoft.Xunit.Performance.Api;
+using Xunit;
+using Xunit.Abstractions;
+
+namespace LinkBench
+{
+ public class Benchmark
+ {
+ public string Name;
+
+ public string UnlinkedDir;
+ public string LinkedDir;
+ public double UnlinkedMsilSize;
+ public double LinkedMsilSize;
+ public double UnlinkedDirSize;
+ public double LinkedDirSize;
+ public double MsilSizeReduction;
+ public double DirSizeReduction;
+
+ private DirectoryInfo unlinkedDirInfo;
+ private DirectoryInfo linkedDirInfo;
+ private double certDiff;
+ const double MB = 1024 * 1024;
+
+ public Benchmark(string _Name, string _UnlinkedDir, string _LinkedDir)
+ {
+ Name = _Name;
+ UnlinkedDir = _UnlinkedDir;
+ LinkedDir = _LinkedDir;
+ unlinkedDirInfo = new DirectoryInfo(UnlinkedDir);
+ linkedDirInfo = new DirectoryInfo(LinkedDir);
+ }
+
+ public void Compute()
+ {
+ ComputeCertDiff();
+ UnlinkedMsilSize = GetMSILSize(UnlinkedDir);
+ LinkedMsilSize = GetMSILSize(LinkedDir);
+ UnlinkedDirSize = GetDirSize(unlinkedDirInfo);
+ LinkedDirSize = GetDirSize(linkedDirInfo);
+
+ MsilSizeReduction = (UnlinkedMsilSize - LinkedMsilSize) / UnlinkedMsilSize * 100;
+ DirSizeReduction = (UnlinkedDirSize - LinkedDirSize) / UnlinkedDirSize * 100;
+ }
+
+ // Compute total size of a directory, in MegaBytes
+ // Includes all files and subdirectories recursively
+ private double GetDirSize(DirectoryInfo dir)
+ {
+ double size = 0;
+ FileInfo[] files = dir.GetFiles();
+ foreach (FileInfo fileInfo in files)
+ {
+ size += fileInfo.Length;
+ }
+ DirectoryInfo[] subDirs = dir.GetDirectories();
+ foreach (DirectoryInfo dirInfo in subDirs)
+ {
+ size += GetDirSize(dirInfo);
+ }
+
+ return size / MB;
+ }
+
+ // Compute the size of MSIL files in a directory, in MegaBytes
+ // Top level only, excludes crossgen files.
+ private double GetMSILSize(string dir)
+ {
+ string[] files = Directory.GetFiles(dir);
+ long msilSize = 0;
+
+ foreach (string file in files)
+ {
+ if (file.EndsWith(".ni.dll") || file.EndsWith(".ni.exe"))
+ {
+ continue;
+ }
+ try
+ {
+ AssemblyLoadContext.GetAssemblyName(file);
+ }
+ catch (BadImageFormatException)
+ {
+ continue;
+ }
+
+ msilSize += new FileInfo(file).Length;
+ }
+
+ return msilSize / MB;
+ }
+
+ // Gets the size of the Certificate header in a MSIL or ReadyToRun binary.
+ private long GetCertSize(string file)
+ {
+ Process p = new Process();
+ p.StartInfo.UseShellExecute = false;
+ p.StartInfo.RedirectStandardOutput = true;
+ p.StartInfo.FileName = LinkBench.ScriptDir + "GetCert.cmd";
+ p.StartInfo.Arguments = file;
+ p.Start();
+ string output = p.StandardOutput.ReadToEnd();
+ p.WaitForExit();
+ long size = Int32.Parse(output.Substring(18, 8),
+ NumberStyles.AllowLeadingWhite | NumberStyles.AllowTrailingWhite | NumberStyles.HexNumber);
+ return size;
+ }
+
+ // Get the total size difference for all certificates in all managed binaries
+ // in the unlinked and linked directories.
+ private double ComputeCertDiff()
+ {
+ string[] files = Directory.GetFiles(LinkedDir);
+ long totalDiff = 0;
+
+ foreach (string file in files)
+ {
+ try
+ {
+ AssemblyLoadContext.GetAssemblyName(file);
+ }
+ catch (BadImageFormatException)
+ {
+ continue;
+ }
+
+ FileInfo fileInfo = new FileInfo(file);
+ long linkedCert = GetCertSize(file);
+ long unlinkedCert = GetCertSize(UnlinkedDir + "\\" + fileInfo.Name);
+ totalDiff += (unlinkedCert - linkedCert);
+ }
+
+ return totalDiff / MB;
+ }
+ }
+
+ public class LinkBench
+ {
+ private static ScenarioConfiguration scenarioConfiguration = new ScenarioConfiguration(new TimeSpan(2000000));
+ private static MetricModel SizeMetric = new MetricModel { Name = "Size", DisplayName = "File Size", Unit = "MB" };
+ private static MetricModel PercMetric = new MetricModel { Name = "Perc", DisplayName = "% Reduction", Unit = "%" };
+ public static string Workspace;
+ public static string ScriptDir;
+ public static string AssetsDir;
+ private static Benchmark CurrentBenchmark;
+
+ public static int Main(String [] args)
+ {
+ // Workspace is the ROOT of the coreclr tree.
+ // If CORECLR_REPO is not set, the script assumes that the location of sandbox
+ // is <path>\coreclr\sandbox.
+ bool doClone = true;
+ bool doBuild = true;
+
+ for(int i=0; i < args.Length; i++)
+ {
+ if (String.Compare(args[i], "noclone", true) == 0)
+ {
+ doClone = false;
+ }
+ else if (String.Compare(args[i], "nobuild", true) == 0)
+ {
+ doClone = false;
+ doBuild = false;
+ }
+ else
+ {
+ Console.WriteLine("Unknown argument");
+ return -4;
+ }
+ }
+
+ Workspace = Environment.GetEnvironmentVariable("CORECLR_REPO");
+ if (Workspace == null)
+ {
+ Workspace = Directory.GetParent(Directory.GetCurrentDirectory()).FullName;
+ }
+ if (Workspace == null)
+ {
+ Console.WriteLine("CORECLR_REPO not found");
+ return -1;
+ }
+
+ string LinkBenchDir = Workspace + "\\tests\\src\\performance\\linkbench\\";
+ ScriptDir = LinkBenchDir + "scripts\\";
+ AssetsDir = LinkBenchDir + "assets\\";
+
+ Benchmark[] Benchmarks =
+ {
+ new Benchmark("HelloWorld",
+ "LinkBench\\HelloWorld\\bin\\release\\netcoreapp2.0\\win10-x64\\publish",
+ "LinkBench\\HelloWorld\\bin\\release\\netcoreapp2.0\\win10-x64\\linked"),
+ new Benchmark("WebAPI",
+ "LinkBench\\WebAPI\\bin\\release\\netcoreapp2.0\\win10-x64\\publish",
+ "LinkBench\\WebAPI\\bin\\release\\netcoreapp2.0\\win10-x64\\linked"),
+ new Benchmark("MusicStore",
+ "LinkBench\\JitBench\\src\\MusicStore\\bin\\release\\netcoreapp2.0\\win10-x64\\publish",
+ "LinkBench\\JitBench\\src\\MusicStore\\bin\\release\\netcoreapp2.0\\win10-x64\\linked"),
+ new Benchmark("MusicStore_R2R",
+ "LinkBench\\JitBench\\src\\MusicStore\\bin\\release\\netcoreapp2.0\\win10-x64\\publish_r2r",
+ "LinkBench\\JitBench\\src\\MusicStore\\bin\\release\\netcoreapp2.0\\win10-x64\\linked_r2r"),
+ new Benchmark("Corefx",
+ "LinkBench\\corefx\\bin\\ILLinkTrimAssembly\\netcoreapp-Windows_NT-Release-x64\\pretrimmed",
+ "LinkBench\\corefx\\bin\\ILLinkTrimAssembly\\netcoreapp-Windows_NT-Release-x64\\trimmed"),
+ new Benchmark("Roslyn",
+ "LinkBench\\roslyn\\Binaries\\Release\\Exes\\CscCore",
+ "LinkBench\\roslyn\\Binaries\\Release\\Exes\\Linked"),
+ };
+
+ // Update the build files to facilitate the link step
+ if(doClone)
+ {
+ if(!Setup())
+ {
+ return -2;
+ }
+ }
+
+ if (doBuild)
+ {
+ // Run the setup Script, which clones, builds and links the benchmarks.
+ using (var setup = new Process())
+ {
+ setup.StartInfo.FileName = ScriptDir + "build.cmd";
+ setup.StartInfo.Arguments = AssetsDir;
+ setup.Start();
+ setup.WaitForExit();
+ if (setup.ExitCode != 0)
+ {
+ Console.WriteLine("Setup failed");
+ return -3;
+ }
+ }
+ }
+
+ // Since this is a size measurement scenario, there are no iterations
+ // to perform. So, create a process that does nothing, to satisfy XUnit.
+ // All size measurements are performed PostRun()
+ var emptyCmd = new ProcessStartInfo()
+ {
+ FileName = ScriptDir + "empty.cmd"
+ };
+
+ for (int i = 0; i < Benchmarks.Length; i++)
+ {
+ CurrentBenchmark = Benchmarks[i];
+ string[] scriptArgs = { "--perf:runid", CurrentBenchmark.Name };
+
+ using (var h = new XunitPerformanceHarness(scriptArgs))
+ {
+ h.RunScenario(emptyCmd, null, null, PostRun, scenarioConfiguration);
+ }
+ }
+
+ return 0;
+ }
+
+ private static ScenarioBenchmark PostRun()
+ {
+ // The XUnit output doesn't print the benchmark name, so print it now.
+ Console.WriteLine("{0}", CurrentBenchmark.Name);
+
+ var scenario = new ScenarioBenchmark(CurrentBenchmark.Name)
+ {
+ Namespace = "LinkBench"
+ };
+
+ CurrentBenchmark.Compute();
+
+ addMeasurement(ref scenario, "MSIL Unlinked", SizeMetric, CurrentBenchmark.UnlinkedMsilSize);
+ addMeasurement(ref scenario, "MSIL Linked", SizeMetric, CurrentBenchmark.LinkedMsilSize);
+ addMeasurement(ref scenario, "MSIL %Reduction", PercMetric, CurrentBenchmark.MsilSizeReduction);
+ addMeasurement(ref scenario, "Total Uninked", SizeMetric, CurrentBenchmark.UnlinkedDirSize);
+ addMeasurement(ref scenario, "Total Linked", SizeMetric, CurrentBenchmark.LinkedDirSize);
+ addMeasurement(ref scenario, "Total %Reduction", PercMetric, CurrentBenchmark.DirSizeReduction);
+
+ return scenario;
+ }
+
+ private static bool Setup()
+ {
+ // Clone the benchmarks
+ using (var setup = new Process())
+ {
+ setup.StartInfo.FileName = ScriptDir + "clone.cmd";
+ Console.WriteLine("Run {0}", setup.StartInfo.FileName);
+ setup.Start();
+ setup.WaitForExit();
+ if (setup.ExitCode != 0)
+ {
+ Console.WriteLine("clone failed");
+ return false;
+ }
+ }
+
+ //Update the project files
+ AddLinkerReference("LinkBench\\HelloWorld\\HelloWorld.csproj");
+ AddLinkerReference("LinkBench\\WebAPI\\WebAPI.csproj");
+ AddLinkerReference("LinkBench\\JitBench\\src\\MusicStore\\MusicStore.csproj");
+ RemoveCrossgenTarget("LinkBench\\JitBench\\src\\MusicStore\\MusicStore.csproj");
+
+ return true;
+ }
+
+ private static void AddLinkerReference(string csproj)
+ {
+ var xdoc = XDocument.Load(csproj);
+ var ns = xdoc.Root.GetDefaultNamespace();
+ bool added = false;
+ foreach (var el in xdoc.Root.Elements(ns + "ItemGroup"))
+ {
+ if (el.Elements(ns + "PackageReference").Any())
+ {
+ el.Add(new XElement(ns + "PackageReference",
+ new XAttribute("Include", "ILLink.Tasks"),
+ new XAttribute("Version", "0.1.0-preview")));
+ added = true;
+ break;
+ }
+ }
+ if (!added)
+ {
+ xdoc.Root.Add(new XElement(ns + "ItemGroup",
+ new XElement(ns + "PackageReference",
+ new XAttribute("Include", "ILLink.Tasks"),
+ new XAttribute("Version", "0.1.0-preview"))));
+ added = true;
+ }
+ using (var fs = new FileStream(csproj, FileMode.Create))
+ {
+ xdoc.Save(fs);
+ }
+ }
+
+ private static void RemoveCrossgenTarget(string csproj)
+ {
+ var xdoc = XDocument.Load(csproj);
+ var ns = xdoc.Root.GetDefaultNamespace();
+ var target = xdoc.Root.Element(ns + "Target");
+ target.Remove();
+ using (var fs = new FileStream(csproj, FileMode.Create))
+ {
+ xdoc.Save(fs);
+ }
+ }
+
+ private static void addMeasurement(ref ScenarioBenchmark scenario, string name, MetricModel metric, double value)
+ {
+ var iteration = new IterationModel
+ {
+ Iteration = new Dictionary<string, double>()
+ };
+ iteration.Iteration.Add(metric.Name, value);
+
+ var size = new ScenarioTestModel(name);
+ size.Performance.Metrics.Add(metric);
+ size.Performance.IterationModels.Add(iteration);
+ scenario.Tests.Add(size);
+ }
+ }
+}
diff --git a/tests/src/performance/linkbench/linkbench.csproj b/tests/src/performance/linkbench/linkbench.csproj
new file mode 100644
index 0000000000..2a3048ab21
--- /dev/null
+++ b/tests/src/performance/linkbench/linkbench.csproj
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <AssemblyName>LinkBench</AssemblyName>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{507E3CC2-5D95-414D-9F01-2A106FC177DC}</ProjectGuid>
+ <OutputType>exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+ <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
+ <DefineConstants>$(DefineConstants);STATIC</DefineConstants>
+ <NuGetTargetMoniker>.NETStandard,Version=v1.4</NuGetTargetMoniker>
+ </PropertyGroup>
+ <!-- Default configurations to help VS understand the configurations -->
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
+ </PropertyGroup>
+ <PropertyGroup>
+ <ProjectJson>..\project.json</ProjectJson>
+ <ProjectLockJson>..\project.lock.json</ProjectLockJson>
+ </PropertyGroup>
+ <ItemGroup>
+ <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
+ <Visible>False</Visible>
+ </CodeAnalysisDependentAssemblyPaths>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="linkbench.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), performance.targets))\performance.targets" />
+</Project>
diff --git a/tests/src/performance/linkbench/scripts/build.cmd b/tests/src/performance/linkbench/scripts/build.cmd
new file mode 100644
index 0000000000..88b7eb139e
--- /dev/null
+++ b/tests/src/performance/linkbench/scripts/build.cmd
@@ -0,0 +1,116 @@
+@echo off
+
+REM Usage: Build.cmd <LinkBench assets directory>
+setlocal
+call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\VsDevCmd.bat"
+
+set ROOT=%cd%\LinkBench
+set AssetDir=%1
+set ExitCode=0
+mkdir LinkBench 2> nul
+pushd %ROOT%
+
+echo Build ** HelloWorld **
+cd %ROOT%\HelloWorld
+dotnet restore -r win10-x64
+dotnet publish -c release -r win10-x64
+dotnet msbuild /t:Link /p:LinkerMode=sdk /p:RuntimeIdentifier=win10-x64 /v:n /p:Configuration=release
+if errorlevel 1 set ExitCode=1
+echo -- Done --
+
+echo Build ** WebAPI **
+cd %ROOT%\WebAPI
+dotnet restore -r win10-x64
+dotnet publish -c release -r win10-x64
+dotnet msbuild /t:Link /p:LinkerMode=sdk /p:RuntimeIdentifier=win10-x64 /v:n /p:Configuration=release
+if errorlevel 1 set ExitCode=1
+echo -- Done --
+
+echo Build ** MusicStore **
+cd %ROOT%\JitBench\src\MusicStore
+copy %AssetDir%\MusicStore\MusicStoreReflection.xml .
+dotnet restore -r win10-x64
+dotnet publish -c release -r win10-x64
+dotnet msbuild /t:Link /p:LinkerMode=sdk /p:RuntimeIdentifier=win10-x64 /v:n /p:LinkerRootFiles=MusicStoreReflection.xml /p:Configuration=release
+if errorlevel 1 set ExitCode=1
+echo -- Done --
+
+echo Build ** MusicStore Ready2Run **
+cd %ROOT%\JitBench\src\MusicStore
+powershell -noprofile -executionPolicy RemoteSigned -file Get-Crossgen.ps1
+pushd bin\release\netcoreapp2.0\win10-x64\
+call :SetupR2R publish
+if errorlevel 1 set ExitCode=1
+call :SetupR2R linked
+if errorlevel 1 set ExitCode=1
+echo -- Done --
+
+echo Build ** CoreFX **
+cd %ROOT%\corefx
+set BinPlaceILLinkTrimAssembly=true
+call build.cmd -release
+if errorlevel 1 set ExitCode=1
+echo -- Done --
+
+echo Build ** Roslyn **
+cd %ROOT%\roslyn
+copy %AssetDir%\Roslyn\RoslynRoots.txt .
+copy %AssetDir%\Roslyn\RoslynRoots.xml .
+set RoslynRoot=%cd%
+REM Build Roslyn
+call restore.cmd
+msbuild /m Roslyn.sln /p:Configuration=Release
+REM Fetch ILLink
+mkdir illink
+cd illink
+copy %AssetDir%\Roslyn\illinkcsproj illink.csproj
+dotnet restore illink.csproj -r win10-x64 --packages bin
+cd ..
+REM Create Linker Directory
+cd Binaries\Release\Exes
+mkdir Linked
+cd CscCore
+REM Copy Unmanaged Assets
+FOR /F "delims=" %%I IN ('DIR /b *') DO (
+ corflags %%I >nul 2> nul
+ if errorlevel 1 copy %%I ..\Linked >nul
+)
+copy *.ni.dll ..\Linked
+REM Run Linker
+dotnet %RoslynRoot%\illink\bin\illink.tasks\0.1.0-preview\tools\illink.dll -t -c link -a @%RoslynRoot%\RoslynRoots.txt -x %RoslynRoot%\RoslynRoots.xml -l none -out ..\Linked
+if errorlevel 1 set ExitCode=1
+echo -- Done --
+popd
+
+:Done
+exit /b %ExitCode%
+
+:SetupR2R
+REM Create R2R directory and copy all contents from MSIL to R2R directory
+mkdir %1_r2r
+xcopy /E /Y /Q %1 %1_r2r
+REM Generate Ready2Run images for all MSIL files by running crossgen
+cd %1_r2r
+copy ..\..\..\..\..\crossgen.exe
+FOR /F %%I IN ('dir /b *.dll ^| find /V /I ".ni.dll" ^| find /V /I "System.Private.CoreLib" ^| find /V /I "mscorlib.dll"') DO (
+ REM Don't crossgen Corlib, since the native image already exists.
+ REM For all other MSIL files (corflags returns 0), run crossgen
+ corflags %%I >nul 2>nul
+ if not errorlevel 1 (
+ crossgen /Platform_Assemblies_Paths . %%I >nul 2>nul
+ if errorlevel 1 (
+ exit /b 1
+ )
+ )
+)
+del crossgen.exe
+
+REM Remove the original MSIL files, rename the Ready2Run files .ni.dll --> .dll
+FOR /F "delims=" %%I IN ('dir /b *.dll') DO (
+ if exist %%~nI.ni.dll (
+ del %%I
+ ren %%~nI.ni.dll %%I
+ )
+)
+cd ..
+exit /b 0
diff --git a/tests/src/performance/linkbench/scripts/clone.cmd b/tests/src/performance/linkbench/scripts/clone.cmd
new file mode 100644
index 0000000000..ae28d41d08
--- /dev/null
+++ b/tests/src/performance/linkbench/scripts/clone.cmd
@@ -0,0 +1,30 @@
+@echo off
+
+rmdir /s /q LinkBench
+
+set ROOT=%cd%\LinkBench
+mkdir LinkBench 2> nul
+pushd %ROOT%
+
+mkdir HelloWorld
+cd HelloWorld
+dotnet new console
+if errorlevel 1 exit /b 1
+cd ..
+
+mkdir WebAPI
+cd WebAPI
+dotnet new webapi
+if errorlevel 1 exit /b 1
+cd ..
+
+git clone https://github.com/aspnet/JitBench -b dev
+if errorlevel 1 exit /b 1
+
+git clone http://github.com/dotnet/corefx
+if errorlevel 1 exit /b 1
+
+git clone https://github.com/dotnet/roslyn.git
+if errorlevel 1 exit /b 1
+
+popd \ No newline at end of file
diff --git a/tests/src/performance/linkbench/scripts/empty.cmd b/tests/src/performance/linkbench/scripts/empty.cmd
new file mode 100644
index 0000000000..83cb140ebd
--- /dev/null
+++ b/tests/src/performance/linkbench/scripts/empty.cmd
@@ -0,0 +1 @@
+@echo off
diff --git a/tests/src/performance/linkbench/scripts/getcert.cmd b/tests/src/performance/linkbench/scripts/getcert.cmd
new file mode 100644
index 0000000000..e02f72d714
--- /dev/null
+++ b/tests/src/performance/linkbench/scripts/getcert.cmd
@@ -0,0 +1,2 @@
+@echo off
+"%VS140COMNTOOLS%\..\..\VC\bin\amd64\dumpbin.exe" /headers %1 | findstr /C:"Certificates Directory
diff --git a/tests/src/performance/project.json b/tests/src/performance/project.json
index 1d0eb6d538..86a42f2df7 100644
--- a/tests/src/performance/project.json
+++ b/tests/src/performance/project.json
@@ -1,22 +1,23 @@
{
"dependencies": {
- "xunit.performance.api": "1.0.0-alpha-build0049",
- "xunit.performance.core": "1.0.0-alpha-build0049",
- "xunit.performance.execution": "1.0.0-alpha-build0049",
- "xunit.performance.metrics": "1.0.0-alpha-build0049",
+ "xunit.performance.api": "1.0.0-beta-build0003",
+ "xunit.performance.core": "1.0.0-beta-build0003",
+ "xunit.performance.execution": "1.0.0-beta-build0003",
+ "xunit.performance.metrics": "1.0.0-beta-build0003",
"Microsoft.Diagnostics.Tracing.TraceEvent": "1.0.3-alpha-experimental",
- "Microsoft.NETCore.Platforms": "2.0.0-preview1-25210-01",
+ "Microsoft.NETCore.Platforms": "2.0.0-preview1-25221-01",
"System.Collections.NonGeneric": "4.4.0-beta-24913-02",
"System.Console": "4.4.0-beta-24913-02",
"System.IO.FileSystem": "4.4.0-beta-24913-02",
"System.Linq": "4.4.0-beta-24913-02",
"System.Linq.Expressions": "4.4.0-beta-24913-02",
- "System.Numerics.Vectors": "4.4.0-preview1-25210-01",
+ "System.Numerics.Vectors": "4.4.0-preview1-25221-01",
"System.Reflection": "4.4.0-beta-24913-02",
"System.Reflection.Extensions": "4.4.0-beta-24913-02",
- "System.Reflection.TypeExtensions": "4.4.0-preview1-25210-01",
+ "System.Reflection.TypeExtensions": "4.4.0-preview1-25221-01",
"System.Runtime": "4.4.0-beta-24913-02",
"System.Runtime.Extensions": "4.4.0-beta-24913-02",
+ "System.Runtime.Loader": "4.0.0",
"System.Runtime.Numerics": "4.4.0-beta-24913-02",
"System.Text.RegularExpressions": "4.4.0-beta-24913-02",
"System.Threading": "4.4.0-beta-24913-02",
@@ -31,7 +32,7 @@
"xunit.runner.utility": "2.2.0-beta2-build3300"
},
"frameworks": {
- "netstandard1.4": {
+ "netstandard1.5": {
"imports": [
"dnxcore50",
"portable-net45+win8"
diff --git a/tests/src/readytorun/fieldgetter.il b/tests/src/readytorun/tests/fieldgetter.il
index c2eff200af..c2eff200af 100644
--- a/tests/src/readytorun/fieldgetter.il
+++ b/tests/src/readytorun/tests/fieldgetter.il
diff --git a/tests/src/readytorun/fieldgetter.ilproj b/tests/src/readytorun/tests/fieldgetter.ilproj
index b3f2aa9e13..b3f2aa9e13 100644
--- a/tests/src/readytorun/fieldgetter.ilproj
+++ b/tests/src/readytorun/tests/fieldgetter.ilproj
diff --git a/tests/src/readytorun/generics.cs b/tests/src/readytorun/tests/generics.cs
index 4c41756305..4c41756305 100644
--- a/tests/src/readytorun/generics.cs
+++ b/tests/src/readytorun/tests/generics.cs
diff --git a/tests/src/readytorun/generics.csproj b/tests/src/readytorun/tests/generics.csproj
index 4ea64b30d6..4ea64b30d6 100644
--- a/tests/src/readytorun/generics.csproj
+++ b/tests/src/readytorun/tests/generics.csproj
diff --git a/tests/src/readytorun/genericsload/callgenericctor.cs b/tests/src/readytorun/tests/genericsload/callgenericctor.cs
index 05e16afb3b..05e16afb3b 100644
--- a/tests/src/readytorun/genericsload/callgenericctor.cs
+++ b/tests/src/readytorun/tests/genericsload/callgenericctor.cs
diff --git a/tests/src/readytorun/genericsload/callgenericctor.csproj b/tests/src/readytorun/tests/genericsload/callgenericctor.csproj
index 0f73092f43..0f73092f43 100644
--- a/tests/src/readytorun/genericsload/callgenericctor.csproj
+++ b/tests/src/readytorun/tests/genericsload/callgenericctor.csproj
diff --git a/tests/src/readytorun/genericsload/genericslib.il b/tests/src/readytorun/tests/genericsload/genericslib.il
index fdc2f408a3..fdc2f408a3 100644
--- a/tests/src/readytorun/genericsload/genericslib.il
+++ b/tests/src/readytorun/tests/genericsload/genericslib.il
diff --git a/tests/src/readytorun/genericsload/genericslib.ilproj b/tests/src/readytorun/tests/genericsload/genericslib.ilproj
index 04548543af..04548543af 100644
--- a/tests/src/readytorun/genericsload/genericslib.ilproj
+++ b/tests/src/readytorun/tests/genericsload/genericslib.ilproj
diff --git a/tests/src/readytorun/genericsload/usegenericfield.cs b/tests/src/readytorun/tests/genericsload/usegenericfield.cs
index 770334c6cf..770334c6cf 100644
--- a/tests/src/readytorun/genericsload/usegenericfield.cs
+++ b/tests/src/readytorun/tests/genericsload/usegenericfield.cs
diff --git a/tests/src/readytorun/genericsload/usegenericfield.csproj b/tests/src/readytorun/tests/genericsload/usegenericfield.csproj
index 6b9e15a733..6b9e15a733 100644
--- a/tests/src/readytorun/genericsload/usegenericfield.csproj
+++ b/tests/src/readytorun/tests/genericsload/usegenericfield.csproj
diff --git a/tests/src/readytorun/main.cs b/tests/src/readytorun/tests/main.cs
index 783c1fd3cb..783c1fd3cb 100644
--- a/tests/src/readytorun/main.cs
+++ b/tests/src/readytorun/tests/main.cs
diff --git a/tests/src/readytorun/mainv1.csproj b/tests/src/readytorun/tests/mainv1.csproj
index cca0b4106b..cca0b4106b 100644
--- a/tests/src/readytorun/mainv1.csproj
+++ b/tests/src/readytorun/tests/mainv1.csproj
diff --git a/tests/src/readytorun/mainv2.csproj b/tests/src/readytorun/tests/mainv2.csproj
index acf898e7f9..acf898e7f9 100644
--- a/tests/src/readytorun/mainv2.csproj
+++ b/tests/src/readytorun/tests/mainv2.csproj
diff --git a/tests/src/readytorun/test.cs b/tests/src/readytorun/tests/test.cs
index 8a6beaea15..8a6beaea15 100644
--- a/tests/src/readytorun/test.cs
+++ b/tests/src/readytorun/tests/test.cs
diff --git a/tests/src/readytorun/testv1/test.csproj b/tests/src/readytorun/tests/testv1/test.csproj
index c56c53cad9..c56c53cad9 100644
--- a/tests/src/readytorun/testv1/test.csproj
+++ b/tests/src/readytorun/tests/testv1/test.csproj
diff --git a/tests/src/readytorun/testv2/test.csproj b/tests/src/readytorun/tests/testv2/test.csproj
index 058a0d6346..058a0d6346 100644
--- a/tests/src/readytorun/testv2/test.csproj
+++ b/tests/src/readytorun/tests/testv2/test.csproj
diff --git a/tests/testsFailingOutsideWindows.txt b/tests/testsFailingOutsideWindows.txt
index 809433c0ac..5829a8f36c 100644
--- a/tests/testsFailingOutsideWindows.txt
+++ b/tests/testsFailingOutsideWindows.txt
@@ -70,7 +70,6 @@ GC/Features/BackgroundGC/foregroundgc/foregroundgc.sh
GC/Features/LOHFragmentation/lohfragmentation/lohfragmentation.sh
GC/Features/SustainedLowLatency/scenario/scenario.sh
GC/Regressions/dev10bugs/536168/536168/536168.sh
-GC/Stress/Framework/ReliabilityFramework/ReliabilityFramework.sh
GC/Scenarios/DoublinkList/doublinkgen/doublinkgen.sh
Loader/classloader/TypeGeneratorTests/TypeGeneratorTest612/Generated612/Generated612.sh
Loader/classloader/TypeGeneratorTests/TypeGeneratorTest613/Generated613/Generated613.sh
diff --git a/tests/testsUnsupportedOutsideWindows.txt b/tests/testsUnsupportedOutsideWindows.txt
index ef43049316..9983cc0cee 100644
--- a/tests/testsUnsupportedOutsideWindows.txt
+++ b/tests/testsUnsupportedOutsideWindows.txt
@@ -315,6 +315,7 @@ JIT/Methodical/tailcall/_il_dbgpointer/_il_dbgpointer.sh
JIT/Methodical/tailcall/_il_dbgpointer_i/_il_dbgpointer_i.sh
JIT/Methodical/tailcall/_il_relpointer/_il_relpointer.sh
JIT/Methodical/tailcall/_il_relpointer_i/_il_relpointer_i.sh
+JIT/Methodical/tailcall_v4/smallFrame/smallFrame.sh
JIT/Methodical/varargs/callconv/gc_ctor_il_d/gc_ctor_il_d.sh
JIT/Methodical/varargs/callconv/gc_ctor_il_r/gc_ctor_il_r.sh
JIT/Methodical/varargs/callconv/val_ctor_il_d/val_ctor_il_d.sh
@@ -326,6 +327,7 @@ JIT/Methodical/varargs/seh/filter_il_d/filter_il_d.sh
JIT/Methodical/varargs/seh/filter_il_r/filter_il_r.sh
JIT/opt/Inline/tests/security/security.sh
JIT/opt/Inline/tests/xmodb/xmodb.sh
+JIT/opt/Tailcall/TailcallVerifyWithPrefix/TailcallVerifyWithPrefix.sh
JIT/Regression/clr-x64-JIT/v2.1/b173569/b173569/b173569.sh
JIT/Regression/clr-x64-JIT/v4.0/devdiv374539/DevDiv_374539/DevDiv_374539.sh
JIT/Regression/CLR-x86-EJIT/V1-M12-Beta2/b26323/b26323/b26323.sh
diff --git a/tests/x86_jit32_issues.targets b/tests/x86_jit32_issues.targets
index 04960ea6bf..7a6983db26 100644
--- a/tests/x86_jit32_issues.targets
+++ b/tests/x86_jit32_issues.targets
@@ -130,9 +130,6 @@
<ExcludeList Include="$(XunitTestBinBase)\JIT\Generics\Coverage\chaos65204782cs_o\chaos65204782cs_o.cmd">
<Issue>6714</Issue>
</ExcludeList>
- <ExcludeList Include="$(XunitTestBinBase)\JIT\jit64\gc\regress\vswhidbey\143837\143837.cmd">
- <Issue>6718</Issue>
- </ExcludeList>
<ExcludeList Include="$(XunitTestBinBase)\JIT\jit64\localloc\verify\verify01_dynamic\verify01_dynamic.cmd">
<Issue>2414</Issue>
</ExcludeList>
@@ -337,9 +334,6 @@
<ExcludeList Include="$(XunitTestBinBase)\JIT\SIMD\CircleInConvex_ro\CircleInConvex_ro.cmd">
<Issue>needs triage</Issue>
</ExcludeList>
- <ExcludeList Include="$(XunitTestBinBase)\Loader\classloader\methodoverriding\regressions\549411\exploit\exploit.cmd">
- <Issue>6717</Issue>
- </ExcludeList>
<ExcludeList Include="$(XunitTestBinBase)\Loader\classloader\TSAmbiguities\CollapsedInterfaces\HelloWorld\HelloWorld.cmd">
<Issue>6714</Issue>
</ExcludeList>