< prev index next >

src/hotspot/cpu/aarch64/immediate_aarch64.cpp

Print this page
rev 60625 : 8248676: AArch64: Add workaround for LITable constructor
Reviewed-by: aph
Contributed-by: mbeckwit, luhenry, burban
rev 60629 : 8248656: Add Windows AArch64 platform support code
Reviewed-by:
Contributed-by: mbeckwit, luhenry, burban

@@ -22,10 +22,13 @@
  *
  */
 
 #include <stdlib.h>
 #include <stdint.h>
+
+#include "precompiled.hpp"
+#include "utilities/globalDefinitions.hpp"
 #include "immediate_aarch64.hpp"
 
 // there are at most 2^13 possible logical immediate encodings
 // however, some combinations of immr and imms are invalid
 static const unsigned  LI_TABLE_SIZE = (1 << 13);

@@ -242,11 +245,14 @@
   return 1;
 }
 
 // constructor to initialise the lookup tables
 
-static void initLITables() __attribute__ ((constructor));
+static void initLITables();
+// Use an empty struct with a construtor as MSVC doesn't support `__attribute__ ((constructor))`
+// See https://stackoverflow.com/questions/1113409/attribute-constructor-equivalent-in-vc
+static struct initLITables_t { initLITables_t(void) { initLITables(); } } _initLITables;
 static void initLITables()
 {
   li_table_entry_count = 0;
   for (unsigned index = 0; index < LI_TABLE_SIZE; index++) {
     uint32_t N = uimm(index, 12, 12);
< prev index next >