You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2015/06/02 19:05:22 UTC
[19/50] [abbrv] git commit: [flex-falcon] [refs/heads/develop] - get
donated fdbworkers to work,
including integration with latest falcon compiler for expression evaluation
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/00c0bf63/debugger/src/flash/tools/debugger/events/TraceEvent.java
----------------------------------------------------------------------
diff --git a/debugger/src/flash/tools/debugger/events/TraceEvent.java b/debugger/src/flash/tools/debugger/events/TraceEvent.java
new file mode 100644
index 0000000..5f04af8
--- /dev/null
+++ b/debugger/src/flash/tools/debugger/events/TraceEvent.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package flash.tools.debugger.events;
+
+/**
+ * Trace is a special operation by the player that
+ * allows text strings to be displayed during the
+ * execution of some ActionScript.
+ * <p>
+ * The event provides notification that a trace
+ * statement was encountered. The info string
+ * contains the contenxt of the trace message.
+ */
+public class TraceEvent extends DebugEvent
+{
+ public TraceEvent(String s) { super(s); }
+}
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/00c0bf63/debugger/src/flash/tools/debugger/expression/AS3DebuggerBURM.jbg
----------------------------------------------------------------------
diff --git a/debugger/src/flash/tools/debugger/expression/AS3DebuggerBURM.jbg b/debugger/src/flash/tools/debugger/expression/AS3DebuggerBURM.jbg
new file mode 100644
index 0000000..555cf0a
--- /dev/null
+++ b/debugger/src/flash/tools/debugger/expression/AS3DebuggerBURM.jbg
@@ -0,0 +1,269 @@
+package flash.tools.debugger.expression;
+
+header
+{
+ /*
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ AS3DebuggerBURM.java is a Bottom-Up Rewrite Machine for ActionScript 3.0.
+
+ A BURM recognizes patterns of nodes within an tree (in this case, an
+ abstract syntax tree for AS 3.0 expressions) and performs rule-based reduction
+ on them (in this case producing DebuggerValues).
+
+ AS3DebuggerBURM.java is generated from AS3DebuggerBURM.jbg using JBurg, an open-source
+ Java implementation of a Bottom-Up Rewrite Generator.
+
+ The most important entry point of this class is burm(),
+ which is called by the code generator.
+ */
+
+ import static org.apache.flex.abc.ABCConstants.*;
+ import static org.apache.flex.compiler.tree.ASTNodeID.*;
+
+ import org.apache.flex.compiler.constants.IASLanguageConstants;
+ import org.apache.flex.compiler.exceptions.BURMAbortException;
+ import org.apache.flex.compiler.problems.*;
+ import org.apache.flex.compiler.internal.semantics.SemanticUtils;
+ import org.apache.flex.compiler.tree.ASTNodeID;
+ import org.apache.flex.compiler.tree.as.IASNode;
+ import org.apache.flex.compiler.tree.as.ITryNode;
+}
+
+INodeType IASNode;
+OpcodeType ASTNodeID;
+
+/*
+ * The I-node type is IASNode, and it has its own adapter.
+ */
+INodeAdapter org.apache.flex.compiler.internal.as.codegen.IASNodeAdapter;
+
+// Generate Java output.
+Language java;
+
+// Return type of all the reductions
+ReturnType Object;
+
+/**
+ * This is a name to use in an expression context.
+ *
+ * TODO: What type should this be?
+ */
+ReturnType name = Object;
+
+ReturnType decl_name = Object;
+
+/**
+ * Qualified name - this acts the same as a name above, but is built a little differently.
+ */
+ReturnType qualifiedName = Object;
+ReturnType qualifiedNamePart = Object;
+
+/**
+ * This is a name used in a type annotation context, such as 'Foo' in:
+ * var x : Foo;
+ * It is a Binding, as type annotations must always be resolved.
+ * A type_name also allows '*', which can't happen in a general expression context.
+ */
+ReturnType type_name = Object;
+
+/**
+ * This is a name used in a new context, such as 'Foo' in:
+ * new Foo();
+ * We can do additional analysis when the new expression resolves to a Type, which
+ * is why we have a special name for the new expression.
+ */
+ReturnType new_type_name = Object;
+
+ReturnType dottedNamePart = String;
+
+ReturnType non_resolving_identifier = String;
+
+ReturnType runtime_name_expression = Object;
+ReturnType multinameL = Object;
+ReturnType e4x_literal = String;
+
+ReturnType integer_constant = Integer;
+ReturnType uint_constant = Long;
+ReturnType double_constant = Double;
+ReturnType string_constant = String;
+ReturnType boolean_constant = Boolean;
+ReturnType float_constant = Float;
+
+ReturnType numeric_constant = Number;
+
+ReturnType constant_value = Object;
+
+/**
+ * Value to use to indicate a cost that is not feasible
+ */
+JBurg.Constant ERROR_TRAP = 268435456;
+
+{
+ final static boolean NEED_VALUE = true;
+ final static boolean DISCARD_VALUE = false;
+
+
+ /**
+ * The reducer has all the implementation
+ * logic for the rewrite; the BURM constructed
+ * by this specification drives that logic.
+ */
+ AS3DebuggerReducer reducer;
+
+
+ /*
+ * ** Cost functions **
+ * Cost functions are Java code that returns an int value.
+ * The value is used to compute the cost of a particular
+ * candidate reduction. The BURM searches for the lowest
+ * total cost sequence of reductions to transform the input
+ * AST into a value, so low values mean "good cost," higher
+ * values mean "less desirable." The total cost of a reduction
+ * is always strictly less than Integer.MAX_VALUE; a cost of
+ * Integer.MAX_VALUE tells the pattern matcher that the
+ * reduction is not feasible.
+ */
+
+
+ /**
+ * @return "feasible" if the reducer can reduce this to a dotted name.
+ */
+ int isDottedName(IASNode iNode)
+ {
+ return reducer.isDottedName(iNode);
+ }
+
+ /**
+ * @return "feasible" if the reducer can reduce this to a package name.
+ */
+ int isPackageName(IASNode iNode)
+ {
+ return reducer.isPackageName(iNode);
+ }
+
+ /**
+ * @return "feasible" if this node's qualifier is a compile-time constant.
+ */
+ int qualifierIsCompileTimeConstant(IASNode iNode)
+ {
+ return reducer.qualifierIsCompileTimeConstant(iNode);
+ }
+
+ /**
+ * @return "feasible" if this node can be resolved to a compile-time constant.
+ */
+ int isCompileTimeConstant(IASNode iNode)
+ {
+ return reducer.isCompileTimeConstant(iNode);
+ }
+
+ /**
+ * @return "feasible" if this function call node can be resolved to a compile-time constant function.
+ */
+ int isCompileTimeConstantFunction(IASNode iNode)
+ {
+ return reducer.isCompileTimeConstantFunction(iNode);
+ }
+
+ /**
+ * @return "feasible" if this binary node has at least one expression that is
+ * of type "float".
+ */
+ int isFloatBinOp(IASNode iNode)
+ {
+ return reducer.isFloatBinOp(iNode);
+ }
+
+ /**
+ * @return "feasible" if this node is for 'new Array()'.
+ */
+ int isEmptyArrayConstructor(IASNode iNode)
+ {
+ return reducer.isEmptyArrayConstructor(iNode);
+ }
+
+ /**
+ * @return "feasible" if this node is for 'new Object()'.
+ */
+ int isEmptyObjectConstructor(IASNode iNode)
+ {
+ return reducer.isEmptyObjectConstructor(iNode);
+ }
+
+ /**
+ * @return "feasible" if this node resolves to a type definition.
+ */
+ int isKnownType(IASNode iNode)
+ {
+ return reducer.isKnownType(iNode);
+ }
+
+ /**
+ * @return "feasible" if the type parameter resolves to a type definition.
+ */
+ int parameterTypeIsConstant(IASNode iNode)
+ {
+ return reducer.parameterTypeIsConstant(iNode);
+ }
+
+ /**
+ * recordError is a convenience method for error reductions;
+ * it adds a problem to the current set of problems and
+ */
+ Object recordError(ICompilerProblem problem)
+ {
+ return new Object();
+ }
+
+ int isIntLiteral(IASNode iNode)
+ {
+ return reducer.isIntLiteral(iNode);
+ }
+
+ int isUintLiteral(IASNode iNode)
+ {
+ return reducer.isUintLiteral(iNode);
+ }
+
+ int isDoubleLiteral(IASNode iNode)
+ {
+ return reducer.isDoubleLiteral(iNode);
+ }
+
+ int isFloatLiteral(IASNode iNode)
+ {
+ return reducer.isDoubleLiteral(iNode);
+ }
+
+}
+
+/*
+ * Error recovery routine: deduce what we can from the problem
+ * tree, then abort this BURM with an exception that the caller
+ * can catch and ignore.
+ */
+DefaultErrorHandler
+{
+ BURMAbortException.abort();
+}
+
+/*
+ * Patterns and rules are stored in their own, shareable file.
+ */
+JBurg.include "../compiler/src/org/apache/flex/compiler/internal/as/codegen/CmcPatterns.jbg"
+JBurg.include "AS3DebuggerRules.jbg"
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/00c0bf63/debugger/src/flash/tools/debugger/expression/AS3DebuggerCompoundAssignmentRules.jbg
----------------------------------------------------------------------
diff --git a/debugger/src/flash/tools/debugger/expression/AS3DebuggerCompoundAssignmentRules.jbg b/debugger/src/flash/tools/debugger/expression/AS3DebuggerCompoundAssignmentRules.jbg
new file mode 100644
index 0000000..5a6b955
--- /dev/null
+++ b/debugger/src/flash/tools/debugger/expression/AS3DebuggerCompoundAssignmentRules.jbg
@@ -0,0 +1,28 @@
+/*
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+
+expression = Pattern compoundAssignToName : 0
+JBurg.Reduction reducer.compoundBinaryAssignmentNameExpr(__p, operand, expr, Op_COMPOUND_ASSIGN);
+
+
+expression = Pattern compoundAssignToMember : 0
+JBurg.Reduction reducer.compoundBinaryAssignmentMemberExpr(__p, stem, member, expr, Op_COMPOUND_ASSIGN);
+
+expression = Pattern compoundAssignToBracket : 0
+JBurg.Reduction reducer.compoundBinaryAssignmentBracketExpr(__p, stem, index, expr, Op_COMPOUND_ASSIGN);