error with code > 1 Kb

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

error with code > 1 Kb

rrojano
Dear all,

  Does any body knows why the code in each class should be less than 1 KB?
  When I wrote code bigger than 1 KB I got an error from the compiler.

Regards,
Rafael
Reply | Threaded
Open this post in threaded view
|

Re: error with code > 1 Kb

Andreas.Raab
That's a limit of the compiler / byte code representation. Split your
method into two and have one call the other instead.

Cheers,
   - Andreas

Rafael Rojano wrote:
> Dear all,
>
>   Does any body knows why the code in each class should be less than 1 KB?
>   When I wrote code bigger than 1 KB I got an error from the compiler.
>
> Regards,
> Rafael
Reply | Threaded
Open this post in threaded view
|

Re: error with code > 1 Kb

rrojano
Thank you!

But, I don't get very clear why does exist this limitation. Do you know if there is any document where I could read about this limitation?

By the way if I should split my method, suppose the next scenario:
 I got an object (suppose a cube) and I would like to modify their behavior making a translation or any transformation with respect to a second object, how could get access to the behavior of the second object accessing it from the first object? How to gain access to their variables?

 Does it have sense? Thank you for your time.

Rafael

On Thu, Jul 17, 2008 at 7:35 PM, Andreas Raab <[hidden email]> wrote:
That's a limit of the compiler / byte code representation. Split your method into two and have one call the other instead.

Cheers,
 - Andreas


Rafael Rojano wrote:
Dear all,

 Does any body knows why the code in each class should be less than 1 KB?
 When I wrote code bigger than 1 KB I got an error from the compiler.

Regards,
Rafael

Reply | Threaded
Open this post in threaded view
|

Re: error with code > 1 Kb

Andreas.Raab
Rafael Rojano wrote:
> But, I don't get very clear why does exist this limitation. Do you know
> if there is any document where I could read about this limitation?

I'm not sure about all the reasons but one limit that comes to mind is
the conditional jump bytecodes. They are limited to the range -1023 to
+1024 (IIRC) so the VM doesn't know how to execute jumps beyond these
limits.

> By the way if I should split my method, suppose the next scenario:
> I got an object (suppose a cube) and I would like to modify their
> behavior making a translation or any transformation with respect to a
> second object, how could get access to the behavior of the second object
> accessing it from the first object? How to gain access to their variables?

You send messages. In general you cannot get access to another object's
variables unless that object allows it by providing accessor messages.
In Smalltalk all object interaction is based on message-passing, there
simply isn't a way of accessing another objects variables directly.

Cheers,
   - Andreas