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.jikesrvm.objectmodel;
014
015import org.vmmagic.Intrinsic;
016
017/**
018 * This interface is used to indicate a type will behave as a runtime table.
019 * Runtime tables are used to implement arrays whose elements can only be
020 * manipulated by the the get and set methods of the table. Every runtime table
021 * will have a static allocate method and implement the methods below.
022 *
023 * @see org.jikesrvm.classloader.TypeReference#isRuntimeTable()
024 */
025public interface RuntimeTable<T> {
026  /**
027   * Get a value from the table. This method is hijacked by the compiler but the
028   * implementation is used during boot image writing.
029   *
030   * @param index location to read
031   * @return value from table
032   */
033  @Intrinsic
034  T get(int index);
035  /**
036   * Set a value to the table. This method is hijacked by the compiler but the
037   * implementation is used during boot image writing.
038   *
039   * @param index location to write
040   * @param value to write
041   */
042  @Intrinsic
043  void set(int index, T value);
044  /**
045   * Get the table length. This method is hijacked by the compiler but the
046   * implementation is used during boot image writing.
047   *
048   * @return length of table
049   */
050  @Intrinsic
051  int length();
052  /**
053   * Only called at boot image write time. This returns the backing array to the
054   * boot image writer.
055   *
056   * @return backing array of elements
057   */
058  @Intrinsic
059  T[] getBacking();
060}