Skip to content
This repository has been archived by the owner on Mar 24, 2022. It is now read-only.

Allow use of pinned heap registers #512

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

shravanrn
Copy link
Contributor

@shravanrn shravanrn commented May 6, 2020

@pchickey @awortman-fastly @iximeow Slightly cleaned up and rebased version of #273 with some comment fixes

I've left the code mostly as is although some of the changes here seem orthogonal. Wanted to ask about this first before removing the code

  • Context save for sandbox is also saving the value for register r8
  • In stack.rs, there is a stack overflow test where the size of the stack seems to be bumped.

Let me know if I should remove either of these, and I can update the PR

Copy link
Contributor

@iximeow iximeow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 thank you for fixing up conflicts here!

I do have two requests:

  • it looks like the r8 preservation is no longer necessary, remove that please!
  • can you make this a bit in ModuleFeatures, set by lucetc? right now there's a fairly tight coordination between "pinning the heap is enabled" and "which register is the one for heap pinning", but I could imagine a runtime wanting to reject non-pinning modules, or needing to declare which register is used for heap pinning at compile time.

Also, I don't think I ever investigated what made the magic value for stack.rs change. Can you see if 481 is still not enough to cause the expected overflow? If it's not, I'd like to ask you to figure out what the right updated value is - I think I just picked 591 as a big number that would make it overflow, with intent to minimize it when it came time to try landing the change.

@shravanrn
Copy link
Contributor Author

shravanrn commented May 13, 2020

Sorry, just wrapping some other work. Will update the pr shortly

@shravanrn
Copy link
Contributor Author

Made the changes. Hopefully the r15 bit is not too hacky --- i was trying to avoid pulling in new dependencies.
Also, restored the stack size in the test. Haven't tested this though. Waiting for CI to complete, and will fix things

@shravanrn
Copy link
Contributor Author

@iximeow looks like the tests pass with the old stack size. I think this is ready for review?

@shravanrn
Copy link
Contributor Author

ping 🙂

Copy link
Contributor

@iximeow iximeow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thought I'd taken a look but neglected to click "Submit review", sorry - one additional change I think would be good before landing this.

Glad to see that the stack.rs change didn't need to stick though, thank you!

@@ -59,6 +59,8 @@ pub struct ModuleFeatures {
pub lzcnt: bool,
pub popcnt: bool,
pub instruction_count: bool,
pub pinned_heap: bool,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How's it sound to make this an Option<HeapPinStyle>? Then None means "no pinning", and HeapPinStyle can be written like

#[repr(u8)]
enum HeapPinStyle {
    PinR15 = 1
}

that we can extend if need be in the future?

I mostly want to avoid a cranelift RegUnit, even in u16 form in lucet-module - the stability of those numbers isn't guaranteed, so we could misinterpret an old module, or an old runtime could misinterpret a new module.

@pchickey pchickey closed this Jun 26, 2020
@pchickey
Copy link
Contributor

This PR was closed as a byproduct of deleting the branch named master. If this is still an active PR, re-open as a new PR against main.

@acfoltzer acfoltzer reopened this Jun 26, 2020
@acfoltzer acfoltzer changed the base branch from master to main June 26, 2020 00:51
@awortman-fastly awortman-fastly mentioned this pull request Jul 2, 2020
@iximeow
Copy link
Contributor

iximeow commented Jul 2, 2020

Just a heads up, I pushed a small commit here that specifically lists what heap pinning approach lucetc builds a module expecting. With that (or a change like it) I'd be happy to ✔️ but I can't push to this branch so either you can cherry pick it or I can rebase these two and put up a new PR. Either works!

We've enabled CircleCI for some of our CI workflow since this branch got put up, so either way it'll need to pick up that configuration to get a pass on CI now.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants