< prev index next >

src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JavaAdapterBytecodeGenerator.java

Print this page

        

*** 664,674 **** // Set our local variable index final int globalRestoringRunnableVar = nextLocalVar++; // Load the creatingGlobal object loadField(mv, GLOBAL_FIELD_NAME, SCRIPT_OBJECT_TYPE_DESCRIPTOR); - // stack: [creatingGlobal] SET_GLOBAL.invoke(mv); // stack: [runnable] mv.visitVarInsn(ASTORE, globalRestoringRunnableVar); // stack: [] --- 664,673 ----
*** 725,734 **** --- 724,738 ---- // stack: [hasOwnToString] mv.ifeq(defaultBehavior); } loadField(mv, DELEGATE_FIELD_NAME, SCRIPT_OBJECT_TYPE_DESCRIPTOR); + //For the cases like scripted overridden methods invoked from super constructors get adapter global/delegate fields as null, since we + //cannot set these fields before invoking super constructor better solution is opt out of scripted overridden method if global/delegate fields + //are null and invoke super method instead + mv.ifnull(defaultBehavior); + loadField(mv, DELEGATE_FIELD_NAME, SCRIPT_OBJECT_TYPE_DESCRIPTOR); mv.dup(); // stack: [delegate, delegate] final String encodedName = NameCodec.encode(name); mv.visitInvokeDynamicInsn(encodedName, GET_METHOD_PROPERTY_METHOD_DESCRIPTOR, BOOTSTRAP_HANDLE,
< prev index next >