CACAO
Static Public Member Functions
Primitive Class Reference

Static Public Member Functions

static void initialize_table ()
 Fill the primitive type table with the primitive-type classes, array-classes and wrapper classes. More...
 
static void post_initialize_table ()
 Finish the primitive-type table initialization. More...
 
static classinfoget_class_by_name (Utf8String name)
 Returns the primitive class of the given class name. More...
 
static classinfoget_class_by_type (int type)
 Returns the primitive class of the given type. More...
 
static classinfoget_class_by_char (char ch)
 Returns the primitive class of the given type. More...
 
static classinfoget_arrayclass_by_name (Utf8String name)
 Returns the primitive array-class of the given primitive class name. More...
 
static classinfoget_arrayclass_by_type (int type)
 Returns the primitive array-class of the given type. More...
 
static int get_type_by_wrapperclass (classinfo *c)
 Returns the primitive type of the given wrapper-class. More...
 
static int get_type_by_primitiveclass (classinfo *c)
 Returns the primitive type of the given primitive-class. More...
 
static java_handle_tbox (int type, imm_union value)
 Box a primitive of the given type. More...
 
static java_handle_tbox (uint8_t value)
 Box a primitive type. More...
 
static java_handle_tbox (int8_t value)
 
static java_handle_tbox (uint16_t value)
 
static java_handle_tbox (int16_t value)
 
static java_handle_tbox (int32_t value)
 
static java_handle_tbox (int64_t value)
 
static java_handle_tbox (float value)
 
static java_handle_tbox (double value)
 
static imm_union unbox (java_handle_t *o)
 Unbox a primitive of the given type. More...
 
static bool unbox_typed (java_handle_t *o, int type, imm_union *value)
 Unbox a primitive of the given type. More...
 
static uint8_t unbox_boolean (java_handle_t *o)
 Unbox a primitive type. More...
 
static int8_t unbox_byte (java_handle_t *o)
 
static uint16_t unbox_char (java_handle_t *o)
 
static int16_t unbox_short (java_handle_t *o)
 
static int32_t unbox_int (java_handle_t *o)
 
static int64_t unbox_long (java_handle_t *o)
 
static float unbox_float (java_handle_t *o)
 
static double unbox_double (java_handle_t *o)
 

Detailed Description

Definition at line 70 of file primitive.hpp.

Member Function Documentation

java_handle_t * Primitive::box ( int  type,
imm_union  value 
)
static

Box a primitive of the given type.

If the type is an object, simply return it.

Parameters
typeType of the passed value.
valueValue to box.
Returns
Handle of the boxing Java object.

Definition at line 393 of file primitive.cpp.

java_handle_t * Primitive::box ( uint8_t  value)
static

Box a primitive type.

Definition at line 652 of file primitive.cpp.

java_handle_t * Primitive::box ( int8_t  value)
static

Definition at line 665 of file primitive.cpp.

java_handle_t * Primitive::box ( uint16_t  value)
static

Definition at line 678 of file primitive.cpp.

java_handle_t * Primitive::box ( int16_t  value)
static

Definition at line 691 of file primitive.cpp.

java_handle_t * Primitive::box ( int32_t  value)
static

Definition at line 704 of file primitive.cpp.

java_handle_t * Primitive::box ( int64_t  value)
static

Definition at line 717 of file primitive.cpp.

java_handle_t * Primitive::box ( float  value)
static

Definition at line 730 of file primitive.cpp.

java_handle_t * Primitive::box ( double  value)
static

Definition at line 743 of file primitive.cpp.

classinfo * Primitive::get_arrayclass_by_name ( Utf8String  name)
static

Returns the primitive array-class of the given primitive class name.

Parameters
nameName of the class.
Returns
Class structure.

Definition at line 314 of file primitive.cpp.

classinfo * Primitive::get_arrayclass_by_type ( int  type)
static

Returns the primitive array-class of the given type.

Parameters
typeInteger type of the class.
Returns
Class structure.

Definition at line 336 of file primitive.cpp.

classinfo * Primitive::get_class_by_char ( char  ch)
static

Returns the primitive class of the given type.

Parameters
ch
Returns
Class structure.

Definition at line 266 of file primitive.cpp.

classinfo * Primitive::get_class_by_name ( Utf8String  name)
static

Returns the primitive class of the given class name.

Parameters
nameName of the class.
Returns
Class structure.

Definition at line 231 of file primitive.cpp.

classinfo * Primitive::get_class_by_type ( int  type)
static

Returns the primitive class of the given type.

Parameters
typeInteger type of the class.
Returns
Class structure.

Definition at line 253 of file primitive.cpp.

int Primitive::get_type_by_primitiveclass ( classinfo c)
static

Returns the primitive type of the given primitive-class.

Parameters
cClass structure.
Returns
Integer type of the class.

Definition at line 370 of file primitive.cpp.

int Primitive::get_type_by_wrapperclass ( classinfo c)
static

Returns the primitive type of the given wrapper-class.

Parameters
cClass structure.
Returns
Integer type of the class.

Definition at line 349 of file primitive.cpp.

void Primitive::initialize_table ( )
static

Fill the primitive type table with the primitive-type classes, array-classes and wrapper classes.

This is important in the VM startup.

We split this primitive-type table initialization because of annotations in the bootstrap classes.

But we may get a problem if we have annotations in:

java/lang/Object java/lang/Cloneable java/io/Serializable

Also see: loader_preinit and linker_preinit.

Definition at line 94 of file primitive.cpp.

void Primitive::post_initialize_table ( )
static

Finish the primitive-type table initialization.

In this step we set the vftbl of the primitive-type classes.

This is necessary because java/lang/Class is loaded and linked after the primitive types have been linked.

We have to do that in an extra function, as the primitive types are not stored in the classcache.

Definition at line 204 of file primitive.cpp.

imm_union Primitive::unbox ( java_handle_t h)
static

Unbox a primitive of the given type.

If the type is an object, simply return it.

Parameters
hHandle of the Java object.
Returns
Unboxed value as union.

Definition at line 442 of file primitive.cpp.

uint8_t Primitive::unbox_boolean ( java_handle_t o)
inlinestatic

Unbox a primitive type.

Definition at line 767 of file primitive.cpp.

int8_t Primitive::unbox_byte ( java_handle_t o)
inlinestatic

Definition at line 773 of file primitive.cpp.

uint16_t Primitive::unbox_char ( java_handle_t o)
inlinestatic

Definition at line 779 of file primitive.cpp.

double Primitive::unbox_double ( java_handle_t o)
inlinestatic

Definition at line 809 of file primitive.cpp.

float Primitive::unbox_float ( java_handle_t o)
inlinestatic

Definition at line 803 of file primitive.cpp.

int32_t Primitive::unbox_int ( java_handle_t o)
inlinestatic

Definition at line 791 of file primitive.cpp.

int64_t Primitive::unbox_long ( java_handle_t o)
inlinestatic

Definition at line 797 of file primitive.cpp.

int16_t Primitive::unbox_short ( java_handle_t o)
inlinestatic

Definition at line 785 of file primitive.cpp.

bool Primitive::unbox_typed ( java_handle_t h,
int  type,
imm_union value 
)
static

Unbox a primitive of the given type.

Also checks if the boxed primitive type can be widened into the destination type. This conversion is done according to "The Java Language Specification, Third Edition, $5.1.2 Widening Primitive Conversion".

Parameters
hHandle of the boxing Java object.
typeDestination type of the conversion.
valuePointer to union where the resulting primitive value will be stored will.
Returns
True of the conversion is allowed, false otherwise.

Definition at line 508 of file primitive.cpp.


The documentation for this class was generated from the following files: