4

This may seem a strange question... Why would anyone want to disable such a thing? But I know what I'm doing (and why I want/need to do this) and I really want to disable dead code elimination.

Is it possible somehow?

I use Eclipse by the way, if it's relevant...

rfgamaral
  • 16,546
  • 57
  • 163
  • 275
  • Are you compiling in debug mode? – Gabe Jul 02 '10 at 01:43
  • I honestly don't know, Eclipse is confusing. how do I compile in debug/release mode? I mostly select "export" to compile the final file... – rfgamaral Jul 02 '10 at 09:04
  • Sometimes when you need to benchmark certain things, you might need to call a function which could just do some calculations and return. I find this question very useful, but just that I don't have the answers in this forum – Mohan Mar 06 '13 at 17:17

3 Answers3

1

Is it possible somehow?

I haven't come across any method for doing this. There don't seem to be any relevant options.

But to be clear, dead code elimination could (potentially) be done by either or both of the bytecode compiler and the JIT. So you need to be clear which case you are concerned about. (I guess it is the bytecode compiler ...)

Stephen C
  • 698,415
  • 94
  • 811
  • 1,216
0

The first thought that popped into my head is to write some kind of crazy aspect and use compile time weaving, so that your dead code isn't dead anymore... but then my head exploded.

bwawok
  • 14,898
  • 7
  • 32
  • 43
0

I would suggest you to think again, and try to achieve your goal with some different way. What are you trying to do looks like a 'hack' and even if you succeed, you will never be sure, that your dead code retention mechanism still works.

Illarion Kovalchuk
  • 5,774
  • 8
  • 42
  • 54