|
|
Created:
3 years, 11 months ago by mattloring Modified:
3 years, 11 months ago CC:
v8-reviews_googlegroups.com Target Ref:
refs/pending/heads/master Project:
v8 Visibility:
Public. |
Description[ffi] Translation + test for int32
Also introduces FFIType separate from MachineType for express ffi
signatures.
BUG=v8:4456
Review-Url: https://codereview.chromium.org/2639163004
Cr-Commit-Position: refs/heads/master@{#42612}
Committed: https://chromium.googlesource.com/v8/v8/+/a5913c9a8ec0460c050d10d6d158afc7f23898ad
Patch Set 1 #
Total comments: 6
Patch Set 2 : Address nits #
Total comments: 4
Patch Set 3 : Correct int32 conversion for 32bit platforms #Patch Set 4 : Generate builtin frames instead of full-codegen #
Total comments: 2
Patch Set 5 : Check return values in test #Patch Set 6 : Arm fixes #
Messages
Total messages: 37 (20 generated)
Description was changed from ========== [ffi] Translation + test for int32 Also introduces FFIType separate from MachineType for express ffi signatures. BUG=v8:4456 ========== to ========== [ffi] Translation + test for int32 Also introduces FFIType separate from MachineType for express ffi signatures. BUG=v8:4456 ==========
mattloring@google.com changed reviewers: + ofrobots@google.com
On 2017/01/18 19:27:32, mattloring wrote: LGTM
mattloring@google.com changed reviewers: + bmeurer@chromium.org, ishell@chromium.org, mstarzinger@chromium.org
https://codereview.chromium.org/2639163004/diff/1/src/ffi/ffi-compiler.cc File src/ffi/ffi-compiler.cc (right): https://codereview.chromium.org/2639163004/diff/1/src/ffi/ffi-compiler.cc#new... src/ffi/ffi-compiler.cc:46: return result; Nit: Can we have UNREACHABLE(); return nullptr; here, and return directly from the proper cases above? https://codereview.chromium.org/2639163004/diff/1/src/ffi/ffi-compiler.cc#new... src/ffi/ffi-compiler.cc:56: } Nit: Can we have UNREACHABLE(); return nullptr; here, and return directly from the proper cases above? https://codereview.chromium.org/2639163004/diff/1/src/ffi/ffi-compiler.cc#new... src/ffi/ffi-compiler.cc:65: } This should probably end with an UNREACHABLE(); return MachineType::None();
https://codereview.chromium.org/2639163004/diff/1/src/ffi/ffi-compiler.cc File src/ffi/ffi-compiler.cc (right): https://codereview.chromium.org/2639163004/diff/1/src/ffi/ffi-compiler.cc#new... src/ffi/ffi-compiler.cc:46: return result; On 2017/01/19 05:04:28, Benedikt Meurer wrote: > Nit: Can we have UNREACHABLE(); return nullptr; here, and return directly from > the proper cases above? Done. https://codereview.chromium.org/2639163004/diff/1/src/ffi/ffi-compiler.cc#new... src/ffi/ffi-compiler.cc:56: } On 2017/01/19 05:04:28, Benedikt Meurer wrote: > Nit: Can we have UNREACHABLE(); return nullptr; here, and return directly from > the proper cases above? Done. https://codereview.chromium.org/2639163004/diff/1/src/ffi/ffi-compiler.cc#new... src/ffi/ffi-compiler.cc:65: } On 2017/01/19 05:04:28, Benedikt Meurer wrote: > This should probably end with an UNREACHABLE(); return MachineType::None(); Done.
https://codereview.chromium.org/2639163004/diff/20001/src/ffi/ffi-compiler.cc File src/ffi/ffi-compiler.cc (right): https://codereview.chromium.org/2639163004/diff/20001/src/ffi/ffi-compiler.cc... src/ffi/ffi-compiler.cc:41: return SmiFromWord32(node); On 32-bit architectures the payload of a Smi is a 31-bit signed integer. That means int32_t cannot always be encoded as a Smi. Please make sure to run your tests on a 32-bit architecture (e.g. ia32 or arm) as well. What you want here instead is ChangeInt32ToTagged I think.
https://codereview.chromium.org/2639163004/diff/20001/src/ffi/ffi-compiler.cc File src/ffi/ffi-compiler.cc (right): https://codereview.chromium.org/2639163004/diff/20001/src/ffi/ffi-compiler.cc... src/ffi/ffi-compiler.cc:110: Code::ComputeFlags(Code::FUNCTION), "js-to-native"); Unrelated to this change, but still important (feel free to fix in a separate CL): Marking the code objects as kind {FUNCTION} is dangerous. This instructs the stack-walker to treat it as a full-codegen frame where all stack slots are considered tagged. This does not hold for the frames at hand. I would advise to use {BUILTIN} instead. The problem can be reproduced with the following modification to the {Run_FFI_add7} test case: { FLAG_allow_natives_syntax = true; v8::Local<v8::Value> res = CompileRun("var o = { valueOf: function() { %DebugTrace() } }; o;"); Handle<JSReceiver> param(v8::Utils::OpenHandle(v8::Object::Cast(*res))); Handle<Object> args[] = { param, isolate->factory()->NewNumber(2), isolate->factory()->NewNumber(3), isolate->factory()->NewNumber(4), isolate->factory()->NewNumber(5), isolate->factory()->NewNumber(6), isolate->factory()->NewNumber(21)}; USE(Execution::Call(isolate, jsfunc, undefined, arraysize(args), args)); }
https://codereview.chromium.org/2639163004/diff/20001/src/ffi/ffi-compiler.cc File src/ffi/ffi-compiler.cc (right): https://codereview.chromium.org/2639163004/diff/20001/src/ffi/ffi-compiler.cc... src/ffi/ffi-compiler.cc:41: return SmiFromWord32(node); On 2017/01/19 11:37:58, Michael Starzinger wrote: > On 32-bit architectures the payload of a Smi is a 31-bit signed integer. That > means int32_t cannot always be encoded as a Smi. Please make sure to run your > tests on a 32-bit architecture (e.g. ia32 or arm) as well. What you want here > instead is ChangeInt32ToTagged I think. That makes sense, thanks! https://codereview.chromium.org/2639163004/diff/20001/src/ffi/ffi-compiler.cc... src/ffi/ffi-compiler.cc:110: Code::ComputeFlags(Code::FUNCTION), "js-to-native"); On 2017/01/19 12:30:49, Michael Starzinger wrote: > Unrelated to this change, but still important (feel free to fix in a separate > CL): Marking the code objects as kind {FUNCTION} is dangerous. This instructs > the stack-walker to treat it as a full-codegen frame where all stack slots are > considered tagged. This does not hold for the frames at hand. I would advise to > use {BUILTIN} instead. The problem can be reproduced with the following > modification to the {Run_FFI_add7} test case: > > { > FLAG_allow_natives_syntax = true; > v8::Local<v8::Value> res = > CompileRun("var o = { valueOf: function() { %DebugTrace() } }; o;"); > Handle<JSReceiver> param(v8::Utils::OpenHandle(v8::Object::Cast(*res))); > Handle<Object> args[] = { > param, isolate->factory()->NewNumber(2), > isolate->factory()->NewNumber(3), isolate->factory()->NewNumber(4), > isolate->factory()->NewNumber(5), isolate->factory()->NewNumber(6), > isolate->factory()->NewNumber(21)}; > USE(Execution::Call(isolate, jsfunc, undefined, arraysize(args), args)); > } Thanks for catching this. I'll open a new CL to fix.
On 2017/01/19 18:19:55, mattloring wrote: > https://codereview.chromium.org/2639163004/diff/20001/src/ffi/ffi-compiler.cc > File src/ffi/ffi-compiler.cc (right): > > https://codereview.chromium.org/2639163004/diff/20001/src/ffi/ffi-compiler.cc... > src/ffi/ffi-compiler.cc:41: return SmiFromWord32(node); > On 2017/01/19 11:37:58, Michael Starzinger wrote: > > On 32-bit architectures the payload of a Smi is a 31-bit signed integer. That > > means int32_t cannot always be encoded as a Smi. Please make sure to run your > > tests on a 32-bit architecture (e.g. ia32 or arm) as well. What you want here > > instead is ChangeInt32ToTagged I think. > > That makes sense, thanks! > > https://codereview.chromium.org/2639163004/diff/20001/src/ffi/ffi-compiler.cc... > src/ffi/ffi-compiler.cc:110: Code::ComputeFlags(Code::FUNCTION), > "js-to-native"); > On 2017/01/19 12:30:49, Michael Starzinger wrote: > > Unrelated to this change, but still important (feel free to fix in a separate > > CL): Marking the code objects as kind {FUNCTION} is dangerous. This instructs > > the stack-walker to treat it as a full-codegen frame where all stack slots are > > considered tagged. This does not hold for the frames at hand. I would advise > to > > use {BUILTIN} instead. The problem can be reproduced with the following > > modification to the {Run_FFI_add7} test case: > > > > { > > FLAG_allow_natives_syntax = true; > > v8::Local<v8::Value> res = > > CompileRun("var o = { valueOf: function() { %DebugTrace() } }; o;"); > > Handle<JSReceiver> param(v8::Utils::OpenHandle(v8::Object::Cast(*res))); > > Handle<Object> args[] = { > > param, isolate->factory()->NewNumber(2), > > isolate->factory()->NewNumber(3), isolate->factory()->NewNumber(4), > > isolate->factory()->NewNumber(5), isolate->factory()->NewNumber(6), > > isolate->factory()->NewNumber(21)}; > > USE(Execution::Call(isolate, jsfunc, undefined, arraysize(args), args)); > > } > > Thanks for catching this. I'll open a new CL to fix. Actually, just going to fix that in this CL.
LGTM from my end.
https://codereview.chromium.org/2639163004/diff/60001/test/cctest/ffi/test-ff... File test/cctest/ffi/test-ffi.cc (right): https://codereview.chromium.org/2639163004/diff/60001/test/cctest/ffi/test-ff... test/cctest/ffi/test-ffi.cc:197: CompileRun("var o = { valueOf: function() { %DebugTrace() } }; o;"); nit: You could even add a "return 1" into the "valueOf" function after the "%DebugTrace" and then check the return value down below in line 206 similar to the other methods. Just for additional checking.
https://codereview.chromium.org/2639163004/diff/60001/test/cctest/ffi/test-ff... File test/cctest/ffi/test-ffi.cc (right): https://codereview.chromium.org/2639163004/diff/60001/test/cctest/ffi/test-ff... test/cctest/ffi/test-ffi.cc:197: CompileRun("var o = { valueOf: function() { %DebugTrace() } }; o;"); On 2017/01/20 09:14:21, Michael Starzinger wrote: > nit: You could even add a "return 1" into the "valueOf" function after the > "%DebugTrace" and then check the return value down below in line 206 similar to > the other methods. Just for additional checking. Done.
The CQ bit was checked by mattloring@google.com 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_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_arm64_rel_ng_triggered on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_linux_arm64_rel_ng_trigg...)
The CQ bit was checked by mattloring@google.com 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_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_arm64_rel_ng_triggered on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_linux_arm64_rel_ng_trigg...)
Patchset #6 (id:100001) has been deleted
On 2017/01/20 18:12:51, mattloring wrote: > https://codereview.chromium.org/2639163004/diff/60001/test/cctest/ffi/test-ff... > File test/cctest/ffi/test-ffi.cc (right): > > https://codereview.chromium.org/2639163004/diff/60001/test/cctest/ffi/test-ff... > test/cctest/ffi/test-ffi.cc:197: CompileRun("var o = { valueOf: function() { > %DebugTrace() } }; o;"); > On 2017/01/20 09:14:21, Michael Starzinger wrote: > > nit: You could even add a "return 1" into the "valueOf" function after the > > "%DebugTrace" and then check the return value down below in line 206 similar > to > > the other methods. Just for additional checking. > > Done. I am in the process of trying to get access to an Arm machine to debug this. If anyone has thoughts on these failures that would be helpful as well.
On 2017/01/20 21:23:03, mattloring wrote: > On 2017/01/20 18:12:51, mattloring wrote: > > > https://codereview.chromium.org/2639163004/diff/60001/test/cctest/ffi/test-ff... > > File test/cctest/ffi/test-ffi.cc (right): > > > > > https://codereview.chromium.org/2639163004/diff/60001/test/cctest/ffi/test-ff... > > test/cctest/ffi/test-ffi.cc:197: CompileRun("var o = { valueOf: function() { > > %DebugTrace() } }; o;"); > > On 2017/01/20 09:14:21, Michael Starzinger wrote: > > > nit: You could even add a "return 1" into the "valueOf" function after the > > > "%DebugTrace" and then check the return value down below in line 206 similar > > to > > > the other methods. Just for additional checking. > > > > Done. > > I am in the process of trying to get access to an Arm machine to debug this. If > anyone has thoughts on these failures that would be helpful as well. You don't need ARM hardware to reproduce this, just running the V8-internal simulator is good enough. If you compile the "arm.debug" configuration on your machine, it will automatically run all generated code through the simulator. In fact, the try-jobs do exactly the same. I can reproduce the issue at hand locally just fine.
The CQ bit was checked by mattloring@google.com 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.
On 2017/01/23 13:20:29, Michael Starzinger wrote: > On 2017/01/20 21:23:03, mattloring wrote: > > On 2017/01/20 18:12:51, mattloring wrote: > > > > > > https://codereview.chromium.org/2639163004/diff/60001/test/cctest/ffi/test-ff... > > > File test/cctest/ffi/test-ffi.cc (right): > > > > > > > > > https://codereview.chromium.org/2639163004/diff/60001/test/cctest/ffi/test-ff... > > > test/cctest/ffi/test-ffi.cc:197: CompileRun("var o = { valueOf: function() { > > > %DebugTrace() } }; o;"); > > > On 2017/01/20 09:14:21, Michael Starzinger wrote: > > > > nit: You could even add a "return 1" into the "valueOf" function after the > > > > "%DebugTrace" and then check the return value down below in line 206 > similar > > > to > > > > the other methods. Just for additional checking. > > > > > > Done. > > > > I am in the process of trying to get access to an Arm machine to debug this. > If > > anyone has thoughts on these failures that would be helpful as well. > > You don't need ARM hardware to reproduce this, just running the V8-internal > simulator is good enough. If you compile the "arm.debug" configuration on your > machine, it will automatically run all generated code through the simulator. In > fact, the try-jobs do exactly the same. I can reproduce the issue at hand > locally just fine. Things are fixed on arm. It looks like the simulator for arm does not support calls with more than 6 arguments. Is this expected or an error on my end?
The CQ bit was checked by mattloring@google.com
The patchset sent to the CQ was uploaded after l-g-t-m from ofrobots@google.com, mstarzinger@chromium.org Link to the patchset: https://codereview.chromium.org/2639163004/#ps120001 (title: "Arm fixes")
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": 120001, "attempt_start_ts": 1485215444314480, "parent_rev": "6eba6b4b89db81bc359dc041c62d1277f24bb8d4", "commit_rev": "a5913c9a8ec0460c050d10d6d158afc7f23898ad"}
Message was sent while issue was closed.
Description was changed from ========== [ffi] Translation + test for int32 Also introduces FFIType separate from MachineType for express ffi signatures. BUG=v8:4456 ========== to ========== [ffi] Translation + test for int32 Also introduces FFIType separate from MachineType for express ffi signatures. BUG=v8:4456 Review-Url: https://codereview.chromium.org/2639163004 Cr-Commit-Position: refs/heads/master@{#42612} Committed: https://chromium.googlesource.com/v8/v8/+/a5913c9a8ec0460c050d10d6d158afc7f23... ==========
Message was sent while issue was closed.
Committed patchset #6 (id:120001) as https://chromium.googlesource.com/v8/v8/+/a5913c9a8ec0460c050d10d6d158afc7f23... |