treewide: rename to src/

This commit is contained in:
2024-06-20 15:16:49 +08:00
parent d396b0d24d
commit e9fd3de6c5
15 changed files with 60 additions and 14 deletions

View File

@@ -6,7 +6,7 @@
* @returns A tuple containing the indices representing the binary search state: [begin, half, end].
*/
export function binSearch(begin: number, end: number, beforeHalf: boolean[]): [number, number, number] {
const gHalf = () => { return Math.floor((end - begin) / 2) + begin; }
const gHalf = () => { return Math.floor((end - begin) / 2) + begin; };
for (const pred of beforeHalf) {
const half = gHalf();

View File

@@ -2,4 +2,4 @@ import { LLVM_SRC } from "./environment";
import { buildLLVMHash } from "./build/llvmPackages";
buildLLVMHash(LLVM_SRC, "31c8e21f40ea654f9d49b3a926acc6ef1f2ca5d5");
buildLLVMHash(LLVM_SRC, "e201a0b21b8933b7df79d5cfca2c1e89348aad1f");

View File

@@ -1,8 +1,8 @@
import path from "path";
import { GeneralVariable, LLVMVariable, command, variable } from "commands/cmake";
import { SYSROOT_PREFIX } from "environment";
import { GeneralVariable, LLVMVariable, command, variable } from "lyc/commands/cmake";
import { SYSROOT_PREFIX } from "lyc/environment";
import { PackageTask, buildPackage } from "./build";
import { checkedSpawnSync } from "cli";
import { checkedSpawnSync } from "lyc/cli";
import os from "os";
import { SpawnOptions, spawn } from "child_process";

View File

View File

@@ -1,14 +1,14 @@
import { spawn } from "child_process";
import { promisifySpawn } from "cli";
import { runcpuOptions } from "commands/spec";
import { systemdRunOptions } from "commands/systemd";
import { LLVM_INSTALL } from "environment";
import { promisifySpawn } from "lyc/cli";
import { runcpuOptions } from "lyc/commands/spec";
import { systemdRunOptions } from "lyc/commands/systemd";
import { LLVM_INSTALL } from "lyc/environment";
import path from "path";
import { defaultSPEC, renderConfig } from "spec";
import { defaultSPEC, renderConfig } from "lyc/spec";
(async () => {
const llvmHash = "31c8e21f40ea654f9d49b3a926acc6ef1f2ca5d5";
const llvmHash = "31c8e21f40ea654f9d49b3a926acc6ef1f2ca5d5"; // ipa-pure-const.c
const llvmPrefix = path.join(LLVM_INSTALL, llvmHash);
const config = `clang-O2-${llvmHash}.cfg`;

View File

@@ -3,6 +3,10 @@ import * as fs from "fs";
import { promisify } from "util";
import { SW_AUTOVEC } from "./environment";
import { spec } from 'node:test/reporters';
import { ChildProcess, ChildProcessByStdio } from 'child_process';
import { Readable, Writable } from 'stream';
import { Readline } from 'readline/promises';
import { createInterface } from 'readline';
export interface SPECBenchData {
objectNames: string[];
@@ -419,3 +423,41 @@ export function renderConfig(options: ConfigOptions) {
.replace("@@GCCDIR@@", options.gccdir)
.replace("@@OPTIMIZE@@", options.optimize);
}
interface SPECResult {
format: string;
paths: string[];
}
/**
* Monitor SPEC2017 runcpu process in a subprocess.
*/
export async function watchSPEC<T extends ChildProcessByStdio<null | Writable, Readable, Readable>>(process: T) {
const rl = createInterface({
input: process.stdout,
terminal: false,
});
// Match & extract string like " format CSV -> /path/to/csv"
const formatRe = /^\s*format:\s*(\w+)\s*->\s*(.*)$/;
return await new Promise<SPECResult[]>((resolve, reject) => {
let results: SPECResult[] = [];
rl.on("line", line => {
let match;
if ((match = formatRe.exec(line)) != null) {
const type = match[1];
const paths = match[2].split(',').map(path => path.trim());
results.push({
format: type,
paths: paths,
});
}
// To match if the line contains: "runcpu finished
if (line.startsWith("runcpu finished")) {
resolve(results);
}
});
});
}

View File

@@ -25,8 +25,12 @@
"module": "commonjs", /* Specify what module code is generated. */
// "rootDir": "./", /* Specify the root folder within your source files. */
// "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
"baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
"paths": {
"lyc/*": [
"./src/*"
]
}, /* Specify a set of entries that re-map imports to additional lookup locations. */
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
@@ -50,7 +54,7 @@
"sourceMap": true, /* Create source map files for emitted JavaScript files. */
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
"outDir": "out", /* Specify an output folder for all emitted files. */
"outDir": "out/lyc", /* Specify an output folder for all emitted files. */
// "removeComments": true, /* Disable emitting comments. */
// "noEmit": true, /* Disable emitting files from a compilation. */
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */