|
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)
+ ? new OPT_AddressConstantOperand(Address.zero())
+ : bc2ir.popAddress();
+ OPT_Operand base = bc2ir.popAddress();
+ OPT_RegisterOperand result = gc.temps.makeTemp(returnType);
+ bc2ir.appendInstruction(Load.create(getOperator(returnType, LOAD_OP),
+ result, base, offset, null));
+ bc2ir.push(result.copyD2U(), returnType);
+ }
+ break;
+ case LOADINT_OFS:
+ case LOADFLOAT_OFS:
+ case LOADADDRESS_OFS:
+ case LOADOBJECTREFERENCE_OFS:
+ case LOADWORD_OFS:
+ case LOADINT:
+ case LOADFLOAT:
+ case LOADADDRESS:
+ case LOADOBJECTREFERENCE:
+ case LOADWORD: {
+ // LOAD: Code same as cases above, as jnode does these differently, see if we need to do differently
+ OPT_Operand offset = (types.length == 0)
+ ? new OPT_AddressConstantOperand(Address.zero())
+ : bc2ir.popAddress();
+ OPT_Operand base = bc2ir.popAddress();
+ OPT_RegisterOperand result = gc.temps.makeTemp(returnType);
+ bc2ir.appendInstruction(Load.create(getOperator(returnType, LOAD_OP),
+ result, base, offset, null));
+ bc2ir.push(result.copyD2U(), returnType);
+ }
+ break;
+ case PREPAREINT_OFS:
+ case PREPAREADDRESS_OFS:
+ case PREPAREOBJECTREFERENCE_OFS:
+ case PREPAREWORD_OFS:
+ case PREPAREINT:
+ case PREPAREADDRESS:
+ case PREPAREOBJECTREFERENCE:
+ case PREPAREWORD: {
+ // PREPARE
+ OPT_Operand offset = (types.length == 0)
+ ? new OPT_AddressConstantOperand(Address.zero())
+ : bc2ir.popAddress();
+ OPT_Operand base = bc2ir.popAddress();
+ OPT_RegisterOperand result = gc.temps.makeTemp(returnType);
+ bc2ir.appendInstruction(
+ Prepare.create(getOperator(returnType, PREPARE_OP),
+ result, base, offset, null));
+ bc2ir.push(result.copyD2U(), returnType);
+ }
+ break;
+ case LOADLONG:
+ case LOADDOUBLE:
+ case LOADLONG_OFS:
+ case LOADDOUBLE_OFS: {
+ // LOAD: Code same as cases above, as jnode does these differently, see if we need to do differently
+ OPT_Operand offset = (types.length == 0)
+ ? new OPT_AddressConstantOperand(Address.zero())
+ : bc2ir.popAddress();
+ OPT_Operand base = bc2ir.popAddress();
+ OPT_RegisterOperand result = gc.temps.makeTemp(returnType);
+ bc2ir.appendInstruction(Load.create(getOperator(returnType, LOAD_OP),
+ result, base, offset, null));
+ bc2ir.push(result.copyD2U(), returnType);
+ }
+ break;
+ case STOREBYTE_OFS:
+ case STORECHAR_OFS:
+ case STORESHORT_OFS:
+ case STOREBYTE:
+ case STORECHAR:
+ case STORESHORT: {
+ // STORE: Code same as cases above, as jnode does these differently, see if we need to do differently
+ VM_TypeReference storeType = types[0];
+
+ OPT_Operand offset = (types.length == 1)
+ ? new OPT_AddressConstantOperand(Address.zero())
+ : bc2ir.popAddress();
+
+ OPT_Operand val = bc2ir.pop(storeType);
+ OPT_Operand base = bc2ir.popAddress();
+ bc2ir.appendInstruction(Store.create(getOperator(storeType, STORE_OP),
+ val, base, offset, null));
+ }
+ break;
+ case STOREINT_OFS:
+ case STOREFLOAT_OFS:
+ case STOREADDRESS_OFS:
+ case STOREOBJECTREFERENCE_OFS:
+ case STOREWORD_OFS:
+ case STOREINT:
+ case STOREFLOAT:
+ case STOREADDRESS:
+ case STOREOBJECTREFERENCE:
+ case STOREWORD: {
+ // STORE: Code same as cases above, as jnode does these differently, see if we need to do differently
+ VM_TypeReference storeType = types[0];
+
+ OPT_Operand offset = (types.length == 1)
+ ? new OPT_AddressConstantOperand(Address.zero())
+ : bc2ir.popAddress();
+
+ OPT_Operand val = bc2ir.pop(storeType);
+ OPT_Operand base = bc2ir.popAddress();
+ bc2ir.appendInstruction(Store.create(getOperator(storeType, STORE_OP),
+ val, base, offset, null));
+ }
+ break;
+ case STORELONG_OFS:
+ case STOREDOUBLE_OFS:
+ case STORELONG:
+ case STOREDOUBLE: {
+ // STORE: Code same as cases above, as jnode does these differently, see if we need to do differently
+ VM_TypeReference storeType = types[0];
+
+ OPT_Operand offset = (types.length == 1)
+ ? new OPT_AddressConstantOperand(Address.zero())
+ : bc2ir.popAddress();
+
+ OPT_Operand val = bc2ir.pop(storeType);
+ OPT_Operand base = bc2ir.popAddress();
+ bc2ir.appendInstruction(Store.create(getOperator(storeType, STORE_OP),
+ val, base, offset, null));
+ }
+ break;
+ case ATTEMPTINT_OFS:
+ case ATTEMPTADDRESS_OFS:
+ case ATTEMPTOBJECTREFERENCE_OFS:
+ case ATTEMPTWORD_OFS:
+ case ATTEMPTINT:
+ case ATTEMPTADDRESS:
+ case ATTEMPTOBJECTREFERENCE:
+ case ATTEMPTWORD: {
+ // ATTEMPT
+ VM_TypeReference attemptType = types[0];
+
+ OPT_Operand offset = (types.length == 2)
+ ? new OPT_AddressConstantOperand(Address.zero())
+ : bc2ir.popAddress();
+
+ OPT_Operand newVal = bc2ir.pop();
+ OPT_Operand oldVal = bc2ir.pop();
+ OPT_Operand base = bc2ir.popAddress();
+ OPT_RegisterOperand test = gc.temps.makeTempInt();
+ bc2ir.appendInstruction(
+ Attempt.create(getOperator(attemptType, ATTEMPT_OP), test,
+ base, offset, oldVal, newVal, null));
+ bc2ir.push(test.copyD2U(), returnType);
+ }
+ break;
+ case GETOBJECTTYPE: {
+ OPT_Operand val = bc2ir.popRef();
+ OPT_Operand guard = OPT_BC2IR.getGuard(val);
+ if (guard == null) {
+ // it's magic, so assume that it's OK....
+ guard = new OPT_TrueGuardOperand();
+ }
+ OPT_RegisterOperand tibPtr =
+ gc.temps.makeTemp(VM_TypeReference.JavaLangObjectArray);
+ bc2ir.appendInstruction(GuardedUnary.create(GET_OBJ_TIB, tibPtr,
+ val, guard));
+ OPT_RegisterOperand op0;
+ VM_TypeReference argType = val.getType();
+ if (argType.isArrayType()) {
+ op0 = gc.temps.makeTemp(VM_TypeReference.VM_Array);
+ } else {
+ if (argType == VM_TypeReference.JavaLangObject ||
+ argType == VM_TypeReference.JavaLangCloneable ||
+ argType == VM_TypeReference.JavaIoSerializable) {
+ // could be an array or a class, so make op0 be a VM_Type
+ op0 = gc.temps.makeTemp(VM_TypeReference.VM_Type);
+ } else {
+ op0 = gc.temps.makeTemp(VM_TypeReference.VM_Class);
+ }
+ }
+ bc2ir.markGuardlessNonNull(op0);
+ bc2ir.appendInstruction(Unary.create(GET_TYPE_FROM_TIB, op0,
+ tibPtr.copyD2U()));
+ bc2ir.push(op0.copyD2U());
+ }
+ break;
+ case GETTIB: {
+ OPT_Operand val = bc2ir.popRef();
+ OPT_Operand guard = OPT_BC2IR.getGuard(val);
+ if (guard == null) {
+ // it's magic, so assume that it's OK....
+ guard = new OPT_TrueGuardOperand();
+ }
+ OPT_RegisterOperand tibPtr =
+ gc.temps.makeTemp(VM_TypeReference.JavaLangObjectArray);
+ bc2ir.appendInstruction(GuardedUnary.create(GET_OBJ_TIB, tibPtr,
+ val, guard));
+ bc2ir.push(tibPtr.copyD2U(), returnType);
+ }
+ break;
+ case GETOBJECTFLAGS: {
+ OPT_Operand offset = new OPT_IntConstantOperand(ObjectLayout.FLAGS_SLOT * slotSize);
+ OPT_Operand base = bc2ir.popRef();
+ OPT_RegisterOperand result = gc.temps.makeTemp(returnType);
+ bc2ir.appendInstruction(Load.create(getOperator(returnType, LOAD_OP),
+ result, base, offset, null));
+ bc2ir.push(result.copyD2U(), returnType);
+ }
+ break;
+ case SETOBJECTFLAGS: {
+ OPT_Operand offset = new OPT_IntConstantOperand(ObjectLayout.FLAGS_SLOT * slotSize);
+ VM_TypeReference storeType = types[1];
+ OPT_Operand val = bc2ir.pop(storeType);
+ OPT_Operand base = bc2ir.popRef();
+ bc2ir.appendInstruction(Store.create(getOperator(storeType, STORE_OP),
+ val, base, offset, null));
+ }
+ break;
+ case GETARRAYDATA: {
+ OPT_Operand offset = new OPT_IntConstantOperand(VmArray.DATA_OFFSET * slotSize);
+ OPT_RegisterOperand base = bc2ir.popRef().asRegister();
+ OPT_RegisterOperand result = gc.temps.makeTemp(returnType);
+ bc2ir.appendInstruction(Binary.create(INT_ADD, result, base, offset));
+ bc2ir.push(result.copyD2U(), returnType);
+ }
+ break;
+ case GETOBJECTCOLOR: {
+ OPT_Operand offset = new OPT_IntConstantOperand(ObjectLayout.FLAGS_SLOT * slotSize);
+ OPT_Operand gcmask = new OPT_IntConstantOperand(ObjectFlags.GC_COLOUR_MASK);
+ OPT_Operand base = bc2ir.popRef();
+ OPT_RegisterOperand result = gc.temps.makeTemp(returnType);
+ bc2ir.appendInstruction(Load.create(getOperator(returnType, LOAD_OP),
+ result, base, offset, null));
+ bc2ir.appendInstruction(Binary.create(INT_AND, result.copyRO(), result.copy(), gcmask));
+ bc2ir.push(result.copy(), returnType);
+ }
+ break;
+ case ISFINALIZED: {
+ OPT_Operand offset = new OPT_IntConstantOperand(ObjectLayout.FLAGS_SLOT * slotSize);
+ OPT_Operand fmask = new OPT_IntConstantOperand(ObjectFlags.STATUS_FINALIZED);
+ OPT_Operand base = bc2ir.popRef();
+ OPT_RegisterOperand result = gc.temps.makeTemp(returnType);
+ bc2ir.appendInstruction(Load.create(INT_LOAD, result, base, offset, null));
+ bc2ir.appendInstruction(Binary.create(INT_AND, result.copyRO(), result.copy(), fmask));
+ bc2ir.push(result.copy(), returnType);
+ }
+ break;
+ case GETCURRENTFRAME: {
+ OPT_RegisterOperand result = gc.temps.makeTemp(returnType);
+ OPT_RegisterOperand ebp = new OPT_RegisterOperand(phys.getEBP(), returnType);
+ bc2ir.appendInstruction(Move.create(INT_MOVE, result, ebp));
+ bc2ir.push(result.copy(), returnType);
+ }
+ break;
+ case GETTIMESTAMP: {
+ OPT_RegisterOperand result = gc.temps.makeTemp(returnType);
+ bc2ir.appendInstruction(Call.create0(GET_TIME_BASE, result, null, null, null));
+ bc2ir.push(result.copy(), returnType);
+ }
+ break;
+ case INTBITSTOFLOAT: {
+ OPT_Operand val = bc2ir.popInt();
+ OPT_RegisterOperand op0 = gc.temps.makeTempFloat();
+ bc2ir.appendInstruction(Unary.create(INT_BITS_AS_FLOAT, op0, val));
+ bc2ir.push(op0.copyD2U());
+ }
+ break;
+ case FLOATTORAWINTBITS: {
+ OPT_Operand val = bc2ir.popFloat();
+ OPT_RegisterOperand op0 = gc.temps.makeTempInt();
+ bc2ir.appendInstruction(Unary.create(FLOAT_AS_INT_BITS, op0, val));
+ bc2ir.push(op0.copyD2U());
+ }
+ break;
+ case LONGBITSTODOUBLE: {
+ OPT_Operand val = bc2ir.popLong();
+ OPT_RegisterOperand op0 = gc.temps.makeTempDouble();
+ bc2ir.appendInstruction(Unary.create(LONG_BITS_AS_DOUBLE, op0, val));
+ bc2ir.pushDual(op0.copyD2U());
+ }
+ break;
+ case DOUBLETORAWLONGBITS: {
+ OPT_Operand val = bc2ir.popDouble();
+ OPT_RegisterOperand op0 = gc.temps.makeTempLong();
+ bc2ir.appendInstruction(Unary.create(DOUBLE_AS_LONG_BITS, op0, val));
+ bc2ir.pushDual(op0.copyD2U());
+ }
+ break;
+// case BREAKPOINT: {
+// //TODO
+// if (Vm.VerifyAssertions)
+// Vm._assert(isstatic);
+// os.writeINT(3);
+// }
+// break;
+ case CURRENTPROCESSOR: {
+ OPT_RegisterOperand result = gc.temps.makeTemp(returnType);
+ bc2ir.appendInstruction(JnodeMagic.create(JNODE_PROCESSOR, result));
+ bc2ir.push(result.copyD2U(), returnType);
+ }
+ break;
+ case GETSHAREDSTATICSFIELDADDRESS:
+ case GETISOLATEDSTATICSFIELDADDRESS: {
+ OPT_Operand idx = bc2ir.popInt();
+ OPT_RegisterOperand result = gc.temps.makeTemp(returnType);
+ bc2ir.appendInstruction(BinaryAcc.create(INT_SHL_ACC, idx.asRegister().copyRO(),
+ new OPT_IntConstantOperand(2)));
+ bc2ir.appendInstruction(BinaryAcc.create(INT_ADD_ACC, idx.asRegister().copyRO(),
+ new OPT_IntConstantOperand(VmArray.DATA_OFFSET * slotSize)));
+ if(mcode == MagicMethod.GETSHAREDSTATICSFIELDADDRESS)
+ bc2ir.appendInstruction(JnodeMagic.create(JNODE_SHARED_STATICS, result));
+ else
+ bc2ir.appendInstruction(JnodeMagic.create(JNODE_ISOLATED_STATICS, result));
+ bc2ir.appendInstruction(Binary.create(INT_ADD, result.copyRO(), result.copy(), idx.copy()));
+ //bc2ir.appendInstruction(Move.create(INT_MOVE, result.copyRO(), result.copy()));
+ //, idx.copy(), null, null));
+ bc2ir.push(result.copyD2U(), returnType);
+ }
+ break;
+ case ISRUNNINGJNODE: {
+ OPT_IntConstantOperand val = new OPT_IntConstantOperand(1);
+ OPT_RegisterOperand result = gc.temps.makeTemp(returnType);
+ bc2ir.appendInstruction(Move.create(INT_MOVE, result, val));
+ bc2ir.push(result.copyD2U(), returnType);
+ }
+ break;
+ // xyzArray classes
+ case ARR_CREATE: {
+ OPT_Instruction s = bc2ir.generateAnewarray(meth.getType().getArrayElementType());
+ bc2ir.appendInstruction(s);
+ }
+ break;
+ case ARR_GET: {
+ VM_TypeReference elementType = meth.getType().getArrayElementType();
+ OPT_Operand index = bc2ir.popInt();
+ OPT_Operand ref = bc2ir.popRef();
+ OPT_RegisterOperand offsetI = gc.temps.makeTempInt();
+ OPT_RegisterOperand offset = gc.temps.makeTempOffset();
+ OPT_RegisterOperand result = null;
+ if (meth.getType().isCodeArrayType()) {
+ if (VM.BuildForIA32) {
+ result = gc.temps.makeTemp(VM_TypeReference.Byte);
+ bc2ir.appendInstruction(Load.create(BYTE_LOAD, result, ref, index,
+ new OPT_LocationOperand(elementType),
+ new OPT_TrueGuardOperand()));
+ } else if (VM.BuildForPowerPC) {
+ result = gc.temps.makeTemp(VM_TypeReference.Int);
+ bc2ir.appendInstruction(Binary.create(INT_SHL, offsetI, index,
+ new OPT_IntConstantOperand(LOG_BYTES_IN_INT)));
+ bc2ir.appendInstruction(Unary.create(INT_2ADDRZerExt, offset, offsetI.copy()));
+ bc2ir.appendInstruction(Load.create(INT_LOAD, result, ref, offset.copy(),
+ new OPT_LocationOperand(elementType),
+ new OPT_TrueGuardOperand()));
+ }
+ } else {
+ result = gc.temps.makeTemp(elementType);
+ bc2ir.appendInstruction(Binary.create(INT_SHL, offsetI, index,
+ new OPT_IntConstantOperand(LOG_BYTES_IN_ADDRESS)));
+ bc2ir.appendInstruction(Unary.create(INT_2ADDRZerExt, offset, offsetI.copy()));
+ bc2ir.appendInstruction(Load.create(REF_LOAD, result, ref, offset.copy(),
+ new OPT_LocationOperand(elementType),
+ new OPT_TrueGuardOperand()));
+ }
+ bc2ir.push(result.copyD2U());
+ }
+ break;
+ case ARR_SET: {
+ VM_TypeReference elementType = meth.getType().getArrayElementType();
+ OPT_Operand val = bc2ir.pop();
+ OPT_Operand index = bc2ir.popInt();
+ OPT_Operand ref = bc2ir.popRef();
+ OPT_RegisterOperand offsetI = gc.temps.makeTempInt();
+ OPT_RegisterOperand offset = gc.temps.makeTempOffset();
+ if (meth.getType().isCodeArrayType()) {
+ if (VM.BuildForIA32) {
+ bc2ir.appendInstruction(Store.create(BYTE_STORE, val, ref, index,
+ new OPT_LocationOperand(elementType),
+ new OPT_TrueGuardOperand()));
+ } else if (VM.BuildForPowerPC) {
+ bc2ir.appendInstruction(Binary.create(INT_SHL, offsetI, index,
+ new OPT_IntConstantOperand(LOG_BYTES_IN_INT)));
+ bc2ir.appendInstruction(Unary.create(INT_2ADDRZerExt, offset, offsetI.copy()));
+ bc2ir.appendInstruction(Store.create(INT_STORE, val, ref, offset.copy(),
+ new OPT_LocationOperand(elementType),
+ new OPT_TrueGuardOperand()));
+ }
+ } else {
+ bc2ir.appendInstruction(Binary.create(INT_SHL, offsetI, index,
+ new OPT_IntConstantOperand(LOG_BYTES_IN_ADDRESS)));
+ bc2ir.appendInstruction(Unary.create(INT_2ADDRZerExt, offset, offsetI.copy()));
+ bc2ir.appendInstruction(Store.create(REF_STORE, val, ref, offset.copy(),
+ new OPT_LocationOperand(elementType),
+ new OPT_TrueGuardOperand()));
+ }
+ }
+ break;
+ case ARR_LENGTH: {
+ OPT_Operand op1 = bc2ir.pop();
+ bc2ir.clearCurrentGuard();
+ if (bc2ir.do_NullCheck(op1))
+ return true;
+ OPT_RegisterOperand t = gc.temps.makeTempInt();
+ OPT_Instruction s = GuardedUnary.create(ARRAYLENGTH, t, op1, bc2ir.getCurrentGuard());
+ bc2ir.push(t.copyD2U());
+ bc2ir.appendInstruction(s);
+ }
+ break;
+
+ default:
+ //We should never hit this point
+ VM._assert(false);
+ }
+ return true;
+ }
}
Modified: branches/jikesRVM/core/src/test/org/jnode/test/core/CompilerTest.java
===================================================================
--- branches/jikesRVM/core/src/test/org/jnode/test/core/CompilerTest.java 2006-12-22 09:56:52 UTC (rev 2953)
+++ branches/jikesRVM/core/src/test/org/jnode/test/core/CompilerTest.java 2006-12-22 21:17:39 UTC (rev 2954)
@@ -104,7 +104,7 @@
// "org.jnode.vm.bytecode.BytecodeParser",
// "com.ibm.JikesRVM.VM_Runtime",
// "org.jnode.test.JikesTest",
- "org.jnode.vm.classmgr.ClassDecoder$PragmaAnnotation"
+ "org.jnode.vm.classmgr.VmConstFloat"
};
public static void main(String[] args) throws Exception {
@@ -148,7 +148,7 @@
for (int i = 0; i < cnt; i++) {
final VmMethod method = type.getDeclaredMethod(i);
counts[ci]++;
- if(method.getName().contains("init"))
+// if(method.getName().contains("is"))
compile(method, arch, cs[ci], cpuId, ci + 1);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|