2326 – Methods within final class are not considered final when optimizing

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 2326 - Methods within final class are not considered final when optimizing
Summary: Methods within final class are not considered final when optimizing
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D1 (retired)
Hardware: x86 Windows
: P2 normal
Assignee: Walter Bright
URL:
Keywords:
: 1909 (view as issue list)
Depends on:
Blocks:
Reported: 2008年09月01日 13:46 UTC by Matti Niemenmaa
Modified: 2014年03月01日 00:36 UTC (History)
2 users (show)

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description Matti Niemenmaa 2008年09月01日 13:46:42 UTC
final class A {
	int i;
	 void f() { ++i; }
	final void g() { ++i; }
	void foo() {
		f();
		g();
	}
}
A snippet from obj2asm on the above, compiled with "dmd -c -O -inline -release":
_D4asdf1A3fooMFZv	comdat
	assume	CS:_D4asdf1A3fooMFZv
		push	EBX
		mov	EBX,EAX
		mov	ECX,[EBX]
		call	dword ptr 014h[ECX]
		inc	dword ptr 8[EBX]
		pop	EBX
		ret
The call to g is inlined, but the call to f is not. Since class A is final, all methods within it should be considered final for purposes of optimization; thus, in this case, both f and g should be inlined.
Comment 1 Walter Bright 2008年11月14日 22:13:49 UTC
This only happens on D1.
Comment 2 Koroskin Denis 2008年11月15日 06:41:18 UTC
(In reply to comment #1)
> This only happens on D1.
> 
So? Does this mean that the bug is not considered harmful and thus wont be fixed in D1?
Comment 3 Robert Fraser 2008年11月15日 08:14:50 UTC
Yes, I would very much like to see this fixed in D1, especially since it's not a spec change at all.
Comment 4 torhu 2008年12月07日 06:54:45 UTC
This is listed in the changelog for 1.037, can anyone confirm that it's fixed?
Comment 5 Matti Niemenmaa 2008年12月07日 09:11:14 UTC
Fixed in DMD 1.037. (At least the simple example in the report.)
Comment 6 Matti Niemenmaa 2009年09月18日 06:13:00 UTC
*** Issue 1909 has been marked as a duplicate of this issue. ***


AltStyle によって変換されたページ (->オリジナル) /