LCOV - code coverage report
Current view: top level - vm/jit - linenumbertable.hpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 8 9 88.9 %
Date: 2015-06-10 18:10:59 Functions: 5 6 83.3 %

          Line data    Source code
       1             : /* src/vm/jit/linenumbertable.hpp - linenumber table
       2             : 
       3             :    Copyright (C) 2007, 2008
       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 _LINENUMBERTABLE_HPP
      27             : #define _LINENUMBERTABLE_HPP
      28             : 
      29             : #include "config.h"
      30             : 
      31             : #include <stdint.h>
      32             : #include <functional>
      33             : #include <vector>
      34             : 
      35             : #include "toolbox/list.hpp"
      36             : 
      37             : #include "vm/method.hpp"
      38             : 
      39             : #include "vm/jit/code.hpp"
      40             : 
      41             : #include "vm/jit/ir/instruction.hpp"
      42             : 
      43             : struct codegendata;
      44             : struct instruction;
      45             : 
      46             : /**
      47             :  * Represents a Java line number.
      48             :  */
      49           0 : class Linenumber {
      50             : private:
      51             :         // TODO Add constants.
      52             :         /* -1......start of inlined body              */
      53             :         /* -2......end of inlined body                */
      54             :         /* <= -3...special entry with methodinfo *    */
      55             :         /* (see doc/inlining_stacktrace.txt)          */
      56             : 
      57             :         int32_t _linenumber;
      58             :         void*   _pc;
      59             : 
      60             : public:
      61      828758 :         Linenumber(int32_t linenumber, void* pc) : _linenumber(linenumber), _pc(pc) {}
      62             : 
      63         110 :         inline int32_t get_linenumber() const { return _linenumber; }
      64        3317 :         inline void*   get_pc        () const { return _pc; }
      65             : 
      66             :         void resolve(const codeinfo* code);
      67             : };
      68             : 
      69             : 
      70             : /**
      71             :  * Unary function to resolve Linenumber objects.
      72             :  */
      73             : class LinenumberResolver : public std::binary_function<Linenumber, codeinfo*, void> {
      74             : public:
      75             :         // Unary resolve function.
      76      828758 :         void operator() (Linenumber& ln, const codeinfo* code) const
      77             :         {
      78      828758 :                 ln.resolve(code);
      79      828758 :         }
      80             : };
      81             : 
      82             : 
      83             : /**
      84             :  * Linenumber table of a Java method.
      85             :  */
      86             : class LinenumberTable {
      87             : private:
      88             :         std::vector<Linenumber> _linenumbers;
      89             : 
      90             :         // Comparator class.
      91             :         class comparator : public std::binary_function<Linenumber, void*, bool> {
      92             :         public:
      93        3317 :                 bool operator() (const Linenumber& ln, const void* pc) const
      94             :                 {
      95        3317 :                         return (pc >= ln.get_pc());
      96             :                 }
      97             :         };
      98             : 
      99             : public:
     100             :         LinenumberTable(jitdata* jd);
     101             :         ~LinenumberTable();
     102             : 
     103             :         int32_t find(methodinfo **pm, void* pc);
     104             : };
     105             : 
     106             : void linenumbertable_list_entry_add(codegendata *cd, int32_t linenumber);
     107             : void linenumbertable_list_entry_add_inline_start(codegendata *cd, instruction *iptr);
     108             : void linenumbertable_list_entry_add_inline_end(codegendata *cd, instruction *iptr);
     109             : 
     110             : #endif // _LINENUMBERTABLE_HPP
     111             : 
     112             : 
     113             : /*
     114             :  * These are local overrides for various environment variables in Emacs.
     115             :  * Please do not remove this and leave it at the end of the file, where
     116             :  * Emacs will automagically detect them.
     117             :  * ---------------------------------------------------------------------
     118             :  * Local variables:
     119             :  * mode: c++
     120             :  * indent-tabs-mode: t
     121             :  * c-basic-offset: 4
     122             :  * tab-width: 4
     123             :  * End:
     124             :  * vim:noexpandtab:sw=4:ts=4:
     125             :  */

Generated by: LCOV version 1.11