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/AllocationStrategy.java
/* * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. * * * * * * * * * * * * * * * * * * * * */ package jdk.nashorn.internal.runtime; import static jdk.nashorn.internal.lookup.Lookup.MH; import java.io.Serializable; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.lang.ref.WeakReference; import jdk.nashorn.internal.codegen.Compiler; import jdk.nashorn.internal.codegen.CompilerConstants; import jdk.nashorn.internal.codegen.ObjectClassGenerator; /** * Encapsulates the allocation strategy for a function when used as a constructor. */ final public class AllocationStrategy implements Serializable { private static final long serialVersionUID = 1L; private static final MethodHandles.Lookup LOOKUP = MethodHandles.lookup(); /** Number of fields in the allocated object */ private final int fieldCount; /** Whether to use dual field representation */ private final boolean dualFields; /** Name of class where allocator function resides */ private transient String allocatorClassName; /** lazily generated allocator */ private transient MethodHandle allocator; /** Last used allocator map */ private transient AllocatorMap lastMap; /** * Construct an allocation strategy with the given map and class name. * @param fieldCount number of fields in the allocated object * @param dualFields whether to use dual field representation */ public AllocationStrategy(final int fieldCount, final boolean dualFields) { this.fieldCount = fieldCount; this.dualFields = dualFields; } private String getAllocatorClassName() { if (allocatorClassName == null) { // These classes get loaded, so an interned variant of their name is most likely around anyway. allocatorClassName = Compiler.binaryName(ObjectClassGenerator.getClassName(fieldCount, dualFields)).intern(); } return allocatorClassName; } /** * Get the property map for the allocated object. * @param prototype the prototype object * @return the property map */ synchronized PropertyMap getAllocatorMap(final ScriptObject prototype) { assert prototype != null; final PropertyMap protoMap = prototype.getMap(); if (lastMap != null) { if (!lastMap.hasSharedProtoMap()) { if (lastMap.hasSamePrototype(prototype)) { return lastMap.allocatorMap; } if (lastMap.hasSameProtoMap(protoMap) && lastMap.hasUnchangedProtoMap()) { // Convert to shared prototype map. Allocated objects will use the same property map // that can be used as long as none of the prototypes modify the shared proto map. final PropertyMap allocatorMap = PropertyMap.newMap(null, getAllocatorClassName(), 0, fieldCount, 0); final SharedPropertyMap sharedProtoMap = new SharedPropertyMap(protoMap); allocatorMap.setSharedProtoMap(sharedProtoMap); prototype.setMap(sharedProtoMap); lastMap = new AllocatorMap(prototype, protoMap, allocatorMap); return allocatorMap; } } if (lastMap.hasValidSharedProtoMap() && lastMap.hasSameProtoMap(protoMap)) { prototype.setMap(lastMap.getSharedProtoMap()); return lastMap.allocatorMap; } } final PropertyMap allocatorMap = PropertyMap.newMap(null, getAllocatorClassName(), 0, fieldCount, 0); lastMap = new AllocatorMap(prototype, protoMap, allocatorMap); return allocatorMap; } /** * Allocate an object with the given property map * @param map the property map * @return the allocated object */ ScriptObject allocate(final PropertyMap map) { try { if (allocator == null) { allocator = MH.findStatic(LOOKUP, Context.forStructureClass(getAllocatorClassName()), CompilerConstants.ALLOCATE.symbolName(), MH.type(ScriptObject.class, PropertyMap.class)); } return (ScriptObject)allocator.invokeExact(map); } catch (final RuntimeException | Error e) { throw e; } catch (final Throwable t) { throw new RuntimeException(t); } } @Override public String toString() { return "AllocationStrategy[fieldCount=" + fieldCount + "]"; } static class AllocatorMap { final private WeakReference<ScriptObject> prototype; final private WeakReference<PropertyMap> prototypeMap; private final PropertyMap allocatorMap; AllocatorMap(final ScriptObject prototype, final PropertyMap protoMap, final PropertyMap allocMap) { this.prototype = new WeakReference<>(prototype); this.prototypeMap = new WeakReference<>(protoMap); this.allocatorMap = allocMap; } boolean hasSamePrototype(final ScriptObject proto) { return prototype.get() == proto; } boolean hasSameProtoMap(final PropertyMap protoMap) { return prototypeMap.get() == protoMap || allocatorMap.getSharedProtoMap() == protoMap; } boolean hasUnchangedProtoMap() { final ScriptObject proto = prototype.get(); return proto != null && proto.getMap() == prototypeMap.get(); } boolean hasSharedProtoMap() { return getSharedProtoMap() != null; } boolean hasValidSharedProtoMap() { return hasSharedProtoMap() && getSharedProtoMap().isValidSharedProtoMap(); } PropertyMap getSharedProtoMap() { return allocatorMap.getSharedProtoMap(); } } }
⏎ jdk/nashorn/internal/runtime/AllocationStrategy.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, 107794👍, 0💬
Popular Posts:
JLayer is a library that decodes/plays/converts MPEG 1/2/2.5 Layer 1/2/3 (i.e. MP3) in real time for...
JDK 11 jdk.localedata.jmod is the JMOD file for JDK 11 Localedata module. JDK 11 Locale Data module ...
JDK 11 java.management.jmod is the JMOD file for JDK 11 Management module. JDK 11 Management module ...
Snappy-Java is a Java port of the "snappy", a fast C++ compresser/decompresser developed by Google. ...
iText is an ideal library for developers looking to enhance web- and other applications with dynamic...