This repository was archived by the owner on May 29, 2023. It is now read-only.
Various fixes and improvements#1
Open
philipcmonk wants to merge 1 commit intoashelkovnykov:masterfrom
Open
Conversation
These are mostly small bugs I ran into when trying to run this in zorp-corp/sword#33. They should mostly be self-explanatory, but I'm happy to explain any of them or go over this synchronously. The changes I made beyond bug fixes are: - Added `pma_in_arena(void*)` so the copying code knows whether it needs to copy a noun out. - Added `root` to the metadata to record where the most recent root is, which will generally be the arvo state, bytecode cache, and anything else that needs to be persisted. You need this so that when you load, you know where to get started. There are a few possible variations, for example we could put the event number and epoch number inside the root as well. - Made pma_load return the epoch number, event number, and root. Right now it returns these as a struct, but out parameters plus an error code return could be preferable.
|
|
||
| // TODO: macros for dealing with cache? | ||
| // Pop page off queue | ||
| uint16_t head = _pma_state->metadata.dpage_cache->head; |
Owner
There was a problem hiding this comment.
Do you recall the reason for moving this declaration down? It's not used between the location in the original code and the location in this PR.
| _pma_state->metadata.dpage_cache->size -= 1; | ||
| _pma_state->metadata.dpage_cache->head = ((head + 1) % PMA_DPAGE_CACHE_SIZE); | ||
|
|
||
| _pma_state->metadata.dpage_cache->head = (_pma_state->metadata.dpage_cache->head + 1) % PMA_DPAGE_CACHE_SIZE; |
Owner
There was a problem hiding this comment.
Do you recall the reasoning for this change? What's wrong with using head?
| // If pages available in cache... | ||
| if (size) { | ||
| // Use a page from the cache and record that it was used afterwards | ||
| uint16_t head = _pma_state->metadata.dpage_cache->head; |
Owner
|
This PR now exists just for posterity - this work is being continued here |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
These are mostly small bugs I ran into when trying to run this in zorp-corp/sword#33. They should mostly be self-explanatory, but I'm happy to explain any of them or go over this synchronously.
The changes I made beyond bug fixes are:
pma_in_arena(void*)so the copying code knows whether it needs to copy a noun out.rootto the metadata to record where the most recent root is, which will generally be the arvo state, bytecode cache, and anything else that needs to be persisted. You need this so that when you load, you know where to get started. There are a few possible variations, for example we could put the event number and epoch number inside the root as well.pma_loadreturn the epoch number, event number, and root. Right now it returns these as a struct, but out parameters plus an error code return could be preferable.