old_contents:
package tlc2.tool.distributed;

public aspect RMIMethodMonitorAspect {

	// catch all method calls to RMI methods
	pointcut callToRemoteMethod() :
		   execution(* tlc2.tool.distributed.InternRMI.*(..))
		|| execution(* tlc2.tool.distributed.TLCServerRMI.*(..))
		|| execution(* tlc2.tool.distributed.TLCWorkerRMI.*(..))
		|| execution(* tlc2.tool.distributed.fp.FPSetRMI.*(..))

	before(): (callToRemoteMethod()) {
		RMIMethodMonitor.entering(thisJoinPoint);
	}
}

new_contents:
package tlc2.tool.distributed;

public aspect RMIMethodMonitorAspect {

	// catch all method calls to RMI methods
	pointcut callToRemoteMethod() :
		   execution(* tlc2.tool.distributed.InternRMI.*(..))
		|| execution(* tlc2.tool.distributed.TLCServerRMI.*(..))
		|| execution(* tlc2.tool.distributed.TLCWorkerRMI.*(..))
		|| execution(* tlc2.tool.distributed.fp.FPSetRMI.*(..));

	before(): (callToRemoteMethod()) {
		RMIMethodMonitor.entering(thisJoinPoint);
	}
}

subject: Fix syntax error due to missing semicolon

license: mit


old_contents:
package scala.tools.eclipse.contribution.weaving.jdt.core;

import org.eclipse.jdt.internal.core.util.Util;

/**
 * We override the behaviour of isValidCompilationUnitName() for .scala files.
 * The standard implementation applies Java identifier rules on the prefix of
 * the file name, so that, for example, "package.scala" would not be judged
 * valid. See Issue #3266.
 */
@SuppressWarnings("restriction")
public aspect CompilationUnitNameAspect {

	pointcut isValidCompilationUnitName(String name, String sourceLevel, String complianceLevel):
	    args(name, sourceLevel, complianceLevel) &&
		execution(boolean Util.isValidCompilationUnitName(String, String, String));

	boolean around(String name, String sourceLevel, String complianceLevel):
	    isValidCompilationUnitName(name, sourceLevel, complianceLevel) {
		if (name != null && name.endsWith(".scala"))
			return true;
		else
			return proceed(name, sourceLevel, complianceLevel);
	}
}

new_contents:
package scala.tools.eclipse.contribution.weaving.jdt.core;

import org.eclipse.jdt.internal.core.util.Util;
import org.eclipse.jdt.core.JavaConventions;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jdt.internal.core.JavaModelStatus;

/**
 * We override the behaviour of isValidCompilationUnitName() for .scala files.
 * The standard implementation applies Java identifier rules on the prefix of
 * the file name, so that, for example, "package.scala" would not be judged
 * valid. See Issues #3266, #1000859.
 */
@SuppressWarnings("restriction")
public aspect CompilationUnitNameAspect {

	private static boolean isScalaFileName(String name) {
		return name != null && name.length() > 6 && name.endsWith(".scala");
	}

	pointcut isValidCompilationUnitName(String name, String sourceLevel, String complianceLevel):
	    args(name, sourceLevel, complianceLevel) &&
		execution(boolean Util.isValidCompilationUnitName(String, String, String));

	boolean around(String name, String sourceLevel, String complianceLevel):
	    isValidCompilationUnitName(name, sourceLevel, complianceLevel) {
		if (isScalaFileName(name))
			return true;
		else
			return proceed(name, sourceLevel, complianceLevel);
	}

	pointcut validateCompilationUnitName(String name, String sourceLevel, String complianceLevel):
	    args(name, sourceLevel, complianceLevel) &&
		execution(IStatus JavaConventions.validateCompilationUnitName(String, String, String));

	IStatus around(String name, String sourceLevel, String complianceLevel):
	    validateCompilationUnitName(name, sourceLevel, complianceLevel) {
		if (isScalaFileName(name))
			return JavaModelStatus.VERIFIED_OK;
		else
			return proceed(name, sourceLevel, complianceLevel);
	}
}

subject: Add a 2nd pointcut to handle files named "package.scala".


message: Fix syntax error due to missing semicolon


old_contents:
package edu.brown.cs.systems.retro.aspects.cpu;

