pike.git/src/program.c:1724: Inside #if 0
Pike_compiler->new_program->identifiers[i].linenumber,
i);
}
}
add_to_identifiers (id);
}
#else
#define debug_add_to_identifiers(ARG) add_to_identifiers(ARG)
#endif
+ static void add_identifier(struct compilation *c,
+ struct pike_type *type,
+ struct pike_string *name,
+ unsigned int identifier_flags,
+ unsigned int opt_flags,
+ union idptr func,
+ int run_time_type)
+ {
+ struct identifier dummy;
+ copy_shared_string(dummy.name, name);
+ copy_pike_type(dummy.type, type);
+ dummy.filename_strno = store_prog_string(c->lex.current_file);
+ dummy.linenumber = c->lex.current_line;
+ dummy.identifier_flags = identifier_flags;
+ dummy.run_time_type = run_time_type;
+ dummy.func = func;
+ dummy.opt_flags = opt_flags;
+ #ifdef PROFILING
+ dummy.self_time=0;
+ dummy.num_calls=0;
+ dummy.recur_depth=0;
+ dummy.total_time=0;
+ #endif
+ debug_add_to_identifiers(dummy);
+ }
+
void add_relocated_int_to_program(INT32 i)
{
add_to_relocations(Pike_compiler->new_program->num_program);
ins_int(i, (void (*)(char))add_to_program);
}
void use_module(struct svalue *s)
{
struct compilation *c = THIS_COMPILATION;
if( (1<<TYPEOF(*s)) & (BIT_MAPPING | BIT_OBJECT | BIT_PROGRAM))
pike.git/src/program.c:5469:
* they will be defaulted to the values from the aliased identifier.
*/
int low_define_alias(struct pike_string *name, struct pike_type *type,
int flags, int depth, int refno)
{
int n;
int e;
struct compilation *c = THIS_COMPILATION;
struct program_state *state = Pike_compiler;
- struct identifier dummy, *id;
+ struct identifier *id;
struct reference ref;
-
+ union idptr func;
#ifdef PIKE_DEBUG
if(Pike_compiler->new_program->flags & (PROGRAM_FIXED | PROGRAM_OPTIMIZED))
Pike_fatal("Attempting to add variable to fixed program\n");
if(Pike_compiler->compiler_pass==2)
Pike_fatal("Internal error: Not allowed to add more identifiers during second compiler pass.\n"
"Added identifier: \"%s\"\n", name->str);
#endif
pike.git/src/program.c:5497: Inside #if defined(PIKE_DEBUG)
Pike_fatal("Internal error: External symbol buried too deep.\n");
}
if (state->new_program->num_identifier_references <= refno) {
Pike_fatal("Internal error: Reference out of bounds: %d (max: %d).\n",
refno, state->new_program->num_identifier_references);
}
#endif
id = ID_FROM_INT(state->new_program, refno);
- if (name) {
- copy_shared_string(dummy.name, name);
- } else {
- copy_shared_string(dummy.name, id->name);
- }
- if (type) {
- copy_pike_type(dummy.type, type);
- } else {
- copy_pike_type(dummy.type, id->type);
- }
- dummy.filename_strno = store_prog_string(c->lex.current_file);
- dummy.linenumber = c->lex.current_line;
- dummy.identifier_flags = id->identifier_flags | IDENTIFIER_ALIAS;
- dummy.run_time_type = id->run_time_type; /* Not actually used. */
- dummy.func.ext_ref.depth = depth;
- dummy.func.ext_ref.id = refno;
- dummy.opt_flags = 0;
- #ifdef PROFILING
- dummy.self_time=0;
- dummy.num_calls=0;
- dummy.recur_depth=0;
- dummy.total_time=0;
- #endif
+ func.ext_ref.depth = depth;
+ func.ext_ref.id = refno;
if (flags & ID_PRIVATE) flags |= ID_INLINE;
ref.id_flags=flags;
ref.identifier_offset=Pike_compiler->new_program->num_identifiers;
ref.inherit_offset=0;
ref.run_time_type = PIKE_T_UNKNOWN;
- debug_add_to_identifiers(dummy);
+ add_identifier(c, type ? type : id->type, name ? name : id->name,
+ id->identifier_flags | IDENTIFIER_ALIAS, 0,
+ func, id->run_time_type);
n = Pike_compiler->new_program->num_identifier_references;
add_to_identifier_references(ref);
return n;
}
PMOD_EXPORT int define_alias(struct pike_string *name, struct pike_type *type,
int flags, int depth, int refno)
{
pike.git/src/program.c:5627:
struct pike_type *type,
INT32 flags,
size_t offset,
INT32 run_time_type)
{
int n;
struct compilation *c = THIS_COMPILATION;
struct identifier dummy;
struct reference ref;
+ union idptr func;
#ifdef PIKE_DEBUG
if(Pike_compiler->new_program->flags & (PROGRAM_FIXED | PROGRAM_OPTIMIZED))
Pike_fatal("Attempting to add variable to fixed program\n");
if(Pike_compiler->compiler_pass==2)
Pike_fatal("Internal error: Not allowed to add more identifiers during second compiler pass.\n"
"Added identifier: \"%s\"\n", name->str);
#endif
- copy_shared_string(dummy.name, name);
- copy_pike_type(dummy.type, type);
- dummy.filename_strno = store_prog_string(c->lex.current_file);
- dummy.linenumber = c->lex.current_line;
- dummy.identifier_flags = IDENTIFIER_VARIABLE;
- dummy.run_time_type=run_time_type;
- dummy.func.offset=offset - Pike_compiler->new_program->inherits[0].storage_offset;
- dummy.opt_flags = 0;
- #ifdef PROFILING
- dummy.self_time=0;
- dummy.num_calls=0;
- dummy.recur_depth=0;
- dummy.total_time=0;
- #endif
+ func.offset = offset - Pike_compiler->new_program->inherits[0].storage_offset;
+ if (run_time_type == PIKE_T_FREE) func.offset = -1;
- if (run_time_type == PIKE_T_FREE) dummy.func.offset = -1;
-
+
if (flags & ID_PRIVATE) flags |= ID_LOCAL|ID_PROTECTED;
- if (flags & ID_WEAK) dummy.identifier_flags |= IDENTIFIER_WEAK;
+
ref.id_flags=flags;
ref.identifier_offset=Pike_compiler->new_program->num_identifiers;
ref.inherit_offset=0;
ref.run_time_type = PIKE_T_UNKNOWN;
add_to_variable_index(ref.identifier_offset);
- debug_add_to_identifiers(dummy);
+ if (flags & ID_WEAK) {
+ add_identifier(c, type, name,
+ IDENTIFIER_VARIABLE|IDENTIFIER_WEAK, 0,
+ func,
+ run_time_type);
+ } else {
+ add_identifier(c, type, name,
+ IDENTIFIER_VARIABLE, 0,
+ func,
+ run_time_type);
+ }
n=Pike_compiler->new_program->num_identifier_references;
add_to_identifier_references(ref);
return n;
}
/* type is a serialized tokenized type. */
PMOD_EXPORT int quick_map_variable(const char *name,
int name_length,
pike.git/src/program.c:5907:
}
PMOD_EXPORT int add_constant(struct pike_string *name,
const struct svalue *c,
INT32 flags)
{
int n;
struct compilation *cc = THIS_COMPILATION;
struct identifier dummy;
struct reference ref;
+ struct pike_type *type;
+ unsigned int opt_flags;
+ union idptr func;
#ifdef PROGRAM_BUILD_DEBUG
{
if (c) {
struct pike_type *t = get_type_of_svalue(c);
struct pike_string *d = describe_type (t);
fprintf (stderr, "%*sdefining constant (pass=%d): %s ",
cc->compilation_depth, "",
Pike_compiler->compiler_pass, d->str);
free_type(t);
pike.git/src/program.c:6053: Inside #if defined(PIKE_DEBUG)
Pike_fatal("Attempting to add constant to fixed program\n");
if(Pike_compiler->compiler_pass==2) {
dump_program_tables(Pike_compiler->new_program, 2);
Pike_fatal("Internal error: Not allowed to add more identifiers during second compiler pass.\n"
" Attempted to add the identifier \"%s\"\n",
name->str);
}
#endif
- copy_shared_string(dummy.name, name);
- dummy.identifier_flags = IDENTIFIER_CONSTANT;
- dummy.filename_strno = store_prog_string(cc->lex.current_file);
- dummy.linenumber = cc->lex.current_line;
-
+
#if 1
if (c) {
#endif
if( !(flags & ID_INLINE) )
- dummy.type = get_lax_type_of_svalue( c );
+ type = get_lax_type_of_svalue( c );
else
- dummy.type = get_type_of_svalue( c );
- dummy.run_time_type = (unsigned char) TYPEOF(*c);
- dummy.func.const_info.offset = store_constant(c, 0, 0);
- dummy.opt_flags=OPT_SIDE_EFFECT | OPT_EXTERNAL_DEPEND;
+ type = get_type_of_svalue( c );
+ func.const_info.offset = store_constant(c, 0, 0);
+ opt_flags = OPT_SIDE_EFFECT | OPT_EXTERNAL_DEPEND;
if(TYPEOF(*c) == PIKE_T_PROGRAM && (c->u.program->flags & PROGRAM_CONSTANT))
- dummy.opt_flags=0;
+ opt_flags = 0;
#if 1
}
else {
- copy_pike_type(dummy.type, mixed_type_string);
- dummy.run_time_type=T_MIXED;
- dummy.func.const_info.offset = -1;
- dummy.opt_flags=0;
+ copy_pike_type(type, mixed_type_string);
+ func.const_info.offset = -1;
+ opt_flags = 0;
}
#endif
if (flags & ID_PRIVATE) flags |= ID_LOCAL|ID_PROTECTED;
ref.id_flags=flags;
ref.identifier_offset=Pike_compiler->new_program->num_identifiers;
ref.inherit_offset=0;
ref.run_time_type = PIKE_T_UNKNOWN;
- #ifdef PROFILING
- dummy.self_time=0;
- dummy.num_calls=0;
- dummy.recur_depth=0;
- dummy.total_time=0;
- #endif
+ add_identifier(cc, type, name,
+ IDENTIFIER_CONSTANT, opt_flags,
+ func, c ? TYPEOF(*c) : T_MIXED);
+ free_pike_type(type);
- debug_add_to_identifiers(dummy);
-
+
if(n != -1)
{
int overridden;
if(IDENTIFIERP(n)->id_flags & ID_FINAL)
my_yyerror("Illegal to redefine 'final' identifier %S", name);
if(IDENTIFIER_IS_VARIABLE(ID_FROM_INT(Pike_compiler->new_program,
n)->identifier_flags))
{
pike.git/src/program.c:6292:
*/
INT32 define_function(struct pike_string *name,
struct pike_type *type,
unsigned flags,
unsigned function_flags,
union idptr *func,
unsigned opt_flags)
{
struct compilation *c = THIS_COMPILATION;
struct program *prog = Pike_compiler->new_program;
- struct identifier *funp,fun;
+ struct identifier *funp;
+ union idptr idptr;
struct reference ref;
struct svalue *lfun_type;
int run_time_type = T_FUNCTION;
INT32 i;
int getter_setter = -1;
int is_setter = 0;
CHECK_COMPILER();
#ifdef PROGRAM_BUILD_DEBUG
pike.git/src/program.c:6639:
prog->identifier_references[i].id_flags |= ID_PROTECTED;
goto make_a_new_def;
}
/* Otherwise we alter the existing definition */
#ifdef PROGRAM_BUILD_DEBUG
fprintf(stderr, "%*saltering the existing definition\n",
c->compilation_depth, "");
#endif
- copy_shared_string(fun.name, name);
- copy_pike_type(fun.type, type);
- fun.filename_strno = store_prog_string(c->lex.current_file);
- fun.linenumber = c->lex.current_line;
-
- fun.run_time_type = run_time_type;
-
- fun.identifier_flags=function_flags;
-
+
if(func)
- fun.func = *func;
+ idptr = *func;
else
- fun.func.offset = -1;
+ idptr.offset = -1;
- fun.opt_flags = opt_flags;
-
+
ref.identifier_offset = prog->num_identifiers;
- debug_add_to_identifiers(fun);
+
+ add_identifier(c, type, name,
+ function_flags, opt_flags,
+ idptr, run_time_type);
}
if (flags & ID_PRIVATE) flags |= ID_LOCAL|ID_PROTECTED;
ref.inherit_offset = 0;
ref.id_flags = flags;
if (flags & ID_VARIANT) {
ref.id_flags |= ID_USED;
prog->identifier_references[i] = ref;
overridden = i;
pike.git/src/program.c:6713:
make_a_new_def:
#ifdef PIKE_DEBUG
if(Pike_compiler->compiler_pass==2)
Pike_fatal("Internal error: Not allowed to add more identifiers during second compiler pass.\n"
"Added identifier: \"%s\"\n", name->str);
#endif
/* Define a new function */
- copy_shared_string(fun.name, name);
- copy_pike_type(fun.type, type);
- fun.filename_strno = store_prog_string(c->lex.current_file);
- fun.linenumber = c->lex.current_line;
-
- fun.identifier_flags=function_flags;
- fun.run_time_type = run_time_type;
-
+
if(func)
- fun.func = *func;
+ idptr = *func;
else
- fun.func.offset = -1;
+ idptr.offset = -1;
- fun.opt_flags = opt_flags;
-
+
#ifdef PIKE_DEBUG
if (a_flag > 5) {
fprintf(stderr,
"Adding new function #%d: '%s'\n"
" identifier_flags:0x%02x opt_flags:0x%04x\n",
prog->num_identifiers,
- fun.name->str,
- fun.identifier_flags, fun.opt_flags);
+ name->str,
+ function_flags, opt_flags);
}
#endif /* PIKE_DEBUG */
i = prog->num_identifiers;
- debug_add_to_identifiers(fun);
+ add_identifier(c, type, name,
+ function_flags, opt_flags,
+ idptr, run_time_type);
if (flags & ID_PRIVATE) flags |= ID_LOCAL|ID_PROTECTED;
ref.id_flags = flags;
ref.identifier_offset = i;
ref.inherit_offset = 0;
}
ref.run_time_type = PIKE_T_UNKNOWN;