Front Page All Articles Recent Changes Random Article

Contents

Concatenative language

  • ACL
  • Ait
  • Aocla
  • Breeze
  • Cat
  • Cognate
  • colorForth
  • CoSy
  • Deque
  • Elymas
  • Enchilada
  • ETAC
  • F
  • Factor
  • Forth
  • Freelang
  • Gershwin
  • Joy
  • Kitten
  • lang5
  • Lviv
  • min
  • mjoy
  • Mlatu
  • Ode
  • Om
  • Onyx
  • Plorth
  • Popr
  • Porth
  • PostScript
  • Quackery
  • r3
  • Raven
  • Retro
  • Staapl
  • Stabel
  • Trith
  • Worst
  • xs
  • XY
  • 5th
  • 8th

Other languages

  • APL
  • C++
  • Erlang
  • FP trivia
  • Haskell
  • Io
  • Java
  • JavaScript
  • Lisp
  • ML
  • Oberon
  • RPL
  • Self
  • Slate
  • Smalltalk

Computer Science

  • Type systems
  • Language paradigms
  • Compilers
  • Interpreters
  • Garbage collection

Meta

  • Search
  • Farkup wiki format
  • People
  • Etiquette
  • Sandbox

Factor/Optimization

The first step when optimizing Factor code is to ensure that it is compiled with the Optimizing compiler. A word will be optimized if and only if it has a static stack effect. To check this,

[ my-word ] infer.

You can define unit tests which assert this is true,

\ my-word must-infer

High-level optimizer

To see how the high level optimizer treats a word, you can use the following tool:

USE: compiler.tree.debugger
\ foo optimized.

You will be able to see if generic dispatch has been eliminated, and if generic airthmetic has been converted to machine arithmetic, and which words have been inlined.

You can also pass a quotation to optimized.:

[ 100 [ ] times ] optimized.

The high level compiler can be given hints and inline declarations which affects the output of the above.

Low-level optimizer

To see how the low level optimizer treats a word,

USE: compiler.cfg.debugger
\ foo test-mr mr.

Disassembly

To see the final code generated for a word, use the disassemble word.

Disassembling words is accomplished using libudis86 on x86, and gdb on PowerPC.

Note that udis needs to be compiled with the --enable-shared option:

  • udis Installation

This revision created on Sun, 25 Jan 2009 00:41:35 by slava

Latest Revisions Edit

All content is © 2008-2023 by its respective authors. By adding content to this wiki, you agree to release it under the BSD license.