File: vm.h

package info (click to toggle)
neko 1.8.1-6
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 2,116 kB
  • sloc: ansic: 16,707; makefile: 125; sh: 37; xml: 4
file content (68 lines) | stat: -rwxr-xr-x 2,111 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/* ************************************************************************ */
/*																			*/
/*  Neko Virtual Machine													*/
/*  Copyright (c)2005 Motion-Twin											*/
/*																			*/
/* This library is free software; you can redistribute it and/or			*/
/* modify it under the terms of the GNU Lesser General Public				*/
/* License as published by the Free Software Foundation; either				*/
/* version 2.1 of the License, or (at your option) any later version.		*/
/*																			*/
/* This library 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		*/
/* Lesser General Public License or the LICENSE file for more details.		*/
/*																			*/
/* ************************************************************************ */
#ifndef _NEKO_VMCONTEXT_H
#define _NEKO_VMCONTEXT_H
#include <setjmp.h>
#include "neko_vm.h"

#define INIT_STACK_SIZE (1 << 8)
#define MAX_STACK_SIZE	(1 << 18)
#define MAX_STACK_PER_FUNCTION	128
#define PROF_SIZE		(1 << 20)
#define CALL_MAX_ARGS	5
#define NEKO_FIELDS_MASK 63

typedef struct _custom_list {
	vkind tag;
	void *custom;
	struct _custom_list *next;
} custom_list;

struct _neko_vm {
	int_val *sp;
	int_val *csp;
	value env;
	value vthis;
	int_val *spmin;
	int_val *spmax;
	int_val trap;
	void *jit_val;
	jmp_buf start;
	void *c_stack_max;
	int run_jit;
	value exc_stack;
	neko_printer print;
	void *print_param;
	custom_list *clist;
	value resolver;
	char tmp[100];
	int trusted_code;
	neko_stat_func fstats;
	neko_stat_func pstats;
};

extern int_val *callback_return;
extern mt_local *neko_vm_context;

#define NEKO_VM()	((neko_vm*)local_get(neko_vm_context))

extern value neko_alloc_apply( int nargs, value env );
extern value neko_interp( neko_vm *vm, void *m, int_val acc, int_val *pc );
extern int_val *neko_get_ttable();

#endif
/* ************************************************************************ */