Page 1 of 1

Remove unneeded Line MOV if OnError is enabled

Posted: Thu Nov 13, 2008 10:51 pm
by mback2k
Today I saw that the OnError support adds a MOV statement for every line that has compiled text inside, empty lines and comments are ignored, but not constant definitions, enumerations and structures. Those are static and don't do anything at runtime, I don't think there is a need to add debugging information for them.

I am using PB 4.30 Beta 4.

Examples:

Code: Select all

; #jaPBe_CompilerVersion="4.30 BETA 4"
  MOV    dword [CLN],1
; #jaPBe_IsDebuggerRunning=0
  MOV    dword [CLN],2
; #jaPBe_IsExecute=1
  MOV    dword [CLN],3
; #jaPBe_ExecuteBuild=164
  MOV    dword [CLN],4
; #jaPBe_ExecuteType=0
  MOV    dword [CLN],5
; #jaPBe_OnError=1
  MOV    dword [CLN],6

Code: Select all

; Enumeration
; #MAX_NETWORK = 8
  MOV    dword [CLN],16777218
; #MAX_ADDRESS = 15
  MOV    dword [CLN],16777219
; #MAX_IDENTIFIER = 32
  MOV    dword [CLN],16777220
; #MAX_STRING = 255
  MOV    dword [CLN],16777221
; EndEnumeration
; 
; Structure Last
; sIP.s{#MAX_ADDRESS}
  MOV    dword [CLN],16777225
; sResult.s{#MAX_STRING}
  MOV    dword [CLN],16777226
; bPrompt.b
  MOV    dword [CLN],16777227
; lTime.i
  MOV    dword [CLN],16777228
; lUserData.i
  MOV    dword [CLN],16777229
; EndStructure

Posted: Fri Nov 14, 2008 1:13 am
by DoubleDutch
What would be best is if we could turn this on/off with some kind of compilation switch in the source code.

Posted: Fri Nov 14, 2008 7:32 am
by mback2k
Good idea, but could it ever happen that such line raises an error that the OnError line would catch? Structures, enumerations and constants are checked on compilation ;-) As you can see in my examples, there is no code generated from those lines.

Posted: Fri Nov 14, 2008 7:48 am
by Mistrel
If a line that has only a constant on it causes a runtime error then there is a bigger bug to be worried about.

Posted: Sat Nov 15, 2008 1:59 pm
by mback2k
The thing is, my program has hundreds of Structure and Enumeration lines, more than 6kb unneeded MOV statements are in my executable.

BTW-- It does also take effect on Import(C) statements.

Posted: Wed Dec 17, 2008 9:49 pm
by mback2k
With PB 4.30 final I still get hundreds of unneeded MOV statements. I would really like that to be changed :)

Image

Posted: Wed Dec 17, 2008 9:54 pm
by DoubleDutch
I would like it if it didn't create the mov's on effectively blank lines, but also allowed the ability top turn it on/off on normal code lines at will.

Posted: Mon Dec 29, 2008 7:07 am
by USCode
Isn't this a bug and not a "feature" ?