Skip to content

refactor(entrypoint): build single non-flavored variant, drop pointer dispatch - #424

Draft
vporoshok wants to merge 1 commit into
ppfrom
chore/single-flavor-entrypoint
Draft

refactor(entrypoint): build single non-flavored variant, drop pointer dispatch#424
vporoshok wants to merge 1 commit into
ppfrom
chore/single-flavor-entrypoint

Conversation

@vporoshok

Copy link
Copy Markdown
Collaborator

Summary

Instead of building three amd64 flavors (k8/nehalem/haswell) with objcopy symbol prefixing and selecting one at runtime via function pointers, build a single baseline variant (amd64 k8, arm64 armv8-a) and link its symbols directly.

Benefits:

  • Faster build: one variant instead of three, no objcopy prefixing pass.
  • Removes the extra indirect call per entrypoint function (no *_ptr dispatch).

Changes

  • Remove the generated init layer: entrypoint.cpp.template, entrypoint.cpp.mk, entrypoint.h.template, and the entrypoint_init/entrypoint_init_aio targets in pp/BUILD.
  • Restore jemalloc's own constructor by dropping 0002-manual-init.patch (manual init existed only for runtime flavor selection, which no longer applies).
  • Move prompp_get_flavor into bridge/common.cpp as a compile-time constant.
  • build.mk/Makefile build and install a single *_entrypoint_aio_*.a archive.
  • cgo LDFLAGS link the single archive per arch/asan/dbg combination; regenerate entrypoint.h.

Notes

Test

  • Built pp/entrypoint archive in devcontainer (arm64); jemalloc rebuilt cleanly with its own constructor.
  • go test -tags stringlabels ./pp/go/... all green (incl. cppbridge cgo link against the single archive).
  • Pre-existing UI ui-build TypeScript failure is unrelated to this change.

Made with Cursor

… dispatch

Instead of building three amd64 flavors (k8/nehalem/haswell) with objcopy
symbol prefixing and selecting one at runtime via function pointers, build a
single baseline variant (amd64 k8, arm64 armv8-a) and link its symbols
directly. This speeds up the build (one variant instead of three) and removes
the extra indirect call per entrypoint function.

- Remove the generated init layer: entrypoint.cpp.template, entrypoint.cpp.mk,
  entrypoint.h.template, and the entrypoint_init/entrypoint_init_aio BUILD
  targets.
- Restore jemalloc's own constructor (drop 0002-manual-init.patch); the manual
  init existed only for runtime flavor selection, which no longer applies.
- Move prompp_get_flavor into bridge/common.cpp as a compile-time constant.
- build.mk/Makefile now build and install one *_entrypoint_aio_*.a archive.
- cgo LDFLAGS link the single archive per arch/asan/dbg combination.

Co-authored-by: Cursor <cursoragent@cursor.com>
@vporoshok
vporoshok requested a review from u-veles-a July 21, 2026 17:22
@vporoshok vporoshok self-assigned this Jul 21, 2026
@vporoshok
vporoshok requested a review from cherep58 July 21, 2026 17:22
@vporoshok
vporoshok marked this pull request as draft July 21, 2026 17:22
@vporoshok vporoshok added this to the experiment milestone Jul 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant