1 /*
2 * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
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 *
314 dump_on(tty);
315 }
316 #endif
317 };
318
319 //------------------------------SafePointNode----------------------------------
320 // A SafePointNode is a subclass of a MultiNode for convenience (and
321 // potential code sharing) only - conceptually it is independent of
322 // the Node semantics.
323 class SafePointNode : public MultiNode {
324 virtual bool cmp( const Node &n ) const;
325 virtual uint size_of() const; // Size is bigger
326
327 public:
328 SafePointNode(uint edges, JVMState* jvms,
329 // A plain safepoint advertises no memory effects (NULL):
330 const TypePtr* adr_type = NULL)
331 : MultiNode( edges ),
332 _oop_map(NULL),
333 _jvms(jvms),
334 _adr_type(adr_type)
335 {
336 init_class_id(Class_SafePoint);
337 }
338
339 OopMap* _oop_map; // Array of OopMap info (8-bit char) for GC
340 JVMState* const _jvms; // Pointer to list of JVM State objects
341 const TypePtr* _adr_type; // What type of memory does this node produce?
342 ReplacedNodes _replaced_nodes; // During parsing: list of pair of nodes from calls to GraphKit::replace_in_map()
343
344 // Many calls take *all* of memory as input,
345 // but some produce a limited subset of that memory as output.
346 // The adr_type reports the call's behavior as a store, not a load.
347
348 virtual JVMState* jvms() const { return _jvms; }
349 void set_jvms(JVMState* s) {
350 *(JVMState**)&_jvms = s; // override const attribute in the accessor
351 }
352 OopMap *oop_map() const { return _oop_map; }
353 void set_oop_map(OopMap *om) { _oop_map = om; }
354
355 private:
356 void verify_input(JVMState* jvms, uint idx) const {
357 assert(verify_jvms(jvms), "jvms must match");
358 Node* n = in(idx);
359 assert((!n->bottom_type()->isa_long() && !n->bottom_type()->isa_double()) ||
360 in(idx + 1)->is_top(), "2nd half of long/double");
361 }
362
444 _replaced_nodes.clone();
445 }
446 void record_replaced_node(Node* initial, Node* improved) {
447 _replaced_nodes.record(initial, improved);
448 }
449 void transfer_replaced_nodes_from(SafePointNode* sfpt, uint idx = 0) {
450 _replaced_nodes.transfer_from(sfpt->_replaced_nodes, idx);
451 }
452 void delete_replaced_nodes() {
453 _replaced_nodes.reset();
454 }
455 void apply_replaced_nodes(uint idx) {
456 _replaced_nodes.apply(this, idx);
457 }
458 void merge_replaced_nodes_with(SafePointNode* sfpt) {
459 _replaced_nodes.merge_with(sfpt->_replaced_nodes);
460 }
461 bool has_replaced_nodes() const {
462 return !_replaced_nodes.is_empty();
463 }
464
465 void disconnect_from_root(PhaseIterGVN *igvn);
466
467 // Standard Node stuff
468 virtual int Opcode() const;
469 virtual bool pinned() const { return true; }
470 virtual const Type* Value(PhaseGVN* phase) const;
471 virtual const Type *bottom_type() const { return Type::CONTROL; }
472 virtual const TypePtr *adr_type() const { return _adr_type; }
473 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
474 virtual Node* Identity(PhaseGVN* phase);
475 virtual uint ideal_reg() const { return 0; }
476 virtual const RegMask &in_RegMask(uint) const;
477 virtual const RegMask &out_RegMask() const;
478 virtual uint match_edge(uint idx) const;
479
480 static bool needs_polling_address_input();
481
482 #ifndef PRODUCT
483 virtual void dump_spec(outputStream *st) const;
644 virtual void dump_req(outputStream *st = tty) const;
645 virtual void dump_spec(outputStream *st) const;
646 #endif
647 };
648
649
650 //------------------------------CallJavaNode-----------------------------------
651 // Make a static or dynamic subroutine call node using Java calling
652 // convention. (The "Java" calling convention is the compiler's calling
653 // convention, as opposed to the interpreter's or that of native C.)
654 class CallJavaNode : public CallNode {
655 friend class VMStructs;
656 protected:
657 virtual bool cmp( const Node &n ) const;
658 virtual uint size_of() const; // Size is bigger
659
660 bool _optimized_virtual;
661 bool _method_handle_invoke;
662 bool _override_symbolic_info; // Override symbolic call site info from bytecode
663 ciMethod* _method; // Method being direct called
664 public:
665 const int _bci; // Byte Code Index of call byte code
666 CallJavaNode(const TypeFunc* tf , address addr, ciMethod* method, int bci)
667 : CallNode(tf, addr, TypePtr::BOTTOM),
668 _optimized_virtual(false),
669 _method_handle_invoke(false),
670 _override_symbolic_info(false),
671 _method(method), _bci(bci)
672 {
673 init_class_id(Class_CallJava);
674 }
675
676 virtual int Opcode() const;
677 ciMethod* method() const { return _method; }
678 void set_method(ciMethod *m) { _method = m; }
679 void set_optimized_virtual(bool f) { _optimized_virtual = f; }
680 bool is_optimized_virtual() const { return _optimized_virtual; }
681 void set_method_handle_invoke(bool f) { _method_handle_invoke = f; }
682 bool is_method_handle_invoke() const { return _method_handle_invoke; }
683 void set_override_symbolic_info(bool f) { _override_symbolic_info = f; }
684 bool override_symbolic_info() const { return _override_symbolic_info; }
685
686 DEBUG_ONLY( bool validate_symbolic_info() const; )
687
688 #ifndef PRODUCT
689 virtual void dump_spec(outputStream *st) const;
690 virtual void dump_compact_spec(outputStream *st) const;
691 #endif
692 };
693
694 //------------------------------CallStaticJavaNode-----------------------------
695 // Make a direct subroutine call using Java calling convention (for static
696 // calls and optimized virtual calls, plus calls to wrappers for run-time
697 // routines); generates static stub.
698 class CallStaticJavaNode : public CallJavaNode {
699 virtual bool cmp( const Node &n ) const;
700 virtual uint size_of() const; // Size is bigger
701 public:
702 CallStaticJavaNode(Compile* C, const TypeFunc* tf, address addr, ciMethod* method, int bci)
703 : CallJavaNode(tf, addr, method, bci) {
704 init_class_id(Class_CallStaticJava);
|
1 /*
2 * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
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 *
314 dump_on(tty);
315 }
316 #endif
317 };
318
319 //------------------------------SafePointNode----------------------------------
320 // A SafePointNode is a subclass of a MultiNode for convenience (and
321 // potential code sharing) only - conceptually it is independent of
322 // the Node semantics.
323 class SafePointNode : public MultiNode {
324 virtual bool cmp( const Node &n ) const;
325 virtual uint size_of() const; // Size is bigger
326
327 public:
328 SafePointNode(uint edges, JVMState* jvms,
329 // A plain safepoint advertises no memory effects (NULL):
330 const TypePtr* adr_type = NULL)
331 : MultiNode( edges ),
332 _oop_map(NULL),
333 _jvms(jvms),
334 _adr_type(adr_type),
335 _not_global_escape_in_scope(false)
336 {
337 init_class_id(Class_SafePoint);
338 }
339
340 OopMap* _oop_map; // Array of OopMap info (8-bit char) for GC
341 JVMState* const _jvms; // Pointer to list of JVM State objects
342 const TypePtr* _adr_type; // What type of memory does this node produce?
343 ReplacedNodes _replaced_nodes; // During parsing: list of pair of nodes from calls to GraphKit::replace_in_map()
344 bool _not_global_escape_in_scope; // NoEscape or ArgEscape objects in JVM States
345
346 // Many calls take *all* of memory as input,
347 // but some produce a limited subset of that memory as output.
348 // The adr_type reports the call's behavior as a store, not a load.
349
350 virtual JVMState* jvms() const { return _jvms; }
351 void set_jvms(JVMState* s) {
352 *(JVMState**)&_jvms = s; // override const attribute in the accessor
353 }
354 OopMap *oop_map() const { return _oop_map; }
355 void set_oop_map(OopMap *om) { _oop_map = om; }
356
357 private:
358 void verify_input(JVMState* jvms, uint idx) const {
359 assert(verify_jvms(jvms), "jvms must match");
360 Node* n = in(idx);
361 assert((!n->bottom_type()->isa_long() && !n->bottom_type()->isa_double()) ||
362 in(idx + 1)->is_top(), "2nd half of long/double");
363 }
364
446 _replaced_nodes.clone();
447 }
448 void record_replaced_node(Node* initial, Node* improved) {
449 _replaced_nodes.record(initial, improved);
450 }
451 void transfer_replaced_nodes_from(SafePointNode* sfpt, uint idx = 0) {
452 _replaced_nodes.transfer_from(sfpt->_replaced_nodes, idx);
453 }
454 void delete_replaced_nodes() {
455 _replaced_nodes.reset();
456 }
457 void apply_replaced_nodes(uint idx) {
458 _replaced_nodes.apply(this, idx);
459 }
460 void merge_replaced_nodes_with(SafePointNode* sfpt) {
461 _replaced_nodes.merge_with(sfpt->_replaced_nodes);
462 }
463 bool has_replaced_nodes() const {
464 return !_replaced_nodes.is_empty();
465 }
466 void set_not_global_escape_in_scope(bool b) {
467 _not_global_escape_in_scope = b;
468 }
469 bool not_global_escape_in_scope() const {
470 return _not_global_escape_in_scope;
471 }
472
473 void disconnect_from_root(PhaseIterGVN *igvn);
474
475 // Standard Node stuff
476 virtual int Opcode() const;
477 virtual bool pinned() const { return true; }
478 virtual const Type* Value(PhaseGVN* phase) const;
479 virtual const Type *bottom_type() const { return Type::CONTROL; }
480 virtual const TypePtr *adr_type() const { return _adr_type; }
481 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
482 virtual Node* Identity(PhaseGVN* phase);
483 virtual uint ideal_reg() const { return 0; }
484 virtual const RegMask &in_RegMask(uint) const;
485 virtual const RegMask &out_RegMask() const;
486 virtual uint match_edge(uint idx) const;
487
488 static bool needs_polling_address_input();
489
490 #ifndef PRODUCT
491 virtual void dump_spec(outputStream *st) const;
652 virtual void dump_req(outputStream *st = tty) const;
653 virtual void dump_spec(outputStream *st) const;
654 #endif
655 };
656
657
658 //------------------------------CallJavaNode-----------------------------------
659 // Make a static or dynamic subroutine call node using Java calling
660 // convention. (The "Java" calling convention is the compiler's calling
661 // convention, as opposed to the interpreter's or that of native C.)
662 class CallJavaNode : public CallNode {
663 friend class VMStructs;
664 protected:
665 virtual bool cmp( const Node &n ) const;
666 virtual uint size_of() const; // Size is bigger
667
668 bool _optimized_virtual;
669 bool _method_handle_invoke;
670 bool _override_symbolic_info; // Override symbolic call site info from bytecode
671 ciMethod* _method; // Method being direct called
672 bool _arg_escape; // ArgEscape in parameter list
673 public:
674 const int _bci; // Byte Code Index of call byte code
675 CallJavaNode(const TypeFunc* tf , address addr, ciMethod* method, int bci)
676 : CallNode(tf, addr, TypePtr::BOTTOM),
677 _optimized_virtual(false),
678 _method_handle_invoke(false),
679 _override_symbolic_info(false),
680 _method(method),
681 _arg_escape(false), _bci(bci)
682 {
683 init_class_id(Class_CallJava);
684 }
685
686 virtual int Opcode() const;
687 ciMethod* method() const { return _method; }
688 void set_method(ciMethod *m) { _method = m; }
689 void set_optimized_virtual(bool f) { _optimized_virtual = f; }
690 bool is_optimized_virtual() const { return _optimized_virtual; }
691 void set_method_handle_invoke(bool f) { _method_handle_invoke = f; }
692 bool is_method_handle_invoke() const { return _method_handle_invoke; }
693 void set_override_symbolic_info(bool f) { _override_symbolic_info = f; }
694 bool override_symbolic_info() const { return _override_symbolic_info; }
695 void set_arg_escape(bool f) { _arg_escape = f; }
696 bool arg_escape() const { return _arg_escape; }
697
698 DEBUG_ONLY( bool validate_symbolic_info() const; )
699
700 #ifndef PRODUCT
701 virtual void dump_spec(outputStream *st) const;
702 virtual void dump_compact_spec(outputStream *st) const;
703 #endif
704 };
705
706 //------------------------------CallStaticJavaNode-----------------------------
707 // Make a direct subroutine call using Java calling convention (for static
708 // calls and optimized virtual calls, plus calls to wrappers for run-time
709 // routines); generates static stub.
710 class CallStaticJavaNode : public CallJavaNode {
711 virtual bool cmp( const Node &n ) const;
712 virtual uint size_of() const; // Size is bigger
713 public:
714 CallStaticJavaNode(Compile* C, const TypeFunc* tf, address addr, ciMethod* method, int bci)
715 : CallJavaNode(tf, addr, method, bci) {
716 init_class_id(Class_CallStaticJava);
|