VM Maker: VMMaker-oscog-golubovsky.136.mcz

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

VM Maker: VMMaker-oscog-golubovsky.136.mcz

commits-2
 
Dmitry Golubovsky uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker-oscog-golubovsky.136.mcz

==================== Summary ====================

Name: VMMaker-oscog-golubovsky.136
Author: golubovsky
Time: 9 January 2012, 11:01:10 pm
UUID: 892dbc65-4c95-4bdd-837c-6bd55f66c93d
Ancestors: VMMaker-oscog-golubovsky.135

Added primitives to get and set VM idle timer interval.

=============== Diff against VMMaker-oscog-golubovsky.135 ===============

Item was added:
+ ----- Method: AndroidPlugin>>primGetVMTimerInterval (in category 'system primitives') -----
+ primGetVMTimerInterval
+ | timer vmcls vmobj bmmeth jmsg |
+ <var: 'timer' type: 'int'>
+ <var: 'vmcls' type: 'jclass'>
+ <var: 'vmobj' type: 'jobject'>
+ <var: 'bmmeth' type: 'jmethodID'>
+ <export: true>
+ vmcls := self getVMClass.
+ vmcls ifNil: [^ interpreterProxy primitiveFail].
+ vmobj := self getVMObject.
+ vmobj ifNil: [^ interpreterProxy primitiveFail].
+ bmmeth := self getMethod: 'getVMTimerInterval' withSig: '()I' inClass: vmcls.
+ bmmeth ifNil: [^ interpreterProxy primitiveFail].
+ timer := self callIntMethod: bmmeth On: vmobj with: 0.
+ interpreterProxy pop: 1.
+ interpreterProxy pushInteger: timer.
+ !

Item was added:
+ ----- Method: AndroidPlugin>>primSetVMTimerInterval (in category 'system primitives') -----
+ primSetVMTimerInterval
+ | timer vmcls vmobj bmmeth jmsg |
+ <var: 'timer' type: 'int'>
+ <var: 'vmcls' type: 'jclass'>
+ <var: 'vmobj' type: 'jobject'>
+ <var: 'bmmeth' type: 'jmethodID'>
+ <export: true>
+ timer :=  interpreterProxy stackIntegerValue: 0.
+ vmcls := self getVMClass.
+ vmcls ifNil: [^ interpreterProxy primitiveFail].
+ vmobj := self getVMObject.
+ vmobj ifNil: [^ interpreterProxy primitiveFail].
+ bmmeth := self getMethod: 'setVMTimerInterval' withSig: '(I)V' inClass: vmcls.
+ bmmeth ifNil: [^ interpreterProxy primitiveFail].
+ self callVoidMethod: bmmeth On: vmobj with: timer.
+ interpreterProxy pop: 1.
+ !

Reply | Threaded
Open this post in threaded view
|

Re: VM Maker: VMMaker-oscog-golubovsky.136.mcz

Igor Stasenko

What is this:

getMethod: 'setVMTimerInterval' withSig: '(I)V' inClass: vmcls.

first time i see that. ?

On 10 January 2012 05:02,  <[hidden email]> wrote:

>
> Dmitry Golubovsky uploaded a new version of VMMaker to project VM Maker:
> http://source.squeak.org/VMMaker/VMMaker-oscog-golubovsky.136.mcz
>
> ==================== Summary ====================
>
> Name: VMMaker-oscog-golubovsky.136
> Author: golubovsky
> Time: 9 January 2012, 11:01:10 pm
> UUID: 892dbc65-4c95-4bdd-837c-6bd55f66c93d
> Ancestors: VMMaker-oscog-golubovsky.135
>
> Added primitives to get and set VM idle timer interval.
>
> =============== Diff against VMMaker-oscog-golubovsky.135 ===============
>
> Item was added:
> + ----- Method: AndroidPlugin>>primGetVMTimerInterval (in category 'system primitives') -----
> + primGetVMTimerInterval
> +       | timer vmcls vmobj bmmeth jmsg |
> +       <var: 'timer' type: 'int'>
> +       <var: 'vmcls' type: 'jclass'>
> +       <var: 'vmobj' type: 'jobject'>
> +       <var: 'bmmeth' type: 'jmethodID'>
> +       <export: true>
> +       vmcls := self getVMClass.
> +       vmcls ifNil: [^ interpreterProxy primitiveFail].
> +       vmobj := self getVMObject.
> +       vmobj ifNil: [^ interpreterProxy primitiveFail].
> +       bmmeth := self getMethod: 'getVMTimerInterval' withSig: '()I' inClass: vmcls.
> +       bmmeth ifNil: [^ interpreterProxy primitiveFail].
> +       timer := self callIntMethod: bmmeth On: vmobj with: 0.
> +       interpreterProxy pop: 1.
> +       interpreterProxy pushInteger: timer.
> + !
>
> Item was added:
> + ----- Method: AndroidPlugin>>primSetVMTimerInterval (in category 'system primitives') -----
> + primSetVMTimerInterval
> +       | timer vmcls vmobj bmmeth jmsg |
> +       <var: 'timer' type: 'int'>
> +       <var: 'vmcls' type: 'jclass'>
> +       <var: 'vmobj' type: 'jobject'>
> +       <var: 'bmmeth' type: 'jmethodID'>
> +       <export: true>
> +       timer :=  interpreterProxy stackIntegerValue: 0.
> +       vmcls := self getVMClass.
> +       vmcls ifNil: [^ interpreterProxy primitiveFail].
> +       vmobj := self getVMObject.
> +       vmobj ifNil: [^ interpreterProxy primitiveFail].
> +       bmmeth := self getMethod: 'setVMTimerInterval' withSig: '(I)V' inClass: vmcls.
> +       bmmeth ifNil: [^ interpreterProxy primitiveFail].
> +       self callVoidMethod: bmmeth On: vmobj with: timer.
> +       interpreterProxy pop: 1.
> + !
>



