Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (309)
Collections:
Other Resources:
JDK 11 jdk.scripting.nashorn.jmod - Scripting Nashorn Module
JDK 11 jdk.scripting.nashorn.jmod is the JMOD file for JDK 11 Scripting Nashorn module.
JDK 11 Scripting Nashorn module compiled class files are stored in \fyicenter\jdk-11.0.1\jmods\jdk.scripting.nashorn.jmod.
JDK 11 Scripting Nashorn module compiled class files are also linked and stored in the \fyicenter\jdk-11.0.1\lib\modules JImage file.
JDK 11 Scripting Nashorn module source code files are stored in \fyicenter\jdk-11.0.1\lib\src.zip\jdk.scripting.nashorn.
You can click and view the content of each source code file in the list below.
✍: FYIcenter
⏎ jdk/nashorn/internal/runtime/arrays/ContinuousArrayData.java
/* * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. * * * * * * * * * * * * * * * * * * * * */ package jdk.nashorn.internal.runtime.arrays; import static jdk.nashorn.internal.codegen.CompilerConstants.staticCall; import static jdk.nashorn.internal.lookup.Lookup.MH; import static jdk.nashorn.internal.runtime.JSType.getAccessorTypeIndex; import static jdk.nashorn.internal.runtime.UnwarrantedOptimismException.INVALID_PROGRAM_POINT; import static jdk.nashorn.internal.runtime.UnwarrantedOptimismException.isValid; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodType; import java.lang.invoke.SwitchPoint; import jdk.dynalink.CallSiteDescriptor; import jdk.dynalink.linker.GuardedInvocation; import jdk.dynalink.linker.LinkRequest; import jdk.nashorn.internal.codegen.types.Type; import jdk.nashorn.internal.lookup.Lookup; import jdk.nashorn.internal.runtime.ScriptObject; import jdk.nashorn.internal.runtime.linker.NashornCallSiteDescriptor; import jdk.nashorn.internal.runtime.logging.Logger; /** * Interface implemented by all arrays that are directly accessible as underlying * native arrays */ @Logger(name="arrays") public abstract class ContinuousArrayData extends ArrayData { /** * Constructor * @param length length (elementLength) */ protected ContinuousArrayData(final long length) { super(length); } /** * Check if we can put one more element at the end of this continuous * array without reallocating, or if we are overwriting an already * allocated element * * @param index index to check * @return true if we don't need to do any array reallocation to fit an element at index */ public final boolean hasRoomFor(final int index) { return has(index) || (index == length() && ensure(index) == this); } /** * Check if an arraydata is empty * @return true if empty */ public boolean isEmpty() { return length() == 0L; } /** * Return element getter for a certain type at a certain program point * @param returnType return type * @param programPoint program point * @return element getter or null if not supported (used to implement slow linkage instead * as fast isn't possible) */ public abstract MethodHandle getElementGetter(final Class<?> returnType, final int programPoint); /** * Return element getter for a certain type at a certain program point * @param elementType element type * @return element setter or null if not supported (used to implement slow linkage instead * as fast isn't possible) */ public abstract MethodHandle getElementSetter(final Class<?> elementType); /** * Version of has that throws a class cast exception if element does not exist * used for relinking * * @param index index to check - currently only int indexes * @return index */ protected final int throwHas(final int index) { if (!has(index)) { throw new ClassCastException(); } return index; } @Override public abstract ContinuousArrayData copy(); /** * Returns the type used to store an element in this array * @return element type */ public abstract Class<?> getElementType(); @Override public Type getOptimisticType() { return Type.typeFor(getElementType()); } /** * Returns the boxed type of the type used to store an element in this array * @return element type */ public abstract Class<?> getBoxedElementType(); /** * Get the widest element type of two arrays. This can be done faster in subclasses, but * this works for all ContinuousArrayDatas and for where more optimal checks haven't been * implemented. * * @param otherData another ContinuousArrayData * @return the widest boxed element type */ public ContinuousArrayData widest(final ContinuousArrayData otherData) { final Class<?> elementType = getElementType(); return Type.widest(elementType, otherData.getElementType()) == elementType ? this : otherData; } /** * Look up a continuous array element getter * @param get getter, sometimes combined with a has check that throws CCE on failure for relink * @param returnType return type * @param programPoint program point * @return array getter */ protected final MethodHandle getContinuousElementGetter(final MethodHandle get, final Class<?> returnType, final int programPoint) { return getContinuousElementGetter(getClass(), get, returnType, programPoint); } /** * Look up a continuous array element setter * @param set setter, sometimes combined with a has check that throws CCE on failure for relink * @param returnType return type * @return array setter */ protected final MethodHandle getContinuousElementSetter(final MethodHandle set, final Class<?> returnType) { return getContinuousElementSetter(getClass(), set, returnType); } /** * Return element getter for a {@link ContinuousArrayData} * @param clazz clazz for exact type guard * @param getHas has getter * @param returnType return type * @param programPoint program point * @return method handle for element setter */ protected MethodHandle getContinuousElementGetter(final Class<? extends ContinuousArrayData> clazz, final MethodHandle getHas, final Class<?> returnType, final int programPoint) { final boolean isOptimistic = isValid(programPoint); final int fti = getAccessorTypeIndex(getHas.type().returnType()); final int ti = getAccessorTypeIndex(returnType); MethodHandle mh = getHas; if (isOptimistic) { if (ti < fti) { mh = MH.insertArguments(ArrayData.THROW_UNWARRANTED.methodHandle(), 1, programPoint); } } mh = MH.asType(mh, mh.type().changeReturnType(returnType).changeParameterType(0, clazz)); if (!isOptimistic) { //for example a & array[17]; return Lookup.filterReturnType(mh, returnType); } return mh; } /** * Return element setter for a {@link ContinuousArrayData} * @param clazz class for exact type guard * @param setHas set has guard * @param elementType element type * @return method handle for element setter */ protected MethodHandle getContinuousElementSetter(final Class<? extends ContinuousArrayData> clazz, final MethodHandle setHas, final Class<?> elementType) { return MH.asType(setHas, setHas.type().changeParameterType(2, elementType).changeParameterType(0, clazz)); } /** Fast access guard - it is impractical for JIT performance reasons to use only CCE asType as guard :-(, also we need the null case explicitly, which is the one that CCE doesn't handle */ protected static final MethodHandle FAST_ACCESS_GUARD = MH.dropArguments( staticCall( MethodHandles.lookup(), ContinuousArrayData.class, "guard", boolean.class, Class.class, ScriptObject.class).methodHandle(), 2, int.class); @SuppressWarnings("unused") private static boolean guard(final Class<? extends ContinuousArrayData> clazz, final ScriptObject sobj) { return sobj != null && sobj.getArray().getClass() == clazz; } /** * Return a fast linked array getter, or null if we have to dispatch to super class * @param desc descriptor * @param request link request * @return invocation or null if needs to be sent to slow relink */ @Override public GuardedInvocation findFastGetIndexMethod(final Class<? extends ArrayData> clazz, final CallSiteDescriptor desc, final LinkRequest request) { final MethodType callType = desc.getMethodType(); final Class<?> indexType = callType.parameterType(1); final Class<?> returnType = callType.returnType(); if (ContinuousArrayData.class.isAssignableFrom(clazz) && indexType == int.class) { final Object[] args = request.getArguments(); final int index = (int)args[args.length - 1]; if (has(index)) { final MethodHandle getArray = ScriptObject.GET_ARRAY.methodHandle(); final int programPoint = NashornCallSiteDescriptor.isOptimistic(desc) ? NashornCallSiteDescriptor.getProgramPoint(desc) : INVALID_PROGRAM_POINT; MethodHandle getElement = getElementGetter(returnType, programPoint); if (getElement != null) { getElement = MH.filterArguments(getElement, 0, MH.asType(getArray, getArray.type().changeReturnType(clazz))); final MethodHandle guard = MH.insertArguments(FAST_ACCESS_GUARD, 0, clazz); return new GuardedInvocation(getElement, guard, (SwitchPoint)null, ClassCastException.class); } } } return null; } /** * Return a fast linked array setter, or null if we have to dispatch to super class * @param desc descriptor * @param request link request * @return invocation or null if needs to be sent to slow relink */ @Override public GuardedInvocation findFastSetIndexMethod(final Class<? extends ArrayData> clazz, final CallSiteDescriptor desc, final LinkRequest request) { // array, index, value final MethodType callType = desc.getMethodType(); final Class<?> indexType = callType.parameterType(1); final Class<?> elementType = callType.parameterType(2); if (ContinuousArrayData.class.isAssignableFrom(clazz) && indexType == int.class) { final Object[] args = request.getArguments(); final int index = (int)args[args.length - 2]; if (hasRoomFor(index)) { MethodHandle setElement = getElementSetter(elementType); //Z(continuousarraydata, int, int), return true if successful if (setElement != null) { //else we are dealing with a wider type than supported by this callsite MethodHandle getArray = ScriptObject.GET_ARRAY.methodHandle(); getArray = MH.asType(getArray, getArray.type().changeReturnType(getClass())); setElement = MH.filterArguments(setElement, 0, getArray); final MethodHandle guard = MH.insertArguments(FAST_ACCESS_GUARD, 0, clazz); return new GuardedInvocation(setElement, guard, (SwitchPoint)null, ClassCastException.class); //CCE if not a scriptObject anymore } } } return null; } /** * Specialization - fast push implementation * @param arg argument * @return new array length */ public double fastPush(final int arg) { throw new ClassCastException(String.valueOf(getClass())); //type is wrong, relink } /** * Specialization - fast push implementation * @param arg argument * @return new array length */ public double fastPush(final long arg) { throw new ClassCastException(String.valueOf(getClass())); //type is wrong, relink } /** * Specialization - fast push implementation * @param arg argument * @return new array length */ public double fastPush(final double arg) { throw new ClassCastException(String.valueOf(getClass())); //type is wrong, relink } /** * Specialization - fast push implementation * @param arg argument * @return new array length */ public double fastPush(final Object arg) { throw new ClassCastException(String.valueOf(getClass())); //type is wrong, relink } /** * Specialization - fast pop implementation * @return element value */ public int fastPopInt() { throw new ClassCastException(String.valueOf(getClass())); //type is wrong, relink } /** * Specialization - fast pop implementation * @return element value */ public double fastPopDouble() { throw new ClassCastException(String.valueOf(getClass())); //type is wrong, relink } /** * Specialization - fast pop implementation * @return element value */ public Object fastPopObject() { throw new ClassCastException(String.valueOf(getClass())); //type is wrong, relink } /** * Specialization - fast concat implementation * @param otherData data to concat * @return new arraydata */ public ContinuousArrayData fastConcat(final ContinuousArrayData otherData) { throw new ClassCastException(String.valueOf(getClass()) + " != " + String.valueOf(otherData.getClass())); } }
⏎ jdk/nashorn/internal/runtime/arrays/ContinuousArrayData.java
Or download all of them as a single archive file:
File name: jdk.scripting.nashorn-11.0.1-src.zip File size: 1390965 bytes Release date: 2018-11-04 Download
⇒ JDK 11 jdk.scripting.nashorn.shell.jmod - Scripting Nashorn Shell Module
2020-04-25, 83556👍, 0💬
Popular Posts:
commons-io-2.6-sources.j aris the source JAR file for Apache Commons IO 2.6, which is a library of u...
Apache Axis2 is the core engine for Web services. It is a complete re-design and re-write of the wid...
What Is commons-io-2.11.jar? commons-io-2.11.jar is the JAR file for Commons IO 2.5, which is a libr...
GJT (Giant Java Tree) implementation of XML Pull Parser. JAR File Size and Download Location: File n...
JDK 11 jdk.internal.le.jmod is the JMOD file for JDK 11 Internal Line Editing module. JDK 11 Interna...