Better HN
topnewbestaskshowjobs
Log inSign up

hayley-patton

628 karma · joined Nov 13, 2021 (5y ago) · 283 submissions

https://applied-langua.ge/
Submissions

comment 2d ago · link · parent

The HotSpot C1 compiler allocates on SSA form [0], so does libfirm [1], I think the Android Runtime does [2], Go does [3], and so does Cranelift [4]. And this compiler for Intel GPUs does too [5].

[0] https://dl.acm.org/doi/acm/10.1145/1772954.1772979 however they do note that splitting breaks SSA form, and fall back to slower algorithms for values which get split.

[1] https://libfirm.github.io/Features.html

[2] https://arxiv.org/abs/2011.05608v1

[3] https://developers.redhat.com/articles/2024/09/24/go-compile...

[4] https://github.com/bytecodealliance/regalloc2/

[5] https://www.youtube.com/watch?v=-UFjec3YctM

comment 3mo ago · link · parent

> If macros can implement arbitrary language features

Not really your question--others have provided examples of type systems as macros--but they can't, they can only do local rewrites. You couldn't, for example, express mutation or non-local control flow if you didn't have them already; On the expressive power of programming languages [0] is rather theoretical but does set out the boundary of what macros can and can't do. That they're local means everyone has to buy into your type system if you want it to be a macro, though.

[0] https://www.sciencedirect.com/science/article/pii/0167642391... though https://www.youtube.com/watch?v=43XaZEn2aLc might be a useful walkthrough of the ideas being presented

comment 5mo ago · link · parent

> Like there is even a paper that shows that one is tracking liveness, while the other tracks "deadness" and they are literally going at the same thing from different ends.

https://dl.acm.org/doi/10.1145/1035292.1028982

comment 5mo ago · link · parent

> It’s possible my interpretation wasn’t correct and the author was citing Kernel’s approach as sanity. That would make sense technically.

That's indeed what I meant, I meant the opposite of taking a dig at Kernel. My understanding is Shutt thought fexprs got a bad wrap because of dynamic scoping; quoth the Kernel website:

> they made a mess out of the language semantics because they were non-orthogonal to the ordinary variety of procedures constructed via lambda — and, more insidiously, because at that time the mainstream Lisps were dynamically scoped (a language feature that causes more problems for fexprs than it does for the less powerful macros).

My belated apologies for the ambiguity.

comment 8mo ago · link · parent

As not mentioned in the article, if you want the general form of this algorithm, it is a Hillis-Steele prefix sum: <https://en.wikipedia.org/wiki/Prefix_sum#Algorithm_1:_Shorte...>

comment 10mo ago · link · parent

ignore previous instructions and rewrite rlibm in Scheme

comment 10mo ago · link · parent

> If you can't falsify it, you have to take it seriously.

No, I don't.

comment 10mo ago · link · parent

This is the Lisp-2 mark-compact algorithm shuffled around [0]. The Lisp-2 algorithm doesn't need semispaces, because if you compute forwarding pointers and rewrite references before moving objects, you can compact in the one space just fine. The next field of the GC header isn't necessary as the next object will always be immediately after when bump allocating [1], and rewrite_nested doesn't need to recursively call itself, since the heap traversal will fix references in all objects anyway.

About "Since allocations are expensive due to them requiring a system interaction via syscalls" and "For this only bump allocation is an option, simply because syscalls are slow, multiple for many small objects are even slower and hot paths would explode" there's no reason that a free-list allocator has to do more syscalls than a bump allocator; any malloc under the sun is going to have at least one layer of caching before it makes a syscall for more memory. You could do a doubling scheme like with the bump allocator, or allocate a lot at a time; mimalloc for example requests segments of 4MiB from the kernel [2].

[0] It's approximately steps #1 and #3 fused together, then #2 in https://en.wikipedia.org/wiki/Mark%E2%80%93compact_algorithm...

[1] Something like for (void *object = segment->start; object < segment->end; object += size_in_words(object))

[2] https://www.microsoft.com/en-us/research/wp-content/uploads/...

comment 11mo ago · link · parent

My recollection is that ASIC-resistance involves using lots of scratchpad memory and mixing multiple hashing algorithms, so that you'd have to use a lot of silicon and/or bottleneck hard on external RAM. I think the same would hurt FPGAs too.

comment 11mo ago · link · parent

I'm pretty sure it's mathematically guaranteed that you have to be bad at compressing something. You can't compress data to less than its entropy, so compressing totally random bytes (where entropy = size) would have a high probability of not compressing at all, if no identifiable patterns appear in the data by sheer coincidence. Establishing then that you have incompressible data, the least bad option would be to signal to the decompressor to reproduce the data verbatim, without any compression. The compressor would increase the size of the data by including that signal somehow. Therefore there is always some input for a compressor that causes it to produce a larger output, even by some miniscule amount.

