1 /*
  2  * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved.
  3  * Copyright 2007, 2008, 2009, 2010, 2011 Red Hat, Inc.
  4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  5  *
  6  * This code is free software; you can redistribute it and/or modify it
  7  * under the terms of the GNU General Public License version 2 only, as
  8  * published by the Free Software Foundation.
  9  *
 10  * This code is distributed in the hope that it will be useful, but WITHOUT
 11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 13  * version 2 for more details (a copy is included in the LICENSE file that
 14  * accompanied this code).
 15  *
 16  * You should have received a copy of the GNU General Public License version
 17  * 2 along with this work; if not, write to the Free Software Foundation,
 18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 19  *
 20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 21  * or visit www.oracle.com if you need additional information or have any
 22  * questions.
 23  *
 24  */
 25 
 26 #include "precompiled.hpp"
 27 #include "asm/assembler.inline.hpp"
 28 #include "code/debugInfoRec.hpp"
 29 #include "code/vtableStubs.hpp"
 30 #include "interpreter/interpreter.hpp"
 31 #include "runtime/interfaceSupport.inline.hpp"
 32 #include "runtime/sharedRuntime.hpp"
 33 #include "runtime/vframeArray.hpp"
 34 #include "vmreg_zero.inline.hpp"
 35 #ifdef COMPILER1
 36 #include "c1/c1_Runtime1.hpp"
 37 #endif
 38 #ifdef COMPILER2
 39 #include "opto/runtime.hpp"
 40 #endif
 41 
 42 
 43 static address zero_null_code_stub() {
 44   address start = ShouldNotCallThisStub();
 45   return start;
 46 }
 47 
 48 int SharedRuntime::java_calling_convention(const BasicType *sig_bt,
 49                                            VMRegPair *regs,
 50                                            int total_args_passed) {
 51   return 0;
 52 }
 53 
 54 int SharedRuntime::java_return_convention(const BasicType *sig_bt,
 55                                            VMRegPair *regs,
 56                                            int total_args_passed) {
 57   Unimplemented();
 58   return 0;
 59 }
 60 
 61 BufferedInlineTypeBlob* SharedRuntime::generate_buffered_inline_type_adapter(const InlineKlass* vk) {
 62   Unimplemented();
 63   return NULL;
 64 }
 65 
 66 AdapterHandlerEntry* SharedRuntime::generate_i2c2i_adapters(MacroAssembler* masm,
 67                                                             int comp_args_on_stack,
 68                                                             const GrowableArray <SigEntry>* sig,
 69                                                             const VMRegPair* regs,
 70                                                             const GrowableArray <SigEntry>* sig_cc,
 71                                                             const VMRegPair* regs_cc,
 72                                                             const GrowableArray <SigEntry>* sig_cc_ro,
 73                                                             const VMRegPair* regs_cc_ro,
 74                                                             AdapterFingerPrint* fingerprint,
 75                                                             AdapterBlob*& new_adapter,
 76                                                             bool allocate_code_blob) {
 77   if (allocate_code_blob) {
 78     new_adapter = AdapterBlob::create(masm->code(), 0, 0, NULL);
 79   }
 80   return AdapterHandlerLibrary::new_entry(
 81     fingerprint,
 82     CAST_FROM_FN_PTR(address,zero_null_code_stub),
 83     CAST_FROM_FN_PTR(address,zero_null_code_stub),
 84     CAST_FROM_FN_PTR(address,zero_null_code_stub),
 85     CAST_FROM_FN_PTR(address,zero_null_code_stub),
 86     CAST_FROM_FN_PTR(address,zero_null_code_stub),
 87     CAST_FROM_FN_PTR(address,zero_null_code_stub),
 88     CAST_FROM_FN_PTR(address,zero_null_code_stub));
 89 }
 90 
 91 nmethod *SharedRuntime::generate_native_wrapper(MacroAssembler *masm,
 92                                                 const methodHandle& method,
 93                                                 int compile_id,
 94                                                 BasicType *sig_bt,
 95                                                 VMRegPair *regs,
 96                                                 BasicType ret_type) {
 97   ShouldNotCallThis();
 98   return nullptr;
 99 }
100 
101 int Deoptimization::last_frame_adjust(int callee_parameters,
102                                       int callee_locals) {
103   return 0;
104 }
105 
106 uint SharedRuntime::out_preserve_stack_slots() {
107   ShouldNotCallThis();
108   return 0;
109 }
110 
111 JRT_LEAF(void, zero_stub())
112   ShouldNotCallThis();
113 JRT_END
114 
115 static RuntimeStub* generate_empty_runtime_stub() {
116   return CAST_FROM_FN_PTR(RuntimeStub*,zero_stub);
117 }
118 
119 static SafepointBlob* generate_empty_safepoint_blob() {
120   return CAST_FROM_FN_PTR(SafepointBlob*,zero_stub);
121 }
122 
123 static DeoptimizationBlob* generate_empty_deopt_blob() {
124   return CAST_FROM_FN_PTR(DeoptimizationBlob*,zero_stub);
125 }
126 
127 void SharedRuntime::generate_deopt_blob() {
128   _deopt_blob = generate_empty_deopt_blob();
129 }
130 
131 SafepointBlob* SharedRuntime::generate_handler_blob(SharedStubId id, address call_ptr) {
132   return generate_empty_safepoint_blob();
133 }
134 
135 RuntimeStub* SharedRuntime::generate_resolve_blob(SharedStubId id, address destination) {
136   return generate_empty_runtime_stub();
137 }
138 
139 RuntimeStub* SharedRuntime::generate_throw_exception(SharedStubId id, address runtime_entry) {
140   return generate_empty_runtime_stub();
141 }
142 
143 int SharedRuntime::c_calling_convention(const BasicType *sig_bt,
144                                          VMRegPair *regs,
145                                          int total_args_passed) {
146   ShouldNotCallThis();
147   return 0;
148 }
149 
150 int SharedRuntime::vector_calling_convention(VMRegPair *regs,
151                                              uint num_bits,
152                                              uint total_args_passed) {
153   ShouldNotCallThis();
154   return 0;
155 }
156 
157 #if INCLUDE_JFR
158 RuntimeStub* SharedRuntime::generate_jfr_write_checkpoint() {
159   return nullptr;
160 }
161 
162 RuntimeStub* SharedRuntime::generate_jfr_return_lease() {
163   return nullptr;
164 }
165 
166 #endif // INCLUDE_JFR
167