Thanks to the const-folding pass, trivial numeric and string operations are reduced in pass-2. You can see this in -vp2 of the following probes: probe oneshot { println("foobar") } probe oneshot { println("foo" . "bar") } The second one becomes just like the first, as println("foobar"). In the translator pass, we also try to avoid tmp copies of literal values, and instead just emit the values directly into their expressions. However, this is compared on the tok->type rather than checking if the expression itself is a literal. The pattern in translate.cxx looks like this: if (val->tok->type == tok_number || val->tok->type == tok_string) tmpval.override(c_expression(val)) This is basically everywhere c_expression is called, and c_expression itself also asserts the tok->type. But in the case of "foo"."bar", const_folder::visit_concatenation points the new literal_string's tok at the original "." operator, which is not a tok_string. That's useful for accurate error reporting, but it means the translator shouldn't rely on tok->type being accurate. The difference is visible in pass-3: $ stap -p3 -e 'probe oneshot { println("foobar") }' | grep -c tmp 0 $ stap -p3 -e 'probe oneshot { println("foo"."bar") }' | grep -c tmp 4 This might also occur in other places where we synthesize code with literals, tied back to original tokens, like saved $var in .return probes, but I haven't checked for sure.
commit b2d74f03a0c5536dcc2c7b6af262cfdc5459e947