[kaffe] CVS kaffe (hkraemer): tweak for GETSTATIC with static final
fields
Kaffe CVS
cvs-commits at kaffe.org
Fri Jul 30 07:10:14 PDT 2004
PatchSet 5030
Date: 2004/07/30 13:57:47
Author: hkraemer
Branch: HEAD
Tag: (none)
Log:
tweak for GETSTATIC with static final fields
Members:
ChangeLog:1.2588->1.2589
kaffe/kaffevm/kaffe.def:1.32->1.33
Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.2588 kaffe/ChangeLog:1.2589
--- kaffe/ChangeLog:1.2588 Fri Jul 30 11:52:25 2004
+++ kaffe/ChangeLog Fri Jul 30 13:57:47 2004
@@ -1,3 +1,8 @@
+2004-07-30 Helmer Kraemer <hkraemer at freenet.de>
+
+ * kaffe/kaffevm/kaffe.def (GETSTATIC): treat static final fields of
+ initialized classes as constants
+
2004-07-30 Guilhem Lavaux <guilhem at kaffe.org>
* libraries/java/lang/Thread.java: Reverted to original file from
Index: kaffe/kaffe/kaffevm/kaffe.def
diff -u kaffe/kaffe/kaffevm/kaffe.def:1.32 kaffe/kaffe/kaffevm/kaffe.def:1.33
--- kaffe/kaffe/kaffevm/kaffe.def:1.32 Sun Jul 25 16:33:49 2004
+++ kaffe/kaffe/kaffevm/kaffe.def Fri Jul 30 13:57:34 2004
@@ -2182,6 +2182,9 @@
softcall_initialise_class(c); \
}
+#define FIELD_IS_CONSTANT() \
+ field_class()->state==CSTATE_COMPLETE && (field_field()->accflags&ACC_FINAL)!=0
+
define_insn(GETSTATIC)
{
/*
@@ -2251,42 +2254,75 @@
getting data in the right type of register. */
else if (!FIELD_ISPRIM(field_field())) {
push(1);
- load_addr_ref(stack(0), FIELD_ADDRESS(field_field()));
+ if (FIELD_IS_CONSTANT()) {
+ move_ref_const(stack(0), *(jobject *)FIELD_ADDRESS(field_field()));
+ } else {
+ load_addr_ref(stack(0), FIELD_ADDRESS(field_field()));
+ }
}
else switch (CLASS_PRIM_SIG(FIELD_TYPE(field_field()))) {
case 'I':
push(1);
- load_addr_int(stack(0), FIELD_ADDRESS(field_field()));
+ if (FIELD_IS_CONSTANT()) {
+ move_int_const(stack(0), *(jint *)FIELD_ADDRESS(field_field()));
+ } else {
+ load_addr_int(stack(0), FIELD_ADDRESS(field_field()));
+ }
break;
case 'S':
push(1);
- load_addr_short(stack(0), FIELD_ADDRESS(field_field()));
+ if (FIELD_IS_CONSTANT()) {
+ move_int_const(stack(0), *(jint *)FIELD_ADDRESS(field_field()));
+ } else {
+ load_addr_short(stack(0), FIELD_ADDRESS(field_field()));
+ }
break;
case 'B':
case 'Z':
push(1);
- load_addr_byte(stack(0), FIELD_ADDRESS(field_field()));
+ if (FIELD_IS_CONSTANT()) {
+ move_int_const (stack(0), *(jbyte *)FIELD_ADDRESS(field_field()));
+ } else {
+ load_addr_byte(stack(0), FIELD_ADDRESS(field_field()));
+ }
break;
case 'C':
push(1);
- load_addr_char(stack(0), FIELD_ADDRESS(field_field()));
+ if (FIELD_IS_CONSTANT()) {
+ move_int_const(stack(0), *(jchar *)FIELD_ADDRESS(field_field()));
+ } else {
+ load_addr_char(stack(0), FIELD_ADDRESS(field_field()));
+ }
break;
case 'F':
push(1);
- load_addr_float(stack(0), FIELD_ADDRESS(field_field()));
+ if (FIELD_IS_CONSTANT()) {
+ move_float_const(stack(0), *(jfloat *)FIELD_ADDRESS(field_field()));
+ } else {
+ load_addr_float(stack(0), FIELD_ADDRESS(field_field()));
+ }
break;
case 'J':
push(2);
- load_addr_long(stack_long(0), FIELD_ADDRESS(field_field()));
+ if (FIELD_IS_CONSTANT()) {
+ move_long_const(stack(0), *(jlong *)FIELD_ADDRESS(field_field()));
+ } else {
+ load_addr_long(stack_long(0), FIELD_ADDRESS(field_field()));
+ }
break;
case 'D':
push(2);
- load_addr_double(stack_double(0), FIELD_ADDRESS(field_field()));
+ if (FIELD_IS_CONSTANT()) {
+ move_double_const(stack(0), *(jdouble *)FIELD_ADDRESS(field_field()));
+ } else {
+ load_addr_double(stack_double(0), FIELD_ADDRESS(field_field()));
+ }
break;
default:
ABORT();
}
}
+#undef FIELD_IS_CONSTANT
define_insn(PUTSTATIC)
{
More information about the kaffe
mailing list