Re: [racket-dev] TR's optimizer eventually going to unbox structs?

2012-08-27 Thread Robby Findler
Would you need a and is not a substruct? predicate to make such things work? Robby On Mon, Aug 27, 2012 at 10:11 AM, Vincent St-Amour stamo...@ccs.neu.edu wrote: TR's complex number optimizations eliminate repeated boxing and unboxing in chains of operations that each consume and produce

Re: [racket-dev] TR's optimizer eventually going to unbox structs?

2012-08-27 Thread Vincent St-Amour
I don't think it would be necessary. For the optimization to trigger, the only thing a step in the chain can do with its argument is use its components. Anything else (e.g. checking whether it's a substruct) would require the argument to be boxed, and would prevent the optimization from

Re: [racket-dev] TR's optimizer eventually going to unbox structs?

2012-08-27 Thread Neil Toronto
On 08/27/2012 09:11 AM, Vincent St-Amour wrote: TR's complex number optimizations eliminate repeated boxing and unboxing in chains of operations that each consume and produce complex numbers. Similar optimizations for structs would eliminate structs for intermediate results in chains of

Re: [racket-dev] TR's optimizer eventually going to unbox structs?

2012-08-27 Thread Ray Racine
FWIW, the Scala folks have done something along these lines, Value Classes, originally aka Inline Classes. https://docs.google.com/document/d/10TQKgMiJTbVtkdRG53wsLYwWM2MkhtmdV25-NZvLLMA/edit?hl=en_USpli=1 On Mon, Aug 27, 2012 at 12:58 PM, Neil Toronto neil.toro...@gmail.comwrote: On

Re: [racket-dev] TR's optimizer eventually going to unbox structs?

2012-08-27 Thread Robby Findler
Oh, okay. And so if you have a function that accepts a struct, does some work with it, and then returns a new version of it (and you wanted to optimize the body of the function), then you could get away with doing something like 'struct-copy' to make the final version that gets returned. Robby

[racket-dev] TR's optimizer eventually going to unbox structs?

2012-08-18 Thread Neil Toronto
Is TR's optimizer eventually going to unbox structs in the same way it unboxes rectangular flonums? I have a design choice right now: how to represent probabilities. Floats are good because of their speed, but because of floating-point limitations, *four different representations* are

Re: [racket-dev] TR's optimizer eventually going to unbox structs?

2012-08-18 Thread Matthias Felleisen
But don't you need the 'tag' from the struct to distinguish .4 in p from .4 in 1-p? They may be the same number but they denote distinct ideas. -- Matthias ' On Aug 18, 2012, at 2:40 PM, Neil Toronto wrote: Is TR's optimizer eventually going to unbox structs in the same way it unboxes

Re: [racket-dev] TR's optimizer eventually going to unbox structs?

2012-08-18 Thread Robby Findler
One could, concievably, still do that without boxing/unblocking by passing wide enough arguments. And it does seem like TR could help with that, but IIUC the untyped portion of the compiler needs significant work to support that before TR's knowledge of the program would help (But doing a better

Re: [racket-dev] TR's optimizer eventually going to unbox structs?

2012-08-18 Thread Matthias Felleisen
Vincent got TR to 'split' complex numbers, if that's what you mean by 'wide enough' arguments, and he did so w/o changing R. So perhaps there is a way to get the computation on floats and the tag for their meaning. On Aug 18, 2012, at 4:13 PM, Robby Findler wrote: One could, concievably,

Re: [racket-dev] TR's optimizer eventually going to unbox structs?

2012-08-18 Thread Robby Findler
Oh right! A generalized version of that strategy might work for Neil's program too. On Saturday, August 18, 2012, Matthias Felleisen wrote: Vincent got TR to 'split' complex numbers, if that's what you mean by 'wide enough' arguments, and he did so w/o changing R. So perhaps there is a way