Skip to content

Commit

Permalink
Update thread model to r15544 of Jikes RVM and various Harmony fixes.…
Browse files Browse the repository at this point in the history
… Not yet fully functional.
  • Loading branch information
Ian Rogers committed Feb 27, 2009
1 parent 6801f60 commit 94a8f7b
Show file tree
Hide file tree
Showing 22 changed files with 239 additions and 796 deletions.
12 changes: 2 additions & 10 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1636,10 +1636,6 @@ Check to make sure all required properties are specified. This includes properti
<equals arg1="${config.include.perfctr}" arg2="true"/>
</condition>

<condition property="syswrap.lib" value="-lsyswrap" else="">
<equals arg1="${include.syswrap}" arg2="true"/>
</condition>

<if>
<conditions>
<equals arg1="${classlib.provider}" arg2="GNU Classpath"/>
Expand All @@ -1651,7 +1647,7 @@ Check to make sure all required properties are specified. This includes properti
<arg path="${build.base}/JikesRVM"/>
<arg value="-L${build.base}"/>
<arg value="-ldl"/>
<arg line="-lrvm ${syswrap.lib}"/>
<arg line="-lrvm"/>
</exec>
</sequential>
</if>
Expand All @@ -1667,7 +1663,7 @@ Check to make sure all required properties are specified. This includes properti
<arg value="-L${build.base}"/>
<arg value="-L${harmony.lib.dir}"/>
<arg value="-ldl"/>
<arg line="-lrvm ${syswrap.lib}"/>
<arg value="-lrvm"/>
<arg value="-lvmi"/>
<arg value="-lhyarchive"/>
<arg value="-lhyprt"/>
Expand Down Expand Up @@ -1765,10 +1761,6 @@ target.jni-suffix=${target.jni-suffix}
</fileset>
</copy>
<copy file="${basedir}/tools/bootImageRunner/rvm.harmony" tofile="${dist.base}/rvm">
<filterset>
<filter token="PRELOAD"
value="${target.dll-prefix}syswrap${target.dll-ext}"/>
</filterset>
</copy>
<chmod file="${dist.base}/rvm" perm="ugo+rx"/>
<copy file="${build.rt.jar}" todir="${dist.base}"/>
Expand Down
1 change: 1 addition & 0 deletions build/primordials/Harmony.txt
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,7 @@ Lorg/apache/harmony/luni/internal/net/www/protocol/file/Handler;
Lorg/apache/harmony/luni/internal/net/www/protocol/file/FileURLConnection;
Lorg/apache/harmony/luni/internal/net/www/protocol/jar/Handler;
Lorg/apache/harmony/luni/internal/net/www/protocol/jar/JarURLConnection;
Lorg/apache/harmony/luni/internal/process/SystemProcess;
Lorg/apache/harmony/luni/internal/nls/Messages;
Lorg/apache/harmony/luni/internal/nls/Messages$1;
Lorg/apache/harmony/luni/platform/AbstractMemorySpy;
Expand Down
4 changes: 2 additions & 2 deletions build/primordials/RVM.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@
[Lorg/jikesrvm/runtime/DynamicLibrary;

[Lorg/jikesrvm/scheduler/RVMThread;
[Lorg/jikesrvm/scheduler/HeavyCondLock;
[Lorg/jikesrvm/scheduler/NoYieldpointsCondLock;
[Lorg/jikesrvm/scheduler/Monitor;
[Lorg/jikesrvm/scheduler/NoYieldpointsMonitor;
[[Lorg/jikesrvm/scheduler/RVMThread;
[Lorg/jikesrvm/scheduler/RVMThread$BlockAdapter;
[[Lorg/jikesrvm/scheduler/RVMThread$BlockAdapter;
Expand Down
50 changes: 25 additions & 25 deletions libraryInterface/Harmony/ASF/src/java/lang/Runtime.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/*
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand Down Expand Up @@ -65,7 +65,7 @@ private Runtime(){
/**
* Execute progArray[0] in a separate platform process The new process
* inherits the environment of the caller.
*
*
* @param progArray the array containing the program to execute as well as
* any arguments to the program.
* @throws java.io.IOException if the program cannot be executed
Expand All @@ -80,7 +80,7 @@ public Process exec(String[] progArray) throws java.io.IOException {
/**
* Execute progArray[0] in a separate platform process The new process uses
* the environment provided in envp
*
*
* @param progArray the array containing the program to execute a well as
* any arguments to the program.
* @param envp the array containing the environment to start the new process
Expand All @@ -97,7 +97,7 @@ public Process exec(String[] progArray, String[] envp) throws java.io.IOExceptio
/**
* Execute progArray[0] in a separate platform process. The new process uses
* the environment provided in envp
*
*
* @param progArray the array containing the program to execute a well as
* any arguments to the program.
* @param envp the array containing the environment to start the new process
Expand Down Expand Up @@ -147,7 +147,7 @@ public Process exec(String prog, String[] envp) throws java.io.IOException {
/**
* Execute prog in a separate platform process The new process uses the
* environment provided in envp
*
*
* @param prog the name of the program to execute
* @param envp the array containing the environment to start the new process
* in.
Expand Down Expand Up @@ -200,7 +200,7 @@ void execShutdownSequence() {
for (Thread hook : hooksList) {
hook.start();
}

for (Thread hook : hooksList) {
while (true){
try {
Expand All @@ -215,7 +215,7 @@ void execShutdownSequence() {
VMState = 2;
// TODO
//FinalizerThread.shutdown(finalizeOnExit);

// Close connections.
if (VM.closeJars) {
JarURLConnection.closeCachedFiles();
Expand All @@ -235,7 +235,7 @@ void execShutdownSequence() {
* Causes the virtual machine to stop running, and the program to exit. If
* runFinalizersOnExit(true) has been invoked, then all finalizers will be
* run first.
*
*
* @param status the return code.
* @throws SecurityException if the running thread is not allowed to cause
* the vm to exit.
Expand All @@ -259,7 +259,7 @@ public void exit(int status) {
/**
* Answers the amount of free memory resources which are available to the
* running program.
*
*
*/
public long freeMemory() {
return MemoryManager.freeMemory().toLong();
Expand All @@ -268,23 +268,23 @@ public long freeMemory() {
/**
* Indicates to the virtual machine that it would be a good time to collect
* available memory. Note that, this is a hint only.
*
*
*/
public void gc() {
VMCommonLibrarySupport.gc();
}

/**
* Return the single Runtime instance
*
*
*/
public static Runtime getRuntime() {
return singleton;
}

/**
* Loads and links the library specified by the argument.
*
*
* @param pathName the absolute (ie: platform dependent) path to the library
* to load
* @throws UnsatisfiedLinkError if the library could not be loaded
Expand Down Expand Up @@ -315,7 +315,7 @@ void load0(String filename, ClassLoader cL, boolean check) throws SecurityExcept

/**
* Loads and links the library specified by the argument.
*
*
* @param libName the name of the library to load
* @throws UnsatisfiedLinkError if the library could not be loaded
* @throws SecurityException if the library was not allowed to be loaded
Expand Down Expand Up @@ -406,7 +406,7 @@ void loadLibrary0(String libname, ClassLoader cL, boolean check) throws Security
/**
* Provides a hint to the virtual machine that it would be useful to attempt
* to perform any outstanding object finalizations.
*
*
*/
public void runFinalization() {
return;
Expand All @@ -416,7 +416,7 @@ public void runFinalization() {
* Ensure that, when the virtual machine is about to exit, all objects are
* finalized. Note that all finalization which occurs when the system is
* exiting is performed after all running threads have been terminated.
*
*
* @param run true means finalize all on exit.
* @deprecated This method is unsafe.
*/
Expand All @@ -434,15 +434,15 @@ public static void runFinalizersOnExit(boolean run) {
/**
* Answers the total amount of memory resources which is available to (or in
* use by) the running program.
*
*
*/
public long totalMemory() {
return MemoryManager.totalMemory().toLong();
}

/**
* Turns the output of debug information for instructions on or off.
*
*
* @param enable if true, turn trace on. false turns trace off.
*/
public void traceInstructions(boolean enable) {
Expand All @@ -451,7 +451,7 @@ public void traceInstructions(boolean enable) {

/**
* Turns the output of debug information for methods on or off.
*
*
* @param enable if true, turn trace on. false turns trace off.
*/
public void traceMethodCalls(boolean enable) {
Expand All @@ -476,7 +476,7 @@ public OutputStream getLocalizedOutputStream(OutputStream stream) {

/**
* Registers a new virtual-machine shutdown hook.
*
*
* @param hook the hook (a Thread) to register
*/
public void addShutdownHook(Thread hook) {
Expand All @@ -487,7 +487,7 @@ public void addShutdownHook(Thread hook) {
// Check hook for null
if (hook == null)
throw new NullPointerException("null is not allowed here");

if (hook.getState() != Thread.State.NEW) {
throw new IllegalArgumentException();
}
Expand All @@ -504,7 +504,7 @@ public void addShutdownHook(Thread hook) {

/**
* De-registers a previously-registered virtual-machine shutdown hook.
*
*
* @param hook the hook (a Thread) to de-register
* @return true if the hook could be de-registered
*/
Expand All @@ -516,7 +516,7 @@ public boolean removeShutdownHook(Thread hook) {
// Check hook for null
if (hook == null)
throw new NullPointerException("null is not allowed here");

if (VMState > 0) {
throw new IllegalStateException();
}
Expand All @@ -528,7 +528,7 @@ public boolean removeShutdownHook(Thread hook) {
/**
* Causes the virtual machine to stop running, and the program to exit.
* Finalizers will not be run first. Shutdown hooks will not be run.
*
*
* @param code
* the return code.
* @throws SecurityException
Expand Down
4 changes: 2 additions & 2 deletions rvm/src/org/jikesrvm/VM.java
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ private static void finishBooting() {

// get pthread_id from OS and store into vm_processor field
//
sysCall.sysPthreadSetupSignalHandling();
RVMThread.getCurrentThread().pthread_id = sysCall.sysPthreadSelf();
sysCall.sysSetupHardwareTrapHandler();
RVMThread.getCurrentThread().pthread_id = sysCall.sysThreadSelf();

// Set up buffer locks used by Thread for logging and status dumping.
// This can happen at any point before we start running
Expand Down
6 changes: 3 additions & 3 deletions rvm/src/org/jikesrvm/mm/mminterface/Barrier.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
package org.jikesrvm.mm.mminterface;

import org.jikesrvm.VM;
import org.jikesrvm.scheduler.HeavyCondLock;
import org.jikesrvm.scheduler.Monitor;
import org.jikesrvm.scheduler.RVMThread;
import org.vmmagic.pragma.Uninterruptible;
import org.vmmagic.pragma.Interruptible;
Expand All @@ -28,15 +28,15 @@
final class Barrier {

public static final int VERBOSE = 0;
private HeavyCondLock lock;
private Monitor lock;
private int target;
private int[] counters=new int[2]; // are two counters enough?
private int[] modes=new int[2];
private int countIdx;
public Barrier() {}
@Interruptible
public void boot(int target) {
lock=new HeavyCondLock();
lock=new Monitor();
this.target=target;
countIdx=0;
}
Expand Down
6 changes: 3 additions & 3 deletions rvm/src/org/jikesrvm/mm/mminterface/Handshake.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import org.jikesrvm.VM;
import org.jikesrvm.mm.mmtk.Collection;
import org.jikesrvm.scheduler.RVMThread;
import org.jikesrvm.scheduler.HeavyCondLock;
import org.jikesrvm.scheduler.Monitor;
import org.vmmagic.pragma.Unpreemptible;
import org.mmtk.plan.Plan;

Expand Down Expand Up @@ -44,7 +44,7 @@ public class Handshake {
*
* Instance variables
*/
private HeavyCondLock lock;
private Monitor lock;
protected boolean requestFlag;
public int gcTrigger; // reason for this GC
private int collectorThreadsParked;
Expand All @@ -53,7 +53,7 @@ public Handshake() {
reset();
}
public void boot() {
lock = new HeavyCondLock();
lock = new Monitor();
}

/**
Expand Down
38 changes: 18 additions & 20 deletions rvm/src/org/jikesrvm/runtime/BootRecord.java
Original file line number Diff line number Diff line change
Expand Up @@ -253,25 +253,23 @@ public void setHeapRange(int id, Address start, Address end) {

// threads
public Address sysNumProcessorsIP;
public Address sysNativeThreadBindSupportedIP;
public Address sysNativeThreadBindIP;
public Address sysNativeThreadCreateIP;
public Address sysSchedYieldIP;
public Address sysPthreadSelfIP;
public Address sysPthreadSetupSignalHandlingIP;
public Address sysPthreadExitIP;
public Address sysStashVmThreadInPthreadIP;
public Address sysTerminatePthreadIP;
// mutexes and conds
public Address sysPthreadMutexCreateIP;
public Address sysPthreadMutexDestroyIP;
public Address sysPthreadMutexLockIP;
public Address sysPthreadMutexUnlockIP;
public Address sysPthreadCondCreateIP;
public Address sysPthreadCondDestroyIP;
public Address sysPthreadCondTimedWaitIP;
public Address sysPthreadCondWaitIP;
public Address sysPthreadCondBroadcastIP;
public Address sysThreadBindSupportedIP;
public Address sysThreadBindIP;
public Address sysThreadCreateIP;
public Address sysThreadYieldIP;
public Address sysThreadSelfIP;
public Address sysSetupHardwareTrapHandlerIP;
public Address sysStashVMThreadIP;
public Address sysThreadTerminateIP;

// monitors
public Address sysMonitorCreateIP;
public Address sysMonitorDestroyIP;
public Address sysMonitorEnterIP;
public Address sysMonitorExitIP;
public Address sysMonitorTimedWaitAbsoluteIP;
public Address sysMonitorWaitIP;
public Address sysMonitorNotifyAllIP;

// arithmetic
@Entrypoint
Expand Down Expand Up @@ -299,7 +297,7 @@ public void setHeapRange(int id, Address start, Address end) {
// time
Address sysCurrentTimeMillisIP;
Address sysNanoTimeIP;
Address sysNanosleepIP;
Address sysNanoSleepIP;

// shared libraries
Address sysDlopenIP;
Expand Down
Loading

0 comments on commit 94a8f7b

Please sign in to comment.