note description: "Byte code for manifest arrays" legal: "See notice at end of class." status: "See notice at end of class." date: "$Date$" revision: "$Revision$" class ARRAY_CONST_B inherit EXPR_B redefine enlarged, enlarge_tree, is_unsafe, optimized_byte_node, calls_special_features, size, pre_inlined_code, inlined_byte_code, allocates_memory, has_call, is_constant_expression end REFACTORING_HELPER export {NONE} all end create make feature {NONE} -- Initialize make (e: like expressions; t: like type) -- New instance of ARRAY_CONST_B initialized with `e' and `t'. require e_not_void: e /= Void t_not_void: t /= Void local l_generics: ARRAYED_LIST [TYPE_A] do expressions := e type := t create l_generics.make (1) l_generics.extend (t.generics.first) create special_info.make (create {GEN_TYPE_A}.make (system.special_id, l_generics)) ensure expressions_set: expressions = e type_set: type = t special_info_set: special_info /= Void end feature -- Visitor process (v: BYTE_NODE_VISITOR) -- Process current element. do v.process_array_const_b (Current) end feature -- Access expressions: BYTE_LIST [BYTE_NODE]; -- Expressions in the array type: GEN_TYPE_A -- Generic array type special_info: CREATE_TYPE -- Info to create manifest array instance feature -- Status report used (r: REGISTRABLE): BOOLEAN -- Is register `r' used in local access ? local expr: EXPR_B i, nb: INTEGER l_area: SPECIAL [BYTE_NODE] l_expressions: BYTE_LIST [BYTE_NODE] do from l_expressions := expressions l_area := l_expressions.area nb := l_expressions.count until i = nb or Result loop expr ?= l_area.item (i) check expr_not_void: expr /= Void end Result := expr.used (r) i := i + 1 end end allocates_memory: BOOLEAN = True; -- Current allocates memory. has_call: BOOLEAN -- Does current contain a call? local expr: EXPR_B l_expressions: like expressions do from l_expressions := expressions l_expressions.start until l_expressions.after or Result loop expr ?= l_expressions.item check expr_not_void: expr /= Void end Result := expr.has_call l_expressions.forth end end is_constant_expression: BOOLEAN -- Is current array only made of constant expressions? local expr: EXPR_B l_expressions: like expressions do from l_expressions := expressions Result := True l_expressions.start until l_expressions.after or not Result loop expr ?= l_expressions.item check expr_not_void: expr /= Void end Result := expr.is_constant_expression l_expressions.forth end end feature -- Code generation enlarge_tree -- Enlarge the expressions. do expressions.enlarge_tree end enlarged: ARRAY_CONST_BL -- Enlarge node do create Result.make_from_other (Current) Result.enlarge_tree end feature -- Array optimization calls_special_features (array_desc: INTEGER): BOOLEAN do Result := expressions.calls_special_features (array_desc) end is_unsafe: BOOLEAN do Result := expressions.is_unsafe end optimized_byte_node: like Current do Result := Current expressions := expressions.optimized_byte_node end feature -- Inlining size: INTEGER do Result := expressions.size + 1 end pre_inlined_code: like Current do Result := Current expressions := expressions.pre_inlined_code end inlined_byte_code: like Current do Result := Current expressions := expressions.inlined_byte_code end invariant expressions_not_void: expressions /= Void type_not_void: type /= Void special_info_not_void: special_info /= Void note copyright: "Copyright (c) 1984-2013, Eiffel Software" license: "GPL version 2 (see http://www.eiffel.com/licensing/gpl.txt)" licensing_options: "http://www.eiffel.com/licensing" copying: "[ This file is part of Eiffel Software's Eiffel Development Environment. Eiffel Software's Eiffel Development Environment is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2 of the License (available at the URL listed under "license" above). Eiffel Software's Eiffel Development Environment is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Eiffel Software's Eiffel Development Environment; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA ]" source: "[ Eiffel Software 5949 Hollister Ave., Goleta, CA 93117 USA Telephone 805-685-1006, Fax 805-685-6869 Website http://www.eiffel.com Customer support http://support.eiffel.com ]" end