8197608: MacroAssembler::unimplemented calls global operator new[]
authorthartmann
Wed, 14 Feb 2018 08:23:53 +0100
changeset 48968 8c64b94dca9d
parent 48967 e0d3be81da47
child 48969 7eb296a8ce2c
8197608: MacroAssembler::unimplemented calls global operator new[] Summary: Removed C heap allocation of string buffers. Reviewed-by: kvn, shade
src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp
src/hotspot/cpu/sparc/macroAssembler_sparc.cpp
src/hotspot/cpu/x86/macroAssembler_x86.cpp
--- a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp	Tue Feb 13 23:38:34 2018 +0100
+++ b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp	Wed Feb 14 08:23:53 2018 +0100
@@ -2056,9 +2056,14 @@
 }
 
 void MacroAssembler::unimplemented(const char* what) {
-  char* b = new char[1024];
-  jio_snprintf(b, 1024, "unimplemented: %s", what);
-  stop(b);
+  const char* buf = NULL;
+  {
+    ResourceMark rm;
+    stringStream ss;
+    ss.print("unimplemented: %s", what);
+    buf = code_string(ss.as_string());
+  }
+  stop(buf);
 }
 
 // If a constant does not fit in an immediate field, generate some
--- a/src/hotspot/cpu/sparc/macroAssembler_sparc.cpp	Tue Feb 13 23:38:34 2018 +0100
+++ b/src/hotspot/cpu/sparc/macroAssembler_sparc.cpp	Wed Feb 14 08:23:53 2018 +0100
@@ -1411,9 +1411,14 @@
 
 
 void MacroAssembler::unimplemented(const char* what) {
-  char* b = new char[1024];
-  jio_snprintf(b, 1024, "unimplemented: %s", what);
-  stop(b);
+  const char* buf = NULL;
+  {
+    ResourceMark rm;
+    stringStream ss;
+    ss.print("unimplemented: %s", what);
+    buf = code_string(ss.as_string());
+  }
+  stop(buf);
 }
 
 
--- a/src/hotspot/cpu/x86/macroAssembler_x86.cpp	Tue Feb 13 23:38:34 2018 +0100
+++ b/src/hotspot/cpu/x86/macroAssembler_x86.cpp	Wed Feb 14 08:23:53 2018 +0100
@@ -3660,9 +3660,14 @@
 }
 
 void MacroAssembler::unimplemented(const char* what) {
-  char* b = new char[1024];
-  jio_snprintf(b, 1024, "unimplemented: %s", what);
-  stop(b);
+  const char* buf = NULL;
+  {
+    ResourceMark rm;
+    stringStream ss;
+    ss.print("unimplemented: %s", what);
+    buf = code_string(ss.as_string());
+  }
+  stop(buf);
 }
 
 #ifdef _LP64