I tweaked the new IR compiler to support Duby's type declarations last
night. This is intended for Duby use, but if we ever thought the
politics of type hinting/gradual typing allowed it we could certainly
use this to start propagating/enforcing explicit type information.
Subbu, I'd like to talk with you about how we can propagate type
information through the IR, since even without this we'll know the
types of literals and have a good idea about the types of profiled
call targets.
Here's a sample IR with Duby type decls in place:
For the code:
def foo(a => Fixnum)
foo(a)
end
name: foo
instrs:
0 self = RECV_ARG(0)
1 DECLARE_TYPE(1:Fixnum)
2 a = RECV_ARG(1)
3 %v_0 = CALL(foo, [self, a])
4 RETURN(%v_0)
live variables:
%v_0: 3-4
a: 2-3
self: 0-3]
I'm hoping that the new IR will provide a better backbone for Duby,
since all the same transformations and optimizations would be useful
even in a static-typed compiler. Plus it will be far easier to
propagate inferred types through IR than through an AST.
- Charlie
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email