code: public static InsnList enterMonitorAndStore(MarkerType markerType, LockVariables lockVars) {
          Validate.notNull(markerType);
          Validate.notNull(lockVars);
  
          Variable lockStateVar = lockVars.getLockStateVar();
          Validate.isTrue(lockStateVar != null);
  
          Type clsType = Type.getType(LOCKSTATE_ENTER_METHOD.getDeclaringClass());
          Type methodType = Type.getType(LOCKSTATE_ENTER_METHOD);
          String clsInternalName = clsType.getInternalName();
          String methodDesc = methodType.getDescriptor();
          String methodName = LOCKSTATE_ENTER_METHOD.getName();
  
          // NOTE: This adds to the lock state AFTER locking.
          return merge(
                  debugMarker(markerType, "Entering monitor and storing"),
                                                                           // [obj]
                  new InsnNode(Opcodes.DUP),                               // [obj, obj]
                  new InsnNode(Opcodes.MONITORENTER),                      // [obj]
                  new VarInsnNode(Opcodes.ALOAD, lockStateVar.getIndex()), // [obj, lockState]
                  new InsnNode(Opcodes.SWAP),                              // [lockState, obj]
                  new MethodInsnNode(Opcodes.INVOKEVIRTUAL,                // []
                          clsInternalName,
                          methodName,
                          methodDesc,
                          false)
          );
      }
docs: Generates instruction to enter a monitor (top item on the stack) and store it in the {@link LockState} object sitting in the
  lockstate variable.
  @param markerType debug marker type
  @param lockVars variables for lock/synchpoint functionality
  @return instructions to enter a monitor and store it in the {@link LockState} object
  @throws NullPointerException if any argument is {@code null}
  @throws IllegalArgumentException if lock variables aren't set (the method doesn't contain any monitorenter/monitorexit instructions)