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/icBuffer.hpp"
 30 #include "code/vtableStubs.hpp"
 31 #include "interpreter/interpreter.hpp"
 32 #include "oops/compiledICHolder.hpp"
 33 #include "runtime/interfaceSupport.inline.hpp"
 34 #include "runtime/sharedRuntime.hpp"
 35 #include "runtime/vframeArray.hpp"
 36 #include "vmreg_zero.inline.hpp"
 37 #ifdef COMPILER1
 38 #include "c1/c1_Runtime1.hpp"
 39 #endif
 40 #ifdef COMPILER2
 41 #include "opto/runtime.hpp"
 42 #endif
 43 
 44 
 45 static address zero_null_code_stub() {
 46   address start = ShouldNotCallThisStub();
 47   return start;
 48 }
 49 
 50 int SharedRuntime::java_calling_convention(const BasicType *sig_bt,
 51                                            VMRegPair *regs,
 52                                            int total_args_passed) {
 53   return 0;
 54 }
 55 
 56 int SharedRuntime::java_return_convention(const BasicType *sig_bt,
 57                                            VMRegPair *regs,
 58                                            int total_args_passed) {
 59   Unimplemented();
 60   return 0;
 61 }
 62 
 63 BufferedInlineTypeBlob* SharedRuntime::generate_buffered_inline_type_adapter(const InlineKlass* vk) {
 64   Unimplemented();
 65   return NULL;
 66 }
 67 
 68 AdapterHandlerEntry* SharedRuntime::generate_i2c2i_adapters(MacroAssembler* masm,
 69                                                             int comp_args_on_stack,
 70                                                             const GrowableArray <SigEntry>* sig,
 71                                                             const VMRegPair* regs,
 72                                                             const GrowableArray <SigEntry>* sig_cc,
 73                                                             const VMRegPair* regs_cc,
 74                                                             const GrowableArray <SigEntry>* sig_cc_ro,
 75                                                             const VMRegPair* regs_cc_ro,
 76                                                             AdapterFingerPrint* fingerprint,
 77                                                             AdapterBlob*& new_adapter,
 78                                                             bool allocate_code_blob) {
 79   if (allocate_code_blob) {
 80     new_adapter = AdapterBlob::create(masm->code(), 0, 0, NULL);
 81   }
 82   return AdapterHandlerLibrary::new_entry(
 83     fingerprint,
 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     CAST_FROM_FN_PTR(address,zero_null_code_stub),
 90     CAST_FROM_FN_PTR(address,zero_null_code_stub));
 91 }
 92 
 93 nmethod *SharedRuntime::generate_native_wrapper(MacroAssembler *masm,
 94                                                 const methodHandle& method,
 95                                                 int compile_id,
 96                                                 BasicType *sig_bt,
 97                                                 VMRegPair *regs,
 98                                                 BasicType ret_type) {
 99   ShouldNotCallThis();
100   return nullptr;
101 }
102 
103 int Deoptimization::last_frame_adjust(int callee_parameters,
104                                       int callee_locals) {
105   return 0;
106 }
107 
108 uint SharedRuntime::out_preserve_stack_slots() {
109   ShouldNotCallThis();
110   return 0;
111 }
112 
113 JRT_LEAF(void, zero_stub())
114   ShouldNotCallThis();
115 JRT_END
116 
117 static RuntimeStub* generate_empty_runtime_stub(const char* name) {
118   return CAST_FROM_FN_PTR(RuntimeStub*,zero_stub);
119 }
120 
121 static SafepointBlob* generate_empty_safepoint_blob() {
122   return CAST_FROM_FN_PTR(SafepointBlob*,zero_stub);
123 }
124 
125 static DeoptimizationBlob* generate_empty_deopt_blob() {
126   return CAST_FROM_FN_PTR(DeoptimizationBlob*,zero_stub);
127 }
128 
129 
130 void SharedRuntime::generate_deopt_blob() {
131   _deopt_blob = generate_empty_deopt_blob();
132 }
133 
134 SafepointBlob* SharedRuntime::generate_handler_blob(address call_ptr, int poll_type) {
135   return generate_empty_safepoint_blob();
136 }
137 
138 RuntimeStub* SharedRuntime::generate_resolve_blob(address destination, const char* name) {
139   return generate_empty_runtime_stub("resolve_blob");
140 }
141 
142 int SharedRuntime::c_calling_convention(const BasicType *sig_bt,
143                                          VMRegPair *regs,
144                                          int total_args_passed) {
145   ShouldNotCallThis();
146   return 0;
147 }
148 
149 int SharedRuntime::vector_calling_convention(VMRegPair *regs,
150                                              uint num_bits,
151                                              uint total_args_passed) {
152   ShouldNotCallThis();
153   return 0;
154 }