Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Java Machine > Re: Manipulate ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 2 Topic 772 of 816
Post > Topic >>

Re: Manipulate java thread stack in this way

by Tom Hawtin <usenet@[EMAIL PROTECTED] > May 28, 2007 at 11:25 PM

Yao Qi wrote:
> 
>    top-->   +--------+
>             |  long  |

long is two entries. This is the real problem, as swap wont work as 
intended. (Not a popular piece of byte code design, but presumably a bit 
easier for interpreters on 32-bit systems.)

>             +--------+
>             | Object |
>             +--------+
>             |  ...   | 
> 
> we want to transform this stack layout to this, shown as follows,
> 
> 
>    top-->   +--------+
>             | Object |
>             +--------+
>             |  long  |
>             +--------+
>             | Object |
>             +--------+
>             | Object |
>             +--------+
>             |  ...   | 


So you have

...., C, B, A

where A and B are the long and C the reference, and you want

...., C, C, B, A, C

The trick is to use dup_x and then discard unwanted values.

So

...., C, B, A
                dup2_x1
...., B, A, C, B, A
                pop2
...., B, A, C
                dup_x2
...., C, B, A, C
                dup_x2
...., C, C, B, A, C

I think. (And make sure you set the max frame size appropriately.)

If you are writing code from scratch, then local variables are very 
useful. Probably not so convenient for instrumentation.

Tom Hawtin
 




 2 Posts in Topic:
Manipulate java thread stack in this way
Yao Qi <qiyaoltc@[EMAI  2007-05-29 01:28:55 
Re: Manipulate java thread stack in this way
Tom Hawtin <usenet@[EM  2007-05-28 23:25:02 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Jul 26 5:03:54 CDT 2008.