OpenJDK / graal / graal-jvmci-8
changeset 2872:0341b6424579
Project renaming.
line wrap: on
line diff
--- a/graal/GraalCompiler/.checkstyle Wed Jun 08 08:31:38 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<fileset-config file-format-version="1.2.0" simple-config="true"> - <local-check-config name="C1X Checkstyle checks" location=".checkstyle_checks.xml" type="project" description=""> - <additional-data name="protect-config-file" value="false"/> - </local-check-config> - <fileset name="all" enabled="true" check-config-name="C1X Checkstyle checks" local="true"> - <file-match-pattern match-pattern="." include-pattern="true"/> - </fileset> -</fileset-config>
--- a/graal/GraalCompiler/.checkstyle_checks.xml Wed Jun 08 08:31:38 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,191 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN" "http://www.puppycrawl.com/dtds/configuration_1_3.dtd"> - -<!-- - This configuration file was written by the eclipse-cs plugin configuration editor ---> -<!-- - Checkstyle-Configuration: C1X Checkstyle checks - Description: none ---> -<module name="Checker"> - <property name="severity" value="warning"/> - <module name="TreeWalker"> - <property name="tabWidth" value="4"/> - <module name="FileContentsHolder"/> - <module name="JavadocStyle"> - <property name="checkHtml" value="false"/> - </module> - <module name="LocalFinalVariableName"/> - <module name="LocalVariableName"/> - <module name="MemberName"> - <property name="format" value="^(([a-z][a-zA-Z0-9]*$)|(_[A-Z][a-zA-Z0-9]*_[a-z][a-zA-Z0-9]*$))"/> - </module> - <module name="MethodName"> - <property name="format" value="^[a-z][a-z_A-Z0-9]*$"/> - </module> - <module name="PackageName"/> - <module name="ParameterName"/> - <module name="TypeName"> - <property name="format" value="^[A-Z][_a-zA-Z0-9]*$"/> - </module> - <module name="RedundantImport"/> - <module name="LineLength"> - <property name="max" value="250"/> - </module> - <module name="MethodParamPad"/> - <module name="NoWhitespaceAfter"> - <property name="tokens" value="ARRAY_INIT,BNOT,DEC,DOT,INC,LNOT,UNARY_MINUS,UNARY_PLUS"/> - </module> - <module name="NoWhitespaceBefore"> - <property name="tokens" value="SEMI,DOT,POST_DEC,POST_INC"/> - </module> - <module name="ParenPad"/> - <module name="TypecastParenPad"> - <property name="tokens" value="RPAREN,TYPECAST"/> - </module> - <module name="WhitespaceAfter"/> - <module name="WhitespaceAround"> - <property name="tokens" value="ASSIGN,BAND,BAND_ASSIGN,BOR,BOR_ASSIGN,BSR,BSR_ASSIGN,BXOR,BXOR_ASSIGN,COLON,DIV,DIV_ASSIGN,EQUAL,GE,GT,LAND,LE,LITERAL_ASSERT,LITERAL_CATCH,LITERAL_DO,LITERAL_ELSE,LITERAL_FINALLY,LITERAL_FOR,LITERAL_IF,LITERAL_RETURN,LITERAL_SYNCHRONIZED,LITERAL_TRY,LITERAL_WHILE,LOR,LT,MINUS,MINUS_ASSIGN,MOD,MOD_ASSIGN,NOT_EQUAL,PLUS,PLUS_ASSIGN,QUESTION,SL,SLIST,SL_ASSIGN,SR,SR_ASSIGN,STAR,STAR_ASSIGN,LITERAL_ASSERT,TYPE_EXTENSION_AND"/> - </module> - <module name="RedundantModifier"/> - <module name="AvoidNestedBlocks"> - <property name="allowInSwitchCase" value="true"/> - </module> - <module name="EmptyBlock"> - <property name="option" value="text"/> - <property name="tokens" value="LITERAL_DO,LITERAL_ELSE,LITERAL_FINALLY,LITERAL_IF,LITERAL_TRY,LITERAL_WHILE,STATIC_INIT"/> - </module> - <module name="LeftCurly"/> - <module name="NeedBraces"/> - <module name="RightCurly"/> - <module name="DoubleCheckedLocking"> - <property name="severity" value="error"/> - </module> - <module name="EmptyStatement"/> - <module name="HiddenField"> - <property name="severity" value="ignore"/> - <property name="ignoreConstructorParameter" value="true"/> - <metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/> - </module> - <module name="FinalClass"/> - <module name="HideUtilityClassConstructor"> - <property name="severity" value="ignore"/> - <metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/> - </module> - <module name="ArrayTypeStyle"/> - <module name="UpperEll"/> - <module name="FallThrough"/> - <module name="FinalLocalVariable"> - <property name="severity" value="ignore"/> - <metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/> - </module> - <module name="MultipleVariableDeclarations"/> - <module name="StringLiteralEquality"> - <property name="severity" value="error"/> - </module> - <module name="SuperFinalize"/> - <module name="UnnecessaryParentheses"> - <property name="severity" value="ignore"/> - <metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/> - </module> - <module name="Indentation"> - <property name="severity" value="ignore"/> - <metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/> - </module> - <module name="StaticVariableName"> - <property name="format" value="^[A-Za-z][a-zA-Z0-9]*$"/> - </module> - <module name="EmptyForInitializerPad"/> - <module name="EmptyForIteratorPad"/> - <module name="ModifierOrder"/> - <module name="DefaultComesLast"/> - <module name="InnerAssignment"> - <property name="severity" value="ignore"/> - <metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/> - </module> - <module name="JUnitTestCase"/> - <module name="ModifiedControlVariable"/> - <module name="MutableException"/> - <module name="ParameterAssignment"> - <property name="severity" value="ignore"/> - <metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/> - </module> - <module name="RegexpSinglelineJava"> - <property name="format" value="\s$"/> - <property name="message" value="Illegal trailing whitespace(s) at the end of the line."/> - <property name="ignoreComments" value="true"/> - <metadata name="com.atlassw.tools.eclipse.checkstyle.comment" value="Checks for trailing spaces at the end of a line"/> - </module> - <module name="RegexpSinglelineJava"> - <property name="format" value=" ,"/> - <property name="ignoreComments" value="true"/> - <metadata name="com.atlassw.tools.eclipse.checkstyle.customMessage" value="Illegal whitespace before a comma."/> - <metadata name="com.atlassw.tools.eclipse.checkstyle.comment" value="Checks for whitespace before a comma."/> - </module> - </module> - <module name="RegexpHeader"> - <property name="header" value="/\*\n \* Copyright \(c\) (20[0-9][0-9], )?20[0-9][0-9], Oracle and/or its affiliates. All rights reserved.\n \* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.\n \*\n \* This code is free software; you can redistribute it and/or modify it\n \* under the terms of the GNU General Public License version 2 only, as\n \* published by the Free Software Foundation.\n \*\n \* This code is distributed in the hope that it will be useful, but WITHOUT\n \* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\n \* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License\n \* version 2 for more details \(a copy is included in the LICENSE file that\n \* accompanied this code\).\n \*\n \* You should have received a copy of the GNU General Public License version\n \* 2 along with this work; if not, write to the Free Software Foundation,\n \* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.\n \*\n \* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA\n \* or visit www.oracle.com if you need additional information or have any\n \* questions.\n \*/\n"/> - </module> - <module name="FileTabCharacter"> - <property name="severity" value="error"/> - </module> - <module name="NewlineAtEndOfFile"> - <property name="lineSeparator" value="lf"/> - </module> - <module name="Translation"/> - <module name="SuppressionCommentFilter"> - <property name="offCommentFormat" value="Checkstyle: stop constant name check"/> - <property name="onCommentFormat" value="Checkstyle: resume constant name check"/> - <property name="checkFormat" value="ConstantNameCheck"/> - <metadata name="com.atlassw.tools.eclipse.checkstyle.comment" value="Allow non-conforming constant names"/> - </module> - <module name="SuppressionCommentFilter"> - <property name="offCommentFormat" value="Checkstyle: stop method name check"/> - <property name="onCommentFormat" value="Checkstyle: resume method name check"/> - <property name="checkFormat" value="MethodName"/> - <property name="checkC" value="false"/> - <metadata name="com.atlassw.tools.eclipse.checkstyle.comment" value="Disable method name checks"/> - </module> - <module name="SuppressionCommentFilter"> - <property name="offCommentFormat" value="CheckStyle: stop parameter assignment check"/> - <property name="onCommentFormat" value="CheckStyle: resume parameter assignment check"/> - <property name="checkFormat" value="ParameterAssignment"/> - <property name="checkC" value="false"/> - <metadata name="com.atlassw.tools.eclipse.checkstyle.comment" value="Disable Parameter Assignment"/> - </module> - <module name="SuppressionCommentFilter"> - <property name="offCommentFormat" value="Checkstyle: stop final variable check"/> - <property name="onCommentFormat" value="Checkstyle: resume final variable check"/> - <property name="checkFormat" value="FinalLocalVariable"/> - <metadata name="com.atlassw.tools.eclipse.checkstyle.comment" value="Disable final variable checks"/> - </module> - <module name="SuppressionCommentFilter"> - <property name="offCommentFormat" value="Checkstyle: stop"/> - <property name="onCommentFormat" value="Checkstyle: resume"/> - <metadata name="com.atlassw.tools.eclipse.checkstyle.comment" value="Disable all checks"/> - </module> - <module name="SuppressionCommentFilter"> - <property name="offCommentFormat" value="// START GENERATED RAW ASSEMBLER METHODS"/> - <property name="onCommentFormat" value="// END GENERATED RAW ASSEMBLER METHODS"/> - <metadata name="com.atlassw.tools.eclipse.checkstyle.comment" value="Disable all checks for generated raw assembler methods"/> - </module> - <module name="SuppressionCommentFilter"> - <property name="offCommentFormat" value="// START GENERATED LABEL ASSEMBLER METHODS"/> - <property name="onCommentFormat" value="// END GENERATED LABEL ASSEMBLER METHODS"/> - <metadata name="com.atlassw.tools.eclipse.checkstyle.comment" value="Disable all checks for generated label assembler methods"/> - </module> - <module name="SuppressionCommentFilter"> - <property name="offCommentFormat" value="CheckStyle: stop inner assignment check"/> - <property name="onCommentFormat" value="CheckStyle: resume inner assignment check"/> - <property name="checkFormat" value="InnerAssignment"/> - <metadata name="com.atlassw.tools.eclipse.checkstyle.comment" value="Disable inner assignment checks"/> - </module> - <module name="SuppressionCommentFilter"> - <property name="offCommentFormat" value="Checkstyle: stop field name check"/> - <property name="onCommentFormat" value="Checkstyle: resume field name check"/> - <property name="checkFormat" value="MemberName"/> - <property name="checkC" value="false"/> - <metadata name="com.atlassw.tools.eclipse.checkstyle.comment" value="Disable field name checks"/> - </module> -</module>
--- a/graal/GraalCompiler/.classpath Wed Jun 08 08:31:38 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<classpath> - <classpathentry kind="src" path="src"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> - <classpathentry combineaccessrules="false" kind="src" path="/GraalGraph"/> - <classpathentry combineaccessrules="false" kind="src" path="/GraalGraphviz"/> - <classpathentry combineaccessrules="false" kind="src" path="/com.oracle.max.asm"/> - <classpathentry combineaccessrules="false" kind="src" path="/com.oracle.max.cri"/> - <classpathentry kind="output" path="bin"/> -</classpath>
--- a/graal/GraalCompiler/.project Wed Jun 08 08:31:38 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<projectDescription> - <name>GraalCompiler</name> - <comment></comment> - <projects> - </projects> - <buildSpec> - <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>net.sourceforge.metrics.builder</name> - <arguments> - </arguments> - </buildCommand> - <buildCommand> - <name>net.sf.eclipsecs.core.CheckstyleBuilder</name> - <arguments> - </arguments> - </buildCommand> - </buildSpec> - <natures> - <nature>org.eclipse.jdt.core.javanature</nature> - <nature>net.sourceforge.metrics.nature</nature> - <nature>net.sf.eclipsecs.core.CheckstyleNature</nature> - </natures> -</projectDescription>
--- a/graal/GraalCompiler/.settings/JavaSourceCodeFormatting.xml Wed Jun 08 08:31:38 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,264 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<profiles version="11"> -<profile kind="CodeFormatterProfile" name="C1XJavaCodeStyle" version="11"> -<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="end_of_line"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_field" value="0"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line" value="false"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases" value="true"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiple_fields" value="16"/> -<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer" value="16"/> -<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression" value="80"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_after_binary_operator" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.brace_position_for_array_initializer" value="end_of_line"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_package" value="1"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="4"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="16"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk" value="1"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_binary_operator" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_package" value="0"/> -<setting id="org.eclipse.jdt.core.compiler.source" value="1.5"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="true"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" value="16"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_member_type" value="1"/> -<setting id="org.eclipse.jdt.core.formatter.align_type_members_on_columns" value="false"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value="16"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_after_unary_operator" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.comment.indent_parameter_description" value="true"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment" value="false"/> -<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="200"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration" value="1"/> -<setting id="org.eclipse.jdt.core.formatter.indentation.size" value="8"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration" value="16"/> -<setting id="org.eclipse.jdt.core.formatter.alignment_for_assignment" value="0"/> -<setting id="org.eclipse.jdt.core.compiler.problem.assertIdentifier" value="error"/> -<setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="space"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_body" value="true"/> -<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_method" value="1"/> -<setting id="org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line" value="false"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration" value="16"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration" value="end_of_line"/> -<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.brace_position_for_switch" value="end_of_line"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments" value="do not insert"/> -<setting id="org.eclipse.jdt.core.compiler.problem.enumIdentifier" value="error"/> -<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch" value="true"/> -<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block" value="end_of_line"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_ellipsis" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.brace_position_for_method_declaration" value="end_of_line"/> -<setting id="org.eclipse.jdt.core.formatter.compact_else_if" value="true"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_constant" value="end_of_line"/> -<setting id="org.eclipse.jdt.core.formatter.comment.indent_root_tags" value="true"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="4"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment" value="false"/> -<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration" value="16"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.indent_empty_lines" value="false"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case" value="end_of_line"/> -<setting id="org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve" value="1"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression" value="16"/> -<setting id="org.eclipse.jdt.core.compiler.compliance" value="1.5"/> -<setting id="org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer" value="4"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="16"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_unary_operator" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line" value="true"/> -<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line" value="false"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration" value="16"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.alignment_for_binary_expression" value="16"/> -<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration" value="end_of_line"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line" value="true"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant" value="16"/> -<setting id="org.eclipse.jdt.core.formatter.comment.format_javadoc_comments" value="true"/> -<setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="120"/> -<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_import_groups" value="1"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration" value="end_of_line"/> -<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="0"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header" value="true"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.wrap_before_binary_operator" value="false"/> -<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header" value="true"/> -<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations" value="1"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_block" value="true"/> -<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration" value="16"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_if" value="16"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_imports" value="1"/> -<setting id="org.eclipse.jdt.core.formatter.comment.format_html" value="true"/> -<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="16"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.comment.format_source_code" value="true"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" value="16"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="do not insert"/> -<setting id="org.eclipse.jdt.core.compiler.codegen.targetPlatform" value="1.5"/> -<setting id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" value="false"/> -<setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="true"/> -<setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" value="true"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="0"/> -<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header" value="true"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.brace_position_for_type_declaration" value="end_of_line"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_imports" value="1"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header" value="true"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for" value="insert"/> -<setting id="org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column" value="true"/> -<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments" value="do not insert"/> -<setting id="org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column" value="true"/> -<setting id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" value="false"/> -</profile> -</profiles>
--- a/graal/GraalCompiler/.settings/org.eclipse.jdt.core.prefs Wed Jun 08 08:31:38 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,355 +0,0 @@ -#Tue Jul 13 10:33:43 PDT 2010 -eclipse.preferences.version=1 -org.eclipse.jdt.core.codeComplete.argumentPrefixes= -org.eclipse.jdt.core.codeComplete.argumentSuffixes= -org.eclipse.jdt.core.codeComplete.fieldPrefixes= -org.eclipse.jdt.core.codeComplete.fieldSuffixes= -org.eclipse.jdt.core.codeComplete.localPrefixes= -org.eclipse.jdt.core.codeComplete.localSuffixes= -org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= -org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= -org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes= -org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes= -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.autoboxing=ignore -org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning -org.eclipse.jdt.core.compiler.problem.deadCode=ignore -org.eclipse.jdt.core.compiler.problem.deprecation=warning -org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled -org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled -org.eclipse.jdt.core.compiler.problem.discouragedReference=warning -org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore -org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled -org.eclipse.jdt.core.compiler.problem.fieldHiding=warning -org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning -org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning -org.eclipse.jdt.core.compiler.problem.forbiddenReference=error -org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning -org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning -org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore -org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning -org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore -org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning -org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore -org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=error -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=disabled -org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning -org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore -org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning -org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning -org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore -org.eclipse.jdt.core.compiler.problem.nullReference=warning -org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning -org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore -org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning -org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore -org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning -org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning -org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore -org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled -org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning -org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled -org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled -org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore -org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning -org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning -org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore -org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=ignore -org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore -org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning -org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled -org.eclipse.jdt.core.compiler.problem.unusedImport=warning -org.eclipse.jdt.core.compiler.problem.unusedLabel=warning -org.eclipse.jdt.core.compiler.problem.unusedLocal=warning -org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled -org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=ignore -org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning -org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.6 -org.eclipse.jdt.core.formatter.align_type_members_on_columns=false -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_assignment=0 -org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 -org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 -org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 -org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 -org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 -org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 -org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 -org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 -org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 -org.eclipse.jdt.core.formatter.blank_lines_after_package=1 -org.eclipse.jdt.core.formatter.blank_lines_before_field=0 -org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=1 -org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 -org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 -org.eclipse.jdt.core.formatter.blank_lines_before_method=1 -org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 -org.eclipse.jdt.core.formatter.blank_lines_before_package=0 -org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 -org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 -org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false -org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false -org.eclipse.jdt.core.formatter.comment.format_block_comments=true -org.eclipse.jdt.core.formatter.comment.format_header=false -org.eclipse.jdt.core.formatter.comment.format_html=true -org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true -org.eclipse.jdt.core.formatter.comment.format_line_comments=true -org.eclipse.jdt.core.formatter.comment.format_source_code=true -org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true -org.eclipse.jdt.core.formatter.comment.indent_root_tags=true -org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert -org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert -org.eclipse.jdt.core.formatter.comment.line_length=120 -org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true -org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true -org.eclipse.jdt.core.formatter.compact_else_if=true -org.eclipse.jdt.core.formatter.continuation_indentation=4 -org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 -org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off -org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on -org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false -org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true -org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true -org.eclipse.jdt.core.formatter.indent_empty_lines=false -org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true -org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true -org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true -org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true -org.eclipse.jdt.core.formatter.indentation.size=8 -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert -org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=insert -org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert -org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert -org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert -org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert -org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=insert -org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.join_lines_in_comments=true -org.eclipse.jdt.core.formatter.join_wrapped_lines=true -org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false -org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=true -org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false -org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false -org.eclipse.jdt.core.formatter.lineSplit=200 -org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true -org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true -org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 -org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 -org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true -org.eclipse.jdt.core.formatter.tabulation.char=space -org.eclipse.jdt.core.formatter.tabulation.size=4 -org.eclipse.jdt.core.formatter.use_on_off_tags=true -org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false -org.eclipse.jdt.core.formatter.wrap_before_binary_operator=false -org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
--- a/graal/GraalCompiler/.settings/org.eclipse.jdt.ui.prefs Wed Jun 08 08:31:38 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -#Thu Feb 18 11:36:17 PST 2010 -eclipse.preferences.version=1 -editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true -formatter_profile=_MaxineJavaCodeStyle -formatter_settings_version=11 -org.eclipse.jdt.ui.exception.name=e -org.eclipse.jdt.ui.gettersetter.use.is=true -org.eclipse.jdt.ui.ignorelowercasenames=true -org.eclipse.jdt.ui.importorder=java;javax;org;com; -org.eclipse.jdt.ui.keywordthis=false -org.eclipse.jdt.ui.ondemandthreshold=0 -org.eclipse.jdt.ui.overrideannotation=true -org.eclipse.jdt.ui.staticondemandthreshold=0 -sp_cleanup.add_default_serial_version_id=true -sp_cleanup.add_generated_serial_version_id=false -sp_cleanup.add_missing_annotations=false -sp_cleanup.add_missing_deprecated_annotations=true -sp_cleanup.add_missing_methods=false -sp_cleanup.add_missing_nls_tags=false -sp_cleanup.add_missing_override_annotations=true -sp_cleanup.add_serial_version_id=false -sp_cleanup.always_use_blocks=true -sp_cleanup.always_use_parentheses_in_expressions=false -sp_cleanup.always_use_this_for_non_static_field_access=false -sp_cleanup.always_use_this_for_non_static_method_access=false -sp_cleanup.convert_to_enhanced_for_loop=false -sp_cleanup.correct_indentation=false -sp_cleanup.format_source_code=false -sp_cleanup.format_source_code_changes_only=false -sp_cleanup.make_local_variable_final=false -sp_cleanup.make_parameters_final=false -sp_cleanup.make_private_fields_final=true -sp_cleanup.make_type_abstract_if_missing_method=false -sp_cleanup.make_variable_declarations_final=false -sp_cleanup.never_use_blocks=false -sp_cleanup.never_use_parentheses_in_expressions=true -sp_cleanup.on_save_use_additional_actions=true -sp_cleanup.organize_imports=false -sp_cleanup.qualify_static_field_accesses_with_declaring_class=false -sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_with_declaring_class=false -sp_cleanup.qualify_static_method_accesses_with_declaring_class=false -sp_cleanup.remove_private_constructors=true -sp_cleanup.remove_trailing_whitespaces=true -sp_cleanup.remove_trailing_whitespaces_all=true -sp_cleanup.remove_trailing_whitespaces_ignore_empty=false -sp_cleanup.remove_unnecessary_casts=false -sp_cleanup.remove_unnecessary_nls_tags=false -sp_cleanup.remove_unused_imports=false -sp_cleanup.remove_unused_local_variables=false -sp_cleanup.remove_unused_private_fields=true -sp_cleanup.remove_unused_private_members=false -sp_cleanup.remove_unused_private_methods=true -sp_cleanup.remove_unused_private_types=true -sp_cleanup.sort_members=false -sp_cleanup.sort_members_all=false -sp_cleanup.use_blocks=false -sp_cleanup.use_blocks_only_for_return_and_throw=false -sp_cleanup.use_parentheses_in_expressions=false -sp_cleanup.use_this_for_non_static_field_access=false -sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true -sp_cleanup.use_this_for_non_static_method_access=false -sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
--- a/graal/GraalCompiler/LICENSE Wed Jun 08 08:31:38 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,347 +0,0 @@ -The GNU General Public License (GPL) - -Version 2, June 1991 - -Copyright (C) 1989, 1991 Free Software Foundation, Inc. -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -Everyone is permitted to copy and distribute verbatim copies of this license -document, but changing it is not allowed. - -Preamble - -The licenses for most software are designed to take away your freedom to share -and change it. By contrast, the GNU General Public License is intended to -guarantee your freedom to share and change free software--to make sure the -software is free for all its users. This General Public License applies to -most of the Free Software Foundation's software and to any other program whose -authors commit to using it. (Some other Free Software Foundation software is -covered by the GNU Library General Public License instead.) You can apply it to -your programs, too. - -When we speak of free software, we are referring to freedom, not price. Our -General Public Licenses are designed to make sure that you have the freedom to -distribute copies of free software (and charge for this service if you wish), -that you receive source code or can get it if you want it, that you can change -the software or use pieces of it in new free programs; and that you know you -can do these things. - -To protect your rights, we need to make restrictions that forbid anyone to deny -you these rights or to ask you to surrender the rights. These restrictions -translate to certain responsibilities for you if you distribute copies of the -software, or if you modify it. - -For example, if you distribute copies of such a program, whether gratis or for -a fee, you must give the recipients all the rights that you have. You must -make sure that they, too, receive or can get the source code. And you must -show them these terms so they know their rights. - -We protect your rights with two steps: (1) copyright the software, and (2) -offer you this license which gives you legal permission to copy, distribute -and/or modify the software. - -Also, for each author's protection and ours, we want to make certain that -everyone understands that there is no warranty for this free software. If the -software is modified by someone else and passed on, we want its recipients to -know that what they have is not the original, so that any problems introduced -by others will not reflect on the original authors' reputations. - -Finally, any free program is threatened constantly by software patents. We -wish to avoid the danger that redistributors of a free program will -individually obtain patent licenses, in effect making the program proprietary. -To prevent this, we have made it clear that any patent must be licensed for -everyone's free use or not licensed at all. - -The precise terms and conditions for copying, distribution and modification -follow. - -TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - -0. This License applies to any program or other work which contains a notice -placed by the copyright holder saying it may be distributed under the terms of -this General Public License. The "Program", below, refers to any such program -or work, and a "work based on the Program" means either the Program or any -derivative work under copyright law: that is to say, a work containing the -Program or a portion of it, either verbatim or with modifications and/or -translated into another language. (Hereinafter, translation is included -without limitation in the term "modification".) Each licensee is addressed as -"you". - -Activities other than copying, distribution and modification are not covered by -this License; they are outside its scope. The act of running the Program is -not restricted, and the output from the Program is covered only if its contents -constitute a work based on the Program (independent of having been made by -running the Program). Whether that is true depends on what the Program does. - -1. You may copy and distribute verbatim copies of the Program's source code as -you receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice and -disclaimer of warranty; keep intact all the notices that refer to this License -and to the absence of any warranty; and give any other recipients of the -Program a copy of this License along with the Program. - -You may charge a fee for the physical act of transferring a copy, and you may -at your option offer warranty protection in exchange for a fee. - -2. You may modify your copy or copies of the Program or any portion of it, thus -forming a work based on the Program, and copy and distribute such modifications -or work under the terms of Section 1 above, provided that you also meet all of -these conditions: - - a) You must cause the modified files to carry prominent notices stating - that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in whole or - in part contains or is derived from the Program or any part thereof, to be - licensed as a whole at no charge to all third parties under the terms of - this License. - - c) If the modified program normally reads commands interactively when run, - you must cause it, when started running for such interactive use in the - most ordinary way, to print or display an announcement including an - appropriate copyright notice and a notice that there is no warranty (or - else, saying that you provide a warranty) and that users may redistribute - the program under these conditions, and telling the user how to view a copy - of this License. (Exception: if the Program itself is interactive but does - not normally print such an announcement, your work based on the Program is - not required to print an announcement.) - -These requirements apply to the modified work as a whole. If identifiable -sections of that work are not derived from the Program, and can be reasonably -considered independent and separate works in themselves, then this License, and -its terms, do not apply to those sections when you distribute them as separate -works. But when you distribute the same sections as part of a whole which is a -work based on the Program, the distribution of the whole must be on the terms -of this License, whose permissions for other licensees extend to the entire -whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest your -rights to work written entirely by you; rather, the intent is to exercise the -right to control the distribution of derivative or collective works based on -the Program. - -In addition, mere aggregation of another work not based on the Program with the -Program (or with a work based on the Program) on a volume of a storage or -distribution medium does not bring the other work under the scope of this -License. - -3. You may copy and distribute the Program (or a work based on it, under -Section 2) in object code or executable form under the terms of Sections 1 and -2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable source - code, which must be distributed under the terms of Sections 1 and 2 above - on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three years, to - give any third party, for a charge no more than your cost of physically - performing source distribution, a complete machine-readable copy of the - corresponding source code, to be distributed under the terms of Sections 1 - and 2 above on a medium customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer to - distribute corresponding source code. (This alternative is allowed only - for noncommercial distribution and only if you received the program in - object code or executable form with such an offer, in accord with - Subsection b above.) - -The source code for a work means the preferred form of the work for making -modifications to it. For an executable work, complete source code means all -the source code for all modules it contains, plus any associated interface -definition files, plus the scripts used to control compilation and installation -of the executable. However, as a special exception, the source code -distributed need not include anything that is normally distributed (in either -source or binary form) with the major components (compiler, kernel, and so on) -of the operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the source -code from the same place counts as distribution of the source code, even though -third parties are not compelled to copy the source along with the object code. - -4. You may not copy, modify, sublicense, or distribute the Program except as -expressly provided under this License. Any attempt otherwise to copy, modify, -sublicense or distribute the Program is void, and will automatically terminate -your rights under this License. However, parties who have received copies, or -rights, from you under this License will not have their licenses terminated so -long as such parties remain in full compliance. - -5. You are not required to accept this License, since you have not signed it. -However, nothing else grants you permission to modify or distribute the Program -or its derivative works. These actions are prohibited by law if you do not -accept this License. Therefore, by modifying or distributing the Program (or -any work based on the Program), you indicate your acceptance of this License to -do so, and all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - -6. Each time you redistribute the Program (or any work based on the Program), -the recipient automatically receives a license from the original licensor to -copy, distribute or modify the Program subject to these terms and conditions. -You may not impose any further restrictions on the recipients' exercise of the -rights granted herein. You are not responsible for enforcing compliance by -third parties to this License. - -7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), conditions -are imposed on you (whether by court order, agreement or otherwise) that -contradict the conditions of this License, they do not excuse you from the -conditions of this License. If you cannot distribute so as to satisfy -simultaneously your obligations under this License and any other pertinent -obligations, then as a consequence you may not distribute the Program at all. -For example, if a patent license would not permit royalty-free redistribution -of the Program by all those who receive copies directly or indirectly through -you, then the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply and -the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any patents or -other property right claims or to contest validity of any such claims; this -section has the sole purpose of protecting the integrity of the free software -distribution system, which is implemented by public license practices. Many -people have made generous contributions to the wide range of software -distributed through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing to -distribute software through any other system and a licensee cannot impose that -choice. - -This section is intended to make thoroughly clear what is believed to be a -consequence of the rest of this License. - -8. If the distribution and/or use of the Program is restricted in certain -countries either by patents or by copyrighted interfaces, the original -copyright holder who places the Program under this License may add an explicit -geographical distribution limitation excluding those countries, so that -distribution is permitted only in or among countries not thus excluded. In -such case, this License incorporates the limitation as if written in the body -of this License. - -9. The Free Software Foundation may publish revised and/or new versions of the -General Public License from time to time. Such new versions will be similar in -spirit to the present version, but may differ in detail to address new problems -or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any later -version", you have the option of following the terms and conditions either of -that version or of any later version published by the Free Software Foundation. -If the Program does not specify a version number of this License, you may -choose any version ever published by the Free Software Foundation. - -10. If you wish to incorporate parts of the Program into other free programs -whose distribution conditions are different, write to the author to ask for -permission. For software which is copyrighted by the Free Software Foundation, -write to the Free Software Foundation; we sometimes make exceptions for this. -Our decision will be guided by the two goals of preserving the free status of -all derivatives of our free software and of promoting the sharing and reuse of -software generally. - -NO WARRANTY - -11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR -THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE -STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE -PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, -INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND -PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, -YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - -12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL -ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE -PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR -INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA -BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER -OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -END OF TERMS AND CONDITIONS - -How to Apply These Terms to Your New Programs - -If you develop a new program, and you want it to be of the greatest possible -use to the public, the best way to achieve this is to make it free software -which everyone can redistribute and change under these terms. - -To do so, attach the following notices to the program. It is safest to attach -them to the start of each source file to most effectively convey the exclusion -of warranty; and each file should have at least the "copyright" line and a -pointer to where the full notice is found. - - One line to give the program's name and a brief idea of what it does. - - Copyright (C) <year> <name of author> - - This program 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; either version 2 of the License, or (at your option) - any later version. - - This program 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 this program; if not, write to the Free Software Foundation, Inc., 59 - Temple Place, Suite 330, Boston, MA 02111-1307 USA - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this when it -starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author Gnomovision comes - with ABSOLUTELY NO WARRANTY; for details type 'show w'. This is free - software, and you are welcome to redistribute it under certain conditions; - type 'show c' for details. - -The hypothetical commands 'show w' and 'show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may be -called something other than 'show w' and 'show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your school, -if any, to sign a "copyright disclaimer" for the program, if necessary. Here -is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - 'Gnomovision' (which makes passes at compilers) written by James Hacker. - - signature of Ty Coon, 1 April 1989 - - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General Public -License instead of this License. - - -"CLASSPATH" EXCEPTION TO THE GPL - -Certain source files distributed by Sun Microsystems, Inc. are subject to -the following clarification and special exception to the GPL, but only where -Sun has expressly included in the particular source file's header the words -"Sun designates this particular file as subject to the "Classpath" exception -as provided by Sun in the LICENSE file that accompanied this code." - - Linking this library statically or dynamically with other modules is making - a combined work based on this library. Thus, the terms and conditions of - the GNU General Public License cover the whole combination. - - As a special exception, the copyright holders of this library give you - permission to link this library with independent modules to produce an - executable, regardless of the license terms of these independent modules, - and to copy and distribute the resulting executable under terms of your - choice, provided that you also meet, for each linked independent module, - the terms and conditions of the license of that module. An independent - module is a module which is not derived from or based on this library. If - you modify this library, you may extend this exception to your version of - the library, but you are not obligated to do so. If you do not wish to do - so, delete this exception statement from your version.
--- a/graal/GraalCompiler/src/com/oracle/max/graal/opt/CanonicalizerPhase.java Wed Jun 08 08:31:38 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code 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 - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.max.graal.opt; - -import java.util.*; - -import com.oracle.graal.graph.*; -import com.sun.c1x.*; - -public class CanonicalizerPhase extends Phase { - - - @Override - protected void run(Graph graph) { - NodeBitMap visited = graph.createNodeBitMap(); - List<Node> nodes = new ArrayList<Node>(graph.getNodes()); - for (Node n : nodes) { - if (n == null) { - continue; - } - if (!visited.isMarked(n)) { - this.canonicalize(n, visited); - } - } - } - - private void canonicalize(Node n, NodeBitMap visited) { - visited.mark(n); - for (Node input : n.inputs()) { - if (input == null) { - continue; - } - if (!visited.isNew(input) && !visited.isMarked(input)) { - canonicalize(input, visited); - } - } - - CanonicalizerOp op = n.lookup(CanonicalizerOp.class); - if (op != null) { - Node canonical = op.canonical(n); - if (canonical != n) { - n.replace(canonical); - C1XMetrics.NodesCanonicalized++; - } - } - } - - public interface CanonicalizerOp extends Op { - Node canonical(Node node); - } -}
--- a/graal/GraalCompiler/src/com/oracle/max/graal/schedule/Block.java Wed Jun 08 08:31:38 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,132 +0,0 @@ -/* - * Copyright (c) 2011, 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code 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 - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.max.graal.schedule; - -import java.util.*; - -import com.oracle.graal.graph.*; -import com.sun.c1x.ir.*; - - -public class Block { - - private int blockID; - private final List<Block> successors = new ArrayList<Block>(); - private final List<Block> predecessors = new ArrayList<Block>(); - private List<Node> instructions = new ArrayList<Node>(); - private Block dominator; - private final List<Block> dominators = new ArrayList<Block>(); - - private Node firstNode; - private Node lastNode; - - public Node firstNode() { - return firstNode; - } - - public void setFirstNode(Node node) { - this.firstNode = node; - } - - public Node lastNode() { - return lastNode; - } - - public void setLastNode(Node node) { - this.lastNode = node; - } - - public List<Block> getSuccessors() { - return Collections.unmodifiableList(successors); - } - - public void setDominator(Block dominator) { - assert this.dominator == null; - assert dominator != null; - this.dominator = dominator; - dominator.dominators.add(this); - } - - public List<Block> getDominators() { - return Collections.unmodifiableList(dominators); - } - - public List<Node> getInstructions() { - return instructions; - } - - public List<Block> getPredecessors() { - return Collections.unmodifiableList(predecessors); - } - - public Block(int blockID) { - this.blockID = blockID; - } - - public void addSuccessor(Block other) { - successors.add(other); - other.predecessors.add(this); - } - - public int blockID() { - return blockID; - } - - /** - * Iterate over this block, its exception handlers, and its successors, in that order. - * - * @param closure the closure to apply to each block - */ - public void iteratePreOrder(BlockClosure closure) { - // XXX: identity hash map might be too slow, consider a boolean array or a mark field - iterate(new IdentityHashMap<Block, Block>(), closure); - } - - private void iterate(IdentityHashMap<Block, Block> mark, BlockClosure closure) { - if (!mark.containsKey(this)) { - mark.put(this, this); - closure.apply(this); - - iterateReverse(mark, closure, this.successors); - } - } - - private void iterateReverse(IdentityHashMap<Block, Block> mark, BlockClosure closure, List<Block> list) { - for (int i = list.size() - 1; i >= 0; i--) { - list.get(i).iterate(mark, closure); - } - } - - @Override - public String toString() { - return "B" + blockID; - } - - public Block dominator() { - return dominator; - } - - public void setInstructions(List<Node> instructions) { - this.instructions = instructions; - } -}
--- a/graal/GraalCompiler/src/com/oracle/max/graal/schedule/Schedule.java Wed Jun 08 08:31:38 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,463 +0,0 @@ -/* - * Copyright (c) 2011, 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code 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 - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.max.graal.schedule; - -import java.util.*; - -import com.oracle.graal.graph.*; -import com.sun.c1x.debug.*; -import com.sun.c1x.ir.*; -import com.sun.c1x.value.*; -import com.sun.cri.ci.*; - - -public class Schedule { - private final List<Block> blocks = new ArrayList<Block>(); - private final NodeMap<Block> nodeToBlock; - private final Graph graph; - - public Schedule(Graph graph) { - this.graph = graph; - nodeToBlock = graph.createNodeMap(); - identifyBlocks(); - } - public List<Block> getBlocks() { - return Collections.unmodifiableList(blocks); - } - - public NodeMap<Block> getNodeToBlock() { - return nodeToBlock; - } - - private Block createBlock() { - Block b = new Block(blocks.size()); - blocks.add(b); - return b; - } - - private Block assignBlock(Node n) { - Block curBlock = nodeToBlock.get(n); - if (curBlock == null) { - curBlock = createBlock(); - return assignBlock(n, curBlock); - } - return curBlock; - } - - - private Block assignBlock(Node n, Block b) { - assert nodeToBlock.get(n) == null; - nodeToBlock.set(n, b); - if (b.firstNode() == null) { - b.setFirstNode(n); - b.setLastNode(n); - } else { - if (b.lastNode() != null) { - b.getInstructions().add(b.lastNode()); - } - b.setLastNode(n); - } - b.setLastNode(n); - return b; - } - - public static boolean isFixed(Node n) { - return n != null && ((n instanceof FixedNode) || n == n.graph().start()); - } - - public static boolean isBlockEnd(Node n) { - return trueSuccessorCount(n) > 1 || n instanceof Anchor || n instanceof Return || n instanceof Unwind; - } - - private void identifyBlocks() { - // Identify blocks. - final ArrayList<Node> blockBeginNodes = new ArrayList<Node>(); - NodeIterator.iterate(EdgeType.SUCCESSORS, graph.start(), null, new NodeVisitor() { - @Override - public boolean visit(Node n) { - if (!isFixed(n)) { - return false; - } - - if (n instanceof LoopBegin) { - // a LoopBegin is always a merge - assignBlock(n); - blockBeginNodes.add(n); - return true; - } - - Node singlePred = null; - for (Node pred : n.predecessors()) { - if (isFixed(pred)) { - if (singlePred == null) { - singlePred = pred; - } else { - // We have more than one predecessor => we are a merge block. - assignBlock(n); - blockBeginNodes.add(n); - return true; - } - } - } - - if (singlePred == null) { - // We have no predecessor => we are the start block. - assignBlock(n); - blockBeginNodes.add(n); - } else { - // We have a single predecessor => check its successor count. - if (isBlockEnd(singlePred)) { - Block b = assignBlock(n); - blockBeginNodes.add(n); - } else { - assignBlock(n, nodeToBlock.get(singlePred)); - } - } - return true; - }} - ); - - // Connect blocks. - for (Node n : blockBeginNodes) { - Block block = nodeToBlock.get(n); - for (Node pred : n.predecessors()) { - if (isFixed(pred)) { - Block predBlock = nodeToBlock.get(pred); - predBlock.addSuccessor(block); - } - } - - if (n instanceof Merge) { - for (Node usage : n.usages()) { - if (usage instanceof Phi) { - nodeToBlock.set(usage, block); - } - } - } - } - - for (Node n : graph.getNodes()) { - if (n instanceof FrameState) { - FrameState f = (FrameState) n; - if (f.predecessors().size() == 1) { - Block predBlock = nodeToBlock.get(f.predecessors().get(0)); - assert predBlock != null; - nodeToBlock.set(f, predBlock); - predBlock.getInstructions().add(f); - } else { - assert f.predecessors().size() == 0; - } - } - } - - computeDominators(); - - - - // Add successors of loop end nodes. Makes the graph cyclic. - for (Node n : blockBeginNodes) { - Block block = nodeToBlock.get(n); - if (n instanceof LoopBegin) { - LoopBegin loopBegin = (LoopBegin) n; - nodeToBlock.get(loopBegin.loopEnd()).addSuccessor(block); - } - } - - assignLatestPossibleBlockToNodes(); - sortNodesWithinBlocks(); - - //print(); - } - - private void assignLatestPossibleBlockToNodes() { - for (Node n : graph.getNodes()) { - assignLatestPossibleBlockToNode(n); - } - } - - private Block assignLatestPossibleBlockToNode(Node n) { - if (n == null) { - return null; - } - - Block prevBlock = nodeToBlock.get(n); - if (prevBlock != null) { - return prevBlock; - } - - Block block = null; - for (Node succ : n.successors()) { - block = getCommonDominator(block, assignLatestPossibleBlockToNode(succ)); - } - for (Node usage : n.usages()) { - if (usage instanceof Phi) { - Phi phi = (Phi) usage; - Merge merge = phi.block(); - Block mergeBlock = nodeToBlock.get(merge); - assert mergeBlock != null; - for (int i = 0; i < phi.valueCount(); ++i) { - if (phi.valueAt(i) == n) { - if (mergeBlock.getPredecessors().size() == 0) { - TTY.println(merge.toString()); - TTY.println(phi.toString()); - TTY.println(merge.predecessors().toString()); - TTY.println("value count: " + phi.valueCount()); - } - block = getCommonDominator(block, mergeBlock.getPredecessors().get(i)); - } - } - } else if (usage instanceof FrameState && ((FrameState) usage).block() != null) { - Merge merge = ((FrameState) usage).block(); - for (Node pred : merge.predecessors()) { - if (isFixed(pred)) { - block = getCommonDominator(block, nodeToBlock.get(pred)); - } - } - } else { - block = getCommonDominator(block, assignLatestPossibleBlockToNode(usage)); - } - } - - nodeToBlock.set(n, block); - if (block != null) { - block.getInstructions().add(n); - } - return block; - } - - private Block getCommonDominator(Block a, Block b) { - if (a == null) { - return b; - } - if (b == null) { - return a; - } - return commonDominator(a, b); - } - - private void sortNodesWithinBlocks() { - NodeBitMap map = graph.createNodeBitMap(); - for (Block b : blocks) { - sortNodesWithinBlocks(b, map); - } - } - - private void sortNodesWithinBlocks(Block b, NodeBitMap map) { - List<Node> instructions = b.getInstructions(); - List<Node> sortedInstructions = new ArrayList<Node>(); - assert !map.isMarked(b.firstNode()) && nodeToBlock.get(b.firstNode()) == b; - - boolean scheduleFirst = true; - - if (b.firstNode() == b.lastNode()) { - Node node = b.firstNode(); - if (!(node instanceof Merge)) { - scheduleFirst = false; - } - } - if (scheduleFirst) { - addToSorting(b, b.firstNode(), sortedInstructions, map); - } - for (Node i : instructions) { - addToSorting(b, i, sortedInstructions, map); - } - addToSorting(b, b.lastNode(), sortedInstructions, map); - //assert b.firstNode() == sortedInstructions.get(0) : b.firstNode(); - // assert b.lastNode() == sortedInstructions.get(sortedInstructions.size() - 1); - b.setInstructions(sortedInstructions); -// TTY.println("Block " + b); -// for (Node n : sortedInstructions) { -// TTY.println("Node: " + n); -// } - } - - private void addToSorting(Block b, Node i, List<Node> sortedInstructions, NodeBitMap map) { - if (i == null || map.isMarked(i) || nodeToBlock.get(i) != b || i instanceof Phi || i instanceof Local) { - return; - } - - for (Node input : i.inputs()) { - addToSorting(b, input, sortedInstructions, map); - } - - for (Node pred : i.predecessors()) { - addToSorting(b, pred, sortedInstructions, map); - } - - map.mark(i); - - for (Node succ : i.successors()) { - if (succ instanceof FrameState) { - addToSorting(b, succ, sortedInstructions, map); - } - } - - // Now predecessors and inputs are scheduled => we can add this node. - if (!(i instanceof FrameState)) { - sortedInstructions.add(i); - } - } - - private void computeDominators() { - Block dominatorRoot = nodeToBlock.get(graph.start()); - assert dominatorRoot.getPredecessors().size() == 0; - CiBitMap visited = new CiBitMap(blocks.size()); - visited.set(dominatorRoot.blockID()); - LinkedList<Block> workList = new LinkedList<Block>(); - workList.add(dominatorRoot); - - while (!workList.isEmpty()) { - Block b = workList.remove(); - - List<Block> predecessors = b.getPredecessors(); - if (predecessors.size() == 1) { - b.setDominator(predecessors.get(0)); - } else if (predecessors.size() > 0) { - boolean delay = false; - for (Block pred : predecessors) { - if (pred != dominatorRoot && pred.dominator() == null) { - delay = true; - break; - } - } - - if (delay) { - workList.add(b); - continue; - } - - Block dominator = null; - for (Block pred : predecessors) { - if (dominator == null) { - dominator = pred; - } else { - dominator = commonDominator(dominator, pred); - } - } - b.setDominator(dominator); - } - - for (Block succ : b.getSuccessors()) { - if (!visited.get(succ.blockID())) { - visited.set(succ.blockID()); - workList.add(succ); - } - } - } - } - - public Block commonDominator(Block a, Block b) { - CiBitMap bitMap = new CiBitMap(blocks.size()); - Block cur = a; - while (cur != null) { - bitMap.set(cur.blockID()); - cur = cur.dominator(); - } - - cur = b; - while (cur != null) { - if (bitMap.get(cur.blockID())) { - return cur; - } - cur = cur.dominator(); - } - - print(); - assert false : "no common dominator between " + a + " and " + b; - return null; - } - - private void print() { - TTY.println("============================================"); - TTY.println("%d blocks", blocks.size()); - - for (Block b : blocks) { - TTY.println(); - TTY.print(b.toString()); - - TTY.print(" succs="); - for (Block succ : b.getSuccessors()) { - TTY.print(succ + ";"); - } - - TTY.print(" preds="); - for (Block pred : b.getPredecessors()) { - TTY.print(pred + ";"); - } - - if (b.dominator() != null) { - TTY.print(" dom=" + b.dominator()); - } - TTY.println(); - - if (b.getInstructions().size() > 0) { - TTY.print("first instr: " + b.getInstructions().get(0)); - TTY.print("last instr: " + b.getInstructions().get(b.getInstructions().size() - 1)); - } - } - -/* - TTY.println("============================================"); - TTY.println("%d nodes", nodeToBlock.size()); - for (Node n : graph.getNodes()) { - if (n != null) { - TTY.print("Node %d: %s", n.id(), n.getClass().toString()); - Block curBlock = nodeToBlock.get(n); - if (curBlock != null) { - TTY.print(" %s", curBlock); - } - TTY.println(); - } - }*/ - } - - public static int trueSuccessorCount(Node n) { - if (n == null) { - return 0; - } - int i = 0; - for (Node s : n.successors()) { - if (isFixed(s)) { - i++; - } - } - return i; - } - - public static int truePredecessorCount(Node n) { - if (n == null) { - return 0; - } - int i = 0; - for (Node s : n.predecessors()) { - if (isFixed(s)) { - i++; - } - } - - if (n instanceof LoopBegin) { - i++; - } - return i; - } -}
--- a/graal/GraalCompiler/src/com/sun/c1x/C1XCompilation.java Wed Jun 08 08:31:38 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,310 +0,0 @@ -/* - * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code 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 - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.c1x; - -import java.util.*; - -import com.oracle.max.asm.*; -import com.sun.c1x.alloc.*; -import com.sun.c1x.asm.*; -import com.sun.c1x.debug.*; -import com.sun.c1x.gen.*; -import com.sun.c1x.gen.LIRGenerator.DeoptimizationStub; -import com.sun.c1x.graph.*; -import com.sun.c1x.lir.*; -import com.sun.c1x.observer.*; -import com.sun.c1x.value.*; -import com.sun.cri.ci.*; -import com.sun.cri.ri.*; - -/** - * This class encapsulates global information about the compilation of a particular method, - * including a reference to the runtime, statistics about the compiled code, etc. - */ -public final class C1XCompilation { - - private static ThreadLocal<C1XCompilation> currentCompilation = new ThreadLocal<C1XCompilation>(); - - public final C1XCompiler compiler; - public final CiTarget target; - public final RiRuntime runtime; - public final RiMethod method; - public final RiRegisterConfig registerConfig; - public final CiStatistics stats; - public final CiAssumptions assumptions = new CiAssumptions(); - public final FrameState placeholderState; - - public CompilerGraph graph = new CompilerGraph(); - - private boolean hasExceptionHandlers; - private final C1XCompilation parent; - - /** - * @see #setNotTypesafe() - * @see #isTypesafe() - */ - private boolean typesafe = true; - - private int nextID = 1; - - private FrameMap frameMap; - private TargetMethodAssembler assembler; - - private IR hir; - - private LIRGenerator lirGenerator; - - /** - * Creates a new compilation for the specified method and runtime. - * - * @param compiler the compiler - * @param method the method to be compiled or {@code null} if generating code for a stub - * @param osrBCI the bytecode index for on-stack replacement, if requested - * @param stats externally supplied statistics object to be used if not {@code null} - */ - public C1XCompilation(C1XCompiler compiler, RiMethod method, int osrBCI, CiStatistics stats) { - if (osrBCI != -1) { - throw new CiBailout("No OSR supported"); - } - this.parent = currentCompilation.get(); - currentCompilation.set(this); - this.compiler = compiler; - this.target = compiler.target; - this.runtime = compiler.runtime; - this.method = method; - this.stats = stats == null ? new CiStatistics() : stats; - this.registerConfig = method == null ? compiler.globalStubRegisterConfig : runtime.getRegisterConfig(method); - this.placeholderState = method != null && method.minimalDebugInfo() ? new FrameState(method, 0, 0, 0, 0, graph) : null; - - if (compiler.isObserved()) { - compiler.fireCompilationStarted(new CompilationEvent(this)); - } - } - - public void close() { - currentCompilation.set(parent); - } - - public IR hir() { - return hir; - } - - /** - * Records that this compilation has exception handlers. - */ - public void setHasExceptionHandlers() { - hasExceptionHandlers = true; - } - - /** - * Translates a given kind to a canonical architecture kind. - * This is an identity function for all but {@link CiKind#Word} - * which is translated to {@link CiKind#Int} or {@link CiKind#Long} - * depending on whether or not this is a {@linkplain #is64Bit() 64-bit} - * compilation. - */ - public CiKind archKind(CiKind kind) { - if (kind.isWord()) { - return target.arch.is64bit() ? CiKind.Long : CiKind.Int; - } - return kind; - } - - /** - * Determines if two given kinds are equal at the {@linkplain #archKind(CiKind) architecture} level. - */ - public boolean archKindsEqual(CiKind kind1, CiKind kind2) { - return archKind(kind1) == archKind(kind2); - } - - /** - * Records an assumption that the specified type has no finalizable subclasses. - * - * @param receiverType the type that is assumed to have no finalizable subclasses - * @return {@code true} if the assumption was recorded and can be assumed; {@code false} otherwise - */ - public boolean recordNoFinalizableSubclassAssumption(RiType receiverType) { - return false; - } - - /** - * Converts this compilation to a string. - * - * @return a string representation of this compilation - */ - @Override - public String toString() { - return "compile: " + method; - } - - /** - * Builds the block map for the specified method. - * - * @param method the method for which to build the block map - * @param osrBCI the OSR bytecode index; {@code -1} if this is not an OSR - * @return the block map for the specified method - */ - public BlockMap getBlockMap(RiMethod method) { - BlockMap map = new BlockMap(method); - map.build(); - if (compiler.isObserved()) { - String label = CiUtil.format("BlockListBuilder %f %r %H.%n(%p)", method, true); - compiler.fireCompilationEvent(new CompilationEvent(this, label, map, method.code().length)); - } - stats.bytecodeCount += method.code().length; - return map; - } - - /** - * Returns the frame map of this compilation. - * @return the frame map - */ - public FrameMap frameMap() { - return frameMap; - } - - public TargetMethodAssembler assembler() { - if (assembler == null) { - AbstractAssembler asm = compiler.backend.newAssembler(registerConfig); - assembler = new TargetMethodAssembler(asm); - assembler.setFrameSize(frameMap.frameSize()); - assembler.targetMethod.setCustomStackAreaOffset(frameMap.offsetToCustomArea()); - } - return assembler; - } - - public boolean hasExceptionHandlers() { - return hasExceptionHandlers; - } - - public CiResult compile() { - CiTargetMethod targetMethod; - try { - emitHIR(); - emitLIR(); - targetMethod = emitCode(); - - if (C1XOptions.PrintMetrics) { - C1XMetrics.BytecodesCompiled += method.code().length; - } - } catch (CiBailout b) { - return new CiResult(null, b, stats); - } catch (Throwable t) { - if (C1XOptions.BailoutOnException) { - return new CiResult(null, new CiBailout("Exception while compiling: " + method, t), stats); - } else { - throw new RuntimeException(t); - } - } finally { - if (compiler.isObserved()) { - compiler.fireCompilationFinished(new CompilationEvent(this)); - } - } - - return new CiResult(targetMethod, null, stats); - } - - public IR emitHIR() { - hir = new IR(this); - hir.build(); - return hir; - } - - public void initFrameMap(int numberOfLocks) { - frameMap = this.compiler.backend.newFrameMap(method, numberOfLocks); - } - - private void emitLIR() { - if (C1XOptions.GenLIR) { - if (C1XOptions.PrintTimers) { - C1XTimers.LIR_CREATE.start(); - } - - initFrameMap(hir.maxLocks()); - - lirGenerator = compiler.backend.newLIRGenerator(this); - - for (LIRBlock begin : hir.linearScanOrder()) { - lirGenerator.doBlock(begin); - } - - if (C1XOptions.PrintTimers) { - C1XTimers.LIR_CREATE.stop(); - } - - if (C1XOptions.PrintLIR && !TTY.isSuppressed()) { - LIRList.printLIR(hir.linearScanOrder()); - } - - new LinearScan(this, hir, lirGenerator, frameMap()).allocate(); - } - } - - private CiTargetMethod emitCode() { - if (C1XOptions.GenLIR && C1XOptions.GenCode) { - final LIRAssembler lirAssembler = compiler.backend.newLIRAssembler(this); - lirAssembler.emitCode(hir.linearScanOrder()); - - // generate code for slow cases - lirAssembler.emitLocalStubs(); - - // generate deoptimization stubs - ArrayList<DeoptimizationStub> deoptimizationStubs = lirGenerator.deoptimizationStubs(); - if (deoptimizationStubs != null) { - for (DeoptimizationStub stub : deoptimizationStubs) { - lirAssembler.emitDeoptizationStub(stub); - } - } - - // generate traps at the end of the method - lirAssembler.emitTraps(); - - CiTargetMethod targetMethod = assembler().finishTargetMethod(method, runtime, lirAssembler.registerRestoreEpilogueOffset, false); - if (assumptions.count() > 0) { - targetMethod.setAssumptions(assumptions); - } - - if (compiler.isObserved()) { - compiler.fireCompilationEvent(new CompilationEvent(this, "After code generation", graph, false, true, targetMethod)); - } - - if (C1XOptions.PrintTimers) { - C1XTimers.CODE_CREATE.stop(); - } - return targetMethod; - } - - return null; - } - - public int nextID() { - return nextID++; - } - - public static C1XCompilation compilation() { - C1XCompilation compilation = currentCompilation.get(); - assert compilation != null; - return compilation; - } -}
--- a/graal/GraalCompiler/src/com/sun/c1x/C1XCompiler.java Wed Jun 08 08:31:38 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,167 +0,0 @@ -/* - * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code 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 - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.sun.c1x; - -import java.util.*; - -import com.sun.c1x.debug.*; -import com.sun.c1x.globalstub.*; -import com.sun.c1x.observer.*; -import com.sun.c1x.target.*; -import com.sun.cri.ci.*; -import com.sun.cri.ri.*; -import com.sun.cri.xir.*; - -/** - * This class implements the compiler interface for C1X. - * - * @author Thomas Wuerthinger - * @author Ben L. Titzer - */ -public class C1XCompiler extends ObservableCompiler { - - public final Map<Object, GlobalStub> stubs = new HashMap<Object, GlobalStub>(); - - /** - * The target that this compiler has been configured for. - */ - public final CiTarget target; - - /** - * The runtime that this compiler has been configured for. - */ - public final RiRuntime runtime; - - /** - * The XIR generator that lowers Java operations to machine operations. - */ - public final RiXirGenerator xir; - - /** - * The backend that this compiler has been configured for. - */ - public final Backend backend; - - public final RiRegisterConfig globalStubRegisterConfig; - - public C1XCompiler(RiRuntime runtime, CiTarget target, RiXirGenerator xirGen, RiRegisterConfig globalStubRegisterConfig) { - this.runtime = runtime; - this.target = target; - this.xir = xirGen; - this.globalStubRegisterConfig = globalStubRegisterConfig; - this.backend = Backend.create(target.arch, this); - init(); - } - - public CiResult compileMethod(RiMethod method, int osrBCI, RiXirGenerator xirGenerator, CiStatistics stats) { - long startTime = 0; - int index = C1XMetrics.CompiledMethods++; - if (C1XOptions.PrintCompilation) { - TTY.print(String.format("C1X %4d %-70s %-45s | ", index, method.holder().name(), method.name())); - startTime = System.nanoTime(); - } - - CiResult result = null; - TTY.Filter filter = new TTY.Filter(C1XOptions.PrintFilter, method); - C1XCompilation compilation = new C1XCompilation(this, method, osrBCI, stats); - try { - result = compilation.compile(); - } finally { - filter.remove(); - compilation.close(); - if (C1XOptions.PrintCompilation && !TTY.isSuppressed()) { - long time = (System.nanoTime() - startTime) / 100000; - TTY.println(String.format("%3d.%dms", time / 10, time % 10)); - } - } - - return result; - } - - private void init() { - final List<XirTemplate> xirTemplateStubs = xir.buildTemplates(backend.newXirAssembler()); - final GlobalStubEmitter emitter = backend.newGlobalStubEmitter(); - - if (xirTemplateStubs != null) { - for (XirTemplate template : xirTemplateStubs) { - TTY.Filter filter = new TTY.Filter(C1XOptions.PrintFilter, template.name); - try { - stubs.put(template, emitter.emit(template, runtime)); - } finally { - filter.remove(); - } - } - } - - for (GlobalStub.Id id : GlobalStub.Id.values()) { - TTY.Filter suppressor = new TTY.Filter(C1XOptions.PrintFilter, id); - try { - stubs.put(id, emitter.emit(id, runtime)); - } finally { - suppressor.remove(); - } - } - - if (C1XOptions.PrintCFGToFile) { - addCompilationObserver(new CFGPrinterObserver()); - } - if (C1XOptions.PrintDOTGraphToFile) { - addCompilationObserver(new GraphvizPrinterObserver(false)); - } - if (C1XOptions.PrintDOTGraphToPdf) { - addCompilationObserver(new GraphvizPrinterObserver(true)); - } - if (C1XOptions.PrintIdealGraphLevel != 0) { - CompilationObserver observer; - if (C1XOptions.PrintIdealGraphFile) { - observer = new IdealGraphPrinterObserver(); - } else { - observer = new IdealGraphPrinterObserver(C1XOptions.PrintIdealGraphAddress, C1XOptions.PrintIdealGraphPort); - } - addCompilationObserver(observer); - } - } - - public GlobalStub lookupGlobalStub(GlobalStub.Id id) { - GlobalStub globalStub = stubs.get(id); - assert globalStub != null : "no stub for global stub id: " + id; - return globalStub; - } - - public GlobalStub lookupGlobalStub(XirTemplate template) { - GlobalStub globalStub = stubs.get(template); - assert globalStub != null : "no stub for XirTemplate: " + template; - return globalStub; - } - - public GlobalStub lookupGlobalStub(CiRuntimeCall runtimeCall) { - GlobalStub globalStub = stubs.get(runtimeCall); - if (globalStub == null) { - globalStub = backend.newGlobalStubEmitter().emit(runtimeCall, runtime); - stubs.put(runtimeCall, globalStub); - } - - assert globalStub != null : "could not find global stub for runtime call: " + runtimeCall; - return globalStub; - } -}
--- a/graal/GraalCompiler/src/com/sun/c1x/C1XMetrics.java Wed Jun 08 08:31:38 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,132 +0,0 @@ -/* - * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code 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 - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.sun.c1x; - -import java.lang.reflect.*; -import java.util.*; - -import com.sun.c1x.debug.*; - - -/** - * This class contains a number of fields that collect metrics about compilation, particularly - * the number of times certain optimizations are performed. - */ -public class C1XMetrics { - public static int CompiledMethods; - public static int TargetMethods; - public static int LocalValueNumberHits; - public static int ValueMapResizes; - public static int InlinedFinalizerChecks; - public static int InlineForcedMethods; - public static int InlineForbiddenMethods; - public static int InlinedJsrs; - public static int BlocksDeleted; - public static int BytecodesCompiled; - public static int CodeBytesEmitted; - public static int SafepointsEmitted; - public static int ExceptionHandlersEmitted; - public static int DataPatches; - public static int DirectCallSitesEmitted; - public static int IndirectCallSitesEmitted; - public static int HIRInstructions; - public static int LiveHIRInstructions; - public static int LIRInstructions; - public static int LIRVariables; - public static int LIRXIRInstructions; - public static int LIRMoveInstructions; - public static int LSRAIntervalsCreated; - public static int LSRASpills; - public static int LoadConstantIterations; - public static int CodeBufferCopies; - public static int UniqueValueIdsAssigned; - public static int FrameStatesCreated; - public static int FrameStateValuesCreated; - public static int NodesCanonicalized; - - public static void print() { - printClassFields(C1XMetrics.class); - - } - - public static void printClassFields(Class<?> javaClass) { - final String className = javaClass.getSimpleName(); - TTY.println(className + " {"); - for (final Field field : javaClass.getFields()) { - printField(field, false); - } - TTY.println("}"); - } - - public static void printField(final Field field, boolean tabbed) { - final String fieldName = String.format("%35s", field.getName()); - try { - String prefix = tabbed ? "" : " " + fieldName + " = "; - String postfix = tabbed ? "\t" : "\n"; - if (field.getType() == int.class) { - TTY.print(prefix + field.getInt(null) + postfix); - } else if (field.getType() == boolean.class) { - TTY.print(prefix + field.getBoolean(null) + postfix); - } else if (field.getType() == float.class) { - TTY.print(prefix + field.getFloat(null) + postfix); - } else if (field.getType() == String.class) { - TTY.print(prefix + field.get(null) + postfix); - } else if (field.getType() == Map.class) { - Map<?, ?> m = (Map<?, ?>) field.get(null); - TTY.print(prefix + printMap(m) + postfix); - } else { - TTY.print(prefix + field.get(null) + postfix); - } - } catch (IllegalAccessException e) { - // do nothing. - } - } - - private static String printMap(Map<?, ?> m) { - StringBuilder sb = new StringBuilder(); - - List<String> keys = new ArrayList<String>(); - for (Object key : m.keySet()) { - keys.add((String) key); - } - Collections.sort(keys); - - for (String key : keys) { - sb.append(key); - sb.append("\t"); - sb.append(m.get(key)); - sb.append("\n"); - } - - return sb.toString(); - } - - private static void printField(String fieldName, long value) { - TTY.print(" " + fieldName + " = " + value + "\n"); - } - - private static void printField(String fieldName, double value) { - TTY.print(" " + fieldName + " = " + value + "\n"); - } -} -
--- a/graal/GraalCompiler/src/com/sun/c1x/C1XOptions.java Wed Jun 08 08:31:38 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,133 +0,0 @@ -/* - * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code 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 - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.sun.c1x; - -import com.sun.c1x.debug.TTY.*; - -/** - * This class encapsulates options that control the behavior of the C1X compiler. - * The help message for each option is specified by a {@linkplain #helpMap help map}. - * - * (tw) WARNING: Fields of this class are treated as final by Graal. - * - * @author Ben L. Titzer - */ -public final class C1XOptions { - - // Checkstyle: stop - private static final boolean ____ = false; - // Checkstyle: resume - - // inlining settings - public static boolean Inline = ____; - public static int MaximumInstructionCount = 37000; - public static float MaximumInlineRatio = 0.90f; - public static int MaximumInlineSize = 35; - public static int MaximumTrivialSize = 6; - public static int MaximumInlineLevel = 9; - public static int MaximumRecursiveInlineLevel = 2; - public static int MaximumDesiredSize = 8000; - public static int MaximumShortLoopSize = 5; - - // debugging settings - public static boolean VerifyPointerMaps = ____; - public static int MethodEndBreakpointGuards = 0; - public static boolean ZapStackOnMethodEntry = ____; - public static boolean StressLinearScan = ____; - public static boolean BailoutOnException = ____; - - /** - * See {@link Filter#Filter(String, Object)}. - */ - public static String PrintFilter = null; - - // printing settings - public static boolean PrintHIR = ____; - public static boolean PrintLIR = ____; - public static boolean PrintCFGToFile = ____; - - // DOT output settings - public static boolean PrintDOTGraphToFile = ____; - public static boolean PrintDOTGraphToPdf = ____; - public static boolean OmitDOTFrameStates = ____; - - // Ideal graph visualizer output settings - public static int PrintIdealGraphLevel = 0; - public static boolean PrintIdealGraphFile = ____; - public static String PrintIdealGraphAddress = "127.0.0.1"; - public static int PrintIdealGraphPort = 4444; - - // Other printing settings - public static boolean PrintMetrics = ____; - public static boolean PrintTimers = ____; - public static boolean PrintCompilation = ____; - public static boolean PrintXirTemplates = ____; - public static boolean PrintIRWithLIR = ____; - public static boolean PrintAssembly = ____; - public static boolean PrintCodeBytes = ____; - public static int PrintAssemblyBytesPerLine = 16; - public static int TraceLinearScanLevel = 0; - public static int TraceLIRGeneratorLevel = 0; - public static boolean TraceRelocation = ____; - public static boolean TraceLIRVisit = ____; - public static boolean TraceAssembler = ____; - public static boolean TraceInlining = ____; - public static boolean TraceDeadCodeElimination = ____; - public static int TraceBytecodeParserLevel = 0; - public static boolean QuietBailout = ____; - - // state merging settings - public static boolean AssumeVerifiedBytecode = ____; - - // Linear scan settings - public static boolean CopyPointerStackArguments = true; - - // Code generator settings - public static boolean GenLIR = true; - public static boolean GenCode = true; - - public static boolean UseConstDirectCall = false; - - public static boolean GenSpecialDivChecks = ____; - public static boolean GenAssertionCode = ____; - public static boolean AlignCallsForPatching = true; - public static boolean NullCheckUniquePc = ____; - public static boolean InvokeSnippetAfterArguments = ____; - public static boolean ResolveClassBeforeStaticInvoke = true; - - // Translating tableswitch instructions - public static int SequentialSwitchLimit = 4; - public static int RangeTestsSwitchDensity = 5; - - public static boolean DetailedAsserts = ____; - - // Runtime settings - public static int ReadPrefetchInstr = 0; - public static int StackShadowPages = 2; - - // Assembler settings - public static boolean CommentedAssembly = ____; - public static boolean PrintLIRWithAssembly = ____; - - public static boolean OptCanonicalizer = true; -}
--- a/graal/GraalCompiler/src/com/sun/c1x/C1XTimers.java Wed Jun 08 08:31:38 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2009, 2009, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code 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 - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.sun.c1x; - -import com.sun.c1x.debug.*; - -/** - * This class contains timers that record the amount of time spent in various - * parts of the compiler. - * - * @author Christian Wimmer - */ -public enum C1XTimers { - HIR_CREATE("Create HIR"), - HIR_OPTIMIZE("Optimize HIR"), - NCE("Nullcheck elimination"), - LIR_CREATE("Create LIR"), - LIFETIME_ANALYSIS("Lifetime Analysis"), - LINEAR_SCAN("Linear Scan"), - RESOLUTION("Resolution"), - DEBUG_INFO("Create Debug Info"), - CODE_CREATE("Create Code"); - - private final String name; - private long start; - private long total; - - private C1XTimers(String name) { - this.name = name; - } - - public void start() { - start = System.nanoTime(); - } - - public void stop() { - total += System.nanoTime() - start; - } - - public static void reset() { - for (C1XTimers t : values()) { - t.total = 0; - } - } - - public static void print() { - long total = 0; - for (C1XTimers timer : C1XTimers.values()) { - total += timer.total; - } - if (total == 0) { - return; - } - - TTY.println(); - for (C1XTimers timer : C1XTimers.values()) { - TTY.println("%-20s: %7.4f s (%5.2f%%)", timer.name, timer.total / 1000000000.0, timer.total * 100.0 / total); - timer.total = 0; - } - TTY.println(); - } -}
--- a/graal/GraalCompiler/src/com/sun/c1x/alloc/ControlFlowOptimizer.java Wed Jun 08 08:31:38 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,260 +0,0 @@ -/* - * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code 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 - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.sun.c1x.alloc; - -import java.util.*; - -import com.sun.c1x.*; -import com.sun.c1x.graph.*; -import com.sun.c1x.ir.*; -import com.sun.c1x.lir.*; -import com.sun.c1x.util.*; -import com.sun.cri.ci.*; - -/** - * This class performs basic optimizations on the control flow graph after LIR generation. - */ -final class ControlFlowOptimizer { - - /** - * Performs control flow optimizations on the given IR graph. - * @param ir the IR graph that should be optimized - */ - public static void optimize(IR ir) { - ControlFlowOptimizer optimizer = new ControlFlowOptimizer(ir); - List<LIRBlock> code = ir.linearScanOrder(); - optimizer.reorderShortLoops(code); - optimizer.deleteEmptyBlocks(code); - optimizer.deleteUnnecessaryJumps(code); - optimizer.deleteJumpsToReturn(code); - } - - private final IR ir; - - private ControlFlowOptimizer(IR ir) { - this.ir = ir; - } - - private void reorderShortLoop(List<LIRBlock> code, LIRBlock headerBlock, int headerIdx) { - int i = headerIdx + 1; - int maxEnd = Math.min(headerIdx + C1XOptions.MaximumShortLoopSize, code.size()); - while (i < maxEnd && code.get(i).loopDepth() >= headerBlock.loopDepth()) { - i++; - } - - if (i == code.size() || code.get(i).loopDepth() < headerBlock.loopDepth()) { - int endIdx = i - 1; - LIRBlock endBlock = code.get(endIdx); - - if (endBlock.numberOfSux() == 1 && endBlock.suxAt(0) == headerBlock) { - // short loop from headerIdx to endIdx found . reorder blocks such that - // the headerBlock is the last block instead of the first block of the loop - - for (int j = headerIdx; j < endIdx; j++) { - code.set(j, code.get(j + 1)); - } - code.set(endIdx, headerBlock); - } - } - } - - private void reorderShortLoops(List<LIRBlock> code) { - for (int i = code.size() - 1; i >= 0; i--) { - LIRBlock block = code.get(i); - - if (block.isLinearScanLoopHeader()) { - reorderShortLoop(code, block, i); - } - } - - assert verify(code); - } - - // only blocks with exactly one successor can be deleted. Such blocks - // must always end with an unconditional branch to this successor - private boolean canDeleteBlock(LIRBlock block) { - if (block.numberOfSux() != 1 || - block == ir.startBlock || - block.suxAt(0) == block) { - return false; - } - - List<LIRInstruction> instructions = block.lir().instructionsList(); - - assert instructions.size() >= 2 : "block must have label and branch"; - assert instructions.get(0).code == LIROpcode.Label : "first instruction must always be a label"; - assert instructions.get(instructions.size() - 1) instanceof LIRBranch : "last instruction must always be a branch but is " + instructions.get(instructions.size() - 1); - assert ((LIRBranch) instructions.get(instructions.size() - 1)).cond() == Condition.TRUE : "branch must be unconditional"; - assert ((LIRBranch) instructions.get(instructions.size() - 1)).block() == block.suxAt(0) : "branch target must be the successor"; - - // block must have exactly one successor - - return instructions.size() == 2 && instructions.get(instructions.size() - 1).info == null; - } - - private void deleteEmptyBlocks(List<LIRBlock> code) { - int oldPos = 0; - int newPos = 0; - int numBlocks = code.size(); - - while (oldPos < numBlocks) { - LIRBlock block = code.get(oldPos); - - if (canDeleteBlock(block)) { - LIRBlock newTarget = block.suxAt(0); - - // update the block references in any branching LIR instructions - for (LIRBlock pred : block.blockPredecessors()) { - for (LIRInstruction instr : pred.lir().instructionsList()) { - if (instr instanceof LIRBranch) { - ((LIRBranch) instr).substitute(block, newTarget); - } else if (instr instanceof LIRTableSwitch) { - ((LIRTableSwitch) instr).substitute(block, newTarget); - } - } - } - - // adjust successor and predecessor lists - block.replaceWith(newTarget); - C1XMetrics.BlocksDeleted++; - } else { - // adjust position of this block in the block list if blocks before - // have been deleted - if (newPos != oldPos) { - code.set(newPos, code.get(oldPos)); - } - newPos++; - } - oldPos++; - } - assert verify(code); - Util.truncate(code, newPos); - - assert verify(code); - } - - private void deleteUnnecessaryJumps(List<LIRBlock> code) { - // skip the last block because there a branch is always necessary - for (int i = code.size() - 2; i >= 0; i--) { - LIRBlock block = code.get(i); - List<LIRInstruction> instructions = block.lir().instructionsList(); - - LIRInstruction lastOp = instructions.get(instructions.size() - 1); - if (lastOp.code == LIROpcode.Branch) { - assert lastOp instanceof LIRBranch : "branch must be of type LIRBranch"; - LIRBranch lastBranch = (LIRBranch) lastOp; - - assert lastBranch.block() != null : "last branch must always have a block as target"; - assert lastBranch.label() == lastBranch.block().label() : "must be equal"; - - if (lastBranch.info == null) { - if (lastBranch.block() == code.get(i + 1)) { - // delete last branch instruction - Util.truncate(instructions, instructions.size() - 1); - - } else { - LIRInstruction prevOp = instructions.get(instructions.size() - 2); - if (prevOp.code == LIROpcode.Branch || prevOp.code == LIROpcode.CondFloatBranch) { - assert prevOp instanceof LIRBranch : "branch must be of type LIRBranch"; - LIRBranch prevBranch = (LIRBranch) prevOp; - - if (prevBranch.block() == code.get(i + 1) && prevBranch.info == null) { - // eliminate a conditional branch to the immediate successor - prevBranch.changeBlock(lastBranch.block()); - prevBranch.negateCondition(); - Util.truncate(instructions, instructions.size() - 1); - } - } - } - } - } - } - - assert verify(code); - } - - private void deleteJumpsToReturn(List<LIRBlock> code) { - for (int i = code.size() - 1; i >= 0; i--) { - LIRBlock block = code.get(i); - List<LIRInstruction> curInstructions = block.lir().instructionsList(); - LIRInstruction curLastOp = curInstructions.get(curInstructions.size() - 1); - - assert curInstructions.get(0).code == LIROpcode.Label : "first instruction must always be a label"; - if (curInstructions.size() == 2 && curLastOp.code == LIROpcode.Return) { - // the block contains only a label and a return - // if a predecessor ends with an unconditional jump to this block, then the jump - // can be replaced with a return instruction - // - // Note: the original block with only a return statement cannot be deleted completely - // because the predecessors might have other (conditional) jumps to this block. - // this may lead to unnecesary return instructions in the final code - - assert curLastOp.info == null : "return instructions do not have debug information"; - - assert curLastOp instanceof LIROp1 : "return must be LIROp1"; - CiValue returnOpr = ((LIROp1) curLastOp).operand(); - - for (int j = block.numberOfPreds() - 1; j >= 0; j--) { - LIRBlock pred = block.predAt(j); - List<LIRInstruction> predInstructions = pred.lir().instructionsList(); - LIRInstruction predLastOp = predInstructions.get(predInstructions.size() - 1); - - if (predLastOp.code == LIROpcode.Branch) { - assert predLastOp instanceof LIRBranch : "branch must be LIRBranch"; - LIRBranch predLastBranch = (LIRBranch) predLastOp; - - if (predLastBranch.block() == block && predLastBranch.cond() == Condition.TRUE && predLastBranch.info == null) { - // replace the jump to a return with a direct return - // Note: currently the edge between the blocks is not deleted - predInstructions.set(predInstructions.size() - 1, new LIROp1(LIROpcode.Return, returnOpr)); - } - } - } - } - } - } - - private boolean verify(List<LIRBlock> code) { - for (LIRBlock block : code) { - List<LIRInstruction> instructions = block.lir().instructionsList(); - - for (LIRInstruction instr : instructions) { - if (instr instanceof LIRBranch) { - LIRBranch opBranch = (LIRBranch) instr; - assert opBranch.block() == null || code.contains(opBranch.block()) : "missing successor branch from: " + block + " to: " + opBranch.block(); - assert opBranch.unorderedBlock() == null || code.contains(opBranch.unorderedBlock()) : "missing successor branch from: " + block + " to: " + opBranch.unorderedBlock(); - } - } - - for (LIRBlock sux : block.blockSuccessors()) { - assert code.contains(sux) : "missing successor from: " + block + "to: " + sux; - } - - for (LIRBlock pred : block.blockPredecessors()) { - assert code.contains(pred) : "missing predecessor from: " + block + "to: " + pred; - } - } - - return true; - } -}
--- a/graal/GraalCompiler/src/com/sun/c1x/alloc/EdgeMoveOptimizer.java Wed Jun 08 08:31:38 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,298 +0,0 @@ -/* - * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code 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 - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.sun.c1x.alloc; - -import java.util.*; - -import com.sun.c1x.*; -import com.sun.c1x.ir.*; -import com.sun.c1x.lir.*; - -/** - * This class optimizes moves, particularly those that result from eliminating SSA form. - * - * When a block has more than one predecessor, and all predecessors end with - * the {@linkplain #same(LIRInstruction, LIRInstruction) same} sequence of - * {@linkplain LIROpcode#Move move} instructions, then these sequences - * can be replaced with a single copy of the sequence at the beginning of the block. - * - * Similarly, when a block has more than one successor, then same sequences of - * moves at the beginning of the successors can be placed once at the end of - * the block. But because the moves must be inserted before all branch - * instructions, this works only when there is exactly one conditional branch - * at the end of the block (because the moves must be inserted before all - * branches, but after all compares). - * - * This optimization affects all kind of moves (reg->reg, reg->stack and - * stack->reg). Because this optimization works best when a block contains only - * a few moves, it has a huge impact on the number of blocks that are totally - * empty. - * - * @author Christian Wimmer (original HotSpot implementation) - * @author Thomas Wuerthinger - * @author Doug Simon - */ -final class EdgeMoveOptimizer { - - /** - * Optimizes moves on block edges. - * - * @param blockList a list of blocks whose moves should be optimized - */ - public static void optimize(List<LIRBlock> blockList) { - EdgeMoveOptimizer optimizer = new EdgeMoveOptimizer(); - - // ignore the first block in the list (index 0 is not processed) - for (int i = blockList.size() - 1; i >= 1; i--) { - LIRBlock block = blockList.get(i); - - if (block.numberOfPreds() > 1) { - optimizer.optimizeMovesAtBlockEnd(block); - } - if (block.numberOfSux() == 2) { - optimizer.optimizeMovesAtBlockBegin(block); - } - } - } - - private final List<List<LIRInstruction>> edgeInstructionSeqences; - - private EdgeMoveOptimizer() { - edgeInstructionSeqences = new ArrayList<List<LIRInstruction>>(4); - } - - /** - * Determines if two operations are both {@linkplain LIROpcode#Move moves} - * that have the same {@linkplain LIROp1#operand() source} and {@linkplain LIROp1#result() destination} - * operands and they have the same {@linkplain LIRInstruction#info debug info}. - * - * @param op1 the first instruction to compare - * @param op2 the second instruction to compare - * @return {@code true} if {@code op1} and {@code op2} are the same by the above algorithm - */ - private boolean same(LIRInstruction op1, LIRInstruction op2) { - assert op1 != null; - assert op2 != null; - - if (op1.code == LIROpcode.Move && op2.code == LIROpcode.Move) { - assert op1 instanceof LIROp1 : "move must be LIROp1"; - assert op2 instanceof LIROp1 : "move must be LIROp1"; - LIROp1 move1 = (LIROp1) op1; - LIROp1 move2 = (LIROp1) op2; - if (move1.info == move2.info && move1.operand().equals(move2.operand()) && move1.result().equals(move2.result())) { - // these moves are exactly equal and can be optimized - return true; - } - } - return false; - } - - /** - * Moves the longest {@linkplain #same common} subsequence at the end all - * predecessors of {@code block} to the start of {@code block}. - */ - private void optimizeMovesAtBlockEnd(LIRBlock block) { - if (block.isPredecessor(block)) { - // currently we can't handle this correctly. - return; - } - - // clear all internal data structures - edgeInstructionSeqences.clear(); - - int numPreds = block.numberOfPreds(); - assert numPreds > 1 : "do not call otherwise"; - - // setup a list with the LIR instructions of all predecessors - for (int i = 0; i < numPreds; i++) { - LIRBlock pred = block.predAt(i); - assert pred != null; - assert pred.lir() != null; - List<LIRInstruction> predInstructions = pred.lir().instructionsList(); - - if (pred.numberOfSux() != 1) { - // this can happen with switch-statements where multiple edges are between - // the same blocks. - return; - } - - assert pred.suxAt(0) == block : "invalid control flow"; - assert predInstructions.get(predInstructions.size() - 1).code == LIROpcode.Branch : "block with successor must end with branch"; - assert predInstructions.get(predInstructions.size() - 1) instanceof LIRBranch : "branch must be LIROpBranch"; - assert ((LIRBranch) predInstructions.get(predInstructions.size() - 1)).cond() == Condition.TRUE : "block must end with unconditional branch"; - - if (predInstructions.get(predInstructions.size() - 1).info != null) { - // can not optimize instructions that have debug info - return; - } - - // ignore the unconditional branch at the end of the block - List<LIRInstruction> seq = predInstructions.subList(0, predInstructions.size() - 1); - edgeInstructionSeqences.add(seq); - } - - // process lir-instructions while all predecessors end with the same instruction - while (true) { - List<LIRInstruction> seq = edgeInstructionSeqences.get(0); - if (seq.isEmpty()) { - return; - } - - LIRInstruction op = last(seq); - for (int i = 1; i < numPreds; ++i) { - List<LIRInstruction> otherSeq = edgeInstructionSeqences.get(i); - if (otherSeq.isEmpty() || !same(op, last(otherSeq))) { - return; - } - } - - // insert the instruction at the beginning of the current block - block.lir().insertBefore(1, op); - - // delete the instruction at the end of all predecessors - for (int i = 0; i < numPreds; i++) { - seq = edgeInstructionSeqences.get(i); - removeLast(seq); - } - } - } - - /** - * Moves the longest {@linkplain #same common} subsequence at the start of all - * successors of {@code block} to the end of {@code block} just prior to the - * branch instruction ending {@code block}. - */ - private void optimizeMovesAtBlockBegin(LIRBlock block) { - - edgeInstructionSeqences.clear(); - int numSux = block.numberOfSux(); - - List<LIRInstruction> instructions = block.lir().instructionsList(); - - assert numSux == 2 : "method should not be called otherwise"; - assert instructions.get(instructions.size() - 1).code == LIROpcode.Branch : "block with successor must end with branch block=B" + block.blockID(); - assert instructions.get(instructions.size() - 1) instanceof LIRBranch : "branch must be LIROpBranch"; - assert ((LIRBranch) instructions.get(instructions.size() - 1)).cond() == Condition.TRUE : "block must end with unconditional branch"; - - if (instructions.get(instructions.size() - 1).info != null) { - // cannot optimize instructions when debug info is needed - return; - } - - LIRInstruction branch = instructions.get(instructions.size() - 2); - if (branch.info != null || (branch.code != LIROpcode.Branch && branch.code != LIROpcode.CondFloatBranch)) { - // not a valid case for optimization - // currently, only blocks that end with two branches (conditional branch followed - // by unconditional branch) are optimized - return; - } - - // now it is guaranteed that the block ends with two branch instructions. - // the instructions are inserted at the end of the block before these two branches - int insertIdx = instructions.size() - 2; - - if (C1XOptions.DetailedAsserts) { - for (int i = insertIdx - 1; i >= 0; i--) { - LIRInstruction op = instructions.get(i); - if ((op.code == LIROpcode.Branch || op.code == LIROpcode.CondFloatBranch) && ((LIRBranch) op).block() != null) { - throw new Error("block with two successors can have only two branch instructions"); - } - } - } - - // setup a list with the lir-instructions of all successors - for (int i = 0; i < numSux; i++) { - LIRBlock sux = block.suxAt(i); - List<LIRInstruction> suxInstructions = sux.lir().instructionsList(); - - assert suxInstructions.get(0).code == LIROpcode.Label : "block must start with label"; - - if (sux.numberOfPreds() != 1) { - // this can happen with switch-statements where multiple edges are between - // the same blocks. - return; - } - assert sux.predAt(0) == block : "invalid control flow"; - - // ignore the label at the beginning of the block - List<LIRInstruction> seq = suxInstructions.subList(1, suxInstructions.size()); - edgeInstructionSeqences.add(seq); - } - - // process LIR instructions while all successors begin with the same instruction - while (true) { - List<LIRInstruction> seq = edgeInstructionSeqences.get(0); - if (seq.isEmpty()) { - return; - } - - LIRInstruction op = first(seq); - for (int i = 1; i < numSux; i++) { - List<LIRInstruction> otherSeq = edgeInstructionSeqences.get(i); - if (otherSeq.isEmpty() || !same(op, first(otherSeq))) { - // these instructions are different and cannot be optimized . - // no further optimization possible - return; - } - } - - // insert instruction at end of current block - block.lir().insertBefore(insertIdx, op); - insertIdx++; - - // delete the instructions at the beginning of all successors - for (int i = 0; i < numSux; i++) { - seq = edgeInstructionSeqences.get(i); - removeFirst(seq); - } - } - } - - /** - * Gets the first element from a LIR instruction sequence. - */ - private static LIRInstruction first(List<LIRInstruction> seq) { - return seq.get(0); - } - - /** - * Gets the last element from a LIR instruction sequence. - */ - private static LIRInstruction last(List<LIRInstruction> seq) { - return seq.get(seq.size() - 1); - } - - /** - * Removes the first element from a LIR instruction sequence. - */ - private static void removeFirst(List<LIRInstruction> seq) { - seq.remove(0); - } - - /** - * Removes the last element from a LIR instruction sequence. - */ - private static void removeLast(List<LIRInstruction> seq) { - seq.remove(seq.size() - 1); - } -}
--- a/graal/GraalCompiler/src/com/sun/c1x/alloc/Interval.java Wed Jun 08 08:31:38 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1173 +0,0 @@ -/* - * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code 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 - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.sun.c1x.alloc; - -import java.util.*; - -import com.sun.c1x.*; -import com.sun.c1x.debug.*; -import com.sun.c1x.lir.*; -import com.sun.c1x.util.*; -import com.sun.cri.ci.*; - -/** - * Represents an interval in the {@linkplain LinearScan linear scan register allocator}. - * - * @author Thomas Wuerthinger - * @author Doug Simon - */ -public final class Interval { - - /** - * A pair of intervals. - */ - static final class Pair { - public final Interval first; - public final Interval second; - public Pair(Interval first, Interval second) { - this.first = first; - this.second = second; - } - } - - /** - * A set of interval lists, one per {@linkplain RegisterBinding binding} type. - */ - static final class RegisterBindingLists { - - /** - * List of intervals whose binding is currently {@link RegisterBinding#Fixed}. - */ - public Interval fixed; - - /** - * List of intervals whose binding is currently {@link RegisterBinding#Any}. - */ - public Interval any; - - public RegisterBindingLists(Interval fixed, Interval any) { - this.fixed = fixed; - this.any = any; - } - - /** - * Gets the list for a specified binding. - * - * @param binding specifies the list to be returned - * @return the list of intervals whose binding is {@code binding} - */ - public Interval get(RegisterBinding binding) { - if (binding == RegisterBinding.Any) { - return any; - } - assert binding == RegisterBinding.Fixed; - return fixed; - } - - /** - * Sets the list for a specified binding. - * - * @param binding specifies the list to be replaced - * @param a list of intervals whose binding is {@code binding} - */ - public void set(RegisterBinding binding, Interval list) { - assert list != null; - if (binding == RegisterBinding.Any) { - any = list; - } else { - assert binding == RegisterBinding.Fixed; - fixed = list; - } - } - - /** - * Adds an interval to a list sorted by {@linkplain Interval#currentFrom() current from} positions. - * - * @param binding specifies the list to be updated - * @param interval the interval to add - */ - public void addToListSortedByCurrentFromPositions(RegisterBinding binding, Interval interval) { - Interval list = get(binding); - Interval prev = null; - Interval cur = list; - while (cur.currentFrom() < interval.currentFrom()) { - prev = cur; - cur = cur.next; - } - Interval result = list; - if (prev == null) { - // add to head of list - result = interval; - } else { - // add before 'cur' - prev.next = interval; - } - interval.next = cur; - set(binding, result); - } - - /** - * Adds an interval to a list sorted by {@linkplain Interval#from() start} positions and - * {@linkplain Interval#firstUsage(RegisterPriority) first usage} positions. - * - * @param binding specifies the list to be updated - * @param interval the interval to add - */ - public void addToListSortedByStartAndUsePositions(RegisterBinding binding, Interval interval) { - Interval list = get(binding); - Interval prev = null; - Interval cur = list; - while (cur.from() < interval.from() || (cur.from() == interval.from() && cur.firstUsage(RegisterPriority.None) < interval.firstUsage(RegisterPriority.None))) { - prev = cur; - cur = cur.next; - } - if (prev == null) { - list = interval; - } else { - prev.next = interval; - } - interval.next = cur; - set(binding, list); - } - - /** - * Removes an interval from a list. - * - * @param binding specifies the list to be updated - * @param interval the interval to remove - */ - public void remove(RegisterBinding binding, Interval i) { - Interval list = get(binding); - Interval prev = null; - Interval cur = list; - while (cur != i) { - assert cur != null && cur != Interval.EndMarker : "interval has not been found in list: " + i; - prev = cur; - cur = cur.next; - } - if (prev == null) { - set(binding, cur.next); - } else { - prev.next = cur.next; - } - } - } - - /** - * Constants denoting the register usage priority for an interval. - * The constants are declared in increasing order of priority are - * are used to optimize spilling when multiple overlapping intervals - * compete for limited registers. - */ - enum RegisterPriority { - /** - * No special reason for an interval to be allocated a register. - */ - None, - - /** - * Priority level for intervals live at the end of a loop. - */ - LiveAtLoopEnd, - - /** - * Priority level for intervals that should be allocated to a register. - */ - ShouldHaveRegister, - - /** - * Priority level for intervals that must be allocated to a register. - */ - MustHaveRegister; - - public static final RegisterPriority[] VALUES = values(); - - /** - * Determines if this priority is higher than or equal to a given priority. - */ - public boolean greaterEqual(RegisterPriority other) { - return ordinal() >= other.ordinal(); - } - - /** - * Determines if this priority is lower than a given priority. - */ - public boolean lessThan(RegisterPriority other) { - return ordinal() < other.ordinal(); - } - } - - /** - * Constants denoting whether an interval is bound to a specific register. This models - * platform dependencies on register usage for certain instructions. - */ - enum RegisterBinding { - /** - * Interval is bound to a specific register as required by the platform. - */ - Fixed, - - /** - * Interval has no specific register requirements. - */ - Any; - - public static final RegisterBinding[] VALUES = values(); - } - - /** - * Constants denoting the linear-scan states an interval may be in with respect to the - * {@linkplain Interval#from() start} {@code position} of the interval being processed. - */ - enum State { - /** - * An interval that starts after {@code position}. - */ - Unhandled, - - /** - * An interval that {@linkplain Interval#covers covers} {@code position} and has an assigned register. - */ - Active, - - /** - * An interval that starts before and ends after {@code position} but does not - * {@linkplain Interval#covers cover} it due to a lifetime hole. - */ - Inactive, - - /** - * An interval that ends before {@code position} or is spilled to memory. - */ - Handled; - } - - /** - * Constants used in optimization of spilling of an interval. - */ - enum SpillState { - /** - * Starting state of calculation: no definition found yet. - */ - NoDefinitionFound, - - /** - * One definition has already been found. Two consecutive definitions are treated as one - * (e.g. a consecutive move and add because of two-operand LIR form). - * The position of this definition is given by {@link Interval#spillDefinitionPos()}. - */ - NoSpillStore, - - /** - * One spill move has already been inserted. - */ - OneSpillStore, - - /** - * The interval should be stored immediately after its definition to prevent - * multiple redundant stores. - */ - StoreAtDefinition, - - /** - * The interval starts in memory (e.g. method parameter), so a store is never necessary. - */ - StartInMemory, - - /** - * The interval has more than one definition (e.g. resulting from phi moves), so stores - * to memory are not optimized. - */ - NoOptimization - } - - /** - * List of use positions. Each entry in the list records the use position and register - * priority associated with the use position. The entries in the list are in descending - * order of use position. - * - * @author Doug Simon - */ - public static final class UsePosList { - private IntList list; - - /** - * Creates a use list. - * - * @param initialCapacity the initial capacity of the list in terms of entries - */ - public UsePosList(int initialCapacity) { - list = new IntList(initialCapacity * 2); - } - - private UsePosList(IntList list) { - this.list = list; - } - - /** - * Splits this list around a given position. All entries in this list with a use position greater or equal than - * {@code splitPos} are removed from this list and added to the returned list. - * - * @param splitPos the position for the split - * @return a use position list containing all entries removed from this list that have a use position greater or equal - * than {@code splitPos} - */ - public UsePosList splitAt(int splitPos) { - int i = size() - 1; - int len = 0; - while (i >= 0 && usePos(i) < splitPos) { - --i; - len += 2; - } - int listSplitIndex = (i + 1) * 2; - IntList childList = list; - list = IntList.copy(this.list, listSplitIndex, len); - childList.setSize(listSplitIndex); - UsePosList child = new UsePosList(childList); - return child; - } - - /** - * Gets the use position at a specified index in this list. - * - * @param index the index of the entry for which the use position is returned - * @return the use position of entry {@code index} in this list - */ - public int usePos(int index) { - return list.get(index << 1); - } - - /** - * Gets the register priority for the use position at a specified index in this list. - * - * @param index the index of the entry for which the register priority is returned - * @return the register priority of entry {@code index} in this list - */ - public RegisterPriority registerPriority(int index) { - return RegisterPriority.VALUES[list.get((index << 1) + 1)]; - } - - public void add(int usePos, RegisterPriority registerPriority) { - assert list.size() == 0 || usePos(size() - 1) > usePos; - list.add(usePos); - list.add(registerPriority.ordinal()); - } - - public int size() { - return list.size() >> 1; - } - - public void removeLowestUsePos() { - list.setSize(list.size() - 2); - } - - public void setRegisterPriority(int index, RegisterPriority registerPriority) { - list.set(index * 2, registerPriority.ordinal()); - } - - @Override - public String toString() { - StringBuilder buf = new StringBuilder("["); - for (int i = size() - 1; i >= 0; --i) { - if (buf.length() != 1) { - buf.append(", "); - } - RegisterPriority prio = registerPriority(i); - buf.append(usePos(i)).append(" -> ").append(prio.ordinal()).append(':').append(prio); - } - return buf.append("]").toString(); - } - } - - /** - * The {@linkplain CiRegisterValue register} or {@linkplain CiVariable variable} for this interval prior to register allocation. - */ - public final CiValue operand; - - /** - * The {@linkplain OperandPool#operandNumber(CiValue) operand number} for this interval's {@linkplain #operand operand}. - */ - public final int operandNumber; - - /** - * The {@linkplain CiRegisterValue register}, {@linkplain CiStackSlot spill slot} or {@linkplain CiAddress address} assigned to this interval. - */ - private CiValue location; - - /** - * The stack slot to which all splits of this interval are spilled if necessary. - */ - private CiStackSlot spillSlot; - - /** - * The kind of this interval. - * Only valid if this is a {@linkplain #isVariable() variable}. - */ - private CiKind kind; - - /** - * The head of the list of ranges describing this interval. This list is sorted by {@linkplain LIRInstruction#id instruction ids}. - */ - private Range first; - - /** - * List of (use-positions, register-priorities) pairs, sorted by use-positions. - */ - private UsePosList usePosList; - - /** - * Iterator used to traverse the ranges of an interval. - */ - private Range current; - - /** - * Link to next interval in a sorted list of intervals that ends with {@link #EndMarker}. - */ - Interval next; - - /** - * The linear-scan state of this interval. - */ - State state; - - private int cachedTo; // cached value: to of last range (-1: not cached) - - /** - * The interval from which this one is derived. If this is a {@linkplain #isSplitParent() split parent}, it points to itself. - */ - private Interval splitParent; - - /** - * List of all intervals that are split off from this interval. This is only used if this is a {@linkplain #isSplitParent() split parent}. - */ - private List<Interval> splitChildren = Collections.emptyList(); - - /** - * Current split child that has been active or inactive last (always stored in split parents). - */ - private Interval currentSplitChild; - - /** - * Specifies if move is inserted between currentSplitChild and this interval when interval gets active the first time. - */ - private boolean insertMoveWhenActivated; - - /** - * For spill move optimization. - */ - private SpillState spillState; - - /** - * Position where this interval is defined (if defined only once). - */ - private int spillDefinitionPos; - - /** - * This interval should be assigned the same location as the hint interval. - */ - private Interval locationHint; - - void assignLocation(CiValue location) { - if (location.isRegister()) { - assert this.location == null : "cannot re-assign location for " + this; - if (location.kind == CiKind.Illegal && kind != CiKind.Illegal) { - location = location.asRegister().asValue(kind); - } - } else { - assert this.location == null || this.location.isRegister() : "cannot re-assign location for " + this; - assert location.isStackSlot(); - assert location.kind != CiKind.Illegal; - assert location.kind == this.kind; - } - this.location = location; - } - - /** - * Gets the {@linkplain CiRegisterValue register}, {@linkplain CiStackSlot spill slot} or {@linkplain CiAddress address} assigned to this interval. - */ - public CiValue location() { - return location; - } - - public CiKind kind() { - assert !operand.isRegister() : "cannot access type for fixed interval"; - return kind; - } - - void setKind(CiKind kind) { - assert operand.isRegister() || this.kind == CiKind.Illegal || this.kind == kind : "overwriting existing type"; - assert kind == kind.stackKind() || kind == CiKind.Short : "these kinds should have int type registers"; - this.kind = kind; - } - - public Range first() { - return first; - } - - int from() { - return first.from; - } - - int to() { - if (cachedTo == -1) { - cachedTo = calcTo(); - } - assert cachedTo == calcTo() : "invalid cached value"; - return cachedTo; - } - - int numUsePositions() { - return usePosList.size(); - } - - void setLocationHint(Interval interval) { - locationHint = interval; - } - - boolean isSplitParent() { - return splitParent == this; - } - - boolean isSplitChild() { - return splitParent != this; - } - - /** - * Gets the split parent for this interval. - */ - public Interval splitParent() { - assert splitParent.isSplitParent() : "not a split parent: " + this; - return splitParent; - } - - /** - * Gets the canonical spill slot for this interval. - */ - CiStackSlot spillSlot() { - return splitParent().spillSlot; - } - - void setSpillSlot(CiStackSlot slot) { - assert splitParent().spillSlot == null : "connot overwrite existing spill slot"; - splitParent().spillSlot = slot; - } - - Interval currentSplitChild() { - return splitParent().currentSplitChild; - } - - void makeCurrentSplitChild() { - splitParent().currentSplitChild = this; - } - - boolean insertMoveWhenActivated() { - return insertMoveWhenActivated; - } - - void setInsertMoveWhenActivated(boolean b) { - insertMoveWhenActivated = b; - } - - // for spill optimization - public SpillState spillState() { - return splitParent().spillState; - } - - int spillDefinitionPos() { - return splitParent().spillDefinitionPos; - } - - void setSpillState(SpillState state) { - assert state.ordinal() >= spillState().ordinal() : "state cannot decrease"; - splitParent().spillState = state; - } - - void setSpillDefinitionPos(int pos) { - assert spillDefinitionPos() == -1 : "cannot set the position twice"; - splitParent().spillDefinitionPos = pos; - } - - // returns true if this interval has a shadow copy on the stack that is always correct - boolean alwaysInMemory() { - return splitParent().spillState == SpillState.StoreAtDefinition || splitParent().spillState == SpillState.StartInMemory; - } - - void removeFirstUsePos() { - usePosList.removeLowestUsePos(); - } - - // test intersection - boolean intersects(Interval i) { - return first.intersects(i.first); - } - - int intersectsAt(Interval i) { - return first.intersectsAt(i.first); - } - - // range iteration - void rewindRange() { - current = first; - } - - void nextRange() { - assert this != EndMarker : "not allowed on sentinel"; - current = current.next; - } - - int currentFrom() { - return current.from; - } - - int currentTo() { - return current.to; - } - - boolean currentAtEnd() { - return current == Range.EndMarker; - } - - boolean currentIntersects(Interval it) { - return current.intersects(it.current); - } - - int currentIntersectsAt(Interval it) { - return current.intersectsAt(it.current); - } - - /** - * Sentinel interval to denote the end of an interval list. - */ - static final Interval EndMarker = new Interval(CiValue.IllegalValue, -1); - - Interval(CiValue operand, int operandNumber) { - C1XMetrics.LSRAIntervalsCreated++; - assert operand != null; - this.operand = operand; - this.operandNumber = operandNumber; - if (operand.isRegister()) { - location = operand; - } else { - assert operand.isIllegal() || operand.isVariable(); - } - this.kind = CiKind.Illegal; - this.first = Range.EndMarker; - this.usePosList = new UsePosList(4); - this.current = Range.EndMarker; - this.next = EndMarker; - this.cachedTo = -1; - this.spillState = SpillState.NoDefinitionFound; - this.spillDefinitionPos = -1; - splitParent = this; - currentSplitChild = this; - } - - int calcTo() { - assert first != Range.EndMarker : "interval has no range"; - - Range r = first; - while (r.next != Range.EndMarker) { - r = r.next; - } - return r.to; - } - - // consistency check of split-children - boolean checkSplitChildren() { - if (!splitChildren.isEmpty()) { - assert isSplitParent() : "only split parents can have children"; - - for (int i = 0; i < splitChildren.size(); i++) { - Interval i1 = splitChildren.get(i); - - assert i1.splitParent() == this : "not a split child of this interval"; - assert i1.kind() == kind() : "must be equal for all split children"; - assert i1.spillSlot() == spillSlot() : "must be equal for all split children"; - - for (int j = i + 1; j < splitChildren.size(); j++) { - Interval i2 = splitChildren.get(j); - - assert i1.operand != i2.operand : "same register number"; - - if (i1.from() < i2.from()) { - assert i1.to() <= i2.from() && i1.to() < i2.to() : "intervals overlapping"; - } else { - assert i2.from() < i1.from() : "intervals start at same opId"; - assert i2.to() <= i1.from() && i2.to() < i1.to() : "intervals overlapping"; - } - } - } - } - - return true; - } - - public Interval locationHint(boolean searchSplitChild, LinearScan allocator) { - if (!searchSplitChild) { - return locationHint; - } - - if (locationHint != null) { - assert locationHint.isSplitParent() : "ony split parents are valid hint registers"; - - if (locationHint.location != null && locationHint.location.isRegister()) { - return locationHint; - } else if (!locationHint.splitChildren.isEmpty()) { - // search the first split child that has a register assigned - int len = locationHint.splitChildren.size(); - for (int i = 0; i < len; i++) { - Interval interval = locationHint.splitChildren.get(i); - if (interval.location != null && interval.location.isRegister()) { - return interval; - } - } - } - } - - // no hint interval found that has a register assigned - return null; - } - - Interval getSplitChildAtOpId(int opId, LIRInstruction.OperandMode mode, LinearScan allocator) { - assert isSplitParent() : "can only be called for split parents"; - assert opId >= 0 : "invalid opId (method cannot be called for spill moves)"; - - if (splitChildren.isEmpty()) { - assert this.covers(opId, mode) : this + " does not cover " + opId; - return this; - } else { - Interval result = null; - int len = splitChildren.size(); - - // in outputMode, the end of the interval (opId == cur.to()) is not valid - int toOffset = (mode == LIRInstruction.OperandMode.Output ? 0 : 1); - - int i; - for (i = 0; i < len; i++) { - Interval cur = splitChildren.get(i); - if (cur.from() <= opId && opId < cur.to() + toOffset) { - if (i > 0) { - // exchange current split child to start of list (faster access for next call) - Util.atPutGrow(splitChildren, i, splitChildren.get(0), null); - Util.atPutGrow(splitChildren, 0, cur, null); - } - - // interval found - result = cur; - break; - } - } - - assert checkSplitChild(result, opId, allocator, toOffset, mode); - return result; - } - } - - private boolean checkSplitChild(Interval result, int opId, LinearScan allocator, int toOffset, LIRInstruction.OperandMode mode) { - if (result == null) { - // this is an error - StringBuilder msg = new StringBuilder(this.toString()).append(" has no child at ").append(opId); - if (!splitChildren.isEmpty()) { - Interval first = splitChildren.get(0); - Interval last = splitChildren.get(splitChildren.size() - 1); - msg.append(" (first = ").append(first).append(", last = ").append(last).append(")"); - } - throw new CiBailout("Linear Scan Error: " + msg); - } - - if (!splitChildren.isEmpty()) { - for (Interval interval : splitChildren) { - if (interval != result && interval.from() <= opId && opId < interval.to() + toOffset) { - TTY.println(String.format("two valid result intervals found for opId %d: %d and %d", opId, result.operandNumber, interval.operandNumber)); - TTY.println(result.logString(allocator)); - TTY.println(interval.logString(allocator)); - throw new CiBailout("two valid result intervals found"); - } - } - } - assert result.covers(opId, mode) : "opId not covered by interval"; - return true; - } - - // returns the last split child that ends before the given opId - Interval getSplitChildBeforeOpId(int opId) { - assert opId >= 0 : "invalid opId"; - - Interval parent = splitParent(); - Interval result = null; - - assert !parent.splitChildren.isEmpty() : "no split children available"; - int len = parent.splitChildren.size(); - - for (int i = len - 1; i >= 0; i--) { - Interval cur = parent.splitChildren.get(i); - if (cur.to() <= opId && (result == null || result.to() < cur.to())) { - result = cur; - } - } - - assert result != null : "no split child found"; - return result; - } - - // checks if opId is covered by any split child - boolean splitChildCovers(int opId, LIRInstruction.OperandMode mode) { - assert isSplitParent() : "can only be called for split parents"; - assert opId >= 0 : "invalid opId (method can not be called for spill moves)"; - - if (splitChildren.isEmpty()) { - // simple case if interval was not split - return covers(opId, mode); - - } else { - // extended case: check all split children - int len = splitChildren.size(); - for (int i = 0; i < len; i++) { - Interval cur = splitChildren.get(i); - if (cur.covers(opId, mode)) { - return true; - } - } - return false; - } - } - - // Note: use positions are sorted descending . first use has highest index - int firstUsage(RegisterPriority minRegisterPriority) { - assert operand.isVariable() : "cannot access use positions for fixed intervals"; - - for (int i = usePosList.size() - 1; i >= 0; --i) { - RegisterPriority registerPriority = usePosList.registerPriority(i); - if (registerPriority.greaterEqual(minRegisterPriority)) { - return usePosList.usePos(i); - } - } - return Integer.MAX_VALUE; - } - - int nextUsage(RegisterPriority minRegisterPriority, int from) { - assert operand.isVariable() : "cannot access use positions for fixed intervals"; - - for (int i = usePosList.size() - 1; i >= 0; --i) { - int usePos = usePosList.usePos(i); - if (usePos >= from && usePosList.registerPriority(i).greaterEqual(minRegisterPriority)) { - return usePos; - } - } - return Integer.MAX_VALUE; - } - - int nextUsageExact(RegisterPriority exactRegisterPriority, int from) { - assert operand.isVariable() : "cannot access use positions for fixed intervals"; - - for (int i = usePosList.size() - 1; i >= 0; --i) { - int usePos = usePosList.usePos(i); - if (usePos >= from && usePosList.registerPriority(i) == exactRegisterPriority) { - return usePos; - } - } - return Integer.MAX_VALUE; - } - - int previousUsage(RegisterPriority minRegisterPriority, int from) { - assert operand.isVariable() : "cannot access use positions for fixed intervals"; - - int prev = 0; - for (int i = usePosList.size() - 1; i >= 0; --i) { - int usePos = usePosList.usePos(i); - if (usePos > from) { - return prev; - } - if (usePosList.registerPriority(i).greaterEqual(minRegisterPriority)) { - prev = usePos; - } - } - return prev; - } - - void addUsePos(int pos, RegisterPriority registerPriority) { - assert covers(pos, LIRInstruction.OperandMode.Input) : "use position not covered by live range"; - - // do not add use positions for precolored intervals because they are never used - if (registerPriority != RegisterPriority.None && operand.isVariable()) { - if (C1XOptions.DetailedAsserts) { - for (int i = 0; i < usePosList.size(); i++) { - assert pos <= usePosList.usePos(i) : "already added a use-position with lower position"; - if (i > 0) { - assert usePosList.usePos(i) < usePosList.usePos(i - 1) : "not sorted descending"; - } - } - } - - // Note: addUse is called in descending order, so list gets sorted - // automatically by just appending new use positions - int len = usePosList.size(); - if (len == 0 || usePosList.usePos(len - 1) > pos) { - usePosList.add(pos, registerPriority); - } else if (usePosList.registerPriority(len - 1).lessThan(registerPriority)) { - assert usePosList.usePos(len - 1) == pos : "list not sorted correctly"; - usePosList.setRegisterPriority(len - 1, registerPriority); - } - } - } - - void addRange(int from, int to) { - assert from < to : "invalid range"; - assert first() == Range.EndMarker || to < first().next.from : "not inserting at begin of interval"; - assert from <= first().to : "not inserting at begin of interval"; - - if (first.from <= to) { - assert first != Range.EndMarker; - // join intersecting ranges - first.from = Math.min(from, first().from); - first.to = Math.max(to, first().to); - } else { - // insert new range - first = new Range(from, to, first()); - } - } - - Interval newSplitChild(LinearScan allocator) { - // allocate new interval - Interval parent = splitParent(); - Interval result = allocator.createDerivedInterval(parent); - result.setKind(kind()); - - result.splitParent = parent; - result.setLocationHint(parent); - - // insert new interval in children-list of parent - if (parent.splitChildren.isEmpty()) { - assert isSplitParent() : "list must be initialized at first split"; - - // Create new non-shared list - parent.splitChildren = new ArrayList<Interval>(4); - parent.splitChildren.add(this); - } - parent.splitChildren.add(result); - - return result; - } - - /** - * Splits this interval at a specified position and returns the remainder as a new <i>child</i> interval - * of this interval's {@linkplain #splitParent() parent} interval. - * <p> - * When an interval is split, a bi-directional link is established between the original <i>parent</i> - * interval and the <i>children</i> intervals that are split off this interval. - * When a split child is split again, the new created interval is a direct child - * of the original parent. That is, there is no tree of split children stored, just a flat list. - * All split children are spilled to the same {@linkplain #spillSlot spill slot}. - * - * @param splitPos the position at which to split this interval - * @param allocator the register allocator context - * @return the child interval split off from this interval - */ - Interval split(int splitPos, LinearScan allocator) { - assert operand.isVariable() : "cannot split fixed intervals"; - - // allocate new interval - Interval result = newSplitChild(allocator); - - // split the ranges - Range prev = null; - Range cur = first; - while (cur != Range.EndMarker && cur.to <= splitPos) { - prev = cur; - cur = cur.next; - } - assert cur != Range.EndMarker : "split interval after end of last range"; - - if (cur.from < splitPos) { - result.first = new Range(splitPos, cur.to, cur.next); - cur.to = splitPos; - cur.next = Range.EndMarker; - - } else { - assert prev != null : "split before start of first range"; - result.first = cur; - prev.next = Range.EndMarker; - } - result.current = result.first; - cachedTo = -1; // clear cached value - - // split list of use positions - result.usePosList = usePosList.splitAt(splitPos); - - if (C1XOptions.DetailedAsserts) { - for (int i = 0; i < usePosList.size(); i++) { - assert usePosList.usePos(i) < splitPos; - } - for (int i = 0; i < result.usePosList.size(); i++) { - assert result.usePosList.usePos(i) >= splitPos; - } - } - return result; - } - - /** - * Splits this interval at a specified position and returns - * the head as a new interval (this interval is the tail). - * - * Currently, only the first range can be split, and the new interval must not have split positions - */ - Interval splitFromStart(int splitPos, LinearScan allocator) { - assert operand.isVariable() : "cannot split fixed intervals"; - assert splitPos > from() && splitPos < to() : "can only split inside interval"; - assert splitPos > first.from && splitPos <= first.to : "can only split inside first range"; - assert firstUsage(RegisterPriority.None) > splitPos : "can not split when use positions are present"; - - // allocate new interval - Interval result = newSplitChild(allocator); - - // the new interval has only one range (checked by assertion above, - // so the splitting of the ranges is very simple - result.addRange(first.from, splitPos); - - if (splitPos == first.to) { - assert first.next != Range.EndMarker : "must not be at end"; - first = first.next; - } else { - first.from = splitPos; - } - - return result; - } - - // returns true if the opId is inside the interval - boolean covers(int opId, LIRInstruction.OperandMode mode) { - Range cur = first; - - while (cur != Range.EndMarker && cur.to < opId) { - cur = cur.next; - } - if (cur != Range.EndMarker) { - assert cur.to != cur.next.from : "ranges not separated"; - - if (mode == LIRInstruction.OperandMode.Output) { - return cur.from <= opId && opId < cur.to; - } else { - return cur.from <= opId && opId <= cur.to; - } - } - return false; - } - - // returns true if the interval has any hole between holeFrom and holeTo - // (even if the hole has only the length 1) - boolean hasHoleBetween(int holeFrom, int holeTo) { - assert holeFrom < holeTo : "check"; - assert from() <= holeFrom && holeTo <= to() : "index out of interval"; - - Range cur = first; - while (cur != Range.EndMarker) { - assert cur.to < cur.next.from : "no space between ranges"; - - // hole-range starts before this range . hole - if (holeFrom < cur.from) { - return true; - - // hole-range completely inside this range . no hole - } else { - if (holeTo <= cur.to) { - return false; - - // overlapping of hole-range with this range . hole - } else { - if (holeFrom <= cur.to) { - return true; - } - } - } - - cur = cur.next; - } - - return false; - } - - @Override - public String toString() { - String from = "?"; - String to = "?"; - if (first != null && first != Range.EndMarker) { - from = String.valueOf(from()); - to = String.valueOf(to()); - } - String location = this.location == null ? "" : "@" + this.location.name(); - return operandNumber + ":" + operand + (operand.isRegister() ? "" : location) + "[" + from + "," + to + "]"; - } - - /** - * Gets the use position information for this interval. - */ - public UsePosList usePosList() { - return usePosList; - } - - /** - * Gets a single line string for logging the details of this interval to a log stream. - * - * @param allocator the register allocator context - */ - public String logString(LinearScan allocator) { - StringBuilder buf = new StringBuilder(100); - buf.append(operandNumber).append(':').append(operand).append(' '); - if (!operand.isRegister()) { - if (location != null) { - buf.append("location{").append(location).append("} "); - } - } - - buf.append("hints{").append(splitParent.operandNumber); - Interval hint = locationHint(false, allocator); - if (hint != null && hint.operandNumber != splitParent.operandNumber) { - buf.append(", ").append(hint.operandNumber); - } - buf.append("} ranges{"); - - // print ranges - Range cur = first; - while (cur != Range.EndMarker) { - if (cur != first) { - buf.append(", "); - } - buf.append(cur); - cur = cur.next; - assert cur != null : "range list not closed with range sentinel"; - } - buf.append("} uses{"); - - // print use positions - int prev = 0; - for (int i = usePosList.size() - 1; i >= 0; --i) { - assert prev < usePosList.usePos(i) : "use positions not sorted"; - if (i != usePosList.size() - 1) { - buf.append(", "); - } - buf.append(usePosList.usePos(i)).append(':').append(usePosList.registerPriority(i)); - prev = usePosList.usePos(i); - } - return buf.append("} spill-state{").append(spillState()).append("}").toString(); - } -}
--- a/graal/GraalCompiler/src/com/sun/c1x/alloc/IntervalWalker.java Wed Jun 08 08:31:38 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,246 +0,0 @@ -/* - * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code 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 - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.sun.c1x.alloc; - -import com.sun.c1x.*; -import com.sun.c1x.alloc.Interval.*; -import com.sun.c1x.debug.*; - -/** - * - * @author Thomas Wuerthinger - */ -public class IntervalWalker { - - protected final C1XCompilation compilation; - protected final LinearScan allocator; - - /** - * Sorted list of intervals, not live before the current position. - */ - RegisterBindingLists unhandledLists; - - /** - * Sorted list of intervals, live at the current position. - */ - RegisterBindingLists activeLists; - - /** - * Sorted list of intervals in a life time hole at the current position. - */ - RegisterBindingLists inactiveLists; - - /** - * The current interval (taken from the unhandled list) being processed. - */ - protected Interval current; - - /** - * The current position (intercept point through the intervals). - */ - protected int currentPosition; - - /** - * The binding of the current interval being processed. - */ - protected RegisterBinding currentBinding; - - /** - * Processes the {@linkplain #current} interval in an attempt to allocate a physical - * register to it and thus allow it to be moved to a list of {@linkplain #activeLists active} intervals. - * - * @return {@code true} if a register was allocated to the {@linkplain #current} interval - */ - boolean activateCurrent() { - return true; - } - - void walkBefore(int lirOpId) { - walkTo(lirOpId - 1); - } - - void walk() { - walkTo(Integer.MAX_VALUE); - } - - /** - * Creates a new interval walker. - * - * @param allocator the register allocator context - * @param unhandledFixed the list of unhandled {@linkplain RegisterBinding#Fixed fixed} intervals - * @param unhandledAny the list of unhandled {@linkplain RegisterBinding#Any non-fixed} intervals - */ - IntervalWalker(LinearScan allocator, Interval unhandledFixed, Interval unhandledAny) { - this.compilation = allocator.compilation; - this.allocator = allocator; - - unhandledLists = new RegisterBindingLists(unhandledFixed, unhandledAny); - activeLists = new RegisterBindingLists(Interval.EndMarker, Interval.EndMarker); - inactiveLists = new RegisterBindingLists(Interval.EndMarker, Interval.EndMarker); - currentPosition = -1; - current = null; - nextInterval(); - } - - void removeFromList(Interval interval) { - if (interval.state == State.Active) { - activeLists.remove(RegisterBinding.Any, interval); - } else { - assert interval.state == State.Inactive : "invalid state"; - inactiveLists.remove(RegisterBinding.Any, interval); - } - } - - void walkTo(State state, int from) { - assert state == State.Active || state == State.Inactive : "wrong state"; - for (RegisterBinding binding : RegisterBinding.VALUES) { - Interval prevprev = null; - Interval prev = (state == State.Active) ? activeLists.get(binding) : inactiveLists.get(binding); - Interval next = prev; - while (next.currentFrom() <= from) { - Interval cur = next; - next = cur.next; - - boolean rangeHasChanged = false; - while (cur.currentTo() <= from) { - cur.nextRange(); - rangeHasChanged = true; - } - - // also handle move from inactive list to active list - rangeHasChanged = rangeHasChanged || (state == State.Inactive && cur.currentFrom() <= from); - - if (rangeHasChanged) { - // remove cur from list - if (prevprev == null) { - if (state == State.Active) { - activeLists.set(binding, next); - } else { - inactiveLists.set(binding, next); - } - } else { - prevprev.next = next; - } - prev = next; - if (cur.currentAtEnd()) { - // move to handled state (not maintained as a list) - cur.state = State.Handled; - intervalMoved(cur, binding, state, State.Handled); - } else if (cur.currentFrom() <= from) { - // sort into active list - activeLists.addToListSortedByCurrentFromPositions(binding, cur); - cur.state = State.Active; - if (prev == cur) { - assert state == State.Active : "check"; - prevprev = prev; - prev = cur.next; - } - intervalMoved(cur, binding, state, State.Active); - } else { - // sort into inactive list - inactiveLists.addToListSortedByCurrentFromPositions(binding, cur); - cur.state = State.Inactive; - if (prev == cur) { - assert state == State.Inactive : "check"; - prevprev = prev; - prev = cur.next; - } - intervalMoved(cur, binding, state, State.Inactive); - } - } else { - prevprev = prev; - prev = cur.next; - } - } - } - } - - void nextInterval() { - RegisterBinding binding; - Interval any = unhandledLists.any; - Interval fixed = unhandledLists.fixed; - - if (any != Interval.EndMarker) { - // intervals may start at same position . prefer fixed interval - binding = fixed != Interval.EndMarker && fixed.from() <= any.from() ? RegisterBinding.Fixed : RegisterBinding.Any; - - assert binding == RegisterBinding.Fixed && fixed.from() <= any.from() || binding == RegisterBinding.Any && any.from() <= fixed.from() : "wrong interval!!!"; - assert any == Interval.EndMarker || fixed == Interval.EndMarker || any.from() != fixed.from() || binding == RegisterBinding.Fixed : "if fixed and any-Interval start at same position, fixed must be processed first"; - - } else if (fixed != Interval.EndMarker) { - binding = RegisterBinding.Fixed; - } else { - current = null; - return; - } - currentBinding = binding; - current = unhandledLists.get(binding); - unhandledLists.set(binding, current.next); - current.next = Interval.EndMarker; - current.rewindRange(); - } - - void walkTo(int toOpId) { - assert currentPosition <= toOpId : "can not walk backwards"; - while (current != null) { - boolean isActive = current.from() <= toOpId; - int opId = isActive ? current.from() : toOpId; - - if (C1XOptions.TraceLinearScanLevel >= 2 && !TTY.isSuppressed()) { - if (currentPosition < opId) { - TTY.println(); - TTY.println("walkTo(%d) *", opId); - } - } - - // set currentPosition prior to call of walkTo - currentPosition = opId; - - // call walkTo even if currentPosition == id - walkTo(State.Active, opId); - walkTo(State.Inactive, opId); - - if (isActive) { - current.state = State.Active; - if (activateCurrent()) { - activeLists.addToListSortedByCurrentFromPositions(currentBinding, current); - intervalMoved(current, currentBinding, State.Unhandled, State.Active); - } - - nextInterval(); - } else { - return; - } - } - } - - private void intervalMoved(Interval interval, RegisterBinding kind, State from, State to) { - // intervalMoved() is called whenever an interval moves from one interval list to another. - // In the implementation of this method it is prohibited to move the interval to any list. - if (C1XOptions.TraceLinearScanLevel >= 4 && !TTY.isSuppressed()) { - TTY.print(from.toString() + " to " + to.toString()); - TTY.fillTo(23); - TTY.out().println(interval.logString(allocator)); - } - } -}
--- a/graal/GraalCompiler/src/com/sun/c1x/alloc/LIRInsertionBuffer.java Wed Jun 08 08:31:38 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,136 +0,0 @@ -/* - * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code 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 - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.sun.c1x.alloc; - -import java.util.*; - -import com.sun.c1x.lir.*; -import com.sun.c1x.util.*; -import com.sun.cri.ci.*; - -/** - * - * @author Thomas Wuerthinger - */ -public final class LIRInsertionBuffer { - - private LIRList lir; // the lir list where ops of this buffer should be inserted later (null when uninitialized) - - // list of insertion points. index and count are stored alternately: - // indexAndCount[i * 2]: the index into lir list where "count" ops should be inserted - // indexAndCount[i * 2 + 1]: the number of ops to be inserted at index - private final IntList indexAndCount; - - // the LIROps to be inserted - private final List<LIRInstruction> ops; - - private void appendNew(int index, int count) { - indexAndCount.add(index); - indexAndCount.add(count); - } - - private void setCountAt(int i, int value) { - indexAndCount.set((i << 1) + 1, value); - } - - LIRInsertionBuffer() { - ops = new ArrayList<LIRInstruction>(8); - indexAndCount = new IntList(8); - } - - // must be called before using the insertion buffer - void init(LIRList lir) { - assert !initialized() : "already initialized"; - this.lir = lir; - indexAndCount.clear(); - ops.clear(); - } - - boolean initialized() { - return lir != null; - } - - // called automatically when the buffer is appended to the LIRList - public void finish() { - lir = null; - } - - // accessors - public LIRList lirList() { - return lir; - } - - public int numberOfInsertionPoints() { - return indexAndCount.size() >> 1; - } - - public int indexAt(int i) { - return indexAndCount.get((i << 1)); - } - - public int countAt(int i) { - return indexAndCount.get((i << 1) + 1); - } - - public int numberOfOps() { - return ops.size(); - } - - public LIRInstruction opAt(int i) { - return ops.get(i); - } - - void move(int index, CiValue src, CiValue dst, LIRDebugInfo info) { - append(index, new LIROp1(LIROpcode.Move, src, dst, dst.kind, info)); - } - - // Implementation of LIRInsertionBuffer - - private void append(int index, LIRInstruction op) { - assert indexAndCount.size() % 2 == 0 : "must have a count for each index"; - - int i = numberOfInsertionPoints() - 1; - if (i < 0 || indexAt(i) < index) { - appendNew(index, 1); - } else { - assert indexAt(i) == index : "can append LIROps in ascending order only"; - assert countAt(i) > 0 : "check"; - setCountAt(i, countAt(i) + 1); - } - ops.add(op); - - assert verify(); - } - - private boolean verify() { - int sum = 0; - int prevIdx = -1; - - for (int i = 0; i < numberOfInsertionPoints(); i++) { - assert prevIdx < indexAt(i) : "index must be ordered ascending"; - sum += countAt(i); - } - assert sum == numberOfOps() : "wrong total sum"; - return true; - } -}
--- a/graal/GraalCompiler/src/com/sun/c1x/alloc/LinearScan.java Wed Jun 08 08:31:38 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2317 +0,0 @@ -/* - * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code 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 - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.sun.c1x.alloc; - -import static com.sun.cri.ci.CiUtil.*; -import static java.lang.reflect.Modifier.*; - -import java.util.*; - -import com.oracle.graal.graph.*; -import com.sun.c1x.*; -import com.sun.c1x.alloc.Interval.*; -import com.sun.c1x.debug.*; -import com.sun.c1x.gen.*; -import com.sun.c1x.graph.*; -import com.sun.c1x.ir.*; -import com.sun.c1x.lir.*; -import com.sun.c1x.lir.LIRInstruction.*; -import com.sun.c1x.observer.*; -import com.sun.c1x.util.*; -import com.sun.c1x.value.*; -import com.sun.c1x.value.FrameState.*; -import com.sun.cri.ci.*; -import com.sun.cri.ri.*; - -/** - * An implementation of the linear scan register allocator algorithm described - * in <a href="http://doi.acm.org/10.1145/1064979.1064998">"Optimized Interval Splitting in a Linear Scan Register Allocator"</a> - * by Christian Wimmer and Hanspeter Moessenboeck. - * - * @author Christian Wimmer (original HotSpot implementation) - * @author Thomas Wuerthinger - * @author Doug Simon - */ -public final class LinearScan { - - final C1XCompilation compilation; - final IR ir; - final LIRGenerator gen; - final FrameMap frameMap; - final RiRegisterAttributes[] registerAttributes; - final CiRegister[] registers; - - private static final int INITIAL_SPLIT_INTERVALS_CAPACITY = 32; - - /** - * List of blocks in linear-scan order. This is only correct as long as the CFG does not change. - */ - final LIRBlock[] sortedBlocks; - - final OperandPool operands; - - /** - * Number of stack slots used for intervals allocated to memory. - */ - int maxSpills; - - /** - * Unused spill slot for a single-word value because of alignment of a double-word value. - */ - CiStackSlot unusedSpillSlot; - - /** - * Map from {@linkplain #operandNumber(CiValue) operand numbers} to intervals. - */ - Interval[] intervals; - - /** - * The number of valid entries in {@link #intervals}. - */ - int intervalsSize; - - /** - * The index of the first entry in {@link #intervals} for a {@linkplain #createDerivedInterval(Interval) derived interval}. - */ - int firstDerivedIntervalIndex = -1; - - /** - * Intervals sorted by {@link Interval#from()}. - */ - Interval[] sortedIntervals; - - /** - * Map from an instruction {@linkplain LIRInstruction#id id} to the instruction. - * Entries should be retrieved with {@link #instructionForId(int)} as the id is - * not simply an index into this array. - */ - LIRInstruction[] opIdToInstructionMap; - - /** - * Map from an instruction {@linkplain LIRInstruction#id id} to the {@linkplain - * LIRBlock block} containing the instruction. Entries should be retrieved with - * {@link #blockForId(int)} as the id is not simply an index into this array. - */ - LIRBlock[] opIdToBlockMap; - - /** - * Bit set for each variable that is contained in each loop. - */ - BitMap2D intervalInLoop; - - public LinearScan(C1XCompilation compilation, IR ir, LIRGenerator gen, FrameMap frameMap) { - this.compilation = compilation; - this.ir = ir; - this.gen = gen; - this.frameMap = frameMap; - this.maxSpills = frameMap.initialSpillSlot(); - this.unusedSpillSlot = null; - this.sortedBlocks = ir.linearScanOrder().toArray(new LIRBlock[ir.linearScanOrder().size()]); - CiRegister[] allocatableRegisters = compilation.registerConfig.getAllocatableRegisters(); - this.registers = new CiRegister[CiRegister.maxRegisterNumber(allocatableRegisters) + 1]; - for (CiRegister reg : allocatableRegisters) { - registers[reg.number] = reg; - } - this.registerAttributes = compilation.registerConfig.getAttributesMap(); - this.operands = gen.operands; - } - - /** - * Converts an operand (variable or register) to an index in a flat address space covering all the - * {@linkplain CiVariable variables} and {@linkplain CiRegisterValue registers} being processed by this - * allocator. - */ - int operandNumber(CiValue operand) { - return operands.operandNumber(operand); - } - - static final IntervalPredicate IS_PRECOLORED_INTERVAL = new IntervalPredicate() { - @Override - public boolean apply(Interval i) { - return i.operand.isRegister(); - } - }; - - static final IntervalPredicate IS_VARIABLE_INTERVAL = new IntervalPredicate() { - @Override - public boolean apply(Interval i) { - return i.operand.isVariable(); - } - }; - - static final IntervalPredicate IS_OOP_INTERVAL = new IntervalPredicate() { - @Override - public boolean apply(Interval i) { - return !i.operand.isRegister() && i.kind() == CiKind.Object; - } - }; - - /** - * Gets an object describing the attributes of a given register according to this register configuration. - */ - RiRegisterAttributes attributes(CiRegister reg) { - return registerAttributes[reg.number]; - } - - /** - * Allocates the next available spill slot for a value of a given kind. - */ - CiStackSlot allocateSpillSlot(CiKind kind) { - CiStackSlot spillSlot; - if (numberOfSpillSlots(kind) == 2) { - if (isOdd(maxSpills)) { - // alignment of double-slot values - // the hole because of the alignment is filled with the next single-slot value - assert unusedSpillSlot == null : "wasting a spill slot"; - unusedSpillSlot = CiStackSlot.get(kind, maxSpills); - maxSpills++; - } - spillSlot = CiStackSlot.get(kind, maxSpills); - maxSpills += 2; - } else if (unusedSpillSlot != null) { - // re-use hole that was the result of a previous double-word alignment - spillSlot = unusedSpillSlot; - unusedSpillSlot = null; - } else { - spillSlot = CiStackSlot.get(kind, maxSpills); - maxSpills++; - } - - return spillSlot; - } - - void assignSpillSlot(Interval interval) { - // assign the canonical spill slot of the parent (if a part of the interval - // is already spilled) or allocate a new spill slot - if (interval.spillSlot() != null) { - interval.assignLocation(interval.spillSlot()); - } else { - CiStackSlot slot = allocateSpillSlot(interval.kind()); - interval.setSpillSlot(slot); - interval.assignLocation(slot); - } - } - - /** - * Creates a new interval. - * - * @param operand the operand for the interval - * @return the created interval - */ - Interval createInterval(CiValue operand) { - assert isProcessed(operand); - assert operand.isLegal(); - int operandNumber = operandNumber(operand); - Interval interval = new Interval(operand, operandNumber); - assert operandNumber < intervalsSize; - assert intervals[operandNumber] == null; - intervals[operandNumber] = interval; - return interval; - } - - /** - * Creates an interval as a result of splitting or spilling another interval. - * - * @param source an interval being split of spilled - * @return a new interval derived from {@code source} - */ - Interval createDerivedInterval(Interval source) { - if (firstDerivedIntervalIndex == -1) { - firstDerivedIntervalIndex = intervalsSize; - } - if (intervalsSize == intervals.length) { - intervals = Arrays.copyOf(intervals, intervals.length * 2); - } - intervalsSize++; - Interval interval = createInterval(operands.newVariable(source.kind())); - assert intervals[intervalsSize - 1] == interval; - return interval; - } - - // copy the variable flags if an interval is split - void copyRegisterFlags(Interval from, Interval to) { - if (operands.mustBeByteRegister(from.operand)) { - operands.setMustBeByteRegister((CiVariable) to.operand); - } - - // Note: do not copy the mustStartInMemory flag because it is not necessary for child - // intervals (only the very beginning of the interval must be in memory) - } - - // access to block list (sorted in linear scan order) - int blockCount() { - assert sortedBlocks.length == ir.linearScanOrder().size() : "invalid cached block list"; - return sortedBlocks.length; - } - - LIRBlock blockAt(int index) { - assert sortedBlocks[index] == ir.linearScanOrder().get(index) : "invalid cached block list"; - return sortedBlocks[index]; - } - - /** - * Gets the size of the {@link LIRBlock#liveIn} and {@link LIRBlock#liveOut} sets for a basic block. These sets do - * not include any operands allocated as a result of creating {@linkplain #createDerivedInterval(Interval) derived - * intervals}. - */ - int liveSetSize() { - return firstDerivedIntervalIndex == -1 ? operands.size() : firstDerivedIntervalIndex; - } - - int numLoops() { - return ir.numLoops(); - } - - boolean isIntervalInLoop(int interval, int loop) { - return intervalInLoop.at(interval, loop); - } - - Interval intervalFor(CiValue operand) { - int operandNumber = operandNumber(operand); - assert operandNumber < intervalsSize; - return intervals[operandNumber]; - } - - /** - * Gets the highest instruction id allocated by this object. - */ - int maxOpId() { - assert opIdToInstructionMap.length > 0 : "no operations"; - return (opIdToInstructionMap.length - 1) << 1; - } - - /** - * Converts an {@linkplain LIRInstruction#id instruction id} to an instruction index. - * All LIR instructions in a method have an index one greater than their linear-scan order predecesor - * with the first instruction having an index of 0. - */ - static int opIdToIndex(int opId) { - return opId >> 1; - } - - /** - * Retrieves the {@link LIRInstruction} based on its {@linkplain LIRInstruction#id id}. - * - * @param opId an instruction {@linkplain LIRInstruction#id id} - * @return the instruction whose {@linkplain LIRInstruction#id} {@code == id} - */ - LIRInstruction instructionForId(int opId) { - assert isEven(opId) : "opId not even"; - LIRInstruction instr = opIdToInstructionMap[opIdToIndex(opId)]; - assert instr.id == opId; - return instr; - } - - /** - * Gets the block containing a given instruction. - * - * @param opId an instruction {@linkplain LIRInstruction#id id} - * @return the block containing the instruction denoted by {@code opId} - */ - LIRBlock blockForId(int opId) { - assert opIdToBlockMap.length > 0 && opId >= 0 && opId <= maxOpId() + 1 : "opId out of range"; - return opIdToBlockMap[opIdToIndex(opId)]; - } - - boolean isBlockBegin(int opId) { - return opId == 0 || blockForId(opId) != blockForId(opId - 1); - } - - boolean coversBlockBegin(int opId1, int opId2) { - return blockForId(opId1) != blockForId(opId2); - } - - /** - * Determines if an {@link LIRInstruction} destroys all caller saved registers. - * - * @param opId an instruction {@linkplain LIRInstruction#id id} - * @return {@code true} if the instruction denoted by {@code id} destroys all caller saved registers. - */ - boolean hasCall(int opId) { - assert isEven(opId) : "opId not even"; - return instructionForId(opId).hasCall; - } - - /** - * Eliminates moves from register to stack if the stack slot is known to be correct. - */ - void changeSpillDefinitionPos(Interval interval, int defPos) { - assert interval.isSplitParent() : "can only be called for split parents"; - - switch (interval.spillState()) { - case NoDefinitionFound: - assert interval.spillDefinitionPos() == -1 : "must no be set before"; - interval.setSpillDefinitionPos(defPos); - interval.setSpillState(SpillState.NoSpillStore); - break; - - case NoSpillStore: - assert defPos <= interval.spillDefinitionPos() : "positions are processed in reverse order when intervals are created"; - if (defPos < interval.spillDefinitionPos() - 2 || instructionForId(interval.spillDefinitionPos()).code == LIROpcode.Xir) { - // second definition found, so no spill optimization possible for this interval - interval.setSpillState(SpillState.NoOptimization); - } else { - // two consecutive definitions (because of two-operand LIR form) - assert blockForId(defPos) == blockForId(interval.spillDefinitionPos()) : "block must be equal"; - } - break; - - case NoOptimization: - // nothing to do - break; - - default: - throw new CiBailout("other states not allowed at this time"); - } - } - - // called during register allocation - void changeSpillState(Interval interval, int spillPos) { - switch (interval.spillState()) { - case NoSpillStore: { - int defLoopDepth = blockForId(interval.spillDefinitionPos()).loopDepth(); - int spillLoopDepth = blockForId(spillPos).loopDepth(); - - if (defLoopDepth < spillLoopDepth) { - // the loop depth of the spilling position is higher then the loop depth - // at the definition of the interval . move write to memory out of loop - // by storing at definitin of the interval - interval.setSpillState(SpillState.StoreAtDefinition); - } else { - // the interval is currently spilled only once, so for now there is no - // reason to store the interval at the definition - interval.setSpillState(SpillState.OneSpillStore); - } - break; - } - - case OneSpillStore: { - // the interval is spilled more then once, so it is better to store it to - // memory at the definition - interval.setSpillState(SpillState.StoreAtDefinition); - break; - } - - case StoreAtDefinition: - case StartInMemory: - case NoOptimization: - case NoDefinitionFound: - // nothing to do - break; - - default: - throw new CiBailout("other states not allowed at this time"); - } - } - - abstract static class IntervalPredicate { - abstract boolean apply(Interval i); - } - - private static final IntervalPredicate mustStoreAtDefinition = new IntervalPredicate() { - @Override - public boolean apply(Interval i) { - return i.isSplitParent() && i.spillState() == SpillState.StoreAtDefinition; - } - }; - - // called once before assignment of register numbers - void eliminateSpillMoves() { - if (C1XOptions.TraceLinearScanLevel >= 3) { - TTY.println(" Eliminating unnecessary spill moves"); - } - - // collect all intervals that must be stored after their definition. - // the list is sorted by Interval.spillDefinitionPos - Interval interval; - interval = createUnhandledLists(mustStoreAtDefinition, null).first; - if (C1XOptions.DetailedAsserts) { - checkIntervals(interval); - } - - LIRInsertionBuffer insertionBuffer = new LIRInsertionBuffer(); - int numBlocks = blockCount(); - for (int i = 0; i < numBlocks; i++) { - LIRBlock block = blockAt(i); - List<LIRInstruction> instructions = block.lir().instructionsList(); - int numInst = instructions.size(); - boolean hasNew = false; - - // iterate all instructions of the block. skip the first because it is always a label - for (int j = 1; j < numInst; j++) { - LIRInstruction op = instructions.get(j); - int opId = op.id; - - if (opId == -1) { - CiValue resultOperand = op.result(); - // remove move from register to stack if the stack slot is guaranteed to be correct. - // only moves that have been inserted by LinearScan can be removed. - assert op.code == LIROpcode.Move : "only moves can have a opId of -1"; - assert resultOperand.isVariable() : "LinearScan inserts only moves to variables"; - - LIROp1 op1 = (LIROp1) op; - Interval curInterval = intervalFor(resultOperand); - - if (!curInterval.location().isRegister() && curInterval.alwaysInMemory()) { - // move target is a stack slot that is always correct, so eliminate instruction - if (C1XOptions.TraceLinearScanLevel >= 4) { - TTY.println("eliminating move from interval %d to %d", operandNumber(op1.operand()), operandNumber(op1.result())); - } - instructions.set(j, null); // null-instructions are deleted by assignRegNum - } - - } else { - // insert move from register to stack just after the beginning of the interval - assert interval == Interval.EndMarker || interval.spillDefinitionPos() >= opId : "invalid order"; - assert interval == Interval.EndMarker || (interval.isSplitParent() && interval.spillState() == SpillState.StoreAtDefinition) : "invalid interval"; - - while (interval != Interval.EndMarker && interval.spillDefinitionPos() == opId) { - if (!hasNew) { - // prepare insertion buffer (appended when all instructions of the block are processed) - insertionBuffer.init(block.lir()); - hasNew = true; - } - - CiValue fromLocation = interval.location(); - CiValue toLocation = canonicalSpillOpr(interval); - - assert fromLocation.isRegister() : "from operand must be a register but is: " + fromLocation + " toLocation=" + toLocation + " spillState=" + interval.spillState(); - assert toLocation.isStackSlot() : "to operand must be a stack slot"; - - insertionBuffer.move(j, fromLocation, toLocation, null); - - if (C1XOptions.TraceLinearScanLevel >= 4) { - CiStackSlot slot = interval.spillSlot(); - TTY.println("inserting move after definition of interval %d to stack slot %d%s at opId %d", - interval.operandNumber, slot.index(), slot.inCallerFrame() ? " in caller frame" : "", opId); - } - - interval = interval.next; - } - } - } // end of instruction iteration - - if (hasNew) { - block.lir().append(insertionBuffer); - } - } // end of block iteration - - assert interval == Interval.EndMarker : "missed an interval"; - } - - private void checkIntervals(Interval interval) { - Interval prev = null; - Interval temp = interval; - while (temp != Interval.EndMarker) { - assert temp.spillDefinitionPos() > 0 : "invalid spill definition pos"; - if (prev != null) { - assert temp.from() >= prev.from() : "intervals not sorted"; - assert temp.spillDefinitionPos() >= prev.spillDefinitionPos() : "when intervals are sorted by from : then they must also be sorted by spillDefinitionPos"; - } - - assert temp.spillSlot() != null : "interval has no spill slot assigned"; - assert temp.spillDefinitionPos() >= temp.from() : "invalid order"; - assert temp.spillDefinitionPos() <= temp.from() + 2 : "only intervals defined once at their start-pos can be optimized"; - - if (C1XOptions.TraceLinearScanLevel >= 4) { - TTY.println("interval %d (from %d to %d) must be stored at %d", temp.operandNumber, temp.from(), temp.to(), temp.spillDefinitionPos()); - } - - prev = temp; - temp = temp.next; - } - } - - /** - * Numbers all instructions in all blocks. The numbering follows the {@linkplain ComputeLinearScanOrder linear scan order}. - */ - void numberInstructions() { - // Assign IDs to LIR nodes and build a mapping, lirOps, from ID to LIRInstruction node. - int numBlocks = blockCount(); - int numInstructions = 0; - for (int i = 0; i < numBlocks; i++) { - numInstructions += blockAt(i).lir().instructionsList().size(); - } - - // initialize with correct length - opIdToInstructionMap = new LIRInstruction[numInstructions]; - opIdToBlockMap = new LIRBlock[numInstructions]; - - int opId = 0; - int index = 0; - - for (int i = 0; i < numBlocks; i++) { - LIRBlock block = blockAt(i); - block.setFirstLirInstructionId(opId); - List<LIRInstruction> instructions = block.lir().instructionsList(); - - int numInst = instructions.size(); - for (int j = 0; j < numInst; j++) { - LIRInstruction op = instructions.get(j); - op.id = opId; - - opIdToInstructionMap[index] = op; - opIdToBlockMap[index] = block; - assert instructionForId(opId) == op : "must match"; - - index++; - opId += 2; // numbering of lirOps by two - } - block.setLastLirInstructionId((opId - 2)); - } - assert index == numInstructions : "must match"; - assert (index << 1) == opId : "must match: " + (index << 1); - } - - /** - * Computes local live sets (i.e. {@link LIRBlock#liveGen} and {@link LIRBlock#liveKill}) separately for each block. - */ - void computeLocalLiveSets() { - int numBlocks = blockCount(); - int liveSize = liveSetSize(); - - BitMap2D localIntervalInLoop = new BitMap2D(operands.size(), numLoops()); - - // iterate all blocks - for (int i = 0; i < numBlocks; i++) { - LIRBlock block = blockAt(i); - final CiBitMap liveGen = new CiBitMap(liveSize); - final CiBitMap liveKill = new CiBitMap(liveSize); - - List<LIRInstruction> instructions = block.lir().instructionsList(); - int numInst = instructions.size(); - - // iterate all instructions of the block. skip the first because it is always a label - assert !instructions.get(0).hasOperands() : "first operation must always be a label"; - for (int j = 1; j < numInst; j++) { - final LIRInstruction op = instructions.get(j); - - // iterate input operands of instruction - int n = op.operandCount(LIRInstruction.OperandMode.Input); - for (int k = 0; k < n; k++) { - CiValue operand = op.operandAt(LIRInstruction.OperandMode.Input, k); - - if (operand.isVariable()) { - int operandNum = operandNumber(operand); - if (!liveKill.get(operandNum)) { - liveGen.set(operandNum); - if (C1XOptions.TraceLinearScanLevel >= 4) { - TTY.println(" Setting liveGen for operand %d at instruction %d", operandNum, op.id); - } - } - if (block.loopIndex() >= 0) { - localIntervalInLoop.setBit(operandNum, block.loopIndex()); - } - } - - if (C1XOptions.DetailedAsserts) { - assert operand.isVariableOrRegister() : "visitor should only return register operands"; - verifyInput(block, liveKill, operand); - } - } - - // Add uses of live locals from interpreter's point of view for proper debug information generation - LIRDebugInfo info = op.info; - if (info != null) { - info.state.forEachLiveStateValue(new ValueProcedure() { - public void doValue(Value value) { - CiValue operand = value.operand(); - if (operand.isVariable()) { - int operandNum = operandNumber(operand); - if (!liveKill.get(operandNum)) { - liveGen.set(operandNum); - if (C1XOptions.TraceLinearScanLevel >= 4) { - TTY.println(" Setting liveGen for value %s, LIR opId %d, operand %d because of state for " + op.toString(), Util.valueString(value), op.id, operandNum); - } - } - } else if (operand.isRegister()) { - assert !isProcessed(operand) && !operand.kind.isObject(); - } else { - assert operand.isConstant() || operand.isIllegal() : "invalid operand for deoptimization value: " + value; - } - } - }); - } - - // iterate temp operands of instruction - n = op.operandCount(LIRInstruction.OperandMode.Temp); - for (int k = 0; k < n; k++) { - CiValue operand = op.operandAt(LIRInstruction.OperandMode.Temp, k); - - if (operand.isVariable()) { - int varNum = operandNumber(operand); - liveKill.set(varNum); - if (block.loopIndex() >= 0) { - localIntervalInLoop.setBit(varNum, block.loopIndex()); - } - } - - if (C1XOptions.DetailedAsserts) { - assert operand.isVariableOrRegister() : "visitor should only return register operands"; - verifyTemp(liveKill, operand); - } - } - - // iterate output operands of instruction - n = op.operandCount(LIRInstruction.OperandMode.Output); - for (int k = 0; k < n; k++) { - CiValue operand = op.operandAt(LIRInstruction.OperandMode.Output, k); - - if (operand.isVariable()) { - int varNum = operandNumber(operand); - liveKill.set(varNum); - if (block.loopIndex() >= 0) { - localIntervalInLoop.setBit(varNum, block.loopIndex()); - } - } - - if (C1XOptions.DetailedAsserts) { - assert operand.isVariableOrRegister() : "visitor should only return register operands"; - // fixed intervals are never live at block boundaries, so - // they need not be processed in live sets - // process them only in debug mode so that this can be checked - verifyTemp(liveKill, operand); - } - } - } // end of instruction iteration - - block.liveGen = liveGen; - block.liveKill = liveKill; - block.liveIn = new CiBitMap(liveSize); - block.liveOut = new CiBitMap(liveSize); - - if (C1XOptions.TraceLinearScanLevel >= 4) { - TTY.println("liveGen B%d %s", block.blockID(), block.liveGen); - TTY.println("liveKill B%d %s", block.blockID(), block.liveKill); - } - } // end of block iteration - - intervalInLoop = localIntervalInLoop; - } - - private void verifyTemp(CiBitMap liveKill, CiValue operand) { - // fixed intervals are never live at block boundaries, so - // they need not be processed in live sets - // process them only in debug mode so that this can be checked - if (!operand.isVariable()) { - if (isProcessed(operand)) { - liveKill.set(operandNumber(operand)); - } - } - } - - private void verifyInput(LIRBlock block, CiBitMap liveKill, CiValue operand) { - // fixed intervals are never live at block boundaries, so - // they need not be processed in live sets. - // this is checked by these assertions to be sure about it. - // the entry block may have incoming - // values in registers, which is ok. - if (!operand.isVariable() && block != ir.startBlock) { - if (isProcessed(operand)) { - assert liveKill.get(operandNumber(operand)) : "using fixed register that is not defined in this block"; - } - } - } - - /** - * Performs a backward dataflow analysis to compute global live sets (i.e. {@link LIRBlock#liveIn} and - * {@link LIRBlock#liveOut}) for each block. - */ - void computeGlobalLiveSets() { - int numBlocks = blockCount(); - boolean changeOccurred; - boolean changeOccurredInBlock; - int iterationCount = 0; - CiBitMap liveOut = new CiBitMap(liveSetSize()); // scratch set for calculations - - // Perform a backward dataflow analysis to compute liveOut and liveIn for each block. - // The loop is executed until a fixpoint is reached (no changes in an iteration) - do { - changeOccurred = false; - - // iterate all blocks in reverse order - for (int i = numBlocks - 1; i >= 0; i--) { - LIRBlock block = blockAt(i); - - changeOccurredInBlock = false; - - // liveOut(block) is the union of liveIn(sux), for successors sux of block - int n = block.numberOfSux(); - if (n > 0) { - // block has successors - if (n > 0) { - liveOut.setFrom(block.suxAt(0).liveIn); - for (int j = 1; j < n; j++) { - liveOut.setUnion(block.suxAt(j).liveIn); - } - } else { - liveOut.clearAll(); - } - - if (!block.liveOut.isSame(liveOut)) { - // A change occurred. Swap the old and new live out sets to avoid copying. - CiBitMap temp = block.liveOut; - block.liveOut = liveOut; - liveOut = temp; - - changeOccurred = true; - changeOccurredInBlock = true; - } - } - - if (iterationCount == 0 || changeOccurredInBlock) { - // liveIn(block) is the union of liveGen(block) with (liveOut(block) & !liveKill(block)) - // note: liveIn has to be computed only in first iteration or if liveOut has changed! - CiBitMap liveIn = block.liveIn; - liveIn.setFrom(block.liveOut); - liveIn.setDifference(block.liveKill); - liveIn.setUnion(block.liveGen); - } - - if (C1XOptions.TraceLinearScanLevel >= 4) { - traceLiveness(changeOccurredInBlock, iterationCount, block); - } - } - iterationCount++; - - if (changeOccurred && iterationCount > 50) { - throw new CiBailout("too many iterations in computeGlobalLiveSets"); - } - } while (changeOccurred); - - if (C1XOptions.DetailedAsserts) { - verifyLiveness(numBlocks); - } - - // check that the liveIn set of the first block is empty - LIRBlock startBlock = ir.startBlock; - CiBitMap liveInArgs = new CiBitMap(startBlock.liveIn.size()); - if (!startBlock.liveIn.isSame(liveInArgs)) { - if (C1XOptions.DetailedAsserts) { - reportFailure(numBlocks); - } - - TTY.println("preds=" + startBlock.blockPredecessors().size() + ", succs=" + startBlock.blockSuccessors().size()); - TTY.println("startBlock-ID: " + startBlock.blockID()); - - // bailout of if this occurs in product mode. - throw new CiBailout("liveIn set of first block must be empty"); - } - } - - private void reportFailure(int numBlocks) { - TTY.println(compilation.method.toString()); - TTY.println("Error: liveIn set of first block must be empty (when this fails, variables are used before they are defined)"); - TTY.print("affected registers:"); - TTY.println(ir.startBlock.liveIn.toString()); - - // print some additional information to simplify debugging - for (int operandNum = 0; operandNum < ir.startBlock.liveIn.size(); operandNum++) { - if (ir.startBlock.liveIn.get(operandNum)) { - CiValue operand = operands.operandFor(operandNum); - Value instr = operand.isVariable() ? gen.operands.instructionForResult(((CiVariable) operand)) : null; - TTY.println(" var %d (HIR instruction %s)", operandNum, instr == null ? " " : instr.toString()); - - if (instr instanceof Phi) { - Phi phi = (Phi) instr; - TTY.println("phi block begin: " + phi.block()); - TTY.println("pred count on blockbegin: " + phi.block().predecessors().size()); - TTY.println("phi values: " + phi.valueCount()); - TTY.println("phi block preds:"); - for (Node n : phi.block().predecessors()) { - TTY.println(n.toString()); - } - } - - for (int j = 0; j < numBlocks; j++) { - LIRBlock block = blockAt(j); - if (block.liveGen.get(operandNum)) { - TTY.println(" used in block B%d", block.blockID()); - for (LIRInstruction ins : block.lir().instructionsList()) { - TTY.println(ins.id + ": " + ins.result() + " " + ins.toString()); - } - } - if (block.liveKill.get(operandNum)) { - TTY.println(" defined in block B%d", block.blockID()); - for (LIRInstruction ins : block.lir().instructionsList()) { - TTY.println(ins.id + ": " + ins.result() + " " + ins.toString()); - } - } - } - } - } - } - - private void verifyLiveness(int numBlocks) { - // check that fixed intervals are not live at block boundaries - // (live set must be empty at fixed intervals) - for (int i = 0; i < numBlocks; i++) { - LIRBlock block = blockAt(i); - for (int j = 0; j <= operands.maxRegisterNumber(); j++) { - assert !block.liveIn.get(j) : "liveIn set of fixed register must be empty"; - assert !block.liveOut.get(j) : "liveOut set of fixed register must be empty"; - assert !block.liveGen.get(j) : "liveGen set of fixed register must be empty"; - } - } - } - - private void traceLiveness(boolean changeOccurredInBlock, int iterationCount, LIRBlock block) { - char c = iterationCount == 0 || changeOccurredInBlock ? '*' : ' '; - TTY.print("(%d) liveIn%c B%d ", iterationCount, c, block.blockID()); - TTY.println(block.liveIn.toString()); - TTY.print("(%d) liveOut%c B%d ", iterationCount, c, block.blockID()); - TTY.println(block.liveOut.toString()); - } - - Interval addUse(CiValue operand, int from, int to, RegisterPriority registerPriority, CiKind kind) { - if (!isProcessed(operand)) { - return null; - } - if (C1XOptions.TraceLinearScanLevel >= 2 && kind == null) { - TTY.println(" use %s from %d to %d (%s)", operand, from, to, registerPriority.name()); - } - - if (kind == null) { - kind = operand.kind.stackKind(); - } - Interval interval = intervalFor(operand); - if (interval == null) { - interval = createInterval(operand); - } - - if (kind != CiKind.Illegal) { - interval.setKind(kind); - } - - if (operand.isVariable() && gen.operands.mustStayInMemory((CiVariable) operand)) { - interval.addRange(from, maxOpId()); - } else { - interval.addRange(from, to); - } - - interval.addUsePos(to, registerPriority); - return interval; - } - - void addTemp(CiValue operand, int tempPos, RegisterPriority registerPriority, CiKind kind) { - if (!isProcessed(operand)) { - return; - } - Interval interval = intervalFor(operand); - if (interval == null) { - interval = createInterval(operand); - } - - if (kind != CiKind.Illegal) { - interval.setKind(kind); - } - - interval.addRange(tempPos, tempPos + 1); - interval.addUsePos(tempPos, registerPriority); - } - - boolean isProcessed(CiValue operand) { - return !operand.isRegister() || attributes(operand.asRegister()).isAllocatable; - } - - void addDef(CiValue operand, int defPos, RegisterPriority registerPriority, CiKind kind) { - if (!isProcessed(operand)) { - return; - } - if (C1XOptions.TraceLinearScanLevel >= 2) { - TTY.println(" def %s defPos %d (%s)", operand, defPos, registerPriority.name()); - } - Interval interval = intervalFor(operand); - if (interval != null) { - - if (kind != CiKind.Illegal) { - interval.setKind(kind); - } - - Range r = interval.first(); - if (r.from <= defPos) { - // Update the starting point (when a range is first created for a use, its - // start is the beginning of the current block until a def is encountered.) - r.from = defPos; - interval.addUsePos(defPos, registerPriority); - - } else { - // Dead value - make vacuous interval - // also add register priority for dead intervals - interval.addRange(defPos, defPos + 1); - interval.addUsePos(defPos, registerPriority); - if (C1XOptions.TraceLinearScanLevel >= 2) { - TTY.println("Warning: def of operand %s at %d occurs without use", operand, defPos); - } - } - - } else { - // Dead value - make vacuous interval - // also add register priority for dead intervals - interval = createInterval(operand); - if (kind != CiKind.Illegal) { - interval.setKind(kind); - } - - interval.addRange(defPos, defPos + 1); - interval.addUsePos(defPos, registerPriority); - if (C1XOptions.TraceLinearScanLevel >= 2) { - TTY.println("Warning: dead value %s at %d in live intervals", operand, defPos); - } - } - - changeSpillDefinitionPos(interval, defPos); - if (registerPriority == RegisterPriority.None && interval.spillState().ordinal() <= SpillState.StartInMemory.ordinal()) { - // detection of method-parameters and roundfp-results - // TODO: move this directly to position where use-kind is computed - interval.setSpillState(SpillState.StartInMemory); - } - } - - /** - * Determines the register priority for an instruction's output/result operand. - */ - RegisterPriority registerPriorityOfOutputOperand(LIRInstruction op, CiValue operand) { - if (op.code == LIROpcode.Move) { - LIROp1 move = (LIROp1) op; - CiValue res = move.result(); - boolean resultInMemory = res.isVariable() && operands.mustStartInMemory((CiVariable) res); - - if (resultInMemory) { - // Begin of an interval with mustStartInMemory set. - // This interval will always get a stack slot first, so return noUse. - return RegisterPriority.None; - - } else if (move.operand().isStackSlot()) { - // method argument (condition must be equal to handleMethodArguments) - return RegisterPriority.None; - - } - } - - if (operand.isVariable() && operands.mustStartInMemory((CiVariable) operand)) { - // result is a stack-slot, so prevent immediate reloading - return RegisterPriority.None; - } - - // all other operands require a register - return RegisterPriority.MustHaveRegister; - } - - /** - * Determines the priority which with an instruction's input operand will be allocated a register. - */ - RegisterPriority registerPriorityOfInputOperand(LIRInstruction op, CiValue operand) { - if (op.code == LIROpcode.Move) { - LIROp1 move = (LIROp1) op; - CiValue res = move.result(); - boolean resultInMemory = res.isVariable() && operands.mustStartInMemory((CiVariable) res); - - if (resultInMemory) { - // Move to an interval with mustStartInMemory set. - // To avoid moves from stack to stack (not allowed) force the input operand to a register - return RegisterPriority.MustHaveRegister; - - } else if (move.operand().isVariableOrRegister() && move.result().isVariableOrRegister()) { - // The input operand is not forced to a register (moves from stack to register are allowed), - // but it is faster if the input operand is in a register - return RegisterPriority.ShouldHaveRegister; - } - } - - if (compilation.target.arch.isX86()) { - if (op.code == LIROpcode.Cmove) { - // conditional moves can handle stack operands - assert op.result().isVariableOrRegister(); - return RegisterPriority.ShouldHaveRegister; - } - - // optimizations for second input operand of arithmetic operations on Intel - // this operand is allowed to be on the stack in some cases - CiKind kind = operand.kind.stackKind(); - if (kind == CiKind.Float || kind == CiKind.Double) { - // SSE float instruction (CiKind.Double only supported with SSE2) - switch (op.code) { - case Cmp: - case Add: - case Sub: - case Mul: - case Div: { - LIROp2 op2 = (LIROp2) op; - if (op2.operand1() != op2.operand2() && op2.operand2() == operand) { - assert (op2.result().isVariableOrRegister() || op.code == LIROpcode.Cmp) && op2.operand1().isVariableOrRegister() : "cannot mark second operand as stack if others are not in register"; - return RegisterPriority.ShouldHaveRegister; - } - } - } - } else if (kind != CiKind.Long) { - // integer instruction (note: long operands must always be in register) - switch (op.code) { - case Cmp: - case Add: - case Sub: - case LogicAnd: - case LogicOr: - case LogicXor: { - LIROp2 op2 = (LIROp2) op; - if (op2.operand1() != op2.operand2() && op2.operand2() == operand) { - assert (op2.result().isVariableOrRegister() || op.code == LIROpcode.Cmp) && op2.operand1().isVariableOrRegister() : "cannot mark second operand as stack if others are not in register"; - return RegisterPriority.ShouldHaveRegister; - } - } - } - } - } // X86 - - // all other operands require a register - return RegisterPriority.MustHaveRegister; - } - - /** - * Optimizes moves related to incoming stack based arguments. - * The interval for the destination of such moves is assigned - * the stack slot (which is in the caller's frame) as its - * spill slot. - */ - void handleMethodArguments(LIRInstruction op) { - if (op.code == LIROpcode.Move) { - LIROp1 move = (LIROp1) op; - - if (move.operand().isStackSlot()) { - CiStackSlot slot = (CiStackSlot) move.operand(); - if (C1XOptions.DetailedAsserts) { - int argSlots = compilation.method.signature().argumentSlots(!isStatic(compilation.method.accessFlags())); - assert slot.index() >= 0 && slot.index() < argSlots; - assert move.id > 0 : "invalid id"; - assert blockForId(move.id).numberOfPreds() == 0 : "move from stack must be in first block"; - assert move.result().isVariable() : "result of move must be a variable"; - - if (C1XOptions.TraceLinearScanLevel >= 4) { - TTY.println("found move from stack slot %s to %s", slot, move.result()); - } - } - - Interval interval = intervalFor(move.result()); - CiStackSlot copySlot = slot; - if (C1XOptions.CopyPointerStackArguments && slot.kind == CiKind.Object) { - copySlot = allocateSpillSlot(slot.kind); - } - interval.setSpillSlot(copySlot); - interval.assignLocation(copySlot); - } - } - } - - void addRegisterHints(LIRInstruction op) { - switch (op.code) { - case Move: // fall through - case Convert: { - LIROp1 move = (LIROp1) op; - - CiValue moveFrom = move.operand(); - CiValue moveTo = move.result(); - - if (moveTo.isVariableOrRegister() && moveFrom.isVariableOrRegister()) { - Interval from = intervalFor(moveFrom); - Interval to = intervalFor(moveTo); - if (from != null && to != null) { - to.setLocationHint(from); - if (C1XOptions.TraceLinearScanLevel >= 4) { - TTY.println("operation at opId %d: added hint from interval %d to %d", move.id, from.operandNumber, to.operandNumber); - } - } - } - break; - } - case Cmove: { - LIROp2 cmove = (LIROp2) op; - - CiValue moveFrom = cmove.operand1(); - CiValue moveTo = cmove.result(); - - if (moveTo.isVariableOrRegister() && moveFrom.isVariableOrRegister()) { - Interval from = intervalFor(moveFrom); - Interval to = intervalFor(moveTo); - if (from != null && to != null) { - to.setLocationHint(from); - if (C1XOptions.TraceLinearScanLevel >= 4) { - TTY.println("operation at opId %d: added hint from interval %d to %d", cmove.id, from.operandNumber, to.operandNumber); - } - } - } - break; - } - } - } - - void buildIntervals() { - intervalsSize = operands.size(); - intervals = new Interval[intervalsSize + INITIAL_SPLIT_INTERVALS_CAPACITY]; - - // create a list with all caller-save registers (cpu, fpu, xmm) - RiRegisterConfig registerConfig = compilation.registerConfig; - CiRegister[] callerSaveRegs = registerConfig.getCallerSaveRegisters(); - - // iterate all blocks in reverse order - for (int i = blockCount() - 1; i >= 0; i--) { - LIRBlock block = blockAt(i); - List<LIRInstruction> instructions = block.lir().instructionsList(); - final int blockFrom = block.firstLirInstructionId(); - int blockTo = block.lastLirInstructionId(); - - assert blockFrom == instructions.get(0).id; - assert blockTo == instructions.get(instructions.size() - 1).id; - - // Update intervals for operands live at the end of this block; - CiBitMap live = block.liveOut; - for (int operandNum = live.nextSetBit(0); operandNum >= 0; operandNum = live.nextSetBit(operandNum + 1)) { - assert live.get(operandNum) : "should not stop here otherwise"; - CiValue operand = operands.operandFor(operandNum); - if (C1XOptions.TraceLinearScanLevel >= 2) { - TTY.println("live in %s to %d", operand, blockTo + 2); - } - - addUse(operand, blockFrom, blockTo + 2, RegisterPriority.None, CiKind.Illegal); - - // add special use positions for loop-end blocks when the - // interval is used anywhere inside this loop. It's possible - // that the block was part of a non-natural loop, so it might - // have an invalid loop index. - if (block.isLinearScanLoopEnd() && block.loopIndex() != -1 && isIntervalInLoop(operandNum, block.loopIndex())) { - intervalFor(operand).addUsePos(blockTo + 1, RegisterPriority.LiveAtLoopEnd); - } - } - - // iterate all instructions of the block in reverse order. - // skip the first instruction because it is always a label - // definitions of intervals are processed before uses - assert !instructions.get(0).hasOperands() : "first operation must always be a label"; - for (int j = instructions.size() - 1; j >= 1; j--) { - LIRInstruction op = instructions.get(j); - final int opId = op.id; - - // add a temp range for each register if operation destroys caller-save registers - if (op.hasCall) { - for (CiRegister r : callerSaveRegs) { - if (attributes(r).isAllocatable) { - addTemp(r.asValue(), opId, RegisterPriority.None, CiKind.Illegal); - } - } - if (C1XOptions.TraceLinearScanLevel >= 4) { - TTY.println("operation destroys all caller-save registers"); - } - } - - // Add any platform dependent temps - pdAddTemps(op); - - // visit definitions (output and temp operands) - int k; - int n; - n = op.operandCount(LIRInstruction.OperandMode.Output); - for (k = 0; k < n; k++) { - CiValue operand = op.operandAt(LIRInstruction.OperandMode.Output, k); - assert operand.isVariableOrRegister(); - addDef(operand, opId, registerPriorityOfOutputOperand(op, operand), operand.kind.stackKind()); - } - - n = op.operandCount(LIRInstruction.OperandMode.Temp); - for (k = 0; k < n; k++) { - CiValue operand = op.operandAt(LIRInstruction.OperandMode.Temp, k); - assert operand.isVariableOrRegister(); - if (C1XOptions.TraceLinearScanLevel >= 2) { - TTY.println(" temp %s tempPos %d (%s)", operand, opId, RegisterPriority.MustHaveRegister.name()); - } - addTemp(operand, opId, RegisterPriority.MustHaveRegister, operand.kind.stackKind()); - } - - // visit uses (input operands) - n = op.operandCount(LIRInstruction.OperandMode.Input); - for (k = 0; k < n; k++) { - CiValue operand = op.operandAt(LIRInstruction.OperandMode.Input, k); - assert operand.isVariableOrRegister(); - RegisterPriority p = registerPriorityOfInputOperand(op, operand); - Interval interval = addUse(operand, blockFrom, opId, p, null); - if (interval != null && op instanceof LIRXirInstruction) { - Range range = interval.first(); - // (tw) Increase range by 1 in order to overlap the input with the temp and the output operand. - if (range.to == opId) { - range.to++; - } - } - } - - // Add uses of live locals from interpreter's point of view for proper - // debug information generation - // Treat these operands as temp values (if the live range is extended - // to a call site, the value would be in a register at the call otherwise) - LIRDebugInfo info = op.info; - if (info != null) { - info.state.forEachLiveStateValue(new ValueProcedure() { - public void doValue(Value value) { - CiValue operand = value.operand(); - if (operand.isVariableOrRegister()) { - addUse(operand, blockFrom, (opId + 1), RegisterPriority.None, null); - } - } - }); - } - - // special steps for some instructions (especially moves) - handleMethodArguments(op); - addRegisterHints(op); - - } // end of instruction iteration - } // end of block iteration - - // add the range [0, 1] to all fixed intervals. - // the register allocator need not handle unhandled fixed intervals - for (Interval interval : intervals) { - if (interval != null && interval.operand.isRegister()) { - interval.addRange(0, 1); - } - } - } - - // * Phase 5: actual register allocation - - private void pdAddTemps(LIRInstruction op) { - // TODO Platform dependent! - assert compilation.target.arch.isX86(); - - switch (op.code) { - case Tan: - case Sin: - case Cos: { - // The slow path for these functions may need to save and - // restore all live registers but we don't want to save and - // restore everything all the time, so mark the xmms as being - // killed. If the slow path were explicit or we could propagate - // live register masks down to the assembly we could do better - // but we don't have any easy way to do that right now. We - // could also consider not killing all xmm registers if we - // assume that slow paths are uncommon but it's not clear that - // would be a good idea. - if (C1XOptions.TraceLinearScanLevel >= 2) { - TTY.println("killing XMMs for trig"); - } - int opId = op.id; - - for (CiRegister r : compilation.registerConfig.getCallerSaveRegisters()) { - if (r.isFpu()) { - addTemp(r.asValue(), opId, RegisterPriority.None, CiKind.Illegal); - } - } - break; - } - } - - } - - boolean isSorted(Interval[] intervals) { - int from = -1; - for (Interval interval : intervals) { - assert interval != null; - assert from <= interval.from(); - from = interval.from(); - - // XXX: very slow! - assert Arrays.asList(this.intervals).contains(interval); - } - return true; - } - - Interval addToList(Interval first, Interval prev, Interval interval) { - Interval newFirst = first; - if (prev != null) { - prev.next = interval; - } else { - newFirst = interval; - } - return newFirst; - } - - Interval.Pair createUnhandledLists(IntervalPredicate isList1, IntervalPredicate isList2) { - assert isSorted(sortedIntervals) : "interval list is not sorted"; - - Interval list1 = Interval.EndMarker; - Interval list2 = Interval.EndMarker; - - Interval list1Prev = null; - Interval list2Prev = null; - Interval v; - - int n = sortedIntervals.length; - for (int i = 0; i < n; i++) { - v = sortedIntervals[i]; - if (v == null) { - continue; - } - - if (isList1.apply(v)) { - list1 = addToList(list1, list1Prev, v); - list1Prev = v; - } else if (isList2 == null || isList2.apply(v)) { - list2 = addToList(list2, list2Prev, v); - list2Prev = v; - } - } - - if (list1Prev != null) { - list1Prev.next = Interval.EndMarker; - } - if (list2Prev != null) { - list2Prev.next = Interval.EndMarker; - } - - assert list1Prev == null || list1Prev.next == Interval.EndMarker : "linear list ends not with sentinel"; - assert list2Prev == null || list2Prev.next == Interval.EndMarker : "linear list ends not with sentinel"; - - return new Interval.Pair(list1, list2); - } - - void sortIntervalsBeforeAllocation() { - int sortedLen = 0; - for (Interval interval : intervals) { - if (interval != null) { - sortedLen++; - } - } - - Interval[] sortedList = new Interval[sortedLen]; - int sortedIdx = 0; - int sortedFromMax = -1; - - // special sorting algorithm: the original interval-list is almost sorted, - // only some intervals are swapped. So this is much faster than a complete QuickSort - for (Interval interval : intervals) { - if (interval != null) { - int from = interval.from(); - - if (sortedFromMax <= from) { - sortedList[sortedIdx++] = interval; - sortedFromMax = interval.from(); - } else { - // the assumption that the intervals are already sorted failed, - // so this interval must be sorted in manually - int j; - for (j = sortedIdx - 1; j >= 0 && from < sortedList[j].from(); j--) { - sortedList[j + 1] = sortedList[j]; - } - sortedList[j + 1] = interval; - sortedIdx++; - } - } - } - sortedIntervals = sortedList; - } - - void sortIntervalsAfterAllocation() { - if (firstDerivedIntervalIndex == -1) { - // no intervals have been added during allocation, so sorted list is already up to date - return; - } - - Interval[] oldList = sortedIntervals; - Interval[] newList = Arrays.copyOfRange(intervals, firstDerivedIntervalIndex, intervalsSize); - int oldLen = oldList.length; - int newLen = newList.length; - - // conventional sort-algorithm for new intervals - Arrays.sort(newList, INTERVAL_COMPARATOR); - - // merge old and new list (both already sorted) into one combined list - Interval[] combinedList = new Interval[oldLen + newLen]; - int oldIdx = 0; - int newIdx = 0; - - while (oldIdx + newIdx < combinedList.length) { - if (newIdx >= newLen || (oldIdx < oldLen && oldList[oldIdx].from() <= newList[newIdx].from())) { - combinedList[oldIdx + newIdx] = oldList[oldIdx]; - oldIdx++; - } else { - combinedList[oldIdx + newIdx] = newList[newIdx]; - newIdx++; - } - } - - sortedIntervals = combinedList; - } - - private static final Comparator<Interval> INTERVAL_COMPARATOR = new Comparator<Interval>() { - - public int compare(Interval a, Interval b) { - if (a != null) { - if (b != null) { - return a.from() - b.from(); - } else { - return -1; - } - } else { - if (b != null) { - return 1; - } else { - return 0; - } - } - } - }; - - public void allocateRegisters() { - Interval precoloredIntervals; - Interval notPrecoloredIntervals; - - Interval.Pair result = createUnhandledLists(IS_PRECOLORED_INTERVAL, IS_VARIABLE_INTERVAL); - precoloredIntervals = result.first; - notPrecoloredIntervals = result.second; - - // allocate cpu registers - LinearScanWalker lsw = new LinearScanWalker(this, precoloredIntervals, notPrecoloredIntervals); - lsw.walk(); - lsw.finishAllocation(); - } - - // * Phase 6: resolve data flow - // (insert moves at edges between blocks if intervals have been split) - - // wrapper for Interval.splitChildAtOpId that performs a bailout in product mode - // instead of returning null - Interval splitChildAtOpId(Interval interval, int opId, LIRInstruction.OperandMode mode) { - Interval result = interval.getSplitChildAtOpId(opId, mode, this); - - if (result != null) { - if (C1XOptions.TraceLinearScanLevel >= 4) { - TTY.println("Split child at pos " + opId + " of interval " + interval.toString() + " is " + result.toString()); - } - return result; - } - - throw new CiBailout("LinearScan: interval is null"); - } - - Interval intervalAtBlockBegin(LIRBlock block, CiValue operand) { - assert operand.isVariable() : "register number out of bounds"; - assert intervalFor(operand) != null : "no interval found"; - - return splitChildAtOpId(intervalFor(operand), block.firstLirInstructionId(), LIRInstruction.OperandMode.Output); - } - - Interval intervalAtBlockEnd(LIRBlock block, CiValue operand) { - assert operand.isVariable() : "register number out of bounds"; - assert intervalFor(operand) != null : "no interval found"; - - return splitChildAtOpId(intervalFor(operand), block.lastLirInstructionId() + 1, LIRInstruction.OperandMode.Output); - } - - Interval intervalAtOpId(CiValue operand, int opId) { - assert operand.isVariable() : "register number out of bounds"; - assert intervalFor(operand) != null : "no interval found"; - - return splitChildAtOpId(intervalFor(operand), opId, LIRInstruction.OperandMode.Input); - } - - void resolveCollectMappings(LIRBlock fromBlock, LIRBlock toBlock, MoveResolver moveResolver) { - assert moveResolver.checkEmpty(); - - int numOperands = operands.size(); - CiBitMap liveAtEdge = toBlock.liveIn; - - // visit all variables for which the liveAtEdge bit is set - for (int operandNum = liveAtEdge.nextSetBit(0); operandNum >= 0; operandNum = liveAtEdge.nextSetBit(operandNum + 1)) { - assert operandNum < numOperands : "live information set for not exisiting interval"; - assert fromBlock.liveOut.get(operandNum) && toBlock.liveIn.get(operandNum) : "interval not live at this edge"; - - CiValue liveOperand = operands.operandFor(operandNum); - Interval fromInterval = intervalAtBlockEnd(fromBlock, liveOperand); - Interval toInterval = intervalAtBlockBegin(toBlock, liveOperand); - - if (fromInterval != toInterval && (fromInterval.location() != toInterval.location())) { - // need to insert move instruction - moveResolver.addMapping(fromInterval, toInterval); - } - } - } - - void resolveFindInsertPos(LIRBlock fromBlock, LIRBlock toBlock, MoveResolver moveResolver) { - if (fromBlock.numberOfSux() <= 1) { - if (C1XOptions.TraceLinearScanLevel >= 4) { - TTY.println("inserting moves at end of fromBlock B%d", fromBlock.blockID()); - } - - List<LIRInstruction> instructions = fromBlock.lir().instructionsList(); - LIRInstruction instr = instructions.get(instructions.size() - 1); - if (instr instanceof LIRBranch) { - LIRBranch branch = (LIRBranch) instr; - // insert moves before branch - assert branch.cond() == Condition.TRUE : "block does not end with an unconditional jump"; - moveResolver.setInsertPosition(fromBlock.lir(), instructions.size() - 2); - } else { - moveResolver.setInsertPosition(fromBlock.lir(), instructions.size() - 1); - } - - } else { - if (C1XOptions.TraceLinearScanLevel >= 4) { - TTY.println("inserting moves at beginning of toBlock B%d", toBlock.blockID()); - } - - if (C1XOptions.DetailedAsserts) { - assert fromBlock.lir().instructionsList().get(0) instanceof LIRLabel : "block does not start with a label"; - - // because the number of predecessor edges matches the number of - // successor edges, blocks which are reached by switch statements - // may have be more than one predecessor but it will be guaranteed - // that all predecessors will be the same. - for (int i = 0; i < toBlock.numberOfPreds(); i++) { - assert fromBlock == toBlock.predAt(i) : "all critical edges must be broken"; - } - } - - moveResolver.setInsertPosition(toBlock.lir(), 0); - } - } - - /** - * Inserts necessary moves (spilling or reloading) at edges between blocks for intervals that - * have been split. - */ - void resolveDataFlow() { - int numBlocks = blockCount(); - MoveResolver moveResolver = new MoveResolver(this); - CiBitMap blockCompleted = new CiBitMap(numBlocks); - CiBitMap alreadyResolved = new CiBitMap(numBlocks); - - int i; - for (i = 0; i < numBlocks; i++) { - LIRBlock block = blockAt(i); - - // check if block has only one predecessor and only one successor - if (block.numberOfPreds() == 1 && block.numberOfSux() == 1) { - List<LIRInstruction> instructions = block.lir().instructionsList(); - assert instructions.get(0).code == LIROpcode.Label : "block must start with label"; - assert instructions.get(instructions.size() - 1).code == LIROpcode.Branch : "block with successors must end with branch (" + block + "), " + instructions.get(instructions.size() - 1); - assert ((LIRBranch) instructions.get(instructions.size() - 1)).cond() == Condition.TRUE : "block with successor must end with unconditional branch"; - - // check if block is empty (only label and branch) - if (instructions.size() == 2) { - LIRBlock pred = block.predAt(0); - LIRBlock sux = block.suxAt(0); - - // prevent optimization of two consecutive blocks - if (!blockCompleted.get(pred.linearScanNumber()) && !blockCompleted.get(sux.linearScanNumber())) { - if (C1XOptions.TraceLinearScanLevel >= 3) { - TTY.println(" optimizing empty block B%d (pred: B%d, sux: B%d)", block.blockID(), pred.blockID(), sux.blockID()); - } - blockCompleted.set(block.linearScanNumber()); - - // directly resolve between pred and sux (without looking at the empty block between) - resolveCollectMappings(pred, sux, moveResolver); - if (moveResolver.hasMappings()) { - moveResolver.setInsertPosition(block.lir(), 0); - moveResolver.resolveAndAppendMoves(); - } - } - } - } - } - - for (i = 0; i < numBlocks; i++) { - if (!blockCompleted.get(i)) { - LIRBlock fromBlock = blockAt(i); - alreadyResolved.setFrom(blockCompleted); - - int numSux = fromBlock.numberOfSux(); - for (int s = 0; s < numSux; s++) { - LIRBlock toBlock = fromBlock.suxAt(s); - - // check for duplicate edges between the same blocks (can happen with switch blocks) - if (!alreadyResolved.get(toBlock.linearScanNumber())) { - if (C1XOptions.TraceLinearScanLevel >= 3) { - TTY.println(" processing edge between B%d and B%d", fromBlock.blockID(), toBlock.blockID()); - } - alreadyResolved.set(toBlock.linearScanNumber()); - - // collect all intervals that have been split between fromBlock and toBlock - resolveCollectMappings(fromBlock, toBlock, moveResolver); - if (moveResolver.hasMappings()) { - resolveFindInsertPos(fromBlock, toBlock, moveResolver); - moveResolver.resolveAndAppendMoves(); - } - } - } - } - } - } - - // * Phase 7: assign register numbers back to LIR - // (includes computation of debug information and oop maps) - - boolean verifyAssignedLocation(Interval interval, CiValue location) { - CiKind kind = interval.kind(); - - assert location.isRegister() || location.isStackSlot(); - - if (location.isRegister()) { - CiRegister reg = location.asRegister(); - - // register - switch (kind) { - case Byte: - case Char: - case Short: - case Jsr: - case Word: - case Object: - case Int: { - assert reg.isCpu() : "not cpu register"; - break; - } - - case Long: { - assert reg.isCpu() : "not cpu register"; - break; - } - - case Float: { - assert !compilation.target.arch.isX86() || reg.isFpu() : "not xmm register: " + reg; - break; - } - - case Double: { - assert !compilation.target.arch.isX86() || reg.isFpu() : "not xmm register: " + reg; - break; - } - - default: { - throw Util.shouldNotReachHere(); - } - } - } - return true; - } - - CiStackSlot canonicalSpillOpr(Interval interval) { - assert interval.spillSlot() != null : "canonical spill slot not set"; - return interval.spillSlot(); - } - - /** - * Assigns the allocated location for an LIR instruction operand back into the instruction. - * - * @param operand an LIR instruction operand - * @param opId the id of the LIR instruction using {@code operand} - * @param mode the usage mode for {@code operand} by the instruction - * @return the location assigned for the operand - */ - private CiValue colorLirOperand(CiVariable operand, int opId, OperandMode mode) { - Interval interval = intervalFor(operand); - assert interval != null : "interval must exist"; - - if (opId != -1) { - if (C1XOptions.DetailedAsserts) { - LIRBlock block = blockForId(opId); - if (block.numberOfSux() <= 1 && opId == block.lastLirInstructionId()) { - // check if spill moves could have been appended at the end of this block, but - // before the branch instruction. So the split child information for this branch would - // be incorrect. - LIRInstruction instr = block.lir().instructionsList().get(block.lir().instructionsList().size() - 1); - if (instr instanceof LIRBranch) { - LIRBranch branch = (LIRBranch) instr; - if (block.liveOut.get(operandNumber(operand))) { - assert branch.cond() == Condition.TRUE : "block does not end with an unconditional jump"; - throw new CiBailout("can't get split child for the last branch of a block because the information would be incorrect (moves are inserted before the branch in resolveDataFlow)"); - } - } - } - } - - // operands are not changed when an interval is split during allocation, - // so search the right interval here - interval = splitChildAtOpId(interval, opId, mode); - } - - return interval.location(); - } - - IntervalWalker initComputeOopMaps() { - // setup lists of potential oops for walking - Interval oopIntervals; - Interval nonOopIntervals; - - oopIntervals = createUnhandledLists(IS_OOP_INTERVAL, null).first; - - // intervals that have no oops inside need not to be processed. - // to ensure a walking until the last instruction id, add a dummy interval - // with a high operation id - nonOopIntervals = new Interval(CiValue.IllegalValue, -1); - nonOopIntervals.addRange(Integer.MAX_VALUE - 2, Integer.MAX_VALUE - 1); - - return new IntervalWalker(this, oopIntervals, nonOopIntervals); - } - - void computeOopMap(IntervalWalker iw, LIRInstruction op, LIRDebugInfo info, boolean isCallSite, CiBitMap frameRefMap, CiBitMap regRefMap) { - if (C1XOptions.TraceLinearScanLevel >= 3) { - TTY.println("creating oop map at opId %d", op.id); - } - - // walk before the current operation . intervals that start at - // the operation (i.e. output operands of the operation) are not - // included in the oop map - iw.walkBefore(op.id); - - // Iterate through active intervals - for (Interval interval = iw.activeLists.get(RegisterBinding.Fixed); interval != Interval.EndMarker; interval = interval.next) { - CiValue operand = interval.operand; - - assert interval.currentFrom() <= op.id && op.id <= interval.currentTo() : "interval should not be active otherwise"; - assert interval.operand.isVariable() : "fixed interval found"; - - // Check if this range covers the instruction. Intervals that - // start or end at the current operation are not included in the - // oop map, except in the case of patching moves. For patching - // moves, any intervals which end at this instruction are included - // in the oop map since we may safepoint while doing the patch - // before we've consumed the inputs. - if (op.id < interval.currentTo()) { - // caller-save registers must not be included into oop-maps at calls - assert !isCallSite || !operand.isRegister() || !isCallerSave(operand) : "interval is in a caller-save register at a call . register will be overwritten"; - - CiValue location = interval.location(); - if (location.isStackSlot()) { - location = frameMap.toStackAddress((CiStackSlot) location); - } - info.setOop(location, compilation, frameRefMap, regRefMap); - - // Spill optimization: when the stack value is guaranteed to be always correct, - // then it must be added to the oop map even if the interval is currently in a register - if (interval.alwaysInMemory() && op.id > interval.spillDefinitionPos() && !interval.location().equals(interval.spillSlot())) { - assert interval.spillDefinitionPos() > 0 : "position not set correctly"; - assert interval.spillSlot() != null : "no spill slot assigned"; - assert !interval.operand.isRegister() : "interval is on stack : so stack slot is registered twice"; - info.setOop(frameMap.toStackAddress(interval.spillSlot()), compilation, frameRefMap, regRefMap); - } - } - } - } - - private boolean isCallerSave(CiValue operand) { - return attributes(operand.asRegister()).isCallerSave; - } - - void computeOopMap(IntervalWalker iw, LIRInstruction op, LIRDebugInfo info, CiBitMap frameRefMap, CiBitMap regRefMap) { - computeOopMap(iw, op, info, op.hasCall, frameRefMap, regRefMap); - if (op instanceof LIRCall) { - List<CiValue> pointerSlots = ((LIRCall) op).pointerSlots; - if (pointerSlots != null) { - for (CiValue v : pointerSlots) { - info.setOop(v, compilation, frameRefMap, regRefMap); - } - } - } else if (op instanceof LIRXirInstruction) { - List<CiValue> pointerSlots = ((LIRXirInstruction) op).pointerSlots; - if (pointerSlots != null) { - for (CiValue v : pointerSlots) { - info.setOop(v, compilation, frameRefMap, regRefMap); - } - } - } - } - - CiValue toCiValue(int opId, Value value) { - if (value != null && value.operand() != CiValue.IllegalValue) { - CiValue operand = value.operand(); - Constant con = null; - if (value instanceof Constant) { - con = (Constant) value; - } - - assert con == null || operand.isVariable() || operand.isConstant() || operand.isIllegal() : "Constant instructions have only constant operands (or illegal if constant is optimized away)"; - - if (operand.isVariable()) { - OperandMode mode = OperandMode.Input; - LIRBlock block = blockForId(opId); - if (block.numberOfSux() == 1 && opId == block.lastLirInstructionId()) { - // generating debug information for the last instruction of a block. - // if this instruction is a branch, spill moves are inserted before this branch - // and so the wrong operand would be returned (spill moves at block boundaries are not - // considered in the live ranges of intervals) - // Solution: use the first opId of the branch target block instead. - final LIRInstruction instr = block.lir().instructionsList().get(block.lir().instructionsList().size() - 1); - if (instr instanceof LIRBranch) { - if (block.liveOut.get(operandNumber(operand))) { - opId = block.suxAt(0).firstLirInstructionId(); - mode = OperandMode.Output; - } - } - } - - // Get current location of operand - // The operand must be live because debug information is considered when building the intervals - // if the interval is not live, colorLirOperand will cause an assert on failure - operand = colorLirOperand((CiVariable) operand, opId, mode); - assert !hasCall(opId) || operand.isStackSlot() || !isCallerSave(operand) : "cannot have caller-save register operands at calls"; - return operand; - } else if (operand.isRegister()) { - assert false : "must not reach here"; - return operand; - } else { - assert value instanceof Constant; - assert operand.isConstant() : "operand must be constant"; - return operand; - } - } else { - // return a dummy value because real value not needed - return CiValue.IllegalValue; - } - } - - CiFrame computeFrameForState(FrameState state, int opId, CiBitMap frameRefMap) { - CiValue[] values = new CiValue[state.valuesSize() + state.locksSize()]; - int valueIndex = 0; - - for (int i = 0; i < state.valuesSize(); i++) { - values[valueIndex++] = toCiValue(opId, state.valueAt(i)); - } - - for (int i = 0; i < state.locksSize(); i++) { - if (compilation.runtime.sizeOfBasicObjectLock() != 0) { - CiStackSlot monitorAddress = frameMap.toMonitorBaseStackAddress(i); - values[valueIndex++] = monitorAddress; - assert frameRefMap != null; - CiStackSlot objectAddress = frameMap.toMonitorObjectStackAddress(i); -// LIRDebugInfo.setBit(frameRefMap, objectAddress.index()); - frameRefMap.set(objectAddress.index()); - } else { - Value lock = state.lockAt(i); - if (lock.isConstant() && compilation.runtime.asJavaClass(lock.asConstant()) != null) { - // lock on class for synchronized static method - values[valueIndex++] = lock.asConstant(); - } else { - values[valueIndex++] = toCiValue(opId, lock); - } - } - } - CiFrame caller = null; - if (state.outerFrameState() != null) { - caller = computeFrameForState(state.outerFrameState(), opId, frameRefMap); - } - return new CiFrame(caller, state.method, state.bci, values, state.localsSize(), state.stackSize(), state.locksSize()); - } - - private void computeDebugInfo(IntervalWalker iw, LIRInstruction op) { - assert iw != null : "interval walker needed for debug information"; - computeDebugInfo(iw, op, op.info); - - if (op instanceof LIRXirInstruction) { - LIRXirInstruction xir = (LIRXirInstruction) op; - if (xir.infoAfter != null) { - computeDebugInfo(iw, op, xir.infoAfter); - } - } - } - - - private void computeDebugInfo(IntervalWalker iw, LIRInstruction op, LIRDebugInfo info) { - if (info != null) { - if (info.debugInfo == null) { - int frameSize = compilation.frameMap().frameSize(); - int frameWords = frameSize / compilation.target.spillSlotSize; - CiBitMap frameRefMap = new CiBitMap(frameWords); - CiBitMap regRefMap = !op.hasCall ? new CiBitMap(compilation.target.arch.registerReferenceMapBitCount) : null; - CiFrame frame = compilation.placeholderState != null ? null : computeFrame(info.state, op.id, frameRefMap); - computeOopMap(iw, op, info, frameRefMap, regRefMap); - info.debugInfo = new CiDebugInfo(frame, regRefMap, frameRefMap); - } else if (C1XOptions.DetailedAsserts) { - assert info.debugInfo.frame().equals(computeFrame(info.state, op.id, new CiBitMap(info.debugInfo.frameRefMap.size()))); - } - } - } - - CiFrame computeFrame(FrameState state, int opId, CiBitMap frameRefMap) { - if (C1XOptions.TraceLinearScanLevel >= 3) { - TTY.println("creating debug information at opId %d", opId); - } - return computeFrameForState(state, opId, frameRefMap); - } - - private void assignLocations(List<LIRInstruction> instructions, IntervalWalker iw) { - int numInst = instructions.size(); - boolean hasDead = false; - - for (int j = 0; j < numInst; j++) { - LIRInstruction op = instructions.get(j); - if (op == null) { // this can happen when spill-moves are removed in eliminateSpillMoves - hasDead = true; - continue; - } - - // iterate all modes of the visitor and process all virtual operands - for (LIRInstruction.OperandMode mode : LIRInstruction.OPERAND_MODES) { - int n = op.operandCount(mode); - for (int k = 0; k < n; k++) { - CiValue operand = op.operandAt(mode, k); - if (operand.isVariable()) { - op.setOperandAt(mode, k, colorLirOperand((CiVariable) operand, op.id, mode)); - } - } - } - - if (op.info != null) { - // compute reference map and debug information - computeDebugInfo(iw, op); - } - - // make sure we haven't made the op invalid. - assert op.verify(); - - // remove useless moves - if (op.code == LIROpcode.Move) { - CiValue src = op.operand(0); - CiValue dst = op.result(); - if (dst == src || src.equals(dst)) { - // TODO: what about o.f = o.f and exceptions? - instructions.set(j, null); - hasDead = true; - } - } - } - - if (hasDead) { - // iterate all instructions of the block and remove all null-values. - int insertPoint = 0; - for (int j = 0; j < numInst; j++) { - LIRInstruction op = instructions.get(j); - if (op != null) { - if (insertPoint != j) { - instructions.set(insertPoint, op); - } - insertPoint++; - } - } - Util.truncate(instructions, insertPoint); - } - } - - private void assignLocations() { - IntervalWalker iw = initComputeOopMaps(); - for (LIRBlock block : sortedBlocks) { - assignLocations(block.lir().instructionsList(), iw); - } - } - - public void allocate() { - if (C1XOptions.PrintTimers) {