1122 address SignatureHandlerLibrary::set_handler_blob() { |
1122 address SignatureHandlerLibrary::set_handler_blob() { |
1123 BufferBlob* handler_blob = BufferBlob::create("native signature handlers", blob_size); |
1123 BufferBlob* handler_blob = BufferBlob::create("native signature handlers", blob_size); |
1124 if (handler_blob == NULL) { |
1124 if (handler_blob == NULL) { |
1125 return NULL; |
1125 return NULL; |
1126 } |
1126 } |
1127 address handler = handler_blob->instructions_begin(); |
1127 address handler = handler_blob->code_begin(); |
1128 _handler_blob = handler_blob; |
1128 _handler_blob = handler_blob; |
1129 _handler = handler; |
1129 _handler = handler; |
1130 return handler; |
1130 return handler; |
1131 } |
1131 } |
1132 |
1132 |
1138 vm_exit_out_of_memory(blob_size, "native signature handlers"); |
1138 vm_exit_out_of_memory(blob_size, "native signature handlers"); |
1139 } |
1139 } |
1140 |
1140 |
1141 BufferBlob* bb = BufferBlob::create("Signature Handler Temp Buffer", |
1141 BufferBlob* bb = BufferBlob::create("Signature Handler Temp Buffer", |
1142 SignatureHandlerLibrary::buffer_size); |
1142 SignatureHandlerLibrary::buffer_size); |
1143 _buffer = bb->instructions_begin(); |
1143 _buffer = bb->code_begin(); |
1144 |
1144 |
1145 _fingerprints = new(ResourceObj::C_HEAP)GrowableArray<uint64_t>(32, true); |
1145 _fingerprints = new(ResourceObj::C_HEAP)GrowableArray<uint64_t>(32, true); |
1146 _handlers = new(ResourceObj::C_HEAP)GrowableArray<address>(32, true); |
1146 _handlers = new(ResourceObj::C_HEAP)GrowableArray<address>(32, true); |
1147 } |
1147 } |
1148 |
1148 |
1149 address SignatureHandlerLibrary::set_handler(CodeBuffer* buffer) { |
1149 address SignatureHandlerLibrary::set_handler(CodeBuffer* buffer) { |
1150 address handler = _handler; |
1150 address handler = _handler; |
1151 int code_size = buffer->pure_code_size(); |
1151 int insts_size = buffer->pure_insts_size(); |
1152 if (handler + code_size > _handler_blob->instructions_end()) { |
1152 if (handler + insts_size > _handler_blob->code_end()) { |
1153 // get a new handler blob |
1153 // get a new handler blob |
1154 handler = set_handler_blob(); |
1154 handler = set_handler_blob(); |
1155 } |
1155 } |
1156 if (handler != NULL) { |
1156 if (handler != NULL) { |
1157 memcpy(handler, buffer->code_begin(), code_size); |
1157 memcpy(handler, buffer->insts_begin(), insts_size); |
1158 pd_set_handler(handler); |
1158 pd_set_handler(handler); |
1159 ICache::invalidate_range(handler, code_size); |
1159 ICache::invalidate_range(handler, insts_size); |
1160 _handler = handler + code_size; |
1160 _handler = handler + insts_size; |
1161 } |
1161 } |
1162 return handler; |
1162 return handler; |
1163 } |
1163 } |
1164 |
1164 |
1165 void SignatureHandlerLibrary::add(methodHandle method) { |
1165 void SignatureHandlerLibrary::add(methodHandle method) { |
1194 tty->print_cr("argument handler #%d for: %s %s (fingerprint = " UINT64_FORMAT ", %d bytes generated)", |
1194 tty->print_cr("argument handler #%d for: %s %s (fingerprint = " UINT64_FORMAT ", %d bytes generated)", |
1195 _handlers->length(), |
1195 _handlers->length(), |
1196 (method->is_static() ? "static" : "receiver"), |
1196 (method->is_static() ? "static" : "receiver"), |
1197 method->name_and_sig_as_C_string(), |
1197 method->name_and_sig_as_C_string(), |
1198 fingerprint, |
1198 fingerprint, |
1199 buffer.code_size()); |
1199 buffer.insts_size()); |
1200 Disassembler::decode(handler, handler + buffer.code_size()); |
1200 Disassembler::decode(handler, handler + buffer.insts_size()); |
1201 #ifndef PRODUCT |
1201 #ifndef PRODUCT |
1202 tty->print_cr(" --- associated result handler ---"); |
1202 tty->print_cr(" --- associated result handler ---"); |
1203 address rh_begin = Interpreter::result_handler(method()->result_type()); |
1203 address rh_begin = Interpreter::result_handler(method()->result_type()); |
1204 address rh_end = rh_begin; |
1204 address rh_end = rh_begin; |
1205 while (*(int*)rh_end != 0) { |
1205 while (*(int*)rh_end != 0) { |