Mercurial > hg > graal-jvmci-8
diff src/share/vm/jvmci/jvmciCodeInstaller.cpp @ 23674:09a536b9233c
8158850: [JVMCI] be more precise when enforcing OopMapValue encoding limitations
author | Tom Rodriguez <tom.rodriguez@oracle.com> |
---|---|
date | Thu, 09 Jun 2016 18:45:12 -0700 |
parents | 9ed5b586018b |
children | eb166b568645 |
line wrap: on
line diff
--- a/src/share/vm/jvmci/jvmciCodeInstaller.cpp Tue Jun 07 17:45:03 2016 -0700 +++ b/src/share/vm/jvmci/jvmciCodeInstaller.cpp Thu Jun 09 18:45:12 2016 -0700 @@ -85,7 +85,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); }