001/*
002 *  This file is part of the Jikes RVM project (http://jikesrvm.org).
003 *
004 *  This file is licensed to You under the Eclipse Public License (EPL);
005 *  You may not use this file except in compliance with the License. You
006 *  may obtain a copy of the License at
007 *
008 *      http://www.opensource.org/licenses/eclipse-1.0.php
009 *
010 *  See the COPYRIGHT.txt file distributed with this work for information
011 *  regarding copyright ownership.
012 */
013package org.jikesrvm.compilers.opt.runtimesupport;
014
015import org.jikesrvm.scheduler.RVMThread;
016import org.vmmagic.pragma.Uninterruptible;
017
018/**
019 * A visitor that is used to request synchronization of processor caches
020 * after code patching has taken place.
021 * <p>
022 * Garbage collection threads are exempt from the need to respond to soft
023 * handshakes in the current implementation. This is safe because garbage
024 * collection threads will never be executing code that is subject to code
025 * patching. (We don't allow speculative optimization of uninterruptible code).
026 */
027@Uninterruptible
028class CodePatchSyncRequestVisitor extends RVMThread.SoftHandshakeVisitor {
029
030  /**
031   * Signals the given thread to sync for code patching.
032   * @return {@code true} because this visitor is interested in all
033   *  mutator threads
034   */
035  @Override
036  public boolean checkAndSignal(RVMThread t) {
037    t.codePatchSyncRequested = true;
038    return true;
039  }
040
041}