Accessing x86 Performance Counters

2015-05-12 Thread Maxime Chevalier-Boisvert via Digitalmars-d-learn
I was wondering if anyone has written D code to access the x86 performance counters, to get information such as the number of cache misses and cycle count.

Re: Explicitly Freeing Memory

2014-11-19 Thread Maxime Chevalier-Boisvert via Digitalmars-d-learn
Unfortunately I don't have any good suggestions... I have been avoiding depending on dtors in D because of the aforementioned issues (and more), so I haven't had much experience in debugging dtor-related problems in D. I decided to just free everything explicitly:

Explicitly Freeing Memory

2014-11-18 Thread Maxime Chevalier-Boisvert via Digitalmars-d-learn
I posted a thread the other day explaining that I was running into a memory leak issue which is very hard to debug. There seems to be a false pointer somewhere, and I have no way of knowing where that is or which object is being pointed to. I decided to take the easy way out and explicitly

Debugging a Memory Leak

2014-11-17 Thread Maxime Chevalier-Boisvert via Digitalmars-d-learn
There seems to be a memory leak in the Higgs compiler. This problem shows up when running our test suite (`make test` command). A new VM object is created for each unittest block, e.g.: https://github.com/maximecb/Higgs/blob/master/source/runtime/tests.d#L201 These VM objects are

Re: Debugging a Memory Leak

2014-11-17 Thread Maxime Chevalier-Boisvert via Digitalmars-d-learn
GC problems are *nasty*. My advice is to run the simplest program you can think of that still exhibits the problem, and then put in printf debugging everywhere to see where it breaks down. Not sure if this is useful. Unfortunately, the program doesn't break or crash. It just keeps

Destructor/Finalizer Guarantees

2014-11-11 Thread Maxime Chevalier-Boisvert via Digitalmars-d-learn
I have a situation where I have a VM (virtual machine) object, and several GCRoot (garbage collector root objects). The GCRoots are structs and will register themselves into a linked list belonging to the VM. I've made it so they unregister themselves in their destructor. This works perfectly

Capture parameter identifier name in a template?

2014-08-12 Thread Maxime Chevalier-Boisvert via Digitalmars-d-learn
In my JavaScript VM, I have a function whose purpose is to expose D/host constants to the JavaScript runtime code running inside the VM. This makes for somewhat redundant code, as follows: vm.defRTConst(OBJ_MIN_CAPw, OBJ_MIN_CAP); vm.defRTConst(PROTO_SLOT_IDXw, PROTO_SLOT_IDX);

Introspecting a Module with Traits, allMembers

2014-07-09 Thread Maxime Chevalier-Boisvert via Digitalmars-d-learn
Hello, I'm looking to introspect a module, list all the members, iterate over them and filter them by kind inside of a static constructor. This is in the hope of shortening some hand-written code that is quite repetitive (adding many struct instances to an associative array in a static

Re: Introspecting a Module with Traits, allMembers

2014-07-09 Thread Maxime Chevalier-Boisvert via Digitalmars-d-learn
On Wednesday, 9 July 2014 at 20:07:57 UTC, NCrashed wrote: On Wednesday, 9 July 2014 at 20:04:47 UTC, Maxime Chevalier-Boisvert wrote: auto members = [__traits(allMembers, ir.ir)]; pragma(msg, members); Have you tried without quotes? pragma(msg, __traits(allMembers, ir.ir)); Did need to

Re: Introspecting a Module with Traits, allMembers

2014-07-09 Thread Maxime Chevalier-Boisvert via Digitalmars-d-learn
I got the following code to do what I want: static this() { void addOp(ref Opcode op) { assert ( op.mnem !in iir, duplicate op name ~ op.mnem ); iir[op.mnem] = op; } foreach (memberName; __traits(allMembers, ir.ops)) {