changeset 953:221a84ef44c0 jdk9-b27

8054834: Modular Source Code Reviewed-by: alanb, chegar, ihse, mduigou Contributed-by: alan.bateman@oracle.com, alex.buckley@oracle.com, chris.hegarty@oracle.com, erik.joelsson@oracle.com, jonathan.gibbons@oracle.com, karen.kinnear@oracle.com, magnus.ihse.bursie@oracle.com, mandy.chung@oracle.com, mark.reinhold@oracle.com, paul.sandoz@oracle.com
author chegar
date Sun, 17 Aug 2014 15:56:32 +0100
parents 7404f40a22e1
children fa7ee1ec0448 c93b6091b11e
files make/BuildNashorn.gmk src/META-INF/MANIFEST.MF src/META-INF/services/javax.script.ScriptEngineFactory src/jdk.scripting.nashorn/share/classes/META-INF/MANIFEST.MF src/jdk.scripting.nashorn/share/classes/META-INF/services/javax.script.ScriptEngineFactory src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/CallSiteDescriptor.java src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/ChainedCallSite.java src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/DefaultBootstrapper.java src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/DynamicLinker.java src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/DynamicLinkerFactory.java src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/GuardedInvocationFilter.java src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/MonomorphicCallSite.java src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/NoSuchDynamicMethodException.java src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/RelinkableCallSite.java src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/AbstractJavaLinker.java src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/AccessibleMembersLookup.java src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/ApplicableOverloadedMethods.java src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/BeanIntrospector.java src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/BeanLinker.java src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/BeansLinker.java src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/CallerSensitiveDetector.java src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/CallerSensitiveDynamicMethod.java src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/CheckRestrictedPackage.java src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/ClassLinker.java src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/ClassString.java src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/DynamicMethod.java src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/DynamicMethodLinker.java src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/FacetIntrospector.java src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/GuardedInvocationComponent.java src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/MaximallySpecific.java src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/OverloadedDynamicMethod.java src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/OverloadedMethod.java src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/SimpleDynamicMethod.java src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/SingleDynamicMethod.java src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/StaticClass.java src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/StaticClassIntrospector.java src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/StaticClassLinker.java src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/messages.properties src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/package.html src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/linker/ConversionComparator.java src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/linker/GuardedInvocation.java src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/linker/GuardedTypeConversion.java src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/linker/GuardingDynamicLinker.java src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/linker/GuardingTypeConverterFactory.java src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/linker/LinkRequest.java src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/linker/LinkerServices.java src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/linker/TypeBasedGuardingDynamicLinker.java src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/linker/package.html src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/package.html src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/AbstractCallSiteDescriptor.java src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/AbstractRelinkableCallSite.java src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/AutoDiscovery.java src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/BottomGuardingDynamicLinker.java src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/CallSiteDescriptorFactory.java src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/ClassLoaderGetterContextProvider.java src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/ClassMap.java src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/CompositeGuardingDynamicLinker.java src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/CompositeTypeBasedGuardingDynamicLinker.java src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/DefaultCallSiteDescriptor.java src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/DefaultPrelinkFilter.java src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/Guards.java src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/LinkRequestImpl.java src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/LinkerServicesImpl.java src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/Lookup.java src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/LookupCallSiteDescriptor.java src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/NameCodec.java src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/NamedDynCallSiteDescriptor.java src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/RuntimeContextLinkRequestImpl.java src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/TypeConverterFactory.java src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/TypeUtilities.java src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/UnnamedDynCallSiteDescriptor.java src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/messages.properties src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/support/package.html src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/scripting/AbstractJSObject.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/scripting/Formatter.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/scripting/JSObject.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/scripting/NashornException.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/scripting/NashornScriptEngine.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/scripting/NashornScriptEngineFactory.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/scripting/ScriptObjectMirror.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/scripting/ScriptUtils.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/scripting/URLReader.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/scripting/package-info.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/scripting/resources/Messages.properties src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/IntDeque.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ApplySpecialization.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/AssignSymbols.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/BranchOptimizer.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ClassEmitter.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGeneratorLexicalContext.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CompilationException.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CompilationPhase.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CompileUnit.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Compiler.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CompilerConstants.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Condition.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ConstantData.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/DumpBytecode.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Emitter.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/FieldObjectCreator.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/FindScopeDepths.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/FoldConstants.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/FunctionSignature.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Label.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/LocalStateRestorationInfo.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Lower.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/MapCreator.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/MapTuple.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/MethodEmitter.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Namespace.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ObjectClassGenerator.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ObjectCreator.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/OptimisticTypesCalculator.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/OptimisticTypesPersistence.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ProgramPoints.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/RuntimeCallSite.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/SharedScopeCall.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/SpillObjectCreator.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/SplitMethodEmitter.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Splitter.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/TypeEvaluator.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/TypeMap.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/WeighNodes.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/types/ArrayType.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/types/BitwiseType.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/types/BooleanType.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/types/BytecodeArrayOps.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/types/BytecodeBitwiseOps.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/types/BytecodeNumericOps.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/types/BytecodeOps.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/types/IntType.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/types/LongType.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/types/NumberType.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/types/NumericType.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/types/ObjectType.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/types/Type.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/AccessNode.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/Assignment.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/BaseNode.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/BinaryNode.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/Block.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/BlockLexicalContext.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/BlockStatement.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/BreakNode.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/BreakableNode.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/BreakableStatement.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/CallNode.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/CaseNode.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/CatchNode.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/ContinueNode.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/EmptyNode.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/Expression.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/ExpressionStatement.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/Flags.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/ForNode.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/FunctionCall.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/FunctionNode.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/IdentNode.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/IfNode.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/IndexNode.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/JoinPredecessor.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/JoinPredecessorExpression.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/JumpStatement.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/LabelNode.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/Labels.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/LexicalContext.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/LexicalContextExpression.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/LexicalContextNode.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/LexicalContextStatement.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/LiteralNode.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/LocalVariableConversion.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/LoopNode.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/Node.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/ObjectNode.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/Optimistic.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/OptimisticLexicalContext.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/PropertyKey.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/PropertyNode.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/ReturnNode.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/RuntimeNode.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/SplitNode.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/Statement.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/SwitchNode.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/Symbol.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/Terminal.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/TernaryNode.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/ThrowNode.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/TryNode.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/UnaryNode.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/VarNode.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/WhileNode.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/WithNode.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/annotations/Ignore.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/annotations/Immutable.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/annotations/Reference.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/debug/ASTWriter.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/debug/ClassHistogramElement.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/debug/JSONWriter.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/debug/NashornClassReader.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/debug/NashornTextifier.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/debug/ObjectSizeCalculator.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/debug/PrintVisitor.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/visitor/NodeOperatorVisitor.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/visitor/NodeVisitor.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/lookup/Lookup.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/lookup/MethodHandleFactory.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/lookup/MethodHandleFunctionality.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/AccessorPropertyDescriptor.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/ArrayBufferView.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/BoundScriptFunctionImpl.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/DataPropertyDescriptor.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/GenericPropertyDescriptor.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/Global.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeArguments.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeArray.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeArrayBuffer.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeBoolean.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeDataView.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeDate.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeDebug.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeError.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeEvalError.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeFloat32Array.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeFloat64Array.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeFunction.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeInt16Array.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeInt32Array.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeInt8Array.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeJSAdapter.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeJSON.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeJava.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeJavaImporter.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeMath.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeNumber.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeObject.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeRangeError.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeReferenceError.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeRegExp.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeRegExpExecResult.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeStrictArguments.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeString.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeSyntaxError.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeTypeError.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeURIError.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeUint16Array.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeUint32Array.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeUint8Array.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeUint8ClampedArray.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/PrototypeObject.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/ScriptFunctionImpl.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/annotations/Attribute.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/annotations/Constructor.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/annotations/Function.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/annotations/Getter.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/annotations/Optimistic.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/annotations/Property.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/annotations/ScriptClass.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/annotations/Setter.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/annotations/SpecializedConstructor.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/annotations/SpecializedFunction.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/annotations/Where.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/package-info.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/AbstractParser.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/DateParser.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/JSONParser.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Lexer.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Parser.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Scanner.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Token.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/TokenKind.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/TokenLookup.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/TokenStream.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/TokenType.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/AccessorProperty.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ArgumentSetter.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/BitVector.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/CodeInstaller.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/CodeStore.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/CompiledFunction.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/CompiledFunctions.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/CompiledScript.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ConsString.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Context.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Debug.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/DebuggerSupport.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/DefaultPropertyAccess.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ECMAErrors.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ECMAException.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ErrorManager.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/FinalScriptFunctionData.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/FindProperty.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/FunctionScope.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/GlobalConstants.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/GlobalFunctions.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/JSErrorType.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/JSONFunctions.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/JSObjectListAdapter.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/JSType.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ListAdapter.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/NashornLoader.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/NativeJavaPackage.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/NumberToString.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/OptimisticReturnFilters.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ParserException.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Property.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/PropertyAccess.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/PropertyDescriptor.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/PropertyHashMap.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/PropertyListeners.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/PropertyMap.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/QuotedStringTokenizer.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/RewriteException.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Scope.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptEnvironment.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptFunction.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptFunctionData.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptLoader.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptObject.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptRuntime.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptingFunctions.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/SetMethodCreator.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Source.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/SpillProperty.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/StructureLoader.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Timing.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/URIUtils.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Undefined.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/UnwarrantedOptimismException.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/UserAccessorProperty.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Version.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/WithObject.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/ArrayData.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/ArrayFilter.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/ArrayIndex.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/ArrayLikeIterator.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/ByteBufferArrayData.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/ContinuousArrayData.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/DeletedArrayFilter.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/DeletedRangeArrayFilter.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/EmptyArrayLikeIterator.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/FrozenArrayFilter.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/IntArrayData.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/InvalidArrayIndexException.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/IteratorAction.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/JSObjectIterator.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/JavaArrayIterator.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/JavaListIterator.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/LongArrayData.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/NoTypeArrayData.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/NumberArrayData.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/ObjectArrayData.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/ReverseJSObjectIterator.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/ReverseJavaArrayIterator.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/ReverseJavaListIterator.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/ReverseScriptArrayIterator.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/ReverseScriptObjectIterator.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/ScriptArrayIterator.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/ScriptObjectIterator.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/SealedArrayFilter.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/SparseArrayData.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/TypedArrayData.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/UndefinedArrayFilter.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/events/RecompilationEvent.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/events/RuntimeEvent.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/AdaptationException.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/AdaptationResult.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/Bootstrap.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/BoundDynamicMethod.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/BoundDynamicMethodLinker.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/ClassAndLoader.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/InvokeByName.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JSObjectLinker.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JavaAdapterBytecodeGenerator.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JavaAdapterClassLoader.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JavaAdapterFactory.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JavaAdapterServices.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JavaArgumentConverters.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JavaSuperAdapter.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JavaSuperAdapterLinker.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/LinkerCallSite.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/NashornBeansLinker.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/NashornBottomLinker.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/NashornCallSiteDescriptor.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/NashornGuards.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/NashornLinker.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/NashornPrimitiveLinker.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/NashornStaticClassLinker.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/PrimitiveLookup.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/ReflectionCheckLinker.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/logging/DebugLogger.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/logging/Loggable.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/logging/Logger.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/options/KeyValueOption.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/options/LoggingOption.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/options/Option.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/options/OptionTemplate.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/options/Options.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/JdkRegExp.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/JoniRegExp.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/RegExp.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/RegExpFactory.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/RegExpMatcher.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/RegExpResult.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/RegExpScanner.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/Analyser.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ApplyCaseFold.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ApplyCaseFoldArg.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ArrayCompiler.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/BitSet.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/BitStatus.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ByteCodeMachine.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ByteCodePrinter.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/CodeRangeBuffer.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/Compiler.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/Config.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/EncodingHelper.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/Lexer.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/Matcher.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/MatcherFactory.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/MinMaxLen.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/NodeOptInfo.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/OptAnchorInfo.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/OptEnvironment.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/OptExactInfo.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/OptMapInfo.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/Option.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/Parser.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/Regex.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/Region.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ScanEnvironment.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ScannerSupport.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/SearchAlgorithm.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/StackEntry.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/StackMachine.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/Syntax.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/Token.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/WarnCallback.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/Warnings.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ast/AnchorNode.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ast/AnyCharNode.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ast/BackRefNode.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ast/CClassNode.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ast/ConsAltNode.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ast/EncloseNode.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ast/Node.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ast/QuantifierNode.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ast/StateNode.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ast/StringNode.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/AnchorType.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/Arguments.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/AsmConstants.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/CCSTATE.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/CCVALTYPE.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/EncloseType.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/MetaChar.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/NodeStatus.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/NodeType.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/OPCode.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/OPSize.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/RegexState.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/StackPopLevel.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/StackType.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/StringType.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/SyntaxProperties.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/TargetInfo.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/TokenType.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/Traverse.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/encoding/CharacterType.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/encoding/IntHolder.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/encoding/ObjPtr.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/exception/ErrorMessages.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/exception/InternalException.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/exception/JOniException.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/exception/SyntaxException.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/exception/ValueException.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/Messages.properties src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/Options.properties src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/fx/base.js src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/fx/bootstrap.js src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/fx/controls.js src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/fx/fxml.js src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/fx/graphics.js src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/fx/media.js src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/fx/swing.js src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/fx/swt.js src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/fx/web.js src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/mozilla_compat.js src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/parser.js src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/version.properties-template src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/scripts/JO.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/scripts/JS.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/tools/Shell.java src/jdk.scripting.nashorn/share/classes/jdk/nashorn/tools/resources/Shell.properties src/jdk.scripting.nashorn/share/classes/jdk/nashorn/tools/resources/shell.js src/jdk.scripting.nashorn/share/classes/overview.html src/jdk/internal/dynalink/CallSiteDescriptor.java src/jdk/internal/dynalink/ChainedCallSite.java src/jdk/internal/dynalink/DefaultBootstrapper.java src/jdk/internal/dynalink/DynamicLinker.java src/jdk/internal/dynalink/DynamicLinkerFactory.java src/jdk/internal/dynalink/GuardedInvocationFilter.java src/jdk/internal/dynalink/MonomorphicCallSite.java src/jdk/internal/dynalink/NoSuchDynamicMethodException.java src/jdk/internal/dynalink/RelinkableCallSite.java src/jdk/internal/dynalink/beans/AbstractJavaLinker.java src/jdk/internal/dynalink/beans/AccessibleMembersLookup.java src/jdk/internal/dynalink/beans/ApplicableOverloadedMethods.java src/jdk/internal/dynalink/beans/BeanIntrospector.java src/jdk/internal/dynalink/beans/BeanLinker.java src/jdk/internal/dynalink/beans/BeansLinker.java src/jdk/internal/dynalink/beans/CallerSensitiveDetector.java src/jdk/internal/dynalink/beans/CallerSensitiveDynamicMethod.java src/jdk/internal/dynalink/beans/CheckRestrictedPackage.java src/jdk/internal/dynalink/beans/ClassLinker.java src/jdk/internal/dynalink/beans/ClassString.java src/jdk/internal/dynalink/beans/DynamicMethod.java src/jdk/internal/dynalink/beans/DynamicMethodLinker.java src/jdk/internal/dynalink/beans/FacetIntrospector.java src/jdk/internal/dynalink/beans/GuardedInvocationComponent.java src/jdk/internal/dynalink/beans/MaximallySpecific.java src/jdk/internal/dynalink/beans/OverloadedDynamicMethod.java src/jdk/internal/dynalink/beans/OverloadedMethod.java src/jdk/internal/dynalink/beans/SimpleDynamicMethod.java src/jdk/internal/dynalink/beans/SingleDynamicMethod.java src/jdk/internal/dynalink/beans/StaticClass.java src/jdk/internal/dynalink/beans/StaticClassIntrospector.java src/jdk/internal/dynalink/beans/StaticClassLinker.java src/jdk/internal/dynalink/beans/messages.properties src/jdk/internal/dynalink/beans/package.html src/jdk/internal/dynalink/linker/ConversionComparator.java src/jdk/internal/dynalink/linker/GuardedInvocation.java src/jdk/internal/dynalink/linker/GuardedTypeConversion.java src/jdk/internal/dynalink/linker/GuardingDynamicLinker.java src/jdk/internal/dynalink/linker/GuardingTypeConverterFactory.java src/jdk/internal/dynalink/linker/LinkRequest.java src/jdk/internal/dynalink/linker/LinkerServices.java src/jdk/internal/dynalink/linker/TypeBasedGuardingDynamicLinker.java src/jdk/internal/dynalink/linker/package.html src/jdk/internal/dynalink/package.html src/jdk/internal/dynalink/support/AbstractCallSiteDescriptor.java src/jdk/internal/dynalink/support/AbstractRelinkableCallSite.java src/jdk/internal/dynalink/support/AutoDiscovery.java src/jdk/internal/dynalink/support/BottomGuardingDynamicLinker.java src/jdk/internal/dynalink/support/CallSiteDescriptorFactory.java src/jdk/internal/dynalink/support/ClassLoaderGetterContextProvider.java src/jdk/internal/dynalink/support/ClassMap.java src/jdk/internal/dynalink/support/CompositeGuardingDynamicLinker.java src/jdk/internal/dynalink/support/CompositeTypeBasedGuardingDynamicLinker.java src/jdk/internal/dynalink/support/DefaultCallSiteDescriptor.java src/jdk/internal/dynalink/support/DefaultPrelinkFilter.java src/jdk/internal/dynalink/support/Guards.java src/jdk/internal/dynalink/support/LinkRequestImpl.java src/jdk/internal/dynalink/support/LinkerServicesImpl.java src/jdk/internal/dynalink/support/Lookup.java src/jdk/internal/dynalink/support/LookupCallSiteDescriptor.java src/jdk/internal/dynalink/support/NameCodec.java src/jdk/internal/dynalink/support/NamedDynCallSiteDescriptor.java src/jdk/internal/dynalink/support/RuntimeContextLinkRequestImpl.java src/jdk/internal/dynalink/support/TypeConverterFactory.java src/jdk/internal/dynalink/support/TypeUtilities.java src/jdk/internal/dynalink/support/UnnamedDynCallSiteDescriptor.java src/jdk/internal/dynalink/support/messages.properties src/jdk/internal/dynalink/support/package.html src/jdk/nashorn/api/scripting/AbstractJSObject.java src/jdk/nashorn/api/scripting/Formatter.java src/jdk/nashorn/api/scripting/JSObject.java src/jdk/nashorn/api/scripting/NashornException.java src/jdk/nashorn/api/scripting/NashornScriptEngine.java src/jdk/nashorn/api/scripting/NashornScriptEngineFactory.java src/jdk/nashorn/api/scripting/ScriptObjectMirror.java src/jdk/nashorn/api/scripting/ScriptUtils.java src/jdk/nashorn/api/scripting/URLReader.java src/jdk/nashorn/api/scripting/package-info.java src/jdk/nashorn/api/scripting/resources/Messages.properties src/jdk/nashorn/internal/IntDeque.java src/jdk/nashorn/internal/codegen/ApplySpecialization.java src/jdk/nashorn/internal/codegen/AssignSymbols.java src/jdk/nashorn/internal/codegen/BranchOptimizer.java src/jdk/nashorn/internal/codegen/ClassEmitter.java src/jdk/nashorn/internal/codegen/CodeGenerator.java src/jdk/nashorn/internal/codegen/CodeGeneratorLexicalContext.java src/jdk/nashorn/internal/codegen/CompilationException.java src/jdk/nashorn/internal/codegen/CompilationPhase.java src/jdk/nashorn/internal/codegen/CompileUnit.java src/jdk/nashorn/internal/codegen/Compiler.java src/jdk/nashorn/internal/codegen/CompilerConstants.java src/jdk/nashorn/internal/codegen/Condition.java src/jdk/nashorn/internal/codegen/ConstantData.java src/jdk/nashorn/internal/codegen/DumpBytecode.java src/jdk/nashorn/internal/codegen/Emitter.java src/jdk/nashorn/internal/codegen/FieldObjectCreator.java src/jdk/nashorn/internal/codegen/FindScopeDepths.java src/jdk/nashorn/internal/codegen/FoldConstants.java src/jdk/nashorn/internal/codegen/FunctionSignature.java src/jdk/nashorn/internal/codegen/Label.java src/jdk/nashorn/internal/codegen/LocalStateRestorationInfo.java src/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java src/jdk/nashorn/internal/codegen/Lower.java src/jdk/nashorn/internal/codegen/MapCreator.java src/jdk/nashorn/internal/codegen/MapTuple.java src/jdk/nashorn/internal/codegen/MethodEmitter.java src/jdk/nashorn/internal/codegen/Namespace.java src/jdk/nashorn/internal/codegen/ObjectClassGenerator.java src/jdk/nashorn/internal/codegen/ObjectCreator.java src/jdk/nashorn/internal/codegen/OptimisticTypesCalculator.java src/jdk/nashorn/internal/codegen/OptimisticTypesPersistence.java src/jdk/nashorn/internal/codegen/ProgramPoints.java src/jdk/nashorn/internal/codegen/RuntimeCallSite.java src/jdk/nashorn/internal/codegen/SharedScopeCall.java src/jdk/nashorn/internal/codegen/SpillObjectCreator.java src/jdk/nashorn/internal/codegen/SplitMethodEmitter.java src/jdk/nashorn/internal/codegen/Splitter.java src/jdk/nashorn/internal/codegen/TypeEvaluator.java src/jdk/nashorn/internal/codegen/TypeMap.java src/jdk/nashorn/internal/codegen/WeighNodes.java src/jdk/nashorn/internal/codegen/types/ArrayType.java src/jdk/nashorn/internal/codegen/types/BitwiseType.java src/jdk/nashorn/internal/codegen/types/BooleanType.java src/jdk/nashorn/internal/codegen/types/BytecodeArrayOps.java src/jdk/nashorn/internal/codegen/types/BytecodeBitwiseOps.java src/jdk/nashorn/internal/codegen/types/BytecodeNumericOps.java src/jdk/nashorn/internal/codegen/types/BytecodeOps.java src/jdk/nashorn/internal/codegen/types/IntType.java src/jdk/nashorn/internal/codegen/types/LongType.java src/jdk/nashorn/internal/codegen/types/NumberType.java src/jdk/nashorn/internal/codegen/types/NumericType.java src/jdk/nashorn/internal/codegen/types/ObjectType.java src/jdk/nashorn/internal/codegen/types/Type.java src/jdk/nashorn/internal/ir/AccessNode.java src/jdk/nashorn/internal/ir/Assignment.java src/jdk/nashorn/internal/ir/BaseNode.java src/jdk/nashorn/internal/ir/BinaryNode.java src/jdk/nashorn/internal/ir/Block.java src/jdk/nashorn/internal/ir/BlockLexicalContext.java src/jdk/nashorn/internal/ir/BlockStatement.java src/jdk/nashorn/internal/ir/BreakNode.java src/jdk/nashorn/internal/ir/BreakableNode.java src/jdk/nashorn/internal/ir/BreakableStatement.java src/jdk/nashorn/internal/ir/CallNode.java src/jdk/nashorn/internal/ir/CaseNode.java src/jdk/nashorn/internal/ir/CatchNode.java src/jdk/nashorn/internal/ir/ContinueNode.java src/jdk/nashorn/internal/ir/EmptyNode.java src/jdk/nashorn/internal/ir/Expression.java src/jdk/nashorn/internal/ir/ExpressionStatement.java src/jdk/nashorn/internal/ir/Flags.java src/jdk/nashorn/internal/ir/ForNode.java src/jdk/nashorn/internal/ir/FunctionCall.java src/jdk/nashorn/internal/ir/FunctionNode.java src/jdk/nashorn/internal/ir/IdentNode.java src/jdk/nashorn/internal/ir/IfNode.java src/jdk/nashorn/internal/ir/IndexNode.java src/jdk/nashorn/internal/ir/JoinPredecessor.java src/jdk/nashorn/internal/ir/JoinPredecessorExpression.java src/jdk/nashorn/internal/ir/JumpStatement.java src/jdk/nashorn/internal/ir/LabelNode.java src/jdk/nashorn/internal/ir/Labels.java src/jdk/nashorn/internal/ir/LexicalContext.java src/jdk/nashorn/internal/ir/LexicalContextExpression.java src/jdk/nashorn/internal/ir/LexicalContextNode.java src/jdk/nashorn/internal/ir/LexicalContextStatement.java src/jdk/nashorn/internal/ir/LiteralNode.java src/jdk/nashorn/internal/ir/LocalVariableConversion.java src/jdk/nashorn/internal/ir/LoopNode.java src/jdk/nashorn/internal/ir/Node.java src/jdk/nashorn/internal/ir/ObjectNode.java src/jdk/nashorn/internal/ir/Optimistic.java src/jdk/nashorn/internal/ir/OptimisticLexicalContext.java src/jdk/nashorn/internal/ir/PropertyKey.java src/jdk/nashorn/internal/ir/PropertyNode.java src/jdk/nashorn/internal/ir/ReturnNode.java src/jdk/nashorn/internal/ir/RuntimeNode.java src/jdk/nashorn/internal/ir/SplitNode.java src/jdk/nashorn/internal/ir/Statement.java src/jdk/nashorn/internal/ir/SwitchNode.java src/jdk/nashorn/internal/ir/Symbol.java src/jdk/nashorn/internal/ir/Terminal.java src/jdk/nashorn/internal/ir/TernaryNode.java src/jdk/nashorn/internal/ir/ThrowNode.java src/jdk/nashorn/internal/ir/TryNode.java src/jdk/nashorn/internal/ir/UnaryNode.java src/jdk/nashorn/internal/ir/VarNode.java src/jdk/nashorn/internal/ir/WhileNode.java src/jdk/nashorn/internal/ir/WithNode.java src/jdk/nashorn/internal/ir/annotations/Ignore.java src/jdk/nashorn/internal/ir/annotations/Immutable.java src/jdk/nashorn/internal/ir/annotations/Reference.java src/jdk/nashorn/internal/ir/debug/ASTWriter.java src/jdk/nashorn/internal/ir/debug/ClassHistogramElement.java src/jdk/nashorn/internal/ir/debug/JSONWriter.java src/jdk/nashorn/internal/ir/debug/NashornClassReader.java src/jdk/nashorn/internal/ir/debug/NashornTextifier.java src/jdk/nashorn/internal/ir/debug/ObjectSizeCalculator.java src/jdk/nashorn/internal/ir/debug/PrintVisitor.java src/jdk/nashorn/internal/ir/visitor/NodeOperatorVisitor.java src/jdk/nashorn/internal/ir/visitor/NodeVisitor.java src/jdk/nashorn/internal/lookup/Lookup.java src/jdk/nashorn/internal/lookup/MethodHandleFactory.java src/jdk/nashorn/internal/lookup/MethodHandleFunctionality.java src/jdk/nashorn/internal/objects/AccessorPropertyDescriptor.java src/jdk/nashorn/internal/objects/ArrayBufferView.java src/jdk/nashorn/internal/objects/BoundScriptFunctionImpl.java src/jdk/nashorn/internal/objects/DataPropertyDescriptor.java src/jdk/nashorn/internal/objects/GenericPropertyDescriptor.java src/jdk/nashorn/internal/objects/Global.java src/jdk/nashorn/internal/objects/NativeArguments.java src/jdk/nashorn/internal/objects/NativeArray.java src/jdk/nashorn/internal/objects/NativeArrayBuffer.java src/jdk/nashorn/internal/objects/NativeBoolean.java src/jdk/nashorn/internal/objects/NativeDataView.java src/jdk/nashorn/internal/objects/NativeDate.java src/jdk/nashorn/internal/objects/NativeDebug.java src/jdk/nashorn/internal/objects/NativeError.java src/jdk/nashorn/internal/objects/NativeEvalError.java src/jdk/nashorn/internal/objects/NativeFloat32Array.java src/jdk/nashorn/internal/objects/NativeFloat64Array.java src/jdk/nashorn/internal/objects/NativeFunction.java src/jdk/nashorn/internal/objects/NativeInt16Array.java src/jdk/nashorn/internal/objects/NativeInt32Array.java src/jdk/nashorn/internal/objects/NativeInt8Array.java src/jdk/nashorn/internal/objects/NativeJSAdapter.java src/jdk/nashorn/internal/objects/NativeJSON.java src/jdk/nashorn/internal/objects/NativeJava.java src/jdk/nashorn/internal/objects/NativeJavaImporter.java src/jdk/nashorn/internal/objects/NativeMath.java src/jdk/nashorn/internal/objects/NativeNumber.java src/jdk/nashorn/internal/objects/NativeObject.java src/jdk/nashorn/internal/objects/NativeRangeError.java src/jdk/nashorn/internal/objects/NativeReferenceError.java src/jdk/nashorn/internal/objects/NativeRegExp.java src/jdk/nashorn/internal/objects/NativeRegExpExecResult.java src/jdk/nashorn/internal/objects/NativeStrictArguments.java src/jdk/nashorn/internal/objects/NativeString.java src/jdk/nashorn/internal/objects/NativeSyntaxError.java src/jdk/nashorn/internal/objects/NativeTypeError.java src/jdk/nashorn/internal/objects/NativeURIError.java src/jdk/nashorn/internal/objects/NativeUint16Array.java src/jdk/nashorn/internal/objects/NativeUint32Array.java src/jdk/nashorn/internal/objects/NativeUint8Array.java src/jdk/nashorn/internal/objects/NativeUint8ClampedArray.java src/jdk/nashorn/internal/objects/PrototypeObject.java src/jdk/nashorn/internal/objects/ScriptFunctionImpl.java src/jdk/nashorn/internal/objects/annotations/Attribute.java src/jdk/nashorn/internal/objects/annotations/Constructor.java src/jdk/nashorn/internal/objects/annotations/Function.java src/jdk/nashorn/internal/objects/annotations/Getter.java src/jdk/nashorn/internal/objects/annotations/Optimistic.java src/jdk/nashorn/internal/objects/annotations/Property.java src/jdk/nashorn/internal/objects/annotations/ScriptClass.java src/jdk/nashorn/internal/objects/annotations/Setter.java src/jdk/nashorn/internal/objects/annotations/SpecializedConstructor.java src/jdk/nashorn/internal/objects/annotations/SpecializedFunction.java src/jdk/nashorn/internal/objects/annotations/Where.java src/jdk/nashorn/internal/objects/package-info.java src/jdk/nashorn/internal/parser/AbstractParser.java src/jdk/nashorn/internal/parser/DateParser.java src/jdk/nashorn/internal/parser/JSONParser.java src/jdk/nashorn/internal/parser/Lexer.java src/jdk/nashorn/internal/parser/Parser.java src/jdk/nashorn/internal/parser/Scanner.java src/jdk/nashorn/internal/parser/Token.java src/jdk/nashorn/internal/parser/TokenKind.java src/jdk/nashorn/internal/parser/TokenLookup.java src/jdk/nashorn/internal/parser/TokenStream.java src/jdk/nashorn/internal/parser/TokenType.java src/jdk/nashorn/internal/runtime/AccessorProperty.java src/jdk/nashorn/internal/runtime/ArgumentSetter.java src/jdk/nashorn/internal/runtime/BitVector.java src/jdk/nashorn/internal/runtime/CodeInstaller.java src/jdk/nashorn/internal/runtime/CodeStore.java src/jdk/nashorn/internal/runtime/CompiledFunction.java src/jdk/nashorn/internal/runtime/CompiledFunctions.java src/jdk/nashorn/internal/runtime/CompiledScript.java src/jdk/nashorn/internal/runtime/ConsString.java src/jdk/nashorn/internal/runtime/Context.java src/jdk/nashorn/internal/runtime/Debug.java src/jdk/nashorn/internal/runtime/DebuggerSupport.java src/jdk/nashorn/internal/runtime/DefaultPropertyAccess.java src/jdk/nashorn/internal/runtime/ECMAErrors.java src/jdk/nashorn/internal/runtime/ECMAException.java src/jdk/nashorn/internal/runtime/ErrorManager.java src/jdk/nashorn/internal/runtime/FinalScriptFunctionData.java src/jdk/nashorn/internal/runtime/FindProperty.java src/jdk/nashorn/internal/runtime/FunctionScope.java src/jdk/nashorn/internal/runtime/GlobalConstants.java src/jdk/nashorn/internal/runtime/GlobalFunctions.java src/jdk/nashorn/internal/runtime/JSErrorType.java src/jdk/nashorn/internal/runtime/JSONFunctions.java src/jdk/nashorn/internal/runtime/JSObjectListAdapter.java src/jdk/nashorn/internal/runtime/JSType.java src/jdk/nashorn/internal/runtime/ListAdapter.java src/jdk/nashorn/internal/runtime/NashornLoader.java src/jdk/nashorn/internal/runtime/NativeJavaPackage.java src/jdk/nashorn/internal/runtime/NumberToString.java src/jdk/nashorn/internal/runtime/OptimisticReturnFilters.java src/jdk/nashorn/internal/runtime/ParserException.java src/jdk/nashorn/internal/runtime/Property.java src/jdk/nashorn/internal/runtime/PropertyAccess.java src/jdk/nashorn/internal/runtime/PropertyDescriptor.java src/jdk/nashorn/internal/runtime/PropertyHashMap.java src/jdk/nashorn/internal/runtime/PropertyListeners.java src/jdk/nashorn/internal/runtime/PropertyMap.java src/jdk/nashorn/internal/runtime/QuotedStringTokenizer.java src/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java src/jdk/nashorn/internal/runtime/RewriteException.java src/jdk/nashorn/internal/runtime/Scope.java src/jdk/nashorn/internal/runtime/ScriptEnvironment.java src/jdk/nashorn/internal/runtime/ScriptFunction.java src/jdk/nashorn/internal/runtime/ScriptFunctionData.java src/jdk/nashorn/internal/runtime/ScriptLoader.java src/jdk/nashorn/internal/runtime/ScriptObject.java src/jdk/nashorn/internal/runtime/ScriptRuntime.java src/jdk/nashorn/internal/runtime/ScriptingFunctions.java src/jdk/nashorn/internal/runtime/SetMethodCreator.java src/jdk/nashorn/internal/runtime/Source.java src/jdk/nashorn/internal/runtime/SpillProperty.java src/jdk/nashorn/internal/runtime/StructureLoader.java src/jdk/nashorn/internal/runtime/Timing.java src/jdk/nashorn/internal/runtime/URIUtils.java src/jdk/nashorn/internal/runtime/Undefined.java src/jdk/nashorn/internal/runtime/UnwarrantedOptimismException.java src/jdk/nashorn/internal/runtime/UserAccessorProperty.java src/jdk/nashorn/internal/runtime/Version.java src/jdk/nashorn/internal/runtime/WithObject.java src/jdk/nashorn/internal/runtime/arrays/ArrayData.java src/jdk/nashorn/internal/runtime/arrays/ArrayFilter.java src/jdk/nashorn/internal/runtime/arrays/ArrayIndex.java src/jdk/nashorn/internal/runtime/arrays/ArrayLikeIterator.java src/jdk/nashorn/internal/runtime/arrays/ByteBufferArrayData.java src/jdk/nashorn/internal/runtime/arrays/ContinuousArrayData.java src/jdk/nashorn/internal/runtime/arrays/DeletedArrayFilter.java src/jdk/nashorn/internal/runtime/arrays/DeletedRangeArrayFilter.java src/jdk/nashorn/internal/runtime/arrays/EmptyArrayLikeIterator.java src/jdk/nashorn/internal/runtime/arrays/FrozenArrayFilter.java src/jdk/nashorn/internal/runtime/arrays/IntArrayData.java src/jdk/nashorn/internal/runtime/arrays/InvalidArrayIndexException.java src/jdk/nashorn/internal/runtime/arrays/IteratorAction.java src/jdk/nashorn/internal/runtime/arrays/JSObjectIterator.java src/jdk/nashorn/internal/runtime/arrays/JavaArrayIterator.java src/jdk/nashorn/internal/runtime/arrays/JavaListIterator.java src/jdk/nashorn/internal/runtime/arrays/LongArrayData.java src/jdk/nashorn/internal/runtime/arrays/NoTypeArrayData.java src/jdk/nashorn/internal/runtime/arrays/NumberArrayData.java src/jdk/nashorn/internal/runtime/arrays/ObjectArrayData.java src/jdk/nashorn/internal/runtime/arrays/ReverseJSObjectIterator.java src/jdk/nashorn/internal/runtime/arrays/ReverseJavaArrayIterator.java src/jdk/nashorn/internal/runtime/arrays/ReverseJavaListIterator.java src/jdk/nashorn/internal/runtime/arrays/ReverseScriptArrayIterator.java src/jdk/nashorn/internal/runtime/arrays/ReverseScriptObjectIterator.java src/jdk/nashorn/internal/runtime/arrays/ScriptArrayIterator.java src/jdk/nashorn/internal/runtime/arrays/ScriptObjectIterator.java src/jdk/nashorn/internal/runtime/arrays/SealedArrayFilter.java src/jdk/nashorn/internal/runtime/arrays/SparseArrayData.java src/jdk/nashorn/internal/runtime/arrays/TypedArrayData.java src/jdk/nashorn/internal/runtime/arrays/UndefinedArrayFilter.java src/jdk/nashorn/internal/runtime/events/RecompilationEvent.java src/jdk/nashorn/internal/runtime/events/RuntimeEvent.java src/jdk/nashorn/internal/runtime/linker/AdaptationException.java src/jdk/nashorn/internal/runtime/linker/AdaptationResult.java src/jdk/nashorn/internal/runtime/linker/Bootstrap.java src/jdk/nashorn/internal/runtime/linker/BoundDynamicMethod.java src/jdk/nashorn/internal/runtime/linker/BoundDynamicMethodLinker.java src/jdk/nashorn/internal/runtime/linker/ClassAndLoader.java src/jdk/nashorn/internal/runtime/linker/InvokeByName.java src/jdk/nashorn/internal/runtime/linker/JSObjectLinker.java src/jdk/nashorn/internal/runtime/linker/JavaAdapterBytecodeGenerator.java src/jdk/nashorn/internal/runtime/linker/JavaAdapterClassLoader.java src/jdk/nashorn/internal/runtime/linker/JavaAdapterFactory.java src/jdk/nashorn/internal/runtime/linker/JavaAdapterServices.java src/jdk/nashorn/internal/runtime/linker/JavaArgumentConverters.java src/jdk/nashorn/internal/runtime/linker/JavaSuperAdapter.java src/jdk/nashorn/internal/runtime/linker/JavaSuperAdapterLinker.java src/jdk/nashorn/internal/runtime/linker/LinkerCallSite.java src/jdk/nashorn/internal/runtime/linker/NashornBeansLinker.java src/jdk/nashorn/internal/runtime/linker/NashornBottomLinker.java src/jdk/nashorn/internal/runtime/linker/NashornCallSiteDescriptor.java src/jdk/nashorn/internal/runtime/linker/NashornGuards.java src/jdk/nashorn/internal/runtime/linker/NashornLinker.java src/jdk/nashorn/internal/runtime/linker/NashornPrimitiveLinker.java src/jdk/nashorn/internal/runtime/linker/NashornStaticClassLinker.java src/jdk/nashorn/internal/runtime/linker/PrimitiveLookup.java src/jdk/nashorn/internal/runtime/linker/ReflectionCheckLinker.java src/jdk/nashorn/internal/runtime/logging/DebugLogger.java src/jdk/nashorn/internal/runtime/logging/Loggable.java src/jdk/nashorn/internal/runtime/logging/Logger.java src/jdk/nashorn/internal/runtime/options/KeyValueOption.java src/jdk/nashorn/internal/runtime/options/LoggingOption.java src/jdk/nashorn/internal/runtime/options/Option.java src/jdk/nashorn/internal/runtime/options/OptionTemplate.java src/jdk/nashorn/internal/runtime/options/Options.java src/jdk/nashorn/internal/runtime/regexp/JdkRegExp.java src/jdk/nashorn/internal/runtime/regexp/JoniRegExp.java src/jdk/nashorn/internal/runtime/regexp/RegExp.java src/jdk/nashorn/internal/runtime/regexp/RegExpFactory.java src/jdk/nashorn/internal/runtime/regexp/RegExpMatcher.java src/jdk/nashorn/internal/runtime/regexp/RegExpResult.java src/jdk/nashorn/internal/runtime/regexp/RegExpScanner.java src/jdk/nashorn/internal/runtime/regexp/joni/Analyser.java src/jdk/nashorn/internal/runtime/regexp/joni/ApplyCaseFold.java src/jdk/nashorn/internal/runtime/regexp/joni/ApplyCaseFoldArg.java src/jdk/nashorn/internal/runtime/regexp/joni/ArrayCompiler.java src/jdk/nashorn/internal/runtime/regexp/joni/BitSet.java src/jdk/nashorn/internal/runtime/regexp/joni/BitStatus.java src/jdk/nashorn/internal/runtime/regexp/joni/ByteCodeMachine.java src/jdk/nashorn/internal/runtime/regexp/joni/ByteCodePrinter.java src/jdk/nashorn/internal/runtime/regexp/joni/CodeRangeBuffer.java src/jdk/nashorn/internal/runtime/regexp/joni/Compiler.java src/jdk/nashorn/internal/runtime/regexp/joni/Config.java src/jdk/nashorn/internal/runtime/regexp/joni/EncodingHelper.java src/jdk/nashorn/internal/runtime/regexp/joni/Lexer.java src/jdk/nashorn/internal/runtime/regexp/joni/Matcher.java src/jdk/nashorn/internal/runtime/regexp/joni/MatcherFactory.java src/jdk/nashorn/internal/runtime/regexp/joni/MinMaxLen.java src/jdk/nashorn/internal/runtime/regexp/joni/NodeOptInfo.java src/jdk/nashorn/internal/runtime/regexp/joni/OptAnchorInfo.java src/jdk/nashorn/internal/runtime/regexp/joni/OptEnvironment.java src/jdk/nashorn/internal/runtime/regexp/joni/OptExactInfo.java src/jdk/nashorn/internal/runtime/regexp/joni/OptMapInfo.java src/jdk/nashorn/internal/runtime/regexp/joni/Option.java src/jdk/nashorn/internal/runtime/regexp/joni/Parser.java src/jdk/nashorn/internal/runtime/regexp/joni/Regex.java src/jdk/nashorn/internal/runtime/regexp/joni/Region.java src/jdk/nashorn/internal/runtime/regexp/joni/ScanEnvironment.java src/jdk/nashorn/internal/runtime/regexp/joni/ScannerSupport.java src/jdk/nashorn/internal/runtime/regexp/joni/SearchAlgorithm.java src/jdk/nashorn/internal/runtime/regexp/joni/StackEntry.java src/jdk/nashorn/internal/runtime/regexp/joni/StackMachine.java src/jdk/nashorn/internal/runtime/regexp/joni/Syntax.java src/jdk/nashorn/internal/runtime/regexp/joni/Token.java src/jdk/nashorn/internal/runtime/regexp/joni/WarnCallback.java src/jdk/nashorn/internal/runtime/regexp/joni/Warnings.java src/jdk/nashorn/internal/runtime/regexp/joni/ast/AnchorNode.java src/jdk/nashorn/internal/runtime/regexp/joni/ast/AnyCharNode.java src/jdk/nashorn/internal/runtime/regexp/joni/ast/BackRefNode.java src/jdk/nashorn/internal/runtime/regexp/joni/ast/CClassNode.java src/jdk/nashorn/internal/runtime/regexp/joni/ast/ConsAltNode.java src/jdk/nashorn/internal/runtime/regexp/joni/ast/EncloseNode.java src/jdk/nashorn/internal/runtime/regexp/joni/ast/Node.java src/jdk/nashorn/internal/runtime/regexp/joni/ast/QuantifierNode.java src/jdk/nashorn/internal/runtime/regexp/joni/ast/StateNode.java src/jdk/nashorn/internal/runtime/regexp/joni/ast/StringNode.java src/jdk/nashorn/internal/runtime/regexp/joni/constants/AnchorType.java src/jdk/nashorn/internal/runtime/regexp/joni/constants/Arguments.java src/jdk/nashorn/internal/runtime/regexp/joni/constants/AsmConstants.java src/jdk/nashorn/internal/runtime/regexp/joni/constants/CCSTATE.java src/jdk/nashorn/internal/runtime/regexp/joni/constants/CCVALTYPE.java src/jdk/nashorn/internal/runtime/regexp/joni/constants/EncloseType.java src/jdk/nashorn/internal/runtime/regexp/joni/constants/MetaChar.java src/jdk/nashorn/internal/runtime/regexp/joni/constants/NodeStatus.java src/jdk/nashorn/internal/runtime/regexp/joni/constants/NodeType.java src/jdk/nashorn/internal/runtime/regexp/joni/constants/OPCode.java src/jdk/nashorn/internal/runtime/regexp/joni/constants/OPSize.java src/jdk/nashorn/internal/runtime/regexp/joni/constants/RegexState.java src/jdk/nashorn/internal/runtime/regexp/joni/constants/StackPopLevel.java src/jdk/nashorn/internal/runtime/regexp/joni/constants/StackType.java src/jdk/nashorn/internal/runtime/regexp/joni/constants/StringType.java src/jdk/nashorn/internal/runtime/regexp/joni/constants/SyntaxProperties.java src/jdk/nashorn/internal/runtime/regexp/joni/constants/TargetInfo.java src/jdk/nashorn/internal/runtime/regexp/joni/constants/TokenType.java src/jdk/nashorn/internal/runtime/regexp/joni/constants/Traverse.java src/jdk/nashorn/internal/runtime/regexp/joni/encoding/CharacterType.java src/jdk/nashorn/internal/runtime/regexp/joni/encoding/IntHolder.java src/jdk/nashorn/internal/runtime/regexp/joni/encoding/ObjPtr.java src/jdk/nashorn/internal/runtime/regexp/joni/exception/ErrorMessages.java src/jdk/nashorn/internal/runtime/regexp/joni/exception/InternalException.java src/jdk/nashorn/internal/runtime/regexp/joni/exception/JOniException.java src/jdk/nashorn/internal/runtime/regexp/joni/exception/SyntaxException.java src/jdk/nashorn/internal/runtime/regexp/joni/exception/ValueException.java src/jdk/nashorn/internal/runtime/resources/Messages.properties src/jdk/nashorn/internal/runtime/resources/Options.properties src/jdk/nashorn/internal/runtime/resources/fx/base.js src/jdk/nashorn/internal/runtime/resources/fx/bootstrap.js src/jdk/nashorn/internal/runtime/resources/fx/controls.js src/jdk/nashorn/internal/runtime/resources/fx/fxml.js src/jdk/nashorn/internal/runtime/resources/fx/graphics.js src/jdk/nashorn/internal/runtime/resources/fx/media.js src/jdk/nashorn/internal/runtime/resources/fx/swing.js src/jdk/nashorn/internal/runtime/resources/fx/swt.js src/jdk/nashorn/internal/runtime/resources/fx/web.js src/jdk/nashorn/internal/runtime/resources/mozilla_compat.js src/jdk/nashorn/internal/runtime/resources/parser.js src/jdk/nashorn/internal/runtime/resources/version.properties-template src/jdk/nashorn/internal/scripts/JO.java src/jdk/nashorn/internal/scripts/JS.java src/jdk/nashorn/tools/Shell.java src/jdk/nashorn/tools/resources/Shell.properties src/jdk/nashorn/tools/resources/shell.js src/overview.html
diffstat 991 files changed, 144859 insertions(+), 144853 deletions(-) [+]
line wrap: on
line diff
--- a/make/BuildNashorn.gmk	Sun Aug 10 19:39:07 2014 -0700
+++ b/make/BuildNashorn.gmk	Sun Aug 17 15:56:32 2014 +0100
@@ -30,7 +30,8 @@
 include MakeBase.gmk
 include JavaCompilation.gmk
 
