Commit 344a4525 authored by Milad Fa's avatar Milad Fa Committed by V8 LUCI CQ

PPC/s390: Increase the number of args supported by the simulator to 20

Port 4de20cb1

Original Commit Message:

    This CL adds a minor change to the arm/arm64 simulators to support up to
    20 arguments in a C function call. This change is necessary for an
    upcoming CL which adds float support to the simulator and tests with
    more than 20 arguments, see
    https://chromium-review.googlesource.com/c/v8/v8/+/3060486

R=mslekova@chromium.org, joransiu@ca.ibm.com, junyan@redhat.com, midawson@redhat.com
BUG=
LOG=N

Change-Id: Ic3dabdcaa4982840466190003c56cfe82e91316b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3259652Reviewed-by: 's avatarJunliang Yan <junyan@redhat.com>
Reviewed-by: 's avatarMaya Lekova <mslekova@chromium.org>
Commit-Queue: Milad Fa <mfarazma@redhat.com>
Cr-Commit-Position: refs/heads/main@{#77691}
parent 2732cdb3
......@@ -927,16 +927,18 @@ static void decodeObjectPair(ObjectPair* pair, intptr_t* x, intptr_t* y) {
}
// Calls into the V8 runtime.
using SimulatorRuntimeCall = intptr_t (*)(intptr_t arg0, intptr_t arg1,
intptr_t arg2, intptr_t arg3,
intptr_t arg4, intptr_t arg5,
intptr_t arg6, intptr_t arg7,
intptr_t arg8, intptr_t arg9);
using SimulatorRuntimePairCall = ObjectPair (*)(intptr_t arg0, intptr_t arg1,
intptr_t arg2, intptr_t arg3,
intptr_t arg4, intptr_t arg5,
intptr_t arg6, intptr_t arg7,
intptr_t arg8, intptr_t arg9);
using SimulatorRuntimeCall = intptr_t (*)(
intptr_t arg0, intptr_t arg1, intptr_t arg2, intptr_t arg3, intptr_t arg4,
intptr_t arg5, intptr_t arg6, intptr_t arg7, intptr_t arg8, intptr_t arg9,
intptr_t arg10, intptr_t arg11, intptr_t arg12, intptr_t arg13,
intptr_t arg14, intptr_t arg15, intptr_t arg16, intptr_t arg17,
intptr_t arg18, intptr_t arg19);
using SimulatorRuntimePairCall = ObjectPair (*)(
intptr_t arg0, intptr_t arg1, intptr_t arg2, intptr_t arg3, intptr_t arg4,
intptr_t arg5, intptr_t arg6, intptr_t arg7, intptr_t arg8, intptr_t arg9,
intptr_t arg10, intptr_t arg11, intptr_t arg12, intptr_t arg13,
intptr_t arg14, intptr_t arg15, intptr_t arg16, intptr_t arg17,
intptr_t arg18, intptr_t arg19);
// These prototypes handle the four types of FP calls.
using SimulatorRuntimeCompareCall = int (*)(double darg0, double darg1);
......@@ -966,7 +968,7 @@ void Simulator::SoftwareInterrupt(Instruction* instr) {
(get_register(sp) & (::v8::internal::FLAG_sim_stack_alignment - 1)) ==
0;
Redirection* redirection = Redirection::FromInstruction(instr);
const int kArgCount = 10;
const int kArgCount = 20;
const int kRegisterArgCount = 8;
int arg0_regnum = 3;
intptr_t result_buffer = 0;
......@@ -987,7 +989,7 @@ void Simulator::SoftwareInterrupt(Instruction* instr) {
for (int i = kRegisterArgCount, j = 0; i < kArgCount; i++, j++) {
arg[i] = stack_pointer[kStackFrameExtraParamSlot + j];
}
STATIC_ASSERT(kArgCount == kRegisterArgCount + 2);
STATIC_ASSERT(kArgCount == kRegisterArgCount + 12);
STATIC_ASSERT(kMaxCParameters == kArgCount);
bool fp_call =
(redirection->type() == ExternalReference::BUILTIN_FP_FP_CALL) ||
......@@ -1163,9 +1165,14 @@ void Simulator::SoftwareInterrupt(Instruction* instr) {
"\t\t\t\targs %08" V8PRIxPTR ", %08" V8PRIxPTR ", %08" V8PRIxPTR
", %08" V8PRIxPTR ", %08" V8PRIxPTR ", %08" V8PRIxPTR
", %08" V8PRIxPTR ", %08" V8PRIxPTR ", %08" V8PRIxPTR
", %08" V8PRIxPTR,
", %08" V8PRIxPTR ", %08" V8PRIxPTR ", %08" V8PRIxPTR
", %08" V8PRIxPTR ", %08" V8PRIxPTR ", %08" V8PRIxPTR
", %08" V8PRIxPTR ", %08" V8PRIxPTR ", %08" V8PRIxPTR
", %08" V8PRIxPTR ", %08" V8PRIxPTR,
reinterpret_cast<void*>(FUNCTION_ADDR(target)), arg[0], arg[1],
arg[2], arg[3], arg[4], arg[5], arg[6], arg[7], arg[8], arg[9]);
arg[2], arg[3], arg[4], arg[5], arg[6], arg[7], arg[8], arg[9],
arg[10], arg[11], arg[12], arg[13], arg[14], arg[15], arg[16],
arg[17], arg[18], arg[19]);
if (!stack_aligned) {
PrintF(" with unaligned stack %08" V8PRIxPTR "\n",
get_register(sp));
......@@ -1176,8 +1183,10 @@ void Simulator::SoftwareInterrupt(Instruction* instr) {
if (redirection->type() == ExternalReference::BUILTIN_CALL_PAIR) {
SimulatorRuntimePairCall target =
reinterpret_cast<SimulatorRuntimePairCall>(external);
ObjectPair result = target(arg[0], arg[1], arg[2], arg[3], arg[4],
arg[5], arg[6], arg[7], arg[8], arg[9]);
ObjectPair result =
target(arg[0], arg[1], arg[2], arg[3], arg[4], arg[5], arg[6],
arg[7], arg[8], arg[9], arg[10], arg[11], arg[12], arg[13],
arg[14], arg[15], arg[16], arg[17], arg[18], arg[19]);
intptr_t x;
intptr_t y;
decodeObjectPair(&result, &x, &y);
......@@ -1207,8 +1216,10 @@ void Simulator::SoftwareInterrupt(Instruction* instr) {
redirection->type() == ExternalReference::FAST_C_CALL);
SimulatorRuntimeCall target =
reinterpret_cast<SimulatorRuntimeCall>(external);
intptr_t result = target(arg[0], arg[1], arg[2], arg[3], arg[4],
arg[5], arg[6], arg[7], arg[8], arg[9]);
intptr_t result =
target(arg[0], arg[1], arg[2], arg[3], arg[4], arg[5], arg[6],
arg[7], arg[8], arg[9], arg[10], arg[11], arg[12], arg[13],
arg[14], arg[15], arg[16], arg[17], arg[18], arg[19]);
if (::v8::internal::FLAG_trace_sim) {
PrintF("Returned %08" V8PRIxPTR "\n", result);
}
......
......@@ -1936,16 +1936,18 @@ static void decodeObjectPair(ObjectPair* pair, intptr_t* x, intptr_t* y) {
}
// Calls into the V8 runtime.
using SimulatorRuntimeCall = intptr_t (*)(intptr_t arg0, intptr_t arg1,
intptr_t arg2, intptr_t arg3,
intptr_t arg4, intptr_t arg5,
intptr_t arg6, intptr_t arg7,
intptr_t arg8, intptr_t arg9);
using SimulatorRuntimePairCall = ObjectPair (*)(intptr_t arg0, intptr_t arg1,
intptr_t arg2, intptr_t arg3,
intptr_t arg4, intptr_t arg5,
intptr_t arg6, intptr_t arg7,
intptr_t arg8, intptr_t arg9);
using SimulatorRuntimeCall = intptr_t (*)(
intptr_t arg0, intptr_t arg1, intptr_t arg2, intptr_t arg3, intptr_t arg4,
intptr_t arg5, intptr_t arg6, intptr_t arg7, intptr_t arg8, intptr_t arg9,
intptr_t arg10, intptr_t arg11, intptr_t arg12, intptr_t arg13,
intptr_t arg14, intptr_t arg15, intptr_t arg16, intptr_t arg17,
intptr_t arg18, intptr_t arg19);
using SimulatorRuntimePairCall = ObjectPair (*)(
intptr_t arg0, intptr_t arg1, intptr_t arg2, intptr_t arg3, intptr_t arg4,
intptr_t arg5, intptr_t arg6, intptr_t arg7, intptr_t arg8, intptr_t arg9,
intptr_t arg10, intptr_t arg11, intptr_t arg12, intptr_t arg13,
intptr_t arg14, intptr_t arg15, intptr_t arg16, intptr_t arg17,
intptr_t arg18, intptr_t arg19);
// These prototypes handle the four types of FP calls.
using SimulatorRuntimeCompareCall = int (*)(double darg0, double darg1);
......@@ -1975,7 +1977,7 @@ void Simulator::SoftwareInterrupt(Instruction* instr) {
(get_register(sp) & (::v8::internal::FLAG_sim_stack_alignment - 1)) ==
0;
Redirection* redirection = Redirection::FromInstruction(instr);
const int kArgCount = 10;
const int kArgCount = 20;
const int kRegisterArgCount = 5;
int arg0_regnum = 2;
intptr_t result_buffer = 0;
......@@ -1998,7 +2000,7 @@ void Simulator::SoftwareInterrupt(Instruction* instr) {
stack_pointer[(kCalleeRegisterSaveAreaSize / kSystemPointerSize) +
(i - kRegisterArgCount)];
}
STATIC_ASSERT(kArgCount == kRegisterArgCount + 5);
STATIC_ASSERT(kArgCount == kRegisterArgCount + 15);
STATIC_ASSERT(kMaxCParameters == kArgCount);
bool fp_call =
(redirection->type() == ExternalReference::BUILTIN_FP_FP_CALL) ||
......@@ -2177,9 +2179,14 @@ void Simulator::SoftwareInterrupt(Instruction* instr) {
"\t\t\t\targs %08" V8PRIxPTR ", %08" V8PRIxPTR ", %08" V8PRIxPTR
", %08" V8PRIxPTR ", %08" V8PRIxPTR ", %08" V8PRIxPTR
", %08" V8PRIxPTR ", %08" V8PRIxPTR ", %08" V8PRIxPTR
", %08" V8PRIxPTR,
", %08" V8PRIxPTR ", %08" V8PRIxPTR ", %08" V8PRIxPTR
", %08" V8PRIxPTR ", %08" V8PRIxPTR ", %08" V8PRIxPTR
", %08" V8PRIxPTR ", %08" V8PRIxPTR ", %08" V8PRIxPTR
", %08" V8PRIxPTR ", %08" V8PRIxPTR,
reinterpret_cast<void*>(FUNCTION_ADDR(target)), arg[0], arg[1],
arg[2], arg[3], arg[4], arg[5], arg[6], arg[7], arg[8], arg[9]);
arg[2], arg[3], arg[4], arg[5], arg[6], arg[7], arg[8], arg[9],
arg[10], arg[11], arg[12], arg[13], arg[14], arg[15], arg[16],
arg[17], arg[18], arg[19]);
if (!stack_aligned) {
PrintF(" with unaligned stack %08" V8PRIxPTR "\n",
static_cast<intptr_t>(get_register(sp)));
......@@ -2190,8 +2197,10 @@ void Simulator::SoftwareInterrupt(Instruction* instr) {
if (redirection->type() == ExternalReference::BUILTIN_CALL_PAIR) {
SimulatorRuntimePairCall target =
reinterpret_cast<SimulatorRuntimePairCall>(external);
ObjectPair result = target(arg[0], arg[1], arg[2], arg[3], arg[4],
arg[5], arg[6], arg[7], arg[8], arg[9]);
ObjectPair result =
target(arg[0], arg[1], arg[2], arg[3], arg[4], arg[5], arg[6],
arg[7], arg[8], arg[9], arg[10], arg[11], arg[12], arg[13],
arg[14], arg[15], arg[16], arg[17], arg[18], arg[19]);
intptr_t x;
intptr_t y;
decodeObjectPair(&result, &x, &y);
......@@ -2221,8 +2230,10 @@ void Simulator::SoftwareInterrupt(Instruction* instr) {
redirection->type() == ExternalReference::FAST_C_CALL);
SimulatorRuntimeCall target =
reinterpret_cast<SimulatorRuntimeCall>(external);
intptr_t result = target(arg[0], arg[1], arg[2], arg[3], arg[4],
arg[5], arg[6], arg[7], arg[8], arg[9]);
intptr_t result =
target(arg[0], arg[1], arg[2], arg[3], arg[4], arg[5], arg[6],
arg[7], arg[8], arg[9], arg[10], arg[11], arg[12], arg[13],
arg[14], arg[15], arg[16], arg[17], arg[18], arg[19]);
if (::v8::internal::FLAG_trace_sim) {
PrintF("Returned %08" V8PRIxPTR "\n", result);
}
......
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