RESOLVED FIXED 151114
B3 should be able to compile a program with ChillDiv
https://bugs.webkit.org/show_bug.cgi?id=151114
Summary B3 should be able to compile a program with ChillDiv
Filip Pizlo
Reported 2015-11-10 11:19:57 PST
Patch forthcoming.
Attachments
work in progress (36.63 KB, patch)
2015-11-10 12:12 PST, Filip Pizlo
no flags
more (84.31 KB, patch)
2015-11-10 13:26 PST, Filip Pizlo
no flags
the patch (108.07 KB, patch)
2015-11-10 16:54 PST, Filip Pizlo
no flags
the patch (108.25 KB, patch)
2015-11-10 17:09 PST, Filip Pizlo
no flags
the patch (108.31 KB, patch)
2015-11-10 17:42 PST, Filip Pizlo
benjamin: review+
patch for landing (29.87 KB, patch)
2015-11-10 21:53 PST, Filip Pizlo
no flags
patch for landing (108.58 KB, patch)
2015-11-10 22:06 PST, Filip Pizlo
no flags
patch for landing (108.58 KB, patch)
2015-11-10 22:33 PST, Filip Pizlo
no flags
Filip Pizlo
Comment 1 2015-11-10 12:12:30 PST
Created attachment 265215 [details] work in progress
Filip Pizlo
Comment 2 2015-11-10 13:26:03 PST
Filip Pizlo
Comment 3 2015-11-10 16:54:05 PST
Created attachment 265247 [details] the patch
WebKit Commit Bot
Comment 4 2015-11-10 16:56:32 PST
Attachment 265247 [details] did not pass style-queue: ERROR: Source/JavaScriptCore/b3/B3BlockInsertionSet.h:78: The parameter name "block" adds no information, so it should be removed. [readability/parameter_name] [5] ERROR: Source/JavaScriptCore/b3/B3ConstDoubleValue.h:45: The parameter name "proc" adds no information, so it should be removed. [readability/parameter_name] [5] ERROR: Source/JavaScriptCore/b3/B3ConstDoubleValue.h:46: The parameter name "proc" adds no information, so it should be removed. [readability/parameter_name] [5] ERROR: Source/JavaScriptCore/b3/B3ConstDoubleValue.h:47: The parameter name "proc" adds no information, so it should be removed. [readability/parameter_name] [5] Total errors found: 4 in 47 files If any of these errors are false positives, please file a bug against check-webkit-style.
Filip Pizlo
Comment 5 2015-11-10 17:09:19 PST
Created attachment 265251 [details] the patch With some fixes.
Filip Pizlo
Comment 6 2015-11-10 17:42:20 PST
Created attachment 265255 [details] the patch Fix 32-bit.
Benjamin Poulain
Comment 7 2015-11-10 21:06:06 PST
Comment on attachment 265255 [details] the patch View in context: https://bugs.webkit.org/attachment.cgi?id=265255&action=review > Source/JavaScriptCore/ChangeLog:22 > + This introduces an idiom that handles this. It's BlockInsertionSet::splitBefore(). The > + idea is that it uses the current block before the split as the continuation after the > + split. When you call splitBefore(), you pass it your loop index and your InsertionSet > + (if applicable). It makes sure that it changes those auxiliary things in such a way that > + you can keep looping. > + splitBefore() -> splitForward() > Source/JavaScriptCore/assembler/MacroAssemblerX86_64.h:394 > + void x86ConvertToDoubleWord64(RegisterID rax, RegisterID rdx) ConvertToQuadword? > Source/JavaScriptCore/assembler/X86Assembler.h:1295 > + void cdqq() Looks like the official name for this is "cqo" > Source/JavaScriptCore/b3/B3BasicBlockUtils.h:75 > +void updatePredecessors(BasicBlock* root) updatePredecessors -> updatePredecessorsAfter(block)? The name is a bit weird. > Source/JavaScriptCore/b3/B3Common.h:101 > + if (den == -1 && num == -2147483647 - 1) Why not use numeric_limits? > Source/JavaScriptCore/b3/B3Common.h:110 > + if (den == -1 && num == -9223372036854775807ll - 1) ditto, and some later. > Source/JavaScriptCore/b3/B3LowerMacros.cpp:59 > + m_changed |= m_blockInsertionSet.execute(); Having this at the end means no Macro can use a Macro in its expansion. I guess you could assert that by running the algorithm again in Debug and checking that m_blockInsertionSet.execute() returns false. > Source/JavaScriptCore/b3/B3LowerMacros.cpp:90 > + // res = num / dev; dev -> den > Source/JavaScriptCore/b3/B3LowerMacros.cpp:97 > + Value* one = > + m_insertionSet.insertIntConstant(m_index, m_value, 1); Could be on a single line.
Geoffrey Garen
Comment 8 2015-11-10 21:26:11 PST
Comment on attachment 265255 [details] the patch View in context: https://bugs.webkit.org/attachment.cgi?id=265255&action=review >> Source/JavaScriptCore/ChangeLog:22 >> + > > splitBefore() -> splitForward() Or maybe just split()? (The split is forward and backward, and it breaks what comes before from what comes after.)
Filip Pizlo
Comment 9 2015-11-10 21:26:51 PST
(In reply to comment #7) > Comment on attachment 265255 [details] > the patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=265255&action=review > > > Source/JavaScriptCore/ChangeLog:22 > > + This introduces an idiom that handles this. It's BlockInsertionSet::splitBefore(). The > > + idea is that it uses the current block before the split as the continuation after the > > + split. When you call splitBefore(), you pass it your loop index and your InsertionSet > > + (if applicable). It makes sure that it changes those auxiliary things in such a way that > > + you can keep looping. > > + > > splitBefore() -> splitForward() > > > Source/JavaScriptCore/assembler/MacroAssemblerX86_64.h:394 > > + void x86ConvertToDoubleWord64(RegisterID rax, RegisterID rdx) > > ConvertToQuadword? Good point. > > > Source/JavaScriptCore/assembler/X86Assembler.h:1295 > > + void cdqq() > > Looks like the official name for this is "cqo" > > > Source/JavaScriptCore/b3/B3BasicBlockUtils.h:75 > > +void updatePredecessors(BasicBlock* root) > > updatePredecessors -> updatePredecessorsAfter(block)? > The name is a bit weird. Sure. > > > Source/JavaScriptCore/b3/B3Common.h:101 > > + if (den == -1 && num == -2147483647 - 1) > > Why not use numeric_limits? I guess I should! This was old school paranoia about -2147483648 not being a valid constant. Seems that numeric_limits does the right thing though. > > > Source/JavaScriptCore/b3/B3Common.h:110 > > + if (den == -1 && num == -9223372036854775807ll - 1) > > ditto, and some later. > > > Source/JavaScriptCore/b3/B3LowerMacros.cpp:59 > > + m_changed |= m_blockInsertionSet.execute(); > > Having this at the end means no Macro can use a Macro in its expansion. That's true! I think it would be bad form to have an expansion that requires more expansions. Good discipline about this prevents us from having to worry about fixpointing this phase, or having the phase never converge. > > I guess you could assert that by running the algorithm again in Debug and > checking that m_blockInsertionSet.execute() returns false. We could. The phase also returns a bool saying if it changed anything. We could internally have the phase run itself twice. > > > Source/JavaScriptCore/b3/B3LowerMacros.cpp:90 > > + // res = num / dev; > > dev -> den > > > Source/JavaScriptCore/b3/B3LowerMacros.cpp:97 > > + Value* one = > > + m_insertionSet.insertIntConstant(m_index, m_value, 1); > > Could be on a single line.
Filip Pizlo
Comment 10 2015-11-10 21:27:58 PST
(In reply to comment #8) > Comment on attachment 265255 [details] > the patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=265255&action=review > > >> Source/JavaScriptCore/ChangeLog:22 > >> + > > > > splitBefore() -> splitForward() > > Or maybe just split()? (The split is forward and backward, and it breaks > what comes before from what comes after.) Well, if we wanted to split blocks when transforming in a backward algorithm, then we'd want the newly created block to hold things *above* the valueIndex. Hence why I call it "splitForward()". The "Forward" tells you that it's meant to be used in a transformation that walks forward.
Filip Pizlo
Comment 11 2015-11-10 21:53:02 PST
Created attachment 265269 [details] patch for landing
WebKit Commit Bot
Comment 12 2015-11-10 21:56:10 PST
Attachment 265269 [details] did not pass style-queue: ERROR: Source/JavaScriptCore/b3/B3ConstDoubleValue.h:47: The parameter name "proc" adds no information, so it should be removed. [readability/parameter_name] [5] ERROR: Source/JavaScriptCore/b3/testb3.cpp:209: Place brace on its own line for function definitions. [whitespace/braces] [4] ERROR: Source/JavaScriptCore/b3/testb3.cpp:302: Place brace on its own line for function definitions. [whitespace/braces] [4] ERROR: Source/JavaScriptCore/b3/testb3.cpp:2855: Place brace on its own line for function definitions. [whitespace/braces] [4] ERROR: Source/JavaScriptCore/b3/testb3.cpp:2861: Place brace on its own line for function definitions. [whitespace/braces] [4] Total errors found: 5 in 17 files If any of these errors are false positives, please file a bug against check-webkit-style.
Filip Pizlo
Comment 13 2015-11-10 22:06:44 PST
Created attachment 265270 [details] patch for landing The right patch this time!
Filip Pizlo
Comment 14 2015-11-10 22:33:02 PST
Created attachment 265271 [details] patch for landing
WebKit Commit Bot
Comment 15 2015-11-10 23:21:23 PST
Comment on attachment 265271 [details] patch for landing Clearing flags on attachment: 265271 Committed r192295: <http://trac.webkit.org/changeset/192295>
WebKit Commit Bot
Comment 16 2015-11-10 23:21:28 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.