@@ -59,6 +59,8 @@ static bool must_be_in_vm() {
59
59
}
60
60
#endif // ASSERT
61
61
62
+ bool Dependencies::_verify_in_progress = false ; // don't -Xlog:dependencies
63
+
62
64
void Dependencies::initialize (ciEnv* env) {
63
65
Arena* arena = env->arena ();
64
66
_oop_recorder = env->oop_recorder ();
@@ -638,7 +640,7 @@ Dependencies::DepType Dependencies::validate_dependencies(CompileTask* task, cha
638
640
// resizing in the context of an inner resource mark.
639
641
char * buffer = NEW_RESOURCE_ARRAY (char , O_BUFLEN);
640
642
stringStream st (buffer, O_BUFLEN);
641
- deps.print_dependency (witness, true , &st );
643
+ deps.print_dependency (&st, witness, true );
642
644
*failure_detail = st.as_string ();
643
645
}
644
646
}
@@ -866,7 +868,7 @@ void Dependencies::DepStream::log_dependency(Klass* witness) {
866
868
guarantee (argslen == args->length (), " args array cannot grow inside nested ResoureMark scope" );
867
869
}
868
870
869
- void Dependencies::DepStream::print_dependency (Klass* witness, bool verbose, outputStream* st ) {
871
+ void Dependencies::DepStream::print_dependency (outputStream* st, Klass* witness, bool verbose) {
870
872
ResourceMark rm;
871
873
int nargs = argument_count ();
872
874
GrowableArray<DepArgument>* args = new GrowableArray<DepArgument>(nargs);
@@ -1763,7 +1765,7 @@ Klass* Dependencies::find_unique_concrete_subtype(InstanceKlass* ctxk) {
1763
1765
// Make sure the dependency mechanism will pass this discovery:
1764
1766
if (VerifyDependencies) {
1765
1767
// Turn off dependency tracing while actually testing deps.
1766
- FlagSetting fs (TraceDependencies, false );
1768
+ FlagSetting fs (_verify_in_progress, true );
1767
1769
if (!Dependencies::is_concrete_klass (ctxk)) {
1768
1770
guarantee (nullptr == (void *)
1769
1771
check_abstract_with_unique_concrete_subtype (ctxk, conck),
@@ -2058,9 +2060,12 @@ Klass* Dependencies::check_call_site_target_value(oop call_site, oop method_hand
2058
2060
}
2059
2061
2060
2062
void Dependencies::DepStream::trace_and_log_witness (Klass* witness) {
2063
+ if (_verify_in_progress) return ; // don't log
2061
2064
if (witness != nullptr ) {
2062
- if (TraceDependencies) {
2063
- print_dependency (witness, /* verbose=*/ true );
2065
+ LogTarget (Debug, dependencies) lt;
2066
+ if (lt.is_enabled ()) {
2067
+ LogStream ls (<);
2068
+ print_dependency (&ls, witness, /* verbose=*/ true );
2064
2069
}
2065
2070
// The following is a no-op unless logging is enabled:
2066
2071
log_dependency (witness);
@@ -2170,34 +2175,36 @@ Klass* Dependencies::DepStream::spot_check_dependency_at(DepChange& changes) {
2170
2175
}
2171
2176
2172
2177
2173
- void DepChange::print () {
2178
+ void DepChange::print () { print_on (tty); }
2179
+
2180
+ void DepChange::print_on (outputStream* st) {
2174
2181
int nsup = 0 , nint = 0 ;
2175
2182
for (ContextStream str (*this ); str.next (); ) {
2176
2183
InstanceKlass* k = str.klass ();
2177
2184
switch (str.change_type ()) {
2178
2185
case Change_new_type:
2179
- tty ->print_cr (" dependee = %s" , k->external_name ());
2186
+ st ->print_cr (" dependee = %s" , k->external_name ());
2180
2187
break ;
2181
2188
case Change_new_sub:
2182
2189
if (!WizardMode) {
2183
2190
++nsup;
2184
2191
} else {
2185
- tty ->print_cr (" context super = %s" , k->external_name ());
2192
+ st ->print_cr (" context super = %s" , k->external_name ());
2186
2193
}
2187
2194
break ;
2188
2195
case Change_new_impl:
2189
2196
if (!WizardMode) {
2190
2197
++nint;
2191
2198
} else {
2192
- tty ->print_cr (" context interface = %s" , k->external_name ());
2199
+ st ->print_cr (" context interface = %s" , k->external_name ());
2193
2200
}
2194
2201
break ;
2195
2202
default :
2196
2203
break ;
2197
2204
}
2198
2205
}
2199
2206
if (nsup + nint != 0 ) {
2200
- tty ->print_cr (" context supers = %d, interfaces = %d" , nsup, nint);
2207
+ st ->print_cr (" context supers = %d, interfaces = %d" , nsup, nint);
2201
2208
}
2202
2209
}
2203
2210
0 commit comments