49 enum class C1StubId :int {
50 NO_STUBID = -1,
51 C1_STUBS_DO(C1_STUB_ID_ENUM_DECLARE)
52 NUM_STUBIDS
53 };
54 #undef C1_STUB_ID_ENUM_DECLARE
55
56 class Runtime1: public AllStatic {
57 friend class VMStructs;
58 friend class ArrayCopyStub;
59
60 public:
61 // statistics
62 #ifndef PRODUCT
63 static uint _generic_arraycopystub_cnt;
64 static uint _arraycopy_slowcase_cnt;
65 static uint _arraycopy_checkcast_cnt;
66 static uint _arraycopy_checkcast_attempt_cnt;
67 static uint _new_type_array_slowcase_cnt;
68 static uint _new_object_array_slowcase_cnt;
69 static uint _new_instance_slowcase_cnt;
70 static uint _new_multi_array_slowcase_cnt;
71 static uint _monitorenter_slowcase_cnt;
72 static uint _monitorexit_slowcase_cnt;
73 static uint _patch_code_slowcase_cnt;
74 static uint _throw_range_check_exception_count;
75 static uint _throw_index_exception_count;
76 static uint _throw_div0_exception_count;
77 static uint _throw_null_pointer_exception_count;
78 static uint _throw_class_cast_exception_count;
79 static uint _throw_incompatible_class_change_error_count;
80 static uint _throw_count;
81 #endif
82
83 private:
84 static CodeBlob* _blobs[(int)C1StubId::NUM_STUBIDS];
85 static const char* _blob_names[];
86
87 // stub generation
88 public:
89 static CodeBlob* generate_blob(BufferBlob* buffer_blob, C1StubId id, const char* name, bool expect_oop_map, StubAssemblerCodeGenClosure *cl);
90 static void generate_blob_for(BufferBlob* blob, C1StubId id);
91 static OopMapSet* generate_code_for(C1StubId id, StubAssembler* sasm);
92 private:
93 static OopMapSet* generate_exception_throw(StubAssembler* sasm, address target, bool has_argument);
94 static OopMapSet* generate_handle_exception(C1StubId id, StubAssembler* sasm);
95 static void generate_unwind_exception(StubAssembler *sasm);
96 static OopMapSet* generate_patching(StubAssembler* sasm, address target);
97
98 static OopMapSet* generate_stub_call(StubAssembler* sasm, Register result, address entry,
99 Register arg1 = noreg, Register arg2 = noreg, Register arg3 = noreg);
100
101 // runtime entry points
102 static void new_instance (JavaThread* current, Klass* klass);
103 static void new_type_array (JavaThread* current, Klass* klass, jint length);
104 static void new_object_array(JavaThread* current, Klass* klass, jint length);
105 static void new_multi_array (JavaThread* current, Klass* klass, int rank, jint* dims);
106
107 static address counter_overflow(JavaThread* current, int bci, Method* method);
108
109 static void unimplemented_entry(JavaThread* current, C1StubId id);
110
111 static address exception_handler_for_pc(JavaThread* current);
112
113 static void throw_range_check_exception(JavaThread* current, int index, arrayOopDesc* a);
114 static void throw_index_exception(JavaThread* current, int index);
115 static void throw_div0_exception(JavaThread* current);
116 static void throw_null_pointer_exception(JavaThread* current);
117 static void throw_class_cast_exception(JavaThread* current, oopDesc* object);
118 static void throw_incompatible_class_change_error(JavaThread* current);
119 static void throw_array_store_exception(JavaThread* current, oopDesc* object);
120
121 static void monitorenter(JavaThread* current, oopDesc* obj, BasicObjectLock* lock);
122 static void monitorexit (JavaThread* current, BasicObjectLock* lock);
123
124 static void deoptimize(JavaThread* current, jint trap_request);
125
126 static int access_field_patching(JavaThread* current);
127 static int move_klass_patching(JavaThread* current);
128 static int move_mirror_patching(JavaThread* current);
129 static int move_appendix_patching(JavaThread* current);
130
131 static void patch_code(JavaThread* current, C1StubId stub_id);
132
133 public:
134 // initialization
135 static void initialize(BufferBlob* blob);
136 static void initialize_pd();
137
138 // stubs
|
49 enum class C1StubId :int {
50 NO_STUBID = -1,
51 C1_STUBS_DO(C1_STUB_ID_ENUM_DECLARE)
52 NUM_STUBIDS
53 };
54 #undef C1_STUB_ID_ENUM_DECLARE
55
56 class Runtime1: public AllStatic {
57 friend class VMStructs;
58 friend class ArrayCopyStub;
59
60 public:
61 // statistics
62 #ifndef PRODUCT
63 static uint _generic_arraycopystub_cnt;
64 static uint _arraycopy_slowcase_cnt;
65 static uint _arraycopy_checkcast_cnt;
66 static uint _arraycopy_checkcast_attempt_cnt;
67 static uint _new_type_array_slowcase_cnt;
68 static uint _new_object_array_slowcase_cnt;
69 static uint _new_null_free_array_slowcase_cnt;
70 static uint _new_instance_slowcase_cnt;
71 static uint _new_multi_array_slowcase_cnt;
72 static uint _load_flat_array_slowcase_cnt;
73 static uint _store_flat_array_slowcase_cnt;
74 static uint _substitutability_check_slowcase_cnt;
75 static uint _buffer_inline_args_slowcase_cnt;
76 static uint _buffer_inline_args_no_receiver_slowcase_cnt;
77 static uint _monitorenter_slowcase_cnt;
78 static uint _monitorexit_slowcase_cnt;
79 static uint _patch_code_slowcase_cnt;
80 static uint _throw_range_check_exception_count;
81 static uint _throw_index_exception_count;
82 static uint _throw_div0_exception_count;
83 static uint _throw_null_pointer_exception_count;
84 static uint _throw_class_cast_exception_count;
85 static uint _throw_incompatible_class_change_error_count;
86 static uint _throw_illegal_monitor_state_exception_count;
87 static uint _throw_identity_exception_count;
88 static uint _throw_count;
89 #endif
90
91 private:
92 static CodeBlob* _blobs[(int)C1StubId::NUM_STUBIDS];
93 static const char* _blob_names[];
94 static void buffer_inline_args_impl(JavaThread* current, Method* m, bool allocate_receiver);
95
96 // stub generation
97 public:
98 static CodeBlob* generate_blob(BufferBlob* buffer_blob, C1StubId id, const char* name, bool expect_oop_map, StubAssemblerCodeGenClosure *cl);
99 static void generate_blob_for(BufferBlob* blob, C1StubId id);
100 static OopMapSet* generate_code_for(C1StubId id, StubAssembler* sasm);
101 private:
102 static OopMapSet* generate_exception_throw(StubAssembler* sasm, address target, bool has_argument);
103 static OopMapSet* generate_handle_exception(C1StubId id, StubAssembler* sasm);
104 static void generate_unwind_exception(StubAssembler *sasm);
105 static OopMapSet* generate_patching(StubAssembler* sasm, address target);
106
107 static OopMapSet* generate_stub_call(StubAssembler* sasm, Register result, address entry,
108 Register arg1 = noreg, Register arg2 = noreg, Register arg3 = noreg);
109
110 // runtime entry points
111 static void new_instance (JavaThread* current, Klass* klass);
112 static void new_instance_no_inline(JavaThread* current, Klass* klass);
113 static void new_type_array (JavaThread* current, Klass* klass, jint length);
114 static void new_object_array(JavaThread* current, Klass* klass, jint length);
115 static void new_null_free_array(JavaThread* current, Klass* klass, jint length);
116 static void new_multi_array (JavaThread* current, Klass* klass, int rank, jint* dims);
117 static void load_flat_array(JavaThread* current, flatArrayOopDesc* array, int index);
118 static void store_flat_array(JavaThread* current, flatArrayOopDesc* array, int index, oopDesc* value);
119 static int substitutability_check(JavaThread* current, oopDesc* left, oopDesc* right);
120 static void buffer_inline_args(JavaThread* current, Method* method);
121 static void buffer_inline_args_no_receiver(JavaThread* current, Method* method);
122
123 static address counter_overflow(JavaThread* current, int bci, Method* method);
124
125 static void unimplemented_entry(JavaThread* current, C1StubId id);
126
127 static address exception_handler_for_pc(JavaThread* current);
128
129 static void throw_range_check_exception(JavaThread* current, int index, arrayOopDesc* a);
130 static void throw_index_exception(JavaThread* current, int index);
131 static void throw_div0_exception(JavaThread* current);
132 static void throw_null_pointer_exception(JavaThread* current);
133 static void throw_class_cast_exception(JavaThread* current, oopDesc* object);
134 static void throw_incompatible_class_change_error(JavaThread* current);
135 static void throw_illegal_monitor_state_exception(JavaThread* current);
136 static void throw_identity_exception(JavaThread* current, oopDesc* object);
137 static void throw_array_store_exception(JavaThread* current, oopDesc* object);
138
139 static void monitorenter(JavaThread* current, oopDesc* obj, BasicObjectLock* lock);
140 static void monitorexit (JavaThread* current, BasicObjectLock* lock);
141
142 static void deoptimize(JavaThread* current, jint trap_request);
143
144 static int access_field_patching(JavaThread* current);
145 static int move_klass_patching(JavaThread* current);
146 static int move_mirror_patching(JavaThread* current);
147 static int move_appendix_patching(JavaThread* current);
148
149 static void patch_code(JavaThread* current, C1StubId stub_id);
150
151 public:
152 // initialization
153 static void initialize(BufferBlob* blob);
154 static void initialize_pd();
155
156 // stubs
|