Skip to content

Commit

Permalink
RVM-174 & RVM-262: Remove ArchitectureSpecific and improve the typing of
Browse files Browse the repository at this point in the history
PPC assembler registers (original changes for both issues by Ian Rogers
for MRP).

This commit contains changes from the following MRP commits:
- codehaus/mrp@eff1aa4
(removal of ArchitectureSpecific)
- codehaus/mrp@4846ffb
(BURS bug fixes and debugging improvements)
- codehaus/mrp@ad42eb0
(update of Eclipse project templates for removal of
ArchitectureSpecific)
- codehaus/mrp@d0561a9
(remove generated.arch.java from the build)
- codehaus/mrp@155f1c2
(bug fixes for PowerPC builds)
- codehaus/mrp@31d1168
(restructure logic in Instruction.isTwoWayBranch())

The following changes have been made with respect to MRP:
- Whitespace cleanup in the PPC assembler (removed some empty lines in
emit* methods)
- added the enums from org.jikesrvm.ppc.RegisterConstants to the PPC
primordials to fix NPE when running class initializers during VM booting
- in contrast to MRP, the int constants in
org.jikesrvm.compilers.opt.regalloc.ppc.PhysicalRegisterConstants have
not been converted to GPRs / FPRs
- the JNI code differs from MRP because the Jikes RVM is still using the
old PPC JNI code
- JavaDoc errors have been fixed
  • Loading branch information
erik-brangs committed Dec 31, 2015
1 parent d031432 commit 81b2b75
Show file tree
Hide file tree
Showing 262 changed files with 8,985 additions and 7,877 deletions.
4 changes: 2 additions & 2 deletions MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/Collection.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
import org.mmtk.plan.CollectorContext;
import org.mmtk.plan.MutatorContext;

