Most active commenters

    ←back to thread

    383 points hkalbasi | 16 comments | | HN request time: 0.833s | source | bottom
    1. devit ◴[] No.42814926[source]
    I think the optimal approach for development would be to not produce a traditional linked executable at all, but instead just place the object files in memory, and then produce a loader executable that hooks page faults in those memory areas and on-demand mmaps the relevant object elsewhere, applies relocations to it, and then moves it in place with mremap.

    Symbols would be resolved based on an index where only updated object files are reindexed. It could also eagerly relocate in the background, in order depending on previous usage data.

    This would basically make a copyless lazy incremental linker.

    replies(9): >>42815042 #>>42815180 #>>42815279 #>>42815434 #>>42815474 #>>42815621 #>>42815660 #>>42815894 #>>42815895 #
    2. IshKebab ◴[] No.42815042[source]
    Sounds like dynamic linking, sort of.
    3. fsfod ◴[] No.42815180[source]
    You can sort of do that with some of LLVM's JIT systems https://llvm.org/docs/JITLink.html, I'm surprised that no one has yet made a edit and continue system using it.
    replies(2): >>42815305 #>>42817971 #
    4. eseidel ◴[] No.42815279[source]
    Sounds like Apple's old ZeroLink from the aughts?
    5. all2 ◴[] No.42815305[source]
    My parens sense is tingling. This sounds like a lisp-machine, or just standard lisp development environment.
    replies(1): >>42824092 #
    6. checker659 ◴[] No.42815434[source]
    Linker overlays?
    7. ignoramous ◴[] No.42815474[source]
    > Symbols would be resolved based on an index where only updated object files are reindexed. It could also eagerly relocate in the background, in order depending on previous usage data.

    Not exactly this, but Google's Propeller fixes up ("relinks") Basic Blocks (hot code as traced from PGO) in native code at runtime (like an optimizing JIT compiler would): https://research.google/pubs/propeller-a-profile-guided-reli...

    8. 95014_refugee ◴[] No.42815621[source]
    This makes some very naïve assumptions about the relationships between entities in a program; in particular that you can make arbitrary assertions about the representation of already-allocated datastructures across multiple versions of a component, that the program's compositional structure morphs in understandable ways, and that you can pause a program in a state where a component can actually be replaced.

    By the time you have addressed these, you'll find yourself building a microkernel system with a collection of independent servers and well-defined interaction protocols. Which isn't necessarily a terrible way to assemble something, but it's not quite where you're trying to go...

    9. jjmarr ◴[] No.42815660[source]
    Isn't this how dynamic linking works? If you really want to reduce build times, you should be making your hot path in the build a shared library, so you don't have to relink so long as you're not changing the interface.
    replies(1): >>42816581 #
    10. ◴[] No.42815894[source]
    11. cbsmith ◴[] No.42815895[source]
    That sounds a lot like traditional dynamic language runtimes. You kind of get that for free with Smalltalk/LISP/etc.
    12. hinkley ◴[] No.42816581[source]
    But do rust’s invariants work across dynamic links?

    I thought a lot of its proofs were done at compile time not link time.

    replies(2): >>42818056 #>>42818263 #
    13. samatman ◴[] No.42817971[source]
    They have! It's called Julia and it's great.
    14. pas ◴[] No.42818056{3}[source]
    The proof can be done on the whole code (in memory, incremental, etc), and then the modules emitted as dynamically loadable objects.
    15. Nullabillity ◴[] No.42818263{3}[source]
    Yesn't.

    Rust is perfectly happy to emit/use dynamic links.[0] It's just that the primary C use case (distributing and updating the main app and its libraries separately) ends up being unsafe since Rust's ABI is unstable (so compiler versions, libraries, etc must match exactly).

    Avoiding static relinking during development is pretty much the use where it does work. In fact, Bevy recommends this as part of its setup guide![1]

    Practice paints a slightly less rosy picture, though; since the feature is exercised quite rarely, not all libraries work well with it in practice.[2]

    [0]: https://doc.rust-lang.org/reference/linkage.html#r-link.dyli...

    [1]: https://bevyengine.org/learn/quick-start/getting-started/set...

    [2]: For example, https://github.com/linebender/bevy_vello/issues/84

    16. klibertp ◴[] No.42824092{3}[source]
    Maybe of interest: https://github.com/clasp-developers/clasp/ (Lisp env. that uses LLVM for compilation; new-ish, actively developed.) However, my impression (I didn't measure it) is that the compilation speed is an order of magnitude slower than in SBCL, never mind CCL.