1 /*
2 * Copyright (c) 2016, 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 *
104 init_class_id(Class_ValueType);
105 init_req(Oop, oop);
106 }
107
108 // Checks if the value type is loaded from memory and if so returns the oop
109 Node* is_loaded(PhaseGVN* phase, ciValueKlass* vk = NULL, Node* base = NULL, int holder_offset = 0);
110
111 // Checks if the value type fields are all set to default values
112 bool is_default(PhaseGVN& gvn) const;
113
114 const TypeInstPtr* value_ptr() const { return TypeInstPtr::make(TypePtr::BotPTR, value_klass()); }
115 ciValueKlass* value_klass() const { return type()->is_valuetype()->value_klass(); }
116
117 public:
118 // Create uninitialized
119 static ValueTypeNode* make_uninitialized(PhaseGVN& gvn, ciValueKlass* klass);
120 // Create with default field values
121 static ValueTypeNode* make_default(PhaseGVN& gvn, ciValueKlass* vk);
122 // Create and initialize by loading the field values from an oop
123 static ValueTypeNode* make_from_oop(GraphKit* kit, Node* oop, ciValueKlass* vk, bool buffer_check = false, bool null2default = true, int trap_bci = -1);
124 // Create and initialize by loading the field values from a flattened field or array
125 static ValueTypeNode* make_from_flattened(GraphKit* kit, ciValueKlass* vk, Node* obj, Node* ptr, ciInstanceKlass* holder = NULL, int holder_offset = 0);
126 // Create and initialize with the inputs or outputs of a MultiNode (method entry or call)
127 static ValueTypeNode* make_from_multi(GraphKit* kit, MultiNode* multi, ciValueKlass* vk, int base_input, bool in);
128
129 // Load the default oop from the java mirror of the given ValueKlass
130 static Node* load_default_oop(PhaseGVN& gvn, ciValueKlass* vk);
131
132 // Allocate all non-flattened value type fields
133 Node* allocate_fields(GraphKit* kit);
134
135 Node* tagged_klass(PhaseGVN& gvn);
136 void pass_klass(Node* n, uint pos, const GraphKit& kit);
137 uint pass_fields(Node* call, int base_input, GraphKit& kit, bool assert_allocated = false, ciValueKlass* base_vk = NULL, int base_offset = 0);
138
139 // Allocation optimizations
140 void remove_redundant_allocations(PhaseIterGVN* igvn, PhaseIdealLoop* phase);
141
142 virtual Node* Ideal(PhaseGVN* phase, bool can_reshape);
143 virtual int Opcode() const;
|
1 /*
2 * Copyright (c) 2016, 2018, 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 *
104 init_class_id(Class_ValueType);
105 init_req(Oop, oop);
106 }
107
108 // Checks if the value type is loaded from memory and if so returns the oop
109 Node* is_loaded(PhaseGVN* phase, ciValueKlass* vk = NULL, Node* base = NULL, int holder_offset = 0);
110
111 // Checks if the value type fields are all set to default values
112 bool is_default(PhaseGVN& gvn) const;
113
114 const TypeInstPtr* value_ptr() const { return TypeInstPtr::make(TypePtr::BotPTR, value_klass()); }
115 ciValueKlass* value_klass() const { return type()->is_valuetype()->value_klass(); }
116
117 public:
118 // Create uninitialized
119 static ValueTypeNode* make_uninitialized(PhaseGVN& gvn, ciValueKlass* klass);
120 // Create with default field values
121 static ValueTypeNode* make_default(PhaseGVN& gvn, ciValueKlass* vk);
122 // Create and initialize by loading the field values from an oop
123 static ValueTypeNode* make_from_oop(GraphKit* kit, Node* oop, ciValueKlass* vk, bool buffer_check = false, bool null2default = true, int trap_bci = -1);
124 // Create and initialize by loading the field values from an oop returned by a callee.
125 static ValueTypeNode* make_from_returned_oop(GraphKit* kit, Node* oop, ciValueKlass* vk);
126 // Create and initialize by loading the field values from a flattened field or array
127 static ValueTypeNode* make_from_flattened(GraphKit* kit, ciValueKlass* vk, Node* obj, Node* ptr, ciInstanceKlass* holder = NULL, int holder_offset = 0);
128 // Create and initialize with the inputs or outputs of a MultiNode (method entry or call)
129 static ValueTypeNode* make_from_multi(GraphKit* kit, MultiNode* multi, ciValueKlass* vk, int base_input, bool in);
130
131 // Load the default oop from the java mirror of the given ValueKlass
132 static Node* load_default_oop(PhaseGVN& gvn, ciValueKlass* vk);
133
134 // Allocate all non-flattened value type fields
135 Node* allocate_fields(GraphKit* kit);
136
137 Node* tagged_klass(PhaseGVN& gvn);
138 void pass_klass(Node* n, uint pos, const GraphKit& kit);
139 uint pass_fields(Node* call, int base_input, GraphKit& kit, bool assert_allocated = false, ciValueKlass* base_vk = NULL, int base_offset = 0);
140
141 // Allocation optimizations
142 void remove_redundant_allocations(PhaseIterGVN* igvn, PhaseIdealLoop* phase);
143
144 virtual Node* Ideal(PhaseGVN* phase, bool can_reshape);
145 virtual int Opcode() const;
|