-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Apply all changes from Configura to the public MPS. #76
Conversation
These changes were originally implemented as custom work for Configura on the custom/cet/main branch. With permission from the customer (see e-mail https://info.ravenbrook.com/mail/2022/01/18/12-53-38/0/ from Göran Rydqvist) we apply them to the public MPS, subject to future work to integrate the custom documentation and interfaces into the public manual and headers. The custom interfaces are as follows: 1. The Transforms interface provides a mechanism to rewrite references throughout the MPS-managed heap; 2. The Arena extension/contraction callbacks provide a mechanism for the client to register stack decoding callbacks on Windows managed runtime; 3. The hash arrays flag for allocation points prevents the MPS from aggressively collecting address-based hash tables.
* Move transforms sources to the core sections of the makefiles. * Move function declarations to the public header mps.h. * Update copyright notices for transforms code. * Remove references to Configura from the comments. * Remove trailing whitespace. * Translate design to reStructuredText. * Move documentation to reference section of manual. * Add warning about unsuitability when ambiguous references may exist.
* Move type and macro declarations to the public header mps.h. * Move documentation to appropriate sections of manual.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some review to be going on with.
@@ -113,15 +113,16 @@ LONG WINAPI ProtSEHfilter(LPEXCEPTION_POINTERS info) | |||
|
|||
/* ProtSetup -- set up the protection system */ | |||
|
|||
static void *vehHandle; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs a comment to explain why it's global. I can only guess that this is to assist with debugging? The name should start with prot
since it belongs to the prot module.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JPH to change variable name and investigate reason for making global
AVER(mps_old_list != NULL); | ||
AVER(mps_new_list != NULL); | ||
/* count: cannot check */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should check the public names (starting mps_
) or the internal names consistently.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JPH todo
destroyed */ | ||
if (transform->oldToNew != NULL) | ||
CHECKD(Table, transform->oldToNew); | ||
CHECKL(BoolCheck(transform->aborted)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can also check that an aborted transform has a valid table.
CHECKL(!transform->aborted || transform->oldToNew != NULL);
transformTableAlloc, | ||
transformTableFree, | ||
transform, | ||
0, 1); /* these can't be old references */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should have constants for these values, something like this:
#define TransformUnusedKey ((TableKey)0)
#define TransformDeletedKey ((TableKey)1)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JPH todo
{ | ||
Seg seg; | ||
AVER(SegOfAddr(&seg, transform->arena, old_list[i])); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could assert that the old ref is not equal to TransformUnusedKey
or TransformDeletedKey
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JPH todo
/* Condemn generation containing seg if not already condemned. */ | ||
gen = PoolSegPoolGen(SegPool(seg), seg)->gen; | ||
AVERT(GenDesc, gen); | ||
if (RingIsSingle(&gen->trace[trace->ti].traceRing)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use TraceSetIsMember(gen->activeTraces, trace)
here to avoid needing to know so many details of the data structures.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JPH todo
Arena arena; | ||
Globals globals; | ||
Trace trace; | ||
double mortality; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mortality
does not seem to be used anywhere.
/* I'm not sure why the interface is defined this way. RB 2012-08-03 */ | ||
TransformDestroy(transform); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an annoying wart on the interface — I think we should fix this before making the interface public, even though this requires the customer to update their code.
trace->fix = transformFix; | ||
trace->fixClosure = transform; | ||
|
||
res = TraceStart(trace, 1.0, 0.0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These estimates of the mortality and finishing time do not seem very good! Since this is non-incremental, we don't need accurate estimates, but maybe there is a better way to communicate that to TraceStart
/* Force the trace to complete now. */ | ||
ArenaPark(globals); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the arena ends up parked, we need to update the arena state documentation to mentation that mps_transform_apply()
parks the arena.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some more comments. I haven't looked very closely at ztfm.c since it is a test case.
* How the implementation is an add-on to the MPS. | ||
|
||
* How the code is kept separate from the mainstream MPS. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These points no longer need to be written.
|
||
* How the code is kept separate from the mainstream MPS. | ||
|
||
* Why it has its own hash table implementation (no good reason). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is true any more.
If the transform was successfully applied, it is destroyed, as if | ||
:c:func:`mps_transform_destroy` had been called. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to avoid this (see above).
#. Edit the index of releases (``release/index.html``) and add the | ||
#. Edit the index of releases (``release/index.*``) and add the | ||
release to the table, in a manner consistent with previous releases. | ||
|
||
#. Edit the index of versions (``version/index.html``) and add the | ||
#. Edit the index of versions (``version/index.*``) and add the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this change makes sense — the indexes for the public MPS are still in HTML format.
mps_transform_destroy(t1); | ||
after(myrootExact, perset, 1, -10, 2, +10); | ||
|
||
/* Two transforms, both live [-- not supported yet. RHSK 2010-12-16] */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is true that multiple transforms are not supported yet?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JPH investigate
/* testscriptB -- create pools and objects; call testscriptC | ||
* | ||
* Is called via mps_tramp, so matches mps_tramp_t function prototype, | ||
* and use trampDataStruct to pass parameters. | ||
*/ | ||
|
||
typedef struct trampDataStruct { | ||
mps_arena_t arena; | ||
mps_thr_t thr; | ||
const char *script; | ||
} trampDataStruct; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't use mps_tramp
any more, so this needs to be updated.
trampData.arena = arena; | ||
trampData.thr = thr; | ||
trampData.script = script; | ||
testscriptB(&trampData, sizeof trampData); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the only call of testscriptB
so perhaps it could be inlined here.
/* 1<<19 == 524288 == 1/2 Mebibyte */ | ||
/* 16<<20 == 16777216 == 16 Mebibyte */ | ||
|
||
testscriptA("Arena(size 500000000), " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the only call to testscriptA
so perhaps it could be inlined here.
$(PFM)\$(VARIETY)\cvmicv.exe: $(PFM)\$(VARIETY)\cvmicv.obj \ | ||
$(PFM)\$(VARIETY)\mps.lib $(FMTTESTOBJ) $(TESTLIBOBJ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cvmicv.c contains coverage tests for the CVM interface, since the code being tested is now all part of the mainline, should not these coverage tests be migrated as well?
Do we want to make Configura's MPS synchronized with the public MPS for simplicity, ease of delivery, etc.? I understand from @thejayps that some editing may have occurred in this work and that he had to re-add (without source control) work to do with interior pointers back to the code base. |
We have to be extraordinarily careful about this. It affects thousands of real users. I'm working with @thejayps to locate the ends of all the worms in this particular can. |
Blocked pending work planned in https://info.ravenbrook.com/mail/2023/02/06/10-44-45/0/ , which includes a full risk assessment and double-checking of this work. |
We have assigned this as priority "optional" since we are currently researching the associated issue in another way. This pull request could become of higher importance later. |
Added "pending" label because @gareth-rees ' comments require actions as if they were from a formal review. |
This work is subsumed by #213 , #214 , #215 , and #230 and so we will not merge this branch. Postmortem was identified as a requirement but was already implemented in a compatible way in the public MPS. |
These changes were originally implemented as custom work for Configura on the custom/cet/main branch. With permission from the customer (see e-mail from Göran Rydqvist) we apply them to the public MPS, and integrate the custom documentation and interfaces into the public manual and headers.
The custom interfaces are as follows:
The Transforms interface provides a mechanism to rewrite references throughout the MPS-managed heap;
The Arena extension/contraction callbacks provide a mechanism for the client to register stack decoding callbacks on Windows managed runtime;
The hash arrays flag for allocation points prevents the MPS from aggressively collecting address-based hash tables.