harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arc...@apache.org
Subject svn commit: r366407 - in /incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm: include/ libjc/
Date Fri, 06 Jan 2006 03:34:28 GMT
Author: archie
Date: Thu Jan  5 19:34:18 2006
New Revision: 366407

URL: http://svn.apache.org/viewcvs?rev=366407&view=rev
Log:
More minor optimizations:
- Implement xload_x and xconst_x instructions directly.
- Revert r358915 (computing stack offsets so we can reference locals via
  the stack pointer). It doesn't seem to help any and slows down resolution.

Removed:
    incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/analysis.c
Modified:
    incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/include/jc_defs.h
    incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/Makefile.am
    incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/cf_parse.c
    incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/definitions.h
    incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/interp.c
    incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/libjc.h
    incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/resolve2.c
    incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/structures.h
    incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/tables.c

Modified: incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/include/jc_defs.h
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/include/jc_defs.h?rev=366407&r1=366406&r2=366407&view=diff
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/include/jc_defs.h (original)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/include/jc_defs.h Thu
Jan  5 19:34:18 2006
@@ -224,8 +224,8 @@
  ************************************************************************/
 
 struct _jc_iinc {
-	jint		local;
-	jint	  	value;
+	_jc_uint16	local;
+	jshort	  	value;
 };
 
 struct _jc_invoke {
@@ -290,7 +290,7 @@
 	_jc_lookupswitch	*lookupswitch;
 	_jc_tableswitch		*tableswitch;
 	_jc_insn		*target;
-	jint			local;
+	_jc_uint16		local;
 	_jc_value		constant;
 	_jc_string_info 	string;
 };

Modified: incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/Makefile.am
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/Makefile.am?rev=366407&r1=366406&r2=366407&view=diff
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/Makefile.am (original)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/Makefile.am Thu
Jan  5 19:34:18 2006
@@ -6,7 +6,6 @@
 
 # Standard source files
 libjc_a_SOURCES= \
-			analysis.c \
 			array.c \
 			bootstrap.c \
 			cf_parse.c \

Modified: incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/cf_parse.c
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/cf_parse.c?rev=366407&r1=366406&r2=366407&view=diff
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/cf_parse.c (original)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/cf_parse.c Thu Jan
 5 19:34:18 2006
@@ -1206,70 +1206,60 @@
 	case _JC_aload_2:
 	case _JC_aload_3:
 		insn->u.local.index = insn->opcode - _JC_aload_0;
-		insn->opcode = _JC_aload;
 		break;
 	case _JC_astore_0:
 	case _JC_astore_1:
 	case _JC_astore_2:
 	case _JC_astore_3:
 		insn->u.local.index = insn->opcode - _JC_astore_0;
-		insn->opcode = _JC_astore;
 		break;
 	case _JC_dload_0:
 	case _JC_dload_1:
 	case _JC_dload_2:
 	case _JC_dload_3:
 		insn->u.local.index = insn->opcode - _JC_dload_0;
-		insn->opcode = _JC_dload;
 		break;
 	case _JC_dstore_0:
 	case _JC_dstore_1:
 	case _JC_dstore_2:
 	case _JC_dstore_3:
 		insn->u.local.index = insn->opcode - _JC_dstore_0;
-		insn->opcode = _JC_dstore;
 		break;
 	case _JC_fload_0:
 	case _JC_fload_1:
 	case _JC_fload_2:
 	case _JC_fload_3:
 		insn->u.local.index = insn->opcode - _JC_fload_0;
-		insn->opcode = _JC_fload;
 		break;
 	case _JC_fstore_0:
 	case _JC_fstore_1:
 	case _JC_fstore_2:
 	case _JC_fstore_3:
 		insn->u.local.index = insn->opcode - _JC_fstore_0;
-		insn->opcode = _JC_fstore;
 		break;
 	case _JC_iload_0:
 	case _JC_iload_1:
 	case _JC_iload_2:
 	case _JC_iload_3:
 		insn->u.local.index = insn->opcode - _JC_iload_0;
-		insn->opcode = _JC_iload;
 		break;
 	case _JC_istore_0:
 	case _JC_istore_1:
 	case _JC_istore_2:
 	case _JC_istore_3:
 		insn->u.local.index = insn->opcode - _JC_istore_0;
-		insn->opcode = _JC_istore;
 		break;
 	case _JC_lload_0:
 	case _JC_lload_1:
 	case _JC_lload_2:
 	case _JC_lload_3:
 		insn->u.local.index = insn->opcode - _JC_lload_0;
-		insn->opcode = _JC_lload;
 		break;
 	case _JC_lstore_0:
 	case _JC_lstore_1:
 	case _JC_lstore_2:
 	case _JC_lstore_3:
 		insn->u.local.index = insn->opcode - _JC_lstore_0;
