Skip to content

Commit c940bd8

Browse files
Milad FarazmandCommit Bot
authored andcommitted
PPC: Fix offset calculation on AIX when not using a
function descriptor Change-Id: I439bac759cb363f35f6aa23a699b6ef1d9079684 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1925027 Reviewed-by: Junliang Yan <jyan@ca.ibm.com> Commit-Queue: Milad Farazmand <miladfar@ca.ibm.com> Cr-Commit-Position: refs/heads/master@{#65052}
1 parent e927764 commit c940bd8

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

src/codegen/ppc/macro-assembler-ppc.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1940,6 +1940,7 @@ void TurboAssembler::CallCFunctionHelper(Register function,
19401940
LoadP(ip, MemOperand(function, 0));
19411941
dest = ip;
19421942
} else if (ABI_CALL_VIA_IP) {
1943+
// pLinux and Simualtor, not AIX
19431944
Move(ip, function);
19441945
dest = ip;
19451946
}

src/compiler/backend/ppc/code-generator-ppc.cc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,17 +1031,18 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
10311031
Label start_call;
10321032
bool isWasmCapiFunction =
10331033
linkage()->GetIncomingDescriptor()->IsWasmCapiFunction();
1034+
int offset = 9 * kInstrSize;
10341035
#if defined(_AIX)
10351036
// AIX/PPC64BE Linux uses a function descriptor
10361037
int kNumParametersMask = kHasFunctionDescriptorBitMask - 1;
10371038
num_parameters = kNumParametersMask & misc_field;
10381039
has_function_descriptor =
10391040
(misc_field & kHasFunctionDescriptorBitMask) != 0;
1040-
// AIX emits 2 extra Load instructions under CallCFunctionHelper
1041+
// AIX may emit 2 extra Load instructions under CallCFunctionHelper
10411042
// due to having function descriptor.
1042-
constexpr int offset = 11 * kInstrSize;
1043-
#else
1044-
constexpr int offset = 9 * kInstrSize;
1043+
if (has_function_descriptor) {
1044+
offset = 11 * kInstrSize;
1045+
}
10451046
#endif
10461047
if (isWasmCapiFunction) {
10471048
__ mflr(r0);

0 commit comments

Comments
 (0)