gambas-source-code/main/gbx/gb.jit.h
gambas 4e50dec11d Work continues on new JIT system. Translation is now done at runtime.
[INTERPRETER]
* OPT: String routines are now compiled with -O3.
* NEW: Don't display JIT debugging message unless GB_JIT_DEBUG is set to something different from zero.
* NEW: String whose length is greater than 256 now have a growth step of 256 bytes instead of 16.

[GB.JIT]
* NEW: Do many global optimizations as now the class metadata is fully available.
* NEW: Support for optional argument. Still buggy at the moment.
2018-06-09 22:42:35 +02:00

72 lines
2.3 KiB
C

/***************************************************************************
gb.jit.h
(c) 2018 Benoît Minisini <g4mba5@gmail.com>
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;
typedef
ushort JIT_PCODE;
typedef
struct {
GB_VALUE **sp;
JIT_PCODE **pc;
void **cp;
char **op;
GB_VALUE *ret;
void (*debug)(const char *fmt, ...);
JIT_PCODE *(*get_code)(void *class, int index);
void (*throw)(int code, ...) NORETURN;
JIT_CONSTANT *(*get_constant)(int index);
void *(*get_class_ref)(int index);
void **subr_table;
const char *char_table;
void *(*unborrow)(GB_VALUE *val);
void (*new)(void);
void (*push_array)(ushort code);
void (*pop_array)(ushort code);
void (*conv)(GB_VALUE *value, GB_TYPE type);
void (*push_unknown)(void);
void (*call_unknown)(ushort *pc, GB_VALUE *sp);
void (*pop_unknown)(void);
void (*enum_first)(ushort code, GB_VALUE *local, GB_VALUE *penum);
bool (*enum_next)(ushort code, GB_VALUE *local, GB_VALUE *penum);
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);
}
JIT_INTERFACE;
#endif