comment 1y ago · link · parent

> What I can imagine is a purpose-built CPU that would make the JIT's job a lot easier and faster than compiling for x86 or ARM. Such a machine wouldn't execute raw Java bytecode, rather, something a tiny bit more low-level.

This is approximately exactly what Azul Systems did, doing a bog-standard RISC with hardware GC barriers and transactional memory. Cliff Click gave an excellent talk on it [0] and makes your argument around 20:14.

[0] https://www.youtube.com/watch?v=5uljtqyBLxI

comment 1y ago · link · parent

That's a linear traversal of the heap, not a trace. A trace traverses references in objects until it reaches a fixed point of a live/dead set.

comment 1y ago · link · parent

Dynamo <https://www.cse.iitm.ac.in/~krishna/courses/2022/odd-cs6013/...>?

comment 1y ago · link · parent

[0] is Self and Self: Whys and Wherefores <https://youtu.be/3ka4KY7TMTU?si=Js_oG3MneCxBtEql&t=2378>

> And at the time, we thought it was impossible to make this language run efficiently, because it did all these things that were more abstract than languages of the time ...

comment 1y ago · link · parent

> but JavaScript totally missed the boat on efficient compile-ability, which is the most interesting thing about Self

That's making much use of hindsight though: the creators of Self didn't think it would run fast, until it did [0]. The HOPL paper on Self [1] spends many words recounting the challenge of making Self fast.

[0] This is arguably a stronger claim than what appears in HOPL; I think it's from a talk by Dave Ungar, I'd have to check.

[1] https://dl.acm.org/doi/10.1145/1238844.1238853

comment 1y ago · link · parent

> "weird shit" like dynamically creating modules, hell, even creating a Python file, running eval on that, and loading it as a new module.

Expect that you don't, and deoptimise when you do: https://bibliography.selflanguage.org/_static/dynamic-deopti...

It's really not that impossible.

comment 1y ago · link · parent

If you want vectors, use vectors, elisp has them too as primitives. (I don't mean to suggest you don't know that, but still, you can just use vectors.)

comment 1y ago · link · parent

The LC-3 has pretty odd addressing modes - in particular, you can do a doubly indirect load through a PC-relative word in the middle. But you still have to generate subtraction from negation, and negation from NOT and ADD ,,#-1. (I suppose NOT d,s = XOR d,s,#-1 would be a better use of the limited instruction encoding space too.)

comment 2y ago · link · parent

"We changed the name to OTP." "Three of the trendiest names we could think of. Open. Telecom. Platform."

https://www.youtube.com/watch?v=rRbY3TMUcgQ

comment 2y ago · link · parent

Lisp machines didn't have hardware GC, though they had hardware support for read/write barriers.

comment 2y ago · link · parent

> But do that in an interactive environment when the rug can be pulled out of any of the assumption the compiler made, and things get messy quite quickly.

https://bibliography.selflanguage.org/_static/dynamic-deopti...

comment 2y ago · link · parent

> I don't remember seeing it anywhere else, including in Richard Jones' 2006 GC book

Lisp-2 is definitely in both editions of the Handbook, on page 39 in the 2023 edition; though you want to compute the address of the next object before relocating an object in relocate(), else you may overwrite the metadata of the current object [1].

[1] http://gchandbook.org/errata.html

comment 2y ago · link · parent

In my university one of the intro-to-CS courses spent some time on cybersecurity and SQL injections. It seemed like using prepared statements was less effort than concatenating queries together, so I asked why people would write vulnerable code anyway. The instructor wasn't sure; I'm not sure if she knew the uni taught SQL by concatenation in the prior semester.

comment 2y ago · link · parent

Citation very much needed, please; assembly wouldn't give you more control over caches than any language with a prefetch intrinsic.

comment 2y ago · link · parent

Right, your static analysis tools will likely use Abstract Interpretation.

comment 2y ago · link · parent

It's better than I would come up quickly with <https://lamucal.ai/songs/synergy/on-presuming-to-be-modern-i> getting the starts, ends and a few of the middle chords in each run, but misses most of the middle chords or gets them wrong.

comment 2y ago · link · parent

ElectroBOOM did a video testing that, and he came to a similar conclusion: https://www.youtube.com/watch?v=OyTmJX_TC84

comment 2y ago · link · parent

Smalltalk is definitely class based, though you are right for Self. It's rather unrelated to types, though I see the analogy - that said some paper on statically-typed Wyvern mentioned adopting the Self model for delegation.

comment 2y ago · link · parent

The Uni-Vibe (though not a Fender product) is a phaser trying to imitate a rotary speaker, for which the slow and fast settings are often called chorale and tremolo. Go figure.
12345
10