import edu.brown.cs.systems.baggage.Baggage;
import edu.brown.cs.systems.baggage.DetachedBaggage;
import edu.brown.cs.systems.retro.resources.CPUTracking;
import edu.brown.cs.systems.retro.resources.Execution;
import edu.brown.cs.systems.retro.throttling.ThrottlingPoint;

/** Intercepts X-Trace API calls in user code. Don't apply these pointcuts to the X-Trace library itself!
 *
 * @author jon */
public aspect XTraceAPICalls {

    before(): call(void Baggage.start(..)) || call(DetachedBaggage Baggage.swap(..)) {
        Execution.CPU.finished(thisJoinPointStaticPart);
    }

    after(): call(void Baggage.start(..)) || call(DetachedBaggage Baggage.swap(..)) || call(* Baggage.join(..)) {
        Execution.CPU.starting(thisJoinPointStaticPart);
    }

    /** Whenever the XTraceContext is cleared, log an event to indicate the end of CPU processing bounds */
    before(): call(* Baggage.stop(..)) || call(* Baggage.discard(..)) {
        Execution.CPU.finished(thisJoinPointStaticPart);
    }

    before(): call(void ThrottlingPoint+.throttle()) {
        CPUTracking.finishTracking(); // finish and log current cycles
    }

    after():  call(void ThrottlingPoint+.throttle()) {
        CPUTracking.startTracking(); // start tracking cycles
    }

}

new_contents:
package edu.brown.cs.systems.retro.aspects.cpu;

import edu.brown.cs.systems.baggage.Baggage;
import edu.brown.cs.systems.baggage.DetachedBaggage;
import edu.brown.cs.systems.retro.resources.CPUTracking;
import edu.brown.cs.systems.retro.resources.Execution;
import edu.brown.cs.systems.retro.throttling.ThrottlingPoint;

/** Intercepts X-Trace API calls in user code. Don't apply these pointcuts to the X-Trace library itself!
 *
 * @author jon */
public aspect XTraceAPICalls {

    before(): call(void Baggage.start(..)) || call(DetachedBaggage Baggage.swap(..)) {
        Execution.CPU.finished(thisJoinPointStaticPart);
    }

    after(): call(void Baggage.start(..)) || call(DetachedBaggage Baggage.swap(..)) {
        Execution.CPU.starting(thisJoinPointStaticPart);
    }

    /** Whenever the XTraceContext is cleared, log an event to indicate the end of CPU processing bounds */
    before(): call(* Baggage.stop(..)) || call(* Baggage.discard(..)) {
        Execution.CPU.finished(thisJoinPointStaticPart);
    }

    before(): call(void ThrottlingPoint+.throttle()) {
        CPUTracking.finishTracking(); // finish and log current cycles
    }

    after():  call(void ThrottlingPoint+.throttle()) {
        CPUTracking.startTracking(); // start tracking cycles
    }

}

subject: Tweak X-Trace API call logging

message: Tweak X-Trace API call logging


old_contents:
import java.util.ArrayList;
import java.util.List;
import mirah.lang.ast.Node;
import mirah.lang.ast.NodeScanner;
import mirah.lang.ast.NodeImpl;

class ChildCollector extends NodeScanner {
  private ArrayList<Node> children = new ArrayList<Node>();

  @Override
  public boolean enterDefault(Node node, Object arg) {
    if (node == arg) {
      return true;
    } else {
      children.add(node);
      return false;
    }
  }

  @Override
  public Object enterNullChild(Object arg){
    children.add(null);
    return null;
  }

  public ArrayList<Node> children() {
    return children;
  }
}

aspect DubyBootsrap {
  declare parents: Node extends duby.lang.compiler.Node;

  public List<Node> NodeImpl.child_nodes() {
    ChildCollector c = new ChildCollector();
    c.scan(this, this);
    return c.children();
  }
}

new_contents:
import java.util.ArrayList;
import java.util.List;
import mirah.lang.ast.Node;
import mirah.lang.ast.NodeScanner;
import mirah.lang.ast.NodeImpl;

/* To compile the new AST with duby extensions:
 * ajc -1.5 -inpath dist/mirah-parser.jar \
 *     -outjar dist/mirah-parser_with_duby.jar \
 *     -classpath ../mirah/javalib/mirah-bootstrap.jar:/Developer/aspectj1.6/lib/aspectjrt.jar \
 *     src/DubyBootstrap.aj
 */

