private int getAddr(int obj, int offs) {
    obj = obj + size;
    if (obj<0 || obj>=hp) {
      fatal("Invalid object reference");
    }
    int len = heap[obj];
    if (offs<1 || offs>len) {
      fatal("Invalid offset");
    }
    return obj+offs;
  }