-		insn->opcode = _JC_lstore;
 		break;
 	case _JC_anewarray:
 	case _JC_checkcast:

Modified: incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/definitions.h
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/definitions.h?rev=366407&r1=366406&r2=366407&view=diff
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/definitions.h (original)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/definitions.h Thu
Jan  5 19:34:18 2006
@@ -519,9 +519,6 @@
 #define _JC_CPATH_ZIPFILE		2
 #define _JC_CPATH_ERROR			3
 
-/* Invalid bytecode stack adjustment value */
-#define _JC_STACKADJ_INVALID		0x80
-
 /*
  * Array bounds check for offset + length. Returns true if bounds are OK.
  *

Modified: incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/interp.c
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/interp.c?rev=366407&r1=366406&r2=366407&view=diff
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/interp.c (original)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/interp.c Thu Jan
 5 19:34:18 2006
@@ -77,11 +77,11 @@
 #define STACKJ(i)	(*(jlong *)(sp + (i)))
 #define STACKD(i)	(*(jdouble *)(sp + (i)))
 #define STACKL(i)	(*(_jc_object **)(sp + (i)))
-#define LOCALI(i)	(*(jint *)(sp + i))
-#define LOCALF(i)	(*(jfloat *)(sp + i))
-#define LOCALJ(i)	(*(jlong *)(sp + i))
-#define LOCALD(i)	(*(jdouble *)(sp + i))
-#define LOCALL(i)	(*(_jc_object **)(sp + i))
+#define LOCALI(i)	(*(jint *)(locals + i))
+#define LOCALF(i)	(*(jfloat *)(locals + i))
+#define LOCALJ(i)	(*(jlong *)(locals + i))
+#define LOCALD(i)	(*(jdouble *)(locals + i))
+#define LOCALL(i)	(*(_jc_object **)(locals + i))
 #define PUSHI(v)	do { STACKI(0) = (v); sp++; } while (0)
 #define PUSHF(v)	do { STACKF(0) = (v); sp++; } while (0)
 #define PUSHJ(v)	do { STACKJ(0) = (v); sp += 2; } while (0)
@@ -141,10 +141,18 @@
 		ACTION(aaload),
 		ACTION(aastore),
 		ACTION(aload),
+		ACTION(aload_0),
+		ACTION(aload_1),
+		ACTION(aload_2),
+		ACTION(aload_3),
 		ACTION(anewarray),
 		ACTION(areturn),
 		ACTION(arraylength),
 		ACTION(astore),
+		ACTION(astore_0),
+		ACTION(astore_1),
+		ACTION(astore_2),
+		ACTION(astore_3),
 		ACTION(athrow),
 		ACTION(baload),
 		ACTION(bastore),
@@ -159,20 +167,30 @@
 		ACTION(dastore),
 		ACTION(dcmpg),
 		ACTION(dcmpl),
+		ACTION(dconst_0),
+		ACTION(dconst_1),
 		ACTION(ddiv),
 		ACTION(dload),
+		ACTION(dload_0),
+		ACTION(dload_1),
+		ACTION(dload_2),
+		ACTION(dload_3),
 		ACTION(dmul),
 		ACTION(dneg),
 		ACTION(drem),
 		ACTION(dreturn),
 		ACTION(dstore),
+		ACTION(dstore_0),
+		ACTION(dstore_1),
+		ACTION(dstore_2),
+		ACTION(dstore_3),
 		ACTION(dsub),
 		ACTION(dup),
-		ACTION(dup_x1),
-		ACTION(dup_x2),
 		ACTION(dup2),
 		ACTION(dup2_x1),
 		ACTION(dup2_x2),
+		ACTION(dup_x1),
+		ACTION(dup_x2),
 		ACTION(f2d),
 		ACTION(f2i),
 		ACTION(f2l),
@@ -182,33 +200,44 @@
 		ACTION(fastore),
 		ACTION(fcmpg),
 		ACTION(fcmpl),
+		ACTION(fconst_0),
+		ACTION(fconst_1),
+		ACTION(fconst_2),
 		ACTION(fdiv),
 		ACTION(fload),
+		ACTION(fload_0),
+		ACTION(fload_1),
+		ACTION(fload_2),
+		ACTION(fload_3),
 		ACTION(fmul),
 		ACTION(fneg),
 		ACTION(frem),
 		ACTION(freturn),
 		ACTION(fstore),
+		ACTION(fstore_0),
+		ACTION(fstore_1),
+		ACTION(fstore_2),
+		ACTION(fstore_3),
 		ACTION(fsub),
-		ACTION(getfield_z),
 		ACTION(getfield_b),
 		ACTION(getfield_c),
-		ACTION(getfield_s),
+		ACTION(getfield_d),
+		ACTION(getfield_f),
 		ACTION(getfield_i),
 		ACTION(getfield_j),
-		ACTION(getfield_f),
-		ACTION(getfield_d),
 		ACTION(getfield_l),
+		ACTION(getfield_s),
+		ACTION(getfield_z),
 		ACTION(getstatic),
-		ACTION(getstatic_z),
 		ACTION(getstatic_b),
 		ACTION(getstatic_c),
-		ACTION(getstatic_s),
+		ACTION(getstatic_d),
+		ACTION(getstatic_f),
 		ACTION(getstatic_i),
 		ACTION(getstatic_j),
-		ACTION(getstatic_f),
-		ACTION(getstatic_d),
 		ACTION(getstatic_l),
+		ACTION(getstatic_s),
+		ACTION(getstatic_z),
 		ACTION(goto),
 		ACTION(i2b),
 		ACTION(i2c),
@@ -220,25 +249,36 @@
 		ACTION(iaload),
 		ACTION(iand),
 		ACTION(iastore),
+		ACTION(iconst_0),
+		ACTION(iconst_1),
+		ACTION(iconst_2),
+		ACTION(iconst_3),
+		ACTION(iconst_4),
+		ACTION(iconst_5),
+		ACTION(iconst_m1),
 		ACTION(idiv),
 		ACTION(if_acmpeq),
 		ACTION(if_acmpne),
 		ACTION(if_icmpeq),
-		ACTION(if_icmpne),
-		ACTION(if_icmplt),
 		ACTION(if_icmpge),
 		ACTION(if_icmpgt),
 		ACTION(if_icmple),
+		ACTION(if_icmplt),
+		ACTION(if_icmpne),
 		ACTION(ifeq),
-		ACTION(ifne),
-		ACTION(iflt),
 		ACTION(ifge),
 		ACTION(ifgt),
 		ACTION(ifle),
+		ACTION(iflt),
+		ACTION(ifne),
 		ACTION(ifnonnull),
 		ACTION(ifnull),
 		ACTION(iinc),
 		ACTION(iload),
+		ACTION(iload_0),
+		ACTION(iload_1),
+		ACTION(iload_2),
+		ACTION(iload_3),
 		ACTION(imul),
 		ACTION(ineg),
 		ACTION(instanceof),
@@ -253,6 +293,10 @@
 		ACTION(ishl),
 		ACTION(ishr),
 		ACTION(istore),
+		ACTION(istore_0),
+		ACTION(istore_1),
+		ACTION(istore_2),
+		ACTION(istore_3),
 		ACTION(isub),
 		ACTION(iushr),
 		ACTION(ixor),
@@ -265,11 +309,17 @@
 		ACTION(land),
 		ACTION(lastore),
 		ACTION(lcmp),
+		ACTION(lconst_0),
+		ACTION(lconst_1),
 		ACTION(ldc),
-		ACTION(ldc_string),
 		ACTION(ldc2_w),
+		ACTION(ldc_string),
 		ACTION(ldiv),
 		ACTION(lload),
+		ACTION(lload_0),
+		ACTION(lload_1),
+		ACTION(lload_2),
+		ACTION(lload_3),
 		ACTION(lmul),
 		ACTION(lneg),
 		ACTION(lookupswitch),
@@ -279,6 +329,10 @@
 		ACTION(lshl),
 		ACTION(lshr),
 		ACTION(lstore),
+		ACTION(lstore_0),
+		ACTION(lstore_1),
+		ACTION(lstore_2),
+		ACTION(lstore_3),
 		ACTION(lsub),
 		ACTION(lushr),
 		ACTION(lxor),
@@ -290,25 +344,25 @@
 		ACTION(nop),
 		ACTION(pop),
 		ACTION(pop2),
-		ACTION(putfield_z),
 		ACTION(putfield_b),
 		ACTION(putfield_c),
-		ACTION(putfield_s),
+		ACTION(putfield_d),
+		ACTION(putfield_f),
 		ACTION(putfield_i),
 		ACTION(putfield_j),
-		ACTION(putfield_f),
-		ACTION(putfield_d),
 		ACTION(putfield_l),
+		ACTION(putfield_s),
+		ACTION(putfield_z),
 		ACTION(putstatic),
-		ACTION(putstatic_z),
 		ACTION(putstatic_b),
 		ACTION(putstatic_c),
-		ACTION(putstatic_s),
+		ACTION(putstatic_d),
+		ACTION(putstatic_f),
 		ACTION(putstatic_i),
 		ACTION(putstatic_j),
-		ACTION(putstatic_f),
-		ACTION(putstatic_d),
 		ACTION(putstatic_l),
+		ACTION(putstatic_s),
+		ACTION(putstatic_z),
 		ACTION(ret),
 		ACTION(return),
 		ACTION(saload),
@@ -360,8 +414,7 @@
 
 	/* Create Java stack space */
 	locals = env->sp;
