ngn/k
19
63
Fork
You've already forked k
17

entropy #111

Closed
growler wants to merge 194 commits from growler:entropy into master
pull from: growler:entropy
merge into: ngn:master
ngn:master
ngn:pages
Collaborator
Copy link

Use /dev/random if available.

Use /dev/random if available.
#58 
Reviewed-on: growler/k#2 
Switch out the searching implementation with one precomputing the
Eytzinger layout for the sorted `x` argument, while saving the
appropriate permutation to restore the correct indices.
The Eytzinger layout generation and searching code is mostly a direct translation
from [this Algorithmica article](https://algorithmica.org/en/eytzinger).
This should introduce a small regression in performance especially for very short `y` but
is asymptotically faster on large `x` and `y`.
Reviewed-on: growler/k#1 
Reviewed-on: growler/k#5 
Reviewed-on: growler/k#8 
Reviewed-on: growler/k#9 
Reviewed-on: growler/k#10 
Reviewed-on: growler/k#11 
Reviewed-on: growler/k#28 
enable multi-line string syntax highlighting
Reviewed-on: growler/k#30 
By default, when computing use of a local variable, assume that it is a
last use and emit a `bd` instruction.
To support this, keep a list `lu` of indices in the bytecode array `b`.
At any point during compilation, `lu` holds the positions of all emitted
`bd` opcodes in an execution path that may flow into the one we are
currently compiling, without passing through an intermediate assignment.
- when assigning a new value to a local, remove from `lu` the index of any
 instruction that is a use of that local. (by `rl(i,0)`)
- when getting a local for any use (modified assignment or pushing it on
 the stack), iterate through the list patching the `bd`s to `bg`s so that
 the value held by the local survives to this point in the execution path.
 (by `rl(i,1)`)
- if the use is for pushing the local on the stack (thus emitting `bd`),
 also add the offset of the instruction being emitted onto `lu`.
 (by `rl(i,2)`)
- when branching, back up `lu`.
- when reconciliating two branches, take the `lu` from each and compute
 their union as the new `lu`.
- when returning early due to `:`, empty `lu`.
further additions:
- propagate the `r` flag to the branches of `:[i;t;e]`
- fix incorrect code generation due to some uses of blocks
 having a dirty source offset
Reviewed-on: growler/k#32 
Reviewed-on: growler/k#34 
Reviewed-on: growler/k#35 
Reviewed-on: growler/k#36 
Reviewed-on: growler/k#38 
Reviewed-on: growler/k#39 
Reviewed-on: growler/k#40 
Reviewed-on: growler/k#41 
Reviewed-on: growler/k#42 
This reverts commit cecca679d0052dabaae12accc028a8ed90ff0f25.
Reviewed-on: growler/k#45 
Reviewed-on: growler/k#46 
Reviewed-on: growler/k#47 
Reviewed-on: growler/k#44 
Reviewed-on: growler/k#48 
growler closed this pull request 2025年10月22日 14:17:22 +02:00

Pull request closed

This pull request cannot be reopened because the branch was deleted.
Sign in to join this conversation.
No reviewers
Labels
Clear labels
No items
No labels
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ngn/k!111
Reference in a new issue
ngn/k
No description provided.
Delete branch "growler:entropy"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?