src/share/vm/c1/c1_Runtime1.hpp

changeset 0
f90c822e73f8
child 6876
710a3c8b516e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/share/vm/c1/c1_Runtime1.hpp	Wed Apr 27 01:25:04 2016 +0800
     1.3 @@ -0,0 +1,201 @@
     1.4 +/*
     1.5 + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
     1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 + *
     1.8 + * This code is free software; you can redistribute it and/or modify it
     1.9 + * under the terms of the GNU General Public License version 2 only, as
    1.10 + * published by the Free Software Foundation.
    1.11 + *
    1.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
    1.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.15 + * version 2 for more details (a copy is included in the LICENSE file that
    1.16 + * accompanied this code).
    1.17 + *
    1.18 + * You should have received a copy of the GNU General Public License version
    1.19 + * 2 along with this work; if not, write to the Free Software Foundation,
    1.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.21 + *
    1.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.23 + * or visit www.oracle.com if you need additional information or have any
    1.24 + * questions.
    1.25 + *
    1.26 + */
    1.27 +
    1.28 +#ifndef SHARE_VM_C1_C1_RUNTIME1_HPP
    1.29 +#define SHARE_VM_C1_C1_RUNTIME1_HPP
    1.30 +
    1.31 +#include "c1/c1_FrameMap.hpp"
    1.32 +#include "code/stubs.hpp"
    1.33 +#include "interpreter/interpreter.hpp"
    1.34 +#include "memory/allocation.hpp"
    1.35 +#include "runtime/deoptimization.hpp"
    1.36 +
    1.37 +class StubAssembler;
    1.38 +
    1.39 +// The Runtime1 holds all assembly stubs and VM
    1.40 +// runtime routines needed by code code generated
    1.41 +// by the Compiler1.
    1.42 +
    1.43 +#define RUNTIME1_STUBS(stub, last_entry) \
    1.44 +  stub(dtrace_object_alloc)          \
    1.45 +  stub(unwind_exception)             \
    1.46 +  stub(forward_exception)            \
    1.47 +  stub(throw_range_check_failed)       /* throws ArrayIndexOutOfBoundsException */ \
    1.48 +  stub(throw_index_exception)          /* throws IndexOutOfBoundsException */ \
    1.49 +  stub(throw_div0_exception)         \
    1.50 +  stub(throw_null_pointer_exception) \
    1.51 +  stub(register_finalizer)           \
    1.52 +  stub(new_instance)                 \
    1.53 +  stub(fast_new_instance)            \
    1.54 +  stub(fast_new_instance_init_check) \
    1.55 +  stub(new_type_array)               \
    1.56 +  stub(new_object_array)             \
    1.57 +  stub(new_multi_array)              \
    1.58 +  stub(handle_exception_nofpu)         /* optimized version that does not preserve fpu registers */ \
    1.59 +  stub(handle_exception)             \
    1.60 +  stub(handle_exception_from_callee) \
    1.61 +  stub(throw_array_store_exception)  \
    1.62 +  stub(throw_class_cast_exception)   \
    1.63 +  stub(throw_incompatible_class_change_error)   \
    1.64 +  stub(slow_subtype_check)           \
    1.65 +  stub(monitorenter)                 \
    1.66 +  stub(monitorenter_nofpu)             /* optimized version that does not preserve fpu registers */ \
    1.67 +  stub(monitorexit)                  \
    1.68 +  stub(monitorexit_nofpu)              /* optimized version that does not preserve fpu registers */ \
    1.69 +  stub(deoptimize)                   \
    1.70 +  stub(access_field_patching)        \
    1.71 +  stub(load_klass_patching)          \
    1.72 +  stub(load_mirror_patching)         \
    1.73 +  stub(load_appendix_patching)       \
    1.74 +  stub(g1_pre_barrier_slow)          \
    1.75 +  stub(g1_post_barrier_slow)         \
    1.76 +  stub(fpu2long_stub)                \
    1.77 +  stub(counter_overflow)             \
    1.78 +  stub(predicate_failed_trap)        \
    1.79 +  last_entry(number_of_ids)
    1.80 +
    1.81 +#define DECLARE_STUB_ID(x)       x ## _id ,
    1.82 +#define DECLARE_LAST_STUB_ID(x)  x
    1.83 +#define STUB_NAME(x)             #x " Runtime1 stub",
    1.84 +#define LAST_STUB_NAME(x)        #x " Runtime1 stub"
    1.85 +
    1.86 +class Runtime1: public AllStatic {
    1.87 +  friend class VMStructs;
    1.88 +  friend class ArrayCopyStub;
    1.89 +
    1.90 + public:
    1.91 +  enum StubID {
    1.92 +    RUNTIME1_STUBS(DECLARE_STUB_ID, DECLARE_LAST_STUB_ID)
    1.93 +  };
    1.94 +
    1.95 +  // statistics
    1.96 +#ifndef PRODUCT
    1.97 +  static int _resolve_invoke_cnt;
    1.98 +  static int _handle_wrong_method_cnt;
    1.99 +  static int _ic_miss_cnt;
   1.100 +  static int _generic_arraycopy_cnt;
   1.101 +  static int _primitive_arraycopy_cnt;
   1.102 +  static int _oop_arraycopy_cnt;
   1.103 +  static int _generic_arraycopystub_cnt;
   1.104 +  static int _arraycopy_slowcase_cnt;
   1.105 +  static int _arraycopy_checkcast_cnt;
   1.106 +  static int _arraycopy_checkcast_attempt_cnt;
   1.107 +  static int _new_type_array_slowcase_cnt;
   1.108 +  static int _new_object_array_slowcase_cnt;
   1.109 +  static int _new_instance_slowcase_cnt;
   1.110 +  static int _new_multi_array_slowcase_cnt;
   1.111 +  static int _monitorenter_slowcase_cnt;
   1.112 +  static int _monitorexit_slowcase_cnt;
   1.113 +  static int _patch_code_slowcase_cnt;
   1.114 +  static int _throw_range_check_exception_count;
   1.115 +  static int _throw_index_exception_count;
   1.116 +  static int _throw_div0_exception_count;
   1.117 +  static int _throw_null_pointer_exception_count;
   1.118 +  static int _throw_class_cast_exception_count;
   1.119 +  static int _throw_incompatible_class_change_error_count;
   1.120 +  static int _throw_array_store_exception_count;
   1.121 +  static int _throw_count;
   1.122 +#endif
   1.123 +
   1.124 + private:
   1.125 +  static CodeBlob* _blobs[number_of_ids];
   1.126 +  static const char* _blob_names[];
   1.127 +
   1.128 +  // stub generation
   1.129 +  static void       generate_blob_for(BufferBlob* blob, StubID id);
   1.130 +  static OopMapSet* generate_code_for(StubID id, StubAssembler* sasm);
   1.131 +  static OopMapSet* generate_exception_throw(StubAssembler* sasm, address target, bool has_argument);
   1.132 +  static OopMapSet* generate_handle_exception(StubID id, StubAssembler* sasm);
   1.133 +  static void       generate_unwind_exception(StubAssembler *sasm);
   1.134 +  static OopMapSet* generate_patching(StubAssembler* sasm, address target);
   1.135 +
   1.136 +  static OopMapSet* generate_stub_call(StubAssembler* sasm, Register result, address entry,
   1.137 +                                       Register arg1 = noreg, Register arg2 = noreg, Register arg3 = noreg);
   1.138 +
   1.139 +  // runtime entry points
   1.140 +  static void new_instance    (JavaThread* thread, Klass* klass);
   1.141 +  static void new_type_array  (JavaThread* thread, Klass* klass, jint length);
   1.142 +  static void new_object_array(JavaThread* thread, Klass* klass, jint length);
   1.143 +  static void new_multi_array (JavaThread* thread, Klass* klass, int rank, jint* dims);
   1.144 +
   1.145 +  static address counter_overflow(JavaThread* thread, int bci, Method* method);
   1.146 +
   1.147 +  static void unimplemented_entry   (JavaThread* thread, StubID id);
   1.148 +
   1.149 +  static address exception_handler_for_pc(JavaThread* thread);
   1.150 +
   1.151 +  static void throw_range_check_exception(JavaThread* thread, int index);
   1.152 +  static void throw_index_exception(JavaThread* thread, int index);
   1.153 +  static void throw_div0_exception(JavaThread* thread);
   1.154 +  static void throw_null_pointer_exception(JavaThread* thread);
   1.155 +  static void throw_class_cast_exception(JavaThread* thread, oopDesc* object);
   1.156 +  static void throw_incompatible_class_change_error(JavaThread* thread);
   1.157 +  static void throw_array_store_exception(JavaThread* thread, oopDesc* object);
   1.158 +
   1.159 +  static void monitorenter(JavaThread* thread, oopDesc* obj, BasicObjectLock* lock);
   1.160 +  static void monitorexit (JavaThread* thread, BasicObjectLock* lock);
   1.161 +
   1.162 +  static void deoptimize(JavaThread* thread);
   1.163 +
   1.164 +  static int access_field_patching(JavaThread* thread);
   1.165 +  static int move_klass_patching(JavaThread* thread);
   1.166 +  static int move_mirror_patching(JavaThread* thread);
   1.167 +  static int move_appendix_patching(JavaThread* thread);
   1.168 +
   1.169 +  static void patch_code(JavaThread* thread, StubID stub_id);
   1.170 +
   1.171 + public:
   1.172 +  // initialization
   1.173 +  static void initialize(BufferBlob* blob);
   1.174 +  static void initialize_pd();
   1.175 +
   1.176 +  // stubs
   1.177 +  static CodeBlob* blob_for (StubID id);
   1.178 +  static address   entry_for(StubID id)          { return blob_for(id)->code_begin(); }
   1.179 +  static const char* name_for (StubID id);
   1.180 +  static const char* name_for_address(address entry);
   1.181 +
   1.182 +  // platform might add runtime names.
   1.183 +  static const char* pd_name_for_address(address entry);
   1.184 +
   1.185 +  // method tracing
   1.186 +  static void trace_block_entry(jint block_id);
   1.187 +
   1.188 +#ifndef PRODUCT
   1.189 +  static address throw_count_address()               { return (address)&_throw_count;             }
   1.190 +  static address arraycopy_count_address(BasicType type);
   1.191 +#endif
   1.192 +
   1.193 +  // directly accessible leaf routine
   1.194 +  static int  arraycopy(oopDesc* src, int src_pos, oopDesc* dst, int dst_pos, int length);
   1.195 +  static void primitive_arraycopy(HeapWord* src, HeapWord* dst, int length);
   1.196 +  static void oop_arraycopy(HeapWord* src, HeapWord* dst, int length);
   1.197 +  static int  is_instance_of(oopDesc* mirror, oopDesc* obj);
   1.198 +
   1.199 +  static void predicate_failed_trap(JavaThread* thread);
   1.200 +
   1.201 +  static void print_statistics()                 PRODUCT_RETURN;
   1.202 +};
   1.203 +
   1.204 +#endif // SHARE_VM_C1_C1_RUNTIME1_HPP

mercurial