Status: Untriaged
Owner: ----
Type: Bug
New issue 13105 by baghd...@
ca.ibm.com: V8: add support for z/OS
https://bugs.chromium.org/p/v8/issues/detail?id=13105Version: aee4f59521
OS: z/OS
Architecture: s390x
The following changes are required to build V8 on z/OS s390x platform.
These changes will be added on top of the currently supported s390 port of V8;
we will not be adding a new simulator under the V8 CI
https://ci.chromium.org/p/v8/g/ports/.
All changes are guarded by V8_OS_ZOS or __MVS__, except in sampler.cc, and the
moving of macros from assembler-s390.h to constants-s390.h, as described below.
Otherwise the z/OS changes will be invisible to the s390x on Linux and the s390x
simulator and any other platform, and will only affect native z/OS on s390x.
This is similar to how AIX support was added to the PowerPC port of V8.
Changes include:
1) Download dependency and build:
a) DEPS
- Download dependency
https://github.com/ibmruntimes/zoslib into
third_party/zoslib.
b) BUILD.gn
- Build zoslib, exclude NA source and compiler options, and add
z/OS-specific source files to the build.
2) Define macros, constants and includes:
a) include/v8config.h
- Include zos-base.h and define V8_OS_ZOS, V8_OS_STRING, and
V8_OS_POSIX; zos-base.h is from third_party/zoslib/.
b) src/common/globals.h
- Define V8_DEFAULT_STACK_SIZE_KB and remove sanity-check for the 1MB
stack size limit, as 2MB stack size is used on z/OS.
c) src/flags/flag-definitions.h
- Don't force crash on abort, as it may cause further LE abends during
error handling/stack walking.
d) src/d8/d8-posix.cc
- Exclude NA header.
3) Platform:
a) src/base/platform/platform-posix.cc
- Implement GetRandomMmapAddr() and GetCurrentThreadId().
- Set stack size before starting thread.
- Change for pthread_t being a struct, not int.
- Exclude NA static functions and headers.
b) src/base/platform/platform-zos.cc
- New file, implements MemoryMappedFile class, OS::FOpen(), OS::Allocate(),
OS::Free(), etc.
c) src/heap/base/asm/zos/push_registers_asm.cc
- New file, implements PushAllRegistersAndIterateStack() for z/OS.
d) src/base/debug/stack_trace_zos.cc:
- New file, implements StackTrace class methods and stack dumping
signals thread and handler for z/OS.
e) src/base/platform/time.cc
- Use clock_gettime() in ClockNow(), and ClockNow() in ThreadTicks::Now().
- Return true in ThreadTicks::IsSupported().
f) src/base/sys-info.cc
- Implement NumberOfProcessors() and AmountOfPhysicalMemory() using API from zoslib.
g) src/utils/allocation.cc
- Implement AlignedAllocInternal(), AlignedFree() and ByteReverse16|32|64().
h) src/heap/spaces.cc
src/heap/large-spaces.cc
- Skip shrinkage on z/OS as it doesn't support partial frees.
4) Snapshot:
a) src/snapshot/embedded/embedded-file-writer.cc
a) src/snapshot/embedded/embedded-file-writer.h
- Update WriteBinaryContentsAsInlineAssembly() so a line doesn't exceed
the max length of 72, a z/OS requirement for HLASM, and define
DeclareLabelProlog() and DeclareLabelEpilogue() for the embedded blob
code and data symbols.
b) src/snapshot/embedded/platform-embedded-file-writer-zos.cc
src/snapshot/embedded/platform-embedded-file-writer-zos.h
- New files, implements embedded file writer for z/OS.
c) src/snapshot/embedded/platform-embedded-file-writer-base.h
src/snapshot/embedded/platform-embedded-file-writer-base.cc
- Include src/snapshot/embedded/platform-embedded-file-writer-zos.h,
define EmbeddedTargetOs::kZOS and update
NewPlatformEmbeddedFileWriter() if embedded target is z/OS.
5) Codegen:
a) src/codegen/s390/constants-s390.h
src/codegen/s390/macro-assembler-s390.cc
src/codegen/s390/macro-assembler-s390.h
src/codegen/s390/register-s390.h
src/codegen/s390/assembler-s390.cc
src/codegen/s390/assembler-s390.h
src/compiler/backend/s390/code-generator-s390.cc
- Call JS code using a function descriptor as required on z/OS.
- Support XPLINK ABI in builtins for z/OS; shuffle XPLINK arguments
coming from C to JS arguments. Add support for calling z/OS XPLINK
C/C++ from JS codegen.
- Enable support for native regexp codegen for z/OS. Arguments are
shuffled from z/OS XPLINK ABI to LoZ ABI on function entry and vice
versa on return.
- Implement supportsCPUFeature(), supportsSTFLE() and ProbeImpl().
- Handle nop pseudo instructions for basr, bras, brasl call types.
- Move define of ABI_USES_FUNCTION_DESCRIPTORS (1 for z/OS, 0 LoZ) and
related macros from assembler-s390.h to constants-s390.h, so that
for z/OS they're defined when checked, as in simulator.h
(which includes simulator-s390.h that includes constants-s390.h).
b) src/diagnostics/objects-debug.cc
- Don't check for instruction start alignment, as no code alignment is
required on z/OS. The start of each function and labels are aligned
on a half-word binary.
6) Execution:
a) src/execution/execution.cc
- Save LE stack pointer to restore on signal while in JS.
b) src/execution/isolate.cc
- Allow more overflow stack space as z/OS XPLINK uses larger frames.
- Ensure thread has enough stack guard.
c) src/execution/simulator.h
- Create a pseudo function descriptor to ensure correct dispatch to
generated code.
7) Regexp:
a) src/regexp/s390/regexp-macro-assembler-s390.cc
- Enable regexp support:
- Add support for native regexp codegen.
- Shuffle arguments from z/OS XPLINK ABI to LoZ ABI on function
entry and vice versa on return.
- Don't inline LoadCurrentCharacterUnchecked() due to a runtime
error, revisit when clang compiler is available.
8) Builtins:
a) src/builtins/s390/builtins-s390.cc
- Add support for XPLINK ABI in builtins:
- Add support for shuffling XPLINK arguments coming from C to JS.
- Add support for calling z/OS XPLINK C/C++ from JS codegen.
9) Adjust for pthread_t being a struct (not int):
a) src/base/platform/platform.h
src/libsampler/sampler.h
10) libsampler:
a) src/libsampler/sampler.cc
- Implement FillRegisterState() to set the state's registers (pc, sp,
fp, lr) with the given context in the signal handler.
- Adjust for pthread_t being a struct (not int);
this change adds an inline ThreadKey() and applies on all
platforms; not guarded so as not to clutter the code with #if/#else.
11) tools:
a) tools/testrunner/local/statusfile.py
- Add "zos" to VARIABLES.
b) tools/testrunner/local/utils.py
- Return "zos" in GuessOS() if platform.system() is "OS/390"
- Uupdate IsS390SimdSupported() to return true on z13 or higher.
12) test:
a) test/cctest/cctest-utils.h
- Define GET_STACK_POINTER_TO(sp_addr) macro for z/OS.
13) Misc:
a) src/base/platform/semaphore.h
- Include zos-semaphore.h to use semaphore functions from zoslib.
b) src/compiler/code-assembler.h
src/compiler/linkage.h
src/compiler/raw-machine-assembler.h
- Contains only updates to comments related to function descriptors.
--
You received this message because:
1. The project was configured to send all issue notifications to this address
You may adjust your notification preferences at:
https://bugs.chromium.org/hosting/settings