Patent ID: 7003768

Claim:
A method to efficiently realize class initialization barriers in a multitasking virtual machine, wherein class loading always takes place before class initialization, and wherein a class initialization barrier guarantees that a class is initialized before the class is first used by a program, comprising: associating a shared runtime representation of the class with a task class mirror table that comprises at least one entry per-task, including an initialized entry, for a plurality of tasks, wherein each entry holds either a null pointer value or a non-null pointer to a task class mirror object, wherein all entries of a task mirror table that hold a non-null pointer value and that are associated with a same task hold a pointer to a same task class mirror object, wherein the task class mirror object holds a task private representation of the class for that task, wherein each task is associated with a unique integer value, wherein the unique integer value is used to compute a byte-offset from a beginning of task class mirror tables that can be used to retrieve from the initialized entry of any task class mirror table the pointer to the task class mirror object, wherein a computed byte-offset to the initialized entry is stored in a descriptor of a plurality of threads executing on behalf of a corresponding task; using the initialized entry of a task in the task class mirror table to determine whether this task has initialized the class associated with the task class mirror table, which involves: examining the initialized entry of the task in the task class mirror table associated with the class in order to determine if that task has initialized the class, wherein the byte-offset to the initialized entry from the beginning of the task class mirror table is obtained from the descriptor of a thread performing an examination on behalf of the task; and initializing the class by the task if the class is not already initialized, wherein a null pointer stored at the initialized entry indicates that the class has not initialized the task, wherein a non-null pointer value indicates that the class has been initialized; and accessing the task class mirror object associated to a particular task.