JDK 11 jdk.compiler.jmod - Compiler Tool

JDK 11 jdk.compiler.jmod is the JMOD file for JDK 11 Compiler tool, which can be invoked by the "javac" command.

JDK 11 Compiler tool compiled class files are stored in \fyicenter\jdk-11.0.1\jmods\jdk.compiler.jmod.

JDK 11 Compiler tool compiled class files are also linked and stored in the \fyicenter\jdk-11.0.1\lib\modules JImage file.

JDK 11 Compiler source code files are stored in \fyicenter\jdk-11.0.1\lib\src.zip\jdk.compiler.

You can click and view the content of each source code file in the list below.

✍: FYIcenter

com/sun/tools/javac/util/UnsharedNameTable.java

/*
 * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
 * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 */

package com.sun.tools.javac.util;

import java.lang.ref.WeakReference;

/**
 * Implementation of Name.Table that stores names in individual arrays
 * using weak references. It is recommended for use when a single shared
 * byte array is unsuitable.
 *
 *  <p><b>This is NOT part of any supported API.
 *  If you write code that depends on this, you do so at your own risk.
 *  This code and its internal interfaces are subject to change or
 *  deletion without notice.</b>
 */
public class UnsharedNameTable extends Name.Table {
    static public Name.Table create(Names names) {
        return new UnsharedNameTable(names);
    }

    static class HashEntry extends WeakReference<NameImpl> {
        HashEntry next;
        HashEntry(NameImpl referent) {
            super(referent);
        }
    }

    /** The hash table for names.
     */
    private HashEntry[] hashes = null;

    /** The mask to be used for hashing
     */
    private int hashMask;

    /** Index counter for names in this table.
     */
    public int index;

    /** Allocator
     *  @param names The main name table
     *  @param hashSize the (constant) size to be used for the hash table
     *                  needs to be a power of two.
     */
    public UnsharedNameTable(Names names, int hashSize) {
        super(names);
        hashMask = hashSize - 1;
        hashes = new HashEntry[hashSize];
    }

    public UnsharedNameTable(Names names) {
        this(names, 0x8000);
    }


    @Override
    public Name fromChars(char[] cs, int start, int len) {
        byte[] name = new byte[len * 3];
        int nbytes = Convert.chars2utf(cs, start, name, 0, len);
        return fromUtf(name, 0, nbytes);
    }

    @Override
    public Name fromUtf(byte[] cs, int start, int len) {
        int h = hashValue(cs, start, len) & hashMask;

        HashEntry element = hashes[h];

        NameImpl n = null;

        HashEntry previousNonNullTableEntry = null;
        HashEntry firstTableEntry = element;

        while (element != null) {
            if (element == null) {
                break;
            }

            n = element.get();

            if (n == null) {
                if (firstTableEntry == element) {
                    hashes[h] = firstTableEntry = element.next;
                }
                else {
                    Assert.checkNonNull(previousNonNullTableEntry, "previousNonNullTableEntry cannot be null here.");
                    previousNonNullTableEntry.next = element.next;
                }
            }
            else {
                if (n.getByteLength() == len && equals(n.bytes, 0, cs, start, len)) {
                    return n;
                }
                previousNonNullTableEntry = element;
            }

            element = element.next;
        }

        byte[] bytes = new byte[len];
        System.arraycopy(cs, start, bytes, 0, len);
        n = new NameImpl(this, bytes, index++);

        HashEntry newEntry = new HashEntry(n);

        if (previousNonNullTableEntry == null) { // We are not the first name with that hashCode.
            hashes[h] = newEntry;
        }
        else {
            Assert.checkNull(previousNonNullTableEntry.next, "previousNonNullTableEntry.next must be null.");
            previousNonNullTableEntry.next = newEntry;
        }

        return n;
    }

    @Override
    public void dispose() {
        hashes = null;
    }

    static class NameImpl extends Name {
        NameImpl(UnsharedNameTable table, byte[] bytes, int index) {
            super(table);
            this.bytes = bytes;
            this.index = index;
        }

        final byte[] bytes;
        final int index;

        @Override
        public int getIndex() {
            return index;
        }

        @Override
        public int getByteLength() {
            return bytes.length;
        }

        @Override
        public byte getByteAt(int i) {
            return bytes[i];
        }

        @Override
        public byte[] getByteArray() {
            return bytes;
        }

        @Override
        public int getByteOffset() {
            return 0;
        }

    }

}

com/sun/tools/javac/util/UnsharedNameTable.java

 

JDK 11 jdk.crypto.cryptoki.jmod - Crypto KI Module

JDK 11 jdk.charsets.jmod - Charsets Module

Download and Use JDK 11

⇑⇑ FAQ for JDK (Java Development Kit)

2018-11-09, 8141👍, 0💬