The JIT already makes optimisations and then unrolls them if it finds they were based on something that was incorrect, so sure, that's an option. Though when one side effect happens on another thread/process/CPU, if you allow it to run there rather than transferring it to the original thread you're probably going to break stuff.
On Thu, Jan 6, 2011 at 8:40 PM, Joseph Ottinger <[email protected]> wrote: > Hmm, that makes it sound like a job for the JIT: calculate > side-effects, if any, and optimize the loop to be parallel if no > side-effects are detected. of course, if side effects are rare > conditions, that makes things much dicier. > > On Thu, Jan 6, 2011 at 3:37 PM, Ricky Clarkson <[email protected]> > wrote: >> All it takes is for the compiler to know what operations are >> side-effect-ful and it can do all the necessary analysis. So, for >> instance, it's perfectly doable without any hints for Haskell. For >> Java a combination of annotations and inference could do it. >> >> 2011/1/6 Cédric Beust ♔ <[email protected]>: >>> >>> >>> On Thu, Jan 6, 2011 at 12:25 PM, Ricky Clarkson <[email protected]> >>> wrote: >>>> >>>> Loops where each iteration does not depend on any other iteration can >>>> be safely parallelised. That's the connection >>> >>> Yes, but my point was that a language construct will never be enough to tell >>> the compiler that. The developer will always have to give a hint to the >>> compiler explicitly. That was my response to the initial argument which >>> seemed to imply that index based for loops can't be parallelized while >>> foreach loops can. >>> >>> -- >>> Cédric >>> >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "The Java Posse" group. >>> To post to this group, send email to [email protected]. >>> To unsubscribe from this group, send email to >>> [email protected]. >>> For more options, visit this group at >>> http://groups.google.com/group/javaposse?hl=en. >>> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "The Java Posse" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/javaposse?hl=en. >> >> > > > > -- > Joseph B. Ottinger > http://enigmastation.com > > -- > You received this message because you are subscribed to the Google Groups > "The Java Posse" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/javaposse?hl=en. > > -- You received this message because you are subscribed to the Google Groups "The Java Posse" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/javaposse?hl=en.
