Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RISC-V] Implement ThisPtrRetBufPrecode::Init #91451

Merged
merged 1 commit into from
Sep 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/coreclr/vm/riscv64/cgencpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ struct HijackArgs
// Precode to shuffle this and retbuf for closed delegates over static methods with return buffer
struct ThisPtrRetBufPrecode {

static const int Type = 0x2;
static const int Type = 0x93;

UINT32 m_rgCode[6];
TADDR m_pTarget;
Expand Down
18 changes: 17 additions & 1 deletion src/coreclr/vm/riscv64/stubs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,23 @@ void HelperMethodFrame::UpdateRegDisplay(const PREGDISPLAY pRD)
#ifndef DACCESS_COMPILE
void ThisPtrRetBufPrecode::Init(MethodDesc* pMD, LoaderAllocator *pLoaderAllocator)
{
_ASSERTE(!"RISCV64: not implementation on riscv64!!!");
WRAPPER_NO_CONTRACT;

//Initially
//a0 -This ptr
//a1 -ReturnBuffer
m_rgCode[0] = 0x00050f93; // addi t6, a0, 0x0
m_rgCode[1] = 0x00058513; // addi a0, a1, 0x0
m_rgCode[2] = 0x000f8593; // addi a1, t6, 0x0
m_rgCode[3] = 0x00000f97; // auipc t6, 0
m_rgCode[4] = 0x00cfbf83; // ld t6, 12(t6)
m_rgCode[5] = 0x000f8067; // jalr x0, 0(t6)

_ASSERTE((UINT32*)&m_pTarget == &m_rgCode[6]);
_ASSERTE(6 == ARRAY_SIZE(m_rgCode));

m_pTarget = GetPreStubEntryPoint();
m_pMethodDesc = (TADDR)pMD;
}

#endif // !DACCESS_COMPILE
Expand Down
Loading