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