|
|
Created:
3 years, 10 months ago by Clemens Hammacher Modified:
3 years, 10 months ago Reviewers:
titzer CC:
v8-reviews_googlegroups.com Target Ref:
refs/pending/heads/master Project:
v8 Visibility:
Public. |
Description[wasm] Refactor code specialization / patching
All patching logic is now bundled in one compilation unit.
The CodeSpecialization object is set up by all relocation and patching
that should be applied, and then be run on individual code objects or
the whole instance in one go. We hence only need to iterate all
relocation tables exactly once at instantiation.
Also, we do not patch contexts any more since we do not embed them in
generated code any more.
R=titzer@chromium.org
BUG=v8:5991
Review-Url: https://codereview.chromium.org/2696143006
Cr-Commit-Position: refs/heads/master@{#43324}
Committed: https://chromium.googlesource.com/v8/v8/+/a690aa299414bb3ca2f76e97b02a875e0f721892
Patch Set 1 #Patch Set 2 : Fix & rebase #Patch Set 3 : Rebase #Patch Set 4 : Minor fix #Patch Set 5 : Rebase #Patch Set 6 : Remove unused variables and add documentation #
Total comments: 2
Patch Set 7 : Use IdentityMap #
Total comments: 2
Patch Set 8 : Use heap allocation instead of std::optional replacement #Patch Set 9 : Rebase #
Depends on Patchset: Messages
Total messages: 53 (38 generated)
The CQ bit was checked by clemensh@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: v8_android_arm_compile_rel on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_android_arm_compile_rel/...)
The CQ bit was checked by clemensh@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: v8_linux64_avx2_rel_ng on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_linux64_avx2_rel_ng/buil...) v8_linux64_gyp_rel_ng on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_linux64_gyp_rel_ng/build...) v8_linux_arm64_rel_ng on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_linux_arm64_rel_ng/build...) v8_linux_mipsel_compile_rel on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_linux_mipsel_compile_rel...) v8_linux_nodcheck_rel_ng on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_linux_nodcheck_rel_ng/bu...) v8_linux_verify_csa_rel_ng on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_linux_verify_csa_rel_ng/...) v8_presubmit on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_presubmit/builds/34911) v8_win_nosnap_shared_rel_ng on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_win_nosnap_shared_rel_ng...) v8_win_rel_ng on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_win_rel_ng/builds/22788)
Rebase
The CQ bit was checked by clemensh@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: v8_linux64_gyp_rel_ng on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_linux64_gyp_rel_ng/build...)
The CQ bit was checked by clemensh@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Rebase
The CQ bit was checked by clemensh@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: v8_linux64_gyp_rel_ng on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_linux64_gyp_rel_ng/build...)
Remove unused variables and add documentation
The CQ bit was checked by clemensh@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
Much green such refactoring very performance. wow! (PTAL)
https://codereview.chromium.org/2696143006/diff/100001/src/wasm/wasm-code-spe... File src/wasm/wasm-code-specialization.h (right): https://codereview.chromium.org/2696143006/diff/100001/src/wasm/wasm-code-spe... src/wasm/wasm-code-specialization.h:62: std::unordered_map<Object*, Object*> objects_to_relocate; I think we can replace this with an IdentityMap, which is stable over GC (and potentially more efficient because it is a hashmap underneath).
https://codereview.chromium.org/2696143006/diff/100001/src/wasm/wasm-code-spe... File src/wasm/wasm-code-specialization.h (right): https://codereview.chromium.org/2696143006/diff/100001/src/wasm/wasm-code-spe... src/wasm/wasm-code-specialization.h:62: std::unordered_map<Object*, Object*> objects_to_relocate; On 2017/02/17 at 13:38:16, titzer wrote: > I think we can replace this with an IdentityMap, which is stable over GC (and potentially more efficient because it is a hashmap underneath). Also note that I am already using a hash map here. identity-map.h sais: "The value type {V} must not be a heap type." Hence we would have to map to Handle<Object>, which would work, but introduces unnecessary overhead. What do you think?
On 2017/02/20 11:05:57, Clemens Hammacher wrote: > https://codereview.chromium.org/2696143006/diff/100001/src/wasm/wasm-code-spe... > File src/wasm/wasm-code-specialization.h (right): > > https://codereview.chromium.org/2696143006/diff/100001/src/wasm/wasm-code-spe... > src/wasm/wasm-code-specialization.h:62: std::unordered_map<Object*, Object*> > objects_to_relocate; > On 2017/02/17 at 13:38:16, titzer wrote: > > I think we can replace this with an IdentityMap, which is stable over GC (and > potentially more efficient because it is a hashmap underneath). > > Also note that I am already using a hash map here. > identity-map.h sais: "The value type {V} must not be a heap type." > Hence we would have to map to Handle<Object>, which would work, but introduces > unnecessary overhead. What do you think? Using Handle<Object> sounds fine, as that is more future-proof anyway.
Use IdentityMap
The CQ bit was checked by clemensh@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
On 2017/02/20 at 11:30:47, titzer wrote: > On 2017/02/20 11:05:57, Clemens Hammacher wrote: > > https://codereview.chromium.org/2696143006/diff/100001/src/wasm/wasm-code-spe... > > File src/wasm/wasm-code-specialization.h (right): > > > > https://codereview.chromium.org/2696143006/diff/100001/src/wasm/wasm-code-spe... > > src/wasm/wasm-code-specialization.h:62: std::unordered_map<Object*, Object*> > > objects_to_relocate; > > On 2017/02/17 at 13:38:16, titzer wrote: > > > I think we can replace this with an IdentityMap, which is stable over GC (and > > potentially more efficient because it is a hashmap underneath). > > > > Also note that I am already using a hash map here. > > identity-map.h sais: "The value type {V} must not be a heap type." > > Hence we would have to map to Handle<Object>, which would work, but introduces > > unnecessary overhead. What do you think? > > Using Handle<Object> sounds fine, as that is more future-proof anyway. Done. The CodeSpecialization object now requires a Zone, which I decided to not put inside the CodeSpecialization, in order to be able to reuse it for other stuff during instantiation. PTAL.
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: v8_linux_verify_csa_rel_ng on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_linux_verify_csa_rel_ng/...) v8_linux_verify_csa_rel_ng_triggered on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_linux_verify_csa_rel_ng_...)
Almost there. Can't in good conscience sign off on crazy union tricks :-) https://codereview.chromium.org/2696143006/diff/120001/src/wasm/wasm-code-spe... File src/wasm/wasm-code-specialization.cc (right): https://codereview.chromium.org/2696143006/diff/120001/src/wasm/wasm-code-spe... src/wasm/wasm-code-specialization.cc:170: SourcePositionTableIterator source_pos_it; Can we heap allocate these instead of using this union pattern?
Description was changed from ========== [wasm] Refactor code specialization / patching All patching logic is now bundled in one compilation unit. The CodeSpecialization object is set up by all relocation and patching that should be applied, and then be run on individual code objects or the whole instance in one go. We hence only need to iterate all relocation tables exactly once at instantiation. Also, we do not patch contexts any more since we do not embed them in generated code any more. R=titzer@chromium.org ========== to ========== [wasm] Refactor code specialization / patching All patching logic is now bundled in one compilation unit. The CodeSpecialization object is set up by all relocation and patching that should be applied, and then be run on individual code objects or the whole instance in one go. We hence only need to iterate all relocation tables exactly once at instantiation. Also, we do not patch contexts any more since we do not embed them in generated code any more. R=titzer@chromium.org BUG=v8:5991 ==========
Use heap allocation instead of std::optional replacement
The CQ bit was checked by clemensh@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: v8_linux64_asan_rel_ng on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_linux64_asan_rel_ng/buil...) v8_linux_arm_rel_ng on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_linux_arm_rel_ng/builds/...) v8_linux_gcc_compile_rel on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_linux_gcc_compile_rel/bu...) v8_mac_rel_ng on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_mac_rel_ng/builds/17776) v8_presubmit on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_presubmit/builds/35157)
The CQ bit was checked by clemensh@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
https://codereview.chromium.org/2696143006/diff/120001/src/wasm/wasm-code-spe... File src/wasm/wasm-code-specialization.cc (right): https://codereview.chromium.org/2696143006/diff/120001/src/wasm/wasm-code-spe... src/wasm/wasm-code-specialization.cc:170: SourcePositionTableIterator source_pos_it; On 2017/02/20 at 15:12:01, titzer wrote: > Can we heap allocate these instead of using this union pattern? Sure :) Done.
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
lgtm
The CQ bit was checked by clemensh@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
CQ is committing da patch. Bot data: {"patchset_id": 160001, "attempt_start_ts": 1487605833205310, "parent_rev": "67462272919c2ffdba7e0598ce00349a2175ca45", "commit_rev": "a690aa299414bb3ca2f76e97b02a875e0f721892"}
Message was sent while issue was closed.
Description was changed from ========== [wasm] Refactor code specialization / patching All patching logic is now bundled in one compilation unit. The CodeSpecialization object is set up by all relocation and patching that should be applied, and then be run on individual code objects or the whole instance in one go. We hence only need to iterate all relocation tables exactly once at instantiation. Also, we do not patch contexts any more since we do not embed them in generated code any more. R=titzer@chromium.org BUG=v8:5991 ========== to ========== [wasm] Refactor code specialization / patching All patching logic is now bundled in one compilation unit. The CodeSpecialization object is set up by all relocation and patching that should be applied, and then be run on individual code objects or the whole instance in one go. We hence only need to iterate all relocation tables exactly once at instantiation. Also, we do not patch contexts any more since we do not embed them in generated code any more. R=titzer@chromium.org BUG=v8:5991 Review-Url: https://codereview.chromium.org/2696143006 Cr-Commit-Position: refs/heads/master@{#43324} Committed: https://chromium.googlesource.com/v8/v8/+/a690aa299414bb3ca2f76e97b02a875e0f7... ==========
Message was sent while issue was closed.
Committed patchset #9 (id:160001) as https://chromium.googlesource.com/v8/v8/+/a690aa299414bb3ca2f76e97b02a875e0f7... |