[vwnc] VW crash on large method invocation

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

[vwnc] VW crash on large method invocation

Andres Fortier-2
Hi list,
           today I bumped into a weird problem (VW 7.4.1 running on
linux). I was preparing some datasets to perform tests and profiles.
These datasets where gathered from files and automatically converted
to methods, generating something like:

data

| col |
col:=OrderedCollection new.
col add: e1.
col add: e2.
...
col add: eN.
^col.

However, when evaluating the method to get the collection, VW just
juts down; no warnings or errors, just quit. By doing some
trial-and-error I've found out that the limit for the collection seems
to be 3952 elements (in particular Point elements); if it is larger
than that it breaks the image.
I'm sending a file-out attached. Evaluating "Explode data" should shut
down the image

Any hints about this problem are appreciated.

Cheers,
             andrés

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc

Explode.st.zip (60K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] VW crash on large method invocation

Reinout Heeck

On Windows your code crashes the VM too (translation error).

Looking at your method I see that it contains about 60000 bytes of
bytecode. Assuming the JIT creates machine code that is a factor 4 (just
a figure) larger it seems that you might be blowing the JITs capability
to use short branches or indicate compiled code length in two bytes or
something else like that.



The pattern to use with VW is to create large literal arrays and use
small code to turn that into your desired object. This is how windowSpec
methods work for instance.


So if you write your code like this

data
   ^#(
      #(-7.19265 -10.0)
      #(-4.39122 -10.0)
      #(-1.59041 -10.0)
      ...
      #(-4.2767 6.19155)
      #(-7.35022 -6.39121)
   )
      collect: [:pair | pair first @ pair last]


you end up with a method that contains only 5 byte codes and 1 literal
-- nowhere near any VM limits :-)


HTH,

Reinout
-------




Andres Fortier wrote:

> Hi list,
>           today I bumped into a weird problem (VW 7.4.1 running on
> linux). I was preparing some datasets to perform tests and profiles.
> These datasets where gathered from files and automatically converted to
> methods, generating something like:
>
> data
>
> | col |
> col:=OrderedCollection new.
> col add: e1.
> col add: e2.
> ...
> col add: eN.
> ^col.
>
> However, when evaluating the method to get the collection, VW just juts
> down; no warnings or errors, just quit. By doing some trial-and-error
> I've found out that the limit for the collection seems to be 3952
> elements (in particular Point elements); if it is larger than that it
> breaks the image.
> I'm sending a file-out attached. Evaluating "Explode data" should shut
> down the image
>
> Any hints about this problem are appreciated.
>
> Cheers,
>             andrés
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> vwnc mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] VW crash on large method invocation

Andres Fortier-2
Hi Reinout, thanks for the tip and explanation. However I still find
it quite weird that I get no warnings or errors when compiling...

Thanks again!
Andrés

Reinout Heeck escribió:

> On Windows your code crashes the VM too (translation error).
>
> Looking at your method I see that it contains about 60000 bytes of
> bytecode. Assuming the JIT creates machine code that is a factor 4 (just
> a figure) larger it seems that you might be blowing the JITs capability
> to use short branches or indicate compiled code length in two bytes or
> something else like that.
>
>
>
> The pattern to use with VW is to create large literal arrays and use
> small code to turn that into your desired object. This is how windowSpec
> methods work for instance.
>
>
> So if you write your code like this
>
> data
>    ^#(
>       #(-7.19265 -10.0)
>       #(-4.39122 -10.0)
>       #(-1.59041 -10.0)
>       ...
>       #(-4.2767 6.19155)
>       #(-7.35022 -6.39121)
>    )
>       collect: [:pair | pair first @ pair last]
>
>
> you end up with a method that contains only 5 byte codes and 1 literal
> -- nowhere near any VM limits :-)
>
>
> HTH,
>
> Reinout
> -------
>
>
>
>
> Andres Fortier wrote:
>> Hi list,
>>           today I bumped into a weird problem (VW 7.4.1 running on
>> linux). I was preparing some datasets to perform tests and profiles.
>> These datasets where gathered from files and automatically converted to
>> methods, generating something like:
>>
>> data
>>
>> | col |
>> col:=OrderedCollection new.
>> col add: e1.
>> col add: e2.
>> ...
>> col add: eN.
>> ^col.
>>
>> However, when evaluating the method to get the collection, VW just juts
>> down; no warnings or errors, just quit. By doing some trial-and-error
>> I've found out that the limit for the collection seems to be 3952
>> elements (in particular Point elements); if it is larger than that it
>> breaks the image.
>> I'm sending a file-out attached. Evaluating "Explode data" should shut
>> down the image
>>
>> Any hints about this problem are appreciated.
>>
>> Cheers,
>>             andrés
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> vwnc mailing list
>> [hidden email]
>> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
> _______________________________________________
> vwnc mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] VW crash on large method invocation

Reinout Heeck

