Closed sushihangover closed 9 years ago
// Compiler options: -psstrict-
package {
public class Foo {
static var x:Number = 0.0;
static var y:Number = 0.0;
public static function Main():int {
if ( x && y ) {
trace(x);
trace(y);
return 1;
}
return 0;
}
}
}
./pcompile as/test-debug-as-I64.as
./run as/test-debug-as-I64.exe
Unhandled Exception:
System.InvalidProgramException: Invalid IL code in _root.Foo:Main (): IL_0005: brfalse IL_0034
[ERROR] FATAL UNHANDLED EXCEPTION: System.InvalidProgramException: Invalid IL code in _root.Foo:Main (): IL_0005: brfalse IL_0034
Exit Code : 1
Bad IL generation code from as/test-debug-as-I64.exe
// method line 2
.method public static hidebysig
default int32 Main () cil managed
{
// Method begins at RVA 0x2058
.entrypoint
// Code size 54 (0x36)
.maxstack 8
IL_0000: ldsfld float64 _root.Foo::x
IL_0005: brfalse IL_0034
IL_000a: ldsfld float64 _root.Foo::y
IL_000f: brfalse IL_0034
IL_0014: ldsfld float64 _root.Foo::x
IL_0019: box [mscorlib]System.Double
IL_001e: call void class [pscorlib_aot]_root.trace_fn::trace(object)
IL_0023: ldsfld float64 _root.Foo::y
IL_0028: box [mscorlib]System.Double
IL_002d: call void class [pscorlib_aot]_root.trace_fn::trace(object)
IL_0032: ldc.i4.1
IL_0033: ret
IL_0034: ldc.i4.0
IL_0035: ret
} // end of method Foo::Main
Previous IL code:
// method line 2
.method public static hidebysig
default int32 Main () cil managed
{
// Method begins at RVA 0x2058
.entrypoint
// Code size 72 (0x48)
.maxstack 2
IL_0000: ldsfld float64 _root.Foo::x
IL_0005: ldc.r8 0.
IL_000e: beq IL_0046
IL_0013: ldsfld float64 _root.Foo::y
IL_0018: ldc.r8 0.
IL_0021: beq IL_0046
IL_0026: ldsfld float64 _root.Foo::x
IL_002b: box [mscorlib]System.Double
IL_0030: call void class [pscorlib_aot]_root.trace_fn::trace(object)
IL_0035: ldsfld float64 _root.Foo::y
IL_003a: box [mscorlib]System.Double
IL_003f: call void class [pscorlib_aot]_root.trace_fn::trace(object)
IL_0044: ldc.i4.1
IL_0045: ret
IL_0046: ldc.i4.0
IL_0047: ret
} // end of method Foo::Main
commit c917249c75ad6cb0eea1ecf46f406b81b6671373 Author: SushiHangover sushihangover@outlook.com Date: Sun Aug 16 13:32:28 2015 -0700
Fixes #64 - Logical && and || on doubles now get the doubles compared
to zero via bne and bne.un vs the failing brfalse
The following:
Where _width and _height are ActionScript Numbers and is producing the following invalid IL