Monday, June 28, 2010

Integer Code

Hi code is compiled to lambda expression, lambda expressions are compiled to combinators, combinators are compiled to an abstract assembly which only knows how to do one thing: manipulate, inspect and adjust, arrays of integers of pointer size width. Arrays of integers are primitives of the assembly.

In order to do end up with only integer (bit) arrays, all primitives are compiled to them, which, in all respects, works great, and is just a cool thing to do.

In the array language, it is determined which arrays are constants, and which arrays are dynamic, and in one pass the code is generated which explicitly allocates dynamic arrays. (The latter is an easy check, if an array operand is somewhere filled with a register, or is a record array holding a null pointer, it is dynamic.)

The assembly assumes an infinite amount of write-once registers, which means I don't translate to loops, as of yet, and except for dynamically allocated arrays, all registers hold constant values.

I assume C can optimize a lot out of that, but C has some problems handling the static data ('near initializer isn't a constant,' solved for now), and I am not sure C understands all invariants I am trying to communicate to it.

I need my own optimizer.

No comments:

Post a Comment