@colbymchenry/codegraph-win32-x64 1.3.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/dist/db/index.d.ts +17 -5
- package/lib/dist/db/index.d.ts.map +1 -1
- package/lib/dist/db/index.js +68 -12
- package/lib/dist/db/index.js.map +1 -1
- package/lib/dist/db/queries.d.ts +25 -1
- package/lib/dist/db/queries.d.ts.map +1 -1
- package/lib/dist/db/queries.js +39 -0
- package/lib/dist/db/queries.js.map +1 -1
- package/lib/dist/extraction/index.d.ts.map +1 -1
- package/lib/dist/extraction/index.js +84 -31
- package/lib/dist/extraction/index.js.map +1 -1
- package/lib/dist/index.d.ts.map +1 -1
- package/lib/dist/index.js +21 -3
- package/lib/dist/index.js.map +1 -1
- package/lib/dist/mcp/daemon.d.ts.map +1 -1
- package/lib/dist/mcp/daemon.js +23 -1
- package/lib/dist/mcp/daemon.js.map +1 -1
- package/lib/dist/mcp/proxy.d.ts.map +1 -1
- package/lib/dist/mcp/proxy.js +8 -0
- package/lib/dist/mcp/proxy.js.map +1 -1
- package/lib/dist/mcp/query-pool.d.ts +14 -0
- package/lib/dist/mcp/query-pool.d.ts.map +1 -1
- package/lib/dist/mcp/query-pool.js +18 -0
- package/lib/dist/mcp/query-pool.js.map +1 -1
- package/lib/dist/mcp/session.d.ts.map +1 -1
- package/lib/dist/mcp/session.js +6 -0
- package/lib/dist/mcp/session.js.map +1 -1
- package/lib/dist/mcp/tools.d.ts.map +1 -1
- package/lib/dist/mcp/tools.js +14 -9
- package/lib/dist/mcp/tools.js.map +1 -1
- package/lib/dist/mcp/transport.d.ts.map +1 -1
- package/lib/dist/mcp/transport.js +18 -0
- package/lib/dist/mcp/transport.js.map +1 -1
- package/lib/dist/resolution/c-fnptr-synthesizer.d.ts +2 -1
- package/lib/dist/resolution/c-fnptr-synthesizer.d.ts.map +1 -1
- package/lib/dist/resolution/c-fnptr-synthesizer.js +170 -146
- package/lib/dist/resolution/c-fnptr-synthesizer.js.map +1 -1
- package/lib/dist/resolution/callback-synthesizer.d.ts.map +1 -1
- package/lib/dist/resolution/callback-synthesizer.js +322 -93
- package/lib/dist/resolution/callback-synthesizer.js.map +1 -1
- package/lib/dist/resolution/goframe-synthesizer.d.ts +2 -1
- package/lib/dist/resolution/goframe-synthesizer.d.ts.map +1 -1
- package/lib/dist/resolution/goframe-synthesizer.js +8 -3
- package/lib/dist/resolution/goframe-synthesizer.js.map +1 -1
- package/lib/dist/resolution/index.d.ts +10 -0
- package/lib/dist/resolution/index.d.ts.map +1 -1
- package/lib/dist/resolution/index.js +55 -15
- package/lib/dist/resolution/index.js.map +1 -1
- package/lib/dist/resolution/types.d.ts +9 -0
- package/lib/dist/resolution/types.d.ts.map +1 -1
- package/lib/node_modules/.package-lock.json +1 -1
- package/lib/package.json +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../src/mcp/transport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAElC;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,KAAK,CAAC;IACf,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,KAAK,CAAC;IACf,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAC3B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,YAAY,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO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
|
+
const m = parsed;
|
|
156
|
+
process.stderr.write(`[mcp-debug] recv method=${m.method} id=${String(m.id)}\n`);
|
|
157
|
+
}
|
|
154
158
|
await this.messageHandler(parsed);
|
|
159
|
+
if (process.env.CODEGRAPH_MCP_DEBUG) {
|
|
160
|
+
const m = parsed;
|
|
161
|
+
process.stderr.write(`[mcp-debug] handled method=${m.method} id=${String(m.id)}\n`);
|
|
162
|
+
}
|
|
155
163
|
}
|
|
156
164
|
catch (err) {
|
|
157
165
|
const message = parsed;
|
|
@@ -292,7 +300,12 @@ class SocketTransport extends LineBasedJsonRpcTransport {
|
|
|
292
300
|
start(handler) {
|
|
293
301
|
this.messageHandler = handler;
|
|
294
302
|
this.socket.setEncoding('utf8');
|
|
303
|
+
if (process.env.CODEGRAPH_MCP_DEBUG) {
|
|
304
|
+
process.stderr.write(`[mcp-debug] transport attached flowing=${String(this.socket.readableFlowing)} buffered=${this.socket.readableLength}\n`);
|
|
305
|
+
}
|
|
295
306
|
this.socket.on('data', (chunk) => {
|
|
307
|
+
if (process.env.CODEGRAPH_MCP_DEBUG)
|
|
308
|
+
process.stderr.write(`[mcp-debug] transport data ${chunk.length}b\n`);
|
|
296
309
|
this.buffer += chunk;
|
|
297
310
|
let idx;
|
|
298
311
|
// Drain every complete line; tail-fragment stays in the buffer for the
|
|
@@ -312,6 +325,11 @@ class SocketTransport extends LineBasedJsonRpcTransport {
|
|
|
312
325
|
process.stderr.write(`[CodeGraph daemon] socket error: ${err.message}\n`);
|
|
313
326
|
this.handleSocketClose();
|
|
314
327
|
});
|
|
328
|
+
// The daemon's hello reader hands the socket over PAUSED (so the unshifted
|
|
329
|
+
// tail can't be emitted to zero listeners and lost — the #662 wedge).
|
|
330
|
+
// Attaching 'data' does not resume an explicitly-paused stream; do it here.
|
|
331
|
+
// Harmless when the socket was never paused.
|
|
332
|
+
this.socket.resume();
|
|
315
333
|
}
|
|
316
334
|
stop() {
|
|
317
335
|
if (this.stopped)
|
|
@@ -1 +1 @@
|
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,CAAC;IAES,QAAQ;QAChB,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAEO,iBAAiB;QACvB,IAAI,IAAI,CAAC,OAAO;YAAE,OAAO;QACzB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,IAAI,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC;QACpC,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;YACnC,IAAI,CAAC;gBAAC,CAAC,EAAE,CAAC;YAAC,CAAC;YAAC,MAAM,CAAC,CAAC,oDAAoD,CAAC,CAAC;QAC7E,CAAC;QACD,IAAI,CAAC,aAAa,GAAG,EAAE,CAAC;IAC1B,CAAC;CACF;AA5FD,0CA4FC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Edge } from '../types';
|
|
2
2
|
import type { QueryBuilder } from '../db/queries';
|
|
3
3
|
import type { ResolutionContext } from './types';
|
|
4
|
-
|
|
4
|
+
import type { MaybeYield } from './cooperative-yield';
|
|
5
|
+
export declare function cFnPointerDispatchEdges(_queries: QueryBuilder, ctx: ResolutionContext, onYield: MaybeYield): Promise<Edge[]>;
|
|
5
6
|
//# sourceMappingURL=c-fnptr-synthesizer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"c-fnptr-synthesizer.d.ts","sourceRoot":"","sources":["../../src/resolution/c-fnptr-synthesizer.ts"],"names":[],"mappings":"AAmDA,OAAO,KAAK,EAAE,IAAI,EAAQ,MAAM,UAAU,CAAC;AAC3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"c-fnptr-synthesizer.d.ts","sourceRoot":"","sources":["../../src/resolution/c-fnptr-synthesizer.ts"],"names":[],"mappings":"AAmDA,OAAO,KAAK,EAAE,IAAI,EAAQ,MAAM,UAAU,CAAC;AAC3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAgQtD,wBAAsB,uBAAuB,CAAC,QAAQ,EAAE,YAAY,EAAE,GAAG,EAAE,iBAAiB,EAAE,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,CAmqBlI"}
|
|
@@ -85,6 +85,7 @@ exports.cFnPointerDispatchEdges = cFnPointerDispatchEdges;
|
|
|
85
85
|
* key + a real-function gate; a project with no fn-pointer dispatch is a no-op.
|
|
86
86
|
*/
|
|
87
87
|
const path = __importStar(require("node:path"));
|
|
88
|
+
const lru_cache_1 = require("./lru-cache");
|
|
88
89
|
const strip_comments_1 = require("./strip-comments");
|
|
89
90
|
const C_CPP_EXT = /\.(c|h|cc|cpp|cxx|hpp|hh|hxx|cppm|ipp|inl|tcc)$/i;
|
|
90
91
|
const FN_KINDS = new Set(['function', 'method']);
|
|
@@ -337,13 +338,18 @@ const C_TYPE_KEYWORDS = new Set([
|
|
|
337
338
|
const INCLUDE_RE = /#[ \t]*include[ \t]+"([^"\n]+)"/g;
|
|
338
339
|
/** Included files worth scanning for registration tables (e.g. a generated `.def`). */
|
|
339
340
|
const INCLUDABLE_EXT = /\.(def|inc|h|hh|hpp|hxx|c|cc|cpp|cxx|ipp|tcc|tbl)$/i;
|
|
340
|
-
function cFnPointerDispatchEdges(
|
|
341
|
+
async function cFnPointerDispatchEdges(_queries, ctx, onYield) {
|
|
342
|
+
let scannedFiles = 0;
|
|
341
343
|
const files = ctx.getAllFiles().filter((f) => C_CPP_EXT.test(f));
|
|
342
344
|
if (files.length === 0)
|
|
343
345
|
return [];
|
|
344
|
-
// Cache raw + stripped source per file
|
|
345
|
-
//
|
|
346
|
-
|
|
346
|
+
// Cache raw + stripped source per file, LRU-BOUNDED. The old unbounded Maps
|
|
347
|
+
// retained every C/C++ file's raw AND stripped text for the whole pass —
|
|
348
|
+
// multiple GB on the Linux kernel, one of the two OOM culprits in #1212.
|
|
349
|
+
// Every sweep below iterates in `files` order, and node-kind scans return
|
|
350
|
+
// rows in file-commit order, so access is near-sequential and a small LRU
|
|
351
|
+
// hits; a miss just re-reads + re-strips.
|
|
352
|
+
const rawCache = new lru_cache_1.LRUCache(128);
|
|
347
353
|
const raw = (file) => {
|
|
348
354
|
if (rawCache.has(file))
|
|
349
355
|
return rawCache.get(file);
|
|
@@ -351,10 +357,14 @@ function cFnPointerDispatchEdges(queries, ctx) {
|
|
|
351
357
|
rawCache.set(file, r);
|
|
352
358
|
return r;
|
|
353
359
|
};
|
|
354
|
-
const srcCache = new
|
|
360
|
+
const srcCache = new lru_cache_1.LRUCache(128);
|
|
355
361
|
const src = (file) => {
|
|
356
|
-
|
|
357
|
-
|
|
362
|
+
// A cached '' (empty or unreadable file) returns '' where the miss path
|
|
363
|
+
// returns null for unreadable — every caller falsy-checks, so the two are
|
|
364
|
+
// interchangeable.
|
|
365
|
+
const hit = srcCache.get(file);
|
|
366
|
+
if (hit !== undefined)
|
|
367
|
+
return hit;
|
|
358
368
|
const r = raw(file);
|
|
359
369
|
const s = r == null ? '' : (0, strip_comments_1.stripCommentsForRegex)(r, 'c');
|
|
360
370
|
srcCache.set(file, s);
|
|
@@ -380,6 +390,8 @@ function cFnPointerDispatchEdges(queries, ctx) {
|
|
|
380
390
|
const fnPtrTypedefs = new Set();
|
|
381
391
|
const fnTypeTypedefs = new Set();
|
|
382
392
|
for (const file of files) {
|
|
393
|
+
if ((++scannedFiles & 15) === 0)
|
|
394
|
+
await onYield();
|
|
383
395
|
const s = src(file);
|
|
384
396
|
if (!s || !s.includes('typedef'))
|
|
385
397
|
continue;
|
|
@@ -472,10 +484,12 @@ function cFnPointerDispatchEdges(queries, ctx) {
|
|
|
472
484
|
if (fields.some((f) => f.isFnPtr))
|
|
473
485
|
structLayout.set(name, fields);
|
|
474
486
|
};
|
|
475
|
-
for (const st of ctx.getNodesByKind('struct')) {
|
|
487
|
+
for (const st of (ctx.iterateNodesByKind?.('struct') ?? ctx.getNodesByKind('struct'))) {
|
|
488
|
+
if ((++scannedFiles & 255) === 0)
|
|
489
|
+
await onYield();
|
|
476
490
|
if (!C_CPP_EXT.test(st.filePath))
|
|
477
491
|
continue;
|
|
478
|
-
const s =
|
|
492
|
+
const s = src(st.filePath);
|
|
479
493
|
if (!s)
|
|
480
494
|
continue;
|
|
481
495
|
const body = sliceLines(s, st.startLine, st.endLine);
|
|
@@ -490,12 +504,9 @@ function cFnPointerDispatchEdges(queries, ctx) {
|
|
|
490
504
|
// up by `#ifdef`) is discovered later during the unit scan. The `reg.size === 0`
|
|
491
505
|
// guard after registration still short-circuits when nothing bridges.
|
|
492
506
|
const fnPtrFieldOf = (struct, field) => !!structLayout.get(struct)?.some((f) => f.name === field && f.isFnPtr);
|
|
493
|
-
// C/C++ function + method nodes
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
if (C_CPP_EXT.test(fn.filePath))
|
|
497
|
-
cFns.push(fn);
|
|
498
|
-
}
|
|
507
|
+
// C/C++ function + method nodes are STREAMED per sweep (see passes D/E) —
|
|
508
|
+
// the old materialized `cFns` array held every function node on the repo
|
|
509
|
+
// (O(nodes) memory, part of the #1212 kernel OOM).
|
|
499
510
|
// ---- function-name → node resolution (prefer a function in the same file) ----
|
|
500
511
|
const resolveFn = (name, preferFile) => {
|
|
501
512
|
const cands = ctx.getNodesByName(name).filter((n) => FN_KINDS.has(n.kind));
|
|
@@ -511,14 +522,14 @@ function cFnPointerDispatchEdges(queries, ctx) {
|
|
|
511
522
|
return cands[0];
|
|
512
523
|
};
|
|
513
524
|
// ---- Pass C: registrations — Map<"struct.field", Set<funcNodeId>> ----
|
|
525
|
+
// Ids only — retaining the full Node per registration (the old `idToNode`)
|
|
526
|
+
// was write-only dead weight at O(registrations) memory.
|
|
514
527
|
const reg = new Map();
|
|
515
|
-
const idToNode = new Map();
|
|
516
528
|
const addReg = (struct, field, fn) => {
|
|
517
529
|
const key = `${struct}.${field}`;
|
|
518
530
|
if (!reg.has(key))
|
|
519
531
|
reg.set(key, new Set());
|
|
520
532
|
reg.get(key).add(fn.id);
|
|
521
|
-
idToNode.set(fn.id, fn);
|
|
522
533
|
};
|
|
523
534
|
// Bare arrays-of-fn-pointers (no struct): array VARIABLE name → per-file sets
|
|
524
535
|
// of registered function ids. Multi-entry because a file-scope `static` table
|
|
@@ -537,7 +548,6 @@ function cFnPointerDispatchEdges(queries, ctx) {
|
|
|
537
548
|
entries.push(e);
|
|
538
549
|
}
|
|
539
550
|
e.ids.add(fn.id);
|
|
540
|
-
idToNode.set(fn.id, fn);
|
|
541
551
|
};
|
|
542
552
|
// A struct value `{ … }` (one element) — register its function entries to the
|
|
543
553
|
// struct's fields, by `.field = fn` designators or by positional slot.
|
|
@@ -612,7 +622,8 @@ function cFnPointerDispatchEdges(queries, ctx) {
|
|
|
612
622
|
}
|
|
613
623
|
};
|
|
614
624
|
// Per-file macro + include parsing (any file, indexed or not), cached.
|
|
615
|
-
|
|
625
|
+
// Derived per-file caches, LRU-bounded like the content caches (#1212).
|
|
626
|
+
const fnMacroCache = new lru_cache_1.LRUCache(256);
|
|
616
627
|
const fileFnMacros = (file) => {
|
|
617
628
|
let m = fnMacroCache.get(file);
|
|
618
629
|
if (!m) {
|
|
@@ -621,7 +632,7 @@ function cFnPointerDispatchEdges(queries, ctx) {
|
|
|
621
632
|
}
|
|
622
633
|
return m;
|
|
623
634
|
};
|
|
624
|
-
const objMacroCache = new
|
|
635
|
+
const objMacroCache = new lru_cache_1.LRUCache(256);
|
|
625
636
|
const fileObjMacros = (file) => {
|
|
626
637
|
let m = objMacroCache.get(file);
|
|
627
638
|
if (!m) {
|
|
@@ -630,7 +641,7 @@ function cFnPointerDispatchEdges(queries, ctx) {
|
|
|
630
641
|
}
|
|
631
642
|
return m;
|
|
632
643
|
};
|
|
633
|
-
const definedCache = new
|
|
644
|
+
const definedCache = new lru_cache_1.LRUCache(256);
|
|
634
645
|
const fileDefinedNames = (file) => {
|
|
635
646
|
let d = definedCache.get(file);
|
|
636
647
|
if (!d) {
|
|
@@ -639,7 +650,7 @@ function cFnPointerDispatchEdges(queries, ctx) {
|
|
|
639
650
|
}
|
|
640
651
|
return d;
|
|
641
652
|
};
|
|
642
|
-
const includeCache = new
|
|
653
|
+
const includeCache = new lru_cache_1.LRUCache(1024);
|
|
643
654
|
const localIncludesOf = (file) => {
|
|
644
655
|
let out = includeCache.get(file);
|
|
645
656
|
if (out)
|
|
@@ -681,45 +692,7 @@ function cFnPointerDispatchEdges(queries, ctx) {
|
|
|
681
692
|
buildEnv(inc, depth - 1, seen, fn, obj, def);
|
|
682
693
|
};
|
|
683
694
|
const indexedSet = new Set(files);
|
|
684
|
-
const units = [];
|
|
685
695
|
const seenInclude = new Set();
|
|
686
|
-
for (const file of files) {
|
|
687
|
-
const env = new Map();
|
|
688
|
-
const objEnv = new Map();
|
|
689
|
-
const defined = new Set();
|
|
690
|
-
buildEnv(file, 2, new Set(), env, objEnv, defined);
|
|
691
|
-
const s = src(file);
|
|
692
|
-
if (s)
|
|
693
|
-
units.push({ text: s, file, env, objEnv });
|
|
694
|
-
for (const target of localIncludesOf(file)) {
|
|
695
|
-
if (seenInclude.has(`${file}>${target}`))
|
|
696
|
-
continue;
|
|
697
|
-
const incSrc = src(target);
|
|
698
|
-
if (!incSrc)
|
|
699
|
-
continue;
|
|
700
|
-
if (indexedSet.has(target)) {
|
|
701
|
-
// Re-scan an indexed header only when this includer unlocks guarded code.
|
|
702
|
-
const ownDef = fileDefinedNames(target);
|
|
703
|
-
const adds = [...defined].some((n) => !ownDef.has(n));
|
|
704
|
-
if (!adds || !/#\s*if/.test(incSrc))
|
|
705
|
-
continue;
|
|
706
|
-
}
|
|
707
|
-
seenInclude.add(`${file}>${target}`);
|
|
708
|
-
// The include is pasted into the includer — evaluate its conditionals in
|
|
709
|
-
// the includer's defined set (a no-op when it has none). Re-parse the
|
|
710
|
-
// included file's OWN macros from that resolved text so a macro it defines
|
|
711
|
-
// conditionally (vim's `EXCMD`, whose plain last-wins parse picks the enum
|
|
712
|
-
// arm) overrides with the ARM THAT IS ACTUALLY ACTIVE here.
|
|
713
|
-
const text = evalConditionals(incSrc, defined);
|
|
714
|
-
const incEnv = new Map(env);
|
|
715
|
-
for (const [k, v] of parseFunctionMacros(text))
|
|
716
|
-
incEnv.set(k, v);
|
|
717
|
-
const incObjEnv = new Map(objEnv);
|
|
718
|
-
for (const [k, v] of parseObjectMacros(text))
|
|
719
|
-
incObjEnv.set(k, v);
|
|
720
|
-
units.push({ text, file: target, env: incEnv, objEnv: incObjEnv });
|
|
721
|
-
}
|
|
722
|
-
}
|
|
723
696
|
// Global variable → struct type, for resolving a dispatch through a file-scope
|
|
724
697
|
// table by subscript (`cmdnames[i].cmd_func(…)`).
|
|
725
698
|
const globalVarType = new Map();
|
|
@@ -760,10 +733,13 @@ function cFnPointerDispatchEdges(queries, ctx) {
|
|
|
760
733
|
// (`zend_rc_dtor_func_t t[]`) needs none. The typedef-set membership gate
|
|
761
734
|
// (below) is what separates this from a plain data/struct array.
|
|
762
735
|
const ARRAY_TABLE_RE = /(?:^|[;{}])\s*(?:(?:static|const|extern|register|volatile)\s+)*(\w+)\s+(\*\s*)?(\w+)\s*\[[^\]]*\]\s*=\s*\{/g;
|
|
763
|
-
|
|
736
|
+
// Process ONE unit's text and discard it. The old shape built every unit up
|
|
737
|
+
// front (`const units: Unit[]`) — the full text of every C file plus its
|
|
738
|
+
// expanded includes held simultaneously, gigabytes on the kernel (#1212).
|
|
739
|
+
const processUnit = (unit) => {
|
|
764
740
|
const s = unit.text;
|
|
765
741
|
if (!s || !s.includes('{'))
|
|
766
|
-
|
|
742
|
+
return;
|
|
767
743
|
INLINE_STRUCT_RE.lastIndex = 0;
|
|
768
744
|
let im;
|
|
769
745
|
while ((im = INLINE_STRUCT_RE.exec(s))) {
|
|
@@ -793,7 +769,7 @@ function cFnPointerDispatchEdges(queries, ctx) {
|
|
|
793
769
|
}
|
|
794
770
|
}
|
|
795
771
|
if (!s.includes('='))
|
|
796
|
-
|
|
772
|
+
return;
|
|
797
773
|
INIT_RE.lastIndex = 0;
|
|
798
774
|
let m;
|
|
799
775
|
while ((m = INIT_RE.exec(s))) {
|
|
@@ -829,6 +805,47 @@ function cFnPointerDispatchEdges(queries, ctx) {
|
|
|
829
805
|
registerArrayValue(am[3], s.slice(open + 1, close), unit.file, unit.env);
|
|
830
806
|
ARRAY_TABLE_RE.lastIndex = close;
|
|
831
807
|
}
|
|
808
|
+
};
|
|
809
|
+
// ---- Pass C: registrations — stream each file (and its qualifying local
|
|
810
|
+
// includes) through processUnit, one at a time.
|
|
811
|
+
for (const file of files) {
|
|
812
|
+
if ((++scannedFiles & 15) === 0)
|
|
813
|
+
await onYield();
|
|
814
|
+
const env = new Map();
|
|
815
|
+
const objEnv = new Map();
|
|
816
|
+
const defined = new Set();
|
|
817
|
+
buildEnv(file, 2, new Set(), env, objEnv, defined);
|
|
818
|
+
const s = src(file);
|
|
819
|
+
if (s)
|
|
820
|
+
processUnit({ text: s, file, env, objEnv });
|
|
821
|
+
for (const target of localIncludesOf(file)) {
|
|
822
|
+
if (seenInclude.has(`${file}>${target}`))
|
|
823
|
+
continue;
|
|
824
|
+
const incSrc = src(target);
|
|
825
|
+
if (!incSrc)
|
|
826
|
+
continue;
|
|
827
|
+
if (indexedSet.has(target)) {
|
|
828
|
+
// Re-scan an indexed header only when this includer unlocks guarded code.
|
|
829
|
+
const ownDef = fileDefinedNames(target);
|
|
830
|
+
const adds = [...defined].some((n) => !ownDef.has(n));
|
|
831
|
+
if (!adds || !/#\s*if/.test(incSrc))
|
|
832
|
+
continue;
|
|
833
|
+
}
|
|
834
|
+
seenInclude.add(`${file}>${target}`);
|
|
835
|
+
// The include is pasted into the includer — evaluate its conditionals in
|
|
836
|
+
// the includer's defined set (a no-op when it has none). Re-parse the
|
|
837
|
+
// included file's OWN macros from that resolved text so a macro it defines
|
|
838
|
+
// conditionally (vim's `EXCMD`, whose plain last-wins parse picks the enum
|
|
839
|
+
// arm) overrides with the ARM THAT IS ACTUALLY ACTIVE here.
|
|
840
|
+
const text = evalConditionals(incSrc, defined);
|
|
841
|
+
const incEnv = new Map(env);
|
|
842
|
+
for (const [k, v] of parseFunctionMacros(text))
|
|
843
|
+
incEnv.set(k, v);
|
|
844
|
+
const incObjEnv = new Map(objEnv);
|
|
845
|
+
for (const [k, v] of parseObjectMacros(text))
|
|
846
|
+
incObjEnv.set(k, v);
|
|
847
|
+
processUnit({ text, file: target, env: incEnv, objEnv: incObjEnv });
|
|
848
|
+
}
|
|
832
849
|
}
|
|
833
850
|
// ---- receiver-type resolution within a function's source ----
|
|
834
851
|
// `(?:struct )?TYPE [*]recv` declared in the params or body → TYPE (if a known
|
|
@@ -882,21 +899,27 @@ function cFnPointerDispatchEdges(queries, ctx) {
|
|
|
882
899
|
// a fixpoint so a hook slot inherits a registry field's handlers.
|
|
883
900
|
const FIELD_ASSIGN_RE = /(\w+)\s*(?:->|\.)\s*(\w+)\s*=\s*(\w+)\s*(?:->|\.)\s*(\w+)/g;
|
|
884
901
|
const propagations = [];
|
|
885
|
-
for (const
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
if (!body.includes('='))
|
|
902
|
+
for (const file of files) {
|
|
903
|
+
if ((++scannedFiles & 15) === 0)
|
|
904
|
+
await onYield();
|
|
905
|
+
const s = src(file);
|
|
906
|
+
if (!s || !s.includes('='))
|
|
891
907
|
continue;
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
const
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
908
|
+
for (const fn of ctx.getNodesInFile(file)) {
|
|
909
|
+
if (!FN_KINDS.has(fn.kind))
|
|
910
|
+
continue;
|
|
911
|
+
const body = sliceLines(s, fn.startLine, fn.endLine);
|
|
912
|
+
if (!body.includes('='))
|
|
913
|
+
continue;
|
|
914
|
+
FIELD_ASSIGN_RE.lastIndex = 0;
|
|
915
|
+
let m;
|
|
916
|
+
while ((m = FIELD_ASSIGN_RE.exec(body))) {
|
|
917
|
+
const [, lrecv, lfield, rrecv, rfield] = m;
|
|
918
|
+
const lt = recvTypeIn(body, lrecv);
|
|
919
|
+
const rt = recvTypeIn(body, rrecv);
|
|
920
|
+
if (lt && rt && fnPtrFieldOf(lt, lfield) && fnPtrFieldOf(rt, rfield)) {
|
|
921
|
+
propagations.push({ to: `${lt}.${lfield}`, from: `${rt}.${rfield}` });
|
|
922
|
+
}
|
|
900
923
|
}
|
|
901
924
|
}
|
|
902
925
|
}
|
|
@@ -934,76 +957,43 @@ function cFnPointerDispatchEdges(queries, ctx) {
|
|
|
934
957
|
const ARRAY_DISPATCH_RE = /(?:\(\s*\*\s*)?\b(\w+)\s*\[[^\][]*\]\s*\)?\s*\(/g;
|
|
935
958
|
const edges = [];
|
|
936
959
|
const seen = new Set();
|
|
937
|
-
for (const
|
|
938
|
-
|
|
960
|
+
for (const file of files) {
|
|
961
|
+
if ((++scannedFiles & 15) === 0)
|
|
962
|
+
await onYield();
|
|
963
|
+
const s = src(file);
|
|
939
964
|
if (!s)
|
|
940
965
|
continue;
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
let m;
|
|
944
|
-
let added = 0;
|
|
945
|
-
while ((m = DISPATCH_RE.exec(body)) && added < FANOUT_CAP) {
|
|
946
|
-
const baseChain = m[1].replace(/\s*(?:->|\.)\s*$/, '').trim(); // receiver, minus the trailing arrow
|
|
947
|
-
const field = m[2];
|
|
948
|
-
const owners = fieldToStructs.get(field);
|
|
949
|
-
if (!owners || owners.size === 0)
|
|
950
|
-
continue;
|
|
951
|
-
// 1) resolve the receiver chain's struct type precisely (handles c->cmd->proc);
|
|
952
|
-
// 2) else the last segment as a simple local/param of a fn-pointer-bearing struct;
|
|
953
|
-
// 3) else fall back to a field name that belongs to exactly one struct.
|
|
954
|
-
let struct = resolveChainType(body, baseChain);
|
|
955
|
-
if (!struct || !owners.has(struct)) {
|
|
956
|
-
const lastSeg = baseChain.replace(/\s*\[[^\]]*\]/g, '').split(/\s*(?:->|\.)\s*/).pop();
|
|
957
|
-
const t = recvTypeIn(body, lastSeg);
|
|
958
|
-
struct = t && owners.has(t) ? t : null;
|
|
959
|
-
}
|
|
960
|
-
if (!struct || !owners.has(struct))
|
|
961
|
-
struct = owners.size === 1 ? [...owners][0] : null;
|
|
962
|
-
if (!struct)
|
|
966
|
+
for (const fn of ctx.getNodesInFile(file)) {
|
|
967
|
+
if (!FN_KINDS.has(fn.kind))
|
|
963
968
|
continue;
|
|
964
|
-
const
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
const
|
|
972
|
-
if (
|
|
969
|
+
const body = sliceLines(s, fn.startLine, fn.endLine);
|
|
970
|
+
DISPATCH_RE.lastIndex = 0;
|
|
971
|
+
let m;
|
|
972
|
+
let added = 0;
|
|
973
|
+
while ((m = DISPATCH_RE.exec(body)) && added < FANOUT_CAP) {
|
|
974
|
+
const baseChain = m[1].replace(/\s*(?:->|\.)\s*$/, '').trim(); // receiver, minus the trailing arrow
|
|
975
|
+
const field = m[2];
|
|
976
|
+
const owners = fieldToStructs.get(field);
|
|
977
|
+
if (!owners || owners.size === 0)
|
|
973
978
|
continue;
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
});
|
|
987
|
-
if (++added >= FANOUT_CAP)
|
|
988
|
-
break;
|
|
989
|
-
}
|
|
990
|
-
}
|
|
991
|
-
// ---- bare array-of-fn-pointers dispatch (`tbl[i](…)`) ----
|
|
992
|
-
if (arrayReg.size && added < FANOUT_CAP) {
|
|
993
|
-
ARRAY_DISPATCH_RE.lastIndex = 0;
|
|
994
|
-
while ((m = ARRAY_DISPATCH_RE.exec(body)) && added < FANOUT_CAP) {
|
|
995
|
-
const entries = arrayReg.get(m[1]);
|
|
996
|
-
if (!entries)
|
|
979
|
+
// 1) resolve the receiver chain's struct type precisely (handles c->cmd->proc);
|
|
980
|
+
// 2) else the last segment as a simple local/param of a fn-pointer-bearing struct;
|
|
981
|
+
// 3) else fall back to a field name that belongs to exactly one struct.
|
|
982
|
+
let struct = resolveChainType(body, baseChain);
|
|
983
|
+
if (!struct || !owners.has(struct)) {
|
|
984
|
+
const lastSeg = baseChain.replace(/\s*\[[^\]]*\]/g, '').split(/\s*(?:->|\.)\s*/).pop();
|
|
985
|
+
const t = recvTypeIn(body, lastSeg);
|
|
986
|
+
struct = t && owners.has(t) ? t : null;
|
|
987
|
+
}
|
|
988
|
+
if (!struct || !owners.has(struct))
|
|
989
|
+
struct = owners.size === 1 ? [...owners][0] : null;
|
|
990
|
+
if (!struct)
|
|
997
991
|
continue;
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
const ids = entries.length === 1
|
|
1001
|
-
? entries[0].ids
|
|
1002
|
-
: (entries.find((e) => e.file === fn.filePath)?.ids ?? null);
|
|
1003
|
-
if (!ids)
|
|
992
|
+
const targets = reg.get(`${struct}.${field}`);
|
|
993
|
+
if (!targets)
|
|
1004
994
|
continue;
|
|
1005
995
|
const line = fn.startLine + body.slice(0, m.index).split('\n').length - 1;
|
|
1006
|
-
for (const tid of
|
|
996
|
+
for (const tid of targets) {
|
|
1007
997
|
if (tid === fn.id)
|
|
1008
998
|
continue;
|
|
1009
999
|
const key = `${fn.id}>${tid}`;
|
|
@@ -1018,7 +1008,7 @@ function cFnPointerDispatchEdges(queries, ctx) {
|
|
|
1018
1008
|
provenance: 'heuristic',
|
|
1019
1009
|
metadata: {
|
|
1020
1010
|
synthesizedBy: 'fn-pointer-dispatch',
|
|
1021
|
-
via: `${
|
|
1011
|
+
via: `${struct}.${field}`,
|
|
1022
1012
|
registeredAt: `${fn.filePath}:${line}`,
|
|
1023
1013
|
},
|
|
1024
1014
|
});
|
|
@@ -1026,13 +1016,47 @@ function cFnPointerDispatchEdges(queries, ctx) {
|
|
|
1026
1016
|
break;
|
|
1027
1017
|
}
|
|
1028
1018
|
}
|
|
1019
|
+
// ---- bare array-of-fn-pointers dispatch (`tbl[i](…)`) ----
|
|
1020
|
+
if (arrayReg.size && added < FANOUT_CAP) {
|
|
1021
|
+
ARRAY_DISPATCH_RE.lastIndex = 0;
|
|
1022
|
+
while ((m = ARRAY_DISPATCH_RE.exec(body)) && added < FANOUT_CAP) {
|
|
1023
|
+
const entries = arrayReg.get(m[1]);
|
|
1024
|
+
if (!entries)
|
|
1025
|
+
continue;
|
|
1026
|
+
// Same-file table wins on a name collision (two file-local `opcodes`);
|
|
1027
|
+
// a unique name resolves cross-file; otherwise ambiguous — bail.
|
|
1028
|
+
const ids = entries.length === 1
|
|
1029
|
+
? entries[0].ids
|
|
1030
|
+
: (entries.find((e) => e.file === fn.filePath)?.ids ?? null);
|
|
1031
|
+
if (!ids)
|
|
1032
|
+
continue;
|
|
1033
|
+
const line = fn.startLine + body.slice(0, m.index).split('\n').length - 1;
|
|
1034
|
+
for (const tid of ids) {
|
|
1035
|
+
if (tid === fn.id)
|
|
1036
|
+
continue;
|
|
1037
|
+
const key = `${fn.id}>${tid}`;
|
|
1038
|
+
if (seen.has(key))
|
|
1039
|
+
continue;
|
|
1040
|
+
seen.add(key);
|
|
1041
|
+
edges.push({
|
|
1042
|
+
source: fn.id,
|
|
1043
|
+
target: tid,
|
|
1044
|
+
kind: 'calls',
|
|
1045
|
+
line,
|
|
1046
|
+
provenance: 'heuristic',
|
|
1047
|
+
metadata: {
|
|
1048
|
+
synthesizedBy: 'fn-pointer-dispatch',
|
|
1049
|
+
via: `${m[1]}[]`,
|
|
1050
|
+
registeredAt: `${fn.filePath}:${line}`,
|
|
1051
|
+
},
|
|
1052
|
+
});
|
|
1053
|
+
if (++added >= FANOUT_CAP)
|
|
1054
|
+
break;
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1029
1058
|
}
|
|
1030
1059
|
}
|
|
1031
1060
|
return edges;
|
|
1032
1061
|
}
|
|
1033
|
-
/** C/C++ function + method nodes, streamed (memory-safe on symbol-dense repos). */
|
|
1034
|
-
function* iterateFns(queries) {
|
|
1035
|
-
yield* queries.iterateNodesByKind('function');
|
|
1036
|
-
yield* queries.iterateNodesByKind('method');
|
|
1037
|
-
}
|
|
1038
1062
|
//# sourceMappingURL=c-fnptr-synthesizer.js.map
|