/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#ifndef SHARE_VM_CI_CIMETHOD_HPP
#define SHARE_VM_CI_CIMETHOD_HPP
#include "ci/ciFlags.hpp"
#include "ci/ciInstanceKlass.hpp"
#include "ci/ciObject.hpp"
#include "ci/ciSignature.hpp"
#include "compiler/methodLiveness.hpp"
#include "prims/methodHandles.hpp"
#include "utilities/bitMap.hpp"
class ciMethodBlocks;
class MethodLiveness;
class BitMap;
class Arena;
class BCEscapeAnalyzer;
// ciMethod
//
// This class represents a methodOop in the HotSpot virtual
// machine.
friend class CompileBroker;
friend class ciEnv;
friend class ciExceptionHandlerStream;
friend class ciBytecodeStream;
friend class ciMethodHandle;
private:
// General method information.
// Code attributes.
int _code_size;
int _max_stack;
int _max_locals;
int _handler_count;
bool _uses_monitors;
bool _balanced_monitors;
bool _is_c1_compilable;
bool _is_c2_compilable;
bool _can_be_statically_bound;
// Lazy fields, filled in on demand
// Optional liveness analyzer.
#endif
return m;
}
void load_code();
}
public:
// Basic method information.
// Signature information.
// Can only be used on loaded ciMethods
int arg_size() const {
}
// Report the number of elements on stack when invoking this method.
// This is different than the regular arg_size because invokedynamic
// has an implicit receiver.
if (is_loaded()) {
return arg_size();
} else {
// Add a receiver argument, maybe:
arg_size++;
}
return arg_size;
}
}
// Method code and related information.
int interpreter_invocation_count() const { check_is_loaded(); return _interpreter_invocation_count; }
// Code size for inlining decisions.
int code_size_for_inlining();
int comp_level();
int highest_osr_comp_level();
}
bool has_linenumber_table() const; // length unknown until decompression
int line_number_from_bci(int bci) const;
// Runtime information.
int vtable_index();
#ifdef SHARK
int itable_index();
#endif // SHARK
// Analysis and profiling.
//
// Usage note: liveness_at_bci and init_vars should be wrapped in ResourceMarks.
bool uses_monitors() const { return _uses_monitors; } // this one should go away, it has a misleading name
bool has_balanced_monitors();
// Returns a bitmap indicating which locals are required to be
// maintained as live for deopt. raw_liveness_at_bci is always the
// direct output of the liveness computation while liveness_at_bci
// may mark all locals as live to improve support for debugging Java
// code by maintaining the state of as many locals as possible.
// Get the interpreters viewpoint on oop liveness. MethodLiveness is
// conservative in the sense that it may consider locals to be live which
// cannot be live, like in the case where a local could contain an oop or
// a primitive along different paths. In that case the local must be
// dead when those paths merge. Since the interpreter's viewpoint is
// used when gc'ing an interpreter frame we need to use its viewpoint
// during OSR when loading the locals.
#ifdef COMPILER1
const BitMap bci_block_start();
#endif
int interpreter_call_site_count(int bci);
// Given a certain calling environment, find the monomorphic target
// for the call. Return NULL if the call is not monomorphic in
// its calling environment.
// Given a known receiver klass, find the target for the call.
// Return NULL if the call has no target or is abstract.
// Find the proper vtable index to invoke this method.
// Compilation directives
bool should_exclude();
bool should_inline();
bool should_not_inline();
bool should_print_assembly();
bool break_at_execute();
bool has_option(const char *option);
bool can_be_compiled();
bool can_be_osr_compiled(int entry_bci);
bool has_compiled_code();
bool is_not_reached(int bci);
bool was_executed_more_than(int times);
bool ensure_method_data(); // make sure it exists in the VM also
// JSR 292 support
bool is_method_handle_intrinsic() const;
bool is_compiled_lambda_form() const;
bool has_member_arg() const;
// What kind of ciObject is this?
bool is_method() { return true; }
// Java access flags
// Other flags
bool is_empty_method() const;
bool is_vanilla_constructor() const;
bool has_loops () const;
bool has_jsrs () const;
bool is_accessor () const;
bool is_initializer () const;
// Print the bytecodes of this method.
void print_codes() {
}
// Print the name of this method in various incarnations.
};
#endif // SHARE_VM_CI_CIMETHOD_HPP