1. <strong id="7actg"></strong>
    2. <table id="7actg"></table>

    3. <address id="7actg"></address>
      <address id="7actg"></address>
      1. <object id="7actg"><tt id="7actg"></tt></object>

        AsmJitC/C++ 編譯器

        聯(lián)合創(chuàng)作 · 2023-10-01 11:12

        AsmJit 是一個完整的 JIT(Just-In-Time,運行時刻)的針對 C++ 語言的匯編器,可以生成兼容 x86 和 x64 架構(gòu)的原生代碼,不僅支持整個 x86/x64 的指令集(包括傳統(tǒng)的 MMX 和最新的 AVX2 指令集),而且提供了一套可以在編譯時刻進(jìn)行語義檢查的 API。

        AsmJit 的使用也沒有任何的限制,適用于多媒體,虛擬機的后端,遠(yuǎn)程代碼生成等等。

        特性

        • 完全支持 x86/x64 指令集(包括 MMX,SSEx,AVX1/2,BMI,XOP,F(xiàn)MA3 和 FMA4)

        • 底層次和高層次的代碼生成概念

        • 內(nèi)置檢測處理器特性功能

        • 實現(xiàn)虛擬內(nèi)存的管理,類似于 malloc 和 free

        • 強大的日志記錄和錯誤處理能力

        • 體積小,可直接嵌入項目,編譯后的體積在150至200kb之間

        • 獨立性強,不需要依賴其他任何的庫(包括 STL 和 RTTI ) 

        環(huán)境

        1.  操作系統(tǒng)

        • BSD系列

        • Linux

        • Mac

        • Windows

        2.  C++編譯器

        • Borland C++

        • Clang

        • GCC

        • MinGW

        • MSVC

        • 其他的在”build.h”中文件中定義過的編譯器

        3.  后端

        • X86

        • X64

        軟件簡介引自:http://www.cnblogs.com/lanrenxinxin/p/5021641.html

        // Create simple DWORD memory copy function for 32 bit x86 platform:
        // (for AsmJit version 0.8+)
        //
        // void ASMJIT_CDECL memcpy32(UInt32* dst, const UInt32* src, SysUInt len);
        
        // AsmJit library
        #include <AsmJit/AsmJitAssembler.h>
        #include <AsmJit/AsmJitVM.h>
        
        // C library - printf
        #include <stdio.h>
        
        using namespace AsmJit;
        
        // This is type of function we will generate 
        typedef void (*MemCpy32Fn)(UInt32*, const UInt32*, SysUInt);
        
        int main(int argc, char* argv[])
        {
          // ==========================================================================
          // Part 1:
        
          // Create Assembler
          Assembler a;
          
          // Constants
          const int arg_offset = 8; // Arguments offset (STDCALL EBP)
          const int arg_size = 12;  // Arguments size
          
          // Labels
          Label L_Loop;
          Label L_Exit;
          
          // Prolog
          a.push(ebp);
          a.mov(ebp, esp);
          a.push(esi);
          a.push(edi);
          
          // Fetch arguments
          a.mov(edi, dword_ptr(ebp, arg_offset + 0)); // get dst
          a.mov(esi, dword_ptr(ebp, arg_offset + 4)); // get src
          
          a.mov(ecx, dword_ptr(ebp, arg_offset + 8)); // get len
          // exit if length is zero
          a.jz(&L_Exit);
          
          // Bind L_Loop label to here
          a.bind(&L_Loop);
          
          a.mov(eax, dword_ptr(esi));
          a.mov(dword_ptr(edi), eax);
          
          a.add(esi, 4);
          a.add(edi, 4);
          
          // Loop until ecx is not zero
          a.dec(ecx);
          a.jnz(&L_Loop);
          
          // Exit
          a.bind(&L_Exit);
          
          // Epilog
          a.pop(edi);
          a.pop(esi);
          a.mov(esp, ebp);
          a.pop(ebp);
        
          // Return  
          a.ret();
          // ==========================================================================
        
          // ==========================================================================
          // Part 2:
        
          // Make JIT function
          MemCpy32Fn fn = function_cast<MemCpy32Fn>(a.make());
        
          // Ensure that everything is ok
          if (!fn)
          {
            printf("Error making jit function (%u).\n", a.error());
            return 1;
          }
        
          // Create some data
          UInt32 dst[128];
          UInt32 src[128];
          
          // Call JIT function
          fn(dst, src, 128);
          
          // If you don't need the function anymore, it should be freed
          MemoryManager::global()->free((void*)fn);
          // ==========================================================================
        
          return 0;
        }
        瀏覽 21
        點贊
        評論
        收藏
        分享

        手機掃一掃分享

        編輯 分享
        舉報
        評論
        圖片
        表情
        推薦
        點贊
        評論
        收藏
        分享

        手機掃一掃分享

        編輯 分享
        舉報
        1. <strong id="7actg"></strong>
        2. <table id="7actg"></table>

        3. <address id="7actg"></address>
          <address id="7actg"></address>
          1. <object id="7actg"><tt id="7actg"></tt></object>
            免费操屄视频 | 国产乱人乱偷精品视频a人人澡 | 中文字幕人妻一区二区三区在线视频 | 天天操,天天日,天天干 | 九九色影院 | 蜜芽tv跳转接口点击进入 | 国产亲子伦视频一区二区3区 | 久久夜色精品国产欧美乱 | 午夜看逼| 粉嫩一区二区三区 |