}
-/* builtin_descriptorscompatible ***********************************************
-
- Checks if two array type descriptors are assignment compatible.
-
- RETURN VALUE:
- 1......target = desc is possible
- 0......otherwise
-
-*******************************************************************************/
-
-static bool builtin_descriptorscompatible(arraydescriptor *desc, arraydescriptor *target)
-{
- if (desc == target)
- return 1;
-
- if (desc->arraytype != target->arraytype)
- return 0;
-
- if (desc->arraytype != ARRAYTYPE_OBJECT)
- return 1;
-
- /* {both arrays are arrays of references} */
-
- if (desc->dimension == target->dimension) {
- if (!desc->elementvftbl)
- return 0;
- /* an array which contains elements of interface types is
- allowed to be casted to Object (JOWENN)*/
-
- if ((desc->elementvftbl->baseval < 0) &&
- (target->elementvftbl->baseval == 1))
- return 1;
-
- return class_isanysubclass(desc->elementvftbl->clazz,
- target->elementvftbl->clazz);
- }
-
- if (desc->dimension < target->dimension)
- return 0;
-
- /* {desc has higher dimension than target} */
-
- return class_isanysubclass(pseudo_class_Arraystub,
- target->elementvftbl->clazz);
-}
-
-
/* builtin_arraycheckcast ******************************************************
Checks if an object is really a subtype of the requested array
if (desc == NULL)
return 0;
- return builtin_descriptorscompatible(desc, targetclass->vftbl->arraydesc);
+ return class_is_arraycompatible(desc, targetclass->vftbl->arraydesc);
}
vftbl_t *componentvftbl;
vftbl_t *valuevftbl;
int32_t baseval;
- uint32_t diffval;
bool result;
if (o == NULL)
#if USES_NEW_SUBTYPE
result = fast_subtype_check(valuevftbl, componentvftbl);
#else
- diffval = valuevftbl->baseval - componentvftbl->baseval;
- result = diffval <= (uint32_t) componentvftbl->diffval;
+ uint32_t diffval = valuevftbl->baseval - componentvftbl->baseval;
+ result = diffval <= (uint32_t) componentvftbl->diffval;
#endif
}
else {
/* {o is an array} */
- result = builtin_descriptorscompatible(valuedesc, componentvftbl->arraydesc);
+ result = class_is_arraycompatible(valuedesc, componentvftbl->arraydesc);
}
/* return result */
vftbl_t *elementvftbl;
vftbl_t *valuevftbl;
int32_t baseval;
- uint32_t diffval;
bool result;
if (o == NULL)
#if USES_NEW_SUBTYPE
result = fast_subtype_check(valuevftbl, elementvftbl);
#else
- diffval = valuevftbl->baseval - elementvftbl->baseval;
- result = diffval <= (uint32_t) elementvftbl->diffval;
+ uint32_t diffval = valuevftbl->baseval - elementvftbl->baseval;
+ result = diffval <= (uint32_t) elementvftbl->diffval;
#endif
}
* one-dimensional array of a class type */
bool builtin_fast_canstore_onedim_class(java_objectarray_t *a, java_object_t *o)
{
- vftbl_t *elementvftbl;
- vftbl_t *valuevftbl;
- uint32_t diffval;
- bool result;
+ vftbl_t *elementvftbl;
+ vftbl_t *valuevftbl;
+ bool result;
if (o == NULL)
return 1;
#if USES_NEW_SUBTYPE
result = fast_subtype_check(valuevftbl, elementvftbl);
#else
- diffval = valuevftbl->baseval - elementvftbl->baseval;
- result = diffval <= (uint32_t) elementvftbl->diffval;
+ uint32_t diffval = valuevftbl->baseval - elementvftbl->baseval;
+ result = diffval <= (uint32_t) elementvftbl->diffval;
#endif
UNLOCK_CLASSRENUMBER_LOCK;