-	sp = locals + code->max_locals;
-	env->sp = sp + code->max_stack;
+	env->sp = locals + code->max_locals + code->max_stack;
 
 	/* Check Java stack overflow; release secret space during exception */
 	if (_JC_UNLIKELY(env->sp > env->stack_data_end)) {
@@ -372,7 +425,7 @@
 	/* Synchronize */
 	if (_JC_UNLIKELY(_JC_ACC_TEST(method, SYNCHRONIZED))) {
 		lock = _JC_ACC_TEST(method, STATIC) ?
-		    method->class->instance : LOCALL(-code->max_locals);
+		    method->class->instance : LOCALL(0);
 		if (_JC_UNLIKELY(_jc_lock_object(env, lock) != JNI_OK))
 			goto fail;
 	} else
@@ -394,6 +447,7 @@
 
 	/* Begin execution */
 	ticker = PERIODIC_CHECK_TICKS;
+	sp = locals + code->max_locals;
 	JUMP(code->insns);
 
 TARGET(aaload)
@@ -442,6 +496,18 @@
 TARGET(aload)
 	PUSHL(LOCALL(INFO(local)));
 	NEXT();
+TARGET(aload_0)
+	PUSHL(LOCALL(0));
+	NEXT();
+TARGET(aload_1)
+	PUSHL(LOCALL(1));
+	NEXT();
+TARGET(aload_2)
+	PUSHL(LOCALL(2));
+	NEXT();
+TARGET(aload_3)
+	PUSHL(LOCALL(3));
+	NEXT();
 TARGET(anewarray)
     {
 	_jc_array *array;
@@ -468,6 +534,22 @@
 	POP(1);
 	LOCALL(INFO(local)) = STACKL(0);
 	NEXT();
+TARGET(astore_0)
+	POP(1);
+	LOCALL(0) = STACKL(0);
+	NEXT();
+TARGET(astore_1)
+	POP(1);
+	LOCALL(1) = STACKL(0);
+	NEXT();
+TARGET(astore_2)
+	POP(1);
+	LOCALL(2) = STACKL(0);
+	NEXT();
+TARGET(astore_3)
+	POP(1);
+	LOCALL(3) = STACKL(0);
+	NEXT();
 TARGET(athrow)
 	POP(1);
 	NULLPOINTERCHECK(STACKL(0));
@@ -552,6 +634,12 @@
 	}
 	NEXT();
     }
