Closed GoogleCodeExporter closed 9 years ago
That makes no sense. Neither const-string nor invoke-static/range have 4 bit
wideregister fields. const-string uses an 8-bit register field, so it is able
to go up to v255, while invoke-static/range uses a 16bit starting register and
an 8 bit register count, for a maximum register range of v65535..v65792
Are you positive you're looking at and assembling the correct code?
Original comment by JesusFr...@gmail.com
on 3 May 2011 at 4:28
Ah, sorry about that. I had not included a line out of hand that I was -sure-
was not causing it, because it's never given me a problem before and the error
had nothing to do with that line. My mistake.
I added back the line, getApplicationContext. It's called elsewhere in the code
exactly like that but with no problems.
.class public Lfile;
.super Landroid/app/Activity;
.source "file.java"
.method static constructor <clinit>()V
# stuff
.end method
.method public onCreate(Landroid/os/Bundle;)V
.locals 20
.parameter "someParam"
.prologue
.line 110
invoke-virtual {p0}, Lfile;->getApplicationContext()Landroid/content/Context;
const-string v15, "SomeString1"
const-string v16, "OnCreate"
invoke-static/range {v15 .. v16}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I
Is onCreate of an Activity special? After your previous comment I thought about
trying something like this:
invoke-virtual/range {p0 .. p0}, Lfile;->getBaseContext()Landroid/content/Context;
Which works fine. Is the error saying that p0 is not 4 bits?
Original comment by tekpr...@gmail.com
on 3 May 2011 at 12:15
Yes, that is in fact the offending line. There is some information on the
Registers wiki page about the difference between the v* and p* registers. In
short, the p* registers are aliased to the end of the v registers, based on how
many registers are used and how many parameters are in the method. For this
method, there are 22 registers total (20 "local" registers, and 2 parameter
registers), and so p0 is aliased to v19.
Original comment by JesusFr...@gmail.com
on 3 May 2011 at 2:27
Thanks for the explanation and writing up the documentation. I've looked at
several more apps and they all use invoke-virtual/range to get context when the
number of local registers is high enough.
Original comment by tekpr...@gmail.com
on 3 May 2011 at 2:37
Original issue reported on code.google.com by
tekpr...@gmail.com
on 3 May 2011 at 1:56