diff src/cpu/x86/vm/x86_32.ad @ 4114:6729bbc1fcd6

7003454: order constants in constant table by number of references in code Reviewed-by: kvn, never, bdelsart
author twisti
date Wed, 16 Nov 2011 01:39:50 -0800
parents d8cb48376797
children db2e64ca2d5a
line wrap: on
line diff
--- a/src/cpu/x86/vm/x86_32.ad	Mon Nov 14 18:38:03 2011 -0800
+++ b/src/cpu/x86/vm/x86_32.ad	Wed Nov 16 01:39:50 2011 -0800
@@ -507,9 +507,12 @@
 
 
 //=============================================================================
-const bool Matcher::constant_table_absolute_addressing = true;
 const RegMask& MachConstantBaseNode::_out_RegMask = RegMask::Empty;
 
+int Compile::ConstantTable::calculate_table_base_offset() const {
+  return 0;  // absolute addressing, no offset
+}
+
 void MachConstantBaseNode::emit(CodeBuffer& cbuf, PhaseRegAlloc* ra_) const {
   // Empty encoding
 }
@@ -639,6 +642,12 @@
   }
 #endif
 
+  if (C->has_mach_constant_base_node()) {
+    // NOTE: We set the table base offset here because users might be
+    // emitted before MachConstantBaseNode.
+    Compile::ConstantTable& constant_table = C->constant_table();
+    constant_table.set_table_base_offset(constant_table.calculate_table_base_offset());
+  }
 }
 
 uint MachPrologNode::size(PhaseRegAlloc *ra_) const {