Re: Phix: cffi.e

new topic     » goto parent     » topic index » view thread      » older message » newer message

Hallo

I have experimented with a programming language called Julia. The language has a function/macro that outputs the generated assembler code of a function.

I can't really do anything with it, but maybe it helps anyway.

An example of how it works can be found here
https://github.com/andizk4kx/raylib-playground/tree/main/raylib_julia
(filename: nativecode.jl)

The result looks like this, for example:

       .text 
        .file   "DrawCircleV" 
        .globl  julia_DrawCircleV_667           # -- Begin function julia_DrawCircleV_667 
        .p2align        4, 0x90 
        .type   julia_DrawCircleV_667,@function 
julia_DrawCircleV_667:                  # @julia_DrawCircleV_667 
; Function Signature: DrawCircleV(Main.Vector2, Float64, Main.Color) 
; ┌ @ D:\devpool\projects\raylib-playground\raylib_julia\raylib.jl:1646 within `DrawCircleV` 
        .cfi_startproc 
# %bb.0:                                # %top 
; │ @ D:\devpool\projects\raylib-playground\raylib_julia\raylib.jl within `DrawCircleV` 
        #DEBUG_VALUE: DrawCircleV:center <- [DW_OP_deref] $rcx 
        #DEBUG_VALUE: DrawCircleV:radius <- $xmm1 
        #DEBUG_VALUE: DrawCircleV:color <- [DW_OP_deref] $r8 
        #DEBUG_VALUE: DrawCircleV:color <- [DW_OP_deref] 0 
        #DEBUG_VALUE: DrawCircleV:center <- [DW_OP_deref] 0 
        push    rbp 
        .cfi_def_cfa_offset 16 
        .cfi_offset rbp, -16 
        mov     rbp, rsp 
        .cfi_def_cfa_register rbp 
        sub     rsp, 32 
; │ @ D:\devpool\projects\raylib-playground\raylib_julia\raylib.jl:1647 within `DrawCircleV` 
        mov     rcx, qword ptr [rcx] 
        mov     r8d, dword ptr [r8] 
; │┌ @ essentials.jl:687 within `cconvert` 
; ││┌ @ number.jl:7 within `convert` 
; │││┌ @ float.jl:338 within `Float32` 
        vcvtsd2ss       xmm1, xmm1, xmm1 
; │└└└ 
        movabs  rax, offset .Ljlplt_DrawCircleV_673_got.jit 
        call    rax 
        add     rsp, 32 
        pop     rbp 
        ret 
.Lfunc_end0: 
        .size   julia_DrawCircleV_667, .Lfunc_end0-julia_DrawCircleV_667 
        .cfi_endproc 
; └ 
                                        # -- End function 
.set .Ljlplt_DrawCircleV_673_got.jit, 140733995387694 
        .size   .Ljlplt_DrawCircleV_673_got.jit, 8 
        .section        ".note.GNU-stack","",@progbits 
 

Andreas

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu