/* primitive_box ***************************************************************
- Box a primitive of the given type.
+ Box a primitive of the given type. If the type is an object,
+ simply return it.
*******************************************************************************/
case PRIMITIVETYPE_DOUBLE:
o = primitive_box_double(value.d);
break;
+ case PRIMITIVETYPE_VOID:
+ o = value.a;
+ break;
default:
vm_abort("primitive_box: invalid primitive type %d", type);
}
/* primitive_unbox *************************************************************
- Unbox a primitive of the given type.
+ Unbox a primitive of the given type. If the type is an object,
+ simply return it.
*******************************************************************************/
case PRIMITIVETYPE_DOUBLE:
value.d = primitive_unbox_double(o);
break;
+ case -1:
+ /* If type is -1 the object is not a primitive box but a
+ normal object. */
+ value.a = o;
+ break;
default:
vm_abort("primitive_unbox: invalid primitive type %d", type);
}