[Laszlo-checkins] r10469 - openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/sc
dda@openlaszlo.org
dda at openlaszlo.org
Thu Jul 24 18:41:13 PDT 2008
Author: dda
Date: 2008-07-24 18:41:07 -0700 (Thu, 24 Jul 2008)
New Revision: 10469
Modified:
openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/sc/CodeGenerator.java
Log:
Change 20080724-dda-2 by dda at lester.local on 2008-07-24 16:43:04 EDT
in /Users/dda/laszlo/src/svn/openlaszlo/trunk-a
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: minor cleanup of SWF6 compiler transforms
New Features:
Bugs Fixed: LPP-6669 (Remove swf6 byte-code kludges from CodeGenerator.java)
Technical Reviewer: ptw (pending)
QA Reviewer: (pending)
Doc Reviewer: (pending)
Documentation:
Release Notes:
Details:
Most of the issues implied by the LPP-6669 cannot be fixed - but details are listed here.
0) Removed some code specific to swf6 involving using lower case for variable and register names
Examined and tested the various transforms in question:
1)
// swf6 returns undefined for comparisons with NaN, it
// is supposed to return false (note that you cannot
// eliminate one NOT by inverting the sense of the
// comparison
BinopInstrs.put(ParserConstants.LT, new Instruction[] {Instructions.LessThan, Instructions.NOT, Instructions.NOT});
Tried setting this to just Instructions.LesThan, but smokecheck gives errors on NaN comparisons.
2)
// swf6 does not have GE or LE, but inverting the
// complement operator does not work for NaN ordering
// Luckily, LogicalOr coerces undefined to false, so we
// don't have to play the NOT NOT trick above
BinopInstrs.put(ParserConstants.LE, new Instruction[]
Tried setting LE to { Instructions.GT, Instructions.NOT }
smokecheck also gives errors on NaN comparisons.
For kicks, also tried setting LE to { Instructions.GT, Instructions.NOT , Instructions.NOT , Instructions.NOT }
to see if the 'double NOT' trick might work, but also gives the same smokecheck errors.
Also examined flasm source to see if GE or LE has been added (they have not).
3)
// swf6 does not have NE or SNE either, but inverting
// the complement is correct for NaN
There are no new opcodes for NE or SNE (at least as known to flasm)
4)
// Approximate a in b as b.a =! void 0
No new opcodes for 'in'
5) Special case of 'is' in translateBinaryExpression.
No new opcodes for 'is'
6) Special case of 'cast' in translateBinaryExpression.
There is a SWF 'CAST' operator that leaves a 'null' on the stack in case of error.
This is not being utilized, and there's already a separate TODO for this item.
It didn't seem to be under the purvue of this Jira bug.
Tests:
regression: smokecheck swf8/dhtml
Modified: openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/sc/CodeGenerator.java
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/sc/CodeGenerator.java 2008-07-25 00:03:29 UTC (rev 10468)
+++ openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/sc/CodeGenerator.java 2008-07-25 01:41:07 UTC (rev 10469)
@@ -1941,21 +1941,14 @@
// for now, ensure that super has a value
known.remove("super");
Set knownSet = new LinkedHashSet(known);
- Set lowerKnownSet = new LinkedHashSet();
- for (Iterator i = knownSet.iterator(); i.hasNext(); ) {
- lowerKnownSet.add(((String)i.next()).toLowerCase());
- }
context.setProperty(TranslationContext.VARIABLES, knownSet);
- context.setProperty(TranslationContext.LOWERVARIABLES, lowerKnownSet);
boolean scriptElement = options.getBoolean(Compiler.SCRIPT_ELEMENT);
Map registerMap = new HashMap();
- Map lowerRegisterMap = new HashMap();
// Always set register map. Inner functions should not see
// parent registers (which they would if the setting of the
// registermap were conditional on function vs. function2)
context.setProperty(TranslationContext.REGISTERS, registerMap);
- context.setProperty(TranslationContext.LOWERREGISTERS, lowerRegisterMap);
// TODO: [2004-03-24] Analyze register usage in $flasm and
// account for it (or rename $flasm regs?)
// NB: Only Flash Player 6r65 or better understands function2
@@ -2028,7 +2021,6 @@
Instructions.Register r = (Instructions.Register)i.next();
r.regno = regno;
registerMap.put(r.name, r);
- lowerRegisterMap.put(r.name.toLowerCase(), r);
}
// It appears you have to always allocate r:0, hence
// regno, not len(registers)
@@ -2457,28 +2449,12 @@
Map registers = (Map)context.get(TranslationContext.REGISTERS);
if (registers != null) {
this.register = (Instructions.Register)registers.get(name);
- if ("swf6".equals(Instructions.getRuntime())) {
- Map lowerRegisters = (Map)context.get(TranslationContext.LOWERREGISTERS);
- if (register != null && (! lowerRegisters.containsKey(name.toLowerCase()))) {
- System.err.println("Warning: Different case used for " + name +
- " in " + node.filename +
- " (" + node.beginLine + ")");
- }
- }
} else {
this.register = null;
}
Set variables = (Set)context.get(TranslationContext.VARIABLES);
if (variables != null) {
this.known = variables.contains(name);
- if ("swf6".equals(Instructions.getRuntime())) {
- Set lowerVariables = (Set)context.get(TranslationContext.LOWERVARIABLES);
- if (known && (! lowerVariables.contains(name.toLowerCase()))) {
- System.err.println("Warning: Different case used for " + name +
- " in " + node.filename +
- " (" + node.beginLine + ")");
- }
- }
// TODO: [2005-12-22 ptw] Not true ECMAscript
// Ensure undefined is "defined"
known |= "undefined".equals(name);
More information about the Laszlo-checkins
mailing list