Hi,

Thanks for the suggestion, but I would like to avoid the overhead of storing everything in an array, if possible. In fact, I would like to not have to manage this at all. I am still thinking this check is being more conservative than it needs to be, although I will be trying the block idea.

-Justin

[email protected] wrote:

Knowing nothing at all about what you're doing, I'm wondering -- could you make an array (or other data structure) that holds all the values? I would think that if you were to replace a not-needed value in an array with something else -- e.g. 0 -- then the value that had been in that slot would be eligible for GC right at that point (unless it was referenced elsewhere of course).

Could that solve your problem?

J. Merrill



From:   Justin Collins <[email protected]>
To:     Neko intermediate language mailing list <[email protected]>
Date:   03/03/2010 06:35 AM
Subject:        Re: [Neko] neko_check_stack failure
Sent by:        <[email protected]>


------------------------------------------------------------------------



Nicolas Cannasse wrote:
> Justin Collins a écrit :
>  > Okay, granted. However, what about 124 locals at the top-level? That
>> seems to fail, as well.
>> As I understand it, local variables are only copied into functions if
>> they are accessed from those functions. This particular test seems to
>> assume all local variables may be copied, whether they actually will
>> or not. Is this correct?
>
> Yes, it will fail as well.
>
>> My problem is that I generate a lot of short-lived, temporary
>> variables. They are not going to be accessed from inside other
>> functions (so there is no danger of having to copy 100+ variables to
>> the function stack). I don't want them to be globals, because I want
>> them garbage collected as soon as possible. What are my options?
>
> Use {} blocks to separate the stacks :
>
> {
>  var v1,v2....v50;
>  ...
> }
> {
>   var v51,v52....v100;
>   ...
> }
>
> This will ensure that your current stack never reach 128.
>
> Best,
> Nicolas
>

Aha, thank you.

It will take some thinking for me to figure how to use this...and
playing around with how it interacts with functions and other control
structures.

-Justin

--
Neko : One VM to run them all
(http://nekovm.org <http://nekovm.org/>)





--
Neko : One VM to run them all
(http://nekovm.org)

Reply via email to