--
Best regards,
Igor Stasenko.
Reply | Threaded
Open this post in threaded view
|

Re: VM Maker: VMMaker-oscog-golubovsky.136.mcz

Bert Freudenberg


On 10.01.2012, at 14:28, Igor Stasenko wrote:

> What is this:
>
> getMethod: 'setVMTimerInterval' withSig: '(I)V' inClass: vmcls.
>
> first time i see that. ?

The Java interface, looks like.

- Bert -

> On 10 January 2012 05:02,  <[hidden email]> wrote:
>>
>> Dmitry Golubovsky uploaded a new version of VMMaker to project VM Maker:
>> http://source.squeak.org/VMMaker/VMMaker-oscog-golubovsky.136.mcz
>>
>> ==================== Summary ====================
>>
>> Name: VMMaker-oscog-golubovsky.136
>> Author: golubovsky
>> Time: 9 January 2012, 11:01:10 pm
>> UUID: 892dbc65-4c95-4bdd-837c-6bd55f66c93d
>> Ancestors: VMMaker-oscog-golubovsky.135
>>
>> Added primitives to get and set VM idle timer interval.
>>
>> =============== Diff against VMMaker-oscog-golubovsky.135 ===============
>>
>> Item was added:
>> + ----- Method: AndroidPlugin>>primGetVMTimerInterval (in category 'system primitives') -----
>> + primGetVMTimerInterval
>> +       | timer vmcls vmobj bmmeth jmsg |
>> +       <var: 'timer' type: 'int'>
>> +       <var: 'vmcls' type: 'jclass'>
>> +       <var: 'vmobj' type: 'jobject'>
>> +       <var: 'bmmeth' type: 'jmethodID'>
>> +       <export: true>
>> +       vmcls := self getVMClass.
>> +       vmcls ifNil: [^ interpreterProxy primitiveFail].
>> +       vmobj := self getVMObject.
>> +       vmobj ifNil: [^ interpreterProxy primitiveFail].
>> +       bmmeth := self getMethod: 'getVMTimerInterval' withSig: '()I' inClass: vmcls.
>> +       bmmeth ifNil: [^ interpreterProxy primitiveFail].
>> +       timer := self callIntMethod: bmmeth On: vmobj with: 0.
>> +       interpreterProxy pop: 1.
>> +       interpreterProxy pushInteger: timer.
>> + !
>>
>> Item was added:
>> + ----- Method: AndroidPlugin>>primSetVMTimerInterval (in category 'system primitives') -----
>> + primSetVMTimerInterval
>> +       | timer vmcls vmobj bmmeth jmsg |
>> +       <var: 'timer' type: 'int'>
>> +       <var: 'vmcls' type: 'jclass'>
>> +       <var: 'vmobj' type: 'jobject'>
>> +       <var: 'bmmeth' type: 'jmethodID'>
>> +       <export: true>
>> +       timer :=  interpreterProxy stackIntegerValue: 0.
>> +       vmcls := self getVMClass.
>> +       vmcls ifNil: [^ interpreterProxy primitiveFail].
>> +       vmobj := self getVMObject.
>> +       vmobj ifNil: [^ interpreterProxy primitiveFail].
>> +       bmmeth := self getMethod: 'setVMTimerInterval' withSig: '(I)V' inClass: vmcls.
>> +       bmmeth ifNil: [^ interpreterProxy primitiveFail].
>> +       self callVoidMethod: bmmeth On: vmobj with: timer.
>> +       interpreterProxy pop: 1.
>> + !
>>
>
>
>
> --
> Best regards,
> Igor Stasenko.