+TARGET(dconst_0)
+	PUSHD(0);
+	NEXT();
+TARGET(dconst_1)
+	PUSHD(1);
+	NEXT();
 TARGET(d2f)
 	POP(1);
 	STACKF(-1) = STACKD(-1);
@@ -605,6 +693,18 @@
 TARGET(dload)
 	PUSHD(LOCALD(INFO(local)));
 	NEXT();
+TARGET(dload_0)
+	PUSHD(LOCALD(0));
+	NEXT();
+TARGET(dload_1)
+	PUSHD(LOCALD(1));
+	NEXT();
+TARGET(dload_2)
+	PUSHD(LOCALD(2));
+	NEXT();
+TARGET(dload_3)
+	PUSHD(LOCALD(3));
+	NEXT();
 TARGET(dmul)
 	POP(2);
 	STACKD(-2) *= STACKD(0);
@@ -623,6 +723,22 @@
 	POP(2);
 	LOCALD(INFO(local)) = STACKD(0);
 	NEXT();
+TARGET(dstore_0)
+	POP(2);
+	LOCALD(0) = STACKD(0);
+	NEXT();
+TARGET(dstore_1)
+	POP(2);
+	LOCALD(1) = STACKD(0);
+	NEXT();
+TARGET(dstore_2)
+	POP(2);
+	LOCALD(2) = STACKD(0);
+	NEXT();
+TARGET(dstore_3)
+	POP(2);
+	LOCALD(3) = STACKD(0);
+	NEXT();
 TARGET(dsub)
 	POP(2);
 	STACKD(-2) -= STACKD(0);
@@ -717,6 +833,15 @@
 	POP(1);
 	STACKI(-1) = _JC_FCMPL(STACKF(-1), STACKF(0));
 	NEXT();
+TARGET(fconst_0)
+	PUSHF(0);
+	NEXT();
+TARGET(fconst_1)
+	PUSHF(1);
+	NEXT();
+TARGET(fconst_2)
+	PUSHF(2);
+	NEXT();
 TARGET(fdiv)
 	POP(1);
 	STACKF(-1) /= STACKF(0);
@@ -724,6 +849,18 @@
 TARGET(fload)
 	PUSHF(LOCALF(INFO(local)));
 	NEXT();
