9228601fdf86e31f13e5f4e9ad6890774cea3883
[cacao.git] / src / vm / jit / tools / genoffsets.c
1 /* src/vm/jit/tools/genoffsets.c - generate asmpart offsets of structures
2
3    Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
4    C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
5    E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
6    J. Wenninger, Institut f. Computersprachen - TU Wien
7
8    This file is part of CACAO.
9
10    This program is free software; you can redistribute it and/or
11    modify it under the terms of the GNU General Public License as
12    published by the Free Software Foundation; either version 2, or (at
13    your option) any later version.
14
15    This program is distributed in the hope that it will be useful, but
16    WITHOUT ANY WARRANTY; without even the implied warranty of
17    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18    General Public License for more details.
19
20    You should have received a copy of the GNU General Public License
21    along with this program; if not, write to the Free Software
22    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23    02110-1301, USA.
24
25    Contact: cacao@cacaojvm.org
26
27    Authors: Christian Thalinger
28
29    Changes: Edwin Steiner
30
31    $Id: genoffsets.c 4623 2006-03-16 00:05:18Z edwin $
32
33 */
34
35
36 #include "config.h"
37
38 #include <stdio.h>
39
40 #include "vm/types.h"
41
42 #include "mm/memory.h"
43 #include "vm/class.h"
44 #include "vm/global.h"
45 #include "vm/linker.h"
46 #include "vm/method.h"
47 #include "vm/vm.h"
48 #include "vm/jit/asmpart.h"
49 #include "vm/jit/stacktrace.h"
50 #include "vm/jit/replace.h"
51
52
53 int main(int argc, char **argv)
54 {
55         printf("/* This file is machine generated, don't edit it! */\n\n");
56
57     printf("/* define some sizeof()'s */\n\n");
58
59         printf("#define sizevmarg                  %3d\n", (s4) sizeof(vm_arg));
60         printf("#define sizestackframeinfo         %3d\n", (s4) sizeof(stackframeinfo));
61         printf("#define sizeexecutionstate         %3d\n", (s4) sizeof(executionstate));
62
63     printf("\n\n/* define some offsets */\n\n");
64
65         printf("#define offobjvftbl                %3d\n", (s4) OFFSET(java_objectheader, vftbl));
66         printf("\n\n");
67
68         printf("/* vftbl_t */\n\n");
69         printf("#define offbaseval                 %3d\n", (s4) OFFSET(vftbl_t, baseval));
70         printf("#define offdiffval                 %3d\n", (s4) OFFSET(vftbl_t, diffval));
71         printf("\n\n");
72
73         printf("/* classinfo */\n\n");
74         printf("#define offclassvftbl              %3d\n", (s4) OFFSET(classinfo, vftbl));
75         printf("\n\n");
76
77         printf("#define offvmargtype               %3d\n", (s4) OFFSET(vm_arg, type));
78         printf("#define offvmargdata               %3d\n", (s4) OFFSET(vm_arg, data));
79         printf("\n\n");
80
81         printf("#define offcast_super_baseval      %3d\n", (s4) OFFSET(castinfo, super_baseval));
82         printf("#define offcast_super_diffval      %3d\n", (s4) OFFSET(castinfo, super_diffval));
83         printf("#define offcast_sub_baseval        %3d\n", (s4) OFFSET(castinfo, sub_baseval));
84
85         printf("#define offes_pc                   %3d\n", (s4) OFFSET(executionstate, pc));
86         printf("#define offes_sp                   %3d\n", (s4) OFFSET(executionstate, sp));
87         printf("#define offes_intregs              %3d\n", (s4) OFFSET(executionstate, intregs));
88         printf("#define offes_fltregs              %3d\n", (s4) OFFSET(executionstate, fltregs));
89
90         /* everything is ok */
91
92         return 0;
93 }
94
95
96 /*
97  * These are local overrides for various environment variables in Emacs.
98  * Please do not remove this and leave it at the end of the file, where
99  * Emacs will automagically detect them.
100  * ---------------------------------------------------------------------
101  * Local variables:
102  * mode: c
103  * indent-tabs-mode: t
104  * c-basic-offset: 4
105  * tab-width: 4
106  * End:
107  * vim:noexpandtab:sw=4:ts=4:
108  */
109
110