digitalmars.D.announce - nogc and NSAutoPool-style regions.
- "Ola Fosheim =?UTF-8?B?R3LDuHN0YWQi?= (32/32) Jul 08 2014 Seems to me that most of the utility beyond maintaining graph
- "Ola Fosheim =?UTF-8?B?R3LDuHN0YWQi?= (1/1) Jul 08 2014 Wrong forum :-(
Seems to me that most of the utility beyond maintaining graph like structures can be covered by making the compiler aware of region allocator semantics. Assuming that the use of GC is constrained locally and does not consume too much space. I think it would work out ok for loading of smaller files etc with the following kind of semantics: Something_ptr someglobalvar; process(A a) { int x; regionalloc(1024,256) { // 1 MiB default size, 256KiB increments auto y = new ...; // gc new() is hijacked by regionalloc // assignments must be restricted so that new() ptrs and y ptrs // are not assigned to memory that can escape the regionalloc // and no writes to global ptrs of region allocated objects allowed auto ptr = compute_with_constrained_gc_semantics(a,y) someglobalvar = make_malloc_copy(ptr); // optimization: remove temporary x = obtain_some_value(ptr); } // region is dead here, including y and ptr objects } The real challenge is in putting the right constraints on the regionalloc block, but I guess weakly pure functions are kind of close in their constraints. So it should be possible? The goal would be to be able to link to libraries that aren't nogc aware without having the GC runtime available. For loading, initialization etc.
Jul 08 2014