[RISC-V] ELT Profiler Bring-Up (#91313)
authorTomasz Sowiński <tomeksowi@gmail.com>
Tue, 5 Sep 2023 20:21:55 +0000 (22:21 +0200)
committerGleb Balykov <g.balykov@samsung.com>
Fri, 15 Dec 2023 12:28:32 +0000 (15:28 +0300)
commit0acff6fa7de0725affd2fa9349299b7656d1b7b5
tree67304d15e396e3c98844ffbc66dee71df70b1da3
parentdcf29169bde1fac4cea638c0eb5e5ce2469947d0
[RISC-V] ELT Profiler Bring-Up (#91313)

* [RISC-V] Generate profiling function callbacks

Initial implementation based on ARM64 code.

* [RISC-V] Fix asm stub for calling profiler callbacks

* Fix argument registers according to RISC-V calling convention
* Fix field offsets for PROFILE_PLATFORM_SPECIFIC_DATA
* Make sure field offsets for PROFILE_PLATFORM_SPECIFIC_DATA stay fixed by static asserting the offsets in asmconstants.h

* [RISC-V] Pass arguments for Profile(Enter|Leave|Tailcall)Naked stubs in t0 and t1 because t2 is used to store the call address of the stub

* [RISC-V] Remove unimplemented definition of EmitRet

* [RISC-V] Copy struct from registers into a buffer so that profiler can see whole struct arguments laid out in memory

* [RISC-V] Implement ProfileArgIterator::GetReturnBufferAddr()

Since the RISC-V ABI says values are returned like the first named argument, re-use the struct copying routine from argument parsing as much as possible.

* Factor out duplicated test results checking routine in SlowPathELTProfiler::Shutdown()

* [RISC-V] Clean up PROFILE_PLATFORM_SPECIFIC_DATA

* Remove unused t0 field
* Remove 'unused' field and widen 'flags' to 64 bits to maintain alignment and shave off one sw instruction

* [RISC-V] Remove commented out code

* [RISC-V] Fix formatting

* [RISC-V] Apply format patch from failed check

* [RISC-V] Post-review fixes
src/coreclr/jit/codegenriscv64.cpp
src/coreclr/jit/targetriscv64.h
src/coreclr/vm/proftoeeinterfaceimpl.h
src/coreclr/vm/riscv64/asmconstants.h
src/coreclr/vm/riscv64/asmhelpers.S
src/coreclr/vm/riscv64/cgencpu.h
src/coreclr/vm/riscv64/profiler.cpp
src/tests/profiler/native/eltprofiler/slowpatheltprofiler.cpp