+TARGET(fload_0)
+	PUSHF(LOCALF(0));
+	NEXT();
+TARGET(fload_1)
+	PUSHF(LOCALF(1));
+	NEXT();
+TARGET(fload_2)
+	PUSHF(LOCALF(2));
+	NEXT();
+TARGET(fload_3)
+	PUSHF(LOCALF(3));
+	NEXT();
 TARGET(fmul)
 	POP(1);
 	STACKF(-1) *= STACKF(0);
@@ -742,6 +879,22 @@
 	POP(1);
 	LOCALF(INFO(local)) = STACKF(0);
 	NEXT();
+TARGET(fstore_0)
+	POP(1);
+	LOCALF(0) = STACKF(0);
+	NEXT();
+TARGET(fstore_1)
+	POP(1);
+	LOCALF(1) = STACKF(0);
+	NEXT();
+TARGET(fstore_2)
+	POP(1);
+	LOCALF(2) = STACKF(0);
+	NEXT();
+TARGET(fstore_3)
+	POP(1);
+	LOCALF(3) = STACKF(0);
+	NEXT();
 TARGET(fsub)
 	POP(1);
 	STACKF(-1) -= STACKF(0);
@@ -943,6 +1096,27 @@
 	array->elems[index] = STACKI(2);
 	NEXT();
     }
+TARGET(iconst_m1)
+	PUSHI(-1);
+	NEXT();
+TARGET(iconst_0)
+	PUSHI(0);
+	NEXT();
+TARGET(iconst_1)
+	PUSHI(1);
+	NEXT();
+TARGET(iconst_2)
+	PUSHI(2);
+	NEXT();
+TARGET(iconst_3)
+	PUSHI(3);
+	NEXT();
+TARGET(iconst_4)
+	PUSHI(4);
+	NEXT();
+TARGET(iconst_5)
+	PUSHI(5);
+	NEXT();
 TARGET(idiv)
 	POP(1);
 	if (_JC_UNLIKELY(STACKI(0) == 0))
@@ -1035,6 +1209,18 @@
 TARGET(iload)
 	PUSHI(LOCALI(INFO(local)));
 	NEXT();
+TARGET(iload_0)
+	PUSHI(LOCALI(0));
+	NEXT();
+TARGET(iload_1)
+	PUSHI(LOCALI(1));
+	NEXT();
+TARGET(iload_2)
+	PUSHI(LOCALI(2));
+	NEXT();
+TARGET(iload_3)
+	PUSHI(LOCALI(3));
+	NEXT();
 TARGET(imul)
 	POP(1);
 	STACKI(-1) *= STACKI(0);
@@ -1264,6 +1450,22 @@
 	POP(1);
 	LOCALI(INFO(local)) = STACKI(0);
 	NEXT();
+TARGET(istore_0)
+	POP(1);
+	LOCALI(0) = STACKI(0);
+	NEXT();
+TARGET(istore_1)
+	POP(1);
+	LOCALI(1) = STACKI(0);
+	NEXT();
+TARGET(istore_2)
+	POP(1);
+	LOCALI(2) = STACKI(0);
+	NEXT();
+TARGET(istore_3)
+	POP(1);
+	LOCALI(3) = STACKI(0);
+	NEXT();
 TARGET(isub)
 	POP(1);
 	STACKI(-1) -= STACKI(0);
@@ -1325,6 +1527,12 @@
 	POP(3);
 	STACKI(-1) = _JC_LCMP(STACKJ(-1), STACKJ(1));
 	NEXT();
+TARGET(lconst_0)
+	PUSHJ(0);
+	NEXT();
+TARGET(lconst_1)
+	PUSHJ(1);
+	NEXT();
 TARGET(ldc)
 	*sp++ = *((_jc_word *)&INFO(constant));
 	NEXT();
@@ -1370,6 +1578,18 @@
 TARGET(lload)
 	PUSHJ(LOCALJ(INFO(local)));
 	NEXT();
+TARGET(lload_0)
+	PUSHJ(LOCALJ(0));
+	NEXT();
+TARGET(lload_1)
+	PUSHJ(LOCALJ(1));
+	NEXT();
+TARGET(lload_2)
+	PUSHJ(LOCALJ(2));
+	NEXT();
+TARGET(lload_3)
+	PUSHJ(LOCALJ(3));
+	NEXT();
 TARGET(lmul)
 	POP(2);
 	STACKJ(-2) *= STACKJ(0);
@@ -1413,6 +1633,22 @@
 TARGET(lstore)
 	POP(2);
 	LOCALJ(INFO(local)) = STACKJ(0);
+	NEXT();
+TARGET(lstore_0)
+	POP(2);
+	LOCALJ(0) = STACKJ(0);
+	NEXT();
+TARGET(lstore_1)
+	POP(2);
+	LOCALJ(1) = STACKJ(0);
+	NEXT();
+TARGET(lstore_2)
+	POP(2);
+	LOCALJ(2) = STACKJ(0);
+	NEXT();
+TARGET(lstore_3)
+	POP(2);
+	LOCALJ(3) = STACKJ(0);
 	NEXT();
 TARGET(lsub)
 	POP(2);

