1 /*
2 * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_VM_OOPS_GENERATEOOPMAP_HPP
26 #define SHARE_VM_OOPS_GENERATEOOPMAP_HPP
27
28 #include "interpreter/bytecodeStream.hpp"
29 #include "memory/allocation.inline.hpp"
30 #include "memory/universe.inline.hpp"
31 #include "oops/method.hpp"
32 #include "oops/oopsHierarchy.hpp"
33 #include "runtime/signature.hpp"
34
35 // Forward definition
36 class GenerateOopMap;
37 class BasicBlock;
38 class CellTypeState;
39 class StackMap;
40
41 // These two should be removed. But requires som code to be cleaned up
42 #define MAXARGSIZE 256 // This should be enough
43 #define MAX_LOCAL_VARS 65536 // 16-bit entry
44
45 typedef void (*jmpFct_t)(GenerateOopMap *c, int bcpDelta, int* data);
46
47
48 // RetTable
49 //
50 // Contains maping between jsr targets and there return addresses. One-to-many mapping
51 //
52 class RetTableEntry : public ResourceObj {
53 private:
343 void print_states (outputStream *os, CellTypeState *vector, int num);
344 void print_current_state (outputStream *os,
345 BytecodeStream *itr,
346 bool detailed);
347 void report_monitor_mismatch (const char *msg);
348
349 // Basicblock info
350 BasicBlock * _basic_blocks; // Array of basicblock info
351 int _gc_points;
352 int _bb_count;
353 ResourceBitMap _bb_hdr_bits;
354
355 // Basicblocks methods
356 void initialize_bb ();
357 void mark_bbheaders_and_count_gc_points();
358 bool is_bb_header (int bci) const {
359 return _bb_hdr_bits.at(bci);
360 }
361 int gc_points () const { return _gc_points; }
362 int bb_count () const { return _bb_count; }
363 void set_bbmark_bit (int bci) {
364 _bb_hdr_bits.at_put(bci, true);
365 }
366 void clear_bbmark_bit (int bci) {
367 _bb_hdr_bits.at_put(bci, false);
368 }
369 BasicBlock * get_basic_block_at (int bci) const;
370 BasicBlock * get_basic_block_containing (int bci) const;
371 void interp_bb (BasicBlock *bb);
372 void restore_state (BasicBlock *bb);
373 int next_bb_start_pc (BasicBlock *bb);
374 void update_basic_blocks (int bci, int delta, int new_method_size);
375 static void bb_mark_fct (GenerateOopMap *c, int deltaBci, int *data);
376
377 // Dead code detection
378 void mark_reachable_code();
379 static void reachable_basicblock (GenerateOopMap *c, int deltaBci, int *data);
380
381 // Interpretation methods (primary)
382 void do_interpretation ();
383 void init_basic_blocks ();
384 void setup_method_entry_state ();
385 void interp_all ();
386
387 // Interpretation methods (secondary)
388 void interp1 (BytecodeStream *itr);
|
1 /*
2 * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_VM_OOPS_GENERATEOOPMAP_HPP
26 #define SHARE_VM_OOPS_GENERATEOOPMAP_HPP
27
28 #include "interpreter/bytecodeStream.hpp"
29 #include "memory/allocation.inline.hpp"
30 #include "memory/universe.inline.hpp"
31 #include "oops/method.hpp"
32 #include "oops/oopsHierarchy.hpp"
33 #include "runtime/signature.hpp"
34 #include "utilities/bitMap.hpp"
35
36 // Forward definition
37 class GenerateOopMap;
38 class BasicBlock;
39 class CellTypeState;
40 class StackMap;
41
42 // These two should be removed. But requires som code to be cleaned up
43 #define MAXARGSIZE 256 // This should be enough
44 #define MAX_LOCAL_VARS 65536 // 16-bit entry
45
46 typedef void (*jmpFct_t)(GenerateOopMap *c, int bcpDelta, int* data);
47
48
49 // RetTable
50 //
51 // Contains maping between jsr targets and there return addresses. One-to-many mapping
52 //
53 class RetTableEntry : public ResourceObj {
54 private:
344 void print_states (outputStream *os, CellTypeState *vector, int num);
345 void print_current_state (outputStream *os,
346 BytecodeStream *itr,
347 bool detailed);
348 void report_monitor_mismatch (const char *msg);
349
350 // Basicblock info
351 BasicBlock * _basic_blocks; // Array of basicblock info
352 int _gc_points;
353 int _bb_count;
354 ResourceBitMap _bb_hdr_bits;
355
356 // Basicblocks methods
357 void initialize_bb ();
358 void mark_bbheaders_and_count_gc_points();
359 bool is_bb_header (int bci) const {
360 return _bb_hdr_bits.at(bci);
361 }
362 int gc_points () const { return _gc_points; }
363 int bb_count () const { return _bb_count; }
364 void set_bbmark_bit (int bci);
365 BasicBlock * get_basic_block_at (int bci) const;
366 BasicBlock * get_basic_block_containing (int bci) const;
367 void interp_bb (BasicBlock *bb);
368 void restore_state (BasicBlock *bb);
369 int next_bb_start_pc (BasicBlock *bb);
370 void update_basic_blocks (int bci, int delta, int new_method_size);
371 static void bb_mark_fct (GenerateOopMap *c, int deltaBci, int *data);
372
373 // Dead code detection
374 void mark_reachable_code();
375 static void reachable_basicblock (GenerateOopMap *c, int deltaBci, int *data);
376
377 // Interpretation methods (primary)
378 void do_interpretation ();
379 void init_basic_blocks ();
380 void setup_method_entry_state ();
381 void interp_all ();
382
383 // Interpretation methods (secondary)
384 void interp1 (BytecodeStream *itr);
|