Gareth Rees
a5ddfca39b
New generic function segflip allows the segment to decide how to handle a trace that’s about to flip.
...
Copied from Perforce
Change: 194000
2018-06-20 10:23:16 +01:00
Gareth Rees
e93949aeef
Refactor arenapeekseg so that it maintains the mps invariants by scanning the segment if necessary. arenaread is now a thin wrapper around arenapeekseg. new function arenawrite is now the corresponding wrapper around arenapokeseg.
...
MRG reference segments inherit from GCSeg (not MutatorSeg) and so don't have hardware barriers. Instead, the code implements software barriers by always using ArenaRead and ArenaWrite.
Copied from Perforce
Change: 193990
2018-06-19 16:25:52 +01:00
Gareth Rees
7f7822d4ab
Segment class gcseg no longer implements hardware barriers; these are implemented by new subclass mutatorseg, which is now used everywhere that gcseg was used formerly. the idea is that in a future change mrgrefseg will inherit from gcseg instead of mutatorseg.
...
Copied from Perforce
Change: 193981
2018-06-19 14:45:42 +01:00
Gareth Rees
f61af11694
Postpone some lookups until it is known that they are needed (avoiding the lookups in the common case where they are not).
...
Copied from Perforce
Change: 193975
2018-06-19 12:27:07 +01:00
Gareth Rees
e62c3dc0c5
Simplify the wasmarked protocol.
...
Copied from Perforce
Change: 193940
2018-06-18 20:03:13 +01:00
Gareth Rees
3e233329d3
Assertions on the critical path.
...
Copied from Perforce
Change: 193879
2018-06-18 13:17:42 +01:00
Gareth Rees
00da8664cd
Mach_thread_self() can in theory "return mach_port_null if a resource shortage prevented the reception of the send right" so add a check in each case. (there's nothing we can do about it but at least we can notice.)
...
Copied from Perforce
Change: 193831
2018-06-15 12:54:28 +01:00
Gareth Rees
fd9f9c41d0
It's safe to register a thread multiple times on macos, so there is no need for the guard.
...
Copied from Perforce
Change: 193828
2018-06-15 12:44:51 +01:00
Gareth Rees
c4a840d676
Rename "mac os x" and "os x" to "macos", except for a few cases where for historical accuracy we want to continue to refer to the former name.
...
Copied from Perforce
Change: 193821
2018-06-15 12:15:36 +01:00
Gareth Rees
11fff0151d
Fix typo.
...
Copied from Perforce
Change: 193811
2018-06-15 11:15:42 +01:00
Gareth Rees
0662e96899
Refactor atfork code to improve separation of concerns.
...
Copied from Perforce
Change: 193806
2018-06-15 10:58:33 +01:00
Gareth Rees
a3779b8c3b
Start the collection and dereference the objects in the parent as well as the child.
...
Copied from Perforce
Change: 193800
2018-06-15 10:06:59 +01:00
Gareth Rees
7ed378141c
Fix issues identified in review by nb.
...
Copied from Perforce
Change: 193793
2018-06-14 19:31:30 +01:00
Gareth Rees
a865019b13
Update design history. restore accidentally removed check.
...
Copied from Perforce
Change: 193787
2018-06-14 17:55:03 +01:00
Gareth Rees
e98b2a05c8
Improve comments.
...
Copied from Perforce
Change: 193783
2018-06-14 17:44:41 +01:00
Gareth Rees
78e6d003bb
Fix ansi build.
...
Copied from Perforce
Change: 193769
2018-06-14 16:58:24 +01:00
Gareth Rees
38a08a6a62
Avoid compilation errors from latest msvc.
...
Copied from Perforce
Change: 193768
2018-06-14 16:54:33 +01:00
Gareth Rees
598b64afb4
Support for fork on linux and freebsd.
...
Copied from Perforce
Change: 193765
2018-06-14 16:47:23 +01:00
Gareth Rees
61e24c399a
Take locks before fork(), release them in the parent and reinitialize them in the child.
...
Add forktest target to the Xcode project.
Write design for fork safety and cross-reference from the code.
Update release notes.
Copied from Perforce
Change: 193760
2018-06-14 16:25:08 +01:00
Gareth Rees
2ccdd80953
Extend forktest so that it does allocation before the fork and collection afterwards; this ensures that we hit the read barrier and thus exercise the exception handling.
...
After forking in the child, re-create exception port and exception thread, and re-register the (only) thread with that port.
Copied from Perforce
Change: 193755
2018-06-14 12:54:35 +01:00
Gareth Rees
47fc093662
Add fork test case (fails on os x if pthread_atfork is not called).
...
pthread_atfork handlers on OS X: in the child, update the mach port for the forking thread and move all other threads to the dead ring.
Copied from Perforce
Change: 193746
2018-06-13 17:09:07 +01:00
Gareth Rees
169b8dcaf6
Avoid using deprecated function mps_fix and deprecated macro mps_fix in the test cases; use mps_fix12 instead.
...
Copied from Perforce
Change: 193726
2018-06-13 13:59:14 +01:00
Gareth Rees
b9ae05b94f
Remove undocumented plinth function mps_lib_assert_fail_expr and rewrite assertp macro to call documented plinth function mps_lib_assert_fail instead.
...
Copied from Perforce
Change: 192941
ServerID: perforce.ravenbrook.com
2017-03-04 11:17:11 +00:00
Gareth Rees
e9df5d6a35
Remove used epvmdefaultsubsequentsegsize.
...
Copied from Perforce
Change: 192938
ServerID: perforce.ravenbrook.com
2017-03-04 11:02:31 +00:00
Gareth Rees
cccb1c1e3c
Documentation improvements.
...
Copied from Perforce
Change: 192905
ServerID: perforce.ravenbrook.com
2017-02-18 09:38:15 +00:00
Gareth Rees
4af5b181b3
Fix typos.
...
Copied from Perforce
Change: 192890
ServerID: perforce.ravenbrook.com
2017-02-11 11:30:15 +00:00
Gareth Rees
3389ec396f
Add "cold end" and "hot end" to the glossary index.
...
Copied from Perforce
Change: 192660
ServerID: perforce.ravenbrook.com
2016-10-20 13:52:30 +01:00
Gareth Rees
0f4564a71b
Merge design.mps.class-interface into design.mps.pool (as suggested by pekka p. pirinen on 1999-07-20).
...
Bring pool class method descriptions up to date.
Document bufferClass, bufferFill, bufferEmpty, totalSize, freeSize methods.
Document generic instance methods at design.mps.protocol.method.
Copied from Perforce
Change: 192642
ServerID: perforce.ravenbrook.com
2016-10-19 15:34:35 +01:00
Gareth Rees
577b32d481
Cherry-pick change 192595 from custom/cet/main, removing mps_addr_object. this function failed to solve the problem of decoding the stack on 64-bit windows, because the stack may need to be decoded after an mps assertion failure, in which case the arena lock is held and mps_addr_object cannot be called. we eventually solved the problem in a different way (using mps_arena_postmortem) and mps_addr_object is no longer used.
...
Copied from Perforce
Change: 192637
ServerID: perforce.ravenbrook.com
2016-10-19 14:13:38 +01:00
Gareth Rees
9f505c501d
Remove unused pool class methods tracebegin and traceend.
...
Remove unused event AMCTraceEnd.
The fixEmergency method must have the same type as the fix method because of how they are used.
Copied from Perforce
Change: 192636
ServerID: perforce.ravenbrook.com
2016-10-19 14:07:20 +01:00
Gareth Rees
8019558576
Use nextmethod to call the superclass init method, instead of calling poolabsinit directly. regularize the error handling.
...
Copied from Perforce
Change: 192631
ServerID: perforce.ravenbrook.com
2016-10-19 11:34:04 +01:00
Gareth Rees
84e59c626e
Bring design.mps.message up to date and move it from old to current.
...
Copied from Perforce
Change: 192625
ServerID: perforce.ravenbrook.com
2016-10-18 22:35:13 +01:00
Gareth Rees
2e7a76cc5c
Regularize the signature comments, for the benefit of design.mps.sig.test.uniq.
...
Copied from Perforce
Change: 192620
ServerID: perforce.ravenbrook.com
2016-10-18 18:30:50 +01:00
Gareth Rees
c07a54b388
Remove design documents for unsupported operating systems sunos, solaris and osf/1 (protsu, sso1al, vmo1, and vmso).
...
Update thread-safety and version-library design documents and move them from old to current.
Copied from Perforce
Change: 192617
ServerID: perforce.ravenbrook.com
2016-10-18 18:30:09 +01:00
Gareth Rees
52d40d2fed
Remove unused functions landcreate and landdestroy.
...
Copied from Perforce
Change: 192603
ServerID: perforce.ravenbrook.com
2016-10-14 22:30:11 +01:00
Gareth Rees
ce8e22cd8e
Split generic mutator context module into two parts: one for generic operating system (prmcan.c) and one for generic architecture (prmcanan.c).
...
Copied from Perforce
Change: 192583
ServerID: perforce.ravenbrook.com
2016-10-14 13:25:14 +01:00
Gareth Rees
9a2d4390b5
Add discriminator to mutatorcontextstruct and implement mutatorcontextinitfault and mutatorcontextinitthread on posix/linux.
...
Copied from Perforce
Change: 192577
ServerID: perforce.ravenbrook.com
2016-10-14 12:39:50 +01:00
Gareth Rees
0e3d8e373d
Add discriminator to mutatorcontextstruct and implement mutatorcontextinitfault and mutatorcontextinitthread on os x.
...
Copied from Perforce
Change: 192572
ServerID: perforce.ravenbrook.com
2016-10-14 12:04:01 +01:00
Gareth Rees
1a04431cff
New modulefile prmcw3.c avoids duplication of code between prmcw3i3.c and prmcw3i6.c.
...
Implement MutatorContextCheck on Windows. Add AVERT(MutatorContext, context) in PoolAccess and other functions.
Document initialization functions MutatorContextInitFault and MutatorContextInitThread and implement them on Windows.
Add a union discriminator to MutatorContextStruct on Windows so that we don't accidentally try to get the stack pointer from a fault context, or the exception address from a thread context.
Copied from Perforce
Change: 192567
ServerID: perforce.ravenbrook.com
2016-10-14 11:53:26 +01:00
Gareth Rees
4457a77a07
Initialization and checking of mutatorcontext data structures.
...
New files prmcix.c and prmcxc.c avoid duplicated code.
Copied from Perforce
Change: 192562
ServerID: perforce.ravenbrook.com
2016-10-13 23:13:40 +01:00
Gareth Rees
0abb95e025
Use protsgix.c on linux and delete protli.c.
...
Copied from Perforce
Change: 192556
ServerID: perforce.ravenbrook.com
2016-10-13 21:24:04 +01:00
Gareth Rees
a4064881dc
In protsgix.c, construct a mutatorcontext object and pass it to arenaaccess.
...
Copied from Perforce
Change: 192550
ServerID: perforce.ravenbrook.com
2016-10-13 20:12:32 +01:00
Gareth Rees
139611337a
Fix "make testmmqa" on freebsd (the shell doesn't do {a,b,c} expansion).
...
Copied from Perforce
Change: 192545
ServerID: perforce.ravenbrook.com
2016-10-13 19:31:25 +01:00
Gareth Rees
613f3f56f1
Fix comment: ll = clang/llvm, not gcc.
...
Copied from Perforce
Change: 192540
ServerID: perforce.ravenbrook.com
2016-10-13 19:15:27 +01:00
Gareth Rees
ba896883ba
Fix makefile, accidentally broken by change 192512.
...
Copied from Perforce
Change: 192539
ServerID: perforce.ravenbrook.com
2016-10-13 19:13:31 +01:00
Gareth Rees
9b3e45e883
Implement mutatorcontextsp and mutatorcontextscan for platforms w3i3 and w3i6.
...
This means that ThreadScan becomes identical on these two platforms and can be moved to thw3.c.
This means that thw3.h, thw3i3.c and thw3i6.c become redundant and can be deleted.
Copied from Perforce
Change: 192534
ServerID: perforce.ravenbrook.com
2016-10-13 16:28:50 +01:00
Gareth Rees
d83934de69
Remove return statements that have no effect.
...
Copied from Perforce
Change: 192529
ServerID: perforce.ravenbrook.com
2016-10-13 15:17:50 +01:00
Gareth Rees
b4a3d0824b
Rename the "protection mutator context" module to "mutator context" (this module handles mutator context decoding for both the protection module and the thread module).
...
Rename functions Prot{Can,}StepInstruction to MutatorContext{Can,}StepInstruction so that they follow the naming convention in guide.implc.naming.prefix.program.
Move mutator context declarations out of prot.h into new header prmc.h.
Correct .assume.null in a couple of places -- it's not safe for MutatorContextStepInstruction to return ResUNIMPL, instead MutatorContextCanStepInstruction should return FALSE.
Copied from Perforce
Change: 192528
ServerID: perforce.ravenbrook.com
2016-10-13 15:06:14 +01:00
Gareth Rees
437bf9c6a4
Rename mutatorfaultcontext to mutatorcontext because this data structure is not only used to store the context of a fault, but also to store the context of a thread that has been suspended.
...
Copied from Perforce
Change: 192523
ServerID: perforce.ravenbrook.com
2016-10-13 14:23:39 +01:00
Gareth Rees
34be22b383
Remove undocumented global mps_exception_info. now that the mps is open source, there is no difficulty in debugging the mutator context.
...
Copied from Perforce
Change: 192518
ServerID: perforce.ravenbrook.com
2016-10-13 13:45:31 +01:00