void lock(int register) {
            if (locks == null) {
                locks = new int[20];
            } else if (locks.length == nlocks) {
                int[] newLocks = new int[locks.length << 1];
                System.arraycopy(locks, 0, newLocks, 0, locks.length);
                locks = newLocks;
            }
            locks[nlocks] = register;
            nlocks++;
        }