void buildHashtable () { typedef std::unordered_map<KEY, VAL, HashFunc> Hashtable; Hashtable tab; VAL o1; KEY key1 (o1); VAL o2; KEY key2 (o2); VAL o3; KEY key3 (o3); tab[key1] = o1; // store copy into hashtable tab[key2] = o2; tab[key3] = o3; CHECK (!isSameObject (o1, tab[key1])); // indeed a copy... CHECK (!isSameObject (o2, tab[key2])); CHECK (!isSameObject (o3, tab[key3])); CHECK (o1.getID() == tab[key1].getID()); // but "equal" by ID CHECK (o2.getID() == tab[key2].getID()); CHECK (o3.getID() == tab[key3].getID()); CHECK (o1.getID() != tab[key2].getID()); CHECK (o1.getID() != tab[key3].getID()); CHECK (o2.getID() != tab[key3].getID()); }
static void search_item(TableIndex index, void *key_ptr, int key_len, void *info_ptr, void *arg) { LoaderInfo *info; SearchData *data; HPROF_ASSERT(info_ptr!=NULL); HPROF_ASSERT(arg!=NULL); info = (LoaderInfo*)info_ptr; data = (SearchData*)arg; if ( data->loader == info->globalref ) { /* Covers when looking for NULL too. */ HPROF_ASSERT(data->found==0); /* Did we find more than one? */ data->found = index; } else if ( data->env != NULL && data->loader != NULL && info->globalref != NULL ) { jobject lref; lref = newLocalReference(data->env, info->globalref); if ( lref == NULL ) { /* Object went away, free reference and entry */ free_entry(data->env, index); } else if ( isSameObject(data->env, data->loader, lref) ) { HPROF_ASSERT(data->found==0); /* Did we find more than one? */ data->found = index; } if ( lref != NULL ) { deleteLocalReference(data->env, lref); } } }
/* Change a RefNode to have a strong reference */ static jobject strengthenNode(JNIEnv *env, RefNode *node) { if (!node->isStrong) { jobject strongRef; strongRef = JNI_FUNC_PTR(env,NewGlobalRef)(env, node->ref); /* * NewGlobalRef on a weak ref will return NULL if the weak * reference has been collected or if out of memory. * We need to distinguish those two occurrences. */ if ((strongRef == NULL) && !isSameObject(env, node->ref, NULL)) { EXIT_ERROR(AGENT_ERROR_NULL_POINTER,"NewGlobalRef"); } if (strongRef != NULL) { JNI_FUNC_PTR(env,DeleteWeakGlobalRef)(env, node->ref); node->ref = strongRef; node->isStrong = JNI_TRUE; } return strongRef; } else { return node->ref; } }
/** @test the table of test frames * computed on demand */ void useFrameTable() { TestFrame& frX = testData(3,50); TestFrame& frY = testData(3,25); TestFrame& frZ = testData(3,50); CHECK (frX.isSane()); CHECK (frY.isSane()); CHECK (frZ.isSane()); CHECK (frX != frY); CHECK (frX == frZ); CHECK (frY != frZ); CHECK (isSameObject (frX, frZ)); corruptMemory(&frZ,40,20); CHECK (!frX.isSane()); CHECK (!testData(3,50).isSane()); CHECK ( testData(3,51).isSane()); CHECK ( testData(3,49).isSane()); resetTestFrames(); CHECK ( testData(3,50).isSane()); }
/* Get the object index for a class loader */ ObjectIndex loader_object_index(JNIEnv *env, LoaderIndex index) { LoaderInfo *info; ObjectIndex object_index; jobject wref; /* Assume no object index at first (default class loader) */ info = get_info(index); object_index = info->object_index; wref = info->globalref; if ( wref != NULL && object_index == 0 ) { jobject lref; object_index = 0; lref = newLocalReference(env, wref); if ( lref != NULL && !isSameObject(env, lref, NULL) ) { jlong tag; /* Get the tag on the object and extract the object_index */ tag = getTag(lref); if ( tag != (jlong)0 ) { object_index = tag_extract(tag); } } if ( lref != NULL ) { deleteLocalReference(env, lref); } info->object_index = object_index; } return object_index; }
/** * Determine if the specified node has a * thread filter with the thread passed in arg. * * This is a match function called by a * eventHandlerRestricted_iterator invokation. */ static jboolean matchThread(JNIEnv *env, HandlerNode *node, void *arg) { jthread goalThread = (jthread)arg; jthread reqThread = requestThread(node); /* If the event's thread and the passed thread are the same * (or both are NULL), we have a match. */ return isSameObject(env, reqThread, goalThread); }
SmpteTC& SmpteTC::operator= (SmpteTC const& o) { if (!isSameObject (*this, o)) { TCode::operator= (o); effectiveFramerate_ = o.effectiveFramerate_; sgn = o.sgn; hours = o.hours; mins = o.mins; secs = o.secs; frames = o.frames; } return *this; }
/** * Determine if the given breakpoint node is in the specified class. */ jboolean eventFilterRestricted_isBreakpointInClass(JNIEnv *env, jclass clazz, HandlerNode *node) { Filter *filter = FILTERS_ARRAY(node); int i; for (i = 0; i < FILTER_COUNT(node); ++i, ++filter) { switch (filter->modifier) { case JDWP_REQUEST_MODIFIER(LocationOnly): return isSameObject(env, clazz, filter->u.LocationOnly.clazz); } } return JNI_TRUE; /* should never come here */ }
/* * Returns the node which contains the common reference for the * given object. The passed reference should not be a weak reference * managed in the object hash table (i.e. returned by commonRef_idToRef) * because no sequence number checking is done. */ static RefNode * findNodeByRef(JNIEnv *env, jobject ref) { RefNode *node; jint slot = hashRef(ref); node = objectsByRef[slot]; while (node != NULL) { if (isSameObject(env, ref, node->ref)) { break; } node = node->nextByRef; } return node; }
/* Get rid of RefNodes for objects that no longer exist */ void commonRef_compact(void) { JNIEnv *env; RefNode *node; RefNode *prev; int i; env = getEnv(); debugMonitorEnter(gdata->refLock); { if ( gdata->objectsByIDsize > 0 ) { /* * Walk through the id-based hash table. Detach any nodes * for which the ref has been collected. */ for (i = 0; i < gdata->objectsByIDsize; i++) { node = gdata->objectsByID[i]; prev = NULL; while (node != NULL) { /* Has the object been collected? */ if ( (!node->isStrong) && isSameObject(env, node->ref, NULL)) { RefNode *freed; /* Detach from the ID list */ if (prev == NULL) { gdata->objectsByID[i] = node->next; } else { prev->next = node->next; } freed = node; node = node->next; deleteNode(env, freed); } else { prev = node; node = node->next; } } } } } debugMonitorExit(gdata->refLock); }
/** * Determine if the specified watchpoint node has the * same field as the FieldFilter passed in arg. * * This is a match function called by a * eventHandlerRestricted_iterator invokation. */ static jboolean matchWatchpoint(JNIEnv *env, HandlerNode *node, void *arg) { FieldFilter *goal = (FieldFilter *)arg; Filter *filter = FILTERS_ARRAY(node); int i; for (i = 0; i < FILTER_COUNT(node); ++i, ++filter) { switch (filter->modifier) { case JDWP_REQUEST_MODIFIER(FieldOnly): { FieldFilter *trial = &(filter->u.FieldOnly); if (trial->field == goal->field && isSameObject(env, trial->clazz, goal->clazz)) { return JNI_TRUE; } } } } return JNI_FALSE; }
/** * Determine if the specified breakpoint node is in the * same location as the LocationFilter passed in arg. * * This is a match function called by a * eventHandlerRestricted_iterator invokation. */ static jboolean matchBreakpoint(JNIEnv *env, HandlerNode *node, void *arg) { LocationFilter *goal = (LocationFilter *)arg; Filter *filter = FILTERS_ARRAY(node); int i; for (i = 0; i < FILTER_COUNT(node); ++i, ++filter) { switch (filter->modifier) { case JDWP_REQUEST_MODIFIER(LocationOnly): { LocationFilter *trial = &(filter->u.LocationOnly); if (trial->method == goal->method && trial->location == goal->location && isSameObject(env, trial->clazz, goal->clazz)) { return JNI_TRUE; } } } } return JNI_FALSE; }
/* * Returns the node stored in the object hash table for the given object * id. The id should be a value previously returned by * commonRef_refToID. */ static RefNode * findNodeByID(JNIEnv *env, jlong id) { jint slot = hashID(id); RefNode *node = objectsByID[slot]; while (node != NULL) { /* * Use this opportunity to clean up any nodes for weak * references that have been garbage collected. */ if (isSameObject(env, node->ref, NULL)) { jlong collectedID = OBJECT_ID(node); node = node->nextByID; deleteNodeByID(env, collectedID, ALL_REFS); } else if (id == OBJECT_ID(node)) { break; /* found it */ } else { node = node->nextByID; } } return node; }
/* * Get rid of RefNodes for objects that no longer exist */ void commonRef_compact(void) { JNIEnv *env = getEnv(); RefNode *node; RefNode *prev; int i; /* printRefTables(); */ debugMonitorEnter(refLock); /* * Part 1: Walk through the id-based hash table. Detach any nodes * for which the ref has been collected. Mark the node instead of * deleting it so that the second part through the ref-based hash * table can find it. */ for (i = 0; i < CR_HASH_SLOT_COUNT; i++) { node = objectsByID[i]; prev = NULL; while (node != NULL) { /* Has the object been collected? */ if (isSameObject(env, node->ref, NULL)) { /* Mark it to be freed by part 2 */ node->count = 0; /* Detach from the ID list */ if (prev == NULL) { objectsByID[i] = node->nextByID; } else { prev->nextByID = node->nextByID; } } else { prev = node; } node = node->nextByID; } } /* * Part 2: Walk through the ref-based hash table. Detach and * delete all nodes that were marked in pass 1. */ for (i = 0; i < CR_HASH_SLOT_COUNT; i++) { node = objectsByRef[i]; prev = NULL; while (node != NULL) { /* Has the object been marked? */ if (node->count == 0) { RefNode *freed = node; /* Detach from the ref list */ if (prev == NULL) { objectsByRef[i] = freed->nextByRef; } else { prev->nextByRef = freed->nextByRef; } node = node->nextByRef; deleteNode(env, freed); } else { prev = node; node = node->nextByRef; } } } debugMonitorExit(refLock); /* printRefTables(); */ }
/* * Determine if this event is interesting to this handler. * Do so by checking each of the handler's filters. * Return false if any of the filters fail, * true if the handler wants this event. * Anyone modifying this function should check * eventFilterRestricted_passesUnloadFilter and * eventFilter_predictFiltering as well. * * If shouldDelete is returned true, a count filter has expired * and the corresponding node should be deleted. */ jboolean eventFilterRestricted_passesFilter(JNIEnv *env, char *classname, EventInfo *evinfo, HandlerNode *node, jboolean *shouldDelete) { jthread thread; jclass clazz; jmethodID method; Filter *filter = FILTERS_ARRAY(node); int i; *shouldDelete = JNI_FALSE; thread = evinfo->thread; clazz = evinfo->clazz; method = evinfo->method; /* * Suppress most events if they happen in debug threads */ if ((evinfo->ei != EI_CLASS_PREPARE) && (evinfo->ei != EI_GC_FINISH) && (evinfo->ei != EI_CLASS_LOAD) && threadControl_isDebugThread(thread)) { return JNI_FALSE; } for (i = 0; i < FILTER_COUNT(node); ++i, ++filter) { switch (filter->modifier) { case JDWP_REQUEST_MODIFIER(ThreadOnly): if (!isSameObject(env, thread, filter->u.ThreadOnly.thread)) { return JNI_FALSE; } break; case JDWP_REQUEST_MODIFIER(ClassOnly): /* Class filters catch events in the specified * class and any subclass/subinterface. */ if (!JNI_FUNC_PTR(env,IsAssignableFrom)(env, clazz, filter->u.ClassOnly.clazz)) { return JNI_FALSE; } break; /* This is kinda cheating assumming the event * fields will be in the same locations, but it is * true now. */ case JDWP_REQUEST_MODIFIER(LocationOnly): if (evinfo->method != filter->u.LocationOnly.method || evinfo->location != filter->u.LocationOnly.location || !isSameObject(env, clazz, filter->u.LocationOnly.clazz)) { return JNI_FALSE; } break; case JDWP_REQUEST_MODIFIER(FieldOnly): /* Field watchpoints can be triggered from the * declared class or any subclass/subinterface. */ if ((evinfo->u.field_access.field != filter->u.FieldOnly.field) || !isSameObject(env, evinfo->u.field_access.field_clazz, filter->u.FieldOnly.clazz)) { return JNI_FALSE; } break; case JDWP_REQUEST_MODIFIER(ExceptionOnly): /* do we want caught/uncaught exceptions */ if (!((evinfo->u.exception.catch_clazz == NULL)? filter->u.ExceptionOnly.uncaught : filter->u.ExceptionOnly.caught)) { return JNI_FALSE; } /* do we care about exception class */ if (filter->u.ExceptionOnly.exception != NULL) { jclass exception = evinfo->object; /* do we want this exception class */ if (!JNI_FUNC_PTR(env,IsInstanceOf)(env, exception, filter->u.ExceptionOnly.exception)) { return JNI_FALSE; } } break; case JDWP_REQUEST_MODIFIER(InstanceOnly): { jobject eventInst = eventInstance(evinfo); jobject filterInst = filter->u.InstanceOnly.instance; /* if no error and doesn't match, don't pass * filter */ if (eventInst != NULL && !isSameObject(env, eventInst, filterInst)) { return JNI_FALSE; } break; } case JDWP_REQUEST_MODIFIER(Count): { JDI_ASSERT(filter->u.Count.count > 0); if (--filter->u.Count.count > 0) { return JNI_FALSE; } *shouldDelete = JNI_TRUE; break; } case JDWP_REQUEST_MODIFIER(Conditional): /*** if (... filter->u.Conditional.exprID ...) { return JNI_FALSE; } ***/ break; case JDWP_REQUEST_MODIFIER(ClassMatch): { if (!patternStringMatch(classname, filter->u.ClassMatch.classPattern)) { return JNI_FALSE; } break; } case JDWP_REQUEST_MODIFIER(ClassExclude): { if (patternStringMatch(classname, filter->u.ClassExclude.classPattern)) { return JNI_FALSE; } break; } case JDWP_REQUEST_MODIFIER(Step): if (!isSameObject(env, thread, filter->u.Step.thread)) { return JNI_FALSE; } if (!stepControl_handleStep(env, thread, clazz, method)) { return JNI_FALSE; } break; case JDWP_REQUEST_MODIFIER(SourceNameMatch): { char* desiredNamePattern = filter->u.SourceNameOnly.sourceNamePattern; if (!searchAllSourceNames(env, clazz, desiredNamePattern) == 1) { /* The name isn't in the SDE; try the sourceName in the ref * type */ char *sourceName = 0; jvmtiError error = JVMTI_FUNC_PTR(gdata->jvmti,GetSourceFileName) (gdata->jvmti, clazz, &sourceName); if (error == JVMTI_ERROR_NONE && sourceName != 0 && patternStringMatch(sourceName, desiredNamePattern)) { // got a hit - report the event jvmtiDeallocate(sourceName); break; } // We have no match, we have no source file name, // or we got a JVM TI error. Don't report the event. jvmtiDeallocate(sourceName); return JNI_FALSE; } break; } default: EXIT_ERROR(AGENT_ERROR_ILLEGAL_ARGUMENT,"Invalid filter modifier"); return JNI_FALSE; } } return JNI_TRUE; }
/** @test cover the basic situations of object handling, * especially copy operations and re-assignments */ void checkHandling (TestList& objs) { Opaque oo; CHECK (!oo); CHECK (isnil(oo)); oo = objs[1]; CHECK (oo); CHECK (!isnil(oo)); typedef DD<3> D3; typedef DD<5> D5; D3 d3 (oo.get<D3>() ); CHECK (3 == oo->getIt()); // re-access through Base interface CHECK (!isSameObject (d3, *oo)); VERIFY_ERROR (WRONG_TYPE, oo.get<D5>() ); // direct assignment of target into Buffer oo = D5(); CHECK (oo); CHECK (5 == oo->getIt()); VERIFY_ERROR (WRONG_TYPE, oo.get<D3>() ); // can get a direct reference to contained object D5 &rd5 (oo.get<D5>()); CHECK (isSameObject (rd5, *oo)); CHECK (!isnil(oo)); oo = objs[3]; // copy construction also works on non-empty object CHECK (7 == oo->getIt()); // WARNING: direct ref has been messed up through the backdoor! CHECK (7 == rd5.getIt()); CHECK (isSameObject (rd5, *oo)); uint cnt_before = _create_count; oo.clear(); CHECK (!oo); oo = D5(); // direct assignment also works on empty object CHECK (oo); CHECK (5 == oo->getIt()); CHECK (_create_count == 2 + cnt_before); // one within buff and one for the anonymous temporary D5() // verify that self-assignment is properly detected... cnt_before = _create_count; oo = oo; CHECK (oo); CHECK (_create_count == cnt_before); oo = oo.get<D5>(); CHECK (_create_count == cnt_before); oo = *oo; CHECK (_create_count == cnt_before); CHECK (oo); oo.clear(); CHECK (!oo); CHECK (isnil(oo)); VERIFY_ERROR (BOTTOM_VALUE, oo.get<D5>() ); #if false ///////////////////////////////////////////////////////////////////////////////////////////////TICKET #537 : restore throwing ASSERT VERIFY_ERROR (ASSERTION, oo->getIt() ); #endif ///////////////////////////////////////////////////////////////////////////////////////////////TICKET #537 : restore throwing ASSERT // can't access empty holder... Opaque o1 (oo); CHECK (!o1); Opaque o2 (d3); CHECK (!isSameObject (d3, *o2)); CHECK (3 == o2->getIt()); CHECK (sizeof(Opaque) <= sizeof(Base) + sizeof(void*) + _ALIGN_); }
/* isSameObject(generic_id, generic_id) */ bool isSameObject( CTrilinos_Universal_ID_t id1, CTrilinos_Universal_ID_t id2 ) { bool shares = false; if (id1.is_const) { switch (id1.table) { case CT_Epetra_Distributor_ID: shares = isSameObject(CEpetra::getConstDistributor(id1), id2); break; case CT_Epetra_SerialComm_ID: shares = isSameObject(CEpetra::getConstSerialComm(id1), id2); break; case CT_Epetra_BLAS_ID: shares = isSameObject(CEpetra::getConstBLAS(id1), id2); break; case CT_Epetra_Comm_ID: shares = isSameObject(CEpetra::getConstComm(id1), id2); break; case CT_Epetra_Operator_ID: shares = isSameObject(CEpetra::getConstOperator(id1), id2); break; case CT_Epetra_MultiVector_ID: shares = isSameObject(CEpetra::getConstMultiVector(id1), id2); break; case CT_Epetra_OffsetIndex_ID: shares = isSameObject(CEpetra::getConstOffsetIndex(id1), id2); break; case CT_Epetra_Object_ID: shares = isSameObject(CEpetra::getConstObject(id1), id2); break; case CT_Epetra_RowMatrix_ID: shares = isSameObject(CEpetra::getConstRowMatrix(id1), id2); break; case CT_Epetra_CompObject_ID: shares = isSameObject(CEpetra::getConstCompObject(id1), id2); break; case CT_Epetra_Directory_ID: shares = isSameObject(CEpetra::getConstDirectory(id1), id2); break; case CT_Epetra_Flops_ID: shares = isSameObject(CEpetra::getConstFlops(id1), id2); break; case CT_Epetra_SrcDistObject_ID: shares = isSameObject(CEpetra::getConstSrcDistObject(id1), id2); break; #ifdef HAVE_MPI case CT_Epetra_MpiComm_ID: shares = isSameObject(CEpetra::getConstMpiComm(id1), id2); break; #endif /* HAVE_MPI */ case CT_Epetra_CrsMatrix_ID: shares = isSameObject(CEpetra::getConstCrsMatrix(id1), id2); break; case CT_Epetra_CrsGraph_ID: shares = isSameObject(CEpetra::getConstCrsGraph(id1), id2); break; case CT_Epetra_DistObject_ID: shares = isSameObject(CEpetra::getConstDistObject(id1), id2); break; case CT_Epetra_Vector_ID: shares = isSameObject(CEpetra::getConstVector(id1), id2); break; case CT_Epetra_Export_ID: shares = isSameObject(CEpetra::getConstExport(id1), id2); break; case CT_Epetra_Map_ID: shares = isSameObject(CEpetra::getConstMap(id1), id2); break; case CT_Epetra_BlockMap_ID: shares = isSameObject(CEpetra::getConstBlockMap(id1), id2); break; case CT_Epetra_Import_ID: shares = isSameObject(CEpetra::getConstImport(id1), id2); break; case CT_Epetra_Time_ID: shares = isSameObject(CEpetra::getConstTime(id1), id2); break; case CT_Epetra_JadMatrix_ID: shares = isSameObject(CEpetra::getConstJadMatrix(id1), id2); break; case CT_Epetra_LinearProblem_ID: shares = isSameObject(CEpetra::getConstLinearProblem(id1), id2); break; case CT_Epetra_LAPACK_ID: shares = isSameObject(CEpetra::getConstLAPACK(id1), id2); break; case CT_Teuchos_CommandLineProcessor_ID: shares = isSameObject(CTeuchos::getConstCommandLineProcessor(id1), id2); break; case CT_Teuchos_ParameterList_ID: shares = isSameObject(CTeuchos::getConstParameterList(id1), id2); break; case CT_Teuchos_ParameterEntry_ID: shares = isSameObject(CTeuchos::getConstParameterEntry(id1), id2); break; case CT_Teuchos_any_ID: shares = isSameObject(CTeuchos::getConstany(id1), id2); break; #ifdef HAVE_CTRILINOS_AMESOS case CT_Amesos_BaseSolver_ID: shares = isSameObject(CAmesos::getConstBaseSolver(id1), id2); break; #endif /* HAVE_CTRILINOS_AMESOS */ #ifdef HAVE_CTRILINOS_AMESOS case CT_Amesos_ID: shares = isSameObject(CAmesos::getConstAmesos(id1), id2); break; #endif /* HAVE_CTRILINOS_AMESOS */ case CT_Epetra_FECrsMatrix_ID: shares = isSameObject(CEpetra::getConstFECrsMatrix(id1), id2); break; case CT_Epetra_IntSerialDenseVector_ID: shares = isSameObject(CEpetra::getConstIntSerialDenseVector(id1), id2); break; case CT_Epetra_SerialDenseMatrix_ID: shares = isSameObject(CEpetra::getConstSerialDenseMatrix(id1), id2); break; #ifdef HAVE_CTRILINOS_AZTECOO case CT_AztecOO_ID: shares = isSameObject(CAztecOO::getConstAztecOO(id1), id2); break; #endif /* HAVE_CTRILINOS_AZTECOO */ #ifdef HAVE_CTRILINOS_AZTECOO case CT_AztecOO_StatusTest_ID: shares = isSameObject(CAztecOO::getConstStatusTest(id1), id2); break; #endif /* HAVE_CTRILINOS_AZTECOO */ #ifdef HAVE_CTRILINOS_AZTECOO case CT_AztecOO_StatusTestCombo_ID: shares = isSameObject(CAztecOO::getConstStatusTestCombo(id1), id2); break; #endif /* HAVE_CTRILINOS_AZTECOO */ #ifdef HAVE_CTRILINOS_AZTECOO case CT_AztecOO_StatusTestMaxIters_ID: shares = isSameObject(CAztecOO::getConstStatusTestMaxIters(id1), id2); break; #endif /* HAVE_CTRILINOS_AZTECOO */ #ifdef HAVE_CTRILINOS_AZTECOO case CT_AztecOO_StatusTestResNorm_ID: shares = isSameObject(CAztecOO::getConstStatusTestResNorm(id1), id2); break; #endif /* HAVE_CTRILINOS_AZTECOO */ #ifdef HAVE_CTRILINOS_IFPACK case CT_Ifpack_ID: shares = isSameObject(CIfpack::getConstIfpack(id1), id2); break; #endif /* HAVE_CTRILINOS_IFPACK */ #ifdef HAVE_CTRILINOS_IFPACK case CT_Ifpack_Preconditioner_ID: shares = isSameObject(CIfpack::getConstPreconditioner(id1), id2); break; #endif /* HAVE_CTRILINOS_IFPACK */ case CT_Epetra_SerialDenseVector_ID: shares = isSameObject(CEpetra::getConstSerialDenseVector(id1), id2); break; #ifdef HAVE_CTRILINOS_PLIRIS #ifdef HAVE_MPI case CT_Pliris_ID: shares = isSameObject(CPliris::getConstPliris(id1), id2); break; #endif /* HAVE_MPI */ #endif /* HAVE_CTRILINOS_PLIRIS */ default: break; } } else { switch (id1.table) { case CT_Epetra_Distributor_ID: shares = isSameObject(CEpetra::getDistributor(id1), id2); break; case CT_Epetra_SerialComm_ID: shares = isSameObject(CEpetra::getSerialComm(id1), id2); break; case CT_Epetra_BLAS_ID: shares = isSameObject(CEpetra::getBLAS(id1), id2); break; case CT_Epetra_Comm_ID: shares = isSameObject(CEpetra::getComm(id1), id2); break; case CT_Epetra_Operator_ID: shares = isSameObject(CEpetra::getOperator(id1), id2); break; case CT_Epetra_MultiVector_ID: shares = isSameObject(CEpetra::getMultiVector(id1), id2); break; case CT_Epetra_OffsetIndex_ID: shares = isSameObject(CEpetra::getOffsetIndex(id1), id2); break; case CT_Epetra_Object_ID: shares = isSameObject(CEpetra::getObject(id1), id2); break; case CT_Epetra_RowMatrix_ID: shares = isSameObject(CEpetra::getRowMatrix(id1), id2); break; case CT_Epetra_CompObject_ID: shares = isSameObject(CEpetra::getCompObject(id1), id2); break; case CT_Epetra_Directory_ID: shares = isSameObject(CEpetra::getDirectory(id1), id2); break; case CT_Epetra_Flops_ID: shares = isSameObject(CEpetra::getFlops(id1), id2); break; case CT_Epetra_SrcDistObject_ID: shares = isSameObject(CEpetra::getSrcDistObject(id1), id2); break; #ifdef HAVE_MPI case CT_Epetra_MpiComm_ID: shares = isSameObject(CEpetra::getMpiComm(id1), id2); break; #endif /* HAVE_MPI */ case CT_Epetra_CrsMatrix_ID: shares = isSameObject(CEpetra::getCrsMatrix(id1), id2); break; case CT_Epetra_CrsGraph_ID: shares = isSameObject(CEpetra::getCrsGraph(id1), id2); break; case CT_Epetra_DistObject_ID: shares = isSameObject(CEpetra::getDistObject(id1), id2); break; case CT_Epetra_Vector_ID: shares = isSameObject(CEpetra::getVector(id1), id2); break; case CT_Epetra_Export_ID: shares = isSameObject(CEpetra::getExport(id1), id2); break; case CT_Epetra_Map_ID: shares = isSameObject(CEpetra::getMap(id1), id2); break; case CT_Epetra_BlockMap_ID: shares = isSameObject(CEpetra::getBlockMap(id1), id2); break; case CT_Epetra_Import_ID: shares = isSameObject(CEpetra::getImport(id1), id2); break; case CT_Epetra_Time_ID: shares = isSameObject(CEpetra::getTime(id1), id2); break; case CT_Epetra_JadMatrix_ID: shares = isSameObject(CEpetra::getJadMatrix(id1), id2); break; case CT_Epetra_LinearProblem_ID: shares = isSameObject(CEpetra::getLinearProblem(id1), id2); break; case CT_Epetra_LAPACK_ID: shares = isSameObject(CEpetra::getLAPACK(id1), id2); break; case CT_Teuchos_CommandLineProcessor_ID: shares = isSameObject(CTeuchos::getCommandLineProcessor(id1), id2); break; case CT_Teuchos_ParameterList_ID: shares = isSameObject(CTeuchos::getParameterList(id1), id2); break; case CT_Teuchos_ParameterEntry_ID: shares = isSameObject(CTeuchos::getParameterEntry(id1), id2); break; case CT_Teuchos_any_ID: shares = isSameObject(CTeuchos::getany(id1), id2); break; #ifdef HAVE_CTRILINOS_AMESOS case CT_Amesos_BaseSolver_ID: shares = isSameObject(CAmesos::getBaseSolver(id1), id2); break; #endif /* HAVE_CTRILINOS_AMESOS */ #ifdef HAVE_CTRILINOS_AMESOS case CT_Amesos_ID: shares = isSameObject(CAmesos::getAmesos(id1), id2); break; #endif /* HAVE_CTRILINOS_AMESOS */ case CT_Epetra_FECrsMatrix_ID: shares = isSameObject(CEpetra::getFECrsMatrix(id1), id2); break; case CT_Epetra_IntSerialDenseVector_ID: shares = isSameObject(CEpetra::getIntSerialDenseVector(id1), id2); break; case CT_Epetra_SerialDenseMatrix_ID: shares = isSameObject(CEpetra::getSerialDenseMatrix(id1), id2); break; #ifdef HAVE_CTRILINOS_AZTECOO case CT_AztecOO_ID: shares = isSameObject(CAztecOO::getAztecOO(id1), id2); break; #endif /* HAVE_CTRILINOS_AZTECOO */ #ifdef HAVE_CTRILINOS_AZTECOO case CT_AztecOO_StatusTest_ID: shares = isSameObject(CAztecOO::getStatusTest(id1), id2); break; #endif /* HAVE_CTRILINOS_AZTECOO */ #ifdef HAVE_CTRILINOS_AZTECOO case CT_AztecOO_StatusTestCombo_ID: shares = isSameObject(CAztecOO::getStatusTestCombo(id1), id2); break; #endif /* HAVE_CTRILINOS_AZTECOO */ #ifdef HAVE_CTRILINOS_AZTECOO case CT_AztecOO_StatusTestMaxIters_ID: shares = isSameObject(CAztecOO::getStatusTestMaxIters(id1), id2); break; #endif /* HAVE_CTRILINOS_AZTECOO */ #ifdef HAVE_CTRILINOS_AZTECOO case CT_AztecOO_StatusTestResNorm_ID: shares = isSameObject(CAztecOO::getStatusTestResNorm(id1), id2); break; #endif /* HAVE_CTRILINOS_AZTECOO */ #ifdef HAVE_CTRILINOS_IFPACK case CT_Ifpack_ID: shares = isSameObject(CIfpack::getIfpack(id1), id2); break; #endif /* HAVE_CTRILINOS_IFPACK */ #ifdef HAVE_CTRILINOS_IFPACK case CT_Ifpack_Preconditioner_ID: shares = isSameObject(CIfpack::getPreconditioner(id1), id2); break; #endif /* HAVE_CTRILINOS_IFPACK */ case CT_Epetra_SerialDenseVector_ID: shares = isSameObject(CEpetra::getSerialDenseVector(id1), id2); break; #ifdef HAVE_CTRILINOS_PLIRIS #ifdef HAVE_MPI case CT_Pliris_ID: shares = isSameObject(CPliris::getPliris(id1), id2); break; #endif /* HAVE_MPI */ #endif /* HAVE_CTRILINOS_PLIRIS */ default: break; } } return shares; }
/* * Determine the component class by looking thru all classes for * one that has the signature of the component and the same class loadeer * as the array. See JVM spec 5.3.3: * If the component type is a reference type, C is marked as having * been defined by the defining class loader of the component type. */ static jdwpError getComponentClass(JNIEnv *env, jclass arrayClass, char *componentSignature, jclass *componentClassPtr) { jobject arrayClassLoader; jclass *classes; jint count; jclass componentClass = NULL; jdwpError serror; jvmtiError error; serror = JDWP_ERROR(NONE); error = classLoader(arrayClass, &arrayClassLoader); if (error != JVMTI_ERROR_NONE) { return map2jdwpError(error); } error = allLoadedClasses(&classes, &count); if (error != JVMTI_ERROR_NONE) { serror = map2jdwpError(error); } else { int i; for (i = 0; (i < count) && (componentClass == NULL); i++) { char *signature = NULL; jclass clazz = classes[i]; jboolean match; jvmtiError error; /* signature must match */ error = classSignature(clazz, &signature, NULL); if (error != JVMTI_ERROR_NONE) { serror = map2jdwpError(error); break; } match = strcmp(signature, componentSignature) == 0; jvmtiDeallocate(signature); /* if signature matches, get class loader to check if * it matches */ if (match) { jobject loader; error = classLoader(clazz, &loader); if (error != JVMTI_ERROR_NONE) { return map2jdwpError(error); } match = isSameObject(env, loader, arrayClassLoader); } if (match) { componentClass = clazz; } } jvmtiDeallocate(classes); *componentClassPtr = componentClass; } if (serror == JDWP_ERROR(NONE) && componentClass == NULL) { /* per JVM spec, component class is always loaded * before array class, so this should never occur. */ serror = JDWP_ERROR(NOT_FOUND); } return serror; }