From 43614c1738ff8dc8e96f217d38b531ce7576c4b0 Mon Sep 17 00:00:00 2001 From: digitalgust Date: Sat, 20 Apr 2019 00:41:38 +0800 Subject: [PATCH] fix fill final static field --- binary/macos/mini_jvm | Bin 325904 -> 325904 bytes mini_jvm/jvm/class.c | 14 ++++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/binary/macos/mini_jvm b/binary/macos/mini_jvm index bad4d46df95902ce6364614dc08279f693603ebf..d48421dc39f843f8c58de15c08bb5e4e8087a666 100755 GIT binary patch delta 262 zcmbR6NqE91;SC$u1kQ`hwiXkyvYH+?@7Ch;k-Ik^VC&y4_;L*c14Eh~zkCaj2C^nh zesxGHq1>8(+ewdPo-Pl@i~k?;Z*yRA>~JwHq)#p8t<~Cby_O04nfkK5XG>dA#P_WTV5|WEcGV i|Nk%$uLI&8K#am~W(nShviJL?e^Zc_jeqI7Bi delta 262 zcmbR6NqE91;SC$u1Xw+Leff3m&8FVZnX%w}PuS)IZ2i0KUf1)7ANcISujRn;*^yt+ z#gyUY4h9AWkIvE)p4~NaZ#;TgleCx_Jh}~DTx$RS-=kMFnUR5^^#Fg%M4+(nShviJL?e^Zc_j~L2)wx diff --git a/mini_jvm/jvm/class.c b/mini_jvm/jvm/class.c index 6ab48f278..67992d3aa 100644 --- a/mini_jvm/jvm/class.c +++ b/mini_jvm/jvm/class.c @@ -290,9 +290,15 @@ void class_clinit(JClass *clazz, Runtime *runtime) { //非引用类型 switch (datatype) { case DATATYPE_BOOLEAN: - case DATATYPE_BYTE: + case DATATYPE_BYTE: { + setFieldByte(ptr, (s8) ((ConstantInteger *) fi->const_value_item)->value); + break; + } case DATATYPE_SHORT: - case DATATYPE_JCHAR: + case DATATYPE_JCHAR: { + setFieldShort(ptr, (s16) ((ConstantInteger *) fi->const_value_item)->value); + break; + } case DATATYPE_INT: { setFieldInt(ptr, ((ConstantInteger *) fi->const_value_item)->value); break; @@ -302,11 +308,11 @@ void class_clinit(JClass *clazz, Runtime *runtime) { break; } case DATATYPE_LONG: { - setFieldFloat(ptr, ((ConstantLong *) fi->const_value_item)->value); + setFieldLong(ptr, ((ConstantLong *) fi->const_value_item)->value); break; } case DATATYPE_DOUBLE: { - setFieldFloat(ptr, ((ConstantDouble *) fi->const_value_item)->value); + setFieldDouble(ptr, ((ConstantDouble *) fi->const_value_item)->value); break; } default: {