RSS

(root)/ildjit/iljit : 1 : src/cil_stack.h

« back to all changes in this revision

Viewing changes to src/cil_stack.h

Speziale Ettore
2009-11-18 13:08:01
Revision ID: ettore@mars-20091118130801-ntc9elzzzz0c62xz
Initial import into Bazaar.

Show diffs side-by-side

added added

removed removed

 
1
/*
 
2
 * Copyright (C) 2006  Campanoni Simone
 
3
 *
 
4
 * iljit - This is a Just-in-time for the CIL language specified with the ECMA-335
 
5
 * 
 
6
 * This program is free software; you can redistribute it and/or modify
 
7
 * it under the terms of the GNU General Public License as published by
 
8
 * the Free Software Foundation; either version 2 of the License, or
 
9
 * (at your option) any later version.
 
10
 *
 
11
 * This program is distributed in the hope that it will be useful,
 
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
 * GNU General Public License for more details.
 
15
 *
 
16
 * You should have received a copy of the GNU General Public License
 
17
 * along with this program; if not, write to the Free Software
 
18
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
19
 */
 
20
/**
 
21
 * @file cil_stack.h
 
22
 *
 
23
 * This file implements the stack used for the translation from CIL bytecode to IR language
 
24
 */
 
25
#ifndef CIL_STACK_H
 
26
#define CIL_STACK_H
 
27
 
 
28
#include <jitsystem.h>
 
29
#include <ir_method.h>
 
30
#include <metadata/metadata_types.h>
 
31
 
 
32
#define MAX_STACK_SIZE                          128
 
33
 
 
34
/**
 
35
 * @brief Stack
 
36
 *
 
37
 * This struct contains the stack used to translate the CIL method into the IR equivalent method.
 
38
 */
 
39
typedef struct t_stack{
 
40
        ir_item_t       *stack;                                                                         /**< Stack                                              */
 
41
        JITUINT32       top;                                                                            /**< Top of the stack                                   */
 
42
        JITUINT32       max_stack_size;                                                                 /**< Max size of the stack                              */
 
43
        void            (*dupTop)               (struct t_stack *_this);                                /**< Duplicate the top of the stack                     */
 
44
        void            (*push)                 (struct t_stack *_this, ir_item_t *var);                /**< Push the element var to the top of the stack       */
 
45
        void            (*pop)                  (struct t_stack *_this, ir_item_t *var);                /**< Pop the element on the top of the stack and store it into the item element if it is not NULL       */
 
46
        void            (*adjustSize)           (struct t_stack *_this);
 
47
        void            (*cleanTop)             (struct t_stack *_this);                                /**< Clean the top of the stack                         */
 
48
} t_stack;
 
49
 
 
50
typedef struct _CILStack{
 
51
        XanList         *stackes;               /**< List of stackes allocated                  */
 
52
        
 
53
        t_stack *       (*newStack)             (struct _CILStack *cilStack);
 
54
        t_stack *       (*mergeStackes)         (struct _CILStack *cilStack, t_stack *stack1, t_stack *stack2, void *ilMethod, void *labelInst);
 
55
        t_stack *       (*cloneStack)           (struct _CILStack *cilStack, t_stack *stack);                           /**< Clone the stack    */
 
56
        void            (*destroy)              (struct _CILStack *cilStack);
 
57
} _CILStack;
 
58
 
 
59
typedef struct _CILStack * CILStack;
 
60
 
 
61
CILStack newCILStack();
 
62
 
 
63
#endif

Loggerhead 1.17 is a web-based interface for Bazaar branches