Commit 4ae9075b authored by Milad Farazmand's avatar Milad Farazmand Committed by Commit Bot

PPC/s390: [wasm-c-api] Add tests and fixes

Port f72c844a

Original Commit Message:

    Port f5ab7d38

    Port 65f3861e

    Original Commit Message:

        In a new test suite: "wasm-api-tests", using a new binary "wasm_api_tests",
        powered by gtest/gmock (like unittests).
        Also fix a bunch of issues that these tests uncovered, mostly to ensure
        that the stack is walkable.

R=miladfar@ca.ibm.com, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com
BUG=
LOG=N

Change-Id: Id52e771fee79210d6c295cecf56a322657cf2b8f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1795864
Commit-Queue: Milad Farazmand <miladfar@ca.ibm.com>
Reviewed-by: 's avatarJunliang Yan <jyan@ca.ibm.com>
Cr-Commit-Position: refs/heads/master@{#63655}
parent 03c1b90f
......@@ -1024,7 +1024,13 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
Label start_call;
bool isWasmCapiFunction =
linkage()->GetIncomingDescriptor()->IsWasmCapiFunction();
#if defined(_AIX)
// AIX/PPC64BE Linux uses a function descriptor
// and emits 2 extra Load instrcutions under CallCFunctionHelper.
constexpr int offset = 11 * kInstrSize;
#else
constexpr int offset = 9 * kInstrSize;
#endif
if (isWasmCapiFunction) {
__ mflr(r0);
__ bind(&start_call);
......@@ -1043,9 +1049,10 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
}
// TODO(miladfar): In the above block, kScratchReg must be populated with
// the strictly-correct PC, which is the return address at this spot. The
// offset is set to 36 (9 * kInstrSize) right now, which is counted from
// where we are binding to the label and ends at this spot. If failed,
// replace it with the correct offset suggested. More info on f5ab7d3.
// offset is set to 36 (9 * kInstrSize) on pLinux and 44 on AIX, which is
// counted from where we are binding to the label and ends at this spot.
// If failed, replace it with the correct offset suggested. More info on
// f5ab7d3.
if (isWasmCapiFunction)
CHECK_EQ(offset, __ SizeOfCodeGeneratedSince(&start_call));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment