[Vm-dev] [OpenSmalltalk/opensmalltalk-vm] FileAttributesPlugin 2.0.6 (#321)

Alistair Grant akgrant0710 at gmail.com
Tue Dec 18 06:30:36 UTC 2018


Hi Eliot,

On Sat, Dec 15, 2018 at 04:11:33PM -0800, Eliot Miranda wrote:
>  
> Hi Alistair,
> 
> you can do better than using malloc & free in primitiveClosedir et al.
> If you look at the changes I made in VMMaker.oscog-eem.2490
> & VMMaker.oscog-eem.2491 you'll see a simple pattern:
>
> ...
>

You are, of course, correct.  By way of excuses: There are a number of
methods that basically do:

	faPath := calloc(1, sizeof(fapath))

I was debating with myself between whether to allocate fapath (between 
9K and 64K, depending on platform) on the heap or the stack since 
there's been some recent discussion about using the VM on SoC systems.  
It's about 30 years since I've dealth with embedded systems (collecting 
statistics on X.25 networks) or really thought about stack and heap 
allocation - I should have just admitted to myself that I'm so far out 
of date that I have no idea. :-)  Anyway, I got caught up on that and 
didn't think about this case.

I'll make the change you suggest, and also move fapath on to the stack 
(primitiveOpendir being the exception) - it will be a bit faster for 
most people.



> The only thing that;'s unclear for me at the moment is how the result of
> faInvalidateSessionId: gets tested. result doesn't get set by it. I
> presume it sets primitive failure, but there';s no test for primitive
> failure where result is tested (result = 0).

faInvalidateSessionId can't fail, all it does is set the session Id to 0 
to catch the case where someone tries to reuse an invalid fapath within 
a VM session (i.e. after calling primitiveClosedir).

Cheers,
Alistair





More information about the Vm-dev mailing list