I have a question.
James Long
Posts: 1,181
Ok....So I'm propping right along....and something pops into my head.
Does the Prop....include all of an external object that is started?
Or just the needed parts?
I know the answer (I Think) , but I'm just making sure.
James L
Does the Prop....include all of an external object that is started?
Or just the needed parts?
I know the answer (I Think) , but I'm just making sure.
James L
Comments
For example, you can declare an array of FullDuplexSerial objects, say a 4 element array. There are 4 copies of the VAR area for the object allocated, but only one copy of the code and DAT area.
This is not really important....unless you get some fluffy objects floating around in the object exchange.
I'm just asking.....because it may be worth while for some of the Propeller guys to insure(read with the time they have allowed) the objects are optimized. This is a matter of opinion, I guess, optimized code for one person is too complicated for another.
I know the project I'm working on is quite large and will have a bunch of communication. This will not be bad because of the way the objects are used in multiples...but not really multiplied.
But I also have an enormous number of calculations to go along with those communications.
Just trying to learn before I get too deep.
James L
Post Edited (James Long) : 9/15/2006 6:04:13 PM GMT
I guess I get your point.....basically....the IDE only includes the·routines that are called. And excludes the routines that are not invoked.
I was confused about the difference in an Object and a Routine. I see that·an Object consist of different routines or blocks of code.
Sometimes our verbage makes the meaning.
Do I have that right?
I'm impressed that the program removes the fluff (routines) not being "used".
Thanks for the very·specific·information,
James L
One person's fluff is another person's "meat".
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Propeller + Hardware - extra bits for the bit bucket =· 1 Coffeeless KaosKidd
·
I'v done some test...
Code that isnt called that is inside a called routine is indeed compiled and sent out...
Code that isnt called and is in it's own sub (aka PRI or PUB) isn't compiled...
Obj's that are defined but are never used (stated) aren't compiled and sent out.
All vars that are declaired are compiled (used or not) <- my biggest problem!
Unused sub in a defined and started OBJ are not compiled or sent.
Lastly...
All vars, cons and dats are compiled and sent.
Remarks (aka my peanut butter!) are not compiled.
Ok, just some EMF's from my desktop.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Propeller + Hardware - extra bits for the bit bucket =· 1 Coffeeless KaosKidd
·
and a routine (method) is included if it's referenced by an included routine. The first
PUB routine in the main file (object) is implicitly called by the SPIN interpreter so it's
always included.
All VARS in an object are included each time the object is declared in another object
(with the main object always included once). Object arrays are what you'd expect -
multiple instances of the VARS of the object.
CONs are not really included in the binary, they're only used at compile time.
DATs are included once only when the object is included.
Good that you've done some testing.
One of the ways I've found to save on VARs is to use a lot of local variables. They're
allocated in the stack and only exist when the routine (method) is executing. The
local variables are allocated strictly in order so you can create small arrays by allocating
several local (long) variables in a group. As an example, I needed a 32 byte buffer for
some text and declared 8 local variables in order, then referenced them using byte[noparse]/noparse:
James L
An empty PUB/PRI (no code it it) that wasn't called by any other PUB/PRI did increase the program size by two longs.
I didn't go into that depth when I looked at things.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Propeller + Hardware - extra bits for the bit bucket =· 1 Coffeeless KaosKidd
·
RoboGeek
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"I reject your reality and subsitute my own!"
Adam Savage, Mythbusters
www.parallax.com
www.goldmine-elec.com
www.expresspcb.com
www.startrek.com
·