Remove unneeded Line MOV if OnError is enabled

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
mback2k
Enthusiast
Enthusiast
Posts: 257
Joined: Sun Dec 02, 2007 12:11 pm
Location: Germany

Remove unneeded Line MOV if OnError is enabled

Post 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
User avatar
DoubleDutch
Addict
Addict
Posts: 3219
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Post by DoubleDutch »

What would be best is if we could turn this on/off with some kind of compilation switch in the source code.
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
User avatar
mback2k
Enthusiast
Enthusiast
Posts: 257
Joined: Sun Dec 02, 2007 12:11 pm
Location: Germany

Post 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.
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Post 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.
User avatar
mback2k
Enthusiast
Enthusiast
Posts: 257
Joined: Sun Dec 02, 2007 12:11 pm
Location: Germany

Post 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.
User avatar
mback2k
Enthusiast
Enthusiast
Posts: 257
Joined: Sun Dec 02, 2007 12:11 pm
Location: Germany

Post by mback2k »

With PB 4.30 final I still get hundreds of unneeded MOV statements. I would really like that to be changed :)

Image
User avatar
DoubleDutch
Addict
Addict
Posts: 3219
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Post 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.
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
User avatar
USCode
Addict
Addict
Posts: 912
Joined: Wed Mar 24, 2004 11:04 pm
Location: Seattle, USA

Post by USCode »

Isn't this a bug and not a "feature" ?
Post Reply