xine-lib 1.2.13-20230125hg15249
goomsl_private.h
Go to the documentation of this file.
1#ifndef _GSL_PRIVATE_H
2#define _GSL_PRIVATE_H
3
4/* -- internal use -- */
5
6#include "goomsl.h"
7
8#ifdef USE_JITC_X86
9#include "jitc_x86.h"
10#endif
11
12#include "goomsl_heap.h"
13
14/* {{{ type of nodes */
15#define EMPTY_NODE 0
16#define CONST_INT_NODE 1
17#define CONST_FLOAT_NODE 2
18#define CONST_PTR_NODE 3
19#define VAR_NODE 4
20#define PARAM_NODE 5
21#define READ_PARAM_NODE 6
22#define OPR_NODE 7
23/* }}} */
24/* {{{ type of operations */
25#define OPR_SET 1
26#define OPR_IF 2
27#define OPR_WHILE 3
28#define OPR_BLOCK 4
29#define OPR_ADD 5
30#define OPR_MUL 6
31#define OPR_EQU 7
32#define OPR_NOT 8
33#define OPR_LOW 9
34#define OPR_DIV 10
35#define OPR_SUB 11
36#define OPR_FUNC_INTRO 12
37#define OPR_FUNC_OUTRO 13
38#define OPR_CALL 14
39#define OPR_EXT_CALL 15
40#define OPR_PLUS_EQ 16
41#define OPR_SUB_EQ 17
42#define OPR_MUL_EQ 18
43#define OPR_DIV_EQ 19
44#define OPR_CALL_EXPR 20
45#define OPR_AFFECT_LIST 21
46#define OPR_FOREACH 22
47#define OPR_VAR_LIST 23
48
49/* }}} */
50
51typedef struct _ConstIntNodeType { /* {{{ */
52 int val;
53} ConstIntNodeType; /* }}} */
54typedef struct _ConstFloatNodeType { /* {{{ */
55 float val;
57typedef struct _ConstPtrNodeType { /* {{{ */
58 int id;
59} ConstPtrNodeType; /* }}} */
60typedef struct _OprNodeType { /* {{{ */
61 int type;
62 int nbOp;
63 struct _NODE_TYPE *op[3]; /* maximal number of operand needed */
65} OprNodeType; /* }}} */
78typedef struct _INSTRUCTION_DATA { /* {{{ */
79
80 union {
81 void *var;
82 int *var_int;
83 int *var_ptr;
84 float *var_float;
88
89 union {
90 void *var;
91 int *var_int;
92 int *var_ptr;
93 float *var_float;
99/* }}} */
100typedef struct _INSTRUCTION { /* {{{ */
101
102 int id;
105 const char *name; /* name of the instruction */
106
107 char **params; /* parametres de l'instruction */
109 int *types; /* type des parametres de l'instruction */
112
116
118
120/* }}} */
128/* }}} */
134/* }}} */
140/* }}} */
146/* }}} */
147typedef struct _Block {
148 int data;
149 int size;
151typedef struct _GSL_StructField { /* {{{ */
152 int type;
153 char name[256];
154 int offsetInStruct; /* Where this field is stored... */
156 /* }}} */
164 /* }}} */
165struct _GoomSL { /* {{{ */
167 Instruction *instr; /* instruction en cours de construction */
168
169 InstructionFlow *iflow; /* flow d'instruction 'normal' */
170 FastInstructionFlow *fastiflow; /* flow d'instruction optimise */
171
172 GoomHash *vars; /* table de variables */
175
176 GoomHash *functions; /* table des fonctions externes */
177
178 GoomHeap *data_heap; /* GSL Heap-like memory space */
179
184
185 int nbPtr;
187 void **ptrArray;
188
190#ifdef USE_JITC_X86
191 JitcX86Env *jitc;
192 JitcFunc jitc_func;
193#endif
194}; /* }}} */
195
196extern GoomSL *currentGoomSL;
197
198Instruction *gsl_instr_init(GoomSL *parent, const char *name, int id, int nb_param, int line_number);
199void gsl_instr_add_param(Instruction *_this, const char *param, int type);
201
202void gsl_declare_task(const char *name);
203void gsl_declare_external_task(const char *name);
204
205int gsl_type_of_var(GoomHash *namespace, const char *name);
206
207void gsl_enternamespace(const char *name);
210GoomHash *gsl_find_namespace(const char *name);
211
212void gsl_commit_compilation(void);
213
214/* #define TYPE_PARAM 1 */
215
216#define FIRST_RESERVED 0x80000
217
218#define TYPE_INTEGER 0x90001
219#define TYPE_FLOAT 0x90002
220#define TYPE_VAR 0x90003
221#define TYPE_PTR 0x90004
222#define TYPE_LABEL 0x90005
223
224#define TYPE_OP_EQUAL 6
225#define TYPE_IVAR 0xa0001
226#define TYPE_FVAR 0xa0002
227#define TYPE_PVAR 0xa0003
228#define TYPE_SVAR 0xa0004
229
230#define INSTR_JUMP 6
231#define INSTR_JZERO 29
232#define INSTR_CALL 36
233#define INSTR_RET 37
234#define INSTR_EXT_CALL 38
235#define INSTR_JNZERO 40
236
237#define INSTR_SET 0x80001
238#define INSTR_INT 0x80002
239#define INSTR_FLOAT 0x80003
240#define INSTR_PTR 0x80004
241#define INSTR_LABEL 0x80005
242#define INSTR_ISLOWER 0x80006
243#define INSTR_ADD 0x80007
244#define INSTR_MUL 0x80008
245#define INSTR_DIV 0x80009
246#define INSTR_SUB 0x80010
247#define INSTR_ISEQUAL 0x80011
248#define INSTR_NOT 0x80012
249
250
251#endif
void(* GoomSL_ExternalFunction)(GoomSL *gsl, GoomHash *global_vars, GoomHash *local_vars)
Definition goomsl.h:7
void gsl_declare_external_task(const char *name)
Definition goomsl.c:858
struct _INSTRUCTION Instruction
Instruction * gsl_instr_init(GoomSL *parent, const char *name, int id, int nb_param, int line_number)
Definition goomsl.c:175
void gsl_declare_task(const char *name)
Definition goomsl.c:844
struct _INSTRUCTION_FLOW InstructionFlow
void gsl_instr_add_param(Instruction *_this, const char *param, int type)
Definition goomsl.c:141
struct _NODE_TYPE NodeType
int gsl_type_of_var(GoomHash *namespace, const char *name)
Definition goomsl_yacc.c:358
struct _ExternalFunctionStruct ExternalFunctionStruct
struct _FastInstructionFlow FastInstructionFlow
GoomHash * gsl_leavenamespace(void)
Definition goomsl.c:828
void gsl_instr_set_namespace(Instruction *_this, GoomHash *ns)
Definition goomsl.c:132
void gsl_commit_compilation(void)
Definition goomsl_yacc.c:1150
struct _INSTRUCTION_DATA InstructionData
struct _ConstFloatNodeType ConstFloatNodeType
struct _GSL_Struct GSL_Struct
struct _GSL_StructField GSL_StructField
void gsl_reenternamespace(GoomHash *ns)
Definition goomsl.c:823
struct _ConstIntNodeType ConstIntNodeType
GoomSL * currentGoomSL
Definition goomsl_lex.c:635
GoomHash * gsl_find_namespace(const char *name)
Definition goomsl.c:834
struct _Block Block
void gsl_enternamespace(const char *name)
Definition goomsl.c:809
struct _FAST_INSTRUCTION FastInstruction
struct _ConstPtrNodeType ConstPtrNodeType
struct _OprNodeType OprNodeType
Definition goomsl_hash.h:20
Definition goomsl_private.h:147
int data
Definition goomsl_private.h:148
int size
Definition goomsl_private.h:149
Definition goomsl_private.h:54
float val
Definition goomsl_private.h:55
Definition goomsl_private.h:51
int val
Definition goomsl_private.h:52
Definition goomsl_private.h:57
int id
Definition goomsl_private.h:58
Definition goomsl_private.h:141
int is_extern
Definition goomsl_private.h:144
GoomSL_ExternalFunction function
Definition goomsl_private.h:142
GoomHash * vars
Definition goomsl_private.h:143
Definition goomsl_private.h:129
Instruction * proto
Definition goomsl_private.h:132
InstructionData data
Definition goomsl_private.h:131
int id
Definition goomsl_private.h:130
Definition goomsl_private.h:135
void * mallocedInstr
Definition goomsl_private.h:138
FastInstruction * instr
Definition goomsl_private.h:137
int number
Definition goomsl_private.h:136
Definition goomsl_heap.c:10
Definition goomsl_private.h:151
int offsetInStruct
Definition goomsl_private.h:154
int type
Definition goomsl_private.h:152
char name[256]
Definition goomsl_private.h:153
Definition goomsl_private.h:157
GSL_StructField * fields[64]
Definition goomsl_private.h:159
Block iBlock[64]
Definition goomsl_private.h:161
int nbFields
Definition goomsl_private.h:158
Block fBlock[64]
Definition goomsl_private.h:162
int size
Definition goomsl_private.h:160
Definition goomsl_private.h:165
int nbPtr
Definition goomsl_private.h:185
InstructionFlow * iflow
Definition goomsl_private.h:169
int ptrArraySize
Definition goomsl_private.h:186
GoomHash * namespaces[16]
Definition goomsl_private.h:174
GSL_Struct ** gsl_struct
Definition goomsl_private.h:182
int num_lines
Definition goomsl_private.h:166
GoomHash * functions
Definition goomsl_private.h:176
GoomHeap * data_heap
Definition goomsl_private.h:178
FastInstructionFlow * fastiflow
Definition goomsl_private.h:170
int nbStructID
Definition goomsl_private.h:180
GoomHash * vars
Definition goomsl_private.h:172
int currentNS
Definition goomsl_private.h:173
GoomHash * structIDS
Definition goomsl_private.h:181
Instruction * instr
Definition goomsl_private.h:167
int gsl_struct_size
Definition goomsl_private.h:183
int compilationOK
Definition goomsl_private.h:189
void ** ptrArray
Definition goomsl_private.h:187
Definition goomsl_private.h:78
int value_int
Definition goomsl_private.h:94
void * var
Definition goomsl_private.h:81
float value_float
Definition goomsl_private.h:96
float * var_float
Definition goomsl_private.h:84
int value_ptr
Definition goomsl_private.h:95
struct _ExternalFunctionStruct * external_function
Definition goomsl_private.h:86
union _INSTRUCTION_DATA::@53 usrc
int jump_offset
Definition goomsl_private.h:85
int * var_ptr
Definition goomsl_private.h:83
int * var_int
Definition goomsl_private.h:82
union _INSTRUCTION_DATA::@52 udest
Definition goomsl_private.h:121
Instruction ** instr
Definition goomsl_private.h:123
GoomHash * labels
Definition goomsl_private.h:126
int number
Definition goomsl_private.h:124
int tabsize
Definition goomsl_private.h:125
Definition goomsl_private.h:100
char * nop_label
Definition goomsl_private.h:115
GoomSL * parent
Definition goomsl_private.h:104
const char * name
Definition goomsl_private.h:105
GoomHash ** vnamespace
Definition goomsl_private.h:108
int line_number
Definition goomsl_private.h:117
int nb_param
Definition goomsl_private.h:111
int id
Definition goomsl_private.h:102
char ** params
Definition goomsl_private.h:107
InstructionData data
Definition goomsl_private.h:103
char * jump_label
Definition goomsl_private.h:114
int * types
Definition goomsl_private.h:109
int address
Definition goomsl_private.h:113
int cur_param
Definition goomsl_private.h:110
Definition goomsl_private.h:66
union _NODE_TYPE::@51 unode
OprNodeType opr
Definition goomsl_private.h:75
GoomHash * vnamespace
Definition goomsl_private.h:69
int type
Definition goomsl_private.h:67
ConstIntNodeType constInt
Definition goomsl_private.h:72
int line_number
Definition goomsl_private.h:70
char * str
Definition goomsl_private.h:68
ConstFloatNodeType constFloat
Definition goomsl_private.h:73
ConstPtrNodeType constPtr
Definition goomsl_private.h:74
Definition goomsl_private.h:60
struct _NODE_TYPE * next
Definition goomsl_private.h:64
struct _NODE_TYPE * op[3]
Definition goomsl_private.h:63
int type
Definition goomsl_private.h:61
int nbOp
Definition goomsl_private.h:62
const char * name
Definition xine.c:1575
_xine_arg_type_t type
Definition xine.c:1574