Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Changeset 3145 for trunk/object.di

Show
Ignore:
Timestamp:
01/31/08 15:04:34 (10 months ago)
Author:
sean
Message:

* Moved exception trace generation from tango.core.Exception into the runtime. This involved adding a TraceInfo? interface to the global Exception class, and moving the machinery to generate a trace into genobj.d.


* The new hook to attach a trace hander is as follows:

extern (C) void  rt_setTraceHandler( void function( void* ptr = null ) h );

This feature is exposed in tango.core.Runtime as the new 'traceHandler' property.


* The change to tracing inspired me to similarly rewire the collection handler code to move that hook into the runtime as well. This was done to improve efficiency for collections, as each collected object can now simply test a pointer to see if a handler is set rather than calling into user-space to perform the same check. The new hook for this mechanism is:

extern (C) void  rt_setCollectHandler( void function(Object) h );

And the feature is also exposed in the Runtime object as the new collectHandler property. I thought about the name 'collectHandler' being in Runtime rather than GC, but I think the accompanying explanation for the function justifies the decision.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/object.di

    r3028 r3145  
    156156class Exception : Object 
    157157{ 
     158    interface TraceInfo 
     159    { 
     160        int opApply( int delegate( inout char[] ) ); 
     161        char[] toString(); 
     162    } 
     163 
    158164    char[]      msg; 
    159165    char[]      file; 
    160166    size_t      line; 
     167    TraceInfo   info; 
    161168    Exception   next; 
    162169