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