< prev index next >

src/hotspot/share/opto/library_call.hpp

Print this page




   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "ci/ciMethod.hpp"

  26 #include "opto/callGenerator.hpp"
  27 #include "opto/graphKit.hpp"
  28 #include "opto/castnode.hpp"
  29 #include "opto/convertnode.hpp"
  30 #include "opto/intrinsicnode.hpp"
  31 #include "opto/movenode.hpp"
  32 
  33 class LibraryIntrinsic : public InlineCallGenerator {
  34   // Extend the set of intrinsics known to the runtime:
  35  public:
  36  private:
  37   bool             _is_virtual;
  38   bool             _does_virtual_dispatch;
  39   int8_t           _predicates_count;  // Intrinsic is predicated by several conditions
  40   int8_t           _last_predicate; // Last generated predicate
  41   vmIntrinsics::ID _intrinsic_id;
  42 
  43  public:
  44   LibraryIntrinsic(ciMethod* m, bool is_virtual, int predicates_count, bool does_virtual_dispatch, vmIntrinsics::ID id)
  45     : InlineCallGenerator(m),
  46       _is_virtual(is_virtual),
  47       _does_virtual_dispatch(does_virtual_dispatch),
  48       _predicates_count((int8_t)predicates_count),
  49       _last_predicate((int8_t)-1),
  50       _intrinsic_id(id)
  51   {
  52   }
  53   virtual bool is_intrinsic() const { return true; }
  54   virtual bool is_virtual()   const { return _is_virtual; }
  55   virtual bool is_predicated() const { return _predicates_count > 0; }
  56   virtual int  predicates_count() const { return _predicates_count; }
  57   virtual bool does_virtual_dispatch()   const { return _does_virtual_dispatch; }
  58   virtual JVMState* generate(JVMState* jvms);
  59   virtual Node* generate_predicate(JVMState* jvms, int predicate);
  60   vmIntrinsics::ID intrinsic_id() const { return _intrinsic_id; }
  61 };
  62 

  63 // Local helper class for LibraryIntrinsic:
  64 class LibraryCallKit : public GraphKit {
  65  private:
  66   LibraryIntrinsic* _intrinsic;     // the library intrinsic being called
  67   Node*             _result;        // the result node, if any
  68   int               _reexecute_sp;  // the stack pointer when bytecode needs to be reexecuted
  69 
  70   const TypeOopPtr* sharpen_unsafe_type(Compile::AliasType* alias_type, const TypePtr *adr_type);
  71 
  72  public:
  73   LibraryCallKit(JVMState* jvms, LibraryIntrinsic* intrinsic)
  74     : GraphKit(jvms),
  75       _intrinsic(intrinsic),
  76       _result(NULL)
  77   {
  78     // Check if this is a root compile.  In that case we don't have a caller.
  79     if (!jvms->has_method()) {
  80       _reexecute_sp = sp();
  81     } else {
  82       // Find out how many arguments the interpreter needs when deoptimizing


 316   bool inline_vector_reduction();
 317   bool inline_vector_test();
 318   bool inline_vector_blend();
 319   bool inline_vector_rearrange();
 320   bool inline_vector_compare();
 321   bool inline_vector_broadcast_int();
 322   bool inline_vector_convert();
 323   bool inline_vector_extract();
 324   bool inline_vector_insert();
 325   Node* box_vector(Node* in, const TypeInstPtr* vbox_type, BasicType bt, int num_elem);
 326   Node* unbox_vector(Node* in, const TypeInstPtr* vbox_type, BasicType bt, int num_elem, bool shuffle_to_vector = false);
 327   Node* shift_count(Node* cnt, int shift_op, BasicType bt, int num_elem);
 328 
 329   enum VectorMaskUseType {
 330     VecMaskUseLoad,
 331     VecMaskUseStore,
 332     VecMaskUseAll,
 333     VecMaskNotUsed
 334   };
 335 
 336   bool arch_supports_vector(int op, int num_elem, BasicType type, VectorMaskUseType mask_use_type);
 337 
 338   void clear_upper_avx() {
 339 #ifdef X86
 340     if (UseAVX >= 2) {
 341       C->set_clear_upper_avx(true);
 342     }
 343 #endif
 344   }
 345 };
 346 


   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "ci/ciMethod.hpp"
  26 #include "classfile/javaClasses.hpp"
  27 #include "opto/callGenerator.hpp"
  28 #include "opto/graphKit.hpp"
  29 #include "opto/castnode.hpp"
  30 #include "opto/convertnode.hpp"
  31 #include "opto/intrinsicnode.hpp"
  32 #include "opto/movenode.hpp"
  33 
  34 class LibraryIntrinsic : public InlineCallGenerator {
  35   // Extend the set of intrinsics known to the runtime:
  36  public:
  37  private:
  38   bool             _is_virtual;
  39   bool             _does_virtual_dispatch;
  40   int8_t           _predicates_count;  // Intrinsic is predicated by several conditions
  41   int8_t           _last_predicate; // Last generated predicate
  42   vmIntrinsics::ID _intrinsic_id;
  43 
  44  public:
  45   LibraryIntrinsic(ciMethod* m, bool is_virtual, int predicates_count, bool does_virtual_dispatch, vmIntrinsics::ID id)
  46     : InlineCallGenerator(m),
  47       _is_virtual(is_virtual),
  48       _does_virtual_dispatch(does_virtual_dispatch),
  49       _predicates_count((int8_t)predicates_count),
  50       _last_predicate((int8_t)-1),
  51       _intrinsic_id(id)
  52   {
  53   }
  54   virtual bool is_intrinsic() const { return true; }
  55   virtual bool is_virtual()   const { return _is_virtual; }
  56   virtual bool is_predicated() const { return _predicates_count > 0; }
  57   virtual int  predicates_count() const { return _predicates_count; }
  58   virtual bool does_virtual_dispatch()   const { return _does_virtual_dispatch; }
  59   virtual JVMState* generate(JVMState* jvms);
  60   virtual Node* generate_predicate(JVMState* jvms, int predicate);
  61   vmIntrinsics::ID intrinsic_id() const { return _intrinsic_id; }
  62 };
  63 
  64 
  65 // Local helper class for LibraryIntrinsic:
  66 class LibraryCallKit : public GraphKit {
  67  private:
  68   LibraryIntrinsic* _intrinsic;     // the library intrinsic being called
  69   Node*             _result;        // the result node, if any
  70   int               _reexecute_sp;  // the stack pointer when bytecode needs to be reexecuted
  71 
  72   const TypeOopPtr* sharpen_unsafe_type(Compile::AliasType* alias_type, const TypePtr *adr_type);
  73 
  74  public:
  75   LibraryCallKit(JVMState* jvms, LibraryIntrinsic* intrinsic)
  76     : GraphKit(jvms),
  77       _intrinsic(intrinsic),
  78       _result(NULL)
  79   {
  80     // Check if this is a root compile.  In that case we don't have a caller.
  81     if (!jvms->has_method()) {
  82       _reexecute_sp = sp();
  83     } else {
  84       // Find out how many arguments the interpreter needs when deoptimizing


 318   bool inline_vector_reduction();
 319   bool inline_vector_test();
 320   bool inline_vector_blend();
 321   bool inline_vector_rearrange();
 322   bool inline_vector_compare();
 323   bool inline_vector_broadcast_int();
 324   bool inline_vector_convert();
 325   bool inline_vector_extract();
 326   bool inline_vector_insert();
 327   Node* box_vector(Node* in, const TypeInstPtr* vbox_type, BasicType bt, int num_elem);
 328   Node* unbox_vector(Node* in, const TypeInstPtr* vbox_type, BasicType bt, int num_elem, bool shuffle_to_vector = false);
 329   Node* shift_count(Node* cnt, int shift_op, BasicType bt, int num_elem);
 330 
 331   enum VectorMaskUseType {
 332     VecMaskUseLoad,
 333     VecMaskUseStore,
 334     VecMaskUseAll,
 335     VecMaskNotUsed
 336   };
 337 
 338   bool arch_supports_vector(int op, int num_elem, BasicType type, VectorMaskUseType mask_use_type, bool has_scalar_args = false);
 339 
 340   void clear_upper_avx() {
 341 #ifdef X86
 342     if (UseAVX >= 2) {
 343       C->set_clear_upper_avx(true);
 344     }
 345 #endif
 346   }
 347 };
 348 
< prev index next >