hotspot/src/share/vm/interpreter/interpreterRuntime.hpp
changeset 13728 882756847a04
parent 13391 30245956af37
child 14583 d70ee55535f4
equal deleted inserted replaced
13727:caf5eb7dd4a7 13728:882756847a04
     1 /*
     1 /*
     2  * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1997, 2012, 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.
    26 #define SHARE_VM_INTERPRETER_INTERPRETERRUNTIME_HPP
    26 #define SHARE_VM_INTERPRETER_INTERPRETERRUNTIME_HPP
    27 
    27 
    28 #include "interpreter/bytecode.hpp"
    28 #include "interpreter/bytecode.hpp"
    29 #include "interpreter/linkResolver.hpp"
    29 #include "interpreter/linkResolver.hpp"
    30 #include "memory/universe.hpp"
    30 #include "memory/universe.hpp"
    31 #include "oops/methodOop.hpp"
    31 #include "oops/method.hpp"
    32 #include "runtime/frame.inline.hpp"
    32 #include "runtime/frame.inline.hpp"
    33 #include "runtime/signature.hpp"
    33 #include "runtime/signature.hpp"
    34 #include "utilities/top.hpp"
    34 #include "utilities/top.hpp"
    35 #ifdef TARGET_OS_FAMILY_linux
    35 #ifdef TARGET_OS_FAMILY_linux
    36 # include "thread_linux.inline.hpp"
    36 # include "thread_linux.inline.hpp"
    53   friend class PrintingClosure; // for method and bcp
    53   friend class PrintingClosure; // for method and bcp
    54 
    54 
    55  private:
    55  private:
    56   // Helper functions to access current interpreter state
    56   // Helper functions to access current interpreter state
    57   static frame     last_frame(JavaThread *thread)    { return thread->last_frame(); }
    57   static frame     last_frame(JavaThread *thread)    { return thread->last_frame(); }
    58   static methodOop method(JavaThread *thread)        { return last_frame(thread).interpreter_frame_method(); }
    58   static Method*   method(JavaThread *thread)        { return last_frame(thread).interpreter_frame_method(); }
    59   static address   bcp(JavaThread *thread)           { return last_frame(thread).interpreter_frame_bcp(); }
    59   static address   bcp(JavaThread *thread)           { return last_frame(thread).interpreter_frame_bcp(); }
    60   static int       bci(JavaThread *thread)           { return last_frame(thread).interpreter_frame_bci(); }
    60   static int       bci(JavaThread *thread)           { return last_frame(thread).interpreter_frame_bci(); }
    61   static void      set_bcp_and_mdp(address bcp, JavaThread*thread);
    61   static void      set_bcp_and_mdp(address bcp, JavaThread*thread);
    62   static Bytecodes::Code code(JavaThread *thread)    {
    62   static Bytecodes::Code code(JavaThread *thread)    {
    63     // pass method to avoid calling unsafe bcp_to_method (partial fix 4926272)
    63     // pass method to avoid calling unsafe bcp_to_method (partial fix 4926272)
    86   // Constants
    86   // Constants
    87   static void    ldc           (JavaThread* thread, bool wide);
    87   static void    ldc           (JavaThread* thread, bool wide);
    88   static void    resolve_ldc   (JavaThread* thread, Bytecodes::Code bytecode);
    88   static void    resolve_ldc   (JavaThread* thread, Bytecodes::Code bytecode);
    89 
    89 
    90   // Allocation
    90   // Allocation
    91   static void    _new          (JavaThread* thread, constantPoolOopDesc* pool, int index);
    91   static void    _new          (JavaThread* thread, ConstantPool* pool, int index);
    92   static void    newarray      (JavaThread* thread, BasicType type, jint size);
    92   static void    newarray      (JavaThread* thread, BasicType type, jint size);
    93   static void    anewarray     (JavaThread* thread, constantPoolOopDesc* pool, int index, jint size);
    93   static void    anewarray     (JavaThread* thread, ConstantPool* pool, int index, jint size);
    94   static void    multianewarray(JavaThread* thread, jint* first_size_address);
    94   static void    multianewarray(JavaThread* thread, jint* first_size_address);
    95   static void    register_finalizer(JavaThread* thread, oopDesc* obj);
    95   static void    register_finalizer(JavaThread* thread, oopDesc* obj);
    96 
    96 
    97   // Quicken instance-of and check-cast bytecodes
    97   // Quicken instance-of and check-cast bytecodes
    98   static void    quicken_io_cc(JavaThread* thread);
    98   static void    quicken_io_cc(JavaThread* thread);
   122   static void    resolve_invoke       (JavaThread* thread, Bytecodes::Code bytecode);
   122   static void    resolve_invoke       (JavaThread* thread, Bytecodes::Code bytecode);
   123   static void    resolve_invokehandle (JavaThread* thread);
   123   static void    resolve_invokehandle (JavaThread* thread);
   124   static void    resolve_invokedynamic(JavaThread* thread);
   124   static void    resolve_invokedynamic(JavaThread* thread);
   125 
   125 
   126   // Breakpoints
   126   // Breakpoints
   127   static void _breakpoint(JavaThread* thread, methodOopDesc* method, address bcp);
   127   static void _breakpoint(JavaThread* thread, Method* method, address bcp);
   128   static Bytecodes::Code get_original_bytecode_at(JavaThread* thread, methodOopDesc* method, address bcp);
   128   static Bytecodes::Code get_original_bytecode_at(JavaThread* thread, Method* method, address bcp);
   129   static void            set_original_bytecode_at(JavaThread* thread, methodOopDesc* method, address bcp, Bytecodes::Code new_code);
   129   static void            set_original_bytecode_at(JavaThread* thread, Method* method, address bcp, Bytecodes::Code new_code);
   130   static bool is_breakpoint(JavaThread *thread) { return Bytecodes::code_or_bp_at(bcp(thread)) == Bytecodes::_breakpoint; }
   130   static bool is_breakpoint(JavaThread *thread) { return Bytecodes::code_or_bp_at(bcp(thread)) == Bytecodes::_breakpoint; }
   131 
   131 
   132   // Safepoints
   132   // Safepoints
   133   static void    at_safepoint(JavaThread* thread);
   133   static void    at_safepoint(JavaThread* thread);
   134 
   134 
   140   static void post_method_entry(JavaThread *thread);
   140   static void post_method_entry(JavaThread *thread);
   141   static void post_method_exit (JavaThread *thread);
   141   static void post_method_exit (JavaThread *thread);
   142   static int  interpreter_contains(address pc);
   142   static int  interpreter_contains(address pc);
   143 
   143 
   144   // Native signature handlers
   144   // Native signature handlers
   145   static void prepare_native_call(JavaThread* thread, methodOopDesc* method);
   145   static void prepare_native_call(JavaThread* thread, Method* method);
   146   static address slow_signature_handler(JavaThread* thread,
   146   static address slow_signature_handler(JavaThread* thread,
   147                                         methodOopDesc* method,
   147                                         Method* method,
   148                                         intptr_t* from, intptr_t* to);
   148                                         intptr_t* from, intptr_t* to);
   149 
   149 
   150 #if defined(IA32) || defined(AMD64) || defined(ARM)
   150 #if defined(IA32) || defined(AMD64) || defined(ARM)
   151   // Popframe support (only needed on x86, AMD64 and ARM)
   151   // Popframe support (only needed on x86, AMD64 and ARM)
   152   static void popframe_move_outgoing_args(JavaThread* thread, void* src_address, void* dest_address);
   152   static void popframe_move_outgoing_args(JavaThread* thread, void* src_address, void* dest_address);
   172 
   172 
   173   // Interpreter's frequency counter overflow
   173   // Interpreter's frequency counter overflow
   174   static nmethod* frequency_counter_overflow(JavaThread* thread, address branch_bcp);
   174   static nmethod* frequency_counter_overflow(JavaThread* thread, address branch_bcp);
   175 
   175 
   176   // Interpreter profiling support
   176   // Interpreter profiling support
   177   static jint    bcp_to_di(methodOopDesc* method, address cur_bcp);
   177   static jint    bcp_to_di(Method* method, address cur_bcp);
   178   static void    profile_method(JavaThread* thread);
   178   static void    profile_method(JavaThread* thread);
   179   static void    update_mdp_for_ret(JavaThread* thread, int bci);
   179   static void    update_mdp_for_ret(JavaThread* thread, int bci);
   180 #ifdef ASSERT
   180 #ifdef ASSERT
   181   static void    verify_mdp(methodOopDesc* method, address bcp, address mdp);
   181   static void    verify_mdp(Method* method, address bcp, address mdp);
   182 #endif // ASSERT
   182 #endif // ASSERT
   183 };
   183 };
   184 
   184 
   185 
   185 
   186 class SignatureHandlerLibrary: public AllStatic {
   186 class SignatureHandlerLibrary: public AllStatic {