-JDK_CLASSES := $(JDK_OUTPUTDIR)/classes
+JDK_CLASSES := $(subst $(SPACE),$(PATH_SEP),$(strip $(addprefix $(JDK_OUTPUTDIR)/modules/, \
+      java.base java.logging java.scripting)))
 
 NASHORN_JAR := $(NASHORN_DIST)/nashorn.jar
 NASHORN_VERSION := $(JDK_VERSION)
@@ -46,19 +47,19 @@
 $(eval $(call SetupJavaCompiler,GENERATE_NEWBYTECODE_DEBUG, \
     JVM := $(JAVA), \
     JAVAC := $(NEW_JAVAC), \
-    FLAGS := -g -source 7 -target 7 -bootclasspath $(JDK_CLASSES), \
+    FLAGS := -g -source 7 -target 7 -bootclasspath "$(JDK_CLASSES)", \
     SERVER_DIR := $(SJAVAC_SERVER_DIR), \
     SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
 
 # Build nashorn into intermediate directory
 $(eval $(call SetupJavaCompilation,BUILD_NASHORN, \
     SETUP := GENERATE_NEWBYTECODE_DEBUG, \
-    SRC := $(NASHORN_TOPDIR)/src, \
+    SRC := $(NASHORN_TOPDIR)/src/jdk.scripting.nashorn/share/classes, \
     COPY := .properties .js, \
     BIN := $(NASHORN_OUTPUTDIR)/nashorn_classes))
 
 NASGEN_SRC := $(NASHORN_TOPDIR)/buildtools/nasgen/src
-ASM_SRC := $(JDK_TOPDIR)/src/share/classes/jdk/internal/org/objectweb/asm
+ASM_SRC := $(JDK_TOPDIR)/src/java.base/share/classes/jdk/internal/org/objectweb/asm
 
 # Build nasgen
 $(eval $(call SetupJavaCompilation,BUILD_NASGEN, \
@@ -70,8 +71,11 @@
 # Nasgen needs nashorn classes
 $(BUILD_NASGEN): $(BUILD_NASHORN)
 
+NASHORN_CLASSES_DIR := $(JDK_OUTPUTDIR)/modules/jdk.scripting.nashorn
+NASGEN_RUN_FILE := $(NASHORN_CLASSES_DIR)/_the.nasgen.run
+
 # Copy classes to final classes dir and run nasgen to modify classes in jdk.nashorn.internal.objects package
-$(NASHORN_OUTPUTDIR)/classes/_the.nasgen.run: $(BUILD_NASGEN)
+$(NASGEN_RUN_FILE): $(BUILD_NASGEN)
 	$(ECHO) Running nasgen
 	$(MKDIR) -p $(@D)
 	$(RM) -rf $(@D)/jdk $(@D)/netscape
@@ -82,11 +86,12 @@
 	$(TOUCH) $@
 
 # Version file needs to be processed with version numbers
-VERSION_FILE := $(NASHORN_OUTPUTDIR)/classes/jdk/nashorn/internal/runtime/resources/version.properties
+VERSION_FILE := $(JDK_OUTPUTDIR)/modules/jdk.scripting.nashorn/jdk/nashorn/internal/runtime/resources/version.properties
+VERSION_SRC := $(NASHORN_TOPDIR)/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/version.properties-template
 
 # Needs to happen after nasgen run since nasgen run deletes it
-$(VERSION_FILE): $(NASHORN_OUTPUTDIR)/classes/_the.nasgen.run
-$(VERSION_FILE): $(NASHORN_TOPDIR)/src/jdk/nashorn/internal/runtime/resources/version.properties-template
+$(VERSION_FILE): $(NASGEN_RUN_FILE)
+$(VERSION_FILE): $(VERSION_SRC)
 	$(ECHO) Creating version.properties
 	$(MKDIR) -p $(@D)
 	$(CAT) $< | $(SED) -e 's/$$(FULL_VERSION)/$(NASHORN_FULL_VERSION)/g' \
@@ -98,15 +103,16 @@
 
 # Create nashorn.jar from the final classes dir
 $(eval $(call SetupArchive,BUILD_NASHORN_JAR, \
-    $(NASHORN_OUTPUTDIR)/classes/_the.nasgen.run \
+    $(NASGEN_RUN_FILE) \
     $(VERSION_FILE), \
-    SRCS := $(NASHORN_OUTPUTDIR)/classes, \
+    SRCS := $(NASHORN_CLASSES_DIR), \
     SUFFIXES := .class .js .properties Factory, \
-    MANIFEST := $(NASHORN_TOPDIR)/src/META-INF/MANIFEST.MF, \
+    MANIFEST := $(NASHORN_TOPDIR)/src/jdk.scripting.nashorn/share/classes/META-INF/MANIFEST.MF, \
     EXTRA_MANIFEST_ATTR := $(MANIFEST_ATTRIBUTES), \
     SKIP_METAINF := true, \
     JAR := $(NASHORN_JAR)))
 
+compile: $(NASHORN_RUN_FILE) $(VERSION_FILE)
 all: $(NASHORN_JAR)
 
-.PHONY: all
+.PHONY: compile all
--- a/src/META-INF/MANIFEST.MF	Sun Aug 10 19:39:07 2014 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-Manifest-Version: 1.0
-Main-Class: jdk.nashorn.tools.Shell
-
-Name: jdk/nashorn/
-Implementation-Vendor: Oracle Corporation
--- a/src/META-INF/services/javax.script.ScriptEngineFactory	Sun Aug 10 19:39:07 2014 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-#
-# Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.  Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-jdk.nashorn.api.scripting.NashornScriptEngineFactory
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.scripting.nashorn/share/classes/META-INF/MANIFEST.MF	Sun Aug 17 15:56:32 2014 +0100
@@ -0,0 +1,5 @@
+Manifest-Version: 1.0
+Main-Class: jdk.nashorn.tools.Shell
+
+Name: jdk/nashorn/
+Implementation-Vendor: Oracle Corporation
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.scripting.nashorn/share/classes/META-INF/services/javax.script.ScriptEngineFactory	Sun Aug 17 15:56:32 2014 +0100
@@ -0,0 +1,25 @@
+#
+# Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+jdk.nashorn.api.scripting.NashornScriptEngineFactory
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/CallSiteDescriptor.java	Sun Aug 17 15:56:32 2014 +0100
@@ -0,0 +1,174 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file, and Oracle licenses the original version of this file under the BSD
+ * license:
+ */
+/*
+   Copyright 2009-2013 Attila Szegedi
+
+   Licensed under both the Apache License, Version 2.0 (the "Apache License")
+   and the BSD License (the "BSD License"), with licensee being free to
+   choose either of the two at their discretion.
+
+   You may not use this file except in compliance with either the Apache
+   License or the BSD License.
+
+   If you choose to use this file in compliance with the Apache License, the
+   following notice applies to you:
+
+       You may obtain a copy of the Apache License at
+
+           http://www.apache.org/licenses/LICENSE-2.0
+
+       Unless required by applicable law or agreed to in writing, software
+       distributed under the License is distributed on an "AS IS" BASIS,
+       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+       implied. See the License for the specific language governing
+       permissions and limitations under the License.
+
+   If you choose to use this file in compliance with the BSD License, the
+   following notice applies to you:
+
+       Redistribution and use in source and binary forms, with or without
+       modification, are permitted provided that the following conditions are
+       met:
+       * Redistributions of source code must retain the above copyright
+         notice, this list of conditions and the following disclaimer.
+       * Redistributions in binary form must reproduce the above copyright
+         notice, this list of conditions and the following disclaimer in the
+         documentation and/or other materials provided with the distribution.
+       * Neither the name of the copyright holder nor the names of
+         contributors may be used to endorse or promote products derived from
+         this software without specific prior written permission.
+
+       THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+       IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+       TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+       PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER
+       BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+       CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+       SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+       BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+       WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+       OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+       ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+package jdk.internal.dynalink;
+
+import java.lang.invoke.MethodHandles.Lookup;
+import java.lang.invoke.MethodType;
+import jdk.internal.dynalink.support.CallSiteDescriptorFactory;
+
+/**
+ * An immutable descriptor of a call site. It is an immutable object that contains all the information about a call
+ * site: the class performing the lookups, the name of the method being invoked, and the method signature. The library
+ * has a default {@link CallSiteDescriptorFactory} for descriptors that you can use, or you can create your own
+ * descriptor classes, especially if you need to add further information (values passed in additional parameters to the
+ * bootstrap method) to them. Call site descriptors are used in this library in place of passing a real call site to
+ * guarding linkers so they aren't tempted to directly manipulate the call sites. The constructors of built-in
+ * {@link RelinkableCallSite} implementations all need a call site descriptor. Even if you create your own call site
+ * descriptors consider using {@link CallSiteDescriptorFactory#tokenizeName(String)} in your implementation.
+ *
+ * @author Attila Szegedi
+ */
+public interface CallSiteDescriptor {
+    /**
+     * The index of the name token that will carry the operation scheme prefix (usually, "dyn").
+     */
+    public static final int SCHEME = 0;
+    /**
+     * The index of the name token that will usually carry the operation name.
+     */
+
+    public static final int OPERATOR=1;
+    /**
+     * The index of the name token that will usually carry a name of an operand (of a property, method, etc.)
+     */
+
+    public static final int NAME_OPERAND=2;
+
+    /**
+     * Character used to delimit tokens in an call site name.
+     */
+    public static final String TOKEN_DELIMITER = ":";
+
+    /**
+     * Character used to delimit operation names in a composite operation specification.
+     */
+    public static final String OPERATOR_DELIMITER = "|";
+
+    /**
+     * Returns the number of tokens in the name of the method at the call site. Method names are tokenized with the
+     * colon ":" character, i.e. "dyn:getProp:color" would be the name used to describe a method that retrieves the
+     * property named "color" on the object it is invoked on.
+     * @return the number of tokens in the name of the method at the call site.
+     */
+    public int getNameTokenCount();
+
+    /**
+     * Returns the <i>i<sup>th</sup></i> token in the method name at the call site. Method names are tokenized with the
+     * colon ":" character.
+     * @param i the index of the token. Must be between 0 (inclusive) and {@link #getNameTokenCount()} (exclusive)
+     * @throws IllegalArgumentException if the index is outside the allowed range.
+     * @return the <i>i<sup>th</sup></i> token in the method name at the call site. The returned strings are interned.
+     */
+    public String getNameToken(int i);
+
+    /**
+     * Returns the name of the method at the call site. Note that the object internally only stores the tokenized name,
+     * and has to reconstruct the full name from tokens on each invocation.
+     * @return the name of the method at the call site.
+     */
+    public String getName();
+
+    /**
+     * The type of the method at the call site.
+     *
+     * @return type of the method at the call site.
+     */
+    public MethodType getMethodType();
+
+    /**
+     * Returns the lookup passed to the bootstrap method.
+     * @return the lookup passed to the bootstrap method.
+     */
+    public Lookup getLookup();
+
+    /**
+     * Creates a new call site descriptor from this descriptor, which is identical to this, except it changes the method
+     * type.
+     *
+     * @param newMethodType the new method type
+     * @return a new call site descriptor, with the method type changed.
+     */
+    public CallSiteDescriptor changeMethodType(MethodType newMethodType);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/ChainedCallSite.java	Sun Aug 17 15:56:32 2014 +0100
@@ -0,0 +1,237 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file, and Oracle licenses the original version of this file under the BSD
+ * license:
+ */
+/*
+   Copyright 2009-2013 Attila Szegedi
+
+   Licensed under both the Apache License, Version 2.0 (the "Apache License")
+   and the BSD License (the "BSD License"), with licensee being free to
+   choose either of the two at their discretion.
+
+   You may not use this file except in compliance with either the Apache
+   License or the BSD License.
+
+   If you choose to use this file in compliance with the Apache License, the
+   following notice applies to you:
+
+       You may obtain a copy of the Apache License at
+
+           http://www.apache.org/licenses/LICENSE-2.0
+
+       Unless required by applicable law or agreed to in writing, software
+       distributed under the License is distributed on an "AS IS" BASIS,
+       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+       implied. See the License for the specific language governing
+       permissions and limitations under the License.
+
+   If you choose to use this file in compliance with the BSD License, the
+   following notice applies to you:
+
+       Redistribution and use in source and binary forms, with or without
+       modification, are permitted provided that the following conditions are
+       met:
+       * Redistributions of source code must retain the above copyright
+         notice, this list of conditions and the following disclaimer.
+       * Redistributions in binary form must reproduce the above copyright
+         notice, this list of conditions and the following disclaimer in the
+         documentation and/or other materials provided with the distribution.
+       * Neither the name of the copyright holder nor the names of
+         contributors may be used to endorse or promote products derived from
+         this software without specific prior written permission.
+
+       THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+       IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+       TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+       PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER
+       BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+       CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+       SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+       BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+       WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+       OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+       ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+package jdk.internal.dynalink;
+
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.concurrent.atomic.AtomicReference;
+import jdk.internal.dynalink.linker.GuardedInvocation;
+import jdk.internal.dynalink.support.AbstractRelinkableCallSite;
+import jdk.internal.dynalink.support.Lookup;
+
+/**
+ * A relinkable call site that maintains a chain of linked method handles. In the default implementation, up to 8 method
+ * handles can be chained, cascading from one to the other through
+ * {@link MethodHandles#guardWithTest(MethodHandle, MethodHandle, MethodHandle)}. When this call site has to link a new
+ * method handle and the length of the chain is already at the maximum, it will throw away the oldest method handle.
+ * Switchpoint-invalidated handles in the chain are removed eagerly (on each linking request, and whenever a
+ * switchpoint-invalidated method handle is traversed during invocation). There is currently no profiling
+ * attached to the handles in the chain, so they are never reordered based on usage; the most recently linked method
+ * handle is always at the start of the chain.
+ */
+public class ChainedCallSite extends AbstractRelinkableCallSite {
+    private static final MethodHandle PRUNE_CATCHES =
+            MethodHandles.insertArguments(
+                    Lookup.findOwnSpecial(
+                            MethodHandles.lookup(),
+                            "prune",
+                            MethodHandle.class,
+                            MethodHandle.class,
+                            boolean.class),
+                    2,
+                    true);
+
+    private static final MethodHandle PRUNE_SWITCHPOINTS =
+            MethodHandles.insertArguments(
+                    Lookup.findOwnSpecial(
+                            MethodHandles.lookup(),
+                            "prune",
+                            MethodHandle.class,
+                            MethodHandle.class,
+                            boolean.class),
+                    2,
+                    false);
+
+    private final AtomicReference<LinkedList<GuardedInvocation>> invocations = new AtomicReference<>();
+
+    /**
+     * Creates a new chained call site.
+     * @param descriptor the descriptor for the call site.
+     */
+    public ChainedCallSite(final CallSiteDescriptor descriptor) {
+        super(descriptor);
+    }
+
+    /**
+     * The maximum number of method handles in the chain. Defaults to 8. You can override it in a subclass if you need
+     * to change the value. If your override returns a value less than 1, the code will break.
+     * @return the maximum number of method handles in the chain.
+     */
+    protected int getMaxChainLength() {
+        return 8;
+    }
+
+    @Override
+    public void relink(final GuardedInvocation guardedInvocation, final MethodHandle fallback) {
+        relinkInternal(guardedInvocation, fallback, false, false);
+    }
+
+    @Override
+    public void resetAndRelink(final GuardedInvocation guardedInvocation, final MethodHandle fallback) {
+        relinkInternal(guardedInvocation, fallback, true, false);
+    }
+
+    private MethodHandle relinkInternal(final GuardedInvocation invocation, final MethodHandle relink, final boolean reset, final boolean removeCatches) {
+        final LinkedList<GuardedInvocation> currentInvocations = invocations.get();
+        @SuppressWarnings({ "unchecked", "rawtypes" })
+        final LinkedList<GuardedInvocation> newInvocations =
+            currentInvocations == null || reset ? new LinkedList<>() : (LinkedList)currentInvocations.clone();
+
+        // First, prune the chain of invalidated switchpoints, we always do this
+        // We also remove any catches if the remove catches flag is set
+        for(final Iterator<GuardedInvocation> it = newInvocations.iterator(); it.hasNext();) {
+            final GuardedInvocation inv = it.next();
+            if(inv.hasBeenInvalidated() || (removeCatches && inv.getException() != null)) {
+                it.remove();
+            }
+        }
+
+        // prune() is allowed to invoke this method with invocation == null meaning we're just pruning the chain and not
+        // adding any new invocations to it.
+        if(invocation != null) {
+            // Remove oldest entry if we're at max length
+            if(newInvocations.size() == getMaxChainLength()) {
+                newInvocations.removeFirst();
+            }
+            newInvocations.addLast(invocation);
+        }
+
+        // prune-and-invoke is used as the fallback for invalidated switchpoints. If a switchpoint gets invalidated, we
+        // rebuild the chain and get rid of all invalidated switchpoints instead of letting them linger.
+        final MethodHandle pruneAndInvokeSwitchPoints = makePruneAndInvokeMethod(relink, getPruneSwitchpoints());
+        final MethodHandle pruneAndInvokeCatches      = makePruneAndInvokeMethod(relink, getPruneCatches());
+
+        // Fold the new chain
+        MethodHandle target = relink;
+        for(final GuardedInvocation inv: newInvocations) {
+            target = inv.compose(target, pruneAndInvokeSwitchPoints, pruneAndInvokeCatches);
+        }
+
+        // If nobody else updated the call site while we were rebuilding the chain, set the target to our chain. In case
+        // we lost the race for multithreaded update, just do nothing. Either the other thread installed the same thing
+        // we wanted to install, or otherwise, we'll be asked to relink again.
+        if(invocations.compareAndSet(currentInvocations, newInvocations)) {
+            setTarget(target);
+        }
+        return target;
+    }
+
+    /**
+     * Get the switchpoint pruning function for a chained call site
+     * @return function that removes invalidated switchpoints tied to callsite guard chain and relinks
+     */
+    protected MethodHandle getPruneSwitchpoints() {
+        return PRUNE_SWITCHPOINTS;
+    }
+
+    /**
+     * Get the catch pruning function for a chained call site
+     * @return function that removes all catches tied to callsite guard chain and relinks
+     */
+    protected MethodHandle getPruneCatches() {
+        return PRUNE_CATCHES;
+    }
+
+    /**
+     * Creates a method that rebuilds our call chain, pruning it of any invalidated switchpoints, and then invokes that
+     * chain.
+     * @param relink the ultimate fallback for the chain (the {@code DynamicLinker}'s relink).
+     * @return a method handle for prune-and-invoke
+     */
+    private MethodHandle makePruneAndInvokeMethod(final MethodHandle relink, final MethodHandle prune) {
+        // Bind prune to (this, relink)
+        final MethodHandle boundPrune = MethodHandles.insertArguments(prune, 0, this, relink);
+        // Make it ignore all incoming arguments
+        final MethodHandle ignoreArgsPrune = MethodHandles.dropArguments(boundPrune, 0, type().parameterList());
+        // Invoke prune, then invoke the call site target with original arguments
+        return MethodHandles.foldArguments(MethodHandles.exactInvoker(type()), ignoreArgsPrune);
+    }
+
+    @SuppressWarnings("unused")
+    private MethodHandle prune(final MethodHandle relink, final boolean catches) {
+        return relinkInternal(null, relink, false, catches);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/DefaultBootstrapper.java	Sun Aug 17 15:56:32 2014 +0100
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file, and Oracle licenses the original version of this file under the BSD
+ * license:
+ */
+/*
+   Copyright 2009-2013 Attila Szegedi
+
+   Licensed under both the Apache License, Version 2.0 (the "Apache License")
+   and the BSD License (the "BSD License"), with licensee being free to
+   choose either of the two at their discretion.
+
+   You may not use this file except in compliance with either the Apache
+   License or the BSD License.
+
+   If you choose to use this file in compliance with the Apache License, the
+   following notice applies to you:
+
+       You may obtain a copy of the Apache License at
+
+           http://www.apache.org/licenses/LICENSE-2.0
+
+       Unless required by applicable law or agreed to in writing, software
+       distributed under the License is distributed on an "AS IS" BASIS,
+       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+       implied. See the License for the specific language governing
+       permissions and limitations under the License.
+
+   If you choose to use this file in compliance with the BSD License, the
+   following notice applies to you:
+
+       Redistribution and use in source and binary forms, with or without
+       modification, are permitted provided that the following conditions are
+       met:
+       * Redistributions of source code must retain the above copyright
+         notice, this list of conditions and the following disclaimer.
+       * Redistributions in binary form must reproduce the above copyright
+         notice, this list of conditions and the following disclaimer in the
+         documentation and/or other materials provided with the distribution.
+       * Neither the name of the copyright holder nor the names of
+         contributors may be used to endorse or promote products derived from
+         this software without specific prior written permission.
+
+       THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+       IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+       TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+       PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER
+       BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+       CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+       SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+       BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+       WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+       OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+       ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+package jdk.internal.dynalink;
+
+import java.lang.invoke.CallSite;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodType;
+import jdk.internal.dynalink.support.CallSiteDescriptorFactory;
+
+/**
+ * A convenience default bootstrapper that exposes static bootstrap methods which language runtimes that need the very
+ * default behavior can use with minimal setup. When first referenced, it will create a dynamic linker with default
+ * settings for the {@link DynamicLinkerFactory}, and its bootstrap methods will create {@link MonomorphicCallSite} for
+ * all call sites. It has two bootstrap methods: one creates call sites that use the
+ * {@link MethodHandles#publicLookup()} as the lookup for all call sites and disregard the one passed in as the caller,
+ * and one that just uses the passed caller as the lookup scope. Using the public lookup one is advised if your language
+ * runtime has no concept of interacting with Java visibility scopes, as it results in a more lightweight runtime
+ * information.
+ *
+ * @author Attila Szegedi
+ */
+public class DefaultBootstrapper {
+    private static final DynamicLinker dynamicLinker = new DynamicLinkerFactory().createLinker();
+
+    private DefaultBootstrapper() {
+    }
+
+    /**
+     * Use this method as your bootstrap method (see the documentation of the java.lang.invoke package for how to do
+     * this). In case your language runtime doesn't have a concept of interaction with Java access scopes, you might
+     * want to consider using
+     * {@link #publicBootstrap(java.lang.invoke.MethodHandles.Lookup, String, MethodType)} instead.
+     *
+     * @param caller the caller's lookup
+     * @param name the name of the method at the call site
+     * @param type the method signature at the call site
+     * @return a new {@link MonomorphicCallSite} linked with the default dynamic linker.
+     */
+    public static CallSite bootstrap(final MethodHandles.Lookup caller, final String name, final MethodType type) {
+        return bootstrapInternal(caller, name, type);
+    }
+
+    /**
+     * Use this method as your bootstrap method (see the documentation of the java.lang.invoke package for how to do
+     * this) when your language runtime doesn't have a concept of interaction with Java access scopes. If you need to
+     * preserve the different caller Lookup objects in the call sites, use
+     * {@link #bootstrap(java.lang.invoke.MethodHandles.Lookup, String, MethodType)} instead
+     *
+     * @param caller the caller's lookup. It is ignored as the call sites will be created with
+     * {@link MethodHandles#publicLookup()} instead.
+     * @param name the name of the method at the call site
+     * @param type the method signature at the call site
+     * @return a new {@link MonomorphicCallSite} linked with the default dynamic linker.
+     */
+    public static CallSite publicBootstrap(final MethodHandles.Lookup caller, final String name, final MethodType type) {
+        return bootstrapInternal(MethodHandles.publicLookup(), name, type);
+    }
+
+    private static CallSite bootstrapInternal(final MethodHandles.Lookup caller, final String name, final MethodType type) {
+        return dynamicLinker.link(new MonomorphicCallSite(CallSiteDescriptorFactory.create(caller, name, type)));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/DynamicLinker.java	Sun Aug 17 15:56:32 2014 +0100
@@ -0,0 +1,324 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file, and Oracle licenses the original version of this file under the BSD
+ * license:
+ */
+/*
+   Copyright 2009-2013 Attila Szegedi
+
+   Licensed under both the Apache License, Version 2.0 (the "Apache License")
+   and the BSD License (the "BSD License"), with licensee being free to
+   choose either of the two at their discretion.
+
+   You may not use this file except in compliance with either the Apache
+   License or the BSD License.
+
+   If you choose to use this file in compliance with the Apache License, the
+   following notice applies to you:
+
+       You may obtain a copy of the Apache License at
+
+           http://www.apache.org/licenses/LICENSE-2.0
+
+       Unless required by applicable law or agreed to in writing, software
+       distributed under the License is distributed on an "AS IS" BASIS,
+       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+       implied. See the License for the specific language governing
+       permissions and limitations under the License.
+
+   If you choose to use this file in compliance with the BSD License, the
+   following notice applies to you:
+
+       Redistribution and use in source and binary forms, with or without
+       modification, are permitted provided that the following conditions are
+       met:
+       * Redistributions of source code must retain the above copyright
+         notice, this list of conditions and the following disclaimer.
+       * Redistributions in binary form must reproduce the above copyright
+         notice, this list of conditions and the following disclaimer in the
+         documentation and/or other materials provided with the distribution.
+       * Neither the name of the copyright holder nor the names of
+         contributors may be used to endorse or promote products derived from
+         this software without specific prior written permission.
+
+       THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+       IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+       TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+       PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER
+       BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+       CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+       SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+       BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+       WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+       OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+       ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+package jdk.internal.dynalink;
+
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodType;
+import java.lang.invoke.MutableCallSite;
+import java.util.List;
+import jdk.internal.dynalink.linker.GuardedInvocation;
+import jdk.internal.dynalink.linker.GuardingDynamicLinker;
+import jdk.internal.dynalink.linker.LinkRequest;
+import jdk.internal.dynalink.linker.LinkerServices;
+import jdk.internal.dynalink.support.CallSiteDescriptorFactory;
+import jdk.internal.dynalink.support.LinkRequestImpl;
+import jdk.internal.dynalink.support.Lookup;
+import jdk.internal.dynalink.support.RuntimeContextLinkRequestImpl;
+
+/**
+ * The linker for {@link RelinkableCallSite} objects. Users of it (scripting frameworks and language runtimes) have to
+ * create a linker using the {@link DynamicLinkerFactory} and invoke its link method from the invokedynamic bootstrap
+ * methods to set the target of all the call sites in the code they generate. Usual usage would be to create one class
+ * per language runtime to contain one linker instance as:
+ *
+ * <pre>
+ * class MyLanguageRuntime {
+ *     private static final GuardingDynamicLinker myLanguageLinker = new MyLanguageLinker();
+ *     private static final DynamicLinker dynamicLinker = createDynamicLinker();
+ *
+ *     private static DynamicLinker createDynamicLinker() {
+ *         final DynamicLinkerFactory factory = new DynamicLinkerFactory();
+ *         factory.setPrioritizedLinker(myLanguageLinker);
+ *         return factory.createLinker();
+ *     }
+ *
+ *     public static CallSite bootstrap(MethodHandles.Lookup caller, String name, MethodType type) {
+ *         return dynamicLinker.link(new MonomorphicCallSite(CallSiteDescriptorFactory.create(lookup, name, type)));
+ *     }
+ * }
+ * </pre>
+ *
+ * Note how there are three components you will need to provide here:
+ * <ul>
+ * <li>You're expected to provide a {@link GuardingDynamicLinker} for your own language. If your runtime doesn't
+ * have its own language and/or object model (i.e. it's a generic scripting shell), you don't need to implement a
+ * dynamic linker; you would simply not invoke the {@code setPrioritizedLinker} method on the factory, or even better,
+ * simply use {@link DefaultBootstrapper}.</li>
+ * <li>The performance of the programs can depend on your choice of the class to represent call sites. The above
+ * example used {@link MonomorphicCallSite}, but you might want to use {@link ChainedCallSite} instead. You'll need to
+ * experiment and decide what fits your language runtime the best. You can subclass either of these or roll your own if
+ * you need to.</li>
+ * <li>You also need to provide {@link CallSiteDescriptor}s to your call sites. They are immutable objects that contain
+ * all the information about the call site: the class performing the lookups, the name of the method being invoked, and
+ * the method signature. The library has a default {@link CallSiteDescriptorFactory} for descriptors that you can use,
+ * or you can create your own descriptor classes, especially if you need to add further information (values passed in
+ * additional parameters to the bootstrap method) to them.</li>
+ * </ul>
+ *
+ * @author Attila Szegedi
+ */
+public class DynamicLinker {
+    private static final String CLASS_NAME = DynamicLinker.class.getName();
+    private static final String RELINK_METHOD_NAME = "relink";
+
+    private static final String INITIAL_LINK_CLASS_NAME = "java.lang.invoke.MethodHandleNatives";
+    private static final String INITIAL_LINK_METHOD_NAME = "linkCallSite";
+
+    private final LinkerServices linkerServices;
+    private final GuardedInvocationFilter prelinkFilter;
+    private final int runtimeContextArgCount;
+    private final boolean syncOnRelink;
+    private final int unstableRelinkThreshold;
+
+    /**
+     * Creates a new dynamic linker.
+     *
+     * @param linkerServices the linkerServices used by the linker, created by the factory.
+     * @param prelinkFilter see {@link DynamicLinkerFactory#setPrelinkFilter(GuardedInvocationFilter)}
+     * @param runtimeContextArgCount see {@link DynamicLinkerFactory#setRuntimeContextArgCount(int)}
+     */
+    DynamicLinker(final LinkerServices linkerServices, final GuardedInvocationFilter prelinkFilter, final int runtimeContextArgCount,
+            final boolean syncOnRelink, final int unstableRelinkThreshold) {
+        if(runtimeContextArgCount < 0) {
+            throw new IllegalArgumentException("runtimeContextArgCount < 0");
+        }
+        if(unstableRelinkThreshold < 0) {
+            throw new IllegalArgumentException("unstableRelinkThreshold < 0");
+        }
+        this.linkerServices = linkerServices;
+        this.prelinkFilter = prelinkFilter;
+        this.runtimeContextArgCount = runtimeContextArgCount;
+        this.syncOnRelink = syncOnRelink;
+        this.unstableRelinkThreshold = unstableRelinkThreshold;
+    }
+
+    /**
+     * Links an invokedynamic call site. It will install a method handle into the call site that invokes the relinking
+     * mechanism of this linker. Next time the call site is invoked, it will be linked for the actual arguments it was
+     * invoked with.
+     *
+     * @param callSite the call site to link.
+     * @return the callSite, for easy call chaining.
+     */
+    public <T extends RelinkableCallSite> T link(final T callSite) {
+        callSite.initialize(createRelinkAndInvokeMethod(callSite, 0));
+        return callSite;
+    }
+
+    /**
+     * Returns the object representing the lower level linker services of this class that are normally exposed to
+     * individual language-specific linkers. While as a user of this class you normally only care about the
+     * {@link #link(RelinkableCallSite)} method, in certain circumstances you might want to use the lower level services
+     * directly; either to lookup specific method handles, to access the type converters, and so on.
+     * @return the object representing the linker services of this class.
+     */
+    public LinkerServices getLinkerServices() {
+        return linkerServices;
+    }
+
+    private static final MethodHandle RELINK = Lookup.findOwnSpecial(MethodHandles.lookup(), RELINK_METHOD_NAME,
+            MethodHandle.class, RelinkableCallSite.class, int.class, Object[].class);
+
+    private MethodHandle createRelinkAndInvokeMethod(final RelinkableCallSite callSite, final int relinkCount) {
+        // Make a bound MH of invoke() for this linker and call site
+        final MethodHandle boundRelinker = MethodHandles.insertArguments(RELINK, 0, this, callSite, Integer.valueOf(
+                relinkCount));
+        // Make a MH that gathers all arguments to the invocation into an Object[]
+        final MethodType type = callSite.getDescriptor().getMethodType();
+        final MethodHandle collectingRelinker = boundRelinker.asCollector(Object[].class, type.parameterCount());
+        return MethodHandles.foldArguments(MethodHandles.exactInvoker(type), collectingRelinker.asType(
+                type.changeReturnType(MethodHandle.class)));
+    }
+
+    /**
+     * Relinks a call site conforming to the invocation arguments.
+     *
+     * @param callSite the call site itself
+     * @param arguments arguments to the invocation
+     * @return return the method handle for the invocation
+     * @throws Exception rethrows any exception thrown by the linkers
+     */
+    @SuppressWarnings("unused")
+    private MethodHandle relink(final RelinkableCallSite callSite, final int relinkCount, final Object... arguments) throws Exception {
+        final CallSiteDescriptor callSiteDescriptor = callSite.getDescriptor();
+        final boolean unstableDetectionEnabled = unstableRelinkThreshold > 0;
+        final boolean callSiteUnstable = unstableDetectionEnabled && relinkCount >= unstableRelinkThreshold;
+        final LinkRequest linkRequest =
+                runtimeContextArgCount == 0 ?
+                        new LinkRequestImpl(callSiteDescriptor, callSite, relinkCount, callSiteUnstable, arguments) :
+                        new RuntimeContextLinkRequestImpl(callSiteDescriptor, callSite, relinkCount, callSiteUnstable, arguments, runtimeContextArgCount);
+
+        GuardedInvocation guardedInvocation = linkerServices.getGuardedInvocation(linkRequest);
+
+        // None found - throw an exception
+        if(guardedInvocation == null) {
+            throw new NoSuchDynamicMethodException(callSiteDescriptor.toString());
+        }
+
+        // If our call sites have a runtime context, and the linker produced a context-stripped invocation, adapt the
+        // produced invocation into contextual invocation (by dropping the context...)
+        if(runtimeContextArgCount > 0) {
+            final MethodType origType = callSiteDescriptor.getMethodType();
+            final MethodHandle invocation = guardedInvocation.getInvocation();
+            if(invocation.type().parameterCount() == origType.parameterCount() - runtimeContextArgCount) {
+                final List<Class<?>> prefix = origType.parameterList().subList(1, runtimeContextArgCount + 1);
+                final MethodHandle guard = guardedInvocation.getGuard();
+                guardedInvocation = guardedInvocation.dropArguments(1, prefix);
+            }
+        }
+
+        // Make sure we filter the invocation before linking it into the call site. This is typically used to match the
+        // return type of the invocation to the call site.
+        guardedInvocation = prelinkFilter.filter(guardedInvocation, linkRequest, linkerServices);
+        guardedInvocation.getClass(); // null pointer check
+
+        int newRelinkCount = relinkCount;
+        // Note that the short-circuited "&&" evaluation below ensures we'll increment the relinkCount until
+        // threshold + 1 but not beyond that. Threshold + 1 is treated as a special value to signal that resetAndRelink
+        // has already executed once for the unstable call site; we only want the call site to throw away its current
+        // linkage once, when it transitions to unstable.
+        if(unstableDetectionEnabled && newRelinkCount <= unstableRelinkThreshold && newRelinkCount++ == unstableRelinkThreshold) {
+            callSite.resetAndRelink(guardedInvocation, createRelinkAndInvokeMethod(callSite, newRelinkCount));
+        } else {
+            callSite.relink(guardedInvocation, createRelinkAndInvokeMethod(callSite, newRelinkCount));
+        }
+        if(syncOnRelink) {
+            MutableCallSite.syncAll(new MutableCallSite[] { (MutableCallSite)callSite });
+        }
+        return guardedInvocation.getInvocation();
+    }
+
+    /**
+     * Returns a stack trace element describing the location of the call site currently being linked on the current
+     * thread. The operation internally creates a Throwable object and inspects its stack trace, so it's potentially
+     * expensive. The recommended usage for it is in writing diagnostics code.
+     * @return a stack trace element describing the location of the call site currently being linked, or null if it is
+     * not invoked while a call site is being linked.
+     */
+    public static StackTraceElement getLinkedCallSiteLocation() {
+        final StackTraceElement[] trace = new Throwable().getStackTrace();
+        for(int i = 0; i < trace.length - 1; ++i) {
+            final StackTraceElement frame = trace[i];
+            if(isRelinkFrame(frame) || isInitialLinkFrame(frame)) {
+                return trace[i + 1];
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Deprecated because of not precise name.
+     * @deprecated Use {@link #getLinkedCallSiteLocation()} instead.
+     * @return see non-deprecated method
+     */
+    @Deprecated
+    public static StackTraceElement getRelinkedCallSiteLocation() {
+        return getLinkedCallSiteLocation();
+    }
+
+    /**
+     * Returns true if the frame represents {@code MethodHandleNatives.linkCallSite()}, the frame immediately on top of
+     * the call site frame when the call site is being linked for the first time.
+     * @param frame the frame
+     * @return true if this frame represents {@code MethodHandleNatives.linkCallSite()}
+     */
+    private static boolean isInitialLinkFrame(final StackTraceElement frame) {
+        return testFrame(frame, INITIAL_LINK_METHOD_NAME, INITIAL_LINK_CLASS_NAME);
+    }
+
+    /**
+     * Returns true if the frame represents {@code DynamicLinker.relink()}, the frame immediately on top of the call
+     * site frame when the call site is being relinked (linked for second and subsequent times).
+     * @param frame the frame
+     * @return true if this frame represents {@code DynamicLinker.relink()}
+     */
+    private static boolean isRelinkFrame(final StackTraceElement frame) {
+        return testFrame(frame, RELINK_METHOD_NAME, CLASS_NAME);
+    }
+
+    private static boolean testFrame(final StackTraceElement frame, final String methodName, final String className) {
+        return methodName.equals(frame.getMethodName()) && className.equals(frame.getClassName());
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/DynamicLinkerFactory.java	Sun Aug 17 15:56:32 2014 +0100
@@ -0,0 +1,346 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file, and Oracle licenses the original version of this file under the BSD
+ * license:
+ */
+/*
+   Copyright 2009-2013 Attila Szegedi
+
+   Licensed under both the Apache License, Version 2.0 (the "Apache License")
+   and the BSD License (the "BSD License"), with licensee being free to
+   choose either of the two at their discretion.
+
+   You may not use this file except in compliance with either the Apache
+   License or the BSD License.
+
+   If you choose to use this file in compliance with the Apache License, the
+   following notice applies to you:
+
+       You may obtain a copy of the Apache License at
+
+           http://www.apache.org/licenses/LICENSE-2.0
+
+       Unless required by applicable law or agreed to in writing, software
+       distributed under the License is distributed on an "AS IS" BASIS,
+       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+       implied. See the License for the specific language governing
+       permissions and limitations under the License.
+
+   If you choose to use this file in compliance with the BSD License, the
+   following notice applies to you:
+
+       Redistribution and use in source and binary forms, with or without
+       modification, are permitted provided that the following conditions are
+       met:
+       * Redistributions of source code must retain the above copyright
+         notice, this list of conditions and the following disclaimer.
+       * Redistributions in binary form must reproduce the above copyright
+         notice, this list of conditions and the following disclaimer in the
+         documentation and/or other materials provided with the distribution.
+       * Neither the name of the copyright holder nor the names of
+         contributors may be used to endorse or promote products derived from
+         this software without specific prior written permission.
+
+       THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+       IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+       TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+       PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER
+       BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+       CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+       SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+       BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+       WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+       OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+       ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+package jdk.internal.dynalink;
+
+import java.lang.invoke.MutableCallSite;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+import jdk.internal.dynalink.beans.BeansLinker;
+import jdk.internal.dynalink.linker.GuardingDynamicLinker;
+import jdk.internal.dynalink.linker.GuardingTypeConverterFactory;
+import jdk.internal.dynalink.linker.LinkRequest;
+import jdk.internal.dynalink.support.AutoDiscovery;
+import jdk.internal.dynalink.support.BottomGuardingDynamicLinker;
+import jdk.internal.dynalink.support.ClassLoaderGetterContextProvider;
+import jdk.internal.dynalink.support.CompositeGuardingDynamicLinker;
+import jdk.internal.dynalink.support.CompositeTypeBasedGuardingDynamicLinker;
+import jdk.internal.dynalink.support.DefaultPrelinkFilter;
+import jdk.internal.dynalink.support.LinkerServicesImpl;
+import jdk.internal.dynalink.support.TypeConverterFactory;
+
+/**
+ * A factory class for creating {@link DynamicLinker}s. The most usual dynamic linker is a linker that is a composition
+ * of all {@link GuardingDynamicLinker}s known and pre-created by the caller as well as any
+ * {@link AutoDiscovery automatically discovered} guarding linkers and the standard fallback {@link BeansLinker} and a
+ * {@link DefaultPrelinkFilter}. See {@link DynamicLinker} documentation for tips on how to use this class.
+ *
+ * @author Attila Szegedi
+ */
+public class DynamicLinkerFactory {
+
+    /**
+     * Default value for {@link #setUnstableRelinkThreshold(int) unstable relink threshold}.
+     */
+    public static final int DEFAULT_UNSTABLE_RELINK_THRESHOLD = 8;
+
+    private boolean classLoaderExplicitlySet = false;
+    private ClassLoader classLoader;
+
+    private List<? extends GuardingDynamicLinker> prioritizedLinkers;
+    private List<? extends GuardingDynamicLinker> fallbackLinkers;
+    private int runtimeContextArgCount = 0;
+    private boolean syncOnRelink = false;
+    private int unstableRelinkThreshold = DEFAULT_UNSTABLE_RELINK_THRESHOLD;
+    private GuardedInvocationFilter prelinkFilter;
+
+    /**
+     * Sets the class loader for automatic discovery of available linkers. If not set explicitly, then the thread
+     * context class loader at the time of {@link #createLinker()} invocation will be used.
+     *
+     * @param classLoader the class loader used for the autodiscovery of available linkers.
+     */
+    public void setClassLoader(final ClassLoader classLoader) {
+        this.classLoader = classLoader;
+        classLoaderExplicitlySet = true;
+    }
+
+    /**
+     * Sets the prioritized linkers. Language runtimes using this framework will usually precreate at least the linker
+     * for their own language. These linkers will be consulted first in the resulting dynamic linker, before any
+     * autodiscovered linkers. If the framework also autodiscovers a linker of the same class as one of the prioritized
+     * linkers, it will be ignored and the explicit prioritized instance will be used.
+     *
+     * @param prioritizedLinkers the list of prioritized linkers. Null can be passed to indicate no prioritized linkers
+     * (this is also the default value).
+     */
+    public void setPrioritizedLinkers(final List<? extends GuardingDynamicLinker> prioritizedLinkers) {
+        this.prioritizedLinkers =
+                prioritizedLinkers == null ? null : new ArrayList<>(prioritizedLinkers);
+    }
+
+    /**
+     * Sets the prioritized linkers. Language runtimes using this framework will usually precreate at least the linker
+     * for their own language. These linkers will be consulted first in the resulting dynamic linker, before any
+     * autodiscovered linkers. If the framework also autodiscovers a linker of the same class as one of the prioritized
+     * linkers, it will be ignored and the explicit prioritized instance will be used.
+     *
+     * @param prioritizedLinkers a list of prioritized linkers.
+     */
+    public void setPrioritizedLinkers(final GuardingDynamicLinker... prioritizedLinkers) {
+        setPrioritizedLinkers(Arrays.asList(prioritizedLinkers));
+    }
+
+    /**
+     * Sets a single prioritized linker. Identical to calling {@link #setPrioritizedLinkers(List)} with a single-element
+     * list.
+     *
+     * @param prioritizedLinker the single prioritized linker. Must not be null.
+     * @throws IllegalArgumentException if null is passed.
+     */
+    public void setPrioritizedLinker(final GuardingDynamicLinker prioritizedLinker) {
+        if(prioritizedLinker == null) {
+            throw new IllegalArgumentException("prioritizedLinker == null");
+        }
+        this.prioritizedLinkers = Collections.singletonList(prioritizedLinker);
+    }
+
+    /**
+     * Sets the fallback linkers. These linkers will be consulted last in the resulting composite linker, after any
+     * autodiscovered linkers. If the framework also autodiscovers a linker of the same class as one of the fallback
+     * linkers, it will be ignored and the explicit fallback instance will be used.
+     *
+     * @param fallbackLinkers the list of fallback linkers. Can be empty to indicate the caller wishes to set no
+     * fallback linkers.
+     */
+    public void setFallbackLinkers(final List<? extends GuardingDynamicLinker> fallbackLinkers) {
+        this.fallbackLinkers = fallbackLinkers == null ? null : new ArrayList<>(fallbackLinkers);
+    }
+
+    /**
+     * Sets the fallback linkers. These linkers will be consulted last in the resulting composite linker, after any
+     * autodiscovered linkers. If the framework also autodiscovers a linker of the same class as one of the fallback
+     * linkers, it will be ignored and the explicit fallback instance will be used.
+     *
+     * @param fallbackLinkers the list of fallback linkers. Can be empty to indicate the caller wishes to set no
+     * fallback linkers. If it is left as null, the standard fallback {@link BeansLinker} will be used.
+     */
+    public void setFallbackLinkers(final GuardingDynamicLinker... fallbackLinkers) {
+        setFallbackLinkers(Arrays.asList(fallbackLinkers));
+    }
+
+    /**
+     * Sets the number of arguments in the call sites that represent the stack context of the language runtime creating
+     * the linker. If the language runtime uses no context information passed on stack, then it should be zero
+     * (the default value). If it is set to nonzero value, then every dynamic call site emitted by this runtime must
+     * have the argument list of the form: {@code (this, contextArg1[, contextArg2[, ...]], normalArgs)}. It is
+     * advisable to only pass one context-specific argument, though, of an easily recognizable, runtime specific type
+     * encapsulating the runtime thread local state.
+     *
+     * @param runtimeContextArgCount the number of language runtime context arguments in call sites.
+     */
+    public void setRuntimeContextArgCount(final int runtimeContextArgCount) {
+        if(runtimeContextArgCount < 0) {
+            throw new IllegalArgumentException("runtimeContextArgCount < 0");
+        }
+        this.runtimeContextArgCount = runtimeContextArgCount;
+    }
+
+    /**
+     * Sets whether the linker created by this factory will invoke {@link MutableCallSite#syncAll(MutableCallSite[])}
+     * after a call site is relinked. Defaults to false. You probably want to set it to true if your runtime supports
+     * multithreaded execution of dynamically linked code.
+     * @param syncOnRelink true for invoking sync on relink, false otherwise.
+     */
+    public void setSyncOnRelink(final boolean syncOnRelink) {
+        this.syncOnRelink = syncOnRelink;
+    }
+
+    /**
+     * Sets the unstable relink threshold; the number of times a call site is relinked after which it will be
+     * considered unstable, and subsequent link requests for it will indicate this.
+     * @param unstableRelinkThreshold the new threshold. Must not be less than zero. The value of zero means that
+     * call sites will never be considered unstable.
+     * @see LinkRequest#isCallSiteUnstable()
+     */
+    public void setUnstableRelinkThreshold(final int unstableRelinkThreshold) {
+        if(unstableRelinkThreshold < 0) {
+            throw new IllegalArgumentException("unstableRelinkThreshold < 0");
+        }
+        this.unstableRelinkThreshold = unstableRelinkThreshold;
+    }
+
+    /**
+     * Set the pre-link filter. This is a {@link GuardedInvocationFilter} that will get the final chance to modify the
+     * guarded invocation after it has been created by a component linker and before the dynamic linker links it into
+     * the call site. It is normally used to adapt the return value type of the invocation to the type of the call site.
+     * When not set explicitly, {@link DefaultPrelinkFilter} will be used.
+     * @param prelinkFilter the pre-link filter for the dynamic linker.
+     */
+    public void setPrelinkFilter(final GuardedInvocationFilter prelinkFilter) {
+        this.prelinkFilter = prelinkFilter;
+    }
+
+    /**
+     * Creates a new dynamic linker consisting of all the prioritized, autodiscovered, and fallback linkers as well as
+     * the pre-link filter.
+     *
+     * @return the new dynamic Linker
+     */
+    public DynamicLinker createLinker() {
+        // Treat nulls appropriately
+        if(prioritizedLinkers == null) {
+            prioritizedLinkers = Collections.emptyList();
+        }
+        if(fallbackLinkers == null) {
+            fallbackLinkers = Collections.singletonList(new BeansLinker());
+        }
+
+        // Gather classes of all precreated (prioritized and fallback) linkers.
+        // We'll filter out any discovered linkers of the same class.
+        final Set<Class<? extends GuardingDynamicLinker>> knownLinkerClasses =
+                new HashSet<>();
+        addClasses(knownLinkerClasses, prioritizedLinkers);
+        addClasses(knownLinkerClasses, fallbackLinkers);
+
+        final ClassLoader effectiveClassLoader = classLoaderExplicitlySet ? classLoader : getThreadContextClassLoader();
+        final List<GuardingDynamicLinker> discovered = AutoDiscovery.loadLinkers(effectiveClassLoader);
+        // Now, concatenate ...
+        final List<GuardingDynamicLinker> linkers =
+                new ArrayList<>(prioritizedLinkers.size() + discovered.size()
+                        + fallbackLinkers.size());
+        // ... prioritized linkers, ...
+        linkers.addAll(prioritizedLinkers);
+        // ... filtered discovered linkers, ...
+        for(final GuardingDynamicLinker linker: discovered) {
+            if(!knownLinkerClasses.contains(linker.getClass())) {
+                linkers.add(linker);
+            }
+        }
+        // ... and finally fallback linkers.
+        linkers.addAll(fallbackLinkers);
+        final List<GuardingDynamicLinker> optimized = CompositeTypeBasedGuardingDynamicLinker.optimize(linkers);
+        final GuardingDynamicLinker composite;
+        switch(linkers.size()) {
+            case 0: {
+                composite = BottomGuardingDynamicLinker.INSTANCE;
+                break;
+            }
+            case 1: {
+                composite = optimized.get(0);
+                break;
+            }
+            default: {
+                composite = new CompositeGuardingDynamicLinker(optimized);
+                break;
+            }
+        }
+
+        final List<GuardingTypeConverterFactory> typeConverters = new LinkedList<>();
+        for(final GuardingDynamicLinker linker: linkers) {
+            if(linker instanceof GuardingTypeConverterFactory) {
+                typeConverters.add((GuardingTypeConverterFactory)linker);
+            }
+        }
+
+        if(prelinkFilter == null) {
+            prelinkFilter = new DefaultPrelinkFilter();
+        }
+
+        return new DynamicLinker(new LinkerServicesImpl(new TypeConverterFactory(typeConverters), composite),
+                prelinkFilter, runtimeContextArgCount, syncOnRelink, unstableRelinkThreshold);
+    }
+
+    private static ClassLoader getThreadContextClassLoader() {
+        return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
+            @Override
+            public ClassLoader run() {
+                return Thread.currentThread().getContextClassLoader();
+            }
+        }, ClassLoaderGetterContextProvider.GET_CLASS_LOADER_CONTEXT);
+    }
+
+    private static void addClasses(final Set<Class<? extends GuardingDynamicLinker>> knownLinkerClasses,
+            final List<? extends GuardingDynamicLinker> linkers) {
+        for(final GuardingDynamicLinker linker: linkers) {
+            knownLinkerClasses.add(linker.getClass());
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/GuardedInvocationFilter.java	Sun Aug 17 15:56:32 2014 +0100
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file, and Oracle licenses the original version of this file under the BSD
+ * license:
+ */
+/*
+   Copyright 2009-2013 Attila Szegedi
+
+   Licensed under both the Apache License, Version 2.0 (the "Apache License")
+   and the BSD License (the "BSD License"), with licensee being free to
+   choose either of the two at their discretion.
+
+   You may not use this file except in compliance with either the Apache
+   License or the BSD License.
+
+   If you choose to use this file in compliance with the Apache License, the
+   following notice applies to you:
+
+       You may obtain a copy of the Apache License at
+
+           http://www.apache.org/licenses/LICENSE-2.0
+
+       Unless required by applicable law or agreed to in writing, software
+       distributed under the License is distributed on an "AS IS" BASIS,
+       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+       implied. See the License for the specific language governing
+       permissions and limitations under the License.
+
+   If you choose to use this file in compliance with the BSD License, the
+   following notice applies to you:
+
+       Redistribution and use in source and binary forms, with or without
+       modification, are permitted provided that the following conditions are
+       met:
+       * Redistributions of source code must retain the above copyright
+         notice, this list of conditions and the following disclaimer.
+       * Redistributions in binary form must reproduce the above copyright
+         notice, this list of conditions and the following disclaimer in the
+         documentation and/or other materials provided with the distribution.
+       * Neither the name of the copyright holder nor the names of
+         contributors may be used to endorse or promote products derived from
+         this software without specific prior written permission.
+
+       THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+       IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+       TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+       PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER
+       BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+       CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+       SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+       BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+       WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+       OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+       ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+package jdk.internal.dynalink;
+
+import jdk.internal.dynalink.linker.GuardedInvocation;
+import jdk.internal.dynalink.linker.LinkRequest;
+import jdk.internal.dynalink.linker.LinkerServices;
+
+/**
+ * Interface for objects that are used to transform one guarded invocation into another one. Typical usage is for
+ * implementing {@link DynamicLinkerFactory#setPrelinkFilter(GuardedInvocationFilter) pre-link filters}.
+ */
+public interface GuardedInvocationFilter {
+    /**
+     * Given a guarded invocation, return a potentially different guarded invocation.
+     * @param inv the original guarded invocation. Null is never passed.
+     * @param linkRequest the link request for which the invocation was generated (usually by some linker).
+     * @param linkerServices the linker services that can be used during creation of a new invocation.
+     * @return either the passed guarded invocation or a different one, with the difference usually determined based on
+     * information in the link request and the differing invocation created with the assistance of the linker services.
+     * Whether or not {@code null} is an accepted return value is dependent on the user of the filter.
+     */
+    public GuardedInvocation filter(GuardedInvocation inv, LinkRequest linkRequest, LinkerServices linkerServices);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/MonomorphicCallSite.java	Sun Aug 17 15:56:32 2014 +0100
@@ -0,0 +1,115 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file, and Oracle licenses the original version of this file under the BSD
+ * license:
+ */
+/*
+   Copyright 2009-2013 Attila Szegedi
+
+   Licensed under both the Apache License, Version 2.0 (the "Apache License")
+   and the BSD License (the "BSD License"), with licensee being free to
+   choose either of the two at their discretion.
+
+   You may not use this file except in compliance with either the Apache
+   License or the BSD License.
+
+   If you choose to use this file in compliance with the Apache License, the
+   following notice applies to you:
+
+       You may obtain a copy of the Apache License at
+
+           http://www.apache.org/licenses/LICENSE-2.0
+
+       Unless required by applicable law or agreed to in writing, software
+       distributed under the License is distributed on an "AS IS" BASIS,
+       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+       implied. See the License for the specific language governing
+       permissions and limitations under the License.
+
+   If you choose to use this file in compliance with the BSD License, the
+   following notice applies to you:
+
+       Redistribution and use in source and binary forms, with or without
+       modification, are permitted provided that the following conditions are
+       met:
+       * Redistributions of source code must retain the above copyright
+         notice, this list of conditions and the following disclaimer.
+       * Redistributions in binary form must reproduce the above copyright
+         notice, this list of conditions and the following disclaimer in the
+         documentation and/or other materials provided with the distribution.
+       * Neither the name of the copyright holder nor the names of
+         contributors may be used to endorse or promote products derived from
+         this software without specific prior written permission.
+
+       THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+       IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+       TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+       PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER
+       BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+       CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+       SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+       BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+       WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+       OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+       ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+package jdk.internal.dynalink;
+
+import java.lang.invoke.MethodHandle;
+import jdk.internal.dynalink.linker.GuardedInvocation;
+import jdk.internal.dynalink.support.AbstractRelinkableCallSite;
+
+/**
+ * A relinkable call site that implements monomorphic inline caching strategy. After it linked a method, it will keep it
+ * until either its guard evaluates to false, or its switchpoint is invalidated, at which time it will throw away the
+ * previous linkage, and trigger relinking with its associated {@link DynamicLinker}.
+ *
+ * @author Attila Szegedi
+ */
+public class MonomorphicCallSite extends AbstractRelinkableCallSite {
+    /**
+     * Creates a new call site with monomorphic inline caching strategy.
+     * @param descriptor the descriptor for this call site
+     */
+    public MonomorphicCallSite(final CallSiteDescriptor descriptor) {
+        super(descriptor);
+    }
+
+    @Override
+    public void relink(final GuardedInvocation guardedInvocation, final MethodHandle relink) {
+        setTarget(guardedInvocation.compose(relink));
+    }
+
+    @Override
+    public void resetAndRelink(final GuardedInvocation guardedInvocation, final MethodHandle relink) {
+        relink(guardedInvocation, relink);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/NoSuchDynamicMethodException.java	Sun Aug 17 15:56:32 2014 +0100
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file, and Oracle licenses the original version of this file under the BSD
+ * license:
+ */
+/*
+   Copyright 2009-2013 Attila Szegedi
+
+   Licensed under both the Apache License, Version 2.0 (the "Apache License")
+   and the BSD License (the "BSD License"), with licensee being free to
+   choose either of the two at their discretion.
+
+   You may not use this file except in compliance with either the Apache
+   License or the BSD License.
+
+   If you choose to use this file in compliance with the Apache License, the
+   following notice applies to you:
+
+       You may obtain a copy of the Apache License at
+
+           http://www.apache.org/licenses/LICENSE-2.0
+
+       Unless required by applicable law or agreed to in writing, software
+       distributed under the License is distributed on an "AS IS" BASIS,
+       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+       implied. See the License for the specific language governing
+       permissions and limitations under the License.
+
+   If you choose to use this file in compliance with the BSD License, the
+   following notice applies to you:
+
+       Redistribution and use in source and binary forms, with or without
+       modification, are permitted provided that the following conditions are
+       met:
+       * Redistributions of source code must retain the above copyright
+         notice, this list of conditions and the following disclaimer.
+       * Redistributions in binary form must reproduce the above copyright
+         notice, this list of conditions and the following disclaimer in the
+         documentation and/or other materials provided with the distribution.
+       * Neither the name of the copyright holder nor the names of
+         contributors may be used to endorse or promote products derived from
+         this software without specific prior written permission.
+
+       THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+       IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+       TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+       PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER
+       BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+       CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+       SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+       BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+       WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+       OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+       ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+package jdk.internal.dynalink;
+
+import jdk.internal.dynalink.linker.GuardingDynamicLinker;
+
+/**
+ * Thrown at the invocation if the call site can not be linked by any available {@link GuardingDynamicLinker}.
+ *
+ * @author Attila Szegedi
+ */
+public class NoSuchDynamicMethodException extends RuntimeException {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * Creates a new NoSuchDynamicMethodException
+     * @param message the message of the exception.
+     */
+    public NoSuchDynamicMethodException(final String message) {
+        super(message);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/RelinkableCallSite.java	Sun Aug 17 15:56:32 2014 +0100
@@ -0,0 +1,147 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file, and Oracle licenses the original version of this file under the BSD
+ * license:
+ */
+/*
+   Copyright 2009-2013 Attila Szegedi
+
+   Licensed under both the Apache License, Version 2.0 (the "Apache License")
+   and the BSD License (the "BSD License"), with licensee being free to
+   choose either of the two at their discretion.
+
+   You may not use this file except in compliance with either the Apache
+   License or the BSD License.
+
+   If you choose to use this file in compliance with the Apache License, the
+   following notice applies to you:
+
+       You may obtain a copy of the Apache License at
+
+           http://www.apache.org/licenses/LICENSE-2.0
+
+       Unless required by applicable law or agreed to in writing, software
+       distributed under the License is distributed on an "AS IS" BASIS,
+       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+       implied. See the License for the specific language governing
+       permissions and limitations under the License.
+
+   If you choose to use this file in compliance with the BSD License, the
+   following notice applies to you:
+
+       Redistribution and use in source and binary forms, with or without
+       modification, are permitted provided that the following conditions are
+       met:
+       * Redistributions of source code must retain the above copyright
+         notice, this list of conditions and the following disclaimer.
+       * Redistributions in binary form must reproduce the above copyright
+         notice, this list of conditions and the following disclaimer in the
+         documentation and/or other materials provided with the distribution.
+       * Neither the name of the copyright holder nor the names of
+         contributors may be used to endorse or promote products derived from
+         this software without specific prior written permission.
+
+       THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+       IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+       TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+       PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER
+       BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+       CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+       SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+       BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+       WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+       OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+       ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+package jdk.internal.dynalink;
+
+import java.lang.invoke.CallSite;
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MutableCallSite;
+import java.lang.invoke.VolatileCallSite;
+import jdk.internal.dynalink.linker.GuardedInvocation;
+
+/**
+ * Interface for relinkable call sites. Language runtimes wishing to use this framework must use subclasses of
+ * {@link CallSite} that also implement this interface as their call sites. There is a readily usable
+ * {@link MonomorphicCallSite} subclass that implements monomorphic inline caching strategy as well as a
+ * {@link ChainedCallSite} that retains a chain of already linked method handles. The reason this is defined as an
+ * interface instead of a concrete, albeit abstract class is that it allows independent implementations to choose
+ * between {@link MutableCallSite} and {@link VolatileCallSite} as they see fit.
+ *
+ * @author Attila Szegedi
+ */
+public interface RelinkableCallSite {
+    /**
+     * Initializes the relinkable call site by setting a relink-and-invoke method handle. The call site implementation
+     * is supposed to set this method handle as its target.
+     * @param relinkAndInvoke a relink-and-invoke method handle supplied by the {@link DynamicLinker}.
+     */
+    public void initialize(MethodHandle relinkAndInvoke);
+
+    /**
+     * Returns the descriptor for this call site.
+     *
+     * @return the descriptor for this call site.
+     */
+    public CallSiteDescriptor getDescriptor();
+
+    /**
+     * This method will be called by the dynamic linker every time the call site is normally relinked. It will be passed
+     * a {@code GuardedInvocation} that the call site should incorporate into its target method handle. When this method
+     * is called, the call site is allowed to keep other non-invalidated invocations around for implementation of
+     * polymorphic inline caches and compose them with this invocation to form its final target.
+     *
+     * @param guardedInvocation the guarded invocation that the call site should incorporate into its target method
+     * handle.
+     * @param fallback the fallback method. This is a method matching the method type of the call site that is supplied
+     * by the {@link DynamicLinker} to be used by this call site as a fallback when it can't invoke its target with the
+     * passed arguments. The fallback method is such that when it's invoked, it'll try to discover the adequate target
+     * for the invocation, subsequently invoke {@link #relink(GuardedInvocation, MethodHandle)} or
+     * {@link #resetAndRelink(GuardedInvocation, MethodHandle)}, and finally invoke the target.
+     */
+    public void relink(GuardedInvocation guardedInvocation, MethodHandle fallback);
+
+    /**
+     * This method will be called by the dynamic linker every time the call site is relinked and the linker wishes the
+     * call site to throw away any prior linkage state. It will be passed a {@code GuardedInvocation} that the call site
+     * should use to build its target method handle. When this method is called, the call site is discouraged from
+     * keeping previous state around, and is supposed to only link the current invocation.
+     *
+     * @param guardedInvocation the guarded invocation that the call site should use to build its target method handle.
+     * @param fallback the fallback method. This is a method matching the method type of the call site that is supplied
+     * by the {@link DynamicLinker} to be used by this call site as a fallback when it can't invoke its target with the
+     * passed arguments. The fallback method is such that when it's invoked, it'll try to discover the adequate target
+     * for the invocation, subsequently invoke {@link #relink(GuardedInvocation, MethodHandle)} or
+     * {@link #resetAndRelink(GuardedInvocation, MethodHandle)}, and finally invoke the target.
+     */
+    public void resetAndRelink(GuardedInvocation guardedInvocation, MethodHandle fallback);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/AbstractJavaLinker.java	Sun Aug 17 15:56:32 2014 +0100
@@ -0,0 +1,870 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file, and Oracle licenses the original version of this file under the BSD
+ * license:
+ */
+/*
+   Copyright 2009-2013 Attila Szegedi
+
+   Licensed under both the Apache License, Version 2.0 (the "Apache License")
+   and the BSD License (the "BSD License"), with licensee being free to
+   choose either of the two at their discretion.
+
+   You may not use this file except in compliance with either the Apache
+   License or the BSD License.
+
+   If you choose to use this file in compliance with the Apache License, the
+   following notice applies to you:
+
+       You may obtain a copy of the Apache License at
+
+           http://www.apache.org/licenses/LICENSE-2.0
+
+       Unless required by applicable law or agreed to in writing, software
+       distributed under the License is distributed on an "AS IS" BASIS,
+       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+       implied. See the License for the specific language governing
+       permissions and limitations under the License.
+
+   If you choose to use this file in compliance with the BSD License, the
+   following notice applies to you:
+
+       Redistribution and use in source and binary forms, with or without
+       modification, are permitted provided that the following conditions are
+       met:
+       * Redistributions of source code must retain the above copyright
+         notice, this list of conditions and the following disclaimer.
+       * Redistributions in binary form must reproduce the above copyright
+         notice, this list of conditions and the following disclaimer in the
+         documentation and/or other materials provided with the distribution.
+       * Neither the name of the copyright holder nor the names of
+         contributors may be used to endorse or promote products derived from
+         this software without specific prior written permission.
+
+       THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+       IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+       TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+       PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER
+       BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+       CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+       SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+       BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+       WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+       OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+       ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+package jdk.internal.dynalink.beans;
+
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodType;
+import java.lang.reflect.AccessibleObject;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import jdk.internal.dynalink.CallSiteDescriptor;
+import jdk.internal.dynalink.beans.GuardedInvocationComponent.ValidationType;
+import jdk.internal.dynalink.linker.GuardedInvocation;
+import jdk.internal.dynalink.linker.GuardingDynamicLinker;
+import jdk.internal.dynalink.linker.LinkRequest;
+import jdk.internal.dynalink.linker.LinkerServices;
+import jdk.internal.dynalink.support.CallSiteDescriptorFactory;
+import jdk.internal.dynalink.support.Guards;
+import jdk.internal.dynalink.support.Lookup;
+import jdk.internal.dynalink.support.TypeUtilities;
+
+/**
+ * A base class for both {@link StaticClassLinker} and {@link BeanLinker}. Deals with common aspects of property
+ * exposure and method calls for both static and instance facets of a class.
+ *
+ * @author Attila Szegedi
+ */
+abstract class AbstractJavaLinker implements GuardingDynamicLinker {
+
+    final Class<?> clazz;
+    private final MethodHandle classGuard;
+    private final MethodHandle assignableGuard;
+    private final Map<String, AnnotatedDynamicMethod> propertyGetters = new HashMap<>();
+    private final Map<String, DynamicMethod> propertySetters = new HashMap<>();
+    private final Map<String, DynamicMethod> methods = new HashMap<>();
+
+    AbstractJavaLinker(final Class<?> clazz, final MethodHandle classGuard) {
+        this(clazz, classGuard, classGuard);
+    }
+
+    AbstractJavaLinker(final Class<?> clazz, final MethodHandle classGuard, final MethodHandle assignableGuard) {
+        this.clazz = clazz;
+        this.classGuard = classGuard;
+        this.assignableGuard = assignableGuard;
+
+        final FacetIntrospector introspector = createFacetIntrospector();
+        // Add methods and properties
+        for(final Method method: introspector.getMethods()) {
+            final String name = method.getName();
+            // Add method
+            addMember(name, method, methods);
+            // Add the method as a property getter and/or setter
+            if(name.startsWith("get") && name.length() > 3 && method.getParameterTypes().length == 0) {
+                // Property getter
+                setPropertyGetter(method, 3);
+            } else if(name.startsWith("is") && name.length() > 2 && method.getParameterTypes().length == 0 &&
+                    method.getReturnType() == boolean.class) {
+                // Boolean property getter
+                setPropertyGetter(method, 2);
+            } else if(name.startsWith("set") && name.length() > 3 && method.getParameterTypes().length == 1) {
+                // Property setter
+                addMember(decapitalize(name.substring(3)), method, propertySetters);
+            }
+        }
+
+        // Add field getter/setters as property getters/setters.
+        for(final Field field: introspector.getFields()) {
+            final String name = field.getName();
+            // Only add a property getter when one is not defined already as a getXxx()/isXxx() method.
+            if(!propertyGetters.containsKey(name)) {
+                setPropertyGetter(name, introspector.unreflectGetter(field), ValidationType.EXACT_CLASS);
+            }
+            if(!(Modifier.isFinal(field.getModifiers()) || propertySetters.containsKey(name))) {
+                addMember(name, new SimpleDynamicMethod(introspector.unreflectSetter(field), clazz, name),
+                        propertySetters);
+            }
+        }
+
+        // Add inner classes, but only those for which we don't hide a property with it
+        for(final Map.Entry<String, MethodHandle> innerClassSpec: introspector.getInnerClassGetters().entrySet()) {
+            final String name = innerClassSpec.getKey();
+            if(!propertyGetters.containsKey(name)) {
+                setPropertyGetter(name, innerClassSpec.getValue(), ValidationType.EXACT_CLASS);
+            }
+        }
+    }
+
+    private static String decapitalize(final String str) {
+        assert str != null;
+        if(str.isEmpty()) {
+            return str;
+        }
+
+        final char c0 = str.charAt(0);
+        if(Character.isLowerCase(c0)) {
+            return str;
+        }
+
+        // If it has two consecutive upper-case characters, i.e. "URL", don't decapitalize
+        if(str.length() > 1 && Character.isUpperCase(str.charAt(1))) {
+            return str;
+        }
+
+        final char c[] = str.toCharArray();
+        c[0] = Character.toLowerCase(c0);
+        return new String(c);
+    }
+
+    abstract FacetIntrospector createFacetIntrospector();
+
+    Collection<String> getReadablePropertyNames() {
+        return getUnmodifiableKeys(propertyGetters);
+    }
+
+    Collection<String> getWritablePropertyNames() {
+        return getUnmodifiableKeys(propertySetters);
+    }
+
+    Collection<String> getMethodNames() {
+        return getUnmodifiableKeys(methods);
+    }
+
+    private static Collection<String> getUnmodifiableKeys(final Map<String, ?> m) {
+        return Collections.unmodifiableCollection(m.keySet());
+    }
+
+    /**
+     * Sets the specified dynamic method to be the property getter for the specified property. Note that you can only
+     * use this when you're certain that the method handle does not belong to a caller-sensitive method. For properties
+     * that are caller-sensitive, you must use {@link #setPropertyGetter(String, SingleDynamicMethod, ValidationType)}
+     * instead.
+     * @param name name of the property
+     * @param handle the method handle that implements the property getter
+     * @param validationType the validation type for the property
+     */
+    private void setPropertyGetter(final String name, final SingleDynamicMethod handle, final ValidationType validationType) {
+        propertyGetters.put(name, new AnnotatedDynamicMethod(handle, validationType));
+    }
+
+    /**
+     * Sets the specified reflective method to be the property getter for the specified property.
+     * @param getter the getter method
+     * @param prefixLen the getter prefix in the method name; should be 3 for getter names starting with "get" and 2 for
+     * names starting with "is".
+     */
+    private void setPropertyGetter(final Method getter, final int prefixLen) {
+        setPropertyGetter(decapitalize(getter.getName().substring(prefixLen)), createDynamicMethod(
+                getMostGenericGetter(getter)), ValidationType.INSTANCE_OF);
+    }
+
+    /**
+     * Sets the specified method handle to be the property getter for the specified property. Note that you can only
+     * use this when you're certain that the method handle does not belong to a caller-sensitive method. For properties
+     * that are caller-sensitive, you must use {@link #setPropertyGetter(String, SingleDynamicMethod, ValidationType)}
+     * instead.
+     * @param name name of the property
+     * @param handle the method handle that implements the property getter
+     * @param validationType the validation type for the property
+     */
+    void setPropertyGetter(final String name, final MethodHandle handle, final ValidationType validationType) {
+        setPropertyGetter(name, new SimpleDynamicMethod(handle, clazz, name), validationType);
+    }
+
+    private void addMember(final String name, final AccessibleObject ao, final Map<String, DynamicMethod> methodMap) {
+        addMember(name, createDynamicMethod(ao), methodMap);
+    }
+
+    private void addMember(final String name, final SingleDynamicMethod method, final Map<String, DynamicMethod> methodMap) {
+        final DynamicMethod existingMethod = methodMap.get(name);
+        final DynamicMethod newMethod = mergeMethods(method, existingMethod, clazz, name);
+        if(newMethod != existingMethod) {
+            methodMap.put(name, newMethod);
+        }
+    }
+
+    /**
+     * Given one or more reflective methods or constructors, creates a dynamic method that represents them all. The
+     * methods should represent all overloads of the same name (or all constructors of the class).
+     * @param members the reflective members
+     * @param clazz the class declaring the reflective members
+     * @param name the common name of the reflective members.
+     * @return a dynamic method representing all the specified reflective members.
+     */
+    static DynamicMethod createDynamicMethod(final Iterable<? extends AccessibleObject> members, final Class<?> clazz, final String name) {
+        DynamicMethod dynMethod = null;
+        for(final AccessibleObject method: members) {
+            dynMethod = mergeMethods(createDynamicMethod(method), dynMethod, clazz, name);
+        }
+        return dynMethod;
+    }
+
+    /**
+     * Given a reflective method or a constructor, creates a dynamic method that represents it. This method will
+     * distinguish between caller sensitive and ordinary methods/constructors, and create appropriate caller sensitive
+     * dynamic method when needed.
+     * @param m the reflective member
+     * @return the single dynamic method representing the reflective member
+     */
+    private static SingleDynamicMethod createDynamicMethod(final AccessibleObject m) {
+        if(CallerSensitiveDetector.isCallerSensitive(m)) {
+            return new CallerSensitiveDynamicMethod(m);
+        }
+        final Member member = (Member)m;
+        return new SimpleDynamicMethod(unreflectSafely(m), member.getDeclaringClass(), member.getName(), m instanceof Constructor);
+    }
+
+    /**
+     * Unreflects a method handle from a Method or a Constructor using safe (zero-privilege) unreflection. Should be
+     * only used for methods and constructors that are not caller sensitive. If a caller sensitive method were
+     * unreflected through this mechanism, it would not be a security issue, but would be bound to the zero-privilege
+     * unreflector as its caller, and thus completely useless.
+     * @param m the method or constructor
+     * @return the method handle
+     */
+    private static MethodHandle unreflectSafely(final AccessibleObject m) {
+        if(m instanceof Method) {
+            final Method reflMethod = (Method)m;
+            final MethodHandle handle = Lookup.PUBLIC.unreflect(reflMethod);
+            if(Modifier.isStatic(reflMethod.getModifiers())) {
+                return StaticClassIntrospector.editStaticMethodHandle(handle);
+            }
+            return handle;
+        }
+        return StaticClassIntrospector.editConstructorMethodHandle(Lookup.PUBLIC.unreflectConstructor((Constructor<?>)m));
+    }
+
+    private static DynamicMethod mergeMethods(final SingleDynamicMethod method, final DynamicMethod existing, final Class<?> clazz, final String name) {
+        if(existing == null) {
+            return method;
+        } else if(existing.contains(method)) {
+            return existing;
+        } else if(existing instanceof SingleDynamicMethod) {
+            final OverloadedDynamicMethod odm = new OverloadedDynamicMethod(clazz, name);
+            odm.addMethod(((SingleDynamicMethod)existing));
+            odm.addMethod(method);
+            return odm;
+        } else if(existing instanceof OverloadedDynamicMethod) {
+            ((OverloadedDynamicMethod)existing).addMethod(method);
+            return existing;
+        }
+        throw new AssertionError();
+    }
+
+    @Override
+    public GuardedInvocation getGuardedInvocation(final LinkRequest request, final LinkerServices linkerServices)
+            throws Exception {
+        final LinkRequest ncrequest = request.withoutRuntimeContext();
+        // BeansLinker already checked that the name is at least 2 elements long and the first element is "dyn".
+        final CallSiteDescriptor callSiteDescriptor = ncrequest.getCallSiteDescriptor();
+        final String op = callSiteDescriptor.getNameToken(CallSiteDescriptor.OPERATOR);
+        // Either dyn:callMethod:name(this[,args]) or dyn:callMethod(this,name[,args]).
+        if("callMethod" == op) {
+            return getCallPropWithThis(callSiteDescriptor, linkerServices);
+        }
+        List<String> operations = CallSiteDescriptorFactory.tokenizeOperators(callSiteDescriptor);
+        while(!operations.isEmpty()) {
+            final GuardedInvocationComponent gic = getGuardedInvocationComponent(callSiteDescriptor, linkerServices,
+                    operations);
+            if(gic != null) {
+                return gic.getGuardedInvocation();
+            }
+            operations = pop(operations);
+        }
+        return null;
+    }
+
+    protected GuardedInvocationComponent getGuardedInvocationComponent(final CallSiteDescriptor callSiteDescriptor,
+            final LinkerServices linkerServices, final List<String> operations) throws Exception {
+        if(operations.isEmpty()) {
+            return null;
+        }
+        final String op = operations.get(0);
+        // Either dyn:getProp:name(this) or dyn:getProp(this, name)
+        if("getProp".equals(op)) {
+            return getPropertyGetter(callSiteDescriptor, linkerServices, pop(operations));
+        }
+        // Either dyn:setProp:name(this, value) or dyn:setProp(this, name, value)
+        if("setProp".equals(op)) {
+            return getPropertySetter(callSiteDescriptor, linkerServices, pop(operations));
+        }
+        // Either dyn:getMethod:name(this), or dyn:getMethod(this, name)
+        if("getMethod".equals(op)) {
+            return getMethodGetter(callSiteDescriptor, linkerServices, pop(operations));
+        }
+        return null;
+    }
+
+    static final <T> List<T> pop(final List<T> l) {
+        return l.subList(1, l.size());
+    }
+
+    MethodHandle getClassGuard(final CallSiteDescriptor desc) {
+        return getClassGuard(desc.getMethodType());
+    }
+
+    MethodHandle getClassGuard(final MethodType type) {
+        return Guards.asType(classGuard, type);
+    }
+
+    GuardedInvocationComponent getClassGuardedInvocationComponent(final MethodHandle invocation, final MethodType type) {
+        return new GuardedInvocationComponent(invocation, getClassGuard(type), clazz, ValidationType.EXACT_CLASS);
+    }
+
+    SingleDynamicMethod getConstructorMethod(final String signature) {
+        return null;
+    }
+
+    private MethodHandle getAssignableGuard(final MethodType type) {
+        return Guards.asType(assignableGuard, type);
+    }
+
+    private GuardedInvocation getCallPropWithThis(final CallSiteDescriptor callSiteDescriptor, final LinkerServices linkerServices) {
+        switch(callSiteDescriptor.getNameTokenCount()) {
+            case 3: {
+                return createGuardedDynamicMethodInvocation(callSiteDescriptor, linkerServices,
+                        callSiteDescriptor.getNameToken(CallSiteDescriptor.NAME_OPERAND), methods);
+            }
+            default: {
+                return null;
+            }
+        }
+    }
+
+    private GuardedInvocation createGuardedDynamicMethodInvocation(final CallSiteDescriptor callSiteDescriptor,
+            final LinkerServices linkerServices, final String methodName, final Map<String, DynamicMethod> methodMap){
+        final MethodHandle inv = getDynamicMethodInvocation(callSiteDescriptor, linkerServices, methodName, methodMap);
+        return inv == null ? null : new GuardedInvocation(inv, getClassGuard(callSiteDescriptor.getMethodType()));
+    }
+
+    private MethodHandle getDynamicMethodInvocation(final CallSiteDescriptor callSiteDescriptor,
+            final LinkerServices linkerServices, final String methodName, final Map<String, DynamicMethod> methodMap) {
+        final DynamicMethod dynaMethod = getDynamicMethod(methodName, methodMap);
+        return dynaMethod != null ? dynaMethod.getInvocation(callSiteDescriptor, linkerServices) : null;
+    }
+
+    private DynamicMethod getDynamicMethod(final String methodName, final Map<String, DynamicMethod> methodMap) {
+        final DynamicMethod dynaMethod = methodMap.get(methodName);
+        return dynaMethod != null ? dynaMethod : getExplicitSignatureDynamicMethod(methodName, methodMap);
+    }
+
+    private SingleDynamicMethod getExplicitSignatureDynamicMethod(final String fullName,
+            final Map<String, DynamicMethod> methodsMap) {
+        // What's below is meant to support the "name(type, type, ...)" syntax that programmers can use in a method name
+        // to manually pin down an exact overloaded variant. This is not usually required, as the overloaded method
+        // resolution works correctly in almost every situation. However, in presence of many language-specific
+        // conversions with a radically dynamic language, most overloaded methods will end up being constantly selected
+        // at invocation time, so a programmer knowledgeable of the situation might choose to pin down an exact overload
+        // for performance reasons.
+
+        // Is the method name lexically of the form "name(types)"?
+        final int lastChar = fullName.length() - 1;
+        if(fullName.charAt(lastChar) != ')') {
+            return null;
+        }
+        final int openBrace = fullName.indexOf('(');
+        if(openBrace == -1) {
+            return null;
+        }
+
+        final String name = fullName.substring(0, openBrace);
+        final String signature = fullName.substring(openBrace + 1, lastChar);
+
+        // Find an existing method for the "name" part
+        final DynamicMethod simpleNamedMethod = methodsMap.get(name);
+        if(simpleNamedMethod == null) {
+            // explicit signature constructor access
+            // Java.type("java.awt.Color")["(int,int,int)"]
+            // will get Color(int,int,int) constructor of Color class.
+            if (name.isEmpty()) {
+                return getConstructorMethod(signature);
+            }
+
+            return null;
+        }
+
+        // Try to get a narrowed dynamic method for the explicit parameter types.
+        return simpleNamedMethod.getMethodForExactParamTypes(signature);
+    }
+
+    private static final MethodHandle IS_METHOD_HANDLE_NOT_NULL = Guards.isNotNull().asType(MethodType.methodType(
+            boolean.class, MethodHandle.class));
+    private static final MethodHandle CONSTANT_NULL_DROP_METHOD_HANDLE = MethodHandles.dropArguments(
+            MethodHandles.constant(Object.class, null), 0, MethodHandle.class);
+
+    private GuardedInvocationComponent getPropertySetter(final CallSiteDescriptor callSiteDescriptor,
+            final LinkerServices linkerServices, final List<String> operations) throws Exception {
+        switch(callSiteDescriptor.getNameTokenCount()) {
+            case 2: {
+                // Must have three arguments: target object, property name, and property value.
+                assertParameterCount(callSiteDescriptor, 3);
+
+                // We want setters that conform to "Object(O, V)". Note, we aren't doing "R(O, V)" as it might not be
+                // valid for us to convert return values proactively. Also, since we don't know what setters will be
+                // invoked, we'll conservatively presume Object return type.
+                final MethodType type = callSiteDescriptor.getMethodType().changeReturnType(Object.class);
+
+                // What's below is basically:
+                //   foldArguments(guardWithTest(isNotNull, invoke, null|nextComponent.invocation),
+                //     get_setter_handle(type, linkerServices))
+                // only with a bunch of method signature adjustments. Basically, retrieve method setter
+                // MethodHandle; if it is non-null, invoke it, otherwise either return null, or delegate to next
+                // component's invocation.
+
+                // Call site type is "ret_type(object_type,property_name_type,property_value_type)", which we'll
+                // abbreviate to R(O, N, V) going forward, although we don't really use R here (see above about using
+                // Object return type).
+                final MethodType setterType = type.dropParameterTypes(1, 2);
+                // Bind property setter handle to the expected setter type and linker services. Type is
+                // MethodHandle(Object, String, Object)
+                final MethodHandle boundGetter = MethodHandles.insertArguments(getPropertySetterHandle, 0,
+                        CallSiteDescriptorFactory.dropParameterTypes(callSiteDescriptor, 1, 2), linkerServices);
+
+                // Cast getter to MethodHandle(O, N, V)
+                final MethodHandle typedGetter = linkerServices.asType(boundGetter, type.changeReturnType(
+                        MethodHandle.class));
+
+                // Handle to invoke the setter R(MethodHandle, O, V)
+                final MethodHandle invokeHandle = MethodHandles.exactInvoker(setterType);
+                // Handle to invoke the setter, dropping unnecessary fold arguments R(MethodHandle, O, N, V)
+                final MethodHandle invokeHandleFolded = MethodHandles.dropArguments(invokeHandle, 2, type.parameterType(
+                        1));
+                final GuardedInvocationComponent nextComponent = getGuardedInvocationComponent(callSiteDescriptor,
+                        linkerServices, operations);
+
+                final MethodHandle fallbackFolded;
+                if(nextComponent == null) {
+                    // Object(MethodHandle)->Object(MethodHandle, O, N, V); returns constant null
+                    fallbackFolded = MethodHandles.dropArguments(CONSTANT_NULL_DROP_METHOD_HANDLE, 1,
+                            type.parameterList()).asType(type.insertParameterTypes(0, MethodHandle.class));
+                } else {
+                    // Object(O, N, V)->Object(MethodHandle, O, N, V); adapts the next component's invocation to drop the
+                    // extra argument resulting from fold
+                    fallbackFolded = MethodHandles.dropArguments(nextComponent.getGuardedInvocation().getInvocation(),
+                            0, MethodHandle.class);
+                }
+
+                // fold(R(MethodHandle, O, N, V), MethodHandle(O, N, V))
+                final MethodHandle compositeSetter = MethodHandles.foldArguments(MethodHandles.guardWithTest(
+                            IS_METHOD_HANDLE_NOT_NULL, invokeHandleFolded, fallbackFolded), typedGetter);
+                if(nextComponent == null) {
+                    return getClassGuardedInvocationComponent(compositeSetter, type);
+                }
+                return nextComponent.compose(compositeSetter, getClassGuard(type), clazz, ValidationType.EXACT_CLASS);
+            }
+            case 3: {
+                // Must have two arguments: target object and property value
+                assertParameterCount(callSiteDescriptor, 2);
+                final GuardedInvocation gi = createGuardedDynamicMethodInvocation(callSiteDescriptor, linkerServices,
+                        callSiteDescriptor.getNameToken(CallSiteDescriptor.NAME_OPERAND), propertySetters);
+                // If we have a property setter with this name, this composite operation will always stop here
+                if(gi != null) {
+                    return new GuardedInvocationComponent(gi, clazz, ValidationType.EXACT_CLASS);
+                }
+                // If we don't have a property setter with this name, always fall back to the next operation in the
+                // composite (if any)
+                return getGuardedInvocationComponent(callSiteDescriptor, linkerServices, operations);
+            }
+            default: {
+                // More than two name components; don't know what to do with it.
+                return null;
+            }
+        }
+    }
+
+    private static final Lookup privateLookup = new Lookup(MethodHandles.lookup());
+
+    private static final MethodHandle IS_ANNOTATED_METHOD_NOT_NULL = Guards.isNotNull().asType(MethodType.methodType(
+            boolean.class, AnnotatedDynamicMethod.class));
+    private static final MethodHandle CONSTANT_NULL_DROP_ANNOTATED_METHOD = MethodHandles.dropArguments(
+            MethodHandles.constant(Object.class, null), 0, AnnotatedDynamicMethod.class);
+    private static final MethodHandle GET_ANNOTATED_METHOD = privateLookup.findVirtual(AnnotatedDynamicMethod.class,
+            "getTarget", MethodType.methodType(MethodHandle.class, MethodHandles.Lookup.class));
+    private static final MethodHandle GETTER_INVOKER = MethodHandles.invoker(MethodType.methodType(Object.class, Object.class));
+
+    private GuardedInvocationComponent getPropertyGetter(final CallSiteDescriptor callSiteDescriptor,
+            final LinkerServices linkerServices, final List<String> ops) throws Exception {
+        switch(callSiteDescriptor.getNameTokenCount()) {
+            case 2: {
+                // Since we can't know what kind of a getter we'll get back on different invocations, we'll just
+                // conservatively presume Object. Note we can't just coerce to a narrower call site type as the linking
+                // runtime might not allow coercing at that call site.
+                final MethodType type = callSiteDescriptor.getMethodType().changeReturnType(Object.class);
+                // Must have exactly two arguments: receiver and name
+                assertParameterCount(callSiteDescriptor, 2);
+
+                // What's below is basically:
+                //   foldArguments(guardWithTest(isNotNull, invoke(get_handle), null|nextComponent.invocation), get_getter_handle)
+                // only with a bunch of method signature adjustments. Basically, retrieve method getter
+                // AnnotatedDynamicMethod; if it is non-null, invoke its "handle" field, otherwise either return null,
+                // or delegate to next component's invocation.
+
+                final MethodHandle typedGetter = linkerServices.asType(getPropertyGetterHandle, type.changeReturnType(
+                        AnnotatedDynamicMethod.class));
+                final MethodHandle callSiteBoundMethodGetter = MethodHandles.insertArguments(
+                        GET_ANNOTATED_METHOD, 1, callSiteDescriptor.getLookup());
+                final MethodHandle callSiteBoundInvoker = MethodHandles.filterArguments(GETTER_INVOKER, 0,
+                        callSiteBoundMethodGetter);
+                // Object(AnnotatedDynamicMethod, Object)->Object(AnnotatedDynamicMethod, T0)
+                final MethodHandle invokeHandleTyped = linkerServices.asType(callSiteBoundInvoker,
+                        MethodType.methodType(type.returnType(), AnnotatedDynamicMethod.class, type.parameterType(0)));
+                // Since it's in the target of a fold, drop the unnecessary second argument
+                // Object(AnnotatedDynamicMethod, T0)->Object(AnnotatedDynamicMethod, T0, T1)
+                final MethodHandle invokeHandleFolded = MethodHandles.dropArguments(invokeHandleTyped, 2,
+                        type.parameterType(1));
+                final GuardedInvocationComponent nextComponent = getGuardedInvocationComponent(callSiteDescriptor,
+                        linkerServices, ops);
+
+                final MethodHandle fallbackFolded;
+                if(nextComponent == null) {
+                    // Object(AnnotatedDynamicMethod)->Object(AnnotatedDynamicMethod, T0, T1); returns constant null
+                    fallbackFolded = MethodHandles.dropArguments(CONSTANT_NULL_DROP_ANNOTATED_METHOD, 1,
+                            type.parameterList()).asType(type.insertParameterTypes(0, AnnotatedDynamicMethod.class));
+                } else {
+                    // Object(T0, T1)->Object(AnnotatedDynamicMethod, T0, T1); adapts the next component's invocation to
+                    // drop the extra argument resulting from fold and to change its return type to Object.
+                    final MethodHandle nextInvocation = nextComponent.getGuardedInvocation().getInvocation();
+                    final MethodType nextType = nextInvocation.type();
+                    fallbackFolded = MethodHandles.dropArguments(nextInvocation.asType(
+                            nextType.changeReturnType(Object.class)), 0, AnnotatedDynamicMethod.class);
+                }
+
+                // fold(Object(AnnotatedDynamicMethod, T0, T1), AnnotatedDynamicMethod(T0, T1))
+                final MethodHandle compositeGetter = MethodHandles.foldArguments(MethodHandles.guardWithTest(
+                            IS_ANNOTATED_METHOD_NOT_NULL, invokeHandleFolded, fallbackFolded), typedGetter);
+                if(nextComponent == null) {
+                    return getClassGuardedInvocationComponent(compositeGetter, type);
+                }
+                return nextComponent.compose(compositeGetter, getClassGuard(type), clazz, ValidationType.EXACT_CLASS);
+            }
+            case 3: {
+                // Must have exactly one argument: receiver
+                assertParameterCount(callSiteDescriptor, 1);
+                // Fixed name
+                final AnnotatedDynamicMethod annGetter = propertyGetters.get(callSiteDescriptor.getNameToken(
+                        CallSiteDescriptor.NAME_OPERAND));
+                if(annGetter == null) {
+                    // We have no such property, always delegate to the next component operation
+                    return getGuardedInvocationComponent(callSiteDescriptor, linkerServices, ops);
+                }
+                final MethodHandle getter = annGetter.getInvocation(callSiteDescriptor, linkerServices);
+                // NOTE: since property getters (not field getters!) are no-arg, we don't have to worry about them being
+                // overloaded in a subclass. Therefore, we can discover the most abstract superclass that has the
+                // method, and use that as the guard with Guards.isInstance() for a more stably linked call site. If
+                // we're linking against a field getter, don't make the assumption.
+                // NOTE: No delegation to the next component operation if we have a property with this name, even if its
+                // value is null.
+                final ValidationType validationType = annGetter.validationType;
+                // TODO: we aren't using the type that declares the most generic getter here!
+                return new GuardedInvocationComponent(getter, getGuard(validationType,
+                        callSiteDescriptor.getMethodType()), clazz, validationType);
+            }
+            default: {
+                // Can't do anything with more than 3 name components
+                return null;
+            }
+        }
+    }
+
+    private MethodHandle getGuard(final ValidationType validationType, final MethodType methodType) {
+        switch(validationType) {
+            case EXACT_CLASS: {
+                return getClassGuard(methodType);
+            }
+            case INSTANCE_OF: {
+                return getAssignableGuard(methodType);
+            }
+            case IS_ARRAY: {
+                return Guards.isArray(0, methodType);
+            }
+            case NONE: {
+                return null;
+            }
+            default: {
+                throw new AssertionError();
+            }
+        }
+    }
+
+    private static final MethodHandle IS_DYNAMIC_METHOD = Guards.isInstance(DynamicMethod.class,
+            MethodType.methodType(boolean.class, Object.class));
+    private static final MethodHandle OBJECT_IDENTITY = MethodHandles.identity(Object.class);
+
+    private GuardedInvocationComponent getMethodGetter(final CallSiteDescriptor callSiteDescriptor,
+            final LinkerServices linkerServices, final List<String> ops) throws Exception {
+        // The created method handle will always return a DynamicMethod (or null), but since we don't want that type to
+        // be visible outside of this linker, declare it to return Object.
+        final MethodType type = callSiteDescriptor.getMethodType().changeReturnType(Object.class);
+        switch(callSiteDescriptor.getNameTokenCount()) {
+            case 2: {
+                // Must have exactly two arguments: receiver and name
+                assertParameterCount(callSiteDescriptor, 2);
+                final GuardedInvocationComponent nextComponent = getGuardedInvocationComponent(callSiteDescriptor,
+                        linkerServices, ops);
+                if(nextComponent == null || !TypeUtilities.areAssignable(DynamicMethod.class,
+                        nextComponent.getGuardedInvocation().getInvocation().type().returnType())) {
+                    // No next component operation, or it can never produce a dynamic method; just return a component
+                    // for this operation.
+                    return getClassGuardedInvocationComponent(linkerServices.asType(getDynamicMethod, type), type);
+                }
+
+                // What's below is basically:
+                // foldArguments(guardWithTest(isNotNull, identity, nextComponent.invocation), getter) only with a
+                // bunch of method signature adjustments. Basically, execute method getter; if it returns a non-null
+                // DynamicMethod, use identity to return it, otherwise delegate to nextComponent's invocation.
+
+                final MethodHandle typedGetter = linkerServices.asType(getDynamicMethod, type);
+                // Since it is part of the foldArgument() target, it will have extra args that we need to drop.
+                final MethodHandle returnMethodHandle = linkerServices.asType(MethodHandles.dropArguments(
+                        OBJECT_IDENTITY, 1, type.parameterList()), type.insertParameterTypes(0, Object.class));
+                final MethodHandle nextComponentInvocation = nextComponent.getGuardedInvocation().getInvocation();
+                // The assumption is that getGuardedInvocationComponent() already asType()'d it correctly modulo the
+                // return type.
+                assert nextComponentInvocation.type().changeReturnType(type.returnType()).equals(type);
+                // Since it is part of the foldArgument() target, we have to drop an extra arg it receives.
+                final MethodHandle nextCombinedInvocation = MethodHandles.dropArguments(nextComponentInvocation, 0,
+                        Object.class);
+                // Assemble it all into a fold(guard(isNotNull, identity, nextInvocation), get)
+                final MethodHandle compositeGetter = MethodHandles.foldArguments(MethodHandles.guardWithTest(
+                        IS_DYNAMIC_METHOD, returnMethodHandle, nextCombinedInvocation), typedGetter);
+
+                return nextComponent.compose(compositeGetter, getClassGuard(type), clazz, ValidationType.EXACT_CLASS);
+            }
+            case 3: {
+                // Must have exactly one argument: receiver
+                assertParameterCount(callSiteDescriptor, 1);
+                final DynamicMethod method = getDynamicMethod(callSiteDescriptor.getNameToken(
+                        CallSiteDescriptor.NAME_OPERAND));
+                if(method == null) {
+                    // We have no such method, always delegate to the next component
+                    return getGuardedInvocationComponent(callSiteDescriptor, linkerServices, ops);
+                }
+                // No delegation to the next component of the composite operation; if we have a method with that name,
+                // we'll always return it at this point.
+                return getClassGuardedInvocationComponent(linkerServices.asType(MethodHandles.dropArguments(
+                        MethodHandles.constant(Object.class, method), 0, type.parameterType(0)), type), type);
+            }
+            default: {
+                // Can't do anything with more than 3 name components
+                return null;
+            }
+        }
+    }
+
+    static class MethodPair {
+        final MethodHandle method1;
+        final MethodHandle method2;
+
+        MethodPair(final MethodHandle method1, final MethodHandle method2) {
+            this.method1 = method1;
+            this.method2 = method2;
+        }
+
+        MethodHandle guardWithTest(final MethodHandle test) {
+            return MethodHandles.guardWithTest(test, method1, method2);
+        }
+    }
+
+    static MethodPair matchReturnTypes(final MethodHandle m1, final MethodHandle m2) {
+        final MethodType type1 = m1.type();
+        final MethodType type2 = m2.type();
+        final Class<?> commonRetType = TypeUtilities.getCommonLosslessConversionType(type1.returnType(),
+                type2.returnType());
+        return new MethodPair(
+                m1.asType(type1.changeReturnType(commonRetType)),
+                m2.asType(type2.changeReturnType(commonRetType)));
+    }
+
+    private static void assertParameterCount(final CallSiteDescriptor descriptor, final int paramCount) {
+        if(descriptor.getMethodType().parameterCount() != paramCount) {
+            throw new BootstrapMethodError(descriptor.getName() + " must have exactly " + paramCount + " parameters.");
+        }
+    }
+
+    private static MethodHandle GET_PROPERTY_GETTER_HANDLE = MethodHandles.dropArguments(privateLookup.findOwnSpecial(
+            "getPropertyGetterHandle", Object.class, Object.class), 1, Object.class);
+    private final MethodHandle getPropertyGetterHandle = GET_PROPERTY_GETTER_HANDLE.bindTo(this);
+
+    /**
+     * @param id the property ID
+     * @return the method handle for retrieving the property, or null if the property does not exist
+     */
+    @SuppressWarnings("unused")
+    private Object getPropertyGetterHandle(final Object id) {
+        return propertyGetters.get(id);
+    }
+
+    // Type is MethodHandle(BeanLinker, MethodType, LinkerServices, Object, String, Object), of which the two "Object"
+    // args are dropped; this makes handles with first three args conform to "Object, String, Object" though, which is
+    // a typical property setter with variable name signature (target, name, value).
+    private static final MethodHandle GET_PROPERTY_SETTER_HANDLE = MethodHandles.dropArguments(MethodHandles.dropArguments(
+            privateLookup.findOwnSpecial("getPropertySetterHandle", MethodHandle.class, CallSiteDescriptor.class,
+                    LinkerServices.class, Object.class), 3, Object.class), 5, Object.class);
+    // Type is MethodHandle(MethodType, LinkerServices, Object, String, Object)
+    private final MethodHandle getPropertySetterHandle = GET_PROPERTY_SETTER_HANDLE.bindTo(this);
+
+    @SuppressWarnings("unused")
+    private MethodHandle getPropertySetterHandle(final CallSiteDescriptor setterDescriptor, final LinkerServices linkerServices,
+            final Object id) {
+        return getDynamicMethodInvocation(setterDescriptor, linkerServices, String.valueOf(id), propertySetters);
+    }
+
+    private static MethodHandle GET_DYNAMIC_METHOD = MethodHandles.dropArguments(privateLookup.findOwnSpecial(
+            "getDynamicMethod", Object.class, Object.class), 1, Object.class);
+    private final MethodHandle getDynamicMethod = GET_DYNAMIC_METHOD.bindTo(this);
+
+    @SuppressWarnings("unused")
+    // This method is marked to return Object instead of DynamicMethod as it's used as a linking component and we don't
+    // want to make the DynamicMethod type observable externally (e.g. as the return type of a MethodHandle returned for
+    // "dyn:getMethod" linking).
+    private Object getDynamicMethod(final Object name) {
+        return getDynamicMethod(String.valueOf(name), methods);
+    }
+
+    /**
+     * Returns a dynamic method of the specified name.
+     *
+     * @param name name of the method
+     * @return the dynamic method (either {@link SimpleDynamicMethod} or {@link OverloadedDynamicMethod}, or null if the
+     * method with the specified name does not exist.
+     */
+    DynamicMethod getDynamicMethod(final String name) {
+        return getDynamicMethod(name, methods);
+    }
+
+    /**
+     * Find the most generic superclass that declares this getter. Since getters have zero args (aside from the
+     * receiver), they can't be overloaded, so we're free to link with an instanceof guard for the most generic one,
+     * creating more stable call sites.
+     * @param getter the getter
+     * @return getter with same name, declared on the most generic superclass/interface of the declaring class
+     */
+    private static Method getMostGenericGetter(final Method getter) {
+        return getMostGenericGetter(getter.getName(), getter.getReturnType(), getter.getDeclaringClass());
+    }
+
+    private static Method getMostGenericGetter(final String name, final Class<?> returnType, final Class<?> declaringClass) {
+        if(declaringClass == null) {
+            return null;
+        }
+        // Prefer interfaces
+        for(final Class<?> itf: declaringClass.getInterfaces()) {
+            final Method itfGetter = getMostGenericGetter(name, returnType, itf);
+            if(itfGetter != null) {
+                return itfGetter;
+            }
+        }
+        final Method superGetter = getMostGenericGetter(name, returnType, declaringClass.getSuperclass());
+        if(superGetter != null) {
+            return superGetter;
+        }
+        if(!CheckRestrictedPackage.isRestrictedClass(declaringClass)) {
+            try {
+                return declaringClass.getMethod(name);
+            } catch(final NoSuchMethodException e) {
+                // Intentionally ignored, meant to fall through
+            }
+        }
+        return null;
+    }
+
+    private static final class AnnotatedDynamicMethod {
+        private final SingleDynamicMethod method;
+        /*private*/ final ValidationType validationType;
+
+        AnnotatedDynamicMethod(final SingleDynamicMethod method, final ValidationType validationType) {
+            this.method = method;
+            this.validationType = validationType;
+        }
+
+        MethodHandle getInvocation(final CallSiteDescriptor callSiteDescriptor, final LinkerServices linkerServices) {
+            return method.getInvocation(callSiteDescriptor, linkerServices);
+        }
+
+        @SuppressWarnings("unused")
+        MethodHandle getTarget(final MethodHandles.Lookup lookup) {
+            final MethodHandle inv = method.getTarget(lookup);
+            assert inv != null;
+            return inv;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/AccessibleMembersLookup.java	Sun Aug 17 15:56:32 2014 +0100
@@ -0,0 +1,267 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file, and Oracle licenses the original version of this file under the BSD
+ * license:
+ */
+/*
+   Copyright 2009-2013 Attila Szegedi
+
+   Licensed under both the Apache License, Version 2.0 (the "Apache License")
+   and the BSD License (the "BSD License"), with licensee being free to
+   choose either of the two at their discretion.
+
+   You may not use this file except in compliance with either the Apache
+   License or the BSD License.
+
+   If you choose to use this file in compliance with the Apache License, the
+   following notice applies to you:
+
+       You may obtain a copy of the Apache License at
+
+           http://www.apache.org/licenses/LICENSE-2.0
+
+       Unless required by applicable law or agreed to in writing, software
+       distributed under the License is distributed on an "AS IS" BASIS,
+       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+       implied. See the License for the specific language governing
+       permissions and limitations under the License.
+
+   If you choose to use this file in compliance with the BSD License, the
+   following notice applies to you:
+
+       Redistribution and use in source and binary forms, with or without
+       modification, are permitted provided that the following conditions are
+       met:
+       * Redistributions of source code must retain the above copyright
+         notice, this list of conditions and the following disclaimer.
+       * Redistributions in binary form must reproduce the above copyright
+         notice, this list of conditions and the following disclaimer in the
+         documentation and/or other materials provided with the distribution.
+       * Neither the name of the copyright holder nor the names of
+         contributors may be used to endorse or promote products derived from
+         this software without specific prior written permission.
+
+       THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+       IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+       TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+       PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER
+       BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+       CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+       SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+       BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+       WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+       OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+       ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+package jdk.internal.dynalink.beans;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.LinkedHashSet;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Utility class for discovering accessible methods and inner classes. Normally, a public member declared on a class is
+ * accessible (that is, it can be invoked from anywhere). However, this is not the case if the class itself is not
+ * public, or belongs to a restricted-access package. In that case, it is required to lookup a member in a publicly
+ * accessible superclass or implemented interface of the class, and use it instead of the member discovered on the
+ * class.
+ *
+ * @author Attila Szegedi
+ */
+class AccessibleMembersLookup {
+    private final Map<MethodSignature, Method> methods;
+    private final Set<Class<?>> innerClasses;
+    private final boolean instance;
+
+    /**
+     * Creates a mapping for all accessible methods and inner classes on a class.
+     *
+     * @param clazz the inspected class
+     * @param instance true to inspect instance methods, false to inspect static methods.
+     */
+    AccessibleMembersLookup(final Class<?> clazz, final boolean instance) {
+        this.methods = new HashMap<>();
+        this.innerClasses = new LinkedHashSet<>();
+        this.instance = instance;
+        lookupAccessibleMembers(clazz);
+    }
+
+    /**
+     * Returns an accessible method equivalent of a method.
+     *
+     * @param m the method whose accessible equivalent is requested.
+     * @return the accessible equivalent for the method (can be the same as the passed in method), or null if there is
+     * no accessible method equivalent.
+     */
+    Method getAccessibleMethod(final Method m) {
+        return m == null ? null : methods.get(new MethodSignature(m));
+    }
+
+    Collection<Method> getMethods() {
+        return methods.values();
+    }
+
+    Class<?>[] getInnerClasses() {
+        return innerClasses.toArray(new Class<?>[innerClasses.size()]);
+    }
+
+    /**
+     * A helper class that represents a method signature - name and argument types.
+     *
+     * @author Attila Szegedi
+     */
+    static final class MethodSignature {
+        private final String name;
+        private final Class<?>[] args;
+
+        /**
+         * Creates a new method signature from arbitrary data.
+         *
+         * @param name the name of the method this signature represents.
+         * @param args the argument types of the method.
+         */
+        MethodSignature(final String name, final Class<?>[] args) {
+            this.name = name;
+            this.args = args;
+        }
+
+        /**
+         * Creates a signature for the given method.
+         *
+         * @param method the method for which a signature is created.
+         */
+        MethodSignature(final Method method) {
+            this(method.getName(), method.getParameterTypes());
+        }
+
+        /**
+         * Compares this object to another object
+         *
+         * @param o the other object
+         * @return true if the other object is also a method signature with the same name, same number of arguments, and
+         * same types of arguments.
+         */
+        @Override
+        public boolean equals(final Object o) {
+            if(o instanceof MethodSignature) {
+                final MethodSignature ms = (MethodSignature)o;
+                return ms.name.equals(name) && Arrays.equals(args, ms.args);
+            }
+            return false;
+        }
+
+        /**
+         * Returns a hash code, consistent with the overridden {@link #equals(Object)}.
+         */
+        @Override
+        public int hashCode() {
+            return name.hashCode() ^ Arrays.hashCode(args);
+        }
+
+        @Override
+        public String toString() {
+            final StringBuilder b = new StringBuilder();
+            b.append("[MethodSignature ").append(name).append('(');
+            if(args.length > 0) {
+                b.append(args[0].getCanonicalName());
+                for(int i = 1; i < args.length; ++i) {
+                    b.append(", ").append(args[i].getCanonicalName());
+                }
+            }
+            return b.append(")]").toString();
+        }
+    }
+
+    private void lookupAccessibleMembers(final Class<?> clazz) {
+        boolean searchSuperTypes;
+
+        if(!CheckRestrictedPackage.isRestrictedClass(clazz)) {
+            searchSuperTypes = false;
+            for(final Method method: clazz.getMethods()) {
+                final boolean isStatic = Modifier.isStatic(method.getModifiers());
+                if(instance != isStatic) {
+                    final MethodSignature sig = new MethodSignature(method);
+                    if(!methods.containsKey(sig)) {
+                        final Class<?> declaringClass = method.getDeclaringClass();
+                        if(declaringClass != clazz && CheckRestrictedPackage.isRestrictedClass(declaringClass)) {
+                            //Sometimes, the declaring class of a method (Method.getDeclaringClass())
+                            //retrieved through Class.getMethods() for a public class will be a
+                            //non-public superclass. For such a method, we need to find a method with
+                            //the same name and signature in a public superclass or implemented
+                            //interface.
+                            //This typically doesn't happen with classes emitted by a reasonably modern
+                            //javac, as it'll create synthetic delegator methods in all public
+                            //immediate subclasses of the non-public class. We have, however, observed
+                            //this in the wild with class files compiled with older javac that doesn't
+                            //generate the said synthetic delegators.
+                            searchSuperTypes = true;
+                        } else {
+                            // don't allow inherited static
+                            if (!isStatic || clazz == declaringClass) {
+                                methods.put(sig, method);
+                            }
+                        }
+                    }
+                }
+            }
+            for(final Class<?> innerClass: clazz.getClasses()) {
+                // Add both static and non-static classes, regardless of instance flag. StaticClassLinker will just
+                // expose non-static classes with explicit constructor outer class argument.
+                // NOTE: getting inner class objects through getClasses() does not resolve them, so if those classes
+                // were not yet loaded, they'll only get loaded in a non-resolved state; no static initializers for
+                // them will trigger just by doing this.
+                innerClasses.add(innerClass);
+            }
+        } else {
+            searchSuperTypes = true;
+        }
+
+        // don't need to search super types for static methods
+        if(instance && searchSuperTypes) {
+            // If we reach here, the class is either not public, or it is in a restricted package. Alternatively, it is
+            // public, but some of its methods claim that their declaring class is non-public. We'll try superclasses
+            // and implemented interfaces then looking for public ones.
+            final Class<?>[] interfaces = clazz.getInterfaces();
+            for(int i = 0; i < interfaces.length; i++) {
+                lookupAccessibleMembers(interfaces[i]);
+            }
+            final Class<?> superclass = clazz.getSuperclass();
+            if(superclass != null) {
+                lookupAccessibleMembers(superclass);
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/ApplicableOverloadedMethods.java	Sun Aug 17 15:56:32 2014 +0100
@@ -0,0 +1,219 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file, and Oracle licenses the original version of this file under the BSD
+ * license:
+ */
+/*
+   Copyright 2009-2013 Attila Szegedi
+
+   Licensed under both the Apache License, Version 2.0 (the "Apache License")
+   and the BSD License (the "BSD License"), with licensee being free to
+   choose either of the two at their discretion.
+
+   You may not use this file except in compliance with either the Apache
+   License or the BSD License.
+
+   If you choose to use this file in compliance with the Apache License, the
+   following notice applies to you:
+
+       You may obtain a copy of the Apache License at
+
+           http://www.apache.org/licenses/LICENSE-2.0
+
+       Unless required by applicable law or agreed to in writing, software
+       distributed under the License is distributed on an "AS IS" BASIS,
+       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+       implied. See the License for the specific language governing
+       permissions and limitations under the License.
+
+   If you choose to use this file in compliance with the BSD License, the
+   following notice applies to you:
+
+       Redistribution and use in source and binary forms, with or without
+       modification, are permitted provided that the following conditions are
+       met:
+       * Redistributions of source code must retain the above copyright
+         notice, this list of conditions and the following disclaimer.
+       * Redistributions in binary form must reproduce the above copyright
+         notice, this list of conditions and the following disclaimer in the
+         documentation and/or other materials provided with the distribution.
+       * Neither the name of the copyright holder nor the names of
+         contributors may be used to endorse or promote products derived from
+         this software without specific prior written permission.
+
+       THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+       IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+       TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+       PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER
+       BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+       CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+       SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+       BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+       WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+       OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+       ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+package jdk.internal.dynalink.beans;
+
+import java.lang.invoke.MethodType;
+import java.util.LinkedList;
+import java.util.List;
+import jdk.internal.dynalink.support.TypeUtilities;
+
+/**
+ * Represents overloaded methods applicable to a specific call site signature.
+ *
+ * @author Attila Szegedi
+ */
+class ApplicableOverloadedMethods {
+    private final List<SingleDynamicMethod> methods;
+    private final boolean varArgs;
+
+    /**
+     * Creates a new ApplicableOverloadedMethods instance
+     *
+     * @param methods a list of all overloaded methods with the same name for a class.
+     * @param callSiteType the type of the call site
+     * @param test applicability test. One of {@link #APPLICABLE_BY_SUBTYPING},
+     * {@link #APPLICABLE_BY_METHOD_INVOCATION_CONVERSION}, or {@link #APPLICABLE_BY_VARIABLE_ARITY}.
+     */
+    ApplicableOverloadedMethods(final List<SingleDynamicMethod> methods, final MethodType callSiteType,
+            final ApplicabilityTest test) {
+        this.methods = new LinkedList<>();
+        for(final SingleDynamicMethod m: methods) {
+            if(test.isApplicable(callSiteType, m)) {
+                this.methods.add(m);
+            }
+        }
+        varArgs = test == APPLICABLE_BY_VARIABLE_ARITY;
+    }
+
+    /**
+     * Retrieves all the methods this object holds.
+     *
+     * @return list of all methods.
+     */
+    List<SingleDynamicMethod> getMethods() {
+        return methods;
+    }
+
+    /**
+     * Returns a list of all methods in this objects that are maximally specific.
+     *
+     * @return a list of maximally specific methods.
+     */
+    List<SingleDynamicMethod> findMaximallySpecificMethods() {
+        return MaximallySpecific.getMaximallySpecificMethods(methods, varArgs);
+    }
+
+    abstract static class ApplicabilityTest {
+        abstract boolean isApplicable(MethodType callSiteType, SingleDynamicMethod method);
+    }
+
+    /**
+     * Implements the applicability-by-subtyping test from JLS 15.12.2.2.
+     */
+    static final ApplicabilityTest APPLICABLE_BY_SUBTYPING = new ApplicabilityTest() {
+        @Override
+        boolean isApplicable(final MethodType callSiteType, final SingleDynamicMethod method) {
+            final MethodType methodType = method.getMethodType();
+            final int methodArity = methodType.parameterCount();
+            if(methodArity != callSiteType.parameterCount()) {
+                return false;
+            }
+            // 0th arg is receiver; it doesn't matter for overload
+            // resolution.
+            for(int i = 1; i < methodArity; ++i) {
+                if(!TypeUtilities.isSubtype(callSiteType.parameterType(i), methodType.parameterType(i))) {
+                    return false;
+                }
+            }
+            return true;
+        }
+    };
+
+    /**
+     * Implements the applicability-by-method-invocation-conversion test from JLS 15.12.2.3.
+     */
+    static final ApplicabilityTest APPLICABLE_BY_METHOD_INVOCATION_CONVERSION = new ApplicabilityTest() {
+        @Override
+        boolean isApplicable(final MethodType callSiteType, final SingleDynamicMethod method) {
+            final MethodType methodType = method.getMethodType();
+            final int methodArity = methodType.parameterCount();
+            if(methodArity != callSiteType.parameterCount()) {
+                return false;
+            }
+            // 0th arg is receiver; it doesn't matter for overload
+            // resolution.
+            for(int i = 1; i < methodArity; ++i) {
+                if(!TypeUtilities.isMethodInvocationConvertible(callSiteType.parameterType(i),
+                        methodType.parameterType(i))) {
+                    return false;
+                }
+            }
+            return true;
+        }
+    };
+
+    /**
+     * Implements the applicability-by-variable-arity test from JLS 15.12.2.4.
+     */
+    static final ApplicabilityTest APPLICABLE_BY_VARIABLE_ARITY = new ApplicabilityTest() {
+        @Override
+        boolean isApplicable(final MethodType callSiteType, final SingleDynamicMethod method) {
+            if(!method.isVarArgs()) {
+                return false;
+            }
+            final MethodType methodType = method.getMethodType();
+            final int methodArity = methodType.parameterCount();
+            final int fixArity = methodArity - 1;
+            final int callSiteArity = callSiteType.parameterCount();
+            if(fixArity > callSiteArity) {
+                return false;
+            }
+            // 0th arg is receiver; it doesn't matter for overload
+            // resolution.
+            for(int i = 1; i < fixArity; ++i) {
+                if(!TypeUtilities.isMethodInvocationConvertible(callSiteType.parameterType(i),
+                        methodType.parameterType(i))) {
+                    return false;
+                }
+            }
+            final Class<?> varArgType = methodType.parameterType(fixArity).getComponentType();
+            for(int i = fixArity; i < callSiteArity; ++i) {
+                if(!TypeUtilities.isMethodInvocationConvertible(callSiteType.parameterType(i), varArgType)) {
+                    return false;
+                }
+            }
+            return true;
+        }
+    };
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/BeanIntrospector.java	Sun Aug 17 15:56:32 2014 +0100
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file, and Oracle licenses the original version of this file under the BSD
+ * license:
+ */
+/*
+   Copyright 2009-2013 Attila Szegedi
+
+   Licensed under both the Apache License, Version 2.0 (the "Apache License")
+   and the BSD License (the "BSD License"), with licensee being free to
+   choose either of the two at their discretion.
+
+   You may not use this file except in compliance with either the Apache
+   License or the BSD License.
+
+   If you choose to use this file in compliance with the Apache License, the
+   following notice applies to you:
+
+       You may obtain a copy of the Apache License at
+
+           http://www.apache.org/licenses/LICENSE-2.0
+
+       Unless required by applicable law or agreed to in writing, software
+       distributed under the License is distributed on an "AS IS" BASIS,
+       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+       implied. See the License for the specific language governing
+       permissions and limitations under the License.
+
+   If you choose to use this file in compliance with the BSD License, the
+   following notice applies to you:
+
+       Redistribution and use in source and binary forms, with or without
+       modification, are permitted provided that the following conditions are
+       met:
+       * Redistributions of source code must retain the above copyright
+         notice, this list of conditions and the following disclaimer.
+       * Redistributions in binary form must reproduce the above copyright
+         notice, this list of conditions and the following disclaimer in the
+         documentation and/or other materials provided with the distribution.
+       * Neither the name of the copyright holder nor the names of
+         contributors may be used to endorse or promote products derived from
+         this software without specific prior written permission.
+
+       THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+       IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+       TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+       PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER
+       BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+       CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+       SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+       BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+       WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+       OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+       ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+package jdk.internal.dynalink.beans;
+
+import java.lang.invoke.MethodHandle;
+import java.util.Collections;
+import java.util.Map;
+
+class BeanIntrospector extends FacetIntrospector {
+    BeanIntrospector(final Class<?> clazz) {
+        super(clazz, true);
+    }
+
+    @Override
+    Map<String, MethodHandle> getInnerClassGetters() {
+        return Collections.emptyMap(); // NOTE: non-static inner classes are also on StaticClassIntrospector.
+    }
+
+    @Override
+    MethodHandle editMethodHandle(final MethodHandle mh) {
+        return mh;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/BeanLinker.java	Sun Aug 17 15:56:32 2014 +0100
@@ -0,0 +1,496 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file, and Oracle licenses the original version of this file under the BSD
+ * license:
+ */
+/*
+   Copyright 2009-2013 Attila Szegedi
+
+   Licensed under both the Apache License, Version 2.0 (the "Apache License")
+   and the BSD License (the "BSD License"), with licensee being free to
+   choose either of the two at their discretion.
+
+   You may not use this file except in compliance with either the Apache
+   License or the BSD License.
+
+   If you choose to use this file in compliance with the Apache License, the
+   following notice applies to you:
+
+       You may obtain a copy of the Apache License at
+
+           http://www.apache.org/licenses/LICENSE-2.0
+
+       Unless required by applicable law or agreed to in writing, software
+       distributed under the License is distributed on an "AS IS" BASIS,
+       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+       implied. See the License for the specific language governing
+       permissions and limitations under the License.
+
+   If you choose to use this file in compliance with the BSD License, the
+   following notice applies to you:
+
+       Redistribution and use in source and binary forms, with or without
+       modification, are permitted provided that the following conditions are
+       met:
+       * Redistributions of source code must retain the above copyright
+         notice, this list of conditions and the following disclaimer.
+       * Redistributions in binary form must reproduce the above copyright
+         notice, this list of conditions and the following disclaimer in the
+         documentation and/or other materials provided with the distribution.
+       * Neither the name of the copyright holder nor the names of
+         contributors may be used to endorse or promote products derived from
+         this software without specific prior written permission.
+
+       THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+       IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+       TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+       PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER
+       BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+       CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+       SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+       BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+       WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+       OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+       ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+package jdk.internal.dynalink.beans;
+
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodType;
+import java.lang.reflect.Array;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import jdk.internal.dynalink.CallSiteDescriptor;
+import jdk.internal.dynalink.beans.GuardedInvocationComponent.ValidationType;
+import jdk.internal.dynalink.linker.GuardedInvocation;
+import jdk.internal.dynalink.linker.LinkerServices;
+import jdk.internal.dynalink.linker.TypeBasedGuardingDynamicLinker;
+import jdk.internal.dynalink.support.Guards;
+import jdk.internal.dynalink.support.Lookup;
+import jdk.internal.dynalink.support.TypeUtilities;
+
+/**
+ * A class that provides linking capabilities for a single POJO class. Normally not used directly, but managed by
+ * {@link BeansLinker}.
+ *
+ * @author Attila Szegedi
+ */
+class BeanLinker extends AbstractJavaLinker implements TypeBasedGuardingDynamicLinker {
+    BeanLinker(final Class<?> clazz) {
+        super(clazz, Guards.getClassGuard(clazz), Guards.getInstanceOfGuard(clazz));
+        if(clazz.isArray()) {
+            // Some languages won't have a notion of manipulating collections. Exposing "length" on arrays as an
+            // explicit property is beneficial for them.
+            // REVISIT: is it maybe a code smell that "dyn:getLength" is not needed?
+            setPropertyGetter("length", GET_ARRAY_LENGTH, ValidationType.IS_ARRAY);
+        } else if(List.class.isAssignableFrom(clazz)) {
+            setPropertyGetter("length", GET_COLLECTION_LENGTH, ValidationType.INSTANCE_OF);
+        }
+    }
+
+    @Override
+    public boolean canLinkType(final Class<?> type) {
+        return type == clazz;
+    }
+
+    @Override
+    FacetIntrospector createFacetIntrospector() {
+        return new BeanIntrospector(clazz);
+    }
+
+    @Override
+    protected GuardedInvocationComponent getGuardedInvocationComponent(final CallSiteDescriptor callSiteDescriptor,
+            final LinkerServices linkerServices, final List<String> operations) throws Exception {
+        final GuardedInvocationComponent superGic = super.getGuardedInvocationComponent(callSiteDescriptor,
+                linkerServices, operations);
+        if(superGic != null) {
+            return superGic;
+        }
+        if(operations.isEmpty()) {
+            return null;
+        }
+        final String op = operations.get(0);
+        // dyn:getElem(this, id)
+        // id is typically either an int (for arrays and lists) or an object (for maps). linkerServices can provide
+        // conversion from call site argument type though.
+        if("getElem".equals(op)) {
+            return getElementGetter(callSiteDescriptor, linkerServices, pop(operations));
+        }
+        if("setElem".equals(op)) {
+            return getElementSetter(callSiteDescriptor, linkerServices, pop(operations));
+        }
+        // dyn:getLength(this) (works on Java arrays, collections, and maps)
+        if("getLength".equals(op)) {
+            return getLengthGetter(callSiteDescriptor);
+        }
+        return null;
+    }
+
+    private static MethodHandle GET_LIST_ELEMENT = Lookup.PUBLIC.findVirtual(List.class, "get",
+            MethodType.methodType(Object.class, int.class));
+
+    private static MethodHandle GET_MAP_ELEMENT = Lookup.PUBLIC.findVirtual(Map.class, "get",
+            MethodType.methodType(Object.class, Object.class));
+
+    private static MethodHandle LIST_GUARD = Guards.getInstanceOfGuard(List.class);
+    private static MethodHandle MAP_GUARD = Guards.getInstanceOfGuard(Map.class);
+
+    private GuardedInvocationComponent getElementGetter(final CallSiteDescriptor callSiteDescriptor,
+            final LinkerServices linkerServices, final List<String> operations) throws Exception {
+        final MethodType callSiteType = callSiteDescriptor.getMethodType();
+        final Class<?> declaredType = callSiteType.parameterType(0);
+        final GuardedInvocationComponent nextComponent = getGuardedInvocationComponent(callSiteDescriptor,
+                linkerServices, operations);
+
+        // If declared type of receiver at the call site is already an array, a list or map, bind without guard. Thing
+        // is, it'd be quite stupid of a call site creator to go though invokedynamic when it knows in advance they're
+        // dealing with an array, or a list or map, but hey...
+        // Note that for arrays and lists, using LinkerServices.asType() will ensure that any language specific linkers
+        // in use will get a chance to perform any (if there's any) implicit conversion to integer for the indices.
+        final GuardedInvocationComponent gic;
+        final boolean isMap;
+        if(declaredType.isArray()) {
+            gic = new GuardedInvocationComponent(MethodHandles.arrayElementGetter(declaredType));
+            isMap = false;
+        } else if(List.class.isAssignableFrom(declaredType)) {
+            gic = new GuardedInvocationComponent(GET_LIST_ELEMENT);
+            isMap = false;
+        } else if(Map.class.isAssignableFrom(declaredType)) {
+            gic = new GuardedInvocationComponent(GET_MAP_ELEMENT);
+            isMap = true;
+        } else if(clazz.isArray()) {
+            gic = getClassGuardedInvocationComponent(MethodHandles.arrayElementGetter(clazz), callSiteType);
+            isMap = false;
+        } else if(List.class.isAssignableFrom(clazz)) {
+            gic = new GuardedInvocationComponent(GET_LIST_ELEMENT, Guards.asType(LIST_GUARD, callSiteType), List.class,
+                    ValidationType.INSTANCE_OF);
+            isMap = false;
+        } else if(Map.class.isAssignableFrom(clazz)) {
+            gic = new GuardedInvocationComponent(GET_MAP_ELEMENT, Guards.asType(MAP_GUARD, callSiteType), Map.class,
+                    ValidationType.INSTANCE_OF);
+            isMap = true;
+        } else {
+            // Can't retrieve elements for objects that are neither arrays, nor list, nor maps.
+            return nextComponent;
+        }
+
+        // We can have "dyn:getElem:foo", especially in composites, i.e. "dyn:getElem|getProp|getMethod:foo"
+        final String fixedKey = getFixedKey(callSiteDescriptor);
+        // Convert the key to a number if we're working with a list or array
+        final Object typedFixedKey;
+        if(!isMap && fixedKey != null) {
+            typedFixedKey = convertKeyToInteger(fixedKey, linkerServices);
+            if(typedFixedKey == null) {
+                // key is not numeric, it can never succeed
+                return nextComponent;
+            }
+        } else {
+            typedFixedKey = fixedKey;
+        }
+
+        final GuardedInvocation gi = gic.getGuardedInvocation();
+        final Binder binder = new Binder(linkerServices, callSiteType, typedFixedKey);
+        final MethodHandle invocation = gi.getInvocation();
+
+        if(nextComponent == null) {
+            return gic.replaceInvocation(binder.bind(invocation));
+        }
+
+        final MethodHandle checkGuard;
+        if(invocation == GET_LIST_ELEMENT) {
+            checkGuard = convertArgToInt(RANGE_CHECK_LIST, linkerServices, callSiteDescriptor);
+        } else if(invocation == GET_MAP_ELEMENT) {
+            // TODO: A more complex solution could be devised for maps, one where we do a get() first, and fold it
+            // into a GWT that tests if it returned null, and if it did, do another GWT with containsKey()
+            // that returns constant null (on true), or falls back to next component (on false)
+            checkGuard = CONTAINS_MAP;
+        } else {
+            checkGuard = convertArgToInt(RANGE_CHECK_ARRAY, linkerServices, callSiteDescriptor);
+        }
+        final MethodPair matchedInvocations = matchReturnTypes(binder.bind(invocation),
+                nextComponent.getGuardedInvocation().getInvocation());
+        return nextComponent.compose(matchedInvocations.guardWithTest(binder.bindTest(checkGuard)), gi.getGuard(),
+                gic.getValidatorClass(), gic.getValidationType());
+    }
+
+    private static String getFixedKey(final CallSiteDescriptor callSiteDescriptor) {
+        return callSiteDescriptor.getNameTokenCount() == 2 ? null : callSiteDescriptor.getNameToken(
+                CallSiteDescriptor.NAME_OPERAND);
+    }
+
+    private static Object convertKeyToInteger(final String fixedKey, final LinkerServices linkerServices) throws Exception {
+        try {
+            if(linkerServices.canConvert(String.class, Number.class)) {
+                try {
+                    final Object val = linkerServices.getTypeConverter(String.class, Number.class).invoke(fixedKey);
+                    if(!(val instanceof Number)) {
+                        return null; // not a number
+                    }
+                    final Number n = (Number)val;
+                    if(n instanceof Integer) {
+                        return n;
+                    }
+                    final int intIndex = n.intValue();
+                    final double doubleValue = n.doubleValue();
+                    if(intIndex != doubleValue && !Double.isInfinite(doubleValue)) { // let infinites trigger IOOBE
+                        return null; // not an exact integer
+                    }
+                    return Integer.valueOf(intIndex);
+                } catch(Exception|Error e) {
+                    throw e;
+                } catch(final Throwable t) {
+                    throw new RuntimeException(t);
+                }
+            }
+            return Integer.valueOf(fixedKey);
+        } catch(final NumberFormatException e) {
+            // key is not a number
+            return null;
+        }
+    }
+
+    private static MethodHandle convertArgToInt(final MethodHandle mh, final LinkerServices ls, final CallSiteDescriptor desc) {
+        final Class<?> sourceType = desc.getMethodType().parameterType(1);
+        if(TypeUtilities.isMethodInvocationConvertible(sourceType, Number.class)) {
+            return mh;
+        } else if(ls.canConvert(sourceType, Number.class)) {
+            final MethodHandle converter = ls.getTypeConverter(sourceType, Number.class);
+            return MethodHandles.filterArguments(mh, 1, converter.asType(converter.type().changeReturnType(
+                    mh.type().parameterType(1))));
+        }
+        return mh;
+    }
+
+    /**
+     * Contains methods to adapt an item getter/setter method handle to the requested type, optionally binding it to a
+     * fixed key first.
+     * @author Attila Szegedi
+     * @version $Id: $
+     */
+    private static class Binder {
+        private final LinkerServices linkerServices;
+        private final MethodType methodType;
+        private final Object fixedKey;
+
+        Binder(final LinkerServices linkerServices, final MethodType methodType, final Object fixedKey) {
+            this.linkerServices = linkerServices;
+            this.methodType = fixedKey == null ? methodType : methodType.insertParameterTypes(1, fixedKey.getClass());
+            this.fixedKey = fixedKey;
+        }
+
+        /*private*/ MethodHandle bind(final MethodHandle handle) {
+            return bindToFixedKey(linkerServices.asTypeLosslessReturn(handle, methodType));
+        }
+
+        /*private*/ MethodHandle bindTest(final MethodHandle handle) {
+            return bindToFixedKey(Guards.asType(handle, methodType));
+        }
+
+        private MethodHandle bindToFixedKey(final MethodHandle handle) {
+            return fixedKey == null ? handle : MethodHandles.insertArguments(handle, 1, fixedKey);
+        }
+    }
+
+    private static MethodHandle RANGE_CHECK_ARRAY = findRangeCheck(Object.class);
+    private static MethodHandle RANGE_CHECK_LIST = findRangeCheck(List.class);
+    private static MethodHandle CONTAINS_MAP = Lookup.PUBLIC.findVirtual(Map.class, "containsKey",
+            MethodType.methodType(boolean.class, Object.class));
+
+    private static MethodHandle findRangeCheck(final Class<?> collectionType) {
+        return Lookup.findOwnStatic(MethodHandles.lookup(), "rangeCheck", boolean.class, collectionType, Object.class);
+    }
+
+    @SuppressWarnings("unused")
+    private static final boolean rangeCheck(final Object array, final Object index) {
+        if(!(index instanceof Number)) {
+            return false;
+        }
+        final Number n = (Number)index;
+        final int intIndex = n.intValue();
+        final double doubleValue = n.doubleValue();
+        if(intIndex != doubleValue && !Double.isInfinite(doubleValue)) { // let infinite trigger IOOBE
+            return false;
+        }
+        if(0 <= intIndex && intIndex < Array.getLength(array)) {
+            return true;
+        }
+        throw new ArrayIndexOutOfBoundsException("Array index out of range: " + n);
+    }
+
+    @SuppressWarnings("unused")
+    private static final boolean rangeCheck(final List<?> list, final Object index) {
+        if(!(index instanceof Number)) {
+            return false;
+        }
+        final Number n = (Number)index;
+        final int intIndex = n.intValue();
+        final double doubleValue = n.doubleValue();
+        if(intIndex != doubleValue && !Double.isInfinite(doubleValue)) { // let infinite trigger IOOBE
+            return false;
+        }
+        if(0 <= intIndex && intIndex < list.size()) {
+            return true;
+        }
+        throw new IndexOutOfBoundsException("Index: " + n + ", Size: " + list.size());
+    }
+
+    private static MethodHandle SET_LIST_ELEMENT = Lookup.PUBLIC.findVirtual(List.class, "set",
+            MethodType.methodType(Object.class, int.class, Object.class));
+
+    private static MethodHandle PUT_MAP_ELEMENT = Lookup.PUBLIC.findVirtual(Map.class, "put",
+            MethodType.methodType(Object.class, Object.class, Object.class));
+
+    private GuardedInvocationComponent getElementSetter(final CallSiteDescriptor callSiteDescriptor,
+            final LinkerServices linkerServices, final List<String> operations) throws Exception {
+        final MethodType callSiteType = callSiteDescriptor.getMethodType();
+        final Class<?> declaredType = callSiteType.parameterType(0);
+
+        final GuardedInvocationComponent gic;
+        // If declared type of receiver at the call site is already an array, a list or map, bind without guard. Thing
+        // is, it'd be quite stupid of a call site creator to go though invokedynamic when it knows in advance they're
+        // dealing with an array, or a list or map, but hey...
+        // Note that for arrays and lists, using LinkerServices.asType() will ensure that any language specific linkers
+        // in use will get a chance to perform any (if there's any) implicit conversion to integer for the indices.
+        final boolean isMap;
+        if(declaredType.isArray()) {
+            gic = new GuardedInvocationComponent(MethodHandles.arrayElementSetter(declaredType));
+            isMap = false;
+        } else if(List.class.isAssignableFrom(declaredType)) {
+            gic = new GuardedInvocationComponent(SET_LIST_ELEMENT);
+            isMap = false;
+        } else if(Map.class.isAssignableFrom(declaredType)) {
+            gic = new GuardedInvocationComponent(PUT_MAP_ELEMENT);
+            isMap = true;
+        } else if(clazz.isArray()) {
+            gic = getClassGuardedInvocationComponent(MethodHandles.arrayElementSetter(clazz), callSiteType);
+            isMap = false;
+        } else if(List.class.isAssignableFrom(clazz)) {
+            gic = new GuardedInvocationComponent(SET_LIST_ELEMENT, Guards.asType(LIST_GUARD, callSiteType), List.class,
+                    ValidationType.INSTANCE_OF);
+            isMap = false;
+        } else if(Map.class.isAssignableFrom(clazz)) {
+            gic = new GuardedInvocationComponent(PUT_MAP_ELEMENT, Guards.asType(MAP_GUARD, callSiteType), Map.class,
+                    ValidationType.INSTANCE_OF);
+            isMap = true;
+        } else {
+            // Can't set elements for objects that are neither arrays, nor list, nor maps.
+            gic = null;
+            isMap = false;
+        }
+
+        // In contrast to, say, getElementGetter, we only compute the nextComponent if the target object is not a map,
+        // as maps will always succeed in setting the element and will never need to fall back to the next component
+        // operation.
+        final GuardedInvocationComponent nextComponent = isMap ? null : getGuardedInvocationComponent(
+                callSiteDescriptor, linkerServices, operations);
+        if(gic == null) {
+            return nextComponent;
+        }
+
+        // We can have "dyn:setElem:foo", especially in composites, i.e. "dyn:setElem|setProp:foo"
+        final String fixedKey = getFixedKey(callSiteDescriptor);
+        // Convert the key to a number if we're working with a list or array
+        final Object typedFixedKey;
+        if(!isMap && fixedKey != null) {
+            typedFixedKey = convertKeyToInteger(fixedKey, linkerServices);
+            if(typedFixedKey == null) {
+                // key is not numeric, it can never succeed
+                return nextComponent;
+            }
+        } else {
+            typedFixedKey = fixedKey;
+        }
+
+        final GuardedInvocation gi = gic.getGuardedInvocation();
+        final Binder binder = new Binder(linkerServices, callSiteType, typedFixedKey);
+        final MethodHandle invocation = gi.getInvocation();
+
+        if(nextComponent == null) {
+            return gic.replaceInvocation(binder.bind(invocation));
+        }
+
+        final MethodHandle checkGuard = convertArgToInt(invocation == SET_LIST_ELEMENT ? RANGE_CHECK_LIST :
+            RANGE_CHECK_ARRAY, linkerServices, callSiteDescriptor);
+        final MethodPair matchedInvocations = matchReturnTypes(binder.bind(invocation),
+                nextComponent.getGuardedInvocation().getInvocation());
+        return nextComponent.compose(matchedInvocations.guardWithTest(binder.bindTest(checkGuard)), gi.getGuard(),
+                gic.getValidatorClass(), gic.getValidationType());
+    }
+
+    private static MethodHandle GET_ARRAY_LENGTH = Lookup.PUBLIC.findStatic(Array.class, "getLength",
+            MethodType.methodType(int.class, Object.class));
+
+    private static MethodHandle GET_COLLECTION_LENGTH = Lookup.PUBLIC.findVirtual(Collection.class, "size",
+            MethodType.methodType(int.class));
+
+    private static MethodHandle GET_MAP_LENGTH = Lookup.PUBLIC.findVirtual(Map.class, "size",
+            MethodType.methodType(int.class));
+
+    private static MethodHandle COLLECTION_GUARD = Guards.getInstanceOfGuard(Collection.class);
+
+    private GuardedInvocationComponent getLengthGetter(final CallSiteDescriptor callSiteDescriptor) {
+        assertParameterCount(callSiteDescriptor, 1);
+        final MethodType callSiteType = callSiteDescriptor.getMethodType();
+        final Class<?> declaredType = callSiteType.parameterType(0);
+        // If declared type of receiver at the call site is already an array, collection, or map, bind without guard.
+        // Thing is, it'd be quite stupid of a call site creator to go though invokedynamic when it knows in advance
+        // they're dealing with an array, collection, or map, but hey...
+        if(declaredType.isArray()) {
+            return new GuardedInvocationComponent(GET_ARRAY_LENGTH.asType(callSiteType));
+        } else if(Collection.class.isAssignableFrom(declaredType)) {
+            return new GuardedInvocationComponent(GET_COLLECTION_LENGTH.asType(callSiteType));
+        } else if(Map.class.isAssignableFrom(declaredType)) {
+            return new GuardedInvocationComponent(GET_MAP_LENGTH.asType(callSiteType));
+        }
+
+        // Otherwise, create a binding based on the actual type of the argument with an appropriate guard.
+        if(clazz.isArray()) {
+            return new GuardedInvocationComponent(GET_ARRAY_LENGTH.asType(callSiteType), Guards.isArray(0,
+                    callSiteType), ValidationType.IS_ARRAY);
+        } if(Collection.class.isAssignableFrom(clazz)) {
+            return new GuardedInvocationComponent(GET_COLLECTION_LENGTH.asType(callSiteType), Guards.asType(
+                    COLLECTION_GUARD, callSiteType), Collection.class, ValidationType.INSTANCE_OF);
+        } if(Map.class.isAssignableFrom(clazz)) {
+            return new GuardedInvocationComponent(GET_MAP_LENGTH.asType(callSiteType), Guards.asType(MAP_GUARD,
+                    callSiteType), Map.class, ValidationType.INSTANCE_OF);
+        }
+        // Can't retrieve length for objects that are neither arrays, nor collections, nor maps.
+        return null;
+    }
+
+    private static void assertParameterCount(final CallSiteDescriptor descriptor, final int paramCount) {
+        if(descriptor.getMethodType().parameterCount() != paramCount) {
+            throw new BootstrapMethodError(descriptor.getName() + " must have exactly " + paramCount + " parameters.");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/BeansLinker.java	Sun Aug 17 15:56:32 2014 +0100
@@ -0,0 +1,274 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file, and Oracle licenses the original version of this file under the BSD
+ * license:
+ */
+/*
+   Copyright 2009-2013 Attila Szegedi
+
+   Licensed under both the Apache License, Version 2.0 (the "Apache License")
+   and the BSD License (the "BSD License"), with licensee being free to
+   choose either of the two at their discretion.
+
+   You may not use this file except in compliance with either the Apache
+   License or the BSD License.
+
+   If you choose to use this file in compliance with the Apache License, the
+   following notice applies to you:
+
+       You may obtain a copy of the Apache License at
+
+           http://www.apache.org/licenses/LICENSE-2.0
+
+       Unless required by applicable law or agreed to in writing, software
+       distributed under the License is distributed on an "AS IS" BASIS,
+       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+       implied. See the License for the specific language governing
+       permissions and limitations under the License.
+
+   If you choose to use this file in compliance with the BSD License, the
+   following notice applies to you:
+
+       Redistribution and use in source and binary forms, with or without
+       modification, are permitted provided that the following conditions are
+       met:
+       * Redistributions of source code must retain the above copyright
+         notice, this list of conditions and the following disclaimer.
+       * Redistributions in binary form must reproduce the above copyright
+         notice, this list of conditions and the following disclaimer in the
+         documentation and/or other materials provided with the distribution.
+       * Neither the name of the copyright holder nor the names of
+         contributors may be used to endorse or promote products derived from
+         this software without specific prior written permission.
+
+       THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+       IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+       TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+       PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER
+       BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+       CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+       SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+       BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+       WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+       OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+       ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+package jdk.internal.dynalink.beans;
+
+import java.lang.invoke.MethodHandles;
+import java.util.Collection;
+import java.util.Collections;
+import jdk.internal.dynalink.CallSiteDescriptor;
+import jdk.internal.dynalink.DynamicLinkerFactory;
+import jdk.internal.dynalink.linker.GuardedInvocation;
+import jdk.internal.dynalink.linker.GuardingDynamicLinker;
+import jdk.internal.dynalink.linker.LinkRequest;
+import jdk.internal.dynalink.linker.LinkerServices;
+import jdk.internal.dynalink.linker.TypeBasedGuardingDynamicLinker;
+
+/**
+ * A linker for POJOs. Normally used as the ultimate fallback linker by the {@link DynamicLinkerFactory} so it is given
+ * the chance to link calls to all objects that no other language runtime recognizes. Specifically, this linker will:
+ * <ul>
+ * <li>expose all public methods of form {@code setXxx()}, {@code getXxx()}, and {@code isXxx()} as property setters and
+ * getters for {@code dyn:setProp} and {@code dyn:getProp} operations;</li>
+ * <li>expose all public methods for invocation through {@code dyn:callMethod} operation;</li>
+ * <li>expose all public methods for retrieval for {@code dyn:getMethod} operation; the methods thus retrieved can then
+ * be invoked using {@code dyn:call};</li>
+ * <li>expose all public fields as properties, unless there are getters or setters for the properties of the same name;</li>
+ * <li>expose {@code dyn:getLength}, {@code dyn:getElem} and {@code dyn:setElem} on native Java arrays, as well as
+ * {@link java.util.List} and {@link java.util.Map} objects; ({@code dyn:getLength} works on any
+ * {@link java.util.Collection});</li>
+ * <li>expose a virtual property named {@code length} on Java arrays;</li>
+ * <li>expose {@code dyn:new} on instances of {@link StaticClass} as calls to constructors, including those static class
+ * objects that represent Java arrays (their constructors take a single {@code int} parameter representing the length of
+ * the array to create);</li>
+ * <li>expose static methods, fields, and properties of classes in a similar manner to how instance method, fields, and
+ * properties are exposed, on {@link StaticClass} objects.</li>
+ * <li>expose a virtual property named {@code static} on instances of {@link java.lang.Class} to access their
+ * {@link StaticClass}.</li>
+ * </ul>
+ * <p><strong>Overloaded method resolution</strong> is performed automatically for property setters, methods, and
+ * constructors. Additionally, manual overloaded method selection is supported by having a call site specify a name for
+ * a method that contains an explicit signature, i.e. {@code dyn:getMethod:parseInt(String,int)}. You can use
+ * non-qualified class names in such signatures regardless of those classes' packages, they will match any class with
+ * the same non-qualified name. You only have to use a fully qualified class name in case non-qualified class names
+ * would cause selection ambiguity (that is extremely rare).</p>
+ * <p><strong>Variable argument invocation</strong> is handled for both methods and constructors.</p>
+ * <p>Currently, only public fields and methods are supported. Any Lookup objects passed in the
+ * {@link LinkRequest}s are ignored and {@link MethodHandles#publicLookup()} is used instead.</p>
+ *
+ * @author Attila Szegedi
+ */
+public class BeansLinker implements GuardingDynamicLinker {
+    private static final ClassValue<TypeBasedGuardingDynamicLinker> linkers = new ClassValue<TypeBasedGuardingDynamicLinker>() {
+        @Override
+        protected TypeBasedGuardingDynamicLinker computeValue(final Class<?> clazz) {
+            // If ClassValue.put() were public, we could just pre-populate with these known mappings...
+            return
+                clazz == Class.class ? new ClassLinker() :
+                clazz == StaticClass.class ? new StaticClassLinker() :
+                DynamicMethod.class.isAssignableFrom(clazz) ? new DynamicMethodLinker() :
+                new BeanLinker(clazz);
+        }
+    };
+
+    /**
+     * Creates a new POJO linker.
+     */
+    public BeansLinker() {
+    }
+
+    /**
+     * Returns a bean linker for a particular single class. Useful when you need to override or extend the behavior of
+     * linking for some classes in your language runtime's linker, but still want to delegate to the default behavior in
+     * some cases.
+     * @param clazz the class
+     * @return a bean linker for that class
+     */
+    public static TypeBasedGuardingDynamicLinker getLinkerForClass(final Class<?> clazz) {
+        return linkers.get(clazz);
+    }
+
+    /**
+     * Returns true if the object is a Dynalink Java dynamic method.
+     *
+     * @param obj the object we want to test for being a dynamic method
+     * @return true if it is a dynamic method, false otherwise.
+     */
+    public static boolean isDynamicMethod(final Object obj) {
+        return obj instanceof DynamicMethod;
+    }
+
+    /**
+     * Returns true if the object is a Dynalink Java constructor.
+     *
+     * @param obj the object we want to test for being a constructor
+     * @return true if it is a constructor, false otherwise.
+     */
+    public static boolean isDynamicConstructor(final Object obj) {
+        return obj instanceof DynamicMethod && ((DynamicMethod)obj).isConstructor();
+    }
+
+    /**
+     * Return the dynamic method of constructor of the given class and the given signature.
+     * @param clazz the class
+     * @param signature full signature of the constructor
+     * @return DynamicMethod for the constructor
+     */
+    public static Object getConstructorMethod(final Class<?> clazz, final String signature) {
+        return StaticClassLinker.getConstructorMethod(clazz, signature);
+    }
+
+    /**
+     * Returns a collection of names of all readable instance properties of a class.
+     * @param clazz the class
+     * @return a collection of names of all readable instance properties of a class.
+     */
+    public static Collection<String> getReadableInstancePropertyNames(final Class<?> clazz) {
+        final TypeBasedGuardingDynamicLinker linker = getLinkerForClass(clazz);
+        if(linker instanceof BeanLinker) {
+            return ((BeanLinker)linker).getReadablePropertyNames();
+        }
+        return Collections.emptySet();
+    }
+
+    /**
+     * Returns a collection of names of all writable instance properties of a class.
+     * @param clazz the class
+     * @return a collection of names of all writable instance properties of a class.
+     */
+    public static Collection<String> getWritableInstancePropertyNames(final Class<?> clazz) {
+        final TypeBasedGuardingDynamicLinker linker = getLinkerForClass(clazz);
+        if(linker instanceof BeanLinker) {
+            return ((BeanLinker)linker).getWritablePropertyNames();
+        }
+        return Collections.emptySet();
+    }
+
+    /**
+     * Returns a collection of names of all instance methods of a class.
+     * @param clazz the class
+     * @return a collection of names of all instance methods of a class.
+     */
+    public static Collection<String> getInstanceMethodNames(final Class<?> clazz) {
+        final TypeBasedGuardingDynamicLinker linker = getLinkerForClass(clazz);
+        if(linker instanceof BeanLinker) {
+            return ((BeanLinker)linker).getMethodNames();
+        }
+        return Collections.emptySet();
+    }
+
+    /**
+     * Returns a collection of names of all readable static properties of a class.
+     * @param clazz the class
+     * @return a collection of names of all readable static properties of a class.
+     */
+    public static Collection<String> getReadableStaticPropertyNames(final Class<?> clazz) {
+        return StaticClassLinker.getReadableStaticPropertyNames(clazz);
+    }
+
+    /**
+     * Returns a collection of names of all writable static properties of a class.
+     * @param clazz the class
+     * @return a collection of names of all writable static properties of a class.
+     */
+    public static Collection<String> getWritableStaticPropertyNames(final Class<?> clazz) {
+        return StaticClassLinker.getWritableStaticPropertyNames(clazz);
+    }
+
+    /**
+     * Returns a collection of names of all static methods of a class.
+     * @param clazz the class
+     * @return a collection of names of all static methods of a class.
+     */
+    public static Collection<String> getStaticMethodNames(final Class<?> clazz) {
+        return StaticClassLinker.getStaticMethodNames(clazz);
+    }
+
+    @Override
+    public GuardedInvocation getGuardedInvocation(final LinkRequest request, final LinkerServices linkerServices)
+            throws Exception {
+        final CallSiteDescriptor callSiteDescriptor = request.getCallSiteDescriptor();
+        final int l = callSiteDescriptor.getNameTokenCount();
+        // All names conforming to the dynalang MOP should have at least two tokens, the first one being "dyn"
+        if(l < 2 || "dyn" != callSiteDescriptor.getNameToken(CallSiteDescriptor.SCHEME)) {
+            return null;
+        }
+
+        final Object receiver = request.getReceiver();
+        if(receiver == null) {
+            // Can't operate on null
+            return null;
+        }
+        return getLinkerForClass(receiver.getClass()).getGuardedInvocation(request, linkerServices);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/CallerSensitiveDetector.java	Sun Aug 17 15:56:32 2014 +0100
@@ -0,0 +1,148 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file, and Oracle licenses the original version of this file under the BSD
+ * license:
+ */
+/*
+   Copyright 2009-2013 Attila Szegedi
+
+   Licensed under both the Apache License, Version 2.0 (the "Apache License")
+   and the BSD License (the "BSD License"), with licensee being free to
+   choose either of the two at their discretion.
+
+   You may not use this file except in compliance with either the Apache
+   License or the BSD License.
+
+   If you choose to use this file in compliance with the Apache License, the
+   following notice applies to you:
+
+       You may obtain a copy of the Apache License at
+
+           http://www.apache.org/licenses/LICENSE-2.0
+
+       Unless required by applicable law or agreed to in writing, software
+       distributed under the License is distributed on an "AS IS" BASIS,
+       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+       implied. See the License for the specific language governing
+       permissions and limitations under the License.
+
+   If you choose to use this file in compliance with the BSD License, the
+   following notice applies to you:
+
+       Redistribution and use in source and binary forms, with or without
+       modification, are permitted provided that the following conditions are
+       met:
+       * Redistributions of source code must retain the above copyright
+         notice, this list of conditions and the following disclaimer.
+       * Redistributions in binary form must reproduce the above copyright
+         notice, this list of conditions and the following disclaimer in the
+         documentation and/or other materials provided with the distribution.
+       * Neither the name of the copyright holder nor the names of
+         contributors may be used to endorse or promote products derived from
+         this software without specific prior written permission.
+
+       THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+       IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+       TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+       PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER
+       BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+       CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+       SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+       BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+       WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+       OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+       ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+package jdk.internal.dynalink.beans;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.AccessibleObject;
+import sun.reflect.CallerSensitive;
+
+/**
+ * Utility class that determines if a method or constructor is caller sensitive. It actually encapsulates two different
+ * strategies for determining caller sensitivity; a more robust one that works if Dynalink runs as code with access
+ * to {@code sun.reflect} package, and an unprivileged one that is used when Dynalink doesn't have access to that
+ * package. Note that even the unprivileged strategy is ordinarily robust, but it relies on the {@code toString} method
+ * of the annotation. If an attacker were to use a different annotation to spoof the string representation of the
+ * {@code CallerSensitive} annotation, they could designate their own methods as caller sensitive. This however does not
+ * escalate privileges, only causes Dynalink to never cache method handles for such methods, so all it would do would
+ * decrease the performance in linking such methods. In the opposite case when an attacker could trick Dynalink into not
+ * recognizing genuine {@code CallerSensitive} annotations, Dynalink would treat caller sensitive methods as ordinary
+ * methods, and would cache them bound to a zero-privilege delegate as the caller (just what Dynalink did before it
+ * could handle caller-sensitive methods). That would practically render caller-sensitive methods exposed through
+ * Dynalink unusable, but again, can not lead to any privilege escalations. Therefore, even the less robust unprivileged
+ * strategy is safe; the worst thing a successful attack against it can achieve is slight reduction in Dynalink-exposed
+ * functionality or performance.
+ */
+public class CallerSensitiveDetector {
+
+    private static final DetectionStrategy DETECTION_STRATEGY = getDetectionStrategy();
+
+    static boolean isCallerSensitive(final AccessibleObject ao) {
+        return DETECTION_STRATEGY.isCallerSensitive(ao);
+    }
+
+    private static DetectionStrategy getDetectionStrategy() {
+        try {
+            return new PrivilegedDetectionStrategy();
+        } catch(final Throwable t) {
+            return new UnprivilegedDetectionStrategy();
+        }
+    }
+
+    private abstract static class DetectionStrategy {
+        abstract boolean isCallerSensitive(AccessibleObject ao);
+    }
+
+    private static class PrivilegedDetectionStrategy extends DetectionStrategy {
+        private static final Class<? extends Annotation> CALLER_SENSITIVE_ANNOTATION_CLASS = CallerSensitive.class;
+
+        @Override
+        boolean isCallerSensitive(final AccessibleObject ao) {
+            return ao.getAnnotation(CALLER_SENSITIVE_ANNOTATION_CLASS) != null;
+        }
+    }
+
+    private static class UnprivilegedDetectionStrategy extends DetectionStrategy {
+        private static final String CALLER_SENSITIVE_ANNOTATION_STRING = "@sun.reflect.CallerSensitive()";
+
+        @Override
+        boolean isCallerSensitive(final AccessibleObject o) {
+            for(final Annotation a: o.getAnnotations()) {
+                if(String.valueOf(a).equals(CALLER_SENSITIVE_ANNOTATION_STRING)) {
+                    return true;
+                }
+            }
+            return false;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/CallerSensitiveDynamicMethod.java	Sun Aug 17 15:56:32 2014 +0100
@@ -0,0 +1,163 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file, and Oracle licenses the original version of this file under the BSD
+ * license:
+ */
+/*
+   Copyright 2009-2013 Attila Szegedi
+
+   Licensed under both the Apache License, Version 2.0 (the "Apache License")
+   and the BSD License (the "BSD License"), with licensee being free to
+   choose either of the two at their discretion.
+
+   You may not use this file except in compliance with either the Apache
+   License or the BSD License.
+
+   If you choose to use this file in compliance with the Apache License, the
+   following notice applies to you:
+
+       You may obtain a copy of the Apache License at
+
+           http://www.apache.org/licenses/LICENSE-2.0
+
+       Unless required by applicable law or agreed to in writing, software
+       distributed under the License is distributed on an "AS IS" BASIS,
+       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+       implied. See the License for the specific language governing
+       permissions and limitations under the License.
+
+   If you choose to use this file in compliance with the BSD License, the
+   following notice applies to you:
+
+       Redistribution and use in source and binary forms, with or without
+       modification, are permitted provided that the following conditions are
+       met:
+       * Redistributions of source code must retain the above copyright
+         notice, this list of conditions and the following disclaimer.
+       * Redistributions in binary form must reproduce the above copyright
+         notice, this list of conditions and the following disclaimer in the
+         documentation and/or other materials provided with the distribution.
+       * Neither the name of the copyright holder nor the names of
+         contributors may be used to endorse or promote products derived from
+         this software without specific prior written permission.
+
+       THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+       IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+       TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+       PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER
+       BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+       CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+       SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+       BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+       WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+       OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+       ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+package jdk.internal.dynalink.beans;
+
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodType;
+import java.lang.reflect.AccessibleObject;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import jdk.internal.dynalink.support.Lookup;
+
+/**
+ * A dynamic method bound to exactly one Java method or constructor that is caller sensitive. Since the target method is
+ * caller sensitive, it doesn't cache a method handle but rather uses the passed lookup object in
+ * {@link #getTarget(java.lang.invoke.MethodHandles.Lookup)} to unreflect a method handle from the reflective member on
+ * every request.
+ *
+ * @author Attila Szegedi
+ */
+class CallerSensitiveDynamicMethod extends SingleDynamicMethod {
+    // Typed as "AccessibleObject" as it can be either a method or a constructor.
+    // If we were Java8-only, we could use java.lang.reflect.Executable
+    private final AccessibleObject target;
+    private final MethodType type;
+
+    public CallerSensitiveDynamicMethod(final AccessibleObject target) {
+        super(getName(target));
+        this.target = target;
+        this.type = getMethodType(target);
+    }
+
+    private static String getName(final AccessibleObject target) {
+        final Member m = (Member)target;
+        return getMethodNameWithSignature(getMethodType(target), getClassAndMethodName(m.getDeclaringClass(),
+                m.getName()));
+    }
+
+    @Override
+    MethodType getMethodType() {
+        return type;
+    }
+