Bug 36339 - Try codegen issues slightly incorrect ANY exception handler
Summary: Try codegen issues slightly incorrect ANY exception handler
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 3.0 M1   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-04-10 06:44 EDT by Philipe Mulet CLA
Modified: 2003-06-05 10:29 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Philipe Mulet CLA 2003-04-10 06:44:13 EDT
Build R2.1

When generating subroutine invocations during return (inside try/finally) 
bytecode sequences, once JSR bytecode has returned, the trailing code until 
return/branch bytecode should not be inside the JSR-finally ANY exception 
handler, since any failure at this point would re-run the finally block through 
the exception handler.

Our current exception handling is ranging from try start to catch-end, and 
should better exclude portions of the bytecode:

e.g.
static int foo(boolean bool) {
  int j;
  try {
    if (bool) return 1;
    j = 2;
  } finally {
    j = 3;
  }
  return j;
}

0	iload_0
1	ifeq 9
4	jsr 20
7	iconst_1 // should be excluded from ANY exception handler range
8	ireturn  // should be excluded from ANY exception handler range
9	iconst_2
10	istore_1
11	goto 25
14	astore_3
15	jsr 20
18	aload_3
19	athrow
20	astore_2
21	iconst_3
22	istore_1
23	ret 2
25	jsr 20
28	iload_1
29	ireturn

Exception Table:
	[pc: 0, pc: 14] -> 14 when : any
Comment 1 Philipe Mulet CLA 2003-04-10 06:45:18 EDT
Also, the natural exit (25	jsr 20
), should be associated with an ANY exception handler as well.
Comment 2 Philipe Mulet CLA 2003-04-18 04:35:29 EDT
Fixed. Added sequence of any exception handlers (and SubRoutineStatement 
intermediate node).
Comment 3 David Audel CLA 2003-06-05 10:29:42 EDT
Verified.