You can't. Right now this is a limitation of the compiler. If it's a common use case we can likely find a solution.
Adam On Dec 2, 2008, at 10:25 PM, Dan Mick wrote: > How does one make the compiler generate runnable code with such D > input? > > Adam Leventhal wrote: >> Hey Jim, >> I was able to reduce this to a simpler case: >> # dtrace -n BEGIN'{ foo[1, 1, 1, 1, 1, 1] = 1; }' >> dtrace: failed to enable 'BEGIN': DIF program content is invalid >> This failed because the D compiler generated invalid DIF in that it >> used >> too many virutal registers. >> If you try one more key, the error is properly identified. >> # dtrace -n BEGIN'{ foo[1, 1, 1, 1, 1, 1, 1] = 1; }' >> dtrace: invalid probe specifier BEGIN{ foo[1, 1, 1, 1, 1, 1, 1] = >> 1; }: >> Insufficient registers to generate code >> It looks like libdtrace is happily allocating a 9th register even >> though there are only 8: >> # dtrace -c '/usr/sbin/i86/dtrace -s /var/tmp/foo.d' -n 'pid >> $target::dt_regset_alloc:return{ trace(arg1); }' >> dtrace: description 'pid$target::dt_regset_alloc:return' matched 1 >> probe >> dtrace: failed to compile script /var/tmp/foo.d: Insufficient >> registers to >> generate code >> dtrace: pid 101053 has exited >> CPU ID FUNCTION:NAME >> 0 73111 dt_regset_alloc:return 0 >> 0 73111 dt_regset_alloc:return 1 >> 0 73111 dt_regset_alloc:return 2 >> 0 73111 dt_regset_alloc:return 3 >> 0 73111 dt_regset_alloc:return 4 >> 0 73111 dt_regset_alloc:return 5 >> 0 73111 dt_regset_alloc:return 6 >> 0 73111 dt_regset_alloc:return 7 >> 0 73111 dt_regset_alloc:return 8 >> 0 73111 dt_regset_alloc:return 4294967295 >> It looks like there's a simple fix in dt_regset_create() which is >> not to add >> one to the number of registers we've been told exist. I've filed >> this bug >> for you: >> 6778459 libdtrace will allocate one more register than there exists >> Adam >> On Sun, Nov 30, 2008 at 08:36:50PM -0800, James Litchfield wrote: >>> What's going on? >>> >>> # dtrace -s iotime_all.d 100 >>> dtrace: failed to enable 'iotime_all.d': DIF program content is >>> invalid >>> >>> The errant script.... >>> >>> #pragma D option quiet >>> >>> BEGIN >>> { >>> stime = timestamp; >>> io_count = 0; >>> } >>> >>> io:::start >>> /args[2]->fi_pathname != "<none>"/ >>> { >>> start[pid, args[2]->fi_pathname, args[0]->b_edev, args[0]- >>> >b_blkno, args[0]->b_bcount] = timestamp; >>> self->pid = pid; >>> self->name = args[2]->fi_pathname; >>> self->size = args[0]->b_bcount; >>> } >>> io:::start >>> /args[2]->fi_pathname != "<none>"/ >>> { >>> start[pid, args[1]->dev_pathname, args[0]->b_edev, args[0]- >>> >b_blkno, args[0]->b_bcount] = timestamp; >>> self->pid = pid; >>> self->name = args[1]->dev_pathname; >>> self->size = args[0]->b_bcount; >>> } >>> >>> io:::done >>> /start[self->pid, self->name, args[0]->b_edev, args[0]->b_blkno, >>> self->size]/ >>> { >>> this->elapsed = timestamp - start[self->pid, self->name, >>> args[0]->b_edev, args[0]->b_blkno, self->size]; >>> printf("%5u %10s %58s %2s %8u %8u %3d.%03d\n", self->pid, >>> args[1]->dev_statname, >>> self->name, args[0]->b_flags & B_READ ? "R" : "W", >>> args[0]->b_bcount, self->size, >>> this->elapsed / 1000000, (this->elapsed / 1000) % 1000); >>> start[self->pid, self->name, args[0]->b_edev, args[0]->b_blkno, >>> self->size] = 0; >>> self->pid = 0; >>> self->name = 0; >>> self->size = 0; >>> io_count++; >>> } >>> io:::done >>> /io_count > $1/ >>> { >>> printf("Elapsed Time: %u seconds\n\n", (timestamp - stime) / >>> 1000000000); >>> exit (0); >>> } >>> >>> _______________________________________________ >>> dtrace-discuss mailing list >>> dtrace-discuss@opensolaris.org > -- Adam Leventhal, Fishworks http://blogs.sun.com/ahl _______________________________________________ dtrace-discuss mailing list dtrace-discuss@opensolaris.org