|
| 1 | +2019-08-01 Keith Miller <keith_miller@apple.com> |
| 2 | + |
| 3 | + B3 should support tuple types |
| 4 | + https://bugs.webkit.org/show_bug.cgi?id=200327 |
| 5 | + |
| 6 | + Reviewed by Filip Pizlo. |
| 7 | + |
| 8 | + As part of the Wasm multi-value proposal, we need to teach B3 that |
| 9 | + patchpoints can return more than one value. This is done by |
| 10 | + adding a new B3::Type called Tuple. Unlike, other B3 types Tuple |
| 11 | + is actually an encoded index into a numeric B3::Type vector on the |
| 12 | + procedure. This lets us distinguish any two tuples from each |
| 13 | + other, moreover, it's possible to get the vector of types with |
| 14 | + just the B3::Tuple type and the procedure. |
| 15 | + |
| 16 | + Since most B3 operations only expect to see a single numeric child |
| 17 | + there is a new Opcode, Extract, that takes yields the some, fixed, |
| 18 | + entry from a tuple value. Extract would be the only other change |
| 19 | + needed to make tuples work in B3 except that some optimizations |
| 20 | + expect to be able to take any non-Void value and stick it into a |
| 21 | + Variable of the same type. This means both Get/Set from a variable |
| 22 | + have to support Tuples as well. For simplicity and consistency, |
| 23 | + the ability to accept tuples is also applied to Phi and Upsilon. |
| 24 | + |
| 25 | + In order to lower a Tuple, B3Lowering needs to have a Tmp for each |
| 26 | + nested type in a Tuple. While we could reuse the existing |
| 27 | + IndexedTables to hold the extra information we need to lower |
| 28 | + Tuples, we instead use a two new HashTables for Value->Tmp(s) and |
| 29 | + Phi->Tmp(s). It's expected that Tuples will be sufficiently |
| 30 | + uncommon the overhead of tracking everything together would be |
| 31 | + prohibitive. On the other hand, we don't worry about this for |
| 32 | + Variables because we don't expect those to make it to lowering. |
| 33 | + |
| 34 | + * JavaScriptCore.xcodeproj/project.pbxproj: |
| 35 | + * Sources.txt: |
| 36 | + * b3/B3Bank.h: |
| 37 | + (JSC::B3::bankForType): |
| 38 | + * b3/B3CheckValue.cpp: |
| 39 | + (JSC::B3::CheckValue::CheckValue): |
| 40 | + * b3/B3ExtractValue.cpp: Copied from Source/JavaScriptCore/b3/B3ProcedureInlines.h. |
| 41 | + (JSC::B3::ExtractValue::~ExtractValue): |
| 42 | + (JSC::B3::ExtractValue::dumpMeta const): |
| 43 | + * b3/B3ExtractValue.h: Copied from Source/JavaScriptCore/b3/B3FixSSA.h. |
| 44 | + * b3/B3FixSSA.h: |
| 45 | + * b3/B3LowerMacros.cpp: |
| 46 | + * b3/B3LowerMacrosAfterOptimizations.cpp: |
| 47 | + * b3/B3LowerToAir.cpp: |
| 48 | + * b3/B3NativeTraits.h: |
| 49 | + * b3/B3Opcode.cpp: |
| 50 | + (JSC::B3::invertedCompare): |
| 51 | + (WTF::printInternal): |
| 52 | + * b3/B3Opcode.h: |
| 53 | + (JSC::B3::opcodeForConstant): |
| 54 | + * b3/B3PatchpointSpecial.cpp: |
| 55 | + (JSC::B3::PatchpointSpecial::forEachArg): |
| 56 | + (JSC::B3::PatchpointSpecial::isValid): |
| 57 | + (JSC::B3::PatchpointSpecial::admitsStack): |
| 58 | + (JSC::B3::PatchpointSpecial::generate): |
| 59 | + * b3/B3PatchpointValue.cpp: |
| 60 | + (JSC::B3::PatchpointValue::dumpMeta const): |
| 61 | + (JSC::B3::PatchpointValue::PatchpointValue): |
| 62 | + * b3/B3PatchpointValue.h: |
| 63 | + * b3/B3Procedure.cpp: |
| 64 | + (JSC::B3::Procedure::addTuple): |
| 65 | + (JSC::B3::Procedure::isValidTuple const): |
| 66 | + (JSC::B3::Procedure::tupleForType const): |
| 67 | + (JSC::B3::Procedure::addIntConstant): |
| 68 | + (JSC::B3::Procedure::addConstant): |
| 69 | + * b3/B3Procedure.h: |
| 70 | + (JSC::B3::Procedure::returnCount const): |
| 71 | + * b3/B3ProcedureInlines.h: |
| 72 | + (JSC::B3::Procedure::extractFromTuple const): |
| 73 | + * b3/B3ReduceStrength.cpp: |
| 74 | + * b3/B3StackmapSpecial.cpp: |
| 75 | + (JSC::B3::StackmapSpecial::isValidImpl): |
| 76 | + (JSC::B3::StackmapSpecial::isArgValidForType): |
| 77 | + (JSC::B3::StackmapSpecial::isArgValidForRep): |
| 78 | + (JSC::B3::StackmapSpecial::isArgValidForValue): Deleted. |
| 79 | + * b3/B3StackmapSpecial.h: |
| 80 | + * b3/B3StackmapValue.h: |
| 81 | + * b3/B3Type.cpp: |
| 82 | + (WTF::printInternal): |
| 83 | + * b3/B3Type.h: |
| 84 | + (JSC::B3::Type::Type): |
| 85 | + (JSC::B3::Type::tupleFromIndex): |
| 86 | + (JSC::B3::Type::kind const): |
| 87 | + (JSC::B3::Type::tupleIndex const): |
| 88 | + (JSC::B3::Type::hash const): |
| 89 | + (JSC::B3::Type::operator== const): |
| 90 | + (JSC::B3::Type::operator!= const): |
| 91 | + (JSC::B3::Type::isInt const): |
| 92 | + (JSC::B3::Type::isFloat const): |
| 93 | + (JSC::B3::Type::isNumeric const): |
| 94 | + (JSC::B3::Type::isTuple const): |
| 95 | + (JSC::B3::sizeofType): |
| 96 | + (JSC::B3::isInt): Deleted. |
| 97 | + (JSC::B3::isFloat): Deleted. |
| 98 | + * b3/B3TypeMap.h: |
| 99 | + (JSC::B3::TypeMap::at): |
| 100 | + * b3/B3Validate.cpp: |
| 101 | + * b3/B3Value.cpp: |
| 102 | + (JSC::B3::Value::isRounded const): |
| 103 | + (JSC::B3::Value::effects const): |
| 104 | + (JSC::B3::Value::typeFor): |
| 105 | + * b3/B3Value.h: |
| 106 | + * b3/B3ValueInlines.h: |
| 107 | + * b3/B3ValueKey.cpp: |
| 108 | + (JSC::B3::ValueKey::intConstant): |
| 109 | + * b3/B3ValueKey.h: |
| 110 | + (JSC::B3::ValueKey::hash const): |
| 111 | + * b3/B3ValueRep.h: |
| 112 | + * b3/B3Width.h: |
| 113 | + (JSC::B3::widthForType): |
| 114 | + * b3/air/AirArg.cpp: |
| 115 | + (JSC::B3::Air::Arg::canRepresent const): |
| 116 | + * b3/air/AirArg.h: |
| 117 | + * b3/air/AirCCallingConvention.cpp: |
| 118 | + (JSC::B3::Air::cCallResult): |
| 119 | + * b3/air/AirLowerMacros.cpp: |
| 120 | + (JSC::B3::Air::lowerMacros): |
| 121 | + * b3/testb3.h: |
| 122 | + (populateWithInterestingValues): |
| 123 | + * b3/testb3_1.cpp: |
| 124 | + (run): |
| 125 | + * b3/testb3_3.cpp: |
| 126 | + (testStorePartial8BitRegisterOnX86): |
| 127 | + * b3/testb3_5.cpp: |
| 128 | + (testPatchpointWithRegisterResult): |
| 129 | + (testPatchpointWithStackArgumentResult): |
| 130 | + (testPatchpointWithAnyResult): |
| 131 | + * b3/testb3_6.cpp: |
| 132 | + (testPatchpointDoubleRegs): |
| 133 | + (testSomeEarlyRegister): |
| 134 | + * b3/testb3_7.cpp: |
| 135 | + (testShuffleDoesntTrashCalleeSaves): |
| 136 | + (testReportUsedRegistersLateUseFollowedByEarlyDefDoesNotMarkUseAsDead): |
| 137 | + (testSimpleTuplePair): |
| 138 | + (testSimpleTuplePairUnused): |
| 139 | + (testSimpleTuplePairStack): |
| 140 | + (tailDupedTuplePair): |
| 141 | + (tuplePairVariableLoop): |
| 142 | + (tupleNestedLoop): |
| 143 | + (addTupleTests): |
| 144 | + * b3/testb3_8.cpp: |
| 145 | + (testLoad): |
| 146 | + (addLoadTests): |
| 147 | + * ftl/FTLAbbreviatedTypes.h: |
| 148 | + * ftl/FTLLowerDFGToB3.cpp: |
| 149 | + (JSC::FTL::DFG::LowerDFGToB3::compileCallOrConstruct): |
| 150 | + (JSC::FTL::DFG::LowerDFGToB3::compileDirectCallOrConstruct): |
| 151 | + (JSC::FTL::DFG::LowerDFGToB3::compileCallOrConstructVarargsSpread): |
| 152 | + (JSC::FTL::DFG::LowerDFGToB3::compileCallOrConstructVarargs): |
| 153 | + (JSC::FTL::DFG::LowerDFGToB3::compileCallEval): |
| 154 | + (JSC::FTL::DFG::LowerDFGToB3::compileCPUIntrinsic): |
| 155 | + (JSC::FTL::DFG::LowerDFGToB3::compileInstanceOf): |
| 156 | + (JSC::FTL::DFG::LowerDFGToB3::compileCallDOMGetter): |
| 157 | + (JSC::FTL::DFG::LowerDFGToB3::emitBinarySnippet): |
| 158 | + (JSC::FTL::DFG::LowerDFGToB3::emitBinaryBitOpSnippet): |
| 159 | + (JSC::FTL::DFG::LowerDFGToB3::emitRightShiftSnippet): |
| 160 | + (JSC::FTL::DFG::LowerDFGToB3::allocateHeapCell): |
| 161 | + * wasm/WasmAirIRGenerator.cpp: |
| 162 | + (JSC::Wasm::AirIRGenerator::emitPatchpoint): |
| 163 | + * wasm/WasmB3IRGenerator.cpp: |
| 164 | + (JSC::Wasm::B3IRGenerator::B3IRGenerator): |
| 165 | + * wasm/WasmCallingConvention.h: |
| 166 | + (JSC::Wasm::CallingConvention::marshallArgument const): |
| 167 | + (JSC::Wasm::CallingConvention::setupFrameInPrologue const): |
| 168 | + (JSC::Wasm::CallingConvention::setupCall const): |
| 169 | + (JSC::Wasm::CallingConventionAir::setupCall const): |
| 170 | + |
1 | 171 | 2019-08-02 Yusuke Suzuki <ysuzuki@apple.com> |
2 | 172 |
|
3 | 173 | [JSC] Use "destroy" function directly for JSWebAssemblyCodeBlock and WebAssemblyFunction |
|
0 commit comments