Reply | Threaded
Open this post in threaded view
|

Re: VM Maker: VMMaker-oscog-golubovsky.136.mcz

michael.haupt
 
Hi,

Am 10.01.2012 um 15:04 schrieb Bert Freudenberg:
What is this:

getMethod: 'setVMTimerInterval' withSig: '(I)V' inClass: vmcls.

first time i see that. ?

The Java interface, looks like.

correct; it asks for a method in the class represented by vmcls, named setVMTimerInterval, accepting an int and returning void. '(I)V' is the internal way of JVMs to represent such a method signature.

Best,

Michael

-- 

Oracle
Dr. Michael Haupt | Principal Member of Technical Staff
Phone: +49 331 200 7277 | Fax: +49 331 200 7561
Oracle Labs 
Oracle Deutschland B.V. & Co. KG, Schiffbauergasse 14 | 14467 Potsdam, Germany
Green OracleOracle is committed to developing practices and products that help protect the environment

Reply | Threaded
Open this post in threaded view
|

Re: VM Maker: VMMaker-oscog-golubovsky.136.mcz

Dimitry Golubovsky
In reply to this post by commits-2
 
Igor Stasenko wrote:

> What is this:

> getMethod: 'setVMTimerInterval' withSig: '(I)V' inClass: vmcls.

> first time i see that. ?

Yes, that's JNI stuff I have to use to get certain things from Android.

So I wrote few wrappers and helper functions around JNI calls and
helper functions to make it easier to resolve JNI calls in VMMaker.
They all are under platforms/android in the VM tree on Gitorious.

This particular one is in response to a discussion on the Pharo list
that CogDroid eats too much battery. It does, if the idle timer wakes
it up too frequently. This VM primitive changes the idle timer
frequency, so with large values in it VM may be (almost) completely
frozen in the absense of user input.

Thanks.

--
Dimitry Golubovsky

Anywhere on the Web
Reply | Threaded
Open this post in threaded view
|

Re: VM Maker: VMMaker-oscog-golubovsky.136.mcz

Igor Stasenko
 
On 10 January 2012 20:02, Dimitry Golubovsky <[hidden email]> wrote:

>
> Igor Stasenko wrote:
>
>> What is this:
>
>> getMethod: 'setVMTimerInterval' withSig: '(I)V' inClass: vmcls.
>
>> first time i see that. ?
>
> Yes, that's JNI stuff I have to use to get certain things from Android.
>
> So I wrote few wrappers and helper functions around JNI calls and
> helper functions to make it easier to resolve JNI calls in VMMaker.
> They all are under platforms/android in the VM tree on Gitorious.
>
> This particular one is in response to a discussion on the Pharo list
> that CogDroid eats too much battery. It does, if the idle timer wakes
> it up too frequently. This VM primitive changes the idle timer
> frequency, so with large values in it VM may be (almost) completely
> frozen in the absense of user input.
>

Yes. I just thought that you made this call in interpreter code..
but then i see that you just added an extra plugin to vmmaker package. :)

Btw, Is there a reasons why you did that, instead of keeping a plugin
in a separate package?
Because some people are already concerned about  VMMaker package size
and voiced to split it
on separate parts, while you doing completely opposite.

> Thanks.
>
> --
> Dimitry Golubovsky
>
> Anywhere on the Web



--
Best regards,
Igor Stasenko.
Reply | Threaded
Open this post in threaded view
|

Re: VM Maker: VMMaker-oscog-golubovsky.136.mcz

Dimitry Golubovsky
In reply to this post by commits-2
 
Hi,

Igor Stasenko wrote:

> Yes. I just thought that you made this call in interpreter code..
> but then i see that you just added an extra plugin to vmmaker package. :)

> Btw, Is there a reasons why you did that, instead of keeping a plugin
> in a separate package?

I think, the reason at the beginning was not to complicate the Cog
configuration by adding extra packages. I wasn't sure how well it
works out although now I see it does pretty well.

Besides, Android plugin is part of the platform support, and IMHO not
much less needed than e. g. Balloon and friends. I just put it into a
separate category.

> Because some people are already concerned about  VMMaker package size
> and voiced to split it
> on separate parts, while you doing completely opposite.

I am also concerned with VMMaker size (it is over 2M now) however
Android plugin would not decrease its size considerably if split from
the rest of the package.

I would also support the idea to split it into say
JIT+interpreter+memory, building, plugins, and C translation (as I see
from quick look at its categories assuming these groups are
orthogonal). But I am not sure how well will these (I'm afraid not so
orthogonal) parts live and develop apart. Cog configuration will have
to track N packages' versions instead of a single package.

But maybe C translation could be taken apart more easily than the rest of VM.

Thanks.

--
Dimitry Golubovsky

Anywhere on the Web