DEADSOFTWARE

Patched for Linux
[mp3cc.git] / MPC.3.5.LINUX / classgen / preverify.h
1 /********************************************************************
3 preverify.h - methods and structures for bytecode preverification
5 Niksa Orlic, 2004-08-18
7 ********************************************************************/
10 /*** Preverifier structures ***/
11 enum stack_item
12 {
13 ITEM_Bogus = 0,
14 ITEM_Integer,
15 ITEM_Float,
16 ITEM_Double,
17 ITEM_Long,
18 ITEM_Null,
19 ITEM_InitObject,
20 ITEM_Object,
21 ITEM_NewObject
22 };
24 struct stack_entry_struct
25 {
26 enum stack_item item_type;
27 short int additional_data;
28 };
30 typedef struct stack_entry_struct stack_entry;
32 struct stack_map_struct
33 {
34 int number_of_items;
35 int allocated_number_of_items;
36 stack_entry **stack;
37 int bytecode_offset;
38 };
40 typedef struct stack_map_struct stack_map;
44 stack_entry* stack_entry_create();
45 void stack_entry_destroy(stack_entry*);
46 stack_entry* stack_entry_duplicate(stack_entry*);
48 stack_map* stack_map_create();
49 void stack_map_destroy(stack_map*);
50 stack_map* stack_map_duplicate(stack_map*);
52 stack_entry* stack_map_pop(stack_map*);
53 void stack_map_push(stack_map*, stack_entry*);
54 void stack_map_push_entry(stack_map*, enum stack_item, short int);
55 void stack_map_push_local(stack_map*, identifier*, int);
58 struct stack_map_list_struct
59 {
60 struct stack_map_list_struct *next;
61 stack_map *data;
62 };
64 typedef struct stack_map_list_struct stack_map_list;
66 void stack_map_list_destroy(stack_map_list*);
68 void stack_map_list_append(stack_map_list**, stack_map*);
69 stack_map* stack_map_list_get(stack_map_list**);
72 /*** Preverifier methods ***/
73 stack_map_list *preverify_bytecode(bytecode*, identifier *);
74 int preverify_consume_bytecode(bytecode*, stack_map*, int *offset, identifier*);
75 void process_jump(stack_map *map, int position);
76 void preverify_bytecode_from(stack_map*, bytecode*, identifier*);
77 stack_map_list* sort_map_list(stack_map_list*);