@@ -446,10 +446,10 @@ void ErrorContext::details(outputStream* ss, const Method* method) const {
446446}
447447
448448void ErrorContext::reason_details (outputStream* ss) const {
449- streamIndentor si (ss);
450- ss->indent (). print_cr (" Reason:" );
451- streamIndentor si2 (ss);
452- ss-> indent (). print ( " %s " , " " );
449+ StreamAutoIndentor sai (ss, 2 );
450+ ss->print_cr (" Reason:" );
451+
452+ StreamAutoIndentor sai2 (ss, 2 );
453453 switch (_fault) {
454454 case INVALID_BYTECODE:
455455 ss->print (" Error exists in the bytecode" );
@@ -507,7 +507,6 @@ void ErrorContext::reason_details(outputStream* ss) const {
507507
508508void ErrorContext::location_details (outputStream* ss, const Method* method) const {
509509 if (_bci != -1 && method != nullptr ) {
510- streamIndentor si (ss);
511510 const char * bytecode_name = " <invalid>" ;
512511 if (method->validate_bci (_bci) != -1 ) {
513512 Bytecodes::Code code = Bytecodes::code_or_bp_at (method->bcp_from (_bci));
@@ -518,46 +517,51 @@ void ErrorContext::location_details(outputStream* ss, const Method* method) cons
518517 }
519518 }
520519 InstanceKlass* ik = method->method_holder ();
521- ss->indent ().print_cr (" Location:" );
522- streamIndentor si2 (ss);
523- ss->indent ().print_cr (" %s.%s%s @%d: %s" ,
520+
521+ StreamAutoIndentor sai (ss, 2 );
522+ ss->print_cr (" Location:" );
523+
524+ StreamAutoIndentor sai2 (ss, 2 );
525+ ss->print_cr (" %s.%s%s @%d: %s" ,
524526 ik->name ()->as_C_string (), method->name ()->as_C_string (),
525527 method->signature ()->as_C_string (), _bci, bytecode_name);
526528 }
527529}
528530
529531void ErrorContext::frame_details (outputStream* ss) const {
530- streamIndentor si (ss);
532+ StreamAutoIndentor sai (ss, 2 );
531533 if (_type.is_valid () && _type.frame () != nullptr ) {
532- ss->indent (). print_cr (" Current Frame:" );
533- streamIndentor si2 (ss);
534+ ss->print_cr (" Current Frame:" );
535+ StreamAutoIndentor sai2 (ss, 2 );
534536 _type.frame ()->print_on (ss);
535537 }
536538 if (_expected.is_valid () && _expected.frame () != nullptr ) {
537- ss->indent (). print_cr (" Stackmap Frame:" );
538- streamIndentor si2 (ss);
539+ ss->print_cr (" Stackmap Frame:" );
540+ StreamAutoIndentor sai2 (ss, 2 );
539541 _expected.frame ()->print_on (ss);
540542 }
541543}
542544
543545void ErrorContext::bytecode_details (outputStream* ss, const Method* method) const {
544546 if (method != nullptr ) {
545- streamIndentor si (ss);
546- ss->indent ().print_cr (" Bytecode:" );
547- streamIndentor si2 (ss);
547+ StreamAutoIndentor sai (ss, 2 );
548+ ss->print_cr (" Bytecode:" );
549+ StreamAutoIndentor sai2 (ss, 2 );
550+ // TODO: print_data should not indent
548551 ss->print_data (method->code_base (), method->code_size (), false );
549552 }
550553}
551554
552555void ErrorContext::handler_details (outputStream* ss, const Method* method) const {
553556 if (method != nullptr ) {
554- streamIndentor si (ss);
557+ StreamAutoIndentor sai (ss, 2 );
558+
555559 ExceptionTable table (method);
556560 if (table.length () > 0 ) {
557- ss->indent (). print_cr (" Exception Handler Table:" );
558- streamIndentor si2 (ss);
561+ ss->print_cr (" Exception Handler Table:" );
562+ StreamAutoIndentor sai2 (ss, 2 );
559563 for (int i = 0 ; i < table.length (); ++i) {
560- ss->indent (). print_cr (" bci [%d, %d] => handler: %d" , table.start_pc (i),
564+ ss->print_cr (" bci [%d, %d] => handler: %d" , table.start_pc (i),
561565 table.end_pc (i), table.handler_pc (i));
562566 }
563567 }
@@ -566,17 +570,16 @@ void ErrorContext::handler_details(outputStream* ss, const Method* method) const
566570
567571void ErrorContext::stackmap_details (outputStream* ss, const Method* method) const {
568572 if (method != nullptr && method->has_stackmap_table ()) {
569- streamIndentor si (ss);
570- ss->indent (). print_cr (" Stackmap Table:" );
573+ StreamAutoIndentor sai (ss, 2 );
574+ ss->print_cr (" Stackmap Table:" );
571575 Array<u1>* data = method->stackmap_data ();
572576 stack_map_table* sm_table =
573577 stack_map_table::at ((address)data->adr_at (0 ));
574578 stack_map_frame* sm_frame = sm_table->entries ();
575- streamIndentor si2 (ss);
579+ StreamAutoIndentor sai2 (ss, 2 );
576580 int current_offset = -1 ;
577581 address end_of_sm_table = (address)sm_table + method->stackmap_data ()->length ();
578582 for (u2 i = 0 ; i < sm_table->number_of_entries (); ++i) {
579- ss->indent ();
580583 if (!sm_frame->verify ((address)sm_frame, end_of_sm_table)) {
581584 sm_frame->print_truncated (ss, current_offset);
582585 return ;
0 commit comments