8029305: add type tag to AbstractCompiler

Reviewed-by: iveresov, kvn
This commit is contained in:
Christian Thalinger 2014-01-06 17:23:07 -08:00
parent 618ee38356
commit 76a9fa693d
5 changed files with 27 additions and 35 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -40,8 +40,19 @@ class AbstractCompiler : public CHeapObj<mtCompiler> {
// This thread will initialize the compiler runtime.
bool should_perform_init();
// The (closed set) of concrete compiler classes.
enum Type {
none,
c1,
c2,
shark
};
private:
Type _type;
public:
AbstractCompiler() : _compiler_state(uninitialized), _num_compiler_threads(0) {}
AbstractCompiler(Type type) : _type(type), _compiler_state(uninitialized), _num_compiler_threads(0) {}
// This function determines the compiler thread that will perform the
// shutdown of the corresponding compiler runtime.
@ -54,27 +65,11 @@ class AbstractCompiler : public CHeapObj<mtCompiler> {
virtual bool supports_native() { return true; }
virtual bool supports_osr () { return true; }
virtual bool can_compile_method(methodHandle method) { return true; }
#if defined(TIERED) || ( !defined(COMPILER1) && !defined(COMPILER2) && !defined(SHARK))
virtual bool is_c1 () { return false; }
virtual bool is_c2 () { return false; }
virtual bool is_shark() { return false; }
#else
#ifdef COMPILER1
bool is_c1 () { return true; }
bool is_c2 () { return false; }
bool is_shark() { return false; }
#endif // COMPILER1
#ifdef COMPILER2
bool is_c1 () { return false; }
bool is_c2 () { return true; }
bool is_shark() { return false; }
#endif // COMPILER2
#ifdef SHARK
bool is_c1 () { return false; }
bool is_c2 () { return false; }
bool is_shark() { return true; }
#endif // SHARK
#endif // TIERED
// Compiler type queries.
bool is_c1() { return _type == c1; }
bool is_c2() { return _type == c2; }
bool is_shark() { return _type == shark; }
// Customization
virtual void initialize () = 0;