Name: clC74495 Date: 01/16/99
=20
Even though, the trace function is an important feature for us Java program=
mer,
trace function in JVM has the following problems:
1. It does not support native characters.
In the trace information several information has a native characters, =
such as
string literal, variable/class/package/method/thread names.
Since the trace function does not support the native character, it does=
n't help
so much when we use the native characters in a Java program.
More over, in some context, the JVM took away the first byte of the eac=
h char
type data(UNICODE) we can't convert them to the native characters by us=
ing
trace file taken.
The JVM should support native characters in it.
2. Incorrect trace information in the putfield_quick and ldc_quick instruc=
tion.
The putfield_quick and ldc_quick instruction is putting the work area a=
ddress
of the field for its trace information, rather than the contents of the=
field.
It does not make sense, should output the contents of the field.
<Java SOURCE CODE that demonstrates the problem. With Kanji code(SJIS).>
import java.lang.*;
public class KanjiTrace extends Thread {
public KanjiTrace(String name) {
super(name);
}
public static float =95=82=93=AE=8F=AC=90=94=93_=95=CF=90=941,var2,var=
3,var4;
public String var5;
protected String =82=C8=82=A2=82=E6=82=A4 ;
public String =82=AD=82=A4=82=CD=82=AD;
protected String[][] =8EQ=8F=C6=3Dnew String[2][3];
protected final String =8A=BF=8E=9A=82=CC=95\ []=3D{"=88=EB","=93=F3","=
=8EQ"};
public String =8A=D6=90=94(long =90=94){
=82=C8=82=A2=82=E6=82=A4=3D((=8EQ=8F=C6[1]=3D=8A=BF=8E=9A=82=CC=95\)[(=
int)(=90=94)]);
return "=91S=8Ap=81@+=83n=83=93=83J=83N =83R=83=93=83U=83C";
}
public void run(){
Runtime.getRuntime().traceMethodCalls(true);
Runtime.getRuntime().traceInstructions(true);
=95=82=93=AE=8F=AC=90=94=93_=95=CF=90=941=3D 1.0f;
var5=3D=8A=D6=90=94(1L);
Runtime.getRuntime().traceInstructions(false);
Runtime.getRuntime().traceMethodCalls(false);
}
public static void main(String argv[]){
KanjiTrace tp=3Dnew KanjiTrace("//=8A=BF=8E=9A=82=F0=8A=DC=82=DE=95=
=B6=8E=9A=97=F1=82=C5=81A=83=86=83j=83R=81[=83h=83G=83X=83P=81[=83v=83V=81[=
=83P=83=93=83X=82=C5=82=CD256characters=82=F0=92=B4=82=A6=81A\n =8B=F3=94=
=92=82=E2=89=FC=8Ds=82=E0=8A=DC=82=DEname//");
try {
tp.start();
tp.join();
}
catch (InterruptedException e) {}
finally {
tp=3Dnull;
}
}
}
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
<Java SOURCE CODE that demonstrates the problem. Without Kanji code.>
<In case of you cann't read the Kanji code, this is a ascii version of the =
above program. (Output of the native2ascii.)>
import java.lang.*;
public class KanjiTrace extends Thread {
public KanjiTrace(String name) {
super(name);
}
public static float \u6d6e\u52d5\u5c0f\u6570\u70b9\u5909\u65701,var2,v=
ar3,var4;
public String var5;
protected String \u306a\u3044\u3088\u3046 ;
public String \u304f\u3046\u306f\u304f;
protected String[][] \u53c2\u7167=3Dnew String[2][3];
protected final String \u6f22\u5b57\u306e\u8868 []=3D{"\u58f1","\u5f10","=
\u53c2"};
public String \u95a2\u6570(long \u6570){
\u306a\u3044\u3088\u3046=3D((\u53c2\u7167[1]=3D\u6f22\u5b57\u306e\u886=
8)[(int)(\u6570)]);
return "\u5168\u89d2\u3000+\u30cf\u30f3\u30ab\u30af \u30b3\u30f3\u30b6=
\u30a4";
}
public void run(){
Runtime.getRuntime().traceMethodCalls(true);
Runtime.getRuntime().traceInstructions(true);
\u6d6e\u52d5\u5c0f\u6570\u70b9\u5909\u65701=3D 1.0f;
var5=3D\u95a2\u6570(1L);
Runtime.getRuntime().traceInstructions(false);
Runtime.getRuntime().traceMethodCalls(false);
}
public static void main(String argv[]){
KanjiTrace tp=3Dnew KanjiTrace("//\u6f22\u5b57\u3092\u542b\u3080\u658=
7\u5b57\u5217\u3067\u3001\u30e6\u30cb\u30b3\u30fc\u30c9\u30a8\u30b9\u30b1\u=
30fc\u30d7\u30b7\u30fc\u30b1\u30f3\u30b9\u3067\u306f256characters\u3092\u8d=
85\u3048\u3001\n \u7a7a\u767d\u3084\u6539\u884c\u3082\u542b\u3080name//");
try {
tp.start();
tp.join();
}
catch (InterruptedException e) {}
finally {
tp=3Dnull;
}
}
}
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
<Trace output got from JDK on Windows>
# //"W=92+=80=87W=17g=01=E6=CB=B3=FC=C9=A8=B9=B1=FC=D7=B7=FC=B1=F3=B9go256c=
haracters=92=85H=01
z}=849L=82+=80name// [ 1] | < java/lang/Runtime.traceMethodCalls(Z)V retur=
ning
# //"W=92+=80=87W=17g=01=E6=CB=B3=FC=C9=A8=B9=B1=FC=D7=B7=FC=B1=F3=B9go256c=
haracters=92=85H=01
z}=849L=82+=80name// [ 1] | > java/lang/Runtime.getRuntime()Ljava/lang/Run=
time; (0) entered
# //"W=92+=80=87W=17g=01=E6=CB=B3=FC=C9=A8=B9=B1=FC=D7=B7=FC=B1=F3=B9go256c=
haracters=92=85H=01
z}=849L=82+=80name// [ 1] | < java/lang/Runtime.getRuntime()Ljava/lang/Run=
time; returning
# //"W=92+=80=87W=17g=01=E6=CB=B3=FC=C9=A8=B9=B1=FC=D7=B7=FC=B1=F3=B9go256c=
haracters=92=85H=01
z}=849L=82+=80name// [ 1] | > java/lang/Runtime.traceInstructions(Z)V (2) =
entered
# //"W=92+=80=87W=17g=01=E6=CB=B3=FC=C9=A8=B9=B1=FC=D7=B7=FC=B1=F3=B9go256c=
haracters=92=85H=01
z}=849L=82+=80name// [ 1] | < java/lang/Runtime.traceInstructions(Z)V retu=
rning
E64288 69EB16=09fconst_1
E64288 69EB17=09putstatic KanjiTrace.=E6=B5=AE=E5=8B=95=E5=B0=8F=E6=95=B0=
=E7=82=B9=E5=A4=89=E6=95=B01
E64288 69EB17=09putstatic_quick KanjiTrace.=E6=B5=AE=E5=8B=95=E5=B0=8F=E6=
=95=B0=E7=82=B9=E5=A4=89=E6=95=B01 <=3D 1
E64288 69EB1A=09aload_0 =3D> KanjiTrace@E64288/EFB690
E64288 69EB1B=09aload_0 =3D> KanjiTrace@E64288/EFB690
E64288 69EB1C=09lconst_1
E64288 69EB1D=09invokevirtual KanjiTrace.=E9=96=A2=E6=95=B0(J)Ljava/lang/=
String;
E64288 69EB1D=09invokevirtual_quick KanjiTrace.=E9=96=A2=E6=95=B0(J)Ljava=
/lang/String; (3)
# //"W=92+=80=87W=17g=01=E6=CB=B3=FC=C9=A8=B9=B1=FC=D7=B7=FC=B1=F3=B9go256c=
haracters=92=85H=01
z}=849L=82+=80name// [ 1] | > KanjiTrace.=E9=96=A2=E6=95=B0(J)Ljava/lang/S=
tring; (3) entered
Entering KanjiTrace.=E9=96=A2=E6=95=B0(KanjiTrace.java:14)
E64288 69EAE0=09aload_0 =3D> KanjiTrace@E64288/EFB690
E64288 69EAE1=09aload_0 =3D> KanjiTrace@E64288/EFB690
E64288 69EAE2=09getfield KanjiTrace.=E5=8F=82=E7=85=A7
E64288 69EAE2=09getfield_quick KanjiTrace@E64288/EFB690.(#14) <=3D E64258
E64288 69EAE5=09iconst_1
E64288 69EAE6=09aload_0 =3D> KanjiTrace@E64288/EFB690
E64288 69EAE7=09getfield KanjiTrace.=E6=BC=A2=E5=AD=97=E3=81=AE=E8=A1=A8
E64288 69EAE7=09getfield_quick KanjiTrace@E64288/EFB690.(#15) <=3D E64240
E64288 69EAEA=09dup_x2
E64288 69EAEB=09aastore ?[1] <=3D 268970848
E64288 69EAEC=09lload_1 =3D> 1
E64288 69EAED=09l2i =3D> 1
E64288 69EAEE=09aaload ?[1] =3D> java.lang.String@E64220/EFB960
E64288 69EAEF=09putfield KanjiTrace.=E3=81=AA=E3=81=84=E3=82=88=E3=81=86
E64288 69EAEF=09putfield_quick KanjiTrace@E64288/EFB690.(#12) <=3D E64220
E64288 0execute_java_constructor new java/lang/String =3D> java.lang=
.String@E64418/EFBD18
Entering=20
E64288 233F3C8=09invokenonvirtual_quick java/lang/String.<init>(II[C)V (4)
# //"W=92+=80=87W=17g=01=E6=CB=B3=FC=C9=A8=B9=B1=FC=D7=B7=FC=B1=F3=B9go256c=
haracters=92=85H=01
z}=849L=82+=80name// [ 2] | | > java/lang/String.<init>(II[C)V (4) entered
Entering java.lang.String.<init>(String.java:368)
E64288 673C5C=09aload_0 =3D> java.lang.String@E64418/EFBD18
E64288 673C5D=09invokeignored_quick
E64288 673C60=09aload_0 =3D> java.lang.String@E64418/EFBD18
E64288 673C61=09aload_3 =3D> "h=D2
E64288 673C62=09putfield_quick_w java.lang.String@E64418/EFBD18.value <=
=3D java.lang.String@E64418/EFBD18
E64288 673C65=09aload_0 =3D> java.lang.String@E64418/EFBD18
E64288 673C66=09iload_1 =3D> 0
E64288 673C67=09putfield_quick_w java.lang.String@E64418/EFBD18.offset <=
=3D 0
E64288 673C6A=09aload_0 =3D> java.lang.String@E64418/EFBD18
E64288 673C6B=09iload_2 =3D> 13
E64288 673C6C=09putfield_quick_w java.lang.String@E64418/EFBD18.count <=
=3D 13
E64288 673C6F=09return
Leaving java.lang.String.<init>(String.java:368)
# //"W=92+=80=87W=17g=01=E6=CB=B3=FC=C9=A8=B9=B1=FC=D7=B7=FC=B1=F3=B9go256c=
haracters=92=85H=01
z}=849L=82+=80name// [ 2] | | < java/lang/String.<init>(II[C)V returning
E64288 233F3CB=09return
Leaving=20
E64288 69EAF2=09ldc1 #2 =3D> 0xe64418
E64288 69EAF4=09areturn java.lang.String@E64418/EFBD18
Leaving KanjiTrace.=E9=96=A2=E6=95=B0(KanjiTrace.java:15)
# //"W=92+=80=87W=17g=01=E6=CB=B3=FC=C9=A8=B9=B1=FC=D7=B7=FC=B1=F3=B9go256c=
haracters=92=85H=01
z}=849L=82+=80name// [ 1] | < KanjiTrace.=E9=96=A2=E6=95=B0(J)Ljava/lang/S=
tring; returning
E64288 69EB20=09putfield KanjiTrace.var5
E64288 69EB20=09putfield_quick KanjiTrace@E64288/EFB690.(#11) <=3D E64418
E64288 69EB23=09invokestatic java/lang/Runtime.getRuntime()Ljava/lang/Run=
time;
E64288 69EB23=09invokestatic_quick java/lang/Runtime.getRuntime()Ljava/la=
ng/Runtime; (0)
# //"W=92+=80=87W=17g=01=E6=CB=B3=FC=C9=A8=B9=B1=FC=D7=B7=FC=B1=F3=B9go256c=
haracters=92=85H=01
z}=849L=82+=80name// [ 1] | > java/lang/Runtime.getRuntime()Ljava/lang/Run=
time; (0) entered
Entering java.lang.Runtime.getRuntime(Runtime.java:52)
E64288 6A2E74=09getstatic_quick java/lang/Runtime.currentRuntime <=3D jav=
a.lang.Runtime@E64428/EFBCF0
E64288 6A2E77=09areturn java.lang.Runtime@E64428/EFBCF0
Leaving java.lang.Runtime.getRuntime(Runtime.java:52)
# //"W=92+=80=87W=17g=01=E6=CB=B3=FC=C9=A8=B9=B1=FC=D7=B7=FC=B1=F3=B9go256c=
haracters=92=85H=01
z}=849L=82+=80name// [ 1] | < java/lang/Runtime.getRuntime()Ljava/lang/Run=
time; returning
E64288 69EB26=09iconst_0
E64288 69EB27=09invokevirtual java/lang/Runtime.traceInstructions(Z)V
E64288 69EB27=09invokevirtual_quick java/lang/Runtime.traceInstructions(Z=
)V (2)
# //"W=92+=80=87W=17g=01=E6=CB=B3=FC=C9=A8=B9=B1=FC=D7=B7=FC=B1=F3=B9go256c=
haracters=92=85H=01
z}=849L=82+=80name// [ 1] | > java/lang/Runtime.traceInstructions(Z)V (2) =
entered
# //"W=92+=80=87W=17g=01=E6=CB=B3=FC=C9=A8=B9=B1=FC=D7=B7=FC=B1=F3=B9go256c=
haracters=92=85H=01
z}=849L=82+=80name// [ 1] | < java/lang/Runtime.traceInstructions(Z)V retu=
rning
# //"W=92+=80=87W=17g=01=E6=CB=B3=FC=C9=A8=B9=B1=FC=D7=B7=FC=B1=F3=B9go256c=
haracters=92=85H=01
z}=849L=82+=80name// [ 1] | > java/lang/Runtime.getRuntime()Ljava/lang/Run=
time; (0) entered
# //"W=92+=80=87W=17g=01=E6=CB=B3=FC=C9=A8=B9=B1=FC=D7=B7=FC=B1=F3=B9go256c=
haracters=92=85H=01
z}=849L=82+=80name// [ 1] | < java/lang/Runtime.getRuntime()Ljava/lang/Run=
time; returning
# //"W=92+=80=87W=17g=01=E6=CB=B3=FC=C9=A8=B9=B1=FC=D7=B7=FC=B1=F3=B9go256c=
haracters=92=85H=01
z}=849L=82+=80name// [ 1] | > java/lang/Runtime.traceMethodCalls(Z)V (2) e=
ntered
(Review ID: 52487)
======================================================================
- duplicates
-
JDK-4304124 Problems in the trace information.
-
- Closed
-