Path: blob/master/runtime/compiler/il/J9ResolvedMethodSymbol.cpp
6000 views
/*******************************************************************************1* Copyright (c) 2000, 2020 IBM Corp. and others2*3* This program and the accompanying materials are made available under4* the terms of the Eclipse Public License 2.0 which accompanies this5* distribution and is available at http://eclipse.org/legal/epl-2.06* or the Apache License, Version 2.0 which accompanies this distribution7* and is available at https://www.apache.org/licenses/LICENSE-2.0.8*9* This Source Code may also be made available under the following Secondary10* Licenses when the conditions for such availability set forth in the11* Eclipse Public License, v. 2.0 are satisfied: GNU General Public License,12* version 2 with the GNU Classpath Exception [1] and GNU General Public13* License, version 2 with the OpenJDK Assembly Exception [2].14*15* [1] https://www.gnu.org/software/classpath/license.html16* [2] http://openjdk.java.net/legal/assembly-exception.html17*18* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception19*******************************************************************************/2021#include "compile/ResolvedMethod.hpp"22#include "env/CompilerEnv.hpp"23#include "env/KnownObjectTable.hpp"24#include "il/ResolvedMethodSymbol.hpp"25#include "compile/Compilation.hpp"262728J9::ResolvedMethodSymbol::ResolvedMethodSymbol(TR_ResolvedMethod *method, TR::Compilation *comp) :29OMR::ResolvedMethodSymbolConnector(method, comp)30{31if (comp->target().cpu.isPower())32{33if ((comp->target().cpu.isAtLeast(OMR_PROCESSOR_PPC_HW_ROUND_FIRST) &&34((method->getRecognizedMethod() == TR::java_lang_Math_floor) ||35(method->getRecognizedMethod() == TR::java_lang_StrictMath_floor) ||36(method->getRecognizedMethod() == TR::java_lang_Math_ceil) ||37(method->getRecognizedMethod() == TR::java_lang_StrictMath_ceil))) ||38(comp->target().cpu.isAtLeast(OMR_PROCESSOR_PPC_HW_COPY_SIGN_FIRST) &&39((method->getRecognizedMethod() == TR::java_lang_Math_copySign_F) ||40(method->getRecognizedMethod() == TR::java_lang_Math_copySign_D))))41{42self()->setCanReplaceWithHWInstr(true);43}44}4546if (method->isJNINative())47{48self()->setJNI();49#if defined(TR_TARGET_POWER)50switch(method->getRecognizedMethod())51{52case TR::java_lang_Math_acos:53case TR::java_lang_Math_asin:54case TR::java_lang_Math_atan:55case TR::java_lang_Math_atan2:56case TR::java_lang_Math_cbrt:57case TR::java_lang_Math_ceil:58case TR::java_lang_Math_copySign_F:59case TR::java_lang_Math_copySign_D:60case TR::java_lang_Math_cos:61case TR::java_lang_Math_cosh:62case TR::java_lang_Math_exp:63case TR::java_lang_Math_expm1:64case TR::java_lang_Math_floor:65case TR::java_lang_Math_hypot:66case TR::java_lang_Math_IEEEremainder:67case TR::java_lang_Math_log:68case TR::java_lang_Math_log10:69case TR::java_lang_Math_log1p:70case TR::java_lang_Math_max_F:71case TR::java_lang_Math_max_D:72case TR::java_lang_Math_min_F:73case TR::java_lang_Math_min_D:74case TR::java_lang_Math_nextAfter_F:75case TR::java_lang_Math_nextAfter_D:76case TR::java_lang_Math_pow:77case TR::java_lang_Math_rint:78case TR::java_lang_Math_round_F:79case TR::java_lang_Math_round_D:80case TR::java_lang_Math_scalb_F:81case TR::java_lang_Math_scalb_D:82case TR::java_lang_Math_sin:83case TR::java_lang_Math_sinh:84case TR::java_lang_Math_sqrt:85case TR::java_lang_Math_tan:86case TR::java_lang_Math_tanh:87case TR::java_lang_StrictMath_acos:88case TR::java_lang_StrictMath_asin:89case TR::java_lang_StrictMath_atan:90case TR::java_lang_StrictMath_atan2:91case TR::java_lang_StrictMath_cbrt:92case TR::java_lang_StrictMath_ceil:93case TR::java_lang_StrictMath_copySign_F:94case TR::java_lang_StrictMath_copySign_D:95case TR::java_lang_StrictMath_cos:96case TR::java_lang_StrictMath_cosh:97case TR::java_lang_StrictMath_exp:98case TR::java_lang_StrictMath_expm1:99case TR::java_lang_StrictMath_floor:100case TR::java_lang_StrictMath_hypot:101case TR::java_lang_StrictMath_IEEEremainder:102case TR::java_lang_StrictMath_log:103case TR::java_lang_StrictMath_log10:104case TR::java_lang_StrictMath_log1p:105case TR::java_lang_StrictMath_max_F:106case TR::java_lang_StrictMath_max_D:107case TR::java_lang_StrictMath_min_F:108case TR::java_lang_StrictMath_min_D:109case TR::java_lang_StrictMath_nextAfter_F:110case TR::java_lang_StrictMath_nextAfter_D:111case TR::java_lang_StrictMath_pow:112case TR::java_lang_StrictMath_rint:113case TR::java_lang_StrictMath_round_F:114case TR::java_lang_StrictMath_round_D:115case TR::java_lang_StrictMath_scalb_F:116case TR::java_lang_StrictMath_scalb_D:117case TR::java_lang_StrictMath_sin:118case TR::java_lang_StrictMath_sinh:119case TR::java_lang_StrictMath_sqrt:120case TR::java_lang_StrictMath_tan:121case TR::java_lang_StrictMath_tanh:122setCanDirectNativeCall(true);123break;124default:125break;126}127#endif // TR_TARGET_POWER128}129130}131132TR::KnownObjectTable::Index133J9::ResolvedMethodSymbol::getKnownObjectIndexForParm(int32_t ordinal)134{135TR::KnownObjectTable::Index index = TR::KnownObjectTable::UNKNOWN;136if (ordinal == 0)137{138if (self()->getResolvedMethod()->convertToMethod()->isArchetypeSpecimen())139{140TR::KnownObjectTable *knot = self()->comp()->getOrCreateKnownObjectTable();141if (knot)142index = knot->getExistingIndexAt(self()->getResolvedMethod()->getMethodHandleLocation());143}144}145return index;146}147148149