Skip to content

Commit

Permalink
fix fill final static field
Browse files Browse the repository at this point in the history
  • Loading branch information
digitalgust committed Apr 19, 2019
1 parent a42e790 commit 43614c1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Binary file modified binary/macos/mini_jvm
Binary file not shown.
14 changes: 10 additions & 4 deletions mini_jvm/jvm/class.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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: {
Expand Down

0 comments on commit 43614c1

Please sign in to comment.