2

.NET7 for LoongArch64(国产龙芯)

 1 year ago
source link: https://www.cnblogs.com/tangyanzhi1111/p/17485456.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

.NET7 for LoongArch64(国产龙芯)

目前龙芯通过自己的指令集LA64支持了.Net7.0.1版本,一同被支持的有Ruby,Nodejs,Java,Electron,Python等。原文:在此处

龙芯.Net7 sdk下载地址:
http://ftp.loongnix.cn/tmp/dotnet/7.0.5/7.0.5-ea1/dotnet-sdk-7.0.105-ea1-loongarch64.tar.xz

在.Net8里面也可见支持LA64的代码,下面列举下
1.返回函数头地址

#if !defined(TARGET_X86) && !defined(TARGET_ARM64) && !defined(TARGET_LOONGARCH64) && !defined(TARGET_RISCV64)
    if (hasRetBuffArg)
    {
        return GetEEFuncEntryPoint(VarargPInvokeStub_RetBuffArg);
    }

2.结构参数使用浮点寄存器

uint32_t CEEInfo::getLoongArch64PassStructInRegisterFlags(CORINFO_CLASS_HANDLE cls)
{
#if defined(TARGET_LOONGARCH64)
    size = (uint32_t)MethodTable::GetLoongArch64PassStructInRegisterFlags(cls);
#endif
    return size;
}

3.JIT传入四字节的展开数据块

#elif defined(TARGET_LOONGARCH64)
    _ASSERTE(IS_ALIGNED(unwindSize, sizeof(ULONG)));
ace for personality routine, it must be 4-byte aligned.
    unwindSize += sizeof(ULONG);

4.JIT64位的一个兼容性,这里除了LA64还有Risc-v

#if defined(TARGET_AMD64) || defined(TARGET_ARM64) || defined(TARGET_LOONGARCH64) || defined(TARGET_RISCV64)

5.
龙芯的SDK需要在支持龙芯指令集的机器上执行,但是也可以虚拟一个龙芯指令集的机子,然后在上面模拟执行。参照之前的文章:龙芯(Loongarch64),在Linux虚拟一个龙芯OS体验下

龙芯.NET团队为了更好的支持LoongArch64架构特点,对整个后端指令构建系统进行了创新重构设计,同时,也从字节码加载、JIT语法树、ABI规范、函数栈帧设计、GC、异常处理等重要模块,都做了适应LoongArch架构特点的优化,也为后续龙芯后续深度参与社区打好基础。

作者:江湖评谈

欢迎关注我的公众号:jianghupt。顶级技术分享,文章首发。

image

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK