Top Description Methods
org.graalvm.nativeimage.c.struct

public @Interface CBitfield

extends Annotation
Annotations
@Retention:RUNTIME
@Target:METHOD
Imports
java.lang.annotation.ElementType, .Retention, .RetentionPolicy, .Target, org.graalvm.word.LocationIdentity, .WordBase

Denotes a method as a bitfield access of a C struct.

If the method has a non-void return type, it is a get-method of the field. Calls of the method are replaced with a memory read. The possible signatures are FieldType getFieldName([LocationIdentity locationIdentity]);

If the method has the return type void, it is a set-method of the field. Calls of the method are replaced with memory accesses. The possible signatures are void setFieldName(FieldType value, [LocationIdentity locationIdentity]); Most architectures do not provide write instructions on the bit-level. Therefore, the memory write of the new value is preceded by a memory read of the old value. This makes bitfield writes non-atomic.

The receiver is the pointer to the struct that is accessed, i.e., the base address of the memory access.

The FieldType must be a primitive integer type or a word type.

The optional parameter locationIdentity specifies the LocationIdentity to be used for the memory access. Two memory accesses with two different location identities are guaranteed to not alias. Note that UniqueLocationIdentity annotation, cannot be used on bitfields.

Multiple accessor methods, with different signatures according to the rules of allowed signatures, are allowed for a single field.

Since
19.0

Method Summary

Modifier and TypeMethod and Description
public String
value()

Specifies the field name inside the C struct.

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString

Method Detail

valueback to summary
public String value()

Specifies the field name inside the C struct. If no name is provided, the method name is used as the field name. A possible "get" or "set" prefix of the method name is removed.

Since
19.0