comparison src/share/vm/compiler/abstractCompiler.hpp @ 14225:16e101c8691f

8029305: add type tag to AbstractCompiler Reviewed-by: iveresov, kvn
author twisti
date Mon, 06 Jan 2014 17:23:07 -0800
parents de6a9e811145
children d8041d695d19
comparison
equal deleted inserted replaced
14224:a7e8ff4a1838 14225:16e101c8691f
1 /* 1 /*
2 * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 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 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
38 38
39 // This method returns true for the first compiler thread that reaches that methods. 39 // This method returns true for the first compiler thread that reaches that methods.
40 // This thread will initialize the compiler runtime. 40 // This thread will initialize the compiler runtime.
41 bool should_perform_init(); 41 bool should_perform_init();
42 42
43 // The (closed set) of concrete compiler classes.
44 enum Type {
45 none,
46 c1,
47 c2,
48 shark
49 };
50
51 private:
52 Type _type;
53
43 public: 54 public:
44 AbstractCompiler() : _compiler_state(uninitialized), _num_compiler_threads(0) {} 55 AbstractCompiler(Type type) : _type(type), _compiler_state(uninitialized), _num_compiler_threads(0) {}
45 56
46 // This function determines the compiler thread that will perform the 57 // This function determines the compiler thread that will perform the
47 // shutdown of the corresponding compiler runtime. 58 // shutdown of the corresponding compiler runtime.
48 bool should_perform_shutdown(); 59 bool should_perform_shutdown();
49 60
52 63
53 // Missing feature tests 64 // Missing feature tests
54 virtual bool supports_native() { return true; } 65 virtual bool supports_native() { return true; }
55 virtual bool supports_osr () { return true; } 66 virtual bool supports_osr () { return true; }
56 virtual bool can_compile_method(methodHandle method) { return true; } 67 virtual bool can_compile_method(methodHandle method) { return true; }
57 #if defined(TIERED) || ( !defined(COMPILER1) && !defined(COMPILER2) && !defined(SHARK)) 68
58 virtual bool is_c1 () { return false; } 69 // Compiler type queries.
59 virtual bool is_c2 () { return false; } 70 bool is_c1() { return _type == c1; }
60 virtual bool is_shark() { return false; } 71 bool is_c2() { return _type == c2; }
61 #else 72 bool is_shark() { return _type == shark; }
62 #ifdef COMPILER1
63 bool is_c1 () { return true; }
64 bool is_c2 () { return false; }
65 bool is_shark() { return false; }
66 #endif // COMPILER1
67 #ifdef COMPILER2
68 bool is_c1 () { return false; }
69 bool is_c2 () { return true; }
70 bool is_shark() { return false; }
71 #endif // COMPILER2
72 #ifdef SHARK
73 bool is_c1 () { return false; }
74 bool is_c2 () { return false; }
75 bool is_shark() { return true; }
76 #endif // SHARK
77 #endif // TIERED
78 73
79 // Customization 74 // Customization
80 virtual void initialize () = 0; 75 virtual void initialize () = 0;
81 76
82 void set_num_compiler_threads(int num) { _num_compiler_threads = num; } 77 void set_num_compiler_threads(int num) { _num_compiler_threads = num; }