[M3devel] RTMachine.PointerAlignment = 1 on NT?
Jay K
jay.krell at cornell.edu
Mon Apr 5 13:41:10 CEST 2010
For the vast majority of platforms:
RTMachine.PointerAlignment = BYTESIZE(INTEGER).
except 1 for NT386, 2 for M68K (dead).
PointerAlignment = BYTESIZE(INTEGER);
(* The C compiler allocates all pointers on 'PointerAlignment'-byte
boundaries. The garbage collector scans thread stacks, but only
looks at these possible pointer locations. Setting this value
smaller than is needed will only make your system run slower.
Setting it too large will cause the collector to collect storage
that is not free. *)
I suggest this is not exactly true.
1) Of what relevance is the C compiler? vs. the Modula-3 compiler.
2) We really think the number is 1 for NT386?
I understand I could say:
void F(void* traced)
{
#pragma pack(1)
struct { char a; void* p} = {0, traced};
}
but
1) That seems highly unlikely.
2) Do we really anticipate the case where C code is the *only* holder of a traced reference?
And more so, it wasn't a parameter to the C code -- the location of parameters is controlled by Modula-3, assuming a pointer-aligned stack.
3) Can't we know/assume/verify that Modula-3 code only stores pointers at more aligned location?
My real goal is to make there only be one RTMachine for systems that don't have stack walkers.
Leave SOLgnu/SOLsun alone.
(Later on implement stack walking for many platforms via libunwind.)
There are I believe only two differences to iron out. Allocation size (8K vs. 64K) and PointerAlignment (1 vs. BYTESIZE(INTEGER)).
There is a reason for NT to be 64K allocation size -- that is what VirtualAlloc uses.
I can test 64K on others.
Historically smaller is probably more efficient.
These days larger but not *too* large is probably more efficient.
64K should work fine on all platforms. Heck, even something larger like 1MB is probably good.
I'll test out 64K.
Can/should we have "paranoidgc" imply PointerAlignment = 1, and report whenever a pointer is found at a location with alignment less than BYTESIZE(pointer)?
A form of this is reasonable today, right? If PointerAligment = 1, I can have it report any found at less than BYTESIZE(pointer), test it a while, if none found, elevate NT386 to that value?
If any found, that'll help educate me/us on why it is 1, and maybe how to change it, or why leave it alone.
- Jay
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20100405/8884b16d/attachment-0001.html>
More information about the M3devel
mailing list