Ejemplo n.º 1
0
void Java_java_lang_Object_hashCode(void)
{
    /* The following must be two lines:
     * objectHashCode can GC, and a compiler is allowed to assume that the
     * value of sp hasn't changed if it is all on one line.
     */
    OBJECT object = popStackAsType(OBJECT);
    long result = objectHashCode(object); /* this may GC */
    pushStack(result);
}
Ejemplo n.º 2
0
/*
 * Note that this may not give accurate results if called with a weak
 * reference.
 */
static jint hashRef(jobject ref) 
{
    jint hashCode = objectHashCode(ref);
    return abs(hashCode) % CR_HASH_SLOT_COUNT;
}
Ejemplo n.º 3
0
void Java_java_lang_System_identityHashCode(void)
{
    OBJECT object = popStackAsType(OBJECT);
    long result = object == NULL ? 0 : objectHashCode(object); /* this may GC */
    pushStack(result);
}
Ejemplo n.º 4
0
/*
 * Return slot in hash table to use for this class.
 */
static jint 
hashKlass(jclass klass) 
{
    jint hashCode = objectHashCode(klass);
    return abs(hashCode) % HASH_SLOT_COUNT;
}