001 /* 002 * This file is part of the Jikes RVM project (http://jikesrvm.org). 003 * 004 * This file is licensed to You under the Eclipse Public License (EPL); 005 * You may not use this file except in compliance with the License. You 006 * may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/eclipse-1.0.php 009 * 010 * See the COPYRIGHT.txt file distributed with this work for information 011 * regarding copyright ownership. 012 */ 013 package org.jikesrvm.compilers.common; 014 015 import org.jikesrvm.ArchitectureSpecific; 016 import org.jikesrvm.SizeConstants; 017 import org.jikesrvm.mm.mminterface.GCMapIterator; 018 import org.jikesrvm.runtime.Magic; 019 import org.vmmagic.pragma.Uninterruptible; 020 import org.vmmagic.unboxed.Address; 021 import org.vmmagic.unboxed.Offset; 022 import org.vmmagic.unboxed.WordArray; 023 024 /** 025 * Iterator for stack frames inserted by hardware trap handler. 026 * Such frames are purely used as markers. 027 * They contain no object references or JSR return addresses. 028 */ 029 @Uninterruptible 030 public final class HardwareTrapGCMapIterator extends GCMapIterator implements SizeConstants { 031 032 public HardwareTrapGCMapIterator(WordArray registerLocations) { 033 this.registerLocations = registerLocations; 034 } 035 036 @Override 037 public void setupIterator(CompiledMethod compiledMethod, Offset instructionOffset, Address framePtr) { 038 this.framePtr = framePtr; 039 } 040 041 @Override 042 public Address getNextReferenceAddress() { 043 // update register locations, noting that the trap handler represented by this stackframe 044 // saved all registers into the thread's "exceptionRegisters" object 045 // 046 Address registerLocation = Magic.objectAsAddress(thread.getExceptionRegisters().gprs); 047 for (int i = 0; i < ArchitectureSpecific.ArchConstants.NUM_GPRS; ++i) { 048 registerLocations.set(i, registerLocation.toWord()); 049 registerLocation = registerLocation.plus(BYTES_IN_ADDRESS); 050 } 051 return Address.zero(); 052 } 053 054 @Override 055 public Address getNextReturnAddressAddress() { 056 return Address.zero(); 057 } 058 059 @Override 060 public void reset() {} 061 062 @Override 063 public void cleanupPointers() {} 064 065 @Override 066 public int getType() { 067 return CompiledMethod.TRAP; 068 } 069 }