454 Commits

Author SHA1 Message Date
theraven
4a78269815 Removed debugging line accidentally committed. 2011-05-29 14:36:05 +00:00
theraven
4ffb19230f Make sure that the statics used to store internal tables are marked as roots. 2011-05-29 14:27:41 +00:00
theraven
8f530849fd When assigning a pointer to an object that is allocated on the stack to the heap, send a -copy message. This lets you cast blocks to id and then assign them to ivars without anything breaking. Apple's 'solution' to this is to segfault, which is not particularly elegant. This code is also quite an ugly hack (it just checks whether the object is allocated within a couple of pages of the current stack frame), so I might remove it before release. 2011-05-29 13:53:15 +00:00
theraven
e7767baf50 Don't send retain / release messages in GC mode when copying object pointers into blocks. 2011-05-29 13:50:46 +00:00
theraven
d1199844cb Lock the GC mode once something has queried it. All of the GNUstep code that
does run-time detection of whether to use GC calls objc_collecting_enabled()
(sometimes indirectly, via NSGarbageCollector) to see if we're in GC mode.
After any of these calls, it is not safe to switch modes.
2011-05-28 15:10:03 +00:00
theraven
fe5d1b892a Tweak GC check, make sure GC_init() is called even when ObjC code isn't using GC (stuff internal to the runtime may be) 2011-05-28 14:38:02 +00:00
theraven
d73eb8f634 Expose another function in the header. 2011-05-28 13:24:24 +00:00
theraven
6d78040180 Initial support for running finalizers in a separate thread. 2011-05-28 13:07:11 +00:00
theraven
0c8faf1961 Sometimes people assign things like classes to __weak pointers. This confuses the GC, because it expects to be able to finalize / delete things that are the target of disappearing links. 2011-05-28 11:04:47 +00:00
thebeing
e661e203d4 Re-enable function inlining. 2011-05-27 19:12:18 +00:00
thebeing
1653751263 Use -lgc on linux platforms. 2011-05-27 18:11:53 +00:00
theraven
4136ad8413 Do an exhaustive collection before dumping stats in response to a signal. 2011-05-27 18:06:39 +00:00
thebeing
72ec07268d Work around GCC error for inline assembly. 2011-05-27 18:06:20 +00:00
theraven
0c72e2e418 Use typed allocations for the hash table entries. This makes sure that the GC won't treat the jump table bitfield as a pointer.
Store the refcount structures inside the hash table, rather than in a chained structure.  This uses less space and should be easier for the GC to scan (less cache used).
2011-05-27 17:40:58 +00:00
thebeing
32b4432ebc Add correct defines for threaded boehm-gc on linux. 2011-05-27 15:27:05 +00:00
theraven
2d9f41aa94 If we're linking against Boehm GC, then we may as well allow it to collect the runtime's hash tables, rather than doing that manually. 2011-05-27 14:54:06 +00:00
theraven
7deef6854a Tweaked release announcement to reflect the fact that GC is built by default unless explicitly disabled. 2011-05-27 14:30:57 +00:00
theraven
3b96938128 Removed GCKit. 2011-05-27 14:27:59 +00:00
theraven
3769a48cd7 Add an ugly hack to prevent a clever optimiser from realising that it can completely optimise objc_clear_stack() away. 2011-05-27 09:44:12 +00:00
theraven
5b2c24bed3 If LIBOBJC_DUMP_GC_STATUS_ON_SIGNAL is set, dump the GC state in response to kill -$(LIBOBJC_DUMP_GC_STATUS_ON_SIGNAL) {pid}. 2011-05-26 22:08:27 +00:00
theraven
cd9ac97fb8 Refine typed allocations slightly. 2011-05-26 18:30:39 +00:00
theraven
0cb2ea01bc Simplify the finalization code slightly. 2011-05-26 18:05:05 +00:00
theraven
5e60899d8e Allow tweaking GC info dump on exit from an environment variable. 2011-05-26 14:28:47 +00:00
theraven
c6fc399a73 Enable GC support by default. You can still turn it off with boehm_gc=no. 2011-05-26 14:25:15 +00:00
theraven
3508ab6ccf Fixed ABI compatibility test. 2011-05-26 14:24:36 +00:00
theraven
306e10edde Tidy up some of the left-over debugging code for GC mode. 2011-05-26 14:17:31 +00:00
theraven
e05c9c2ff5 More GC fixes 2011-05-26 13:28:31 +00:00
theraven
33b7ecb2f8 Don't call -finalize if it doesn't exist. 2011-05-25 17:23:54 +00:00
theraven
fcc47bc7ce Fix building without GC support. Still need to make sure that some of the GC functions always work, since they are expected to be no-ops in non-GC mode. 2011-05-25 12:25:27 +00:00
theraven
01237af0fc Add GC-aware property accessors (in GC mode, we don't need all of the atomic juggling, because the GC looks after that stuff for us). 2011-05-25 12:15:58 +00:00
theraven
ae4eea1597 Some bug fixes for GC mode. 2011-05-25 10:09:13 +00:00
theraven
22c20eb930 Removed spurious debugging line. Removed left-over check that stopped GC_Optional modules from enabling the GC. 2011-05-24 13:40:51 +00:00
theraven
898707bf94 Added function for getting reference count. 2011-05-24 13:11:25 +00:00
theraven
368bf3bd1d Add reallocate function. 2011-05-24 13:02:18 +00:00
theraven
88c075893f Call ObjC++ destructors when finalising an object.
Add public APIs required to implement [NSGarbageCollector -enable] and [NSGarbageCollector -disable].
2011-05-24 12:38:40 +00:00
theraven
444688895a Updated Makefile to compile correctly again.
Added a really ugly hack so that the ABI versions of the three .m files are not checked.  This will (hopefully!) prevent the GC being enabled when libobjc is loaded after being compiled with -fobjc-gc.
2011-05-24 09:44:13 +00:00
theraven
3385e7a724 Remove dead code. 2011-05-23 17:39:10 +00:00
theraven
a4decfa4e3 Add hidden class -dealloc method as -finalize as well. 2011-05-23 17:38:31 +00:00
theraven
9015795dde Use explicitly typed memory for instances. 2011-05-23 17:26:44 +00:00
theraven
9dcc66f7f6 Make sure that associated objects and blocks use GC-scanned memory in GC mode.
Blocks do not yet support __weak bound variables.  This needs fixing before the release.
2011-05-23 16:24:45 +00:00
theraven
2329b7a1ec Change spelling to be consistent with Apple. 2011-05-23 12:08:45 +00:00
theraven
929f8f95b4 Improved a few GC functions.
Added objc-auto.h header, providing (documented) public interfaces to this
functionality.
2011-05-23 11:11:51 +00:00
theraven
ef03a4bdb0 Add objc_gc_allocate_collectible() function, which can be used to implement NSAllocateCollectible(). 2011-05-23 09:46:37 +00:00
theraven
ad16172625 First pass at implementing Apple-compatible GC using Boehm. Still needs some tidying, but the following work:
- __strong pointers, preventing objects from being freed

_ __weak pointers are automatically freed when the last remaining __strong pointer goes away

- objc_gc_{retain,release}_np() functions, which can be used to implement CFRetain() and CFRelease() (adds an reference count - the object will not be collected until after its last retain is gone.
2011-05-22 23:02:04 +00:00
theraven
4f31ed8acd Some tweaks to optimisation order. 2011-05-15 13:06:05 +00:00
theraven
2912bae0a7 Ooops, another debugging line left in which caused a pass not to run... 2011-05-14 18:01:38 +00:00
theraven
b7986e9efa Ooops. Accidentally left the bit that actually did the optimisation commented out. 2011-05-14 17:21:39 +00:00
theraven
8f423d0e29 Fix non-fragile ivar short-circuiting (i.e. hard-code the CORRECT ivar addresses, don't make foo and foobar have the same offset). 2011-05-14 16:12:46 +00:00
theraven
5705845e98 Fixed some bugs with the optimisation passes and introduced support for automatically running them (requires LLVM 3 + a patch that is not yet in trunk, but should be soon). 2011-05-14 15:32:26 +00:00
theraven
dd81cda462 Fix autocompletion bug. 2011-05-11 10:44:34 +00:00