1 /*
   2  * Copyright (c) 2003, 2015, 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.hpp"
  28 #include "assembler_zero.inline.hpp"
  29 #include "code/debugInfoRec.hpp"
  30 #include "code/icBuffer.hpp"
  31 #include "code/vtableStubs.hpp"
  32 #include "interpreter/interpreter.hpp"
  33 #include "oops/compiledICHolder.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 #ifdef SHARK
  45 #include "compiler/compileBroker.hpp"
  46 #include "shark/sharkCompiler.hpp"
  47 #endif
  48 
  49 
  50 
  51 static address zero_null_code_stub() {
  52   address start = ShouldNotCallThisStub();
  53   return start;
  54 }
  55 
  56 int SharedRuntime::java_calling_convention(const BasicType *sig_bt,
  57                                            VMRegPair *regs,
  58                                            int total_args_passed,
  59                                            int is_outgoing) {
  60   return 0;
  61 }
  62 
  63 AdapterHandlerEntry* SharedRuntime::generate_i2c2i_adapters(
  64                         MacroAssembler *masm,
  65                         int total_args_passed,
  66                         int comp_args_on_stack,
  67                         const BasicType *sig_bt,
  68                         const VMRegPair *regs,
  69                         AdapterFingerPrint *fingerprint) {
  70   return AdapterHandlerLibrary::new_entry(
  71     fingerprint,
  72     CAST_FROM_FN_PTR(address,zero_null_code_stub),
  73     CAST_FROM_FN_PTR(address,zero_null_code_stub),
  74     CAST_FROM_FN_PTR(address,zero_null_code_stub));
  75 }
  76 
  77 nmethod *SharedRuntime::generate_native_wrapper(MacroAssembler *masm,
  78                                                 const methodHandle& method,
  79                                                 int compile_id,
  80                                                 BasicType *sig_bt,
  81                                                 VMRegPair *regs,
  82                                                 BasicType ret_type) {
  83 #ifdef SHARK
  84   return SharkCompiler::compiler()->generate_native_wrapper(masm,
  85                                                             method,
  86                                                             compile_id,
  87                                                             sig_bt,
  88                                                             ret_type);
  89 #else
  90   ShouldNotCallThis();
  91   return NULL;
  92 #endif // SHARK
  93 }
  94 
  95 int Deoptimization::last_frame_adjust(int callee_parameters,
  96                                       int callee_locals) {
  97   return 0;
  98 }
  99 
 100 uint SharedRuntime::out_preserve_stack_slots() {
 101   ShouldNotCallThis();
 102   return 0;
 103 }
 104 
 105 JRT_LEAF(void, zero_stub())
 106   ShouldNotCallThis();
 107 JRT_END
 108 
 109 static RuntimeStub* generate_empty_runtime_stub(const char* name) {
 110   return CAST_FROM_FN_PTR(RuntimeStub*,zero_stub);
 111 }
 112 
 113 static SafepointBlob* generate_empty_safepoint_blob() {
 114   return CAST_FROM_FN_PTR(SafepointBlob*,zero_stub);
 115 }
 116 
 117 static DeoptimizationBlob* generate_empty_deopt_blob() {
 118   return CAST_FROM_FN_PTR(DeoptimizationBlob*,zero_stub);
 119 }
 120 
 121 
 122 void SharedRuntime::generate_deopt_blob() {
 123   _deopt_blob = generate_empty_deopt_blob();
 124 }
 125 
 126 SafepointBlob* SharedRuntime::generate_handler_blob(address call_ptr, int poll_type) {
 127   return generate_empty_safepoint_blob();
 128 }
 129 
 130 RuntimeStub* SharedRuntime::generate_resolve_blob(address destination, const char* name) {
 131   return generate_empty_runtime_stub("resolve_blob");
 132 }
 133 
 134 size_t SharedRuntime::trampoline_size() {
 135   ShouldNotCallThis();
 136   return 0;
 137 }
 138 
 139 void SharedRuntime::generate_trampoline(MacroAssembler *masm, address destination) {
 140   ShouldNotCallThis();
 141   return;
 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 }