diff src/share/vm/jvmci/jvmciCodeInstaller.cpp @ 23677:eb166b568645

Merge
author Tom Rodriguez <tom.rodriguez@oracle.com>
date Thu, 09 Jun 2016 18:58:09 -0700
parents f84a5ac3be22 09a536b9233c
children 1b939a613788
line wrap: on
line diff
--- a/src/share/vm/jvmci/jvmciCodeInstaller.cpp	Thu Jun 09 18:57:51 2016 -0700
+++ b/src/share/vm/jvmci/jvmciCodeInstaller.cpp	Thu Jun 09 18:58:09 2016 -0700
@@ -89,7 +89,19 @@
   } else {
     // stack slot
     if (offset % 4 == 0) {
-      return VMRegImpl::stack2reg(offset / 4);
+      VMReg vmReg = VMRegImpl::stack2reg(offset / 4);
+      if (!OopMapValue::legal_vm_reg_name(vmReg)) {
+        // This restriction only applies to VMRegs that are used in OopMap but
+        // since that's the only use of VMRegs it's simplest to put this test
+        // here.  This test should also be equivalent legal_vm_reg_name but JVMCI
+        // clients can use max_oop_map_stack_stack_offset to detect this problem
+        // directly.  The asserts just ensure that the tests are in agreement.
+        assert(offset > JVMCIRuntime::max_oop_map_stack_offset, "illegal VMReg");
+        JVMCI_ERROR_NULL("stack offset %d is too large to be encoded in OopMap (max %d)",
+                         offset, JVMCIRuntime::max_oop_map_stack_offset);
+      }
+      assert(OopMapValue::legal_vm_reg_name(vmReg), "illegal VMReg");
+      return vmReg;
     } else {
       JVMCI_ERROR_NULL("unaligned stack offset %d in oop map", offset);
     }