dtrace: fix style in ustack helper

This commit is contained in:
Fedor Indutny 2013-01-07 22:53:50 +04:00
parent 3b715edda9
commit 13296e4b13

View File

@ -17,8 +17,10 @@
* V8 represents small integers (SMI) using the upper 31 bits of a 32-bit
* value. To extract the actual integer value, we must shift it over.
*/
#define IS_SMI(value) ((value & V8_SmiTagMask) == V8_SmiTag)
#define SMI_VALUE(value) ((uint32_t)(value) >> V8_SmiValueShift)
#define IS_SMI(value) \
((value & V8_SmiTagMask) == V8_SmiTag)
#define SMI_VALUE(value) \
((uint32_t)(value) >> V8_SmiValueShift)
/*
* Heap objects usually start off with a Map pointer, itself another heap
@ -59,8 +61,8 @@
/*
* General helper macros
*/
#define COPYIN_UINT8(addr) (*(uint8_t *)copyin((addr), sizeof (uint8_t)))
#define COPYIN_UINT32(addr) (*(uint32_t *)copyin((addr), sizeof (uint32_t)))
#define COPYIN_UINT8(addr) (*(uint8_t*) copyin((addr), sizeof(uint8_t)))
#define COPYIN_UINT32(addr) (*(uint32_t*) copyin((addr), sizeof(uint32_t)))
#define APPEND_CHR(c) (this->buf[this->off++] = (c))
@ -106,26 +108,26 @@
* SeqString.
*/
#define APPEND_SEQSTR(str, len, attrs) \
dtrace:helper:ustack: \
/!this->done && len > 0 && ASCII_SEQSTR(attrs)/ \
{ \
dtrace:helper:ustack: \
/!this->done && len > 0 && ASCII_SEQSTR(attrs)/ \
{ \
copyinto(str + V8_OFF_STR_CHARS, len, this->buf + this->off); \
this->off += len; \
}
}
/*
* Print out the given Node.js ExternalString, or do nothing if the string is
* not an ASCII ExternalString.
*/
#define APPEND_NODESTR(str, len, attrs) \
dtrace:helper:ustack: \
/!this->done && len > 0 && ASCII_EXTSTR(attrs)/ \
{ \
dtrace:helper:ustack: \
/!this->done && len > 0 && ASCII_EXTSTR(attrs)/ \
{ \
this->resource = COPYIN_UINT32(str + V8_OFF_EXTSTR_RSRC); \
this->dataptr = COPYIN_UINT32(this->resource + NODE_OFF_EXTSTR_DATA); \
copyinto(this->dataptr, len, this->buf + this->off); \
this->off += len; \
}
}
/*
* Recall that each ConsString points to two other strings which are
@ -157,9 +159,9 @@ dtrace:helper:ustack: \
* leafs in the tree above) to get the final output.
*/
#define EXPAND_START() \
dtrace:helper:ustack: \
/!this->done/ \
{ \
dtrace:helper:ustack: \
/!this->done/ \
{ \
this->s0str = this->s1str = this->s2str = 0; \
this->s3str = this->s4str = this->s5str = 0; \
this->s6str = this->s7str = this->s8str = 0; \
@ -177,7 +179,7 @@ dtrace:helper:ustack: \
this->s6attrs = this->s7attrs = this->s8attrs = 0; \
this->s9attrs = this->s10attrs = this->s11attrs = 0; \
this->s12attrs = this->s13attrs = 0; \
}
}
/*
* Expand the ConsString "str" (represented by "str", "len", and "attrs") into
@ -185,9 +187,9 @@ dtrace:helper:ustack: \
* by "s2s", "s2l", "s2a"). If "str" is not a ConsString, do nothing.
*/
#define EXPAND_STR(str, len, attrs, s1s, s1l, s1a, s2s, s2l, s2a) \
dtrace:helper:ustack: \
/!this->done && len > 0 && ASCII_CONSSTR(attrs)/ \
{ \
dtrace:helper:ustack: \
/!this->done && len > 0 && ASCII_CONSSTR(attrs)/ \
{ \
len = 0; \
\
s1s = COPYIN_UINT32(str + V8_OFF_CONSSTR_CAR); \
@ -195,7 +197,7 @@ dtrace:helper:ustack: \
\
s2s = COPYIN_UINT32(str + V8_OFF_CONSSTR_CDR); \
LOAD_STRFIELDS(s2s, s2l, s2a) \
}
}
/*
* Print out a ConsString by expanding it up to three levels and printing out
@ -261,7 +263,7 @@ dtrace:helper:ustack:
this->fp = arg1;
/* output/flow control */
this->buf = (char *)alloca(128);
this->buf = (char*) alloca(128);
this->off = 0;
this->done = 0;
@ -547,8 +549,7 @@ dtrace:helper:ustack:
/!this->done/
{
this->script = COPYIN_UINT32(this->shared + V8_OFF_SHARED_SCRIPT);
this->scriptnamestr = COPYIN_UINT32(this->script +
V8_OFF_SCRIPT_NAME);
this->scriptnamestr = COPYIN_UINT32(this->script + V8_OFF_SCRIPT_NAME);
LOAD_STRFIELDS(this->scriptnamestr, this->scriptnamelen,
this->scriptnameattrs);
@ -568,8 +569,7 @@ dtrace:helper:ustack:
{
this->position = COPYIN_UINT32(this->shared + V8_OFF_SHARED_FUNTOK);
this->line_ends = COPYIN_UINT32(this->script + V8_OFF_SCRIPT_LENDS);
this->map = V8_MAP_PTR(COPYIN_UINT32(this->line_ends +
V8_OFF_HEAPOBJ_MAP));
this->map = V8_MAP_PTR(COPYIN_UINT32(this->line_ends + V8_OFF_HEAPOBJ_MAP));
this->le_attrs = COPYIN_UINT8(this->map + V8_OFF_MAP_ATTRS);
}
@ -607,8 +607,8 @@ dtrace:helper:ustack:
/!this->done/
{
/* initialize binary search */
this->bsearch_line = this->position < COPYIN_UINT32(
this->line_ends + V8_OFF_FA_DATA) ? 1 : 0;
this->bsearch_line = this->position <
COPYIN_UINT32(this->line_ends + V8_OFF_FA_DATA) ? 1 : 0;
this->bsearch_min = 0;
this->bsearch_max = this->bsearch_line != 0 ? 0 :
SMI_VALUE(COPYIN_UINT32(this->line_ends + V8_OFF_FA_SIZE)) - 1;
@ -620,27 +620,27 @@ dtrace:helper:ustack:
* to 32768 lines of code.
*/
#define BSEARCH_LOOP \
dtrace:helper:ustack: \
/!this->done && this->bsearch_max >= 1/ \
{ \
dtrace:helper:ustack: \
/!this->done && this->bsearch_max >= 1/ \
{ \
this->ii = (this->bsearch_min + this->bsearch_max) >> 1; \
} \
} \
\
dtrace:helper:ustack: \
/!this->done && this->bsearch_max >= 1 && \
dtrace:helper:ustack: \
/!this->done && this->bsearch_max >= 1 && \
this->position > COPYIN_UINT32(this->line_ends + V8_OFF_FA_DATA + \
this->ii * sizeof (uint32_t))/ \
{ \
{ \
this->bsearch_min = this->ii + 1; \
} \
} \
\
dtrace:helper:ustack: \
/!this->done && this->bsearch_max >= 1 && \
dtrace:helper:ustack: \
/!this->done && this->bsearch_max >= 1 && \
this->position <= COPYIN_UINT32(this->line_ends + V8_OFF_FA_DATA + \
(this->ii - 1) * sizeof (uint32_t))/ \
{ \
{ \
this->bsearch_max = this->ii - 1; \
}
}
BSEARCH_LOOP
BSEARCH_LOOP