2018-05-28 03:18:44 +02:00
|
|
|
/***************************************************************************
|
|
|
|
|
|
|
|
gb.jit.h
|
|
|
|
|
2022-09-12 15:13:13 +02:00
|
|
|
(c) 2018 Benoît Minisini <benoit.minisini@gambas-basic.org>
|
2018-05-28 03:18:44 +02:00
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
|
|
|
MA 02110-1301, USA.
|
|
|
|
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
#ifndef __GB_JIT_H
|
|
|
|
#define __GB_JIT_H
|
|
|
|
|
|
|
|
typedef
|
|
|
|
union {
|
|
|
|
int type;
|
|
|
|
struct { int type; double value; } PACKED _float;
|
|
|
|
struct { int type; float value; } PACKED _single;
|
|
|
|
struct { int type; int value; } PACKED _integer;
|
|
|
|
struct { int type; int64_t value; } PACKED _long;
|
|
|
|
struct { int type; char *addr; int len; } PACKED _string;
|
|
|
|
struct { int type; int val[2]; } PACKED _swap;
|
|
|
|
}
|
|
|
|
PACKED
|
|
|
|
JIT_CONSTANT;
|
|
|
|
|
2018-06-09 22:42:35 +02:00
|
|
|
typedef
|
|
|
|
ushort JIT_PCODE;
|
|
|
|
|
2018-07-07 14:54:23 +02:00
|
|
|
typedef
|
|
|
|
struct {
|
|
|
|
unsigned char flag;
|
|
|
|
unsigned char id;
|
|
|
|
short value;
|
|
|
|
}
|
|
|
|
JIT_CTYPE;
|
|
|
|
|
2018-07-02 19:37:37 +02:00
|
|
|
typedef
|
|
|
|
struct {
|
|
|
|
void *next;
|
|
|
|
GB_VALUE *bp;
|
|
|
|
GB_VALUE *pp;
|
|
|
|
void *cp;
|
|
|
|
char *op;
|
|
|
|
GB_VALUE *ep;
|
|
|
|
void *fp;
|
|
|
|
JIT_PCODE *pc;
|
|
|
|
JIT_PCODE *ec;
|
|
|
|
JIT_PCODE *et;
|
|
|
|
GB_VALUE *gp;
|
|
|
|
}
|
|
|
|
JIT_CONTEXT;
|
|
|
|
|
2018-05-28 03:18:44 +02:00
|
|
|
typedef
|
|
|
|
struct {
|
2018-06-09 22:42:35 +02:00
|
|
|
GB_VALUE **sp;
|
2018-07-02 19:37:37 +02:00
|
|
|
JIT_CONTEXT *exec;
|
2018-06-09 22:42:35 +02:00
|
|
|
GB_VALUE *ret;
|
2018-06-27 19:32:23 +02:00
|
|
|
GB_VALUE **exec_super;
|
2018-05-29 03:43:23 +02:00
|
|
|
void (*debug)(const char *fmt, ...);
|
2018-07-02 19:37:37 +02:00
|
|
|
JIT_PCODE *(*get_code)(void *func);
|
2018-06-01 03:50:42 +02:00
|
|
|
void (*throw)(int code, ...) NORETURN;
|
2018-08-11 14:05:09 +02:00
|
|
|
void (*throw_type)(GB_TYPE want, GB_TYPE got) NORETURN;
|
2018-05-28 03:18:44 +02:00
|
|
|
JIT_CONSTANT *(*get_constant)(int index);
|
2018-05-29 23:25:57 +02:00
|
|
|
void *(*get_class_ref)(int index);
|
2018-05-28 03:18:44 +02:00
|
|
|
void **subr_table;
|
|
|
|
const char *char_table;
|
2018-06-09 22:42:35 +02:00
|
|
|
void *(*unborrow)(GB_VALUE *val);
|
2018-05-29 23:25:57 +02:00
|
|
|
void (*new)(void);
|
|
|
|
void (*push_array)(ushort code);
|
|
|
|
void (*pop_array)(ushort code);
|
2018-06-02 17:59:47 +02:00
|
|
|
void (*conv)(GB_VALUE *value, GB_TYPE type);
|
|
|
|
void (*push_unknown)(void);
|
2018-08-22 09:30:27 +02:00
|
|
|
void (*call_unknown)(ushort *pc, GB_VALUE **psp);
|
2018-06-02 17:59:47 +02:00
|
|
|
void (*pop_unknown)(void);
|
2018-06-05 11:43:39 +02:00
|
|
|
void (*enum_first)(ushort code, GB_VALUE *local, GB_VALUE *penum);
|
|
|
|
bool (*enum_next)(ushort code, GB_VALUE *local, GB_VALUE *penum);
|
2018-06-09 22:42:35 +02:00
|
|
|
int (*find_symbol)(void *symbol, ushort *sort, int n_symbol, size_t s_symbol, int flag, const char *name, int len, const char *prefix);
|
|
|
|
void (*load_class)(void *class);
|
2018-08-14 16:46:55 +02:00
|
|
|
void (*load_class_without_init)(void *class);
|
2018-06-14 16:42:47 +02:00
|
|
|
void *error_current;
|
|
|
|
void *error_handler;
|
|
|
|
void (*error_reset)(void *);
|
|
|
|
void (*error_set_last)(bool);
|
2023-01-04 18:49:13 +01:00
|
|
|
void (*set_got_error)(bool);
|
2018-06-19 00:26:25 +02:00
|
|
|
void **event_last;
|
|
|
|
void (*push_complex)(void);
|
|
|
|
void (*push_vargs)(void);
|
|
|
|
void (*pop_vargs)(void);
|
2018-06-23 01:31:39 +02:00
|
|
|
void (*exec_quit)(ushort code);
|
2018-06-25 19:17:44 +02:00
|
|
|
void (*push_unknown_event)(bool);
|
2018-06-27 19:32:23 +02:00
|
|
|
void *(*get_extern)(void *ext);
|
2018-07-02 19:37:37 +02:00
|
|
|
const char *(*get_position)(void *cp, void *fp, ushort *pc);
|
|
|
|
void (*release_many)(GB_VALUE *, int);
|
2018-07-07 14:54:23 +02:00
|
|
|
void *(*static_struct)(void *ref, GB_CLASS type, char *addr);
|
|
|
|
void *(*static_array)(void *cp, void *ref, GB_CLASS type, char *addr);
|
|
|
|
void *(*get_array_class)(void *cp, JIT_CTYPE ctype);
|
2020-04-06 04:40:47 +02:00
|
|
|
void (*add_string_local)(GB_STRING *str, GB_STRING val);
|
|
|
|
void (*add_string_global)(char **str, GB_STRING val);
|
2021-06-18 04:33:42 +02:00
|
|
|
void (*value_class_write)(void *class, GB_VALUE *value, void *addr, JIT_CTYPE ctype);
|
2022-10-08 10:26:50 +02:00
|
|
|
void (*subr_poke)(ushort code);
|
2022-10-17 23:30:21 +02:00
|
|
|
void *(*get_object_addr)(void *ob);
|
2018-05-28 03:18:44 +02:00
|
|
|
}
|
|
|
|
JIT_INTERFACE;
|
|
|
|
|
|
|
|
#endif
|