Modified: incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/libjc.h
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/libjc.h?rev=366407&r1=366406&r2=366407&view=diff
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/libjc.h (original)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/libjc.h Thu Jan
 5 19:34:18 2006
@@ -60,10 +60,6 @@
 #include "structures.h"
 #include "arch_libjc.h"
 
-/* analysis.c */
-extern jint		_jc_compute_stack_depth(_jc_env *env,
-				_jc_method_code *code, int *depth);
-
 /* array.c */
 extern jint		_jc_setup_array_types(_jc_env *env);
 
@@ -519,7 +515,6 @@
 extern const char	_jc_hex_chars[16];
 extern const char	*const _jc_verbose_names[_JC_VERBOSE_MAX];
 extern const char	*const _jc_bytecode_names[0x100];
-extern const signed char _jc_bytecode_stackadj[0x100];
 
 /* utf.c */
 extern jint		_jc_utf_decode(const u_char *utf,

Modified: incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/resolve2.c
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/resolve2.c?rev=366407&r1=366406&r2=366407&view=diff
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/resolve2.c (original)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/resolve2.c Thu Jan
 5 19:34:18 2006
@@ -494,7 +494,6 @@
 	_jc_cf_code code_mem;
 	_jc_cf_code *const code = &code_mem;
 	jboolean mutex_locked;
-	int *depth;
 	int i;
 
 	/* Sanity check */
@@ -629,62 +628,6 @@
 			info->constant.i = cinsn->u.immediate.value;
 			opcode = _JC_ldc;
 			break;
-		case _JC_dconst_0:
-			info->constant.d = 0.0;
-			opcode = _JC_ldc2_w;
-			break;
-		case _JC_dconst_1:
-			info->constant.d = 1.0;
-			opcode = _JC_ldc2_w;
-			break;
-		case _JC_fconst_0:
-			info->constant.f = 0.0;
-			opcode = _JC_ldc;
-			break;
-		case _JC_fconst_1:
-			info->constant.f = 1.0;
-			opcode = _JC_ldc;
-			break;
-		case _JC_fconst_2:
-			info->constant.f = 2.0;
-			opcode = _JC_ldc;
-			break;
-		case _JC_iconst_m1:
-			info->constant.i = -1;
-			opcode = _JC_ldc;
-			break;
-		case _JC_iconst_0:
-			info->constant.i = 0;
-			opcode = _JC_ldc;
-			break;
-		case _JC_iconst_1:
-			info->constant.i = 1;
-			opcode = _JC_ldc;
-			break;
-		case _JC_iconst_2:
-			info->constant.i = 2;
-			opcode = _JC_ldc;
-			break;
-		case _JC_iconst_3:
-			info->constant.i = 3;
-			opcode = _JC_ldc;
-			break;
-		case _JC_iconst_4:
-			info->constant.i = 4;
-			opcode = _JC_ldc;
-			break;
-		case _JC_iconst_5:
-			info->constant.i = 5;
-			opcode = _JC_ldc;
-			break;
-		case _JC_lconst_0:
-			info->constant.j = 0;
-			opcode = _JC_ldc2_w;
-			break;
-		case _JC_lconst_1:
-			info->constant.j = 1;
-			opcode = _JC_ldc2_w;
-			break;
 		case _JC_getfield:
 		case _JC_getstatic:
 		case _JC_putfield:
@@ -1092,56 +1035,6 @@
 
 		/* Set opcode */
 		insn->action = opcode;
-	}
-
-	/* Compute stack depth at the start of each instruction */
-	if ((depth = _JC_STACK_ALLOC(env,
-	    code->num_insns * sizeof(*depth))) == NULL)
-		goto post_fail;
-	if (_jc_compute_stack_depth(env, interp, depth) != JNI_OK)
-		goto post_fail;
-
-	/*
-	 * Change all local indicies into stack pointer offsets.
-	 * We must include any stack operations performed before
-	 * the local is referenced.
-	 */
-	for (i = 0; i < code->num_insns; i++) {
-		_jc_insn *const insn = &interp->insns[i];
-		_jc_insn_info *const info = &insn->info;
-
-		/* Handle the case of unreachable code */
-		if (depth[i] == -1) {
-			insn->action = _JC_failure;
-			continue;
-		}
-
-		/* Change local index to SP offset */
-		_JC_ASSERT(depth[i] >= 0 && depth[i] <= code->max_stack);
-		switch (insn->action) {
-		case _JC_aload:
-		case _JC_dload:
-		case _JC_fload:
-		case _JC_iload:
-		case _JC_lload:
-		case _JC_ret:
-			info->local += -code->max_locals - depth[i];
-			break;
-		case _JC_astore:
-		case _JC_fstore:
-		case _JC_istore:
-			info->local += -code->max_locals - (depth[i] - 1);
-			break;
-		case _JC_dstore:
-		case _JC_lstore:
-			info->local += -code->max_locals - (depth[i] - 2);
-			break;
-		case _JC_iinc:
-			info->iinc.local += -code->max_locals - depth[i];
-			break;
-		default:
-			break;
-		}
 	}
 
 	/* Finally, convert opcodes to interpreter jump targets */

