2018-06-09 22:42:35 +02:00
|
|
|
/***************************************************************************
|
|
|
|
|
|
|
|
jit.h
|
|
|
|
|
|
|
|
(c) 2000-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 __JIT_H
|
|
|
|
#define __JIT_H
|
|
|
|
|
|
|
|
#define __GB_COMMON_CASE_H
|
|
|
|
#include "gb_common.h"
|
|
|
|
#include "gb_str.h"
|
|
|
|
#include "gb_pcode.h"
|
|
|
|
#include "gb_reserved.h"
|
|
|
|
#include "gbx_type.h"
|
|
|
|
#include "gbx_class.h"
|
|
|
|
#include "main.h"
|
|
|
|
|
|
|
|
#define T_UNKNOWN 17
|
|
|
|
|
|
|
|
#undef TYPE_is_pure_object
|
|
|
|
#define TYPE_is_pure_object(_type) ((_type) > T_UNKNOWN)
|
|
|
|
|
|
|
|
#undef TYPE_is_object
|
|
|
|
#define TYPE_is_object(_type) ((_type) == T_OBJECT || TYPE_is_pure_object(_type))
|
|
|
|
|
|
|
|
#define TYPEID(_type) (TYPE_is_pure_object(_type) ? T_OBJECT : (_type))
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
CALL_UNKNOWN,
|
|
|
|
CALL_PRIVATE
|
|
|
|
};
|
|
|
|
|
|
|
|
#ifndef __GBC_JIT_C
|
|
|
|
EXTERN char *JIT_prefix;
|
|
|
|
EXTERN CLASS *JIT_class;
|
|
|
|
EXTERN bool JIT_last_print_is_label;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
// jit.c
|
|
|
|
|
|
|
|
char *JIT_translate(const char *name, const char *from);
|
|
|
|
|
|
|
|
void JIT_section(const char *str);
|
|
|
|
|
|
|
|
void JIT_print(const char *fmt, ...);
|
|
|
|
void JIT_vprint(const char *fmt, va_list args);
|
|
|
|
|
|
|
|
const char *JIT_get_type(TYPE type);
|
|
|
|
const char *JIT_get_gtype(TYPE type);
|
|
|
|
const char *JIT_get_ctype(TYPE type);
|
|
|
|
TYPE JIT_ctype_to_type(CTYPE ctype);
|
2018-06-11 18:52:39 +02:00
|
|
|
const char *JIT_get_default_value(TYPE type);
|
2018-06-09 22:42:35 +02:00
|
|
|
|
|
|
|
void JIT_panic(const char *fmt, ...) NORETURN;
|
|
|
|
|
|
|
|
int JIT_get_code_size(FUNCTION *func);
|
2018-06-16 01:12:13 +02:00
|
|
|
bool JIT_must_release(FUNCTION *func);
|
2018-06-09 22:42:35 +02:00
|
|
|
int JIT_find_symbol(CLASS *class, const char *name);
|
|
|
|
void JIT_load_class(CLASS *class);
|
|
|
|
|
|
|
|
// jit_translate.c
|
|
|
|
|
|
|
|
bool JIT_translate_body(FUNCTION *func, int index);
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|