LCOV - code coverage report
Current view: top level - vm - method.hpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 2 0.0 %
Date: 2015-06-10 18:10:59 Functions: 0 1 0.0 %

          Line data    Source code
       1             : /* src/vm/method.hpp - method functions header
       2             : 
       3             :    Copyright (C) 1996-2013
       4             :    CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
       5             : 
       6             :    This file is part of CACAO.
       7             : 
       8             :    This program is free software; you can redistribute it and/or
       9             :    modify it under the terms of the GNU General Public License as
      10             :    published by the Free Software Foundation; either version 2, or (at
      11             :    your option) any later version.
      12             : 
      13             :    This program is distributed in the hope that it will be useful, but
      14             :    WITHOUT ANY WARRANTY; without even the implied warranty of
      15             :    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      16             :    General Public License for more details.
      17             : 
      18             :    You should have received a copy of the GNU General Public License
      19             :    along with this program; if not, write to the Free Software
      20             :    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
      21             :    02110-1301, USA.
      22             : 
      23             : */
      24             : 
      25             : 
      26             : #ifndef METHOD_HPP_
      27             : #define METHOD_HPP_ 1
      28             : 
      29             : #include "config.h"                     // for ENABLE_JAVASE, etc
      30             : 
      31             : #include <stdint.h>                     // for uint16_t, int32_t
      32             : 
      33             : #include "vm/global.hpp"                // for java_handle_bytearray_t, etc
      34             : #include "vm/references.hpp"            // for classref_or_classinfo
      35             : #include "vm/types.hpp"                 // for s4, u2, u1
      36             : #include "vm/utf8.hpp"                  // for Utf8String
      37             : 
      38             : class BreakpointTable;
      39             : class Mutex;
      40             : struct builtintable_entry;
      41             : struct classbuffer;
      42             : struct classinfo;
      43             : struct codeinfo;
      44             : struct lineinfo;
      45             : struct localvarinfo;
      46             : struct method_assumption;
      47             : struct method_worklist;
      48             : struct methoddesc;
      49             : struct methodinfo;
      50             : struct raw_exception_entry;
      51             : struct stack_map_t;
      52             : struct vftbl_t;
      53             : 
      54             : namespace cacao {
      55             :         struct ClassBuffer;
      56             :         struct DescriptorPool;
      57             : }
      58             : 
      59             : 
      60             : #if defined(ENABLE_REPLACEMENT)
      61             : // Initial value for the hit countdown field of each method.
      62             : #define METHOD_INITIAL_HIT_COUNTDOWN  1000
      63             : #endif
      64             : 
      65             : 
      66             : /* methodinfo *****************************************************************/
      67             : 
      68             : struct methodinfo {                 /* method structure                       */
      69             :         Mutex        *mutex;            /* we need this in jit's locking          */
      70             :         s4            flags;            /* ACC flags                              */
      71             :         Utf8String    name;             /* name of method                         */
      72             :         Utf8String    descriptor;       /* JavaVM descriptor string of method     */
      73             : #if defined(ENABLE_JAVASE)
      74             :         Utf8String    signature;        /* Signature attribute                    */
      75             :         stack_map_t  *stack_map;        /* StackMapTable attribute                */
      76             : #endif
      77             : 
      78             :         methoddesc   *parseddesc;       /* parsed descriptor                      */
      79             : 
      80             :         classinfo    *clazz;            /* class, the method belongs to           */
      81             :         s4            vftblindex;       /* index of method in virtual function    */
      82             :                                         /* table (if it is a virtual method)      */
      83             :         s4            maxstack;         /* maximum stack depth of method          */
      84             :         s4            maxlocals;        /* maximum number of local variables      */
      85             :         s4            jcodelength;      /* length of JavaVM code                  */
      86             :         u1           *jcode;            /* pointer to JavaVM code                 */
      87             : 
      88             :         s4            rawexceptiontablelength;  /* exceptiontable length          */
      89             :         raw_exception_entry *rawexceptiontable; /* the exceptiontable             */
      90             : 
      91             :         u2            thrownexceptionscount; /* number of exceptions attribute    */
      92             :         classref_or_classinfo *thrownexceptions; /* except. a method may throw    */
      93             : 
      94             :         u2            linenumbercount;  /* number of linenumber attributes        */
      95             :         lineinfo     *linenumbers;      /* array of lineinfo items                */
      96             : 
      97             : #if defined(ENABLE_JAVASE) && defined(ENABLE_JVMTI)
      98             :         uint16_t      localvarcount;    /* number of local variable attributes    */
      99             :         localvarinfo* localvars;        /* array of localvarinfo items            */
     100             : #endif
     101             : 
     102             :         u1           *stubroutine;      /* stub for compiling or calling natives  */
     103             :         codeinfo     *code;             /* current code of this method            */
     104             : 
     105             : #if defined(ENABLE_LSRA)
     106             :         s4            maxlifetimes;     /* helper for lsra                        */
     107             : #endif
     108             : 
     109             :         methodinfo   *overwrites;       /* method that is directly overwritten    */
     110             :         method_assumption *assumptions; /* list of assumptions about this method  */
     111             : 
     112             :         BreakpointTable* breakpoints;   /* breakpoints in this method             */
     113             : 
     114             : #if defined(ENABLE_REPLACEMENT)
     115             :         s4            hitcountdown;     /* decreased for each hit                 */
     116             : #endif
     117             : 
     118             : #if defined(ENABLE_DEBUG_FILTER)
     119             :         u1            filtermatches;    /* flags indicating which filters the method matches */
     120             : #endif
     121             : 
     122             : #if defined(ENABLE_ESCAPE)
     123             :         u1           *paramescape;
     124             : #endif
     125             : };
     126             : 
     127             : /* method_assumption ***********************************************************
     128             : 
     129             :    This struct is used for registering assumptions about methods.
     130             : 
     131             : *******************************************************************************/
     132             : 
     133             : struct method_assumption {
     134             :         method_assumption *next;
     135             :         methodinfo        *context;
     136             : };
     137             : 
     138             : 
     139             : /* method_worklist *************************************************************
     140             : 
     141             :    List node used for method worklists.
     142             : 
     143             : *******************************************************************************/
     144             : 
     145             : struct method_worklist {
     146             :         method_worklist *next;
     147             :         methodinfo      *m;
     148             : };
     149             : 
     150             : 
     151             : /* raw_exception_entry ********************************************************/
     152             : 
     153             : /* exception table entry read by the loader */
     154             : 
     155             : struct raw_exception_entry {    /* exceptiontable entry in a method           */
     156             :         classref_or_classinfo catchtype; /* catchtype of exc. (0 == catchall)     */
     157             :         u2              startpc;    /* start pc of guarded area (inclusive)       */
     158             :         u2              endpc;      /* end pc of guarded area (exklusive)         */
     159             :         u2              handlerpc;  /* pc of exception handler                    */
     160             : };
     161             : 
     162             : 
     163             : /* lineinfo *******************************************************************/
     164             : 
     165             : struct lineinfo {
     166             :         u2 start_pc;
     167             :         u2 line_number;
     168             : };
     169             : 
     170             : 
     171             : /* localvarinfo ***************************************************************/
     172             : 
     173             : struct localvarinfo {
     174             :         uint16_t   start_pc;
     175             :         uint16_t   length;
     176             :         Utf8String name;
     177             :         Utf8String descriptor;
     178             :         uint16_t   index;
     179             : };
     180             : 
     181             : 
     182             : /* global variables ***********************************************************/
     183             : 
     184             : extern methodinfo *method_java_lang_reflect_Method_invoke;
     185             : 
     186             : 
     187             : /* inline functions ***********************************************************/
     188             : 
     189           0 : inline static bool method_is_builtin(methodinfo* m)
     190             : {
     191           0 :         return m->flags & ACC_METHOD_BUILTIN;
     192             : }
     193             : 
     194             : 
     195             : /* function prototypes ********************************************************/
     196             : 
     197             : void method_init(void);
     198             : 
     199             : bool method_load(cacao::ClassBuffer& cb, methodinfo *m, cacao::DescriptorPool& descpool);
     200             : void method_free(methodinfo *m);
     201             : bool method_canoverwrite(methodinfo *m, methodinfo *old);
     202             : 
     203             : methodinfo *method_new_builtin(builtintable_entry *bte);
     204             : 
     205             : methodinfo *method_vftbl_lookup(vftbl_t *vftbl, methodinfo* m);
     206             : 
     207             : int32_t                    method_get_parametercount(methodinfo *m);
     208             : java_handle_objectarray_t *method_get_parametertypearray(methodinfo *m);
     209             : java_handle_objectarray_t *method_get_exceptionarray(methodinfo *m);
     210             : classinfo                 *method_returntype_get(methodinfo *m);
     211             : 
     212             : void method_add_assumption_monomorphic(methodinfo *m, methodinfo *caller);
     213             : void method_break_assumption_monomorphic(methodinfo *m, method_worklist **wl);
     214             : 
     215             : s4   method_count_implementations(methodinfo *m, classinfo *c, methodinfo **found);
     216             : 
     217             : java_handle_bytearray_t *method_get_annotations(methodinfo *m);
     218             : java_handle_bytearray_t *method_get_parameterannotations(methodinfo *m);
     219             : java_handle_bytearray_t *method_get_annotationdefault(methodinfo *m);
     220             : 
     221             : #if !defined(NDEBUG)
     222             : void method_printflags(methodinfo *m);
     223             : void method_print(methodinfo *m);
     224             : void method_println(methodinfo *m);
     225             : void method_methodref_print(constant_FMIref *mr);
     226             : void method_methodref_println(constant_FMIref *mr);
     227             : #endif
     228             : 
     229             : 
     230             : namespace cacao {
     231             : 
     232             : // forward declaration
     233             : class OStream;
     234             : 
     235             : cacao::OStream& operator<<(cacao::OStream &OS, const struct methodinfo &m);
     236             : 
     237             : } // end namespace cacao
     238             : 
     239             : #endif // METHOD_HPP_
     240             : 
     241             : 
     242             : /*
     243             :  * These are local overrides for various environment variables in Emacs.
     244             :  * Please do not remove this and leave it at the end of the file, where
     245             :  * Emacs will automagically detect them.
     246             :  * ---------------------------------------------------------------------
     247             :  * Local variables:
     248             :  * mode: c++
     249             :  * indent-tabs-mode: t
     250             :  * c-basic-offset: 4
     251             :  * tab-width: 4
     252             :  * End:
     253             :  * vim:noexpandtab:sw=4:ts=4:
     254             :  */

Generated by: LCOV version 1.11