RESOLVED FIXED151741
[JSC] Add a function attribute for Pure functions in B3
https://bugs.webkit.org/show_bug.cgi?id=151741
Summary [JSC] Add a function attribute for Pure functions in B3
Benjamin Poulain
Reported 2015-12-02 01:13:49 PST
[JSC] Add a function attribute for Pure functions in B3
Attachments
Patch (3.50 KB, patch)
2015-12-02 01:16 PST, Benjamin Poulain
fpizlo: review-
Benjamin Poulain
Comment 1 2015-12-02 01:16:39 PST
Geoffrey Garen
Comment 2 2015-12-02 11:17:28 PST
Comment on attachment 266435 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=266435&action=review r=me > Source/JavaScriptCore/b3/B3CCallValue.h:38 > + enum Pure { PureCall }; Usually we call this "enum PureCallTag { PureCall }".
Benjamin Poulain
Comment 3 2015-12-02 14:12:46 PST
Filip Pizlo
Comment 4 2015-12-02 14:17:27 PST
Comment on attachment 266435 [details] Patch This doesn't belong here at all. A pure function can be labeled by setting its Effects appropriately. Also, I really hate the word "pure" since it has no precise meaning. Do you mean that a call to the function with the same incoming values will yield the same result? Do you also mean that the function has no hidden effects that cause it to require execution even if the result is unused? Do you also mean that it will never read any memory, or can it still read some memory? I created B3::Effects with the intent that it can answer all of these questions precisely: - You can say that a function reads no memory. - You can say that a function writes no memory. - You can say that a function is not control-dependent. - You can say that a function will not side-exit (for C functions a side-exit would be if it triggered unwinding - so this can always be cleared for all of the C functions we call). The strongest purity guarantee is "any call to this function with the same arguments will yield the same result". I believe that this guarantee can be expressed by saying that it does not read or write memory, does not have SSA effects, doesn't do any of the other things (control-dependent, side-exit, terminal). My goal with CSE was to have pure CSE rules on calls and patchpoints that do this. So, can we please roll this out?
Note You need to log in before you can comment on or make changes to this bug.