[DTrace-devel] [PATCH v2] Implement TLS variables

Eugene Loh eugene.loh at oracle.com
Wed Nov 24 01:00:24 UTC 2021


I'm also curious about the status of "zero values."  That is, space 
should not be allocated until nonzero values are assigned. Further, 
space should be freed when zero values are assigned.

E.g.,

#pragma D option dynvarsize=1024
BEGIN {
   self->a = 101;
   self->b = 102;
   self->c = 103;
   exit(0);
}

works.  (1024 bytes where each value consumes just over 256 bytes.  So 
room for 3 values.)  Great.  But

#pragma D option dynvarsize=1024
BEGIN {
   self->a = 101;
   self->b = 102;
   self->c = 103;
   self->d = 104;
   exit(0);
}

fails.  Okay.  Makes sense.  The failure mode is different from legacy 
DTrace (as is the dynvarsize value), but no matter.  But:

#pragma D option dynvarsize=1024
BEGIN {
   self->a = 101;
   self->b = 102;
   self->c = 103;
   self->a =   0;
   self->b =   0;
   self->c =   0;
   self->d = 104;
   exit(0);
}

also fails, even though space presumably has been freed.  To be fair, I 
cannot vouch for legacy DTrace's handling of this case. Anyhow,

#pragma D option dynvarsize=1024
BEGIN {
   self->a =   0;
   self->b =   0;
   self->c =   0;
   self->d =   0;
   exit(0);
}

also fails, even though no space should be consumed.




More information about the DTrace-devel mailing list