You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by va...@apache.org on 2007/10/26 06:27:12 UTC
svn commit: r588517 - in
/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32:
Ia32GCMap.cpp Ia32GCSafePoints.cpp Ia32GCSafePoints.h
Ia32InstCodeSelector.cpp
Author: varlax
Date: Thu Oct 25 21:27:02 2007
New Revision: 588517
URL: http://svn.apache.org/viewvc?rev=588517&view=rev
Log:
Applied HARMONY-4786 [drlvm][jit][opt] EHWA crashes on em64t/server_static
Modified:
harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32GCMap.cpp
harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32GCSafePoints.cpp
harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32GCSafePoints.h
harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32InstCodeSelector.cpp
Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32GCMap.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32GCMap.cpp?rev=588517&r1=588516&r2=588517&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32GCMap.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32GCMap.cpp Thu Oct 25 21:27:02 2007
@@ -84,8 +84,6 @@
#ifdef _DEBUG
-static bool isManaged(Opnd* op) { return op->getType()->isObject() || op->getType()->isManagedPtr();}
-
static bool isUnmanagedFieldPtr(Opnd* opnd) {
if (opnd->getMemOpndKind()!=MemOpndKind_Heap) {
Log::out()<<"GCMap::isUnmanagedFieldPtr: not a heap opnd"<<std::endl;
@@ -127,10 +125,10 @@
if (op0!=opnd && op1!=opnd) {
continue;
}
- if (isManaged(op0)==isManaged(op1)) {
+ if (GCSafePointsInfo::isManaged(op0)==GCSafePointsInfo::isManaged(op1)) {
continue;
}
- Opnd* managedOpnd = isManaged(op0)?op0:op1;
+ Opnd* managedOpnd = GCSafePointsInfo::isManaged(op0)?op0:op1;
bool res = isUnmanagedFieldPtr(managedOpnd);
if (!res) {
Log::out()<<"GCMap::checkManaged2UnmanagedConv failure, managedOpnd="<<managedOpnd->getFirstId()<<std::endl;
@@ -406,7 +404,7 @@
void GCSafePoint::enumerate(GCInterface* gcInterface, const JitFrameContext* context, const StackInfo& stackInfo) const {
#ifdef ENABLE_GC_RT_CHECKS
MemoryManager mm("tmp");
- DrlVMTypeManager tm(mm);
+ TypeManager tm(mm);
#endif
//The algorithm of enumeration is
//1. Derive all offsets for MPTRs with offsets unknown during compile time.
Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32GCSafePoints.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32GCSafePoints.cpp?rev=588517&r1=588516&r2=588517&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32GCSafePoints.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32GCSafePoints.cpp Thu Oct 25 21:27:02 2007
@@ -377,68 +377,68 @@
return mode == MODE_1_FIX_BASES ? opnd : NULL;
}
-void GCSafePointsInfo::processStaticFieldMptr(Opnd* opnd, Opnd* fromOpnd, bool forceStatic) {
- StlSet<Opnd*>::iterator sit = staticMptrs.find(fromOpnd);
- if (sit==staticMptrs.end()) {
- Opnd::RuntimeInfo* info = fromOpnd->isPlacedIn(OpndKind_Imm) ? fromOpnd->getRuntimeInfo() : NULL;
- bool isStaticFieldMptr = info!=NULL && info->getKind() == Opnd::RuntimeInfo::Kind_StaticFieldAddress;
- if (!isStaticFieldMptr && !forceStatic) {
- return;
- }
- assert(isStaticFieldMptr);
- staticMptrs.insert(fromOpnd);
- }
- if (fromOpnd!=opnd) {
- staticMptrs.insert(opnd);
- }
-}
-
void GCSafePointsInfo::updateMptrInfoInPairs(GCSafePointPairs& res, Opnd* newMptr, Opnd* fromOpnd, int offset, bool fromOpndIsBase) {
+ assert(!isStaticFieldMptr(newMptr));
if (fromOpndIsBase) { //from is base
removePairByMPtrOpnd(res, newMptr);
- assert(staticMptrs.find(newMptr) == staticMptrs.end());
MPtrPair p(newMptr, getBaseAccordingMode(fromOpnd), offset);
res.push_back(p);
} else { //fromOpnd is mptr
- MPtrPair* fromPair = findPairByMPtrOpnd(res, fromOpnd);
- if (fromPair != NULL) {
- int newOffset = adjustOffsets(fromPair->offset, offset);
- //remove old pair, add new
- MPtrPair* pair = newMptr == fromOpnd ? fromPair : findPairByMPtrOpnd(res, newMptr);
- if (pair != NULL) { //reuse old pair
- pair->offset = newOffset;
- pair->base = fromPair->base;
- pair->mptr = newMptr;
- } else { // new mptr, was not used before
- MPtrPair toPair(newMptr, fromPair->base, newOffset);
- res.push_back(toPair);
- }
- } else {
- processStaticFieldMptr(newMptr, fromOpnd, true);
- dbg_point();
- }
+ MPtrPair* fromPair = findPairByMPtrOpnd(res, fromOpnd);
+ assert(fromPair != NULL);
+ int newOffset = adjustOffsets(fromPair->offset, offset);
+ //remove old pair, add new
+ MPtrPair* pair = newMptr == fromOpnd ? fromPair : findPairByMPtrOpnd(res, newMptr);
+ if (pair != NULL) { //reuse old pair
+ pair->offset = newOffset;
+ pair->base = fromPair->base;
+ pair->mptr = newMptr;
+ } else { // new mptr, was not used before
+ MPtrPair toPair(newMptr, fromPair->base, newOffset);
+ res.push_back(toPair);
+ }
+ }
+}
+
+static void add_static(Opnd* opnd, StlSet<Opnd*>& set, Opnd* cause) {
+ set.insert(opnd);
+ if (Log::isEnabled()) {
+ Log::out()<<"Registering as static opnd, firstId="<<opnd->getFirstId()<<" reason-opndid:"<<(cause?cause->getFirstId() : (uint32)-1)<<std::endl;
}
}
-static bool isStaticFieldPtrDef(Inst* inst, const StlSet<Opnd*>& staticFieldPtrs) {
+void GCSafePointsInfo::filterStaticMptrs(Inst* inst) {
if (inst->hasKind(Inst::Kind_CallInst)) {
CallInst* callInst = (CallInst*)inst;
Opnd::RuntimeInfo * rt = callInst->getRuntimeInfo();
if (rt && rt->getKind() == Opnd::RuntimeInfo::Kind_HelperAddress
- && ((VM_RT_SUPPORT)(POINTER_SIZE_INT)rt->getValue(0)
- == VM_RT_GET_STATIC_FIELD_ADDR_WITHRESOLVE))
+ && ((VM_RT_SUPPORT)(POINTER_SIZE_INT)rt->getValue(0) == VM_RT_GET_STATIC_FIELD_ADDR_WITHRESOLVE))
{
- return true;
+ Opnd* callRes = callInst->getOpnd(0);
+ add_static(callRes, staticMptrs, NULL);
}
} else if (inst->getMnemonic() == Mnemonic_MOV) {
+ Opnd* toOpnd = inst->getOpnd(0);
Opnd* fromOpnd = inst->getOpnd(1);
- if (staticFieldPtrs.find(fromOpnd)!=staticFieldPtrs.end()) {
- return true;
+ if (!isManaged(fromOpnd) && !isManaged(toOpnd)) {
+ return;
+ }
+ if (fromOpnd->isPlacedIn(OpndKind_Mem) && fromOpnd->getMemOpndKind() == MemOpndKind_Heap) {
+ //loading value from memory -> can be object only, not is a mptr to a static field
+ return;
}
- }
- return false;
-
+ if (staticMptrs.find(fromOpnd)!=staticMptrs.end()) {
+ add_static(toOpnd, staticMptrs, fromOpnd);
+ } else if (fromOpnd->isPlacedIn(OpndKind_Imm)) { //imms are compile-time known values -> can only be static
+ Opnd::RuntimeInfo* info = fromOpnd->getRuntimeInfo();
+ bool isStaticFieldMptr = info!=NULL && info->getKind() == Opnd::RuntimeInfo::Kind_StaticFieldAddress;
+ if (isStaticFieldMptr) {
+ add_static(fromOpnd, staticMptrs, NULL);
+ add_static(toOpnd, staticMptrs, fromOpnd);
+ }
+ }
+ }
}
@@ -460,12 +460,12 @@
if (!opndType->isObject() && !opndType->isManagedPtr()) {
return;
}
- if (isStaticFieldPtrDef(inst, staticMptrs)) {
+ filterStaticMptrs(inst);
+ if (isStaticFieldMptr(opnd)) {
removePairByMPtrOpnd(res, opnd);
- staticMptrs.insert(opnd);
- return;
- }
- if (mode == MODE_1_FIX_BASES) { //3 addr form
+ return; // no more analysis required
+ }
+ if (mode == MODE_1_FIX_BASES) { //3 addr form
if (opndType->isObject()) { // MODE_1_FIX_BASES -> obj & mptr types are not coalesced
StlMap<Inst*, Opnd*>::const_iterator ait;
if (!ambiguityFilters.empty() && ((ait = ambiguityFilters.find(inst))!=ambiguityFilters.end())) {
Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32GCSafePoints.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32GCSafePoints.h?rev=588517&r1=588516&r2=588517&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32GCSafePoints.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32GCSafePoints.h Thu Oct 25 21:27:02 2007
@@ -109,20 +109,23 @@
}
const StlSet<Opnd*>& getStaticFieldMptrs() const {return staticMptrs;}
+ bool isStaticFieldMptr(Opnd* opnd) const { return staticMptrs.find(opnd)!=staticMptrs.end();}
void dump(const char* stage) const;
-
+
static bool isGCSafePoint(const Inst* inst) {return IRManager::isGCSafePoint(inst);}
static bool graphHasSafePoints(const IRManager& irm);
static bool blockHasSafePoints(const Node* b);
/** if pairs!=NULL counts only gcpoints with non-empty pairs*/
static uint32 getNumSafePointsInBlock(const Node* b, const GCSafePointPairsMap* pairsMap = NULL);
static MPtrPair* findPairByMPtrOpnd(GCSafePointPairs& pairs, const Opnd* mptr);
-
+ static bool isManaged(Opnd* op) { return op->getType()->isObject() || op->getType()->isManagedPtr();}
+
private:
void _calculate();
void insertLivenessFilters();
void calculateMPtrs();
void filterLiveMPtrsOnGCSafePoints();
+ void filterStaticMptrs(Inst* inst);
void checkPairsOnNodeExits() const ;
void checkPairsOnGCSafePoints() const ;
@@ -133,7 +136,6 @@
void derivePairsOnEntry(const Node* node, GCSafePointPairs& res);
void updatePairsOnInst(Inst* inst, GCSafePointPairs& res) ;
void addAllLive(const BitSet* ls, GCSafePointPairs& res, const GCSafePointPairs& predBlockPairs) const ;
- void processStaticFieldMptr(Opnd* opnd, Opnd* from, bool forceStatic);
bool hasEqualElements(GCSafePointPairs& p1, GCSafePointPairs& p2) const {
if (p1.size()!=p2.size()) {
Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32InstCodeSelector.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32InstCodeSelector.cpp?rev=588517&r1=588516&r2=588517&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32InstCodeSelector.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32InstCodeSelector.cpp Thu Oct 25 21:27:02 2007
@@ -1748,7 +1748,7 @@
Opnd * addr=irManager.newImmOpnd(fieldRefType, Opnd::RuntimeInfo::Kind_StaticFieldAddress, fieldDesc);
#else
Opnd* immOp = irManager.newImmOpnd(fieldRefType, Opnd::RuntimeInfo::Kind_StaticFieldAddress, fieldDesc);
- Opnd* addr = irManager.newOpnd(typeManager.getUnmanagedPtrType(fieldRefType));
+ Opnd* addr = irManager.newOpnd(typeManager.getManagedPtrType(fieldRefType));
appendInsts(irManager.newCopyPseudoInst(Mnemonic_MOV, addr, immOp));
#endif
return addr;