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.
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:
https://github.com/maximecb
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 free
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
allocatin
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 unfortunately
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
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_CAP"w, OBJ_MIN_CAP);
vm.defRTConst("PROTO_SLOT_IDX"w, PROTO_SLOT_IDX);
vm.defRTCons
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))
{
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));
D
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 constr
Thanks, I think the std.concurrency code demonstrates exactly
what I need :)
On Thursday, 12 December 2013 at 05:07:11 UTC, Ali Çehreli wrote:
On 12/11/2013 06:43 PM, Maxime Chevalier-Boisvert wrote:
> Is it possible to template based on a function pointer
argument? If so,
> is it possi
I'd like to know if it's possible to create a templated function
that takes a function pointer as an argument, and uses static ifs
to generate different behaviors based on the type signature of
the function pointer.
More specifically, I want to create code generation functions for
my JIT comp
The closest is to put both classes and the function in the same
module. Things all in the same module can see the private
members of each other.
Good enough for my needs. Thanks.
Does D have something like the concept of friend classes and
functions in C++? I'd like to have a function that can access
private members of two classes at the same time.
One of the reasons I chose to use D for my project is that I was
very excited about the prospect of using CTFE in mixin code.
Unfortunately, there seems to be one (or several?) bugs causing
CTFE to be very slow and to hog a huge amount of memory (multiple
gigs of RAM and swap). I use the latest
I need to pass an array literal as a template parameter. The
reference on this website seems to imply this is possible, but
doesn't illustrate it. The obvious way doesn't seem to work:
mixin template MyTemplate(int[] arr) {}
Error: arithmetic/string type expected for value-parameter, not
int[]
I'm using the mixin statement to generate function declarations
based on data structure descriptions (my attempt at declarative
programming).
I'd like to be able to increment a variable each time I evaluate
my code generation function in the mixin statement. This is so I
can generate a unique
These improvements would be very nice. The unit test framework,
as it is, is rather underpowered.
Exceptions could also use more documentation on the D website. I
heard there was some exception chaining mechanism, but I can't
even seem to find any info on the Error class.
You shouldn't have
I'd like to write some unit tests to check my software. Writing
unittest blocks and putting assert statements in there seems easy
enough, but I noticed that if the code I run in there throws an
exception, I don't get the unit test failed message.
How does unittest check for success/failure? Do
Getting started with D. I've been doing alot of googling trying
to find out what's the best way to check if an object is an
instance of some class. So far, I found you could do:
if (typeid(obj) == typeid(Class)) doSomething();
or:
if (cast(Class)obj) doSomething();
These both seem a little c
20 matches
Mail list logo