1 /* src/vm/method.c - method functions
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
8 This file is part of CACAO.
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.
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.
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
25 Contact: cacao@cacaojvm.org
27 Authors: Reinhard Grafl
29 Changes: Andreas Krall
35 $Id: method.c 4404 2006-02-03 12:38:03Z twisti $
46 #include "mm/memory.h"
48 #include "vm/global.h"
49 #include "vm/loader.h"
50 #include "vm/method.h"
53 /* method_free *****************************************************************
55 Frees all memory that was allocated for this method.
57 *******************************************************************************/
59 void method_free(methodinfo *m)
62 MFREE(m->jcode, u1, m->jcodelength);
64 if (m->exceptiontable)
65 MFREE(m->exceptiontable, exceptiontable, m->exceptiontablelength);
68 CFREE((void *) (ptrint) m->mcode, m->mcodelength);
71 if (m->flags & ACC_NATIVE) {
72 removenativestub(m->stubroutine);
75 removecompilerstub(m->stubroutine);
81 /* method_canoverwrite *********************************************************
83 Check if m and old are identical with respect to type and
84 name. This means that old can be overwritten with m.
86 *******************************************************************************/
88 bool method_canoverwrite(methodinfo *m, methodinfo *old)
90 if (m->name != old->name)
93 if (m->descriptor != old->descriptor)
96 if (m->flags & ACC_STATIC)
103 /* method_printflags ***********************************************************
105 Prints the flags of a method to stdout like.
107 *******************************************************************************/
110 void method_printflags(methodinfo *m)
117 if (m->flags & ACC_PUBLIC) printf(" PUBLIC");
118 if (m->flags & ACC_PRIVATE) printf(" PRIVATE");
119 if (m->flags & ACC_PROTECTED) printf(" PROTECTED");
120 if (m->flags & ACC_STATIC) printf(" STATIC");
121 if (m->flags & ACC_FINAL) printf(" FINAL");
122 if (m->flags & ACC_SYNCHRONIZED) printf(" SYNCHRONIZED");
123 if (m->flags & ACC_VOLATILE) printf(" VOLATILE");
124 if (m->flags & ACC_TRANSIENT) printf(" TRANSIENT");
125 if (m->flags & ACC_NATIVE) printf(" NATIVE");
126 if (m->flags & ACC_INTERFACE) printf(" INTERFACE");
127 if (m->flags & ACC_ABSTRACT) printf(" ABSTRACT");
129 #endif /* !defined(NDEBUG) */
132 /* method_print ****************************************************************
134 Prints a method to stdout like:
136 java.lang.Object.<init>()V
138 *******************************************************************************/
141 void method_print(methodinfo *m)
148 utf_display_classname(m->class->name);
150 utf_display(m->name);
151 utf_display(m->descriptor);
153 method_printflags(m);
155 #endif /* !defined(NDEBUG) */
158 /* method_println **************************************************************
160 Prints a method plus new line to stdout like:
162 java.lang.Object.<init>()V
164 *******************************************************************************/
167 void method_println(methodinfo *m)
172 #endif /* !defined(NDEBUG) */
176 * These are local overrides for various environment variables in Emacs.
177 * Please do not remove this and leave it at the end of the file, where
178 * Emacs will automagically detect them.
179 * ---------------------------------------------------------------------
182 * indent-tabs-mode: t