Giter VIP home page Giter VIP logo

chocoforth's Introduction

LiSP の息抜きにちょっこと Forth でも作ってみる。

Direct threaded code
64bit Linux

もとは jonesforth です。
http://annexia.org/forth


(gdb) p/x *(long*)(var_latest)@10
$3 = {0x401188, 0x455552540420, 0xd7ff419090909090, 0x400828, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0}


p *(char*)($rdi)@$rcx
p/x *(char*)($rdi-24)@24

%rax Return value
%rbx Callee saved
%rcx 4th argument
%rdx 3rd argument
%rsi 2nd argument
%rdi 1st argument
%rbp Callee saved
%rsp Stack pointer
%r8  5th argument
%r9  6th argument
%r10 Callee saved
%r11 Used for linking
%r12 Unused for C
%r13 Callee saved
%r14 Callee saved
%r15 Callee saved


<<Direct Threaded Code>>
mov      r15,     _ENTER

_ENTER:
        PUSHRSP rsi
        pop     rsi
        NEXT

DOUBLE:
        nop
        nop
        nop
        nop
        nop
        call    r15
.code:
        DUP
        PLUS
        EXIT
DUP:
        mov     rax,    rsp
        push    rax
        NEXT
EXIT:
        POPRSP  rsi
        NEXT

<<Indirect Threaded Code>>
DOUBLE:
        DOCOL                   ; codeword
        DUP
        PLUS
        EXIT
DUP:
        DUP_code                ; codeword
DUP_code:
        mov     rax,    rsp
        push    rax
        NEXT
EXIT:
        EXIT_code               ; codeword
EXIT_code:
        POPRSP  rsi
        NEXT
DOCOL:
        PUSHRSP rsi
        add     rax,    CELLL
        mov     rsi,    rax
        NEXT


chocoforth's People

Contributors

quek avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.