Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce %jinx Hint #62

Merged
merged 4 commits into from
Jul 3, 2024
Merged

Introduce %jinx Hint #62

merged 4 commits into from
Jul 3, 2024

Conversation

sigilante
Copy link
Contributor

%jinx hint for timeout.

@will-hanlen
Copy link

I would be excited by this change. Will be useful in any situation where the user is allowed to type in hoon: a hoon-school app, an excel-like hoon spreadsheet, a jupyter-like hoon notebook, etc.

@sigilante
Copy link
Contributor Author

@joemfb pointed out to me the mil_w argument in u3m_soft which sets a preemptive interrupt. However, a path to use this for a particular expression evaluation is not currently clear.

The normal way a hint is handled is to compile it into the Nock bytecode in nock.c. This introduces a side effect like SLOG which gets processed by a special handler.

For %jinx, this isn't adequate because we actually need to be "outside" the Nock code. So let's consider the paths by which we evaluate Nock.

  • ++minku3we_minku3n_nock_etu3m_soft_run, u3n_nock_on. Both of these bypass u3m_soft entirely.

  • Another path to evaluate Nock is in serf.c, which does use u3m_soft in event replay. Not helpful, and succeeds because we know that the event already succeeded.

  • main.c has the wish stuff, also not relevant here.

  • vortex.c uses it on boot, also not helpful here.

  • serf.c: u3m_soft with mil_w_serf_poke_serf_worku3_serf_worku3_serf_writ, which obtains mil_w from the tail of the wit argument. ← _cw_serf_writ registered as inn_u.pok_f for the system poke handler ← called in conn.c and lick.c and newt.c.

  • u3_ovum_init accepts mil_w and places it in the ovum (potential event). OK, now we're getting somewhere. All of the calls to u3_ovum_init always start with mil_w = 0, fine, but at least this is where you set the value and how it gets accessed downstream. The question is how to hook this up to arbitrary Nock execution.

(There's also the vexing question of what would happen if one nested %jinx hints—don't do this!)

@sigilante
Copy link
Contributor Author

OK, so one way to think about this: maybe there's a global timer that is accessed when the standard event execution takes place.

@sigilante
Copy link
Contributor Author

Implementation in urbit/vere #648.

@belisarius222 belisarius222 merged commit 6fc01a0 into main Jul 3, 2024
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.

3 participants