diff --git a/backends/crd_doc/templates/crd.adoc.erb b/backends/crd_doc/templates/crd.adoc.erb index cb74d37f..78768ad0 100644 --- a/backends/crd_doc/templates/crd.adoc.erb +++ b/backends/crd_doc/templates/crd.adoc.erb @@ -455,20 +455,18 @@ RV64:: ==== Exceptions -// TODO: add back after sym table update for generic arch def is merged in profiles branch -<%# -<% exception_list = inst.reachable_exceptions_str(crd.arch_def.symtab) -% > -<% if exception_list.empty? -% > +<%- exception_list = inst.reachable_exceptions_str(crd.arch_def.symtab) -%> +<%- if exception_list.empty? -%> This instruction does not generate synchronous exceptions. -<% else -% > +<%- else -%> This instruction may result in the following synchronous exceptions: - <% exception_list.sort.each do |etype| -% > - * <%= etype % > - <% end -% > + <%- exception_list.sort.each do |etype| -%> + * <%= etype %> + <%- end -%> + +<%- end -%> -<% end -% > -%> <% end -%> diff --git a/backends/manual/templates/instruction.adoc.erb b/backends/manual/templates/instruction.adoc.erb index 030b1a60..9a533540 100644 --- a/backends/manual/templates/instruction.adoc.erb +++ b/backends/manual/templates/instruction.adoc.erb @@ -108,8 +108,7 @@ RV64:: ---- <%- end -%> -<%# exception_list = inst.reachable_exceptions_str(inst.arch_def.sym_table_64, 64) -%> -<%- exception_list = [] -%> +<% exception_list = inst.reachable_exceptions_str(inst.arch_def.symtab, 64) -%> <%- unless exception_list.empty? -%> == Exceptions diff --git a/backends/profile_doc/templates/profile_pdf.adoc.erb b/backends/profile_doc/templates/profile_pdf.adoc.erb index ffe1f313..4d03f12b 100644 --- a/backends/profile_doc/templates/profile_pdf.adoc.erb +++ b/backends/profile_doc/templates/profile_pdf.adoc.erb @@ -618,20 +618,17 @@ RV64:: ==== Exceptions -// TODO: add back after sym table update for generic arch def is merged in profiles branch -<%# -<%- exception_list = inst.reachable_exceptions_str(arch_def.symtab) -% > -<%- if exception_list.empty? -% > +<%- exception_list = inst.reachable_exceptions_str(arch_def.symtab) -%> +<%- if exception_list.empty? -%> This instruction does not generate synchronous exceptions. -<%- else -% > +<%- else -%> This instruction may result in the following synchronous exceptions: - <%- exception_list.sort.each do |etype| -% > - * <%= etype % > - <%- end -% > + <%- exception_list.sort.each do |etype| -%> + * <%= etype %> + <%- end -%> -<%- end -% > -%> +<%- end -%> <%- end -%> diff --git a/lib/arch_obj_models/instruction.rb b/lib/arch_obj_models/instruction.rb index 9b9fa007..1779b959 100644 --- a/lib/arch_obj_models/instruction.rb +++ b/lib/arch_obj_models/instruction.rb @@ -160,7 +160,6 @@ def reachable_exceptions_str(symtab, effective_xlen=nil) if @data["operation()"].nil? [] else - # RubyProf.start etype = symtab.get("ExceptionCode") if effective_xlen.nil? if symtab.archdef.multi_xlen? @@ -174,21 +173,18 @@ def reachable_exceptions_str(symtab, effective_xlen=nil) puts "done" pruned_ast = pruned_operation_ast(symtab, 64) print "Determining reachable exceptions from #{name}#RV64..." - e64 = mask_to_array(prunted_ast.reachable_exceptions(fill_symtab(symtab, 64, pruned_ast))).map { |code| + e64 = mask_to_array(pruned_ast.reachable_exceptions(fill_symtab(symtab, 64, pruned_ast))).map { |code| etype.element_name(code) } - puts done + puts "done" e32 + e64 ).uniq else pruned_ast = pruned_operation_ast(symtab, base) print "Determining reachable exceptions from #{name}..." - result = RubyProf.profile do - e = mask_to_array(pruned_ast.reachable_exceptions(fill_symtab(symtab, base, pruned_ast))).map { |code| - etype.element_name(code) - } - end - RubyProf::CallStackPrinter.new(result).print(File.open("#{name}-profile.html", "w+"), {}) + e = mask_to_array(pruned_ast.reachable_exceptions(fill_symtab(symtab, base, pruned_ast))).map { |code| + etype.element_name(code) + } puts "done" e end @@ -196,12 +192,9 @@ def reachable_exceptions_str(symtab, effective_xlen=nil) effective_xlen = symtab.archdef.mxlen pruned_ast = pruned_operation_ast(symtab, effective_xlen) print "Determining reachable exceptions from #{name}..." - # result = RubyProf.profile do - e = mask_to_array(pruned_ast.reachable_exceptions(fill_symtab(symtab, effective_xlen, pruned_ast))).map { |code| - etype.element_name(code) - } - # end - # RubyProf::FlameGraphPrinter.new(result).print(File.open("#{name}-profile.html", "w+"), {}) + e = mask_to_array(pruned_ast.reachable_exceptions(fill_symtab(symtab, effective_xlen, pruned_ast))).map { |code| + etype.element_name(code) + } puts "done" e end @@ -209,14 +202,12 @@ def reachable_exceptions_str(symtab, effective_xlen=nil) pruned_ast = pruned_operation_ast(symtab, effective_xlen) print "Determining reachable exceptions from #{name}..." - e = mask_to_array(prunted_ast.reachable_exceptions(fill_symtab(symtab, effective_xlen, pruned_ast))).map { |code| + e = mask_to_array(pruned_ast.reachable_exceptions(fill_symtab(symtab, effective_xlen, pruned_ast))).map { |code| etype.element_name(code) } puts "done" e end - # result = RubyProf.stop - # RubyProf::FlatPrinter.new(result).print(STDOUT) end end