|
Lines 1-3
a/Source/JavaScriptCore/ChangeLog_sec1
|
|
|
1 |
2017-04-28 JF Bastien <jfbastien@apple.com> |
| 2 |
|
| 3 |
WebAssembly: Air::Inst::generate crashes on large binary on A64 |
| 4 |
https://bugs.webkit.org/show_bug.cgi?id=170215 |
| 5 |
|
| 6 |
Reviewed by NOBODY (OOPS!). |
| 7 |
|
| 8 |
ARM can't encode all offsets in a single instruction. We usualy |
| 9 |
handle this type of detail early, or the macro assembler uses a |
| 10 |
scratch register to take care of the large immediate. After |
| 11 |
register allocation we assumed that we would never get large |
| 12 |
offsets, and asserted this was the case. That was a fine |
| 13 |
assumption with JavaScript, but WebAssembly ends up generating |
| 14 |
stack frames which are too big to encode. |
| 15 |
|
| 16 |
There are two places that needed to be fixed: |
| 17 |
1. AirGenerate |
| 18 |
2. AirLowerStackArgs |
| 19 |
|
| 20 |
We now unconditionally pin the dataTempRegister on ARM64, and use |
| 21 |
it when immediates don't fit. |
| 22 |
|
| 23 |
Number 1. is easy: we're just incrementing SP, make sure we can |
| 24 |
use a scratch register when that happens. |
| 25 |
|
| 26 |
Number 2. is more complex: not all Inst can receive a stack |
| 27 |
argument whose base register isn't SP or FP. Specifically, |
| 28 |
Patchpoints and Stackmaps get very sad because they just want to |
| 29 |
know the offset value, but when we materialize the offset as |
| 30 |
follows: |
| 31 |
|
| 32 |
Move (spill337), (spill201), %r0, @8735 |
| 33 |
|
| 34 |
Becomes (where %r16 is dataTempRegister): |
| 35 |
Move $1404, %r16, @8736 |
| 36 |
Add64 %sp, %r16, @8736 |
| 37 |
Move (%r16), 2032(%sp), %r0, @8736 |
| 38 |
|
| 39 |
The code currently doesn't see through our little dance. To work |
| 40 |
around this issue we introduce a new Air Arg kind: |
| 41 |
ExtendedOffsetAddr. This is the same as a regular Addr, but with |
| 42 |
an offset which may be too big to encode. Opcodes then declare |
| 43 |
whether their arguments can handle such inputs, and if so we |
| 44 |
generate them, otherwise we generate Addr as shown above. |
| 45 |
|
| 46 |
None of this affects x86 because it can always encode large |
| 47 |
immediates. |
| 48 |
|
| 49 |
This patch also drive-by converts some uses of `override` to |
| 50 |
`final`. It makes the code easier to grok, and maybe helps the |
| 51 |
optimizer sometimes but really that doens't matter. |
| 52 |
|
| 53 |
* assembler/MacroAssembler.h: |
| 54 |
* assembler/MacroAssemblerARM64.h: |
| 55 |
* b3/B3CheckSpecial.cpp: |
| 56 |
(JSC::B3::CheckSpecial::admitsExtendedOffsetAddr): |
| 57 |
* b3/B3CheckSpecial.h: |
| 58 |
* b3/B3Common.cpp: |
| 59 |
(JSC::B3::pinnedExtendedOffsetAddrRegister): keep the CPU-specific |
| 60 |
pinning information in a cpp file |
| 61 |
* b3/B3Common.h: |
| 62 |
* b3/B3PatchpointSpecial.cpp: |
| 63 |
(JSC::B3::PatchpointSpecial::admitsExtendedOffsetAddr): |
| 64 |
* b3/B3PatchpointSpecial.h: |
| 65 |
* b3/B3StackmapSpecial.cpp: |
| 66 |
(JSC::B3::StackmapSpecial::isArgValidForRep): |
| 67 |
(JSC::B3::StackmapSpecial::repForArg): |
| 68 |
* b3/B3StackmapSpecial.h: |
| 69 |
* b3/air/AirArg.cpp: |
| 70 |
(JSC::B3::Air::Arg::isStackMemory): |
| 71 |
(JSC::B3::Air::Arg::jsHash): |
| 72 |
(JSC::B3::Air::Arg::dump): |
| 73 |
(WTF::printInternal): |
| 74 |
(JSC::B3::Air::Arg::stackAddrImpl): Deleted. There was only one |
| 75 |
use of this (in AirLowerStackArgs) and it was now confusing to |
| 76 |
split the logic up between these two. Inline the code that used to |
| 77 |
be here into its one usepoint instead. |
| 78 |
* b3/air/AirArg.h: |
| 79 |
(JSC::B3::Air::Arg::extendedOffsetAddr): |
| 80 |
(JSC::B3::Air::Arg::isExtendedOffsetAddr): |
| 81 |
(JSC::B3::Air::Arg::isMemory): |
| 82 |
(JSC::B3::Air::Arg::base): |
| 83 |
(JSC::B3::Air::Arg::offset): |
| 84 |
(JSC::B3::Air::Arg::isGP): |
| 85 |
(JSC::B3::Air::Arg::isFP): |
| 86 |
(JSC::B3::Air::Arg::isValidForm): |
| 87 |
(JSC::B3::Air::Arg::forEachTmpFast): |
| 88 |
(JSC::B3::Air::Arg::forEachTmp): |
| 89 |
(JSC::B3::Air::Arg::asAddress): |
| 90 |
(JSC::B3::Air::Arg::stackAddr): Deleted. |
| 91 |
* b3/air/AirCCallSpecial.cpp: |
| 92 |
(JSC::B3::Air::CCallSpecial::isValid): |
| 93 |
(JSC::B3::Air::CCallSpecial::admitsExtendedOffsetAddr): |
| 94 |
(JSC::B3::Air::CCallSpecial::generate): |
| 95 |
* b3/air/AirCCallSpecial.h: |
| 96 |
* b3/air/AirCode.cpp: |
| 97 |
(JSC::B3::Air::Code::Code): |
| 98 |
(JSC::B3::Air::Code::pinRegister): Check that the register wasn't |
| 99 |
pinned before pinning it. It's likely a bug to pin the same |
| 100 |
register twice. |
| 101 |
* b3/air/AirCustom.h: |
| 102 |
(JSC::B3::Air::PatchCustom::admitsExtendedOffsetAddr): |
| 103 |
(JSC::B3::Air::CCallCustom::admitsExtendedOffsetAddr): |
| 104 |
(JSC::B3::Air::ShuffleCustom::admitsExtendedOffsetAddr): |
| 105 |
(JSC::B3::Air::EntrySwitchCustom::admitsExtendedOffsetAddr): |
| 106 |
(JSC::B3::Air::WasmBoundsCheckCustom::admitsExtendedOffsetAddr): |
| 107 |
* b3/air/AirGenerate.cpp: |
| 108 |
(JSC::B3::Air::generate): |
| 109 |
* b3/air/AirInst.h: |
| 110 |
* b3/air/AirInstInlines.h: |
| 111 |
(JSC::B3::Air::Inst::admitsExtendedOffsetAddr): |
| 112 |
* b3/air/AirLowerStackArgs.cpp: |
| 113 |
(JSC::B3::Air::lowerStackArgs): |
| 114 |
* b3/air/AirPrintSpecial.cpp: |
| 115 |
(JSC::B3::Air::PrintSpecial::admitsExtendedOffsetAddr): |
| 116 |
(JSC::B3::Air::PrintSpecial::generate): |
| 117 |
* b3/air/AirPrintSpecial.h: |
| 118 |
* b3/air/AirSpecial.h: |
| 119 |
* b3/air/opcode_generator.rb: |
| 120 |
|
| 1 |
2017-05-02 Don Olmstead <don.olmstead@am.sony.com> |
121 |
2017-05-02 Don Olmstead <don.olmstead@am.sony.com> |
| 2 |
|
122 |
|
| 3 |
Build fix after r216078 |
123 |
Build fix after r216078 |