import org.jikesrvm.ArchitectureSpecific;
import org.jikesrvm.VM;
import org.jikesrvm.architecture.StackFrameLayout;
import org.jikesrvm.mm.mminterface.MemoryManager;
import org.jikesrvm.mm.mminterface.Selected;
import org.jikesrvm.mm.mminterface.CollectorThread;
Expand Down Expand Up @@ -44,7 +44,7 @@ public class Collection extends org.mmtk.vm.Collection {
@Override
@Interruptible
public void spawnCollectorContext(CollectorContext context) {
byte[] stack = MemoryManager.newStack(ArchitectureSpecific.StackframeLayoutConstants.STACK_SIZE_COLLECTOR);
byte[] stack = MemoryManager.newStack(StackFrameLayout.getStackSizeCollector());
CollectorThread t = new CollectorThread(stack, context);
t.start();
}
Expand Down
28 changes: 14 additions & 14 deletions MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/ScanThread.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@

import static org.jikesrvm.runtime.UnboxedSizeConstants.BYTES_IN_ADDRESS;

import org.jikesrvm.ArchitectureSpecific;
import org.jikesrvm.ArchitectureSpecific.Registers;
import org.jikesrvm.VM;
import org.jikesrvm.architecture.AbstractRegisters;
import org.jikesrvm.architecture.StackFrameLayout;
import org.jikesrvm.classloader.RVMMethod;
import org.jikesrvm.compilers.common.CompiledMethod;
import org.jikesrvm.compilers.common.CompiledMethods;
Expand Down Expand Up @@ -140,8 +140,8 @@ public static void scanThread(RVMThread thread, TraceLocal trace,
}

/* get the gprs associated with this thread */
Registers regs = thread.getContextRegisters();
Address gprs = Magic.objectAsAddress(regs.gprs);
AbstractRegisters regs = thread.getContextRegisters();
Address gprs = Magic.objectAsAddress(regs.getGPRs());

Address ip = regs.getInnermostInstructionAddress();
Address fp = regs.getInnermostFramePointer();
Expand Down Expand Up @@ -201,7 +201,7 @@ private static void scanThread(RVMThread thread, TraceLocal trace,
ScanThread scanner = RVMThread.getCurrentThread().getCollectorThread().getThreadScanner();

/* Expicitly establish the stopping point for this scan (not necessarily the bottom of stack) */
Address sentinalFp = newRootsSufficent && Options.useShortStackScans.getValue() ? thread.getNextUnencounteredFrame() : ArchitectureSpecific.StackframeLayoutConstants.STACKFRAME_SENTINEL_FP;
Address sentinalFp = newRootsSufficent && Options.useShortStackScans.getValue() ? thread.getNextUnencounteredFrame() : StackFrameLayout.getStackFrameSentinelFP();

/* stack trampoline will be freshly reinstalled at end of thread scan */
if (Options.useReturnBarrier.getValue() || Options.useShortStackScans.getValue()) {
Expand Down Expand Up @@ -293,7 +293,7 @@ private void scanThreadInternal(Address gprs, int verbosity, Address sentinelFp)
if (verbosity >= 2) dumpTopFrameInfo(verbosity);

/* scan each frame if a non-empty stack */
if (fp.NE(ArchitectureSpecific.StackframeLayoutConstants.STACKFRAME_SENTINEL_FP)) {
if (fp.NE(StackFrameLayout.getStackFrameSentinelFP())) {
prevFp = Address.zero();
reinstallReturnBarrier = Options.useReturnBarrier.getValue() || Options.useShortStackScans.getValue();
/* At start of loop:
Expand Down Expand Up @@ -331,9 +331,9 @@ private void scanThreadInternal(Address gprs, int verbosity, Address sentinelFp)
* (if it's been marked as obsolete, we are setting its activeOnStackFlag below).
*/
private void getHWExceptionRegisters() {
ArchitectureSpecific.Registers exReg = thread.getExceptionRegisters();
if (processCodeLocations && exReg.inuse) {
Address ip = exReg.ip;
AbstractRegisters exReg = thread.getExceptionRegisters();
if (processCodeLocations && exReg.getInUse()) {
Address ip = exReg.getIP();
CompiledMethod compiledMethod = CompiledMethods.findMethodForInstruction(ip);
if (VM.VerifyAssertions) {
VM._assert(compiledMethod != null);
Expand Down Expand Up @@ -435,7 +435,7 @@ private boolean setUpFrame(int verbosity) {
int compiledMethodId = Magic.getCompiledMethodID(fp);

/* skip "invisible" transition frames generated by reflection and JNI) */
if (compiledMethodId == ArchitectureSpecific.ArchConstants.INVISIBLE_METHOD_ID) {
if (compiledMethodId == StackFrameLayout.getInvisibleMethodID()) {
if (verbosity >= 2) Log.writeln("\n--- METHOD <invisible method>");
return false;
}
Expand Down Expand Up @@ -545,7 +545,7 @@ private void pushFrameIP(ObjectReference code, int verbosity) {
if (prevFp.isZero()) { /* top of stack: IP in thread state */
if (verbosity >= 3) {
Log.write(" t.contextRegisters.ip = ");
Log.writeln(thread.getContextRegisters().ip);
Log.writeln(thread.getContextRegisters().getIP());
Log.write("*t.contextRegisters.iploc = ");
Log.writeln(thread.getContextRegisters().getIPLocation().loadAddress());
}
Expand Down Expand Up @@ -612,9 +612,9 @@ private void assertImmovableInCurrentCollection() {
VM._assert(thread.getJNIEnv() == null || trace.willNotMoveInCurrentCollection(ObjectReference.fromObject(thread.getJNIEnv())));
VM._assert(thread.getJNIEnv() == null || thread.getJNIEnv().refsArray() == null || trace.willNotMoveInCurrentCollection(ObjectReference.fromObject(thread.getJNIEnv().refsArray())));
VM._assert(trace.willNotMoveInCurrentCollection(ObjectReference.fromObject(thread.getContextRegisters())));
VM._assert(trace.willNotMoveInCurrentCollection(ObjectReference.fromObject(thread.getContextRegisters().gprs)));
VM._assert(trace.willNotMoveInCurrentCollection(ObjectReference.fromObject(thread.getContextRegisters().getGPRs())));
VM._assert(trace.willNotMoveInCurrentCollection(ObjectReference.fromObject(thread.getExceptionRegisters())));
VM._assert(trace.willNotMoveInCurrentCollection(ObjectReference.fromObject(thread.getExceptionRegisters().gprs)));
VM._assert(trace.willNotMoveInCurrentCollection(ObjectReference.fromObject(thread.getExceptionRegisters().getGPRs())));
//CHECKSTYLE:ON
}

Expand All @@ -629,7 +629,7 @@ private void dumpTopFrameInfo(int verbosity) {
Log.write(" topFrame = "); Log.writeln(topFrame);
Log.write(" ip = "); Log.writeln(ip);
Log.write(" fp = "); Log.writeln(fp);
Log.write(" registers.ip = "); Log.writeln(thread.getContextRegisters().ip);
Log.write(" registers.ip = "); Log.writeln(thread.getContextRegisters().getIP());
if (verbosity >= 3 && thread.getJNIEnv() != null)
thread.getJNIEnv().dumpJniRefsStack();
}
Expand Down
9 changes: 7 additions & 2 deletions MMTk/ext/vm/jikesrvm/org/jikesrvm/mm/mmtk/TraceInterface.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
*/
package org.jikesrvm.mm.mmtk;

import org.jikesrvm.ArchitectureSpecific;
import org.jikesrvm.VM;
import org.jikesrvm.architecture.ArchConstants;
import org.jikesrvm.architecture.StackFrameLayout;
import org.jikesrvm.classloader.MemberReference;
import org.jikesrvm.classloader.RVMMethod;
import org.jikesrvm.classloader.RVMType;
Expand Down Expand Up @@ -42,7 +43,8 @@
* Class that supports scanning Objects or Arrays for references
* during tracing, handling those references, and computing death times
*/
@Uninterruptible public final class TraceInterface extends org.mmtk.vm.TraceInterface implements ArchitectureSpecific.ArchConstants {
@Uninterruptible
public final class TraceInterface extends org.mmtk.vm.TraceInterface {

/***********************************************************************
*
Expand Down Expand Up @@ -137,6 +139,8 @@ public Address skipOwnFramesAndDump(ObjectReference typeRef) {
Address ip = Magic.getReturnAddressUnchecked(fp);
fp = Magic.getCallerFramePointer(fp);
// This code borrows heavily from RVMThread.dumpStack
final Address STACKFRAME_SENTINEL_FP = StackFrameLayout.getStackFrameSentinelFP();
final int INVISIBLE_METHOD_ID = StackFrameLayout.getInvisibleMethodID();
while (Magic.getCallerFramePointer(fp).NE(STACKFRAME_SENTINEL_FP)) {
compiledMethodID = Magic.getCompiledMethodID(fp);
if (compiledMethodID != INVISIBLE_METHOD_ID) {
Expand Down Expand Up @@ -172,6 +176,7 @@ public Address skipOwnFramesAndDump(ObjectReference typeRef) {
if (!isAllocCall(m.getName().getBytes())) {
BaselineCompiledMethod baseInfo =
(BaselineCompiledMethod)compiledMethod;
final int INSTRUCTION_WIDTH = ArchConstants.getInstructionWidth();
bci = baseInfo.findBytecodeIndexForInstruction(ipOffset.toWord().lsh(INSTRUCTION_WIDTH).toOffset());
break;
}
Expand Down
Loading

0 comments on commit 81b2b75

Please sign in to comment.