Skip to content

Commit

Permalink
OPTIMUS-36426 export changes from 0bdcd024ac868fcb85c9cb8fc7b62663b95…
Browse files Browse the repository at this point in the history
…ebae4
  • Loading branch information
Optimus Cirrus Developers committed Feb 16, 2023
1 parent 3a506e7 commit bcd35b5
Show file tree
Hide file tree
Showing 42 changed files with 2,257 additions and 500 deletions.
10 changes: 10 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,20 @@
*.scala text eol=lf
*.groovy text eol=lf
*.conf text eol=lf
*.txt text eol=lf
*.proto text eol=lf
*.fbs text eol=lf
*.sql text eol=lf
*.csv text eol=lf
*.xml text eol=lf
*.ksh text eol=lf
*.py text eol=lf

# Similarly for CRLF
*.bat text eol=crlf
*.cmd text eol=crlf
# Perl scripts should always have LF (Unix default) line ending
*.pl text eol=lf
*.pm text eol=lf


Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ object StagingErrors extends OptimusErrorsBase with OptimusPluginAlarmHelper {
warning0(
20013,
StagingPhase.POST_TYPER_STANDARDS,
"[NEW]Suspicious use of implicit Predef.augmentString. Use .toSeq if you really want to treat it as a Seq[Char]. Consider if surrounding code should be a map rather than flatMap. Prefer + rather than ++ for String concatenation."
"Suspicious use of implicit Predef.augmentString. Use .toSeq if you really want to treat it as a Seq[Char]. Consider if surrounding code should be a map rather than flatMap. Prefer + rather than ++ for String concatenation."
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
* Currently tells the DAL reader to intern this value before setting it
*/
/** Currently tells the DAL reader to intern this value before setting it */
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface _intern {}
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,9 @@ object Properties extends KnownProperties {
val numBadBaseline = propI
val numFileReadErrors = propI
val buildNumber = propI

val oldCacheSize = propI
val newCacheSize = propI
}

final case class RequestsStallInfo(pluginType: StallPlugin.Value, reqCount: Int, req: Seq[String]) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
class RedBlackHelper {
private RedBlackHelper() {}

private final static Field treeMapField;
private final static Field treeSetField;
private static final Field treeMapField;
private static final Field treeSetField;

static {
try {
Expand All @@ -37,43 +37,39 @@ private RedBlackHelper() {}
}
}

static <A, B> scala.Option<scala.Tuple2<A, B>> maxBefore(A key, TreeMap<A, B> map) throws IllegalAccessException {
static <A, B> scala.Option<scala.Tuple2<A, B>> maxBefore(A key, TreeMap<A, B> map)
throws IllegalAccessException {
NewRedBlackTree.Tree<A, B> tree = (NewRedBlackTree.Tree<A, B>) treeMapField.get(map);
Ordering<A> ordering = map.ordering();
NewRedBlackTree.Tree<A, B> result = NewRedBlackTree$.MODULE$.maxBefore(tree, key, ordering);
scala.Tuple2<A, B> y = result == null
? null
: new scala.Tuple2<A, B>(result.key(), result.value());
scala.Tuple2<A, B> y =
result == null ? null : new scala.Tuple2<A, B>(result.key(), result.value());
return Option.apply(y);
}

static <A, B> scala.Option<scala.Tuple2<A, B>> minAfter(A key, TreeMap<A, B> map) throws IllegalAccessException {
static <A, B> scala.Option<scala.Tuple2<A, B>> minAfter(A key, TreeMap<A, B> map)
throws IllegalAccessException {
NewRedBlackTree.Tree<A, B> tree = (NewRedBlackTree.Tree<A, B>) treeMapField.get(map);
Ordering<A> ordering = map.ordering();
NewRedBlackTree.Tree<A, B> result = NewRedBlackTree$.MODULE$.minAfter(tree, key, ordering);
scala.Tuple2<A, B> y = result == null
? null
: new scala.Tuple2<A, B>(result.key(), result.value());
scala.Tuple2<A, B> y =
result == null ? null : new scala.Tuple2<A, B>(result.key(), result.value());
return Option.apply(y);
}

static <A> scala.Option<A> maxBefore(A key, TreeSet<A> set) throws IllegalAccessException {
NewRedBlackTree.Tree<A, ?> tree = (NewRedBlackTree.Tree<A, ?>) treeSetField.get(set);
Ordering<A> ordering = set.ordering();
NewRedBlackTree.Tree<A, ?> result = NewRedBlackTree$.MODULE$.maxBefore(tree, key, ordering);
A y = result == null
? null
: result.key();
A y = result == null ? null : result.key();
return Option.apply(y);
}

static <A> scala.Option<A> minAfter(A key, TreeSet<A> set) throws IllegalAccessException {
NewRedBlackTree.Tree<A, ?> tree = (NewRedBlackTree.Tree<A, ?>) treeSetField.get(set);
Ordering<A> ordering = set.ordering();
NewRedBlackTree.Tree<A, ?> result = NewRedBlackTree$.MODULE$.minAfter(tree, key, ordering);
A y = result == null
? null
: result.key();
A y = result == null ? null : result.key();
return Option.apply(y);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
class RedBlackHelper {
private RedBlackHelper() {}

private final static Field treeMapField;
private final static Field treeSetField;
private static final Field treeMapField;
private static final Field treeSetField;

static {
try {
Expand All @@ -37,19 +37,23 @@ private RedBlackHelper() {}
}
}

static <A, B> scala.Option<scala.Tuple2<A, B>> maxBefore(A key, TreeMap<A, B> map) throws IllegalAccessException {
static <A, B> scala.Option<scala.Tuple2<A, B>> maxBefore(A key, TreeMap<A, B> map)
throws IllegalAccessException {
RedBlackTree.Tree<A, B> tree = (RedBlackTree.Tree<A, B>) treeMapField.get(map);
Ordering<A> ordering = map.ordering();
RedBlackTree.Tree<A, B> result = RedBlackTree$.MODULE$.maxBefore(tree, key, ordering);
scala.Tuple2<A, B> y = result == null ? null : new scala.Tuple2<A, B>(result.key(), result.value());
scala.Tuple2<A, B> y =
result == null ? null : new scala.Tuple2<A, B>(result.key(), result.value());
return Option.apply(y);
}

static <A, B> scala.Option<scala.Tuple2<A, B>> minAfter(A key, TreeMap<A, B> map) throws IllegalAccessException {
static <A, B> scala.Option<scala.Tuple2<A, B>> minAfter(A key, TreeMap<A, B> map)
throws IllegalAccessException {
RedBlackTree.Tree<A, B> tree = (RedBlackTree.Tree<A, B>) treeMapField.get(map);
Ordering<A> ordering = map.ordering();
RedBlackTree.Tree<A, B> result = RedBlackTree$.MODULE$.minAfter(tree, key, ordering);
scala.Tuple2<A, B> y = result == null ? null : new scala.Tuple2<A, B>(result.key(), result.value());
scala.Tuple2<A, B> y =
result == null ? null : new scala.Tuple2<A, B>(result.key(), result.value());
return Option.apply(y);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,30 +246,40 @@ public static void prefixCallWithDumpOnTransitivelyCached(String methodToPatch)
/**
* Inject prefix call InstrumentedModuleCtor.trigger in EvaluationContext.current
* Only useful if you also executed markAllModuleCtors
* @see optimus.debug.InstrumentationCmds#markAllModuleCtors()
* @see optimus.debug.InstrumentedModuleCtor#trigger()
* @see optimus.debug.RTVerifierCategory#MODULE_CTOR_EC_CURRENT
* @see optimus.debug.RTVerifierCategory#MODULE_LAZY_VAL_EC_CURRENT
* @see InstrumentationCmds#markAllModuleCtors()
* @see InstrumentedModuleCtor#trigger()
* @see RTVerifierCategory#MODULE_CTOR_EC_CURRENT
* @see RTVerifierCategory#MODULE_LAZY_VAL_EC_CURRENT
*/
public static void prefixECCurrentWithTriggerIfInModuleCtor() {
prefixCall("optimus.graph.OGSchedulerContext.current", "optimus.debug.InstrumentedModuleCtor.trigger");
var moduleCtorTrigger = "optimus.debug.InstrumentedModuleCtor.trigger";
prefixCall("optimus.graph.OGSchedulerContext.current", moduleCtorTrigger);
/* eventually we will detect the methods with an annotation:
prefixCall("optimus.platform.ScenarioStack.getNode", moduleCtorTrigger);
prefixCall("optimus.platform.ScenarioStack.env", moduleCtorTrigger);
prefixCall("optimus.platform.ScenarioStack.getTrackingNodeID", moduleCtorTrigger);
prefixCall("optimus.platform.ScenarioStack.getParentTrackingNode", moduleCtorTrigger);
prefixCall("optimus.platform.ScenarioStack.pluginTags", moduleCtorTrigger);
prefixCall("optimus.platform.ScenarioStack.findPluginTag", moduleCtorTrigger);
*/
}

/**
* When markAllModuleCtors is requested this function allows additions to the exclusion list
* @param className JVM class name of the module
* @see optimus.debug.InstrumentationCmds#markAllModuleCtors()
* @see InstrumentationCmds#markAllModuleCtors()
* @see InstrumentationCmds#markAllEntityCtorsForSIDetection()
*/
public static void excludeModuleFromModuleCtorReporting(String className) {
public static void excludeFromModuleOrEntityCtorReporting(String className) {
var jvmName = className.replace('.', '/');
InstrumentationConfig.addModuleExclusion(jvmName);
InstrumentationConfig.addModuleOrEntityExclusion(jvmName);
}

/**
* When markAllModuleCtors or individual module bracketing is enabled, some call stacks can be disabled
* @param methodToPatch fully specified method reference
* @see optimus.debug.InstrumentationCmds#markAllModuleCtors()
* @see optimus.debug.InstrumentationConfig#addModuleConstructionIntercept
* @see InstrumentationCmds#markAllModuleCtors()
* @see InstrumentationConfig#addModuleConstructionIntercept
*/
public static void excludeMethodFromModuleCtorReporting(String methodToPatch) {
MethodRef mref = asMethodRef(methodToPatch);
Expand All @@ -293,27 +303,27 @@ public static void markScenarioStackAsInitializing(String className) {
* Instrument all entity constructors to call a prefix/postfix methods to mark/unmark entity ctors as running
* @see InstrumentationCmds#reportFindingTweaksInEntityConstructor()
* @see InstrumentationCmds#reportTouchingTweakableInEntityConstructor()
* @see optimus.debug.RTVerifierCategory#TWEAK_IN_ENTITY_CTOR
* @see optimus.debug.RTVerifierCategory#TWEAKABLE_IN_ENTITY_CTOR
* @see RTVerifierCategory#TWEAK_IN_ENTITY_CTOR
* @see RTVerifierCategory#TWEAKABLE_IN_ENTITY_CTOR
*/
public static void markAllEntityCtorsForSIDetection() {
instrumentAllEntities = EntityInstrumentationType.markScenarioStack;
}

/**
* Instrument all module constructors to call a prefix/postfix methods to mark/unmark module ctors as running
* @see optimus.debug.RTVerifierCategory#MODULE_CTOR_EC_CURRENT
* @see optimus.debug.RTVerifierCategory#MODULE_LAZY_VAL_EC_CURRENT
* @see RTVerifierCategory#MODULE_CTOR_EC_CURRENT
* @see RTVerifierCategory#MODULE_LAZY_VAL_EC_CURRENT
*/
public static void markAllModuleCtors() {
instrumentAllModuleConstructors = true;
}

/**
* Instrument all classes that don't implement (and base class doesn't either) their own hashCode.
* Therefore relying on identity hashCodes with calls to optimus.debug.InstrumentedHashCodes#hashCode(java.lang.Object)
* Therefore relying on identity hashCodes with calls to InstrumentedHashCodes#hashCode(java.lang.Object)
* @apiNote Use to flag values that use identity hashCode while being used as a key in property caching
* @see optimus.debug.InstrumentedHashCodes#hashCode(java.lang.Object)
* @see InstrumentedHashCodes#hashCode(java.lang.Object)
*/
public static void reportSuspiciousHashCodesCalls() {
instrumentAllHashCodes = true;
Expand All @@ -322,7 +332,7 @@ public static void reportSuspiciousHashCodesCalls() {
/**
* Instrument callouts and report touching tweakables or entity ctor (which should be RT)
* @see InstrumentationCmds#markAllEntityCtorsForSIDetection()
* @see optimus.debug.RTVerifierCategory#TWEAKABLE_IN_ENTITY_CTOR
* @see RTVerifierCategory#TWEAKABLE_IN_ENTITY_CTOR
*/
public static void reportTouchingTweakableInEntityConstructor() {
InstrumentationConfig.addVerifyScenarioStackCalls();
Expand All @@ -332,7 +342,7 @@ public static void reportTouchingTweakableInEntityConstructor() {
/**
* Instrument callouts and report touching tweaked values or entity ctor (which should be RT)
* @see InstrumentationCmds#markAllEntityCtorsForSIDetection()
* @see optimus.debug.RTVerifierCategory#TWEAK_IN_ENTITY_CTOR
* @see RTVerifierCategory#TWEAK_IN_ENTITY_CTOR
*/
public static void reportFindingTweaksInEntityConstructor() {
InstrumentationConfig.addVerifyScenarioStackCalls();
Expand Down Expand Up @@ -365,7 +375,7 @@ public static void traceSelfAndParentOnException() {
/**
* When traceSelfAndParentOnException or individual exception reporting is enabled, some call stacks can be disabled
* @param methodToPatch fully specified method reference
* @see optimus.debug.InstrumentationCmds#traceSelfAndParentOnException()
* @see InstrumentationCmds#traceSelfAndParentOnException()
*/
public static void excludeMethodFromExceptionReporting(String methodToPatch) {
MethodRef mref = asMethodRef(methodToPatch);
Expand Down
Loading

0 comments on commit bcd35b5

Please sign in to comment.