Modified: incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/structures.h
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/structures.h?rev=366407&r1=366406&r2=366407&view=diff
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/structures.h (original)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/structures.h Thu
Jan  5 19:34:18 2006
@@ -38,7 +38,6 @@
 typedef struct _jc_class_ref _jc_class_ref;
 typedef struct _jc_classbytes _jc_classbytes;
 typedef struct _jc_cpath_entry _jc_cpath_entry;
-typedef struct _jc_depth_state	_jc_depth_state;
 typedef struct _jc_ex_info _jc_ex_info;
 typedef struct _jc_fat_lock _jc_fat_lock;
 typedef struct _jc_fat_locks _jc_fat_locks;
@@ -83,20 +82,6 @@
 	int		size;		/* number of nodes in tree */
 	_jc_splay_node	*root;		/* root of the tree */
 	_jc_splay_cmp_t	*compare;	/* item comparision function */
-};
-
-/************************************************************************
- *		    Java stack depth computation state			*
- ************************************************************************/
-
-struct _jc_depth_state {
-	int		sp;
-	int		ip;
-	_jc_method_code	*code;
-	int		*depth;
-	int		*retsp;
-	int		*locals;
-	int		*stack;
 };
 
 /************************************************************************

Modified: incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/tables.c
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/tables.c?rev=366407&r1=366406&r2=366407&view=diff
==============================================================================
--- incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/tables.c (original)
+++ incubator/harmony/enhanced/trunk/sandbox/contribs/jchevm/jchevm/libjc/tables.c Thu Jan
 5 19:34:18 2006
@@ -509,172 +509,3 @@
 	BYTECODE(tableswitch),
 	BYTECODE(wide),
 };
-#undef BYTECODE
-
-/*
- * Bytecode stack adjustments. This only contains instructions
- * that _jc_compute_stack_depth() would see.
- */
-#define BYTECODE(name, amount)						\
-	[_JC_ ## name]= ((signed char)((amount) ^ _JC_STACKADJ_INVALID))
-const signed char _jc_bytecode_stackadj[0x100] = {
-	BYTECODE(aaload, -1),
-	BYTECODE(aastore, -3),
-	BYTECODE(aload, 1),
-	BYTECODE(anewarray, 0),
-	BYTECODE(areturn, -1),
-	BYTECODE(arraylength, 0),
-	BYTECODE(astore, -1),
-	BYTECODE(athrow, -1),
-	BYTECODE(baload, -1),
-	BYTECODE(bastore, -3),
-	BYTECODE(caload, -1),
-	BYTECODE(castore, -3),
-	BYTECODE(checkcast, 0),
-	BYTECODE(d2f, -1),
-	BYTECODE(d2i, -1),
-	BYTECODE(d2l, 0),
-	BYTECODE(dadd, -2),
-	BYTECODE(daload, 0),
-	BYTECODE(dastore, -4),
-	BYTECODE(dcmpg, -3),
-	BYTECODE(dcmpl, -3),
-	BYTECODE(ddiv, -2),
-	BYTECODE(dload, 2),
-	BYTECODE(dmul, -2),
-	BYTECODE(dneg, 0),
-	BYTECODE(drem, -2),
-	BYTECODE(dreturn, -2),
-	BYTECODE(dstore, -2),
-	BYTECODE(dsub, -2),
-	BYTECODE(dup, 1),
-	BYTECODE(dup_x1, 1),
-	BYTECODE(dup_x2, 1),
-	BYTECODE(dup2, 2),
-	BYTECODE(dup2_x1, 2),
-	BYTECODE(dup2_x2, 2),
-	BYTECODE(f2d, 1),
-	BYTECODE(f2i, 0),
-	BYTECODE(f2l, 1),
-	BYTECODE(fadd, -1),
-	BYTECODE(faload, -1),
-	BYTECODE(fastore, -3),
-	BYTECODE(fcmpg, -1),
-	BYTECODE(fcmpl, -1),
-	BYTECODE(fdiv, -1),
-	BYTECODE(fload, 1),
-	BYTECODE(fmul, -1),
-	BYTECODE(fneg, 0),
-	BYTECODE(frem, -1),
-	BYTECODE(freturn, -1),
-	BYTECODE(fstore, -1),
-	BYTECODE(fsub, -1),
-	BYTECODE(getfield_z, 0),
-	BYTECODE(getfield_b, 0),
-	BYTECODE(getfield_c, 0),
-	BYTECODE(getfield_s, 0),
-	BYTECODE(getfield_i, 0),
-	BYTECODE(getfield_j, 1),
-	BYTECODE(getfield_f, 0),
-	BYTECODE(getfield_d, 1),
-	BYTECODE(getfield_l, 0),
-	/* getstatic: variable */
-	BYTECODE(goto, 0),
-	BYTECODE(i2b, 0),
-	BYTECODE(i2c, 0),
-	BYTECODE(i2d, 1),
-	BYTECODE(i2f, 0),
-	BYTECODE(i2l, 1),
-	BYTECODE(i2s, 0),
-	BYTECODE(iadd, -1),
-	BYTECODE(iaload, -1),
-	BYTECODE(iand, -1),
-	BYTECODE(iastore, -3),
-	BYTECODE(idiv, -1),
-	BYTECODE(if_acmpeq, -2),
-	BYTECODE(if_acmpne, -2),
-	BYTECODE(if_icmpeq, -2),
-	BYTECODE(if_icmpne, -2),
-	BYTECODE(if_icmplt, -2),
-	BYTECODE(if_icmpge, -2),
-	BYTECODE(if_icmpgt, -2),
-	BYTECODE(if_icmple, -2),
-	BYTECODE(ifeq, -1),
-	BYTECODE(ifne, -1),
-	BYTECODE(iflt, -1),
-	BYTECODE(ifge, -1),
-	BYTECODE(ifgt, -1),
-	BYTECODE(ifle, -1),
-	BYTECODE(ifnonnull, -1),
-	BYTECODE(ifnull, -1),
-	BYTECODE(iinc, 0),
-	BYTECODE(iload, 1),
-	BYTECODE(imul, -1),
-	BYTECODE(ineg, 0),
-	BYTECODE(instanceof, 0),
-	/* invokeinterface: variable */
-	/* invokespecial: variable */
-	/* invokestatic: variable */
-	/* invokevirtual: variable */
-	BYTECODE(ior, -1),
-	BYTECODE(irem, -1),
-	BYTECODE(ireturn, -1),
-	BYTECODE(ishl, -1),
-	BYTECODE(ishr, -1),
-	BYTECODE(istore, -1),
-	BYTECODE(isub, -1),
-	BYTECODE(iushr, -1),
-	BYTECODE(ixor, -1),
-	BYTECODE(jsr, 1),
-	BYTECODE(l2d, 0),
-	BYTECODE(l2f, -1),
-	BYTECODE(l2i, -1),
-	BYTECODE(ladd, -2),
-	BYTECODE(laload, 0),
-	BYTECODE(land, -2),
-	BYTECODE(lastore, -4),
-	BYTECODE(lcmp, -3),
-	BYTECODE(ldc, 1),
-	BYTECODE(ldc_string, 1),
-	BYTECODE(ldc2_w, 2),
-	BYTECODE(ldiv, -2),
-	BYTECODE(lload, 2),
-	BYTECODE(lmul, -2),
-	BYTECODE(lneg, 0),
-	BYTECODE(lookupswitch, -1),
-	BYTECODE(lor, -2),
-	BYTECODE(lrem, -2),
-	BYTECODE(lreturn, -2),
-	BYTECODE(lshl, -1),
-	BYTECODE(lshr, -1),
-	BYTECODE(lstore, -2),
-	BYTECODE(lsub, -2),
-	BYTECODE(lushr, -1),
-	BYTECODE(lxor, -2),
-	BYTECODE(monitorenter, -1),
-	BYTECODE(monitorexit, -1),
-	/* multianewarray: variable */
-	BYTECODE(new, 1),
-	BYTECODE(newarray, 0),
-	BYTECODE(nop, 0),
-	BYTECODE(pop, -1),
-	BYTECODE(pop2, -2),
-	BYTECODE(putfield_z, -2),
-	BYTECODE(putfield_b, -2),
-	BYTECODE(putfield_c, -2),
-	BYTECODE(putfield_s, -2),
-	BYTECODE(putfield_i, -2),
-	BYTECODE(putfield_j, -3),
-	BYTECODE(putfield_f, -2),
-	BYTECODE(putfield_d, -3),
-	BYTECODE(putfield_l, -2),
-	/* putstatic: variable */
-	BYTECODE(ret, 0),
-	BYTECODE(return, 0),
-	BYTECODE(saload, -1),
-	BYTECODE(sastore, -3),
-	BYTECODE(swap, 0),
-	BYTECODE(tableswitch, -1),
-};
-#undef BYTECODE
-



Mime
View raw message