PHP_PSI_DEPEND = $(patsubst $(PHP_PSI_SRCDIR)/%,$(PHP_PSI_BUILDDIR)/%,$(PHP_PSI_SOURCES:.c=.dep))
$(PHP_PSI_BUILDDIR)/%.dep: $(PHP_PSI_SRCDIR)/%.c | $(PHP_PSI_GENERATED)
- $(CC) -MM -MG -MF $@ -MT $(patsubst $(PHP_PSI_SRCDIR)/%,$(PHP_PSI_BUILDDIR)/%,$(@:.dep=.lo)) \
+ @echo Generating $@ ...
+ @$(CC) -MM -MG -MF $@ -MT $(patsubst $(PHP_PSI_SRCDIR)/%,$(PHP_PSI_BUILDDIR)/%,$(@:.dep=.lo)) \
$(CPPFLAGS) $(DEFS) $(INCLUDES) $< \
|| touch $@
if (!iarg) {
struct psi_call_frame_argument *frame_arg;
impl_val empty_val = {0};
- zend_string *type_str = zend_string_init(ZEND_STRL("mixed"), 1);
+ zend_string *type_str = zend_string_init_interned(ZEND_STRL("mixed"), 1);
struct psi_impl_arg *carg_spec = psi_impl_arg_init(
psi_impl_type_init(PSI_T_MIXED, type_str),
psi_impl_var_copy(inner_var), NULL);
case PSI_T_STRING:
case PSI_T_QUOTED_STRING:
ZVAL_NEW_STR(&zc.value, zend_string_copy(c->val->ival.zend.str));
+ if (ZSTR_IS_INTERNED(Z_STR(zc.value))) {
+ Z_TYPE_FLAGS(zc.value) = 0;
+ }
break;
default:
assert(0);
no_ws->type = PSI_T_NO_WHITESPACE;
zend_string_release(no_ws->text);
- no_ws->text = zend_string_init("\xA0", 1, 1);
+ no_ws->text = zend_string_init_interned("\xA0", 1, 1);
psi_cpp_tokiter_add(cpp, no_ws);
continue;
}
-/* Generated by re2c 1.1.1 on Thu Nov 1 08:10:31 2018 */
+/* Generated by re2c 1.1.1 on Fri Nov 2 07:35:40 2018 */
#line 1 "src/parser.re"
/*******************************************************************************
Copyright (c) 2016, Michael Wallner <mike@php.net>.
}
fb->length = sb.st_size;
- fb->file = zend_string_init(filename, strlen(filename), 1);
+ fb->file = zend_string_init_interned(filename, strlen(filename), 1);
return fb;
}
memset(sb->buffer + length, 0, YYMAXFILL);
sb->length = length;
- sb->file = zend_string_init("<stdin>", strlen("<stdin>"), 1);
+ sb->file = zend_string_init_interned("<stdin>", strlen("<stdin>"), 1);
return sb;
}
smart_str_appendl_ex(&ns_name, ZEND_STRL("psi\\"), 1);
smart_str_append_ex(&ns_name, name, 1);
name_str = smart_str_extract(&ns_name);
- type_str = zend_string_init(ZEND_STRL("<eval number>"), 1);
+ type_str = zend_string_init_interned(ZEND_STRL("<eval number>"), 1);
num = psi_num_exp_copy(scope.macro->exp);
def = psi_impl_def_val_init(PSI_T_NUMBER, num);
smart_str_appendl_ex(&ns_name, ZEND_STRL("psi\\"), 1);
smart_str_append_ex(&ns_name, name, 1);
name_str = smart_str_extract(&ns_name);
- type_str = zend_string_init(ZEND_STRL("string"), 1);
+ type_str = zend_string_init_interned(ZEND_STRL("string"), 1);
type = psi_impl_type_init(PSI_T_STRING, type_str);
def = psi_impl_def_val_init(PSI_T_QUOTED_STRING, t->text);
++I->lines
#define NEWTOKEN(t) \
- token = psi_token_init(t, tok, cur - tok, tok - eol + 1, I->lines, I->file); \
+ if (t == PSI_T_COMMENT || t == PSI_T_WHITESPACE) { \
+ token = psi_token_init(t, "", 0, tok - eol + 1, I->lines, I->file); \
+ } else { \
+ token = psi_token_init(t, tok, cur - tok, tok - eol + 1, I->lines, I->file); \
+ } \
tokens = psi_plist_add(tokens, &token); \
if (P->flags & PSI_DEBUG) { \
fprintf(stderr, "PSI< "); \
psi_token_dump(2, token); \
}
-union int_suffix {
- char s[4];
- uint32_t i;
-};
struct psi_plist *psi_parser_scan(struct psi_parser *P, struct psi_parser_input *I)
{
}
fb->length = sb.st_size;
- fb->file = zend_string_init(filename, strlen(filename), 1);
+ fb->file = zend_string_init_interned(filename, strlen(filename), 1);
return fb;
}
memset(sb->buffer + length, 0, YYMAXFILL);
sb->length = length;
- sb->file = zend_string_init("<stdin>", strlen("<stdin>"), 1);
+ sb->file = zend_string_init_interned("<stdin>", strlen("<stdin>"), 1);
return sb;
}
smart_str_appendl_ex(&ns_name, ZEND_STRL("psi\\"), 1);
smart_str_append_ex(&ns_name, name, 1);
name_str = smart_str_extract(&ns_name);
- type_str = zend_string_init(ZEND_STRL("<eval number>"), 1);
+ type_str = zend_string_init_interned(ZEND_STRL("<eval number>"), 1);
num = psi_num_exp_copy(scope.macro->exp);
def = psi_impl_def_val_init(PSI_T_NUMBER, num);
smart_str_appendl_ex(&ns_name, ZEND_STRL("psi\\"), 1);
smart_str_append_ex(&ns_name, name, 1);
name_str = smart_str_extract(&ns_name);
- type_str = zend_string_init(ZEND_STRL("string"), 1);
+ type_str = zend_string_init_interned(ZEND_STRL("string"), 1);
type = psi_impl_type_init(PSI_T_STRING, type_str);
def = psi_impl_def_val_init(PSI_T_QUOTED_STRING, t->text);
++I->lines
#define NEWTOKEN(t) \
- token = psi_token_init(t, tok, cur - tok, tok - eol + 1, I->lines, I->file); \
+ if (t == PSI_T_COMMENT || t == PSI_T_WHITESPACE) { \
+ token = psi_token_init(t, "", 0, tok - eol + 1, I->lines, I->file); \
+ } else { \
+ token = psi_token_init(t, tok, cur - tok, tok - eol + 1, I->lines, I->file); \
+ } \
tokens = psi_plist_add(tokens, &token); \
if (P->flags & PSI_DEBUG) { \
fprintf(stderr, "PSI< "); \
psi_token_dump(2, token); \
}
-union int_suffix {
- char s[4];
- uint32_t i;
-};
struct psi_plist *psi_parser_scan(struct psi_parser *P, struct psi_parser_input *I)
{
}
;
-decl_real_type[type]:
+decl_real_type[type]: /* allocated, so free, if set */
FLOAT[type_] {
$type = psi_token_copy($type_);
}
| UNSIGNED
;
-int_width[i]:
+int_width[i]: /* allocated, so free, if set */
SHORT {
$i = psi_token_copy($SHORT);
}
}
;
-decl_int_type[type]:
+decl_int_type[type]: /* allocated, so free, if set */
CHAR {
$type = psi_token_copy($CHAR);
}
}
;
-int_signed_types[type]:
+int_signed_types[type]: /* allocated, so free, if set */
%empty {
$type = NULL;
}
| LONG INT
;
-int_width_types[type]:
+int_width_types[type]: /* allocated, so free, if set */
%empty {
$type = NULL;
}
T->col = col;
T->line = line;
T->file = zend_string_copy(file);
- T->text = zend_string_init(token_txt, token_len, 1);
+ T->text = zend_string_init_interned(token_txt, token_len, 1);
#if PSI_DEBUG_TOKEN_ALLOC
fprintf(stderr, "PSI: token_init %p\n", T);
#endif
struct psi_decl_abi *abi = calloc(1, sizeof(*abi));
abi->convention = convention
? zend_string_copy(convention)
- : zend_string_init(ZEND_STRL("default"), 1);
+ : zend_string_init_interned(ZEND_STRL("default"), 1);
return abi;
}
struct psi_decl *psi_decl_extvar_setter(struct psi_decl_extvar *evar)
{
- zend_string *type_str = zend_string_init(ZEND_STRS("void"), 1);
+ zend_string *type_str = zend_string_init_interned(ZEND_STRS("void"), 1);
struct psi_decl_type *func_type = psi_decl_type_init(PSI_T_VOID, type_str);
struct psi_decl_var *func_var = psi_decl_var_copy(evar->arg->var);
struct psi_decl_arg *func = psi_decl_arg_init(func_type, func_var);
val->type = PSI_T_FLOAT;
type->type = PSI_T_FLOAT;
zend_string_release(type->name);
- type->name = zend_string_init(ZEND_STRL("float"), 1);
+ type->name = zend_string_init_interned(ZEND_STRL("float"), 1);
break;
default:
val->type = PSI_T_INT;
type->type = PSI_T_INT;
zend_string_release(type->name);
- type->name = zend_string_init(ZEND_STRL("int"), 1);
+ type->name = zend_string_init_interned(ZEND_STRL("int"), 1);
break;
}
psi_num_exp_free(&val->data.num);