diff options
author | Björn Gustavsson <[email protected]> | 2012-01-25 15:13:13 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2012-01-25 15:13:13 +0100 |
commit | cbd04034742fbd5f330eb51944d19b99c14ec3f4 (patch) | |
tree | 54a154baa14b6ab3aeac72f3890e6cabbaec6ad6 | |
parent | 92b5a1ad679dec79ae40cee4a144f6da614433e1 (diff) | |
parent | d58a69fcf3af87043d6d807f3101bf0b4d9f6a41 (diff) | |
download | otp-cbd04034742fbd5f330eb51944d19b99c14ec3f4.tar.gz otp-cbd04034742fbd5f330eb51944d19b99c14ec3f4.tar.bz2 otp-cbd04034742fbd5f330eb51944d19b99c14ec3f4.zip |
Merge branch 'maint'
* maint:
Update primary bootstrap
compiler: Correct live calculation when get/1 is used in try...catch
-rw-r--r-- | bootstrap/lib/compiler/ebin/beam_utils.beam | bin | 14532 -> 14552 bytes | |||
-rw-r--r-- | bootstrap/lib/kernel/ebin/code_server.beam | bin | 26088 -> 26228 bytes | |||
-rw-r--r-- | lib/compiler/src/beam_utils.erl | 11 | ||||
-rw-r--r-- | lib/compiler/test/trycatch_SUITE.erl | 18 |
4 files changed, 25 insertions, 4 deletions
diff --git a/bootstrap/lib/compiler/ebin/beam_utils.beam b/bootstrap/lib/compiler/ebin/beam_utils.beam Binary files differindex 12372309d9..9c6ad019f9 100644 --- a/bootstrap/lib/compiler/ebin/beam_utils.beam +++ b/bootstrap/lib/compiler/ebin/beam_utils.beam diff --git a/bootstrap/lib/kernel/ebin/code_server.beam b/bootstrap/lib/kernel/ebin/code_server.beam Binary files differindex 09d86b80ad..adc53aa5f3 100644 --- a/bootstrap/lib/kernel/ebin/code_server.beam +++ b/bootstrap/lib/kernel/ebin/code_server.beam diff --git a/lib/compiler/src/beam_utils.erl b/lib/compiler/src/beam_utils.erl index a631b8cd69..116ede0bc9 100644 --- a/lib/compiler/src/beam_utils.erl +++ b/lib/compiler/src/beam_utils.erl @@ -474,8 +474,15 @@ check_liveness(R, [{make_fun2,_,_,_,NumFree}|Is], St) -> end; check_liveness(R, [{try_end,Y}|Is], St) -> case R of - Y -> {killed,St}; - _ -> check_liveness(R, Is, St) + Y -> + {killed,St}; + {y,_} -> + %% y registers will be used if an exception occurs and + %% control transfers to the label given in the previous + %% try/2 instruction. + {used,St}; + _ -> + check_liveness(R, Is, St) end; check_liveness(R, [{catch_end,Y}|Is], St) -> case R of diff --git a/lib/compiler/test/trycatch_SUITE.erl b/lib/compiler/test/trycatch_SUITE.erl index 760cf17225..09a23724fe 100644 --- a/lib/compiler/test/trycatch_SUITE.erl +++ b/lib/compiler/test/trycatch_SUITE.erl @@ -24,7 +24,7 @@ catch_oops/1,after_oops/1,eclectic/1,rethrow/1, nested_of/1,nested_catch/1,nested_after/1, nested_horrid/1,last_call_optimization/1,bool/1, - plain_catch_coverage/1,andalso_orelse/1]). + plain_catch_coverage/1,andalso_orelse/1,get_in_try/1]). -include_lib("test_server/include/test_server.hrl"). @@ -35,7 +35,7 @@ all() -> [basic, lean_throw, try_of, try_after, catch_oops, after_oops, eclectic, rethrow, nested_of, nested_catch, nested_after, nested_horrid, last_call_optimization, - bool, plain_catch_coverage, andalso_orelse]. + bool, plain_catch_coverage, andalso_orelse, get_in_try]. groups() -> []. @@ -928,3 +928,17 @@ andalso_orelse_2({Type,Keyval}) -> zero() -> 0.0. + +get_in_try(_) -> + undefined = get_valid_line([a], []), + ok. + +get_valid_line([_|T]=Path, Annotations) -> + try + get(Path) + %% beam_dead used to optimize away an assignment to {y,1} + %% because it didn't appear to be used. + catch + _:not_found -> + get_valid_line(T, Annotations) + end. |