chromium: triage mksnapshot
This commit is contained in:
10
src/chromium/mksnapshot.ts
Normal file
10
src/chromium/mksnapshot.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* Wuxi reported "mksnapshot" is errorneous (RE, segmantation fault).
|
||||
* This file addresses this issue.
|
||||
*/
|
||||
|
||||
|
||||
import path from 'path';
|
||||
import * as chromium from '../chromium.js'
|
||||
|
||||
export const dir = path.resolve(chromium.dir, 'mksnapshot')
|
||||
148
src/chromium/mksnapshot/compile-schedule.ts
Normal file
148
src/chromium/mksnapshot/compile-schedule.ts
Normal file
@@ -0,0 +1,148 @@
|
||||
import path from 'path';
|
||||
import { lycEnv } from '../../environment/index.js';
|
||||
import { llvmToolchain } from '../../toolchain/index.js';
|
||||
import { promisifySpawn } from '../../cli.js';
|
||||
import { spawn } from 'child_process';
|
||||
import { dir } from '../mksnapshot.js';
|
||||
import * as compiler from '../../commands/compiler.js';
|
||||
|
||||
|
||||
const hash = '7081b8371ae6460baabc370de4570ebd7e67f923';
|
||||
|
||||
const envToolchain = (hash: string) => llvmToolchain(path.resolve(lycEnv.sharedLLVMInstall, hash));
|
||||
const toolchain = envToolchain(hash);
|
||||
|
||||
const args = [
|
||||
"-DUSE_UDEV",
|
||||
"-DUSE_AURA=1",
|
||||
"-DUSE_GLIB=1",
|
||||
"-DUSE_OZONE=1",
|
||||
"-D__STDC_CONSTANT_MACROS",
|
||||
"-D__STDC_FORMAT_MACROS",
|
||||
"-D_FORTIFY_SOURCE=2",
|
||||
"-D_FILE_OFFSET_BITS=64",
|
||||
"-D_LARGEFILE_SOURCE",
|
||||
"-D_LARGEFILE64_SOURCE",
|
||||
"-D_GNU_SOURCE",
|
||||
"-D_LIBCPP_ABI_UNSTABLE",
|
||||
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
|
||||
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
|
||||
"-D_LIBCPP_ENABLE_NODISCARD",
|
||||
"-DCR_LIBCXX_REVISION=79a2e924d96e2fc1e4b937c42efd08898fa472d7",
|
||||
"-DNDEBUG",
|
||||
"-DNVALGRIND",
|
||||
"-DDYNAMIC_ANNOTATIONS_ENABLED=0",
|
||||
"-DV8_TYPED_ARRAY_MAX_SIZE_IN_HEAP=64",
|
||||
"-DV8_INTL_SUPPORT",
|
||||
"-DV8_USE_EXTERNAL_STARTUP_DATA",
|
||||
"-DV8_ATOMIC_OBJECT_FIELD_WRITES",
|
||||
"-DV8_ENABLE_LAZY_SOURCE_POSITIONS",
|
||||
"-DV8_SHARED_RO_HEAP",
|
||||
"-DV8_WIN64_UNWINDING_INFO",
|
||||
"-DV8_ENABLE_REGEXP_INTERPRETER_THREADED_DISPATCH",
|
||||
"-DV8_ENABLE_WEBASSEMBLY",
|
||||
"-DV8_ALLOCATION_FOLDING",
|
||||
"-DV8_ALLOCATION_SITE_TRACKING",
|
||||
"-DV8_ADVANCED_BIGINT_ALGORITHMS",
|
||||
"-DV8_DEPRECATION_WARNINGS",
|
||||
"-DV8_TARGET_ARCH_SW64",
|
||||
"-DSW64",
|
||||
"-DV8_HAVE_TARGET_OS",
|
||||
"-DV8_TARGET_OS_LINUX",
|
||||
"-DU_USING_ICU_NAMESPACE=0",
|
||||
"-DU_ENABLE_DYLOAD=0",
|
||||
"-DUSE_CHROMIUM_ICU=1",
|
||||
"-DU_ENABLE_TRACING=1",
|
||||
"-DU_ENABLE_RESOURCE_TRACING=0",
|
||||
"-DU_STATIC_IMPLEMENTATION",
|
||||
"-DICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_FILE",
|
||||
"-Wall",
|
||||
"-Wextra",
|
||||
"-Wimplicit-fallthrough",
|
||||
"-Wunreachable-code-aggressive",
|
||||
"-Wthread-safety",
|
||||
"-Wno-missing-field-initializers",
|
||||
"-Wno-unused-parameter",
|
||||
"-Wloop-analysis",
|
||||
"-Wno-unneeded-internal-declaration",
|
||||
"-Wenum-compare-conditional",
|
||||
"-Wno-psabi",
|
||||
"-Wno-ignored-pragma-optimize",
|
||||
"-Wno-unqualified-std-cast-call",
|
||||
"-Wno-deprecated-non-prototype",
|
||||
"-Wshadow",
|
||||
"-fno-delete-null-pointer-checks",
|
||||
"-fno-ident",
|
||||
"-fno-strict-aliasing",
|
||||
"--param=ssp-buffer-size=4",
|
||||
"-fstack-protector",
|
||||
"-funwind-tables",
|
||||
"-fPIC",
|
||||
"-pthread",
|
||||
"-fcolor-diagnostics",
|
||||
"-fmerge-all-constants",
|
||||
"-mllvm",
|
||||
"-instcombine-lower-dbg-declare=0",
|
||||
"-ffp-contract=off",
|
||||
"-fcomplete-member-pointers",
|
||||
"-Wno-builtin-macro-redefined",
|
||||
"-D__DATE__=",
|
||||
"-D__TIME__=",
|
||||
"-D__TIMESTAMP__=",
|
||||
"-ffile-compilation-dir=.",
|
||||
"-no-canonical-prefixes",
|
||||
"-fno-omit-frame-pointer",
|
||||
"-g0",
|
||||
"-Wheader-hygiene",
|
||||
"-Wstring-conversion",
|
||||
"-Wtautological-overlap-compare",
|
||||
"-Wmissing-field-initializers",
|
||||
"-Wno-shadow",
|
||||
"-Wunreachable-code",
|
||||
"-O3",
|
||||
"-fdata-sections",
|
||||
"-ffunction-sections",
|
||||
"-fvisibility=default",
|
||||
"-Wexit-time-destructors",
|
||||
"-std=c++17",
|
||||
"-Wno-trigraphs",
|
||||
"-fno-aligned-new",
|
||||
"-fno-exceptions",
|
||||
"-fno-rtti",
|
||||
];
|
||||
|
||||
// Two processes, true/false simd settings.
|
||||
const simdCompareProcesses = [true, false].map(simd => spawn(
|
||||
toolchain.CXX,
|
||||
[
|
||||
// Input file
|
||||
path.resolve(dir, 'mksnapshot-schedule', 'error', 'schedule.i'),
|
||||
// Fixed arguments.
|
||||
...args,
|
||||
'-emit-llvm',
|
||||
'-fno-discard-value-names',
|
||||
...compiler.generalCommand({
|
||||
output: '-',
|
||||
outputKind: 'object',
|
||||
}),
|
||||
...compiler.sw64TargetOptions({ simd }),
|
||||
]
|
||||
));
|
||||
|
||||
// For each LLVM bitfile output, create a process to extract "_ZN2v88internal8compiler10BasicBlock18GetCommonDominatorEPS2_S3_"
|
||||
const extractProcesses = simdCompareProcesses.map((x, index) => {
|
||||
const functionName = "_ZN2v88internal8compiler10BasicBlock18GetCommonDominatorEPS2_S3_";
|
||||
const extract = spawn(toolchain.LLVM_EXTRACT, [
|
||||
...compiler.extractCommand({
|
||||
func: [functionName],
|
||||
input: "-",
|
||||
output: path.resolve(dir, `${index}.ll`),
|
||||
asm: true,
|
||||
})
|
||||
]);
|
||||
x.stdout.pipe(extract.stdin);
|
||||
return extract;
|
||||
});
|
||||
|
||||
|
||||
await Promise.all([...extractProcesses, ...simdCompareProcesses].map(promisifySpawn));
|
||||
21
src/chromium/mksnapshot/decompress.ts
Normal file
21
src/chromium/mksnapshot/decompress.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* Decompress the tarball for mksnapshot.
|
||||
*/
|
||||
|
||||
import { spawn } from 'child_process';
|
||||
import path from 'path';
|
||||
import { dir } from '../mksnapshot.js';
|
||||
import { promisifySpawn } from '../../cli.js';
|
||||
import { mkdir } from 'fs/promises';
|
||||
|
||||
const { HOME } = process.env;
|
||||
|
||||
|
||||
await mkdir(dir, { recursive: true });
|
||||
|
||||
await promisifySpawn(spawn('tar', [
|
||||
'-xvzf',
|
||||
path.resolve(HOME!, 'resources', 'mksnapshot_schedule.tar.gz'),
|
||||
'-C',
|
||||
dir
|
||||
]));
|
||||
Reference in New Issue
Block a user