|
From: <ans...@us...> - 2006-12-22 21:17:41
|
Revision: 2954
http://jnode.svn.sourceforge.net/jnode/?rev=2954&view=rev
Author: ansari82
Date: 2006-12-22 13:17:39 -0800 (Fri, 22 Dec 2006)
Log Message:
-----------
Fixed compilation of 'instanceof' bytecode in jikesopt', partial fix to float values sent/received in physical registers
Modified Paths:
--------------
branches/jikesRVM/core/src/core/com/ibm/JikesRVM/JikesRVMOptCompiler.java
branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_CallingConvention.java
branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_DynamicTypeCheckExpansion.java
branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_GenerateJnodeMagic.java
branches/jikesRVM/core/src/test/org/jnode/test/core/CompilerTest.java
Modified: branches/jikesRVM/core/src/core/com/ibm/JikesRVM/JikesRVMOptCompiler.java
===================================================================
--- branches/jikesRVM/core/src/core/com/ibm/JikesRVM/JikesRVMOptCompiler.java 2006-12-22 09:56:52 UTC (rev 2953)
+++ branches/jikesRVM/core/src/core/com/ibm/JikesRVM/JikesRVMOptCompiler.java 2006-12-22 21:17:39 UTC (rev 2954)
@@ -118,26 +118,45 @@
}
public static boolean compilableMethod(VmMethod vmMethod) {
- if (vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.A")
- || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.C")
- || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.I")
- || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.M")
- || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.N")
- || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.O")
- || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.S")
- || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.T")
- || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.VmA")
-// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.VmB") <== bad
-// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.VmCl")
-// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.VmCompiledCode")
-// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.VmCompiledEx")
-// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.VmCon")
+ if (
+// vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.A")
+// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.C")
+// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.I")
+// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.M")
+// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.N")
+// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.O")
+// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.S")
+// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.T")
+// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.VmA")
+// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.VmB")
+// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.VmClass")
+// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.VmCom")
+// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.VmConstC") //
+// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.VmConstD") //
+// vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.VmConstMember") //
+ vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.VmConstFl") //
+ && (
+ vmMethod.getName().contains("get")
+ || vmMethod.getName().startsWith("float")
+ )
+// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.VmConstI") //
// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.VmCP")
// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.VmE")
// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.VmF")
-// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.VmCP")
+// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.VmIm")
+// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.VmIns") //
+// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.VmInt")
+// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.VmIso")
+// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.VmL")
+// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.VmM")
+// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.VmN")
+// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.VmO") //
+// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.VmP")
+// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.VmR")
+// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.VmSh")
+// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.VmSp")
// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.VmSt")
- || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.VmT")
+// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.VmT")
// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.VmU")
)
Modified: branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_CallingConvention.java
===================================================================
--- branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_CallingConvention.java 2006-12-22 09:56:52 UTC (rev 2953)
+++ branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_CallingConvention.java 2006-12-22 21:17:39 UTC (rev 2954)
@@ -134,14 +134,14 @@
//non-FPU implementing processor
OPT_Instruction tmp;
if(type.isFloatType()) {
- tmp = MIR_Unary.create(IA32_ADD, new OPT_RegisterOperand(phys.getESP(), VM_TypeReference.Int), IC(-BYTES_IN_DOUBLE));
+ tmp = MIR_Unary.create(IA32_ADD, new OPT_RegisterOperand(phys.getESP(), VM_TypeReference.Int), IC(-BYTES_IN_FLOAT));
ret.insertBefore(tmp);
- tmp = MIR_Move.create(IA32_FMOV, new OPT_RegisterOperand(phys.getESP(), VM_TypeReference.Double), symb1);
+ tmp = MIR_Move.create(IA32_FSTP, new OPT_RegisterOperand(phys.getESP(), VM_TypeReference.Double), symb1);
ret.insertBefore(tmp);
tmp = MIR_Nullary.create(IA32_POP, new OPT_RegisterOperand(phys.getEAX(), VM_TypeReference.Int));
ret.insertBefore(tmp);
- tmp = MIR_Unary.create(IA32_ADD, new OPT_RegisterOperand(phys.getESP(), VM_TypeReference.Int), IC(BYTES_IN_FLOAT));
- ret.insertBefore(tmp);
+// tmp = MIR_Unary.create(IA32_ADD, new OPT_RegisterOperand(phys.getESP(), VM_TypeReference.Int), IC(BYTES_IN_FLOAT));
+// ret.insertBefore(tmp);
OPT_Register r = phys.getFirstReturnGPR();
OPT_RegisterOperand rOp= new OPT_RegisterOperand(r, type);
MIR_Return.setVal(ret, rOp.copyD2U());
@@ -149,7 +149,7 @@
else {
tmp = MIR_Unary.create(IA32_ADD, new OPT_RegisterOperand(phys.getESP(), VM_TypeReference.Int), IC(-BYTES_IN_DOUBLE));
ret.insertBefore(tmp);
- tmp = MIR_Move.create(IA32_FMOV, new OPT_RegisterOperand(phys.getESP(), VM_TypeReference.Double), symb1);
+ tmp = MIR_Move.create(IA32_FSTP, new OPT_RegisterOperand(phys.getESP(), VM_TypeReference.Double), symb1);
ret.insertBefore(tmp);
if(VM.BuildForJNode) {
tmp = MIR_Nullary.create(IA32_POP, new OPT_RegisterOperand(phys.getEAX(), VM_TypeReference.Int));
@@ -245,16 +245,16 @@
OPT_Instruction tmp;
if(result1.type.isFloatType()) {
OPT_MemoryOperand m = OPT_MemoryOperand.B(new OPT_RegisterOperand(phys.getESP(), VM_TypeReference.Int),
- (byte)8, null, null);
- tmp = MIR_Move.create(IA32_FMOV, result1, m);
+ (byte)BYTES_IN_FLOAT, null, null);
+ tmp = MIR_Move.create(IA32_FLD, result1, m);
call.insertAfter(tmp);
tmp = MIR_Nullary.create(IA32_PUSH, new OPT_RegisterOperand(phys.getEAX(), VM_TypeReference.Int));
call.insertAfter(tmp);
}
else {
OPT_MemoryOperand m = OPT_MemoryOperand.B(new OPT_RegisterOperand(phys.getESP(), VM_TypeReference.Int),
- (byte)8, null, null);
- tmp = MIR_Move.create(IA32_FMOV, result1, m);
+ (byte)BYTES_IN_DOUBLE, null, null);
+ tmp = MIR_Move.create(IA32_FLD, result1, m);
call.insertAfter(tmp);
if(VM.BuildForJNode) {
tmp = MIR_Nullary.create(IA32_PUSH, new OPT_RegisterOperand(phys.getEAX(), VM_TypeReference.Int));
Modified: branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_DynamicTypeCheckExpansion.java
===================================================================
--- branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_DynamicTypeCheckExpansion.java 2006-12-22 09:56:52 UTC (rev 2953)
+++ branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_DynamicTypeCheckExpansion.java 2006-12-22 21:17:39 UTC (rev 2954)
@@ -427,9 +427,18 @@
InsertUnary(curBlock.lastInstruction(), ir,
GET_TYPE_FROM_TIB, VM_TypeReference.VM_Type,
lhsElemTIB.copyU2U());
- OPT_RegisterOperand rhsSuperclassIds =
+ OPT_RegisterOperand rhsSuperclassIds;
+ if(VM.BuildForJNode) {
+ rhsSuperclassIds =
InsertUnary(curBlock.lastInstruction(), ir, GET_SUPERCLASS_IDS_FROM_TIB,
- VM_TypeReference.ShortArray, rhsTIB.copyD2U());
+ VM_TypeReference.IntArray, rhsTIB.copyD2U());
+ }
+ else {
+ rhsSuperclassIds =
+ InsertUnary(curBlock.lastInstruction(), ir, GET_SUPERCLASS_IDS_FROM_TIB,
+ VM_TypeReference.ShortArray, rhsTIB.copyD2U());
+
+ }
OPT_RegisterOperand lhsElemDepth =
getField(curBlock.lastInstruction(), ir, lhsElemType, VM_Entrypoints.depthField, TG());
OPT_RegisterOperand rhsSuperclassIdsLength =
@@ -445,10 +454,26 @@
curBlock.insertOut(trapBlock);
curBlock = advanceBlock(s.bcIndex, curBlock, ir);
- OPT_RegisterOperand lhsElemId =
- getField(curBlock.lastInstruction(), ir, lhsElemType.copyD2U(), VM_Entrypoints.idField, TG());
- OPT_RegisterOperand refCandidate = ir.regpool.makeTemp(VM_TypeReference.Short);
- OPT_LocationOperand loc = new OPT_LocationOperand(VM_TypeReference.Short);
+ OPT_RegisterOperand lhsElemId;
+ OPT_RegisterOperand refCandidate;
+ OPT_LocationOperand loc;
+ if(VM.BuildForJNode) {
+ lhsElemId = ir.regpool.makeTempInt();
+ OPT_RegisterOperand jtoc = ir.regpool.makeTempInt();
+ curBlock.appendInstruction(JnodeMagic.create(JNODE_SHARED_STATICS, jtoc));
+ Offset clsOffset = lhsElemType.type.peekResolvedType().getTibOffset();
+ OPT_MemoryOperand cls = OPT_MemoryOperand.BD(jtoc,
+ clsOffset, (byte)BYTES_IN_ADDRESS, new OPT_LocationOperand(lhsElemType.type), null);
+ curBlock.appendInstruction(Move.create(INT_MOVE, lhsElemId, cls));
+ refCandidate = ir.regpool.makeTemp(VM_TypeReference.Int);
+ loc = new OPT_LocationOperand(VM_TypeReference.Int);
+ }
+ else {
+ lhsElemId =
+ getField(curBlock.lastInstruction(), ir, lhsElemType.copyD2U(), VM_Entrypoints.idField, TG());
+ refCandidate = ir.regpool.makeTemp(VM_TypeReference.Short);
+ loc = new OPT_LocationOperand(VM_TypeReference.Short);
+ }
if (LOWER_ARRAY_ACCESS) {
OPT_RegisterOperand lhsDepthOffset =
InsertBinary(curBlock.lastInstruction(), ir, INT_SHL, VM_TypeReference.Int,
@@ -556,7 +581,7 @@
return continueAt;
} else {
// A resolved class (cases 5 and 6 in VM_DynamicTypeCheck)
- if (LHSclass.isFinal()) {
+ if (LHSclass.isFinal() && !VM.BuildForJNode) {
// For a final class, we can do a PTR compare of
// rhsTIB and the TIB of the class
OPT_Operand classTIB = getTIB(s, ir, LHSclass);
@@ -568,9 +593,18 @@
// Do the full blown case 5 or 6 typecheck.
int LHSDepth = LHSclass.getTypeDepth();
int LHSId = LHSclass.getId();
- OPT_RegisterOperand superclassIds =
- InsertUnary(s, ir, GET_SUPERCLASS_IDS_FROM_TIB,
- VM_TypeReference.ShortArray, RHStib);
+ OPT_RegisterOperand superclassIds;
+ if(VM.BuildForJNode) {
+ superclassIds =
+ InsertUnary(s, ir, GET_SUPERCLASS_IDS_FROM_TIB,
+ VM_TypeReference.IntArray, RHStib);
+ }
+ else {
+ superclassIds =
+ InsertUnary(s, ir, GET_SUPERCLASS_IDS_FROM_TIB,
+ VM_TypeReference.ShortArray, RHStib);
+
+ }
OPT_RegisterOperand refCandidate = null;
if(VM.BuildForJNode) {
refCandidate =
@@ -774,7 +808,7 @@
return continueAt;
} else {
// A resolved class (cases 5 and 6 in VM_DynamicTypeCheck)
- if (LHSclass.isFinal()) {
+ if (LHSclass.isFinal() && !VM.BuildForJNode) {
// For a final class, we can do a PTR compare of
// rhsTIB and the TIB of the class
OPT_Operand classTIB = getTIB(continueAt, ir, LHSclass);
@@ -788,9 +822,17 @@
// Do the full blown case 5 or 6 typecheck.
int LHSDepth = LHSclass.getTypeDepth();
int LHSId = LHSclass.getId();
- OPT_RegisterOperand superclassIds =
- InsertUnary(continueAt, ir, GET_SUPERCLASS_IDS_FROM_TIB,
- VM_TypeReference.ShortArray, RHStib);
+ OPT_RegisterOperand superclassIds;
+ if(VM.BuildForJNode) {
+ superclassIds =
+ InsertUnary(continueAt, ir, GET_SUPERCLASS_IDS_FROM_TIB,
+ VM_TypeReference.IntArray, RHStib);
+ }
+ else {
+ superclassIds =
+ InsertUnary(continueAt, ir, GET_SUPERCLASS_IDS_FROM_TIB,
+ VM_TypeReference.ShortArray, RHStib);
+ }
if (VM_DynamicTypeCheck.MIN_SUPERCLASS_IDS_SIZE <= LHSDepth) {
OPT_RegisterOperand superclassIdsLength =
InsertGuardedUnary(continueAt,
@@ -808,13 +850,40 @@
oldBlock.splitNodeWithLinksAt(lengthCheck, ir);
oldBlock.insertOut(falseBlock); // required due to splitNode!
}
- OPT_RegisterOperand refCandidate =
- InsertLoadOffset(continueAt, ir, USHORT_LOAD, VM_TypeReference.Short,
- superclassIds, Offset.fromIntZeroExtend(LHSDepth << 1),
- new OPT_LocationOperand(VM_TypeReference.Short),
- TG());
+ OPT_Operand cmpWith;
+ OPT_LocationOperand loc;
+ OPT_RegisterOperand refCandidate;
+ Offset supOffset;
+ if(VM.BuildForJNode) {
+ cmpWith = ir.regpool.makeTempInt();
+ OPT_RegisterOperand jtoc = ir.regpool.makeTempInt();
+ Offset clsOffset = LHSclass.getTibOffset();
+ supOffset = Offset.fromIntZeroExtend(LHSDepth << LOG_BYTES_IN_INT)
+ .add(VM_ObjectModel.getArrayDataOffset());
+ loc = new OPT_LocationOperand(VM_TypeReference.Int);
+ continueAt.insertBefore(JnodeMagic.create(JNODE_SHARED_STATICS, jtoc));
+ OPT_RegisterOperand cls = InsertLoadOffset(continueAt, ir, INT_LOAD, VM_TypeReference.Int,
+ jtoc, clsOffset, loc, TG());
+ continueAt.insertBefore(Move.create(INT_MOVE, cmpWith.asRegister(), cls));
+
+ refCandidate =
+ InsertLoadOffset(continueAt, ir, INT_LOAD, VM_TypeReference.Int,
+ superclassIds, supOffset,
+ new OPT_LocationOperand(VM_TypeReference.Int),
+ TG());
+ }
+ else {
+ cmpWith = IC(LHSId);
+ supOffset = Offset.fromIntZeroExtend(LHSDepth << LOG_BYTES_IN_SHORT)
+ .add(VM_ObjectModel.getArrayDataOffset());
+ refCandidate =
+ InsertLoadOffset(continueAt, ir, USHORT_LOAD, VM_TypeReference.Short,
+ superclassIds, supOffset,
+ new OPT_LocationOperand(VM_TypeReference.Short),
+ TG());
+ }
continueAt.insertBefore(IfCmp.create(INT_IFCMP, oldGuard,
- refCandidate, IC(LHSId),
+ refCandidate, cmpWith,
OPT_ConditionOperand.NOT_EQUAL(),
falseBlock.makeJumpTarget(),
falseProb));
Modified: branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_GenerateJnodeMagic.java
===================================================================
--- branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_GenerateJnodeMagic.java 2006-12-22 09:56:52 UTC (rev 2953)
+++ branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_GenerateJnodeMagic.java 2006-12-22 21:17:39 UTC (rev 2954)
@@ -1,12 +1,726 @@
package com.ibm.JikesRVM.opt.ir;
+import org.jnode.vm.classmgr.ObjectFlags;
+import org.jnode.vm.classmgr.ObjectLayout;
+import org.jnode.vm.classmgr.VmArray;
+import org.jnode.vm.compiler.BaseMagicHelper.MagicMethod;
+import org.vmmagic.unboxed.Address;
+
+import com.ibm.JikesRVM.VM;
+import com.ibm.JikesRVM.classloader.VM_Atom;
import com.ibm.JikesRVM.classloader.VM_MethodReference;
+import com.ibm.JikesRVM.classloader.VM_TypeReference;
+import com.ibm.JikesRVM.opt.OPT_MagicNotImplementedException;
class OPT_GenerateJnodeMagic extends OPT_GenerateMagic {
- static boolean generateMagic(OPT_BC2IR bc2ir,
- OPT_GenerationContext gc,
- VM_MethodReference meth) {
- return false;
- }
+ static boolean generateMagic(OPT_BC2IR bc2ir, OPT_GenerationContext gc,
+ VM_MethodReference meth) throws OPT_MagicNotImplementedException {
+
+ VM_TypeReference [] paramTypes = meth.getParameterTypes();
+ VM_TypeReference resultType = meth.getReturnType();
+ VM_TypeReference [] types = meth.getParameterTypes();
+ VM_TypeReference returnType = meth.getReturnType();
+ final VM_Atom methodName = meth.getName();
+ final OPT_PhysicalRegisterSet phys = gc.temps.getPhysicalRegisterSet();
+ final MagicMethod mcode = MagicMethod.get(meth.getResolvedMember().getJnodeMethod());
+ final int slotSize = BYTES_IN_WORD;
+
+ // Test magic permission first -- TODO
+ //testMagicPermission(mcode, caller);
+
+ switch (mcode) {
+ case ATOMICADD:
+ case ADD: {
+ OPT_Operand o2 = bc2ir.pop();
+ OPT_Operand o1 = bc2ir.pop();
+ OPT_RegisterOperand op0 = gc.temps.makeTemp(resultType);
+ if (VM.BuildFor64Addr && o2.isInt()){
+ OPT_RegisterOperand op1 = gc.temps.makeTemp(resultType);
+ bc2ir.appendInstruction(Unary.create(INT_2ADDRSigExt, op1, o2));
+ bc2ir.appendInstruction(Binary.create(REF_ADD, op0, o1, op1.copyD2U()));
+ } else {
+ bc2ir.appendInstruction(Binary.create(REF_ADD, op0, o1, o2));
+ }
+ bc2ir.push(op0.copyD2U(), resultType);
+ }
+ break;
+ case ATOMICAND:
+ case AND: {
+ OPT_Operand o2 = bc2ir.pop();
+ OPT_Operand o1 = bc2ir.pop();
+ OPT_RegisterOperand op0 = gc.temps.makeTemp(resultType);
+ bc2ir.appendInstruction(Binary.create(REF_AND, op0, o1, o2));
+ bc2ir.push(op0.copyD2U(), resultType);
+ }
+ break;
+ case ATOMICOR:
+ case OR: {
+ OPT_Operand o2 = bc2ir.pop();
+ OPT_Operand o1 = bc2ir.pop();
+ OPT_RegisterOperand op0 = gc.temps.makeTemp(resultType);
+ bc2ir.appendInstruction(Binary.create(REF_OR, op0, o1, o2));
+ bc2ir.push(op0.copyD2U(), resultType);
+ }
+ break;
+ case ATOMICSUB:
+ case SUB: {
+ OPT_Operand o2 = bc2ir.pop();
+ OPT_Operand o1 = bc2ir.pop();
+ OPT_RegisterOperand op0 = gc.temps.makeTemp(resultType);
+ if (VM.BuildFor64Addr && o2.isInt()){
+ OPT_RegisterOperand op1 = gc.temps.makeTemp(resultType);
+ bc2ir.appendInstruction(Unary.create(INT_2ADDRSigExt, op1, o2));
+ bc2ir.appendInstruction(Binary.create(REF_SUB, op0, o1, op1));
+ } else {
+ bc2ir.appendInstruction(Binary.create(REF_SUB, op0, o1, o2));
+ }
+ bc2ir.push(op0.copyD2U(), resultType);
+ }
+ break;
+ case DIFF: {
+ OPT_Operand o2 = bc2ir.pop();
+ OPT_Operand o1 = bc2ir.pop();
+ OPT_RegisterOperand op0 = gc.temps.makeTemp(resultType);
+ bc2ir.appendInstruction(Binary.create(REF_SUB, op0, o1, o2));
+ bc2ir.push(op0.copyD2U());
+ }
+ break;
+ case XOR: {
+ OPT_Operand o2 = bc2ir.pop();
+ OPT_Operand o1 = bc2ir.pop();
+ OPT_RegisterOperand op0 = gc.temps.makeTemp(resultType);
+ bc2ir.appendInstruction(Binary.create(REF_XOR, op0, o1, o2));
+ bc2ir.push(op0.copyD2U());
+ }
+ break;
+ case NOT: {
+ OPT_Operand o1 = bc2ir.pop();
+ OPT_RegisterOperand op0 = gc.temps.makeTemp(resultType);
+ bc2ir.appendInstruction(Unary.create(REF_NOT, op0, o1));
+ bc2ir.push(op0.copyD2U());
+ }
+ break;
+ case TOINT: {
+ OPT_RegisterOperand reg = gc.temps.makeTempInt();
+ bc2ir.appendInstruction(Unary.create(ADDR_2INT, reg, bc2ir.popAddress()));
+ bc2ir.push(reg.copyD2U());
+ }
+ break;
+ case TOWORD: {
+ OPT_RegisterOperand reg = gc.temps.makeTemp(VM_TypeReference.Word);
+ bc2ir.appendInstruction(Move.create(REF_MOVE, reg, bc2ir.popAddress()));
+ bc2ir.push(reg.copyD2U());
+ }
+ break;
+ case TOADDRESS: {
+ OPT_RegisterOperand reg = gc.temps.makeTemp(VM_TypeReference.Address);
+ bc2ir.appendInstruction(Move.create(REF_MOVE, reg, bc2ir.popRef()));
+ bc2ir.push(reg.copyD2U());
+ }
+ break;
+ case TOOFFSET: {
+ OPT_RegisterOperand reg = gc.temps.makeTemp(VM_TypeReference.Offset);
+ bc2ir.appendInstruction(Move.create(REF_MOVE, reg, bc2ir.popAddress()));
+ bc2ir.push(reg.copyD2U());
+ }
+ break;
+ case TOOBJECT: {
+ OPT_RegisterOperand reg
+ = gc.temps.makeTemp(VM_TypeReference.JavaLangObject);
+ bc2ir.appendInstruction(Move.create(REF_MOVE, reg, bc2ir.popRef()));
+ bc2ir.push(reg.copyD2U());
+ }
+ break;
+ case TOOBJECTREFERENCE: {
+ OPT_RegisterOperand reg
+ = gc.temps.makeTemp(VM_TypeReference.ObjectReference);
+ bc2ir.appendInstruction(Move.create(REF_MOVE, reg, bc2ir.popRef()));
+ bc2ir.push(reg.copyD2U());
+ }
+ break;
+ case TOEXTENT: {
+ OPT_RegisterOperand reg = gc.temps.makeTemp(VM_TypeReference.Extent);
+ bc2ir.appendInstruction(Move.create(REF_MOVE, reg, bc2ir.popAddress()));
+ bc2ir.push(reg.copyD2U());
+ }
+ break;
+ case TOLONG: {
+ OPT_RegisterOperand lreg = gc.temps.makeTempLong();
+ bc2ir.appendInstruction(Unary.create(ADDR_2LONG, lreg, bc2ir.popAddress()));
+ bc2ir.pushDual(lreg.copyD2U());
+ }
+ break;
+ case MAX: {
+ OPT_RegisterOperand op0 = gc.temps.makeTemp(resultType);
+ bc2ir.appendInstruction(Move.create(REF_MOVE, op0, new OPT_AddressConstantOperand(Address.max())));
+ bc2ir.push(op0.copyD2U());
+ }
+ break;
+ case ONE: {
+ OPT_RegisterOperand op0 = gc.temps.makeTemp(resultType);
+ bc2ir.appendInstruction(Move.create(REF_MOVE, op0, new OPT_AddressConstantOperand(Address.fromIntZeroExtend(1))));
+ bc2ir.push(op0.copyD2U());
+ }
+ break;
+ case ZERO:
+ case NULLREFERENCE: {
+ OPT_RegisterOperand op0 = gc.temps.makeTemp(resultType);
+ bc2ir.appendInstruction(Move.create(REF_MOVE, op0, new OPT_AddressConstantOperand(Address.zero())));
+ bc2ir.push(op0.copyD2U());
+ }
+ break;
+ case SIZE: {
+ OPT_RegisterOperand op0 = gc.temps.makeTemp(resultType);
+ bc2ir.appendInstruction(Move.create(REF_MOVE, op0, new OPT_AddressConstantOperand(Address.fromIntZeroExtend(BYTES_IN_WORD))));
+ bc2ir.push(op0.copyD2U());
+ break;
+ }
+ case ISMAX: {
+ OPT_RegisterOperand op0 = gc.temps.makeTemp(resultType);
+ bc2ir.appendInstruction(Move.create(REF_MOVE, op0, new OPT_AddressConstantOperand(Address.max())));
+ OPT_ConditionOperand cond = OPT_ConditionOperand.EQUAL();
+ cmpHelper(bc2ir,gc,cond, op0.copyRO());
+ }
+ break;
+ case ISZERO: {
+ OPT_RegisterOperand op0 = gc.temps.makeTemp(resultType);
+ bc2ir.appendInstruction(Move.create(REF_MOVE, op0, new OPT_AddressConstantOperand(Address.zero())));
+ OPT_ConditionOperand cond = OPT_ConditionOperand.EQUAL();
+ cmpHelper(bc2ir,gc,cond, op0.copyRO());
+ }
+ break;
+ case ISNULL: {
+ OPT_RegisterOperand op0 = gc.temps.makeTemp(resultType);
+ bc2ir.appendInstruction(Move.create(REF_MOVE, op0, new OPT_AddressConstantOperand(Address.zero())));
+ OPT_ConditionOperand cond = OPT_ConditionOperand.EQUAL();
+ cmpHelper(bc2ir,gc,cond,op0.copyRO());
+ }
+ break;
+ case EQUALS:
+ case EQ: {
+ OPT_ConditionOperand cond = OPT_ConditionOperand.EQUAL();
+ cmpHelper(bc2ir,gc,cond,null);
+ }
+ break;
+ case NE: {
+ OPT_ConditionOperand cond = OPT_ConditionOperand.NOT_EQUAL();
+ cmpHelper(bc2ir,gc,cond,null);
+ }
+ break;
+ case LT: {
+ OPT_ConditionOperand cond = OPT_ConditionOperand.LOWER();
+ cmpHelper(bc2ir,gc,cond,null);
+ }
+ break;
+ case LE: {
+ OPT_ConditionOperand cond = OPT_ConditionOperand.LOWER_EQUAL();
+ cmpHelper(bc2ir,gc,cond,null);
+ }
+ break;
+ case GE: {
+ OPT_ConditionOperand cond = OPT_ConditionOperand.HIGHER_EQUAL();
+ cmpHelper(bc2ir,gc,cond,null);
+ }
+ break;
+ case GT: {
+ OPT_ConditionOperand cond = OPT_ConditionOperand.HIGHER();
+ cmpHelper(bc2ir,gc,cond,null);
+ }
+ break;
+ case SLT: {
+ OPT_ConditionOperand cond = OPT_ConditionOperand.LESS();
+ cmpHelper(bc2ir,gc,cond,null);
+ }
+ break;
+ case SLE: {
+ OPT_ConditionOperand cond = OPT_ConditionOperand.LESS_EQUAL();
+ cmpHelper(bc2ir,gc,cond,null);
+ }
+ break;
+ case SGE: {
+ OPT_ConditionOperand cond = OPT_ConditionOperand.GREATER_EQUAL();
+ cmpHelper(bc2ir,gc,cond,null);
+ }
+ break;
+ case SGT: {
+ OPT_ConditionOperand cond = OPT_ConditionOperand.GREATER();
+ cmpHelper(bc2ir,gc,cond,null);
+ }
+ break;
+ case FROMINT:
+ case FROMINTSIGNEXTEND: {
+ OPT_RegisterOperand reg = gc.temps.makeTemp(resultType);
+ bc2ir.appendInstruction(Unary.create(INT_2ADDRSigExt, reg, bc2ir.popInt()));
+ bc2ir.push(reg.copyD2U());
+ }
+ break;
+ case FROMINTZEROEXTEND: {
+ OPT_RegisterOperand reg = gc.temps.makeTemp(resultType);
+ bc2ir.appendInstruction(Unary.create(INT_2ADDRZerExt, reg, bc2ir.popInt()));
+ bc2ir.push(reg.copyD2U());
+ }
+ break;
+ case FROMADDRESS:
+ case FROMOBJECT: {
+ OPT_RegisterOperand reg
+ = gc.temps.makeTemp(VM_TypeReference.ObjectReference);
+ bc2ir.appendInstruction(Move.create(REF_MOVE, reg, bc2ir.popRef()));
+ bc2ir.push(reg.copyD2U());
+ }
+ break;
+ case FROMLONG: {
+ if (VM.BuildFor64Addr) {
+ OPT_RegisterOperand reg = gc.temps.makeTemp(resultType);
+ bc2ir.appendInstruction(Unary.create(LONG_2ADDR, reg, bc2ir.popLong()));
+ bc2ir.push(reg.copyD2U());
+ } else {
+ OPT_RegisterOperand reg = gc.temps.makeTemp(resultType);
+ OPT_Operand longVal = bc2ir.popLong();
+ bc2ir.appendInstruction(Unary.create(LONG_2INT, reg, longVal));
+ bc2ir.appendInstruction(Unary.create(INT_2ADDRZerExt, reg.copyRO(), reg.copy()));
+ bc2ir.push(reg.copyD2U());
+ }
+ }
+ break;
+ case LSH: {
+ OPT_Operand op2 = bc2ir.popInt();
+ OPT_Operand op1 = bc2ir.popAddress();
+ OPT_RegisterOperand res = gc.temps.makeTemp(resultType);
+ bc2ir.appendInstruction(Binary.create(REF_SHL, res, op1, op2));
+ bc2ir.push(res.copyD2U());
+ }
+ break;
+ case RSHA: {
+ OPT_Operand op2 = bc2ir.popInt();
+ OPT_Operand op1 = bc2ir.popAddress();
+ OPT_RegisterOperand res = gc.temps.makeTemp(resultType);
+ bc2ir.appendInstruction(Binary.create(REF_SHR, res, op1, op2));
+ bc2ir.push(res.copyD2U());
+ }
+ break;
+ case RSHL: {
+ OPT_Operand op2 = bc2ir.popInt();
+ OPT_Operand op1 = bc2ir.popAddress();
+ OPT_RegisterOperand res = gc.temps.makeTemp(resultType);
+ bc2ir.appendInstruction(Binary.create(REF_USHR, res, op1, op2));
+ bc2ir.push(res.copyD2U());
+ }
+ break;
+ case LOADBYTE_OFS:
+ case LOADCHAR_OFS:
+ case LOADSHORT_OFS:
+ case LOADBYTE:
+ case LOADCHAR:
+ case LOADSHORT: {
+ // LOAD
+ OPT_Operand offset = (types.length == 0)
+ ...
[truncated message content] |
|
From: <ans...@us...> - 2007-01-17 01:13:49
|
Revision: 3084
http://jnode.svn.sourceforge.net/jnode/?rev=3084&view=rev
Author: ansari82
Date: 2007-01-16 17:13:48 -0800 (Tue, 16 Jan 2007)
Log Message:
-----------
Latest compilable list
Modified Paths:
--------------
branches/jikesRVM/core/src/classpath/vm/java/lang/ClassLoader.java
branches/jikesRVM/core/src/core/com/ibm/JikesRVM/JikesRVMOptCompiler.java
branches/jikesRVM/core/src/core/org/jnode/vm/LoadCompileService.java
branches/jikesRVM/core/src/test/org/jnode/test/JikesTest.java
Modified: branches/jikesRVM/core/src/classpath/vm/java/lang/ClassLoader.java
===================================================================
--- branches/jikesRVM/core/src/classpath/vm/java/lang/ClassLoader.java 2007-01-16 23:32:46 UTC (rev 3083)
+++ branches/jikesRVM/core/src/classpath/vm/java/lang/ClassLoader.java 2007-01-17 01:13:48 UTC (rev 3084)
@@ -288,16 +288,21 @@
}
/* Can the class been loaded by a parent? */
- try {
- if ((parent == null) || skipParentLoader(name)) {
+ if ((parent == null) || skipParentLoader(name)) {
+ try {
if (vmClassLoader.isSystemClassLoader()) {
return vmClassLoader.loadClass(name, resolve).asClass();
}
- } else {
+ } catch (ClassNotFoundException e) {
+ // e.printStackTrace();
+ }
+ }
+ else {
+ try {
return parent.loadClass(name, resolve);
+ } catch (ClassNotFoundException e) {
+ // e.printStackTrace();
}
- } catch (ClassNotFoundException e) {
- // e.printStackTrace();
}
/* Still not found, we have to do it ourself. */
final Class c = findClass(name);
Modified: branches/jikesRVM/core/src/core/com/ibm/JikesRVM/JikesRVMOptCompiler.java
===================================================================
--- branches/jikesRVM/core/src/core/com/ibm/JikesRVM/JikesRVMOptCompiler.java 2007-01-16 23:32:46 UTC (rev 3083)
+++ branches/jikesRVM/core/src/core/com/ibm/JikesRVM/JikesRVMOptCompiler.java 2007-01-17 01:13:48 UTC (rev 3084)
@@ -221,76 +221,31 @@
public static boolean compilableMethod(VmMethod vmMethod) {
if (
-// vmMethod.getDeclaringClass().getName().startsWith("java.io")
-// || vmMethod.getDeclaringClass().getName().startsWith("java.lang")
-// || vmMethod.getDeclaringClass().getName().startsWith("java.net")
-// || vmMethod.getDeclaringClass().getName().startsWith("java.nio")
-// || vmMethod.getDeclaringClass().getName().startsWith("java.security")
-// || vmMethod.getDeclaringClass().getName().startsWith("java.util")
-// || vmMethod.getDeclaringClass().getName().startsWith("javax")
-// || vmMethod.getDeclaringClass().getName().startsWith("gnu.classpath")
-// || vmMethod.getDeclaringClass().getName().startsWith("gnu.java")
-// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.assembler")
-// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.boot")
-// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.naming")
-// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.plugin")
-// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.protocol")
-// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.security")
-// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.system")
-// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.util")
-// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.bytecode")
-// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr")
-// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.compiler")
-// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.isolate")
-// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.scheduler")
-// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.x86.compiler")
+ vmMethod.getDeclaringClass().getName().startsWith("java.io")
+ || vmMethod.getDeclaringClass().getName().startsWith("java.lang")
+ || vmMethod.getDeclaringClass().getName().startsWith("java.net")
+ || vmMethod.getDeclaringClass().getName().startsWith("java.nio")
+ || vmMethod.getDeclaringClass().getName().startsWith("java.security")
+ || vmMethod.getDeclaringClass().getName().startsWith("java.util")
+ || vmMethod.getDeclaringClass().getName().startsWith("javax")
+ || vmMethod.getDeclaringClass().getName().startsWith("gnu.classpath")
+ || vmMethod.getDeclaringClass().getName().startsWith("gnu.java")
+ || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.assembler")
+ || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.boot")
+ || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.naming")
+ || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.plugin")
+ || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.protocol")
+ || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.security")
+ || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.system")
+ || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.util")
+ || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.bytecode")
+ || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr")
+ || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.compiler")
+ || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.isolate")
+ || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.scheduler")
+ || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.x86.compiler")
// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm")
-// && !(
-// vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.VmSystemClassLoader")
-// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.VmReflection")
-// && vmMethod.getName().contentEquals("invoke") //manipulates ESP, which Jikes needs to control
-// )
-
-// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.A")
-// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.B")
-// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.C")
-// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.H")
-// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.I")
-// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.J")
-// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.L")
-// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.M")
-// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.O")
-// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.R")
-// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.S")
-// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.U")
-// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.Vi")
-// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.VmA")
-// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.VmE")
-// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.VmJ")
-// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.VmM")
-// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.VmP")
-// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.VmR")
-// && !vmMethod.getName().contentEquals("invoke") //manipulates ESP, which Jikes needs to control
-// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.VmSt")
-// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.VmSystem")
- vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.VmSystemClassLoader$")
- || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.VmSystemClassLoader")
-//
- && (
- vmMethod.getName().contains("init")
- || vmMethod.getName().startsWith("a")
- || vmMethod.getName().startsWith("c")
- || vmMethod.getName().startsWith("d")
- || vmMethod.getName().startsWith("f")
- || vmMethod.getName().startsWith("g")
- || vmMethod.getName().startsWith("i")
- || vmMethod.getName().startsWith("l")
- || vmMethod.getName().startsWith("p")
- || vmMethod.getName().startsWith("r")
- || vmMethod.getName().startsWith("s")
-
- )
-
+// && !vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.VmSystemClassLoader")
)
{
return true;
@@ -301,7 +256,7 @@
public void compileBootstrap(VmMethod method, NativeStream os,
int level) {
VM_BootstrapClassLoader.fromJikesCompiler = method.getDeclaringClass().getLoader();
- System.out.println(method.getFullName());
+// System.out.println(method.getFullName());
int start = os.getLength();
final CompiledMethod cm;
final boolean abstractM = method.isAbstract();
Modified: branches/jikesRVM/core/src/core/org/jnode/vm/LoadCompileService.java
===================================================================
--- branches/jikesRVM/core/src/core/org/jnode/vm/LoadCompileService.java 2007-01-16 23:32:46 UTC (rev 3083)
+++ branches/jikesRVM/core/src/core/org/jnode/vm/LoadCompileService.java 2007-01-17 01:13:48 UTC (rev 3084)
@@ -211,7 +211,7 @@
}
if (vmMethod.getNativeCodeOptLevel() < optLevel) {
if(cmps[index] == optCompiler &&
- !(vmMethod.getDeclaringClass().getName().startsWith("org.jnode.test")
+ (!vmMethod.getDeclaringClass().getName().startsWith("org.jnode.test")
|| vmMethod.hasNoOptCompilePragma()))
cmp = fallbackCompiler;
else
Modified: branches/jikesRVM/core/src/test/org/jnode/test/JikesTest.java
===================================================================
--- branches/jikesRVM/core/src/test/org/jnode/test/JikesTest.java 2007-01-16 23:32:46 UTC (rev 3083)
+++ branches/jikesRVM/core/src/test/org/jnode/test/JikesTest.java 2007-01-17 01:13:48 UTC (rev 3084)
@@ -31,6 +31,7 @@
System.out.println("jikesAllocMultiArray expect true, return "+(jikesAllocMultiArray()[1][1]==localSTATIC?true:false));
System.out.println("jikesMonitor expect true, return "+jikesMonitor());
System.out.print( "jikesTryCatchException expect true, return ");jikesTryCatch();
+ System.out.print( "jikesComplexException expect true, return ");jikesComplexException(true);
t0 = time();System.out.print("jikestestSmallLoop:"+jikestestsmallloop()+" time:");t1 = time();System.out.println(t1 - t0);
t0 = time();System.out.print("jikestestBigLoop: "+jikestestbigloop() +" time:");t1 = time();System.out.println(t1 - t0);
sayHi2();
@@ -77,6 +78,21 @@
}
}
+ private static boolean jikesComplexException(boolean first) {
+
+ boolean local = first;
+ try{
+ if(local) {
+ jikesTryException();
+ } else {
+ jikesTryException();
+ }
+ } catch (Exception e) {
+ //Do nothing
+ }
+ return local;
+ }
+
private static boolean jikesMonitor() {
Object a = new Object();
boolean b = false;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|