class ChildCollector extends NodeScanner {
  private ArrayList<Node> children = new ArrayList<Node>();

  @Override
  public boolean enterDefault(Node node, Object arg) {
    if (node == arg) {
      return true;
    } else {
      children.add(node);
      return false;
    }
  }

  @Override
  public Object enterNullChild(Object arg){
    children.add(null);
    return null;
  }

  public ArrayList<Node> children() {
    return children;
  }
}

aspect DubyBootsrap {
  declare parents: Node extends duby.lang.compiler.Node;

  public List<Node> NodeImpl.child_nodes() {
    ChildCollector c = new ChildCollector();
    c.scan(this, this);
    return c.children();
  }
}

subject: Add compilation instructions for mirah-parser_with_duby.jar


message:
Fix syntax error due to missing semicolon

git-svn-id: 7acc490bd371dbc82047a939b87dc892fdc31f59@28620 76a6fc44-f60b-0410-a9a8-e67b0e8fc65c


old_contents:
package org.lamport.tla.toolbox.test.threading;

import org.aspectj.lang.annotation.SuppressAjWarnings;

/**
 * The purpose of this advice is to intercept method execution in the backend
 * code - namely all code in the packages tlc2, tla2sany, tla2tex, pcal and util.
 *
 * It notifies the {@link MonitorAdaptor} about the method execution.
 */
public aspect MonitorAspect {

	public MonitorAspect() {
		MonitorAdaptor.setAspect(this);
	}

	// known places where backend call within UI thread are acceptable
	pointcut inFilter() :
		withincode(public boolean org.lamport.tla.toolbox.util.ResourceHelper.isValidSpecName(String));

	// catch all method calls (static and object ones)
	pointcut callToBackend() :
		   execution(* tlc2..*.*(..))
		|| execution(* tla2sany..*.*(..))
		|| execution(* tla2tex..*.*(..))
		|| execution(* pcal..*.*(..))
		|| execution(* util..*.*(..));

	// capture calls to backend, but not within ourself or in filter
	@SuppressAjWarnings
	before(): (callToBackend()
			&& !cflowbelow(callToBackend()) && !cflowbelow(inFilter())) {
		MonitorAdaptor.enter(thisJoinPoint);
	}
}

new_contents:
package org.lamport.tla.toolbox.test.threading;

import org.aspectj.lang.annotation.SuppressAjWarnings;

/**
 * The purpose of this advice is to intercept method execution in the backend
 * code - namely all code in the packages tlc2, tla2sany, tla2tex, pcal and util.
 *
 * It notifies the {@link MonitorAdaptor} about the method execution.
 */
public aspect MonitorAspect {

	public MonitorAspect() {
		MonitorAdaptor.setAspect(this);
	}

	// known places where backend call within UI thread are acceptable
	pointcut inFilter() :
		withincode(public boolean org.lamport.tla.toolbox.util.ResourceHelper.isValidSpecName(String));

	// catch all method calls (static and object ones)
	pointcut callToBackend() :
		   execution(* tlc2..*.*(..))
		|| execution(* tla2sany..*.*(..))
		|| execution(* tla2tex..*.*(..))
		|| execution(* pcal..*.*(..))
		|| execution(* util..*.*(..));

	// capture calls to backend, but not within ourself or in filter
	before(): (callToBackend()
			&& !cflowbelow(callToBackend()) && !cflowbelow(inFilter())) {
		MonitorAdaptor.enter(thisJoinPoint);
	}
}

message:
Remove annotation to remove java5 dependency

git-svn-id: 7acc490bd371dbc82047a939b87dc892fdc31f59@22179 76a6fc44-f60b-0410-a9a8-e67b0e8fc65c


new_contents:
package edu.brown.cs.systems.tracing.aspects;

import edu.brown.cs.systems.baggage.BaggageUtils;

/**
 * Instruments all main methods
 */
public aspect TracingPlaneInit {

    declare precedence: TracingPlaneInit, *;

    before(): execution(public static void main(String[])) {
        BaggageUtils.checkEnvironment(System.getenv());
    }

}

subject: Add aspect to check environment variables for Baggage from main method