grain icon indicating copy to clipboard operation
grain copied to clipboard

feat(compiler)!: Decrease initial memory pages to 1

Open AjaySDwivedi1 opened this issue 1 year ago • 7 comments

Changed initial memory pages value to 1

AjaySDwivedi1 avatar Apr 22 '24 00:04 AjaySDwivedi1

I was having some issues downloading and running node.js so if I need to fix or change anything let me know.

AjaySDwivedi1 avatar Apr 22 '24 00:04 AjaySDwivedi1

Can the checkpoints that are failing be explained a little to me? I'm a little lost on what to fix or change.

AjaySDwivedi1 avatar Apr 22 '24 19:04 AjaySDwivedi1

These are two great test failures—they show a case I hadn't considered. We have a flag, --memory-base, which allows you to reserve an amount of memory that the Grain code won't touch. Those two tests request ~1mb of memory be reserved. The error we see is happening because Grain code is trying to write to memory addresses that don't exist.

We'll either need to automatically start with more pages or provide an error to the user that they need to also ask for more pages.

Looking into this I realized there's also a potential compiler bug that could happen from a particularly large program. That's a little involved to fix, so we'll send a PR to handle that and then we can rebase this PR once that fix is in.

Lots of fun from just a two character change 😄

ospencer avatar Apr 22 '24 20:04 ospencer

These are two great test failures—they show a case I hadn't considered. We have a flag, --memory-base, which allows you to reserve an amount of memory that the Grain code won't touch. Those two tests request ~1mb of memory be reserved. The error we see is happening because Grain code is trying to write to memory addresses that don't exist.

We'll either need to automatically start with more pages or provide an error to the user that they need to also ask for more pages.

Looking into this I realized there's also a potential compiler bug that could happen from a particularly large program. That's a little involved to fix, so we'll send a PR to handle that and then we can rebase this PR once that fix is in.

Lots of fun from just a two character change 😄

I think we should warn the user that the minimum memory page count is below the requested starting amount, rather than just automagically fixing it. I think in environments where you really care about memory usage it's important that the flags are doing what you say.

spotandjake avatar Apr 22 '24 20:04 spotandjake

Yup, that's going to be a part of the fix. Either a warning or an error.

ospencer avatar Apr 22 '24 20:04 ospencer

Specifically, I wouldn't say we're "fixing" it if the program requires more than one starting page and the user didn't specify a specific number of starting pages. In the cases where they do specify the number of pages, we'll either error/warn.

ospencer avatar Apr 22 '24 20:04 ospencer

#2095

JeysonFlores avatar May 16 '24 05:05 JeysonFlores