Completely sidetracked

Whiteknight on 2008-08-07T01:38:14

Got completely sidetracked tonight. I was planning on doing some Parrot work and got sucked into some video-chat experiement for my parents. My brother is in Mexico for the semester with school, and everybody wants to videochat for the first time ever. Unfortunately, it took much of my evening to get that set up on our lousy family computer.

I fixed one small problem with strings. Here's an example like what cotto showed to me:

.sub main :main .local string s .local int i i = s say i .end

The problem here is that an uninitialized string is NULL in C world, and when we try to parse that string we dereference the NULL pointer and segfault. I added a quick-and-dirty patch that resolves the issue by testing whether the pointer is NULL and returning an INTVAL of 0. Better then segfaulting, I think. Jonathan suggested we should throw an exception instead. However, I personally think it makes more sense to assume the string autoinstantiates. Think about the perl code:

my $s; my $i = int($s); print $i

In this case, $s autoinstantiates and the return value is 0. Maybe I'm too tied to perl, and maybe that's not the way Parrot should act. I don't know.

I also added a little bit of function-level documentation in src/stm/backend.c. I don't know much about STM, and this was an easy 15-minute way to get a little bit more familiarized with it. Plus, to keep things mixed up (and keep my attention span from approaching zero asymptotically) I try to do little side projects like this outside of my GC. Tomorrow, if I can find the tuits, I want to do the same for src/stm/waitlist.c too.

I've also identified a problem with the build somewhere, and when I'm done here I'm going to file a ticket. Somehow, "make headerizer" completely screws up the datatype declaration dependencies in compilers/imcc/imc.h. This is the same problem I was having in my branch, and I assumed I screwed something up. However, when it started happening in trunk too I knew there was a problem. NotFound said something about fixing it, but I haven't heard from him in a while and I'm going to post a ticket so we don't forget.