On Aug 21, 2008, at 4:13 PM, Andres Fortier wrote:

> However I still find
> it quite weird that I get no warnings or errors when compiling...



The byte code compiler does not have enough information to do that: it  
cannot predict on which platforms the byte codes will be run so it  
does not know the expansion factors of byte code to native translation  
on those platforms and cannot choose the largest of those to use in  
such a validation. (With apologies for my english style here.)

R
-

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

[vwnc] VW crash on large method invocation

Eliot Miranda-2
In reply to this post by Andres Fortier-2
Oops! Misaddressed.  Sorry.



On Thu, Aug 21, 2008 at 7:13 AM, Andres Fortier <[hidden email]> wrote:
Hi Reinout, thanks for the tip and explanation. However I still find
it quite weird that I get no warnings or errors when compiling...

If you run in a console window (assuming you're on WIndows) the VM should print some form of translation failure on stdout.

Steve and I have discussed the following solution often, but never got round to implementing, because this is a rare problem.  The VM should maintain a limit on the size of native method it will generate and provide some send-back error path, much like doesNotUnderstand: (but more similar in intent to illegalBytecode), so that when one tries to run a method that would generate too much code the VM sends, e.g. methodTooBig: aMessage, to the receiver, and methodTooBig: interprets the method using the simulation machinery.  Overall this is probably better then translating because it allows the VM to maintain a better working set of translated methods that the interpreted method will call, and the VM doesn't waste time translating huge methods.  The simulation machinery can probably be sped-up considerably using perform: and an array of selectors for the bytecode set.


Thanks again!
Andrés

Reinout Heeck escribió:
> On Windows your code crashes the VM too (translation error).
>
> Looking at your method I see that it contains about 60000 bytes of
> bytecode. Assuming the JIT creates machine code that is a factor 4 (just
> a figure) larger it seems that you might be blowing the JITs capability
> to use short branches or indicate compiled code length in two bytes or
> something else like that.
 


The ratios in the VM are about 10 to 1 for CISC code (x86) through 20 to 1 for RISC code such as SPARC.   The VM's branch code *should* cope.  It does an optimistic pass using short branches and if this fails sets a "use long branches" flag, and redoes the compilation with long branches (but there could easily be a bug here).



>
>
>
> The pattern to use with VW is to create large literal arrays and use
> small code to turn that into your desired object. This is how windowSpec
> methods work for instance.
>
>
> So if you write your code like this
>
> data
>    ^#(
>       #(-7.19265 -10.0)
>       #(-4.39122 -10.0)
>       #(-1.59041 -10.0)
>       ...
>       #(-4.2767 6.19155)
>       #(-7.35022 -6.39121)
>    )
>       collect: [:pair | pair first @ pair last]
>
>
> you end up with a method that contains only 5 byte codes and 1 literal
> -- nowhere near any VM limits :-)
>
>
> HTH,
>
> Reinout
> -------
>
>
>
>
> Andres Fortier wrote:
>> Hi list,
>>           today I bumped into a weird problem (VW 7.4.1 running on
>> linux). I was preparing some datasets to perform tests and profiles.
>> These datasets where gathered from files and automatically converted to
>> methods, generating something like:
>>
>> data
>>
>> | col |
>> col:=OrderedCollection new.
>> col add: e1.
>> col add: e2.
>> ...
>> col add: eN.
>> ^col.
>>
>> However, when evaluating the method to get the collection, VW just juts
>> down; no warnings or errors, just quit. By doing some trial-and-error
>> I've found out that the limit for the collection seems to be 3952
>> elements (in particular Point elements); if it is larger than that it
>> breaks the image.
>> I'm sending a file-out attached. Evaluating "Explode data" should shut
>> down the image
>>
>> Any hints about this problem are appreciated.
>>
>> Cheers,
>>             andrés
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> vwnc mailing list
>> [hidden email]
>> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
> _______________________________________________
> vwnc mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc



_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] VW crash on large method invocation

Cesar Rabak
In reply to this post by Reinout Heeck
Reinout Heeck escreveu:

> On Aug 21, 2008, at 4:13 PM, Andres Fortier wrote:
>
>> However I still find
>> it quite weird that I get no warnings or errors when compiling...
>
>
>
> The byte code compiler does not have enough information to do that: it  
> cannot predict on which platforms the byte codes will be run so it  
> does not know the expansion factors of byte code to native translation  
> on those platforms and cannot choose the largest of those to use in  
> such a validation. (With apologies for my english style here.)
>
> R
You don't need to apologise: your German stype is clear enough :-D and
the info is good!

--
Cesar Rabak
GNU/Linux User 52247.
Get counted: http://counter.li.org/
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] VW crash on large method invocation

Andres Fortier-2
In reply to this post by Reinout Heeck
Mmm, I see. However I still prefer a warning (based on the minimum
bytecode size that can crash on a 32-bit platform) than just see my
image die and have to replay the changes (and then finding out why my
image died :)).
Thanks for info!

Cheers,
             Andrés

Reinout Heeck escribió:

> On Aug 21, 2008, at 4:13 PM, Andres Fortier wrote:
>
>> However I still find
>> it quite weird that I get no warnings or errors when compiling...
>
>
>
> The byte code compiler does not have enough information to do that: it  
> cannot predict on which platforms the byte codes will be run so it  
> does not know the expansion factors of byte code to native translation  
> on those platforms and cannot choose the largest of those to use in  
> such a validation. (With apologies for my english style here.)
>
> R
> -
>
> _______________________________________________
> vwnc mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] VW crash on large method invocation

Eliot Miranda-2
In reply to this post by Andres Fortier-2


On Thu, Aug 21, 2008 at 9:56 AM, Andres Fortier <[hidden email]> wrote:
Hi Eliot! Thanks for the detailed explanation. I know this is a (very) rare case, however since it is potentially dangerous and a trivial solution doesn't seem to be very complex (just throw an error if, after compiling, the size of the compiled code is greater than X) I can't help wondering why it isn't fixed. At least It would have saved me some debugging time :)



Difficult for the image to do the test because the code generated will differ in size depending on the processor.  The simplest thing would be for the VM to send e.g. badBytecode:at: with the pc of the instruction that is too big.  The image could then infer form the fact that it is not an illegal bytecode that the method is too big.  Supplying nil as the value of the bytecode would make it easy for the image to realise this was a method that was too big.
 


Cheers!
Andrés

Eliot Miranda escribió:

On Thu, Aug 21, 2008 at 7:13 AM, Andres Fortier <
[hidden email]> wrote:

Hi Reinout, thanks for the tip and explanation. However I still find
it quite weird that I get no warnings or errors when compiling...


If you run in a console window (assuming you're on WIndows) the VM should
print some form of translation failure on stdout.

Steve and I have discussed the following solution often, but never got round
to implementing, because this is a rare problem.  The VM should maintain a
limit on the size of native method it will generate and provide some
send-back error path, much like doesNotUnderstand: (but more similar in
intent to illegalBytecode), so that when one tries to run a method that
would generate too much code the VM sends, e.g. methodTooBig: aMessage, to
the receiver, and methodTooBig: interprets the method using the simulation
machinery.  Overall this is probably better then translating because it
allows the VM to maintain a better working set of translated methods that
the interpreted method will call, and the VM doesn't waste time translating
huge methods.  The simulation machinery can probably be sped-up considerably
using perform: and an array of selectors for the bytecode set.


Thanks again!
Andrés

Reinout Heeck escribió:
On Windows your code crashes the VM too (translation error).

Looking at your method I see that it contains about 60000 bytes of
bytecode. Assuming the JIT creates machine code that is a factor 4 (just
a figure) larger it seems that you might be blowing the JITs capability
to use short branches or indicate compiled code length in two bytes or
something else like that.



The ratios in the VM are about 10 to 1 for CISC code (x86) through 20 to 1
for RISC code such as SPARC.   The VM's branch code *should* cope.  It does
an optimistic pass using short branches and if this fails sets a "use long
branches" flag, and redoes the compilation with long branches (but there
could easily be a bug here).





The pattern to use with VW is to create large literal arrays and use
small code to turn that into your desired object. This is how windowSpec
methods work for instance.


So if you write your code like this

data
  ^#(
     #(-7.19265 -10.0)
     #(-4.39122 -10.0)
     #(-1.59041 -10.0)
     ...
     #(-4.2767 6.19155)
     #(-7.35022 -6.39121)
  )
     collect: [:pair | pair first @ pair last]


you end up with a method that contains only 5 byte codes and 1 literal
-- nowhere near any VM limits :-)


HTH,

Reinout
-------




Andres Fortier wrote:
Hi list,
         today I bumped into a weird problem (VW 7.4.1 running on
linux). I was preparing some datasets to perform tests and profiles.
These datasets where gathered from files and automatically converted to
methods, generating something like:

data

| col |
col:=OrderedCollection new.
col add: e1.
col add: e2.
...
col add: eN.
^col.

However, when evaluating the method to get the collection, VW just juts
down; no warnings or errors, just quit. By doing some trial-and-error
I've found out that the limit for the collection seems to be 3952
elements (in particular Point elements); if it is larger than that it
breaks the image.
I'm sending a file-out attached. Evaluating "Explode data" should shut
down the image

Any hints about this problem are appreciated.

Cheers,
           andrés


------------------------------------------------------------------------

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc




_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

[vwnc] System Browser

Menanteau Jannick
In reply to this post by Andres Fortier-2
Hi all,

I would like to access to the code of the System Browser, for test to  
modify the graphical interface.
But I don't know what and where is the concerned classes.

Can you help me ?

Thanks

Jannick
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc