pike.git
/
src
/
program.h
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/src/program.h:13:
#include "svalue.h" #include "time_stuff.h" #include "program_id.h" #include "block_allocator.h" #include "string_builder.h" #include "gc_header.h" /* Needed to support dynamic loading on NT */ PMOD_EXPORT extern struct program_state * Pike_compiler;
+
/* #define PIKE_NEW_LFUN_LOOKUP */
+
/* Compilation flags */ #define COMPILATION_CHECK_FINAL 0x01 /* This flag is set when resolve functions should force the lookup so * that we don't get a placeholder back. Used for inherits. */ #define COMPILATION_FORCE_RESOLVE 0x02 /* #define FORCE_RESOLVE_DEBUG */ /* Helper macros for force_resolve */ #ifdef FORCE_RESOLVE_DEBUG #define DO_IF_FRD(X) X
pike.git/src/program.h:52:
extern struct pike_string *this_program_string; extern struct pike_string *this_string; extern struct pike_string *args_string; /* Common compiler subsystems */ extern struct pike_string *parser_system_string; extern struct pike_string *type_check_system_string; extern struct pike_string *compat_lfun_destroy_string;
+
#ifdef PIKE_NEW_LFUN_LOOKUP
+
/**
+
* New LFUN lookup table.
+
*
+
* The lfun table is an array of INT16, where the first
+
* 10 (ie number of groups) entries contain offsets into
+
* the same array where the entries for the corresponding
+
* group start. An offset of 0 (zero) indicates that the
+
* group is empty. Group #0 is always present even if empty.
+
*
+
* Each group may currently contain at most 16 members. This is
+
* due to the way they are encoded in the LFUN_* constants.
+
*
+
* The groups partition the set of lfuns into subsets of
+
* related lfuns that are likely to be implemented together.
+
*
+
* The most significant nybble of an lfun number contains
+
* the group number, and the least significant nybble the
+
* offset in the group.
+
*
+
* Note that the values in this enum MUST match the
+
* corresponding tables in program.c.
+
*/
enum LFUN {
-
+
/* Group 0 */
+
LFUN___INIT = 0x00,
+
LFUN_CREATE,
+
LFUN__DESTRUCT,
+
LFUN__SPRINTF,
+
+
/* Group 1 */
+
LFUN_ADD = 0x10,
+
LFUN_SUBTRACT,
+
LFUN_MULTIPLY,
+
LFUN_DIVIDE,
+
LFUN_MOD,
+
LFUN_AND,
+
LFUN_OR,
+
LFUN_XOR,
+
LFUN_LSH,
+
LFUN_RSH,
+
LFUN_POW,
+
+
/* Group 2 */
+
LFUN_RADD = 0x20,
+
LFUN_RSUBTRACT,
+
LFUN_RMULTIPLY,
+
LFUN_RDIVIDE,
+
LFUN_RMOD,
+
LFUN_RAND,
+
LFUN_ROR,
+
LFUN_RXOR,
+
LFUN_RLSH,
+
LFUN_RRSH,
+
LFUN_RPOW,
+
+
/* Group 3 */
+
LFUN_COMPL = 0x30,
+
LFUN_NOT,
+
LFUN_CALL,
+
LFUN_CAST,
+
LFUN___HASH,
+
LFUN__SQRT,
+
LFUN__RANDOM,
+
LFUN__REVERSE,
+
+
/* Group 4 */
+
LFUN_EQ = 0x40,
+
LFUN_LT,
+
LFUN_GT,
+
LFUN__EQUAL,
+
LFUN__IS_TYPE,
+
+
/* Group 5 */
+
LFUN_INDEX = 0x50,
+
LFUN_ARROW,
+
LFUN_RANGE,
+
LFUN__SEARCH,
+
LFUN__SIZE_OBJECT,
+
+
/* Group 6 */
+
LFUN__SIZEOF = 0x60,
+
LFUN__INDICES,
+
LFUN__VALUES,
+
LFUN__TYPES,
+
LFUN__ANNOTATIONS,
+
LFUN__GET_ITERATOR,
+
+
/* Group 7 */
+
LFUN_ADD_EQ = 0x70,
+
LFUN_ASSIGN_INDEX,
+
LFUN_ASSIGN_ARROW,
+
LFUN__M_DELETE,
+
LFUN__M_CLEAR,
+
LFUN__M_ADD,
+
+
/* Group 8 */
+
LFUN__SERIALIZE = 0x80,
+
LFUN__DESERIALIZE,
+
+
/* Group 9 */
+
LFUN_NEXT_FUN = 0x90,
+
LFUN_INDEX_FUN,
+
LFUN_VALUE_FUN,
+
+
NUM_LFUNS,
+
};
+
+
#else
+
+
enum LFUN {
LFUN___INIT, LFUN_CREATE, LFUN__DESTRUCT, LFUN_ADD, LFUN_SUBTRACT, LFUN_AND, LFUN_OR, LFUN_XOR, LFUN_LSH, LFUN_RSH,
pike.git/src/program.h:117:
LFUN__SIZE_OBJECT, LFUN__RANDOM, LFUN_POW, LFUN_RPOW, LFUN__SQRT, LFUN__ANNOTATIONS, LFUN__M_CLEAR, LFUN__M_ADD, LFUN__REVERSE, };
+
#endif
extern const char *const lfun_names[]; extern struct pike_string *lfun_strings[]; #ifndef STRUCT_NODE_S_DECLARED #define STRUCT_NODE_S_DECLARED struct node_s; typedef struct node_s node; #endif
pike.git/src/program.h:677:
#endif /* PROFILING */ size_t total_size; #define FOO(NUMTYPE,TYPE,ARGTYPE,NAME) TYPE * NAME ; #include "program_areas.h" #define FOO(NUMTYPE,TYPE,ARGTYPE,NAME) NUMTYPE PIKE_CONCAT(num_,NAME) ; #include "program_areas.h"
+
#ifdef PIKE_NEW_LFUN_LOOKUP
+
INT16 *lfuns;
+
#else
INT16 lfuns[NUM_LFUNS];
-
+
#endif
}; struct local_variable_info { int names[MAX_LOCAL]; /* Offset in strings. */ int types[MAX_LOCAL]; /* Offset in constants. */ int num_local; /* Number of entries in either of the above. */ }; PMOD_EXPORT void dump_program_tables (const struct program *p, int indent);
pike.git/src/program.h:739:
static inline struct program *PROG_FROM_INT(const struct program *p, const unsigned INT16 x) { struct reference *ref = PTR_FROM_INT(p, x); return PROG_FROM_PTR(p, ref); } static inline struct identifier *ID_FROM_INT(const struct program *p, unsigned INT16 x) { struct reference *ref = PTR_FROM_INT(p, x); return ID_FROM_PTR(p, ref); }
+
#ifdef PIKE_NEW_LFUN_LOOKUP
+
#define QUICK_FIND_LFUN(P,N) ((P)->lfuns[(N)>>4]? \
+
(P)->lfuns[(P)->lfuns[(N)>>4] + ((N) & 0x0f)]:-1)
+
#else
#define QUICK_FIND_LFUN(P,N) (dmalloc_touch(struct program *,(P))->lfuns[N])
-
+
#endif
#ifdef DO_PIKE_CLEANUP PMOD_EXPORT extern int gc_external_refs_zapped; PMOD_EXPORT void gc_check_zapped (void *a, TYPE_T type, const char *file, INT_TYPE line); #endif #if defined (USE_DLL) && defined (DYNAMIC_MODULE) /* Use the function in modules so we don't have to export the block * alloc stuff. */ #define free_program(p) do_free_program(p)