-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix normalization of devirtualized abstract methods
- Loading branch information
Showing
19 changed files
with
456 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
//@execute 0=!NullCheckException | ||
var f: Y; | ||
def main(a: int) -> int { | ||
return f.m(a).0; | ||
} | ||
def foo() { | ||
if (f == null) f = Z.new(); | ||
} | ||
|
||
class X { | ||
def m(a: int) -> (int, int); | ||
} | ||
class Y extends X { | ||
} | ||
class Z extends Y { | ||
def m(a: int) -> (int, int) { | ||
return (a + 42, a + 53); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
//@execute -1=0; 0=!NullCheckException | ||
var f: B; | ||
def main(a: int) -> int { | ||
var x: int; | ||
if (a >= 0) x = f.m(a).0; | ||
return x; | ||
} | ||
def foo() { | ||
if (f == null) f = C.new(); | ||
} | ||
|
||
class A { | ||
def m(a: int) -> (int, int); | ||
} | ||
class B extends A { | ||
} | ||
class C extends B { | ||
def m(a: int) -> (int, int) { | ||
return (a + 42, a + 53); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
//@execute -1=0; 0=!NullCheckException | ||
var f: B; | ||
def main(a: int) -> int { | ||
var x: (int, int); | ||
if (a >= 0) x = f.m(a); | ||
return x.0; | ||
} | ||
def foo() { | ||
if (f == null) f = C.new(); | ||
} | ||
|
||
class A { | ||
def m(a: int) -> (int, int); | ||
} | ||
class B extends A { | ||
} | ||
class C extends B { | ||
def m(a: int) -> (int, int) { | ||
return (a + 42, a + 53); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
//@execute -1=0; 0=!NullCheckException | ||
var f: B; | ||
def main(a: int) -> int { | ||
var x: (int, int); | ||
if (a >= 0) x = f.m(a); | ||
return x.0; | ||
} | ||
|
||
class A { | ||
def m(a: int) -> (int, int); | ||
} | ||
class B extends A { | ||
} | ||
class C extends B { | ||
def m(a: int) -> (int, int) { | ||
return (a + 42, a + 53); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
//@execute -1=8; 0=!NullCheckException | ||
var f: B; | ||
def main(a: int) -> int { | ||
var x = int.!<int>; | ||
if (a >= 0) x = f.m(a); | ||
return x(8); | ||
} | ||
|
||
class A { | ||
def m(a: int) -> (int -> int); | ||
} | ||
class B extends A { | ||
} | ||
class C extends B { | ||
def m(a: int) -> (int -> int) { return int.~; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
//@execute 0=11; 1=11 | ||
|
||
class WasmFunction(id: int) { } | ||
class HostFunction(id: int) { } | ||
class HostFrame { | ||
def caller() -> FrameLoc { | ||
return FrameLoc.None; | ||
} | ||
} | ||
class V3Frame { | ||
var prev: V3Frame; | ||
var func: WasmFunction; | ||
var pc: int; | ||
} | ||
class FrameAccessor { | ||
def caller() -> FrameLoc { | ||
return FrameLoc.None; | ||
} | ||
} | ||
|
||
type TargetFrame(f: V3Frame) #unboxed { | ||
def getFrameAccessor() -> FrameAccessor { | ||
return FrameAccessor.new(); | ||
} | ||
} | ||
|
||
type FrameLoc #unboxed { | ||
case None; | ||
case Wasm(func: WasmFunction, pc: int, frame: TargetFrame); | ||
case Host(func: HostFunction, frame: HostFrame); | ||
} | ||
|
||
def FUNC_19 = WasmFunction.new(19); | ||
def FUNC_21 = WasmFunction.new(21); | ||
def HOST_22 = HostFunction.new(22); | ||
|
||
def frame2 = V3Frame.new(); | ||
|
||
def frames = [ | ||
FrameLoc.Wasm(FUNC_19, 11, TargetFrame(V3Frame.new())), | ||
FrameLoc.Wasm(FUNC_21, 13, TargetFrame(V3Frame.new())), | ||
FrameLoc.Host(HOST_22, HostFrame.new()) | ||
]; | ||
|
||
def main(a: int) -> int { | ||
var g = FrameLoc.Wasm.!(frames[a]); | ||
renderStack(g.frame.getFrameAccessor()); | ||
return 11; | ||
} | ||
|
||
def renderStack(accessor: FrameAccessor) { | ||
var depth = 0; | ||
var caller = accessor.caller(); | ||
while (true) { | ||
match (caller) { | ||
None => break; | ||
Wasm(func, pc, frame) => { | ||
// OUT.put1("%d: ", depth); | ||
// func.render(OUT); | ||
accessor = frame.getFrameAccessor(); | ||
caller = accessor.caller(); | ||
} | ||
Host(func, frame) => { | ||
// OUT.put1("%d: ", depth); | ||
// func.render(OUT); | ||
caller = frame.caller(); | ||
} | ||
} | ||
// OUT.outln(); | ||
depth++; | ||
} | ||
} |
Oops, something went wrong.