001/* 002 * This file is part of the Jikes RVM project (http://jikesrvm.org). 003 * 004 * This file is licensed to You under the Eclipse Public License (EPL); 005 * You may not use this file except in compliance with the License. You 006 * may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/eclipse-1.0.php 009 * 010 * See the COPYRIGHT.txt file distributed with this work for information 011 * regarding copyright ownership. 012 */ 013package org.vmmagic.unboxed; 014 015import org.vmmagic.Unboxed; 016 017/** 018 * The object reference type is used by the runtime system and collector to 019 * represent a type that holds a reference to a single object. 020 * We use a separate type instead of the Java Object type for coding clarity, 021 * to make a clear distinction between objects the VM is written in, and 022 * objects that the VM is managing. No operations that can not be completed in 023 * pure Java should be allowed on Object. 024 */ 025@Unboxed 026public final class ObjectReference { 027 028 /** 029 * The object field. 030 */ 031 @SuppressWarnings("unused") 032 private Object data; 033 034 /** 035 * Convert from an object to a reference. 036 * @param obj The object 037 * @return The corresponding reference 038 */ 039 public static ObjectReference fromObject(Object obj) { 040 return null; 041 } 042 043 /** 044 * @return a {@code null} reference 045 */ 046 public static ObjectReference nullReference() { 047 return null; 048 } 049 050 /** 051 * Convert from an reference to an object. Note: this is a JikesRVM 052 * specific extension to vmmagic. 053 * @return The object 054 */ 055 public Object toObject() { 056 return null; 057 } 058 059 /** 060 * @return a heap address for the object. 061 */ 062 public Address toAddress() { 063 return null; 064 } 065 066 /** 067 * @return whether this is a null reference 068 */ 069 public boolean isNull() { 070 return false; 071 } 072}