On Tue, Feb 13, 2024 at 08:38:49AM +0100, Tomas Hlavaty wrote:
> Hi,
> 
> the manual describes Dynamic Superinstructions
> 
>    (info "(gforth) Dynamic Superinstructions")
> 
> but I cannot make this work.

You don't see the effect of dynamic superinstructions with SEE, which
tries to produce a result that's close to the source code.  Use
SEE-CODE to see the result of dynamic native-code generations:

gforth-fast -e ": sq dup * ; see-code sq bye"

$7F74F59878C8 dup    1->2 
7F74F562C1B2:   mov     r15,r8
$7F74F59878D0 *    2->1 
7F74F562C1B5:   imul    r8,r15
$7F74F59878D8 ;s    1->1 
7F74F562C1B9:   mov     rbx,[r14]
7F74F562C1BC:   add     r14,$08
7F74F562C1C0:   mov     rax,[rbx]
7F74F562C1C3:   jmp     eax

The output from 0.7.9_20230601 looks a little worse, but that's
besides the point.  Without dynamic native-code generation, you see:

gforth-fast --no-dynamic -e ": sq dup * ; see-code sq bye"

$7FE2570C28C8 dup
$7FE2570C28D0 *
$7FE2570C28D8 ;s

For interpreting the output of SEE-CODE, see
<https://gforth.org/manual/Examining-compiled-code.html> (or type HELP
SEE-CODE in Gforth and scroll